From c8c143e7741d2b93b589d770b64c265228293564 Mon Sep 17 00:00:00 2001 From: Glenn Glazer Date: Thu, 18 Aug 2016 13:05:30 -0700 Subject: SL-323: first pass at ripping out old updater --- indra/newview/llfloaterabout.cpp | 83 ---------------------------------------- 1 file changed, 83 deletions(-) (limited to 'indra/newview/llfloaterabout.cpp') diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index bababca652..0d262e73ef 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -39,7 +39,6 @@ #include "llslurl.h" #include "llvoiceclient.h" #include "lluictrlfactory.h" -#include "llupdaterservice.h" #include "llviewertexteditor.h" #include "llviewercontrol.h" #include "llviewerstats.h" @@ -91,10 +90,6 @@ public: 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); @@ -103,9 +98,6 @@ private: // callback method for manual checks static bool callbackCheckUpdate(LLSD const & event); - - // listener name for update checks - static const std::string sCheckUpdateListenerName; static void startFetchServerReleaseNotes(); static void handleServerReleaseNotes(LLSD results); @@ -139,9 +131,6 @@ 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()) @@ -289,11 +278,6 @@ void LLFloaterAbout::onClickCopyToClipboard() support_widget->deselect(); } -void LLFloaterAbout::onClickUpdateCheck() -{ - setUpdateListener(); -} - void LLFloaterAbout::setSupportText(const std::string& server_release_notes_url) { #if LL_WINDOWS @@ -314,68 +298,6 @@ 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 ///---------------------------------------------------------------------------- @@ -386,8 +308,3 @@ void LLFloaterAboutUtil::registerFloater() } -void LLFloaterAboutUtil::checkUpdatesAndNotify() -{ - LLFloaterAbout::setUpdateListener(); -} - -- cgit v1.2.3 From c417b2637a866fb4f47bd60c201cdf24d060251e Mon Sep 17 00:00:00 2001 From: Glenn Glazer Date: Wed, 29 Mar 2017 13:13:26 -0700 Subject: SL-323: cherry pick menu changes lost in v64 merge, viewer-management-process-sl-321 rev 36267 --- indra/newview/llfloaterabout.cpp | 96 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) (limited to 'indra/newview/llfloaterabout.cpp') diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index de2d595fb1..1b85f645e8 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -62,6 +62,7 @@ #include "llsdutil_math.h" #include "lleventapi.h" #include "llcorehttputil.h" +#include "lldir.h" #if LL_WINDOWS #include "lldxhardware.h" @@ -89,6 +90,7 @@ public: static LLSD getInfo(); void onClickCopyToClipboard(); void onClickUpdateCheck(); + void setUpdateListener(); private: void setSupportText(const std::string& server_release_notes_url); @@ -98,6 +100,9 @@ private: // callback method for manual checks static bool callbackCheckUpdate(LLSD const & event); + + // listener name for update checks + static const std::string sCheckUpdateListenerName; static void startFetchServerReleaseNotes(); static void fetchServerReleaseNotesCoro(const std::string& cap_url); @@ -131,6 +136,9 @@ BOOL LLFloaterAbout::postBuild() getChild("copy_btn")->setCommitCallback( boost::bind(&LLFloaterAbout::onClickCopyToClipboard, this)); + + getChild("update_btn")->setCommitCallback( + boost::bind(&LLFloaterAbout::setUpdateListener, this)); static const LLUIColor about_color = LLUIColorTable::instance().getColor("TextFgReadOnlyColor"); @@ -326,6 +334,94 @@ void LLFloaterAbout::setSupportText(const std::string& server_release_notes_url) FALSE, LLStyle::Params() .color(about_color)); } +//This is bound as a callback in postBuild() +void LLFloaterAbout::setUpdateListener() +{ + typedef std::vector vec; + + //There are four possibilities: + //no downloads directory or version directory in "getOSUserAppDir()/downloads" + // => no update + //version directory exists and .done file is not present + // => download in progress + //version directory exists and .done file exists + // => update ready for install + //version directory, .done file and either .skip or .next file exists + // => update deferred + BOOL downloads = false; + std::string downloadDir = ""; + BOOL done = false; + BOOL next = false; + BOOL skip = false; + + LLSD info(LLFloaterAbout::getInfo()); + std::string version = info["VIEWER_VERSION_STR"].asString(); + std::string appDir = gDirUtilp->getOSUserAppDir(); + + //drop down two directory levels so we aren't searching for markers among the log files and crash dumps + //or among other possible viewer upgrade directories if the resident is running multiple viewer versions + //we should end up with a path like ../downloads/1.2.3.456789 + vec file_vec = gDirUtilp->getFilesInDir(appDir); + + for(vec::const_iterator iter=file_vec.begin(); iter!=file_vec.end(); ++iter) + { + if ( (iter->rfind("downloads") ) ) + { + vec dir_vec = gDirUtilp->getFilesInDir(*iter); + for(vec::const_iterator dir_iter=dir_vec.begin(); dir_iter!=dir_vec.end(); ++dir_iter) + { + if ( (dir_iter->rfind(version))) + { + downloads = true; + downloadDir = *dir_iter; + } + } + } + } + + if ( downloads ) + { + for(vec::const_iterator iter=file_vec.begin(); iter!=file_vec.end(); ++iter) + { + if ( (iter->rfind(version))) + { + if ( (iter->rfind(".done") ) ) + { + done = true; + } + else if ( (iter->rfind(".next") ) ) + { + next = true; + } + else if ( (iter->rfind(".skip") ) ) + { + skip = true; + } + } + } + } + + if ( ! downloads) + { + LLNotificationsUtil::add("UpdateViewerUpToDate"); + } + else + { + if ( ! done ) + { + LLNotificationsUtil::add("UpdateDownloadInProgress"); + } + else if ( !next and !skip ) + { + LLNotificationsUtil::add("UpdateDownloadComplete"); + } + else //done and there is a next or skip + { + LLNotificationsUtil::add("UpdateDeferred"); + } + } +} + ///---------------------------------------------------------------------------- /// LLFloaterAboutUtil ///---------------------------------------------------------------------------- -- cgit v1.2.3 From 6c8f447e529d4ea8ac70cc4ede4749f0b9f9bdaf Mon Sep 17 00:00:00 2001 From: "coyot@coyot-sager-PC" Date: Wed, 2 Nov 2016 18:05:32 +0100 Subject: SL-323: activate viewer menu and floater checks for updates via VMP --- indra/newview/llfloaterabout.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterabout.cpp') diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 1b85f645e8..171858e472 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -90,7 +90,7 @@ public: static LLSD getInfo(); void onClickCopyToClipboard(); void onClickUpdateCheck(); - void setUpdateListener(); + static void setUpdateListener(); private: void setSupportText(const std::string& server_release_notes_url); @@ -138,7 +138,7 @@ BOOL LLFloaterAbout::postBuild() boost::bind(&LLFloaterAbout::onClickCopyToClipboard, this)); getChild("update_btn")->setCommitCallback( - boost::bind(&LLFloaterAbout::setUpdateListener, this)); + boost::bind(&LLFloaterAbout::onClickUpdateCheck, this)); static const LLUIColor about_color = LLUIColorTable::instance().getColor("TextFgReadOnlyColor"); @@ -314,6 +314,11 @@ void LLFloaterAbout::onClickCopyToClipboard() support_widget->deselect(); } +void LLFloaterAbout::onClickUpdateCheck() +{ + setUpdateListener(); +} + void LLFloaterAbout::setSupportText(const std::string& server_release_notes_url) { #if LL_WINDOWS @@ -401,17 +406,17 @@ void LLFloaterAbout::setUpdateListener() } } - if ( ! downloads) + if ( !downloads ) { LLNotificationsUtil::add("UpdateViewerUpToDate"); } else { - if ( ! done ) + if ( !done ) { LLNotificationsUtil::add("UpdateDownloadInProgress"); } - else if ( !next and !skip ) + else if ( (!next) && (!skip) ) { LLNotificationsUtil::add("UpdateDownloadComplete"); } @@ -429,6 +434,10 @@ void LLFloaterAboutUtil::registerFloater() { LLFloaterReg::add("sl_about", "floater_about.xml", &LLFloaterReg::build); +} +void LLFloaterAboutUtil::checkUpdatesAndNotify() +{ + LLFloaterAbout::setUpdateListener(); } -- cgit v1.2.3