mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-27 08:19:30 +08:00
Introduce versioning on main configuration file
This commit is contained in:
parent
cbc2de6b85
commit
b8a7ecfe69
@ -36,12 +36,15 @@
|
|||||||
#include "base/preferences.h"
|
#include "base/preferences.h"
|
||||||
#include "base/profile.h"
|
#include "base/profile.h"
|
||||||
#include "base/settingsstorage.h"
|
#include "base/settingsstorage.h"
|
||||||
|
#include "base/settingvalue.h"
|
||||||
#include "base/utils/fs.h"
|
#include "base/utils/fs.h"
|
||||||
#include "base/utils/io.h"
|
#include "base/utils/io.h"
|
||||||
#include "base/utils/string.h"
|
#include "base/utils/string.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
const int MIGRATION_VERSION = 1;
|
||||||
|
|
||||||
void exportWebUIHttpsFiles()
|
void exportWebUIHttpsFiles()
|
||||||
{
|
{
|
||||||
const auto migrate = [](const QString &oldKey, const QString &newKey, const QString &savePath)
|
const auto migrate = [](const QString &oldKey, const QString &newKey, const QString &savePath)
|
||||||
@ -229,12 +232,23 @@ namespace
|
|||||||
|
|
||||||
bool upgrade(const bool /*ask*/)
|
bool upgrade(const bool /*ask*/)
|
||||||
{
|
{
|
||||||
exportWebUIHttpsFiles();
|
CachedSettingValue<int> version {"Meta/MigrationVersion", 0};
|
||||||
upgradeTorrentContentLayout();
|
|
||||||
upgradeListenPortSettings();
|
if (version != MIGRATION_VERSION)
|
||||||
upgradeSchedulerDaysSettings();
|
{
|
||||||
upgradeDNSServiceSettings();
|
if (version < 1)
|
||||||
upgradeTrayIconStyleSettings();
|
{
|
||||||
|
exportWebUIHttpsFiles();
|
||||||
|
upgradeTorrentContentLayout();
|
||||||
|
upgradeListenPortSettings();
|
||||||
|
upgradeSchedulerDaysSettings();
|
||||||
|
upgradeDNSServiceSettings();
|
||||||
|
upgradeTrayIconStyleSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
version = MIGRATION_VERSION;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,9 +146,9 @@ namespace Utils
|
|||||||
{
|
{
|
||||||
return Version(s);
|
return Version(s);
|
||||||
}
|
}
|
||||||
catch (const RuntimeError &er)
|
catch (const RuntimeError &error)
|
||||||
{
|
{
|
||||||
qDebug() << "Error parsing version:" << er.message();
|
qDebug() << "Error parsing version:" << error.message();
|
||||||
return defaultVersion;
|
return defaultVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user