diff --git a/deploy/data/FortFirewall.exe.example.ini b/deploy/data/FortFirewall.exe.example.ini index d4afb339..96a8d2fc 100644 --- a/deploy/data/FortFirewall.exe.example.ini +++ b/deploy/data/FortFirewall.exe.example.ini @@ -41,6 +41,10 @@ ;Default is "/logs". ;logsDir=%FORTHOME%/Data/logs +;Directory to store Fort Firewall's update. +;Default is "". +;updateDir=%TEMP%/Fort Firewall + ;Force debug output. ;forceDebug=true diff --git a/src/ui/form/home/pages/aboutpage.cpp b/src/ui/form/home/pages/aboutpage.cpp index 5e3eda91..9d45bd94 100644 --- a/src/ui/form/home/pages/aboutpage.cpp +++ b/src/ui/form/home/pages/aboutpage.cpp @@ -15,22 +15,6 @@ #include #include -namespace { - -QString checkUpdateToolTip(TaskInfoUpdateChecker *updateChecker) -{ - const QDateTime lastRun = updateChecker->lastRun(); - const QDateTime lastSuccess = updateChecker->lastSuccess(); - - QString text = DateUtil::localeDateTime(lastRun); - if (lastRun != lastSuccess) { - text += " / " + DateUtil::localeDateTime(lastSuccess); - } - return text; -} - -} - AboutPage::AboutPage(HomeController *ctrl, QWidget *parent) : HomeBasePage(ctrl, parent) { setupUi(); @@ -134,8 +118,6 @@ void AboutPage::setupNewVersionUpdate() m_progressBar->setRange(0, taskInfo->downloadSize()); m_btDownload->setVisible(m_isNewVersion && !m_btInstall->isVisible()); - m_btCheckUpdate->setToolTip(checkUpdateToolTip(taskInfo)); - retranslateNewVersionBox(); }; @@ -168,6 +150,8 @@ void AboutPage::setupAutoUpdate() m_btDownload->setVisible(isNewVersion && !isDownloadActive); m_btInstall->setVisible(isNewVersion && isDownloaded); + + m_btInstall->setToolTip(isDownloaded ? manager->installerPath() : QString()); }; refreshAutoUpdate(); diff --git a/src/ui/fortmanager.cpp b/src/ui/fortmanager.cpp index e57ea5d7..15e2008c 100644 --- a/src/ui/fortmanager.cpp +++ b/src/ui/fortmanager.cpp @@ -74,7 +74,7 @@ inline void setupMasterServices(IocContainer *ioc, const FortSettings *settings) ioc->setService(new StatManager(settings->statFilePath())); ioc->setService(new StatBlockManager(settings->statBlockFilePath())); ioc->setService(new AskPendingManager()); - ioc->setService(new AutoUpdateManager(settings->cachePath())); + ioc->setService(new AutoUpdateManager(settings->updatePath())); ioc->setService(new DriverManager()); ioc->setService(new AppInfoManager(settings->cacheFilePath())); ioc->setService(new LogManager()); @@ -96,7 +96,7 @@ inline void setupClientServices(IocContainer *ioc, const FortSettings *settings) ioc->setService(new StatManagerRpc(settings->statFilePath())); ioc->setService(new StatBlockManagerRpc(settings->statBlockFilePath())); ioc->setService(new AskPendingManagerRpc()); - ioc->setService(new AutoUpdateManagerRpc(settings->cachePath())); + ioc->setService(new AutoUpdateManagerRpc(settings->updatePath())); ioc->setService(new DriverManagerRpc()); ioc->setService( new AppInfoManagerRpc(settings->cacheFilePath(), settings->noCache())); diff --git a/src/ui/fortsettings.cpp b/src/ui/fortsettings.cpp index 76e3e004..e2db3873 100644 --- a/src/ui/fortsettings.cpp +++ b/src/ui/fortsettings.cpp @@ -129,6 +129,7 @@ void FortSettings::setupGlobal() m_cachePath = settings.value("global/cacheDir").toString(); m_userPath = settings.value("global/userDir").toString(); m_logsPath = settings.value("global/logsDir").toString(); + m_updatePath = settings.value("global/updateDir").toString(); } void FortSettings::initialize(const QStringList &args, EnvManager *envManager) @@ -337,6 +338,13 @@ void FortSettings::setupPaths(EnvManager *envManager) } else { m_logsPath = expandPath(m_logsPath, envManager); } + + // Update Path + if (m_updatePath.isEmpty()) { + m_updatePath = m_cachePath; + } else { + m_updatePath = expandPath(m_updatePath, envManager); + } } void FortSettings::createPaths() diff --git a/src/ui/fortsettings.h b/src/ui/fortsettings.h index d06f07bb..7cb10b12 100644 --- a/src/ui/fortsettings.h +++ b/src/ui/fortsettings.h @@ -64,6 +64,8 @@ public: QString logsPath() const { return m_logsPath; } + QString updatePath() const { return m_updatePath; } + QString controlCommand() const { return m_controlCommand; } const QStringList &args() const { return m_args; } @@ -153,6 +155,7 @@ private: QString m_cachePath; QString m_userPath; QString m_logsPath; + QString m_updatePath; QString m_controlCommand; QStringList m_args; }; diff --git a/src/ui/manager/autoupdatemanager.cpp b/src/ui/manager/autoupdatemanager.cpp index 51a5aff4..4b44be99 100644 --- a/src/ui/manager/autoupdatemanager.cpp +++ b/src/ui/manager/autoupdatemanager.cpp @@ -23,8 +23,8 @@ constexpr int DownloadMaxTryCount = 3; } -AutoUpdateManager::AutoUpdateManager(const QString &cachePath, QObject *parent) : - TaskDownloader(parent), m_updatePath(cachePath + "update/") +AutoUpdateManager::AutoUpdateManager(const QString &updatePath, QObject *parent) : + TaskDownloader(parent), m_updatePath(updatePath + "update/") { } diff --git a/src/ui/manager/autoupdatemanager.h b/src/ui/manager/autoupdatemanager.h index c0638665..6b1700be 100644 --- a/src/ui/manager/autoupdatemanager.h +++ b/src/ui/manager/autoupdatemanager.h @@ -23,7 +23,7 @@ public: Q_ENUM(Flag) Q_DECLARE_FLAGS(Flags, Flag) - explicit AutoUpdateManager(const QString &cachePath, QObject *parent = nullptr); + explicit AutoUpdateManager(const QString &updatePath, QObject *parent = nullptr); Flags flags() const { return m_flags; } void setFlags(Flags v); diff --git a/src/ui/rpc/autoupdatemanagerrpc.cpp b/src/ui/rpc/autoupdatemanagerrpc.cpp index 25fea7e3..f649b1f2 100644 --- a/src/ui/rpc/autoupdatemanagerrpc.cpp +++ b/src/ui/rpc/autoupdatemanagerrpc.cpp @@ -61,8 +61,8 @@ inline bool processAutoUpdateManagerRpcResult( } -AutoUpdateManagerRpc::AutoUpdateManagerRpc(const QString &cachePath, QObject *parent) : - AutoUpdateManager(cachePath, parent) +AutoUpdateManagerRpc::AutoUpdateManagerRpc(const QString &updatePath, QObject *parent) : + AutoUpdateManager(updatePath, parent) { } diff --git a/src/ui/rpc/autoupdatemanagerrpc.h b/src/ui/rpc/autoupdatemanagerrpc.h index 59981f81..39c63a2f 100644 --- a/src/ui/rpc/autoupdatemanagerrpc.h +++ b/src/ui/rpc/autoupdatemanagerrpc.h @@ -13,7 +13,7 @@ class AutoUpdateManagerRpc : public AutoUpdateManager Q_OBJECT public: - explicit AutoUpdateManagerRpc(const QString &cachePath, QObject *parent = nullptr); + explicit AutoUpdateManagerRpc(const QString &updatePath, QObject *parent = nullptr); int bytesReceived() const override { return m_bytesReceived; } void setBytesReceived(int v);