mirror of
https://github.com/tnodir/fort
synced 2024-11-14 22:19:05 +00:00
FortFirewall.exe.ini: Add "updateDir" option
This commit is contained in:
parent
8cdeef7b57
commit
8b73c25eb0
@ -41,6 +41,10 @@
|
||||
;Default is "<userDir>/logs".
|
||||
;logsDir=%FORTHOME%/Data/logs
|
||||
|
||||
;Directory to store Fort Firewall's update.
|
||||
;Default is "<cacheDir>".
|
||||
;updateDir=%TEMP%/Fort Firewall
|
||||
|
||||
;Force debug output.
|
||||
;forceDebug=true
|
||||
|
||||
|
@ -15,22 +15,6 @@
|
||||
#include <util/dateutil.h>
|
||||
#include <util/iconcache.h>
|
||||
|
||||
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();
|
||||
|
@ -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<StatManager>(new StatManagerRpc(settings->statFilePath()));
|
||||
ioc->setService<StatBlockManager>(new StatBlockManagerRpc(settings->statBlockFilePath()));
|
||||
ioc->setService<AskPendingManager>(new AskPendingManagerRpc());
|
||||
ioc->setService<AutoUpdateManager>(new AutoUpdateManagerRpc(settings->cachePath()));
|
||||
ioc->setService<AutoUpdateManager>(new AutoUpdateManagerRpc(settings->updatePath()));
|
||||
ioc->setService<DriverManager>(new DriverManagerRpc());
|
||||
ioc->setService<AppInfoManager>(
|
||||
new AppInfoManagerRpc(settings->cacheFilePath(), settings->noCache()));
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -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/")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user