From f851d453dcccdf029f5cda6f90c34561cc116236 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Thu, 11 Jun 2015 19:30:02 +0300 Subject: MAINT-5269 FIXED Viewer crashes if you open Help -> About Second Life while a group member list is loading. --- indra/newview/llfloaterabout.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloaterabout.cpp') diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index b342d8fdf3..e71daa6067 100755 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -289,15 +289,11 @@ void LLServerReleaseNotesURLFetcher::httpCompleted() LL_DEBUGS("ServerReleaseNotes") << dumpResponse() << " [headers:" << getResponseHeaders() << "]" << LL_ENDL; - LLFloaterAbout* floater_about = LLFloaterReg::getTypedInstance("sl_about"); - if (floater_about) + std::string location = getResponseHeader(HTTP_IN_HEADER_LOCATION); + if (location.empty()) { - std::string location = getResponseHeader(HTTP_IN_HEADER_LOCATION); - if (location.empty()) - { - location = LLTrans::getString("ErrorFetchingServerReleaseNotesURL"); - } - LLAppViewer::instance()->setServerReleaseNotesURL(location); + location = LLTrans::getString("ErrorFetchingServerReleaseNotesURL"); } + LLAppViewer::instance()->setServerReleaseNotesURL(location); } -- cgit v1.2.3 From 9790ec0c753b54d5ab0c7e6c54139888f49107e3 Mon Sep 17 00:00:00 2001 From: andreykproductengine Date: Tue, 7 Jul 2015 18:51:19 +0300 Subject: MAINT-5174 Add Check for Updates feature to Help menu --- indra/newview/llfloaterabout.cpp | 93 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 92 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloaterabout.cpp') diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index e71daa6067..d88a869d60 100755 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -34,10 +34,12 @@ // Viewer includes #include "llagent.h" #include "llagentui.h" -#include "llappviewer.h" +#include "llappviewer.h" +#include "llnotificationsutil.h" #include "llslurl.h" #include "llvoiceclient.h" #include "lluictrlfactory.h" +#include "llupdaterservice.h" #include "llviewertexteditor.h" #include "llviewercontrol.h" #include "llviewerstats.h" @@ -99,9 +101,23 @@ public: /// separated so that we can programmatically access the same info. static LLSD getInfo(); void onClickCopyToClipboard(); + void onClickUpdateCheck(); + + // checks state of updater service and starts a check outside of schedule. + // subscribes callback for closest state update + static void setUpdateListener(); private: void setSupportText(const std::string& server_release_notes_url); + + // notifications for user requested checks + static void LLFloaterAbout::showCheckUpdateNotification(S32 state); + + // callback method for manual checks + static bool LLFloaterAbout::callbackCheckUpdate(LLSD const & event); + + // listener name for update checks + static const std::string LLFloaterAbout::sCheckUpdateListenerName; }; @@ -132,6 +148,9 @@ BOOL LLFloaterAbout::postBuild() getChild("copy_btn")->setCommitCallback( boost::bind(&LLFloaterAbout::onClickCopyToClipboard, this)); + getChild("update_btn")->setCommitCallback( + boost::bind(&LLFloaterAbout::onClickUpdateCheck, this)); + static const LLUIColor about_color = LLUIColorTable::instance().getColor("TextFgReadOnlyColor"); if (gAgent.getRegion()) @@ -235,6 +254,11 @@ void LLFloaterAbout::onClickCopyToClipboard() support_widget->deselect(); } +void LLFloaterAbout::onClickUpdateCheck() +{ + setUpdateListener(); +} + void LLFloaterAbout::setSupportText(const std::string& server_release_notes_url) { #if LL_WINDOWS @@ -255,6 +279,68 @@ void LLFloaterAbout::setSupportText(const std::string& server_release_notes_url) FALSE, LLStyle::Params() .color(about_color)); } +///---------------------------------------------------------------------------- +/// Floater About Update-check related functions +///---------------------------------------------------------------------------- + +const std::string LLFloaterAbout::sCheckUpdateListenerName = "LLUpdateNotificationListener"; + +void LLFloaterAbout::showCheckUpdateNotification(S32 state) +{ + switch (state) + { + case LLUpdaterService::UP_TO_DATE: + LLNotificationsUtil::add("UpdateViewerUpToDate"); + break; + case LLUpdaterService::DOWNLOADING: + case LLUpdaterService::INSTALLING: + LLNotificationsUtil::add("UpdateDownloadInProgress"); + break; + case LLUpdaterService::TERMINAL: + // download complete, user triggered check after download pop-up appeared + LLNotificationsUtil::add("UpdateDownloadComplete"); + break; + default: + LLNotificationsUtil::add("UpdateCheckError"); + break; + } +} + +bool LLFloaterAbout::callbackCheckUpdate(LLSD const & event) +{ + if (!event.has("payload")) + { + return false; + } + + LLSD payload = event["payload"]; + if (payload.has("type") && payload["type"].asInteger() == LLUpdaterService::STATE_CHANGE) + { + LLEventPumps::instance().obtain("mainlooprepeater").stopListening(sCheckUpdateListenerName); + showCheckUpdateNotification(payload["state"].asInteger()); + } + return false; +} + +void LLFloaterAbout::setUpdateListener() +{ + LLUpdaterService update_service; + S32 service_state = update_service.getState(); + // Note: Do not set state listener before forceCheck() since it set's new state + if (update_service.forceCheck() || service_state == LLUpdaterService::CHECKING_FOR_UPDATE) + { + LLEventPump& mainloop(LLEventPumps::instance().obtain("mainlooprepeater")); + if (mainloop.getListener(sCheckUpdateListenerName) == LLBoundListener()) // dummy listener + { + mainloop.listen(sCheckUpdateListenerName, boost::bind(&callbackCheckUpdate, _1)); + } + } + else + { + showCheckUpdateNotification(service_state); + } +} + ///---------------------------------------------------------------------------- /// LLFloaterAboutUtil ///---------------------------------------------------------------------------- @@ -265,6 +351,11 @@ void LLFloaterAboutUtil::registerFloater() } +void LLFloaterAboutUtil::checkUpdatesAndNotify() +{ + LLFloaterAbout::setUpdateListener(); +} + ///---------------------------------------------------------------------------- /// Class LLServerReleaseNotesURLFetcher implementation ///---------------------------------------------------------------------------- -- cgit v1.2.3 From c7328a348feb7eae0d35e97ec3fdca6e1d72c2e4 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Mon, 13 Jul 2015 16:58:41 +0300 Subject: build fix for linux --- indra/newview/llfloaterabout.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloaterabout.cpp') diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index d88a869d60..c5d637d1fc 100755 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -111,13 +111,13 @@ private: void setSupportText(const std::string& server_release_notes_url); // notifications for user requested checks - static void LLFloaterAbout::showCheckUpdateNotification(S32 state); + static void showCheckUpdateNotification(S32 state); // callback method for manual checks - static bool LLFloaterAbout::callbackCheckUpdate(LLSD const & event); + static bool callbackCheckUpdate(LLSD const & event); // listener name for update checks - static const std::string LLFloaterAbout::sCheckUpdateListenerName; + static const std::string sCheckUpdateListenerName; }; -- cgit v1.2.3