Browse Source

Set appropriate migration version number for new installations

adaptive-webui-19844
Chocobo1 3 years ago
parent
commit
e7ebbffbfd
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 3
      src/app/main.cpp
  2. 8
      src/app/upgrade.cpp
  3. 1
      src/app/upgrade.h

3
src/app/main.cpp

@ -188,7 +188,6 @@ int main(int argc, char *argv[]) @@ -188,7 +188,6 @@ int main(int argc, char *argv[])
#ifndef DISABLE_GUI
if (!userAgreesWithLegalNotice())
return EXIT_SUCCESS;
#elif defined(Q_OS_WIN)
if (_isatty(_fileno(stdin))
&& _isatty(_fileno(stdout))
@ -201,6 +200,8 @@ int main(int argc, char *argv[]) @@ -201,6 +200,8 @@ int main(int argc, char *argv[])
&& !userAgreesWithLegalNotice())
return EXIT_SUCCESS;
#endif
setCurrentMigrationVersion();
}
// Check if qBittorrent is already running for this user

8
src/app/upgrade.cpp

@ -43,6 +43,7 @@ @@ -43,6 +43,7 @@
namespace
{
const int MIGRATION_VERSION = 2;
const char MIGRATION_VERSION_KEY[] = "Meta/MigrationVersion";
void exportWebUIHttpsFiles()
{
@ -329,7 +330,7 @@ namespace @@ -329,7 +330,7 @@ namespace
bool upgrade(const bool /*ask*/)
{
CachedSettingValue<int> version {"Meta/MigrationVersion", 0};
CachedSettingValue<int> version {MIGRATION_VERSION_KEY, 0};
if (version != MIGRATION_VERSION)
{
@ -351,6 +352,11 @@ bool upgrade(const bool /*ask*/) @@ -351,6 +352,11 @@ bool upgrade(const bool /*ask*/)
return true;
}
void setCurrentMigrationVersion()
{
SettingsStorage::instance()->storeValue(QLatin1String(MIGRATION_VERSION_KEY), MIGRATION_VERSION);
}
void handleChangedDefaults(const DefaultPreferencesMode mode)
{
struct DefaultValue

1
src/app/upgrade.h

@ -36,3 +36,4 @@ enum class DefaultPreferencesMode @@ -36,3 +36,4 @@ enum class DefaultPreferencesMode
void handleChangedDefaults(DefaultPreferencesMode mode);
bool upgrade(bool ask = true);
void setCurrentMigrationVersion();

Loading…
Cancel
Save