UI: DbErrorManager: Check profile's dir for portable only

This commit is contained in:
Nodir Temirkhodjaev 2024-05-29 15:38:36 +03:00
parent 82b96a05e9
commit 1b0ed39a08
5 changed files with 17 additions and 7 deletions

View File

@ -49,3 +49,6 @@
;Try to start a Service on startup. ;Try to start a Service on startup.
;canStartService=false ;canStartService=false
;Periodically check that Profile's directory is online.
;checkProfileOnline=false

View File

@ -121,6 +121,7 @@ void FortSettings::setupGlobal()
m_forceDebug = settings.value("global/forceDebug").toBool(); m_forceDebug = settings.value("global/forceDebug").toBool();
m_canInstallDriver = settings.value("global/canInstallDriver").toBool(); m_canInstallDriver = settings.value("global/canInstallDriver").toBool();
m_canStartService = settings.value("global/canStartService").toBool(); m_canStartService = settings.value("global/canStartService").toBool();
m_checkProfileOnline = settings.value("global/checkProfileOnline").toBool();
m_defaultLanguage = settings.value("global/defaultLanguage").toString(); m_defaultLanguage = settings.value("global/defaultLanguage").toString();
m_profilePath = settings.value("global/profileDir").toString(); m_profilePath = settings.value("global/profileDir").toString();

View File

@ -35,6 +35,7 @@ public:
bool forceDebug() const { return m_forceDebug; } bool forceDebug() const { return m_forceDebug; }
bool canInstallDriver() const { return m_canInstallDriver; } bool canInstallDriver() const { return m_canInstallDriver; }
bool canStartService() const { return m_canStartService; } bool canStartService() const { return m_canStartService; }
bool checkProfileOnline() const { return m_checkProfileOnline; }
bool isLaunch() const { return m_isLaunch; } bool isLaunch() const { return m_isLaunch; }
@ -137,6 +138,7 @@ private:
uint m_forceDebug : 1 = false; uint m_forceDebug : 1 = false;
uint m_canInstallDriver : 1 = false; uint m_canInstallDriver : 1 = false;
uint m_canStartService : 1 = false; uint m_canStartService : 1 = false;
uint m_checkProfileOnline : 1 = false;
uint m_isLaunch : 1 = false; uint m_isLaunch : 1 = false;
uint m_isService : 1 = false; uint m_isService : 1 = false;
uint m_hasService : 1 = false; uint m_hasService : 1 = false;

View File

@ -52,19 +52,23 @@ void DbErrorManager::checkConfDir()
void DbErrorManager::setupTimer() void DbErrorManager::setupTimer()
{ {
auto settings = IoC<FortSettings>();
const bool checkProfileOnline = (settings->checkProfileOnline() || settings->isPortable());
if (!checkProfileOnline)
return;
setupDirInfo(settings->confFilePath());
auto timer = new QTimer(this); auto timer = new QTimer(this);
timer->setInterval(1500); timer->setInterval(1500);
timer->start(); timer->start();
connect(timer, &QTimer::timeout, this, &DbErrorManager::checkConfDir); connect(timer, &QTimer::timeout, this, &DbErrorManager::checkConfDir);
setupDirInfo();
} }
void DbErrorManager::setupDirInfo() void DbErrorManager::setupDirInfo(const QString &path)
{ {
auto settings = IoC<FortSettings>(); m_confDir.setPath(path);
m_confDir.setPath(settings->confFilePath());
m_confDir.open(); m_confDir.open();
} }

View File

@ -21,7 +21,7 @@ private slots:
protected: protected:
virtual void setupTimer(); virtual void setupTimer();
void setupDirInfo(); void setupDirInfo(const QString &path);
private: private:
DirInfo m_confDir; DirInfo m_confDir;