qt: Drop custom migration logic (#4135)

Use OptionsModel::checkAndMigrate() instead and clean up the mess one more time.

Also fixes `-resetguisettings`.
This commit is contained in:
UdjinM6 2021-05-06 06:26:02 +03:00 committed by pasta
parent 645e59205e
commit 392828bb51
5 changed files with 11 additions and 35 deletions

View File

@ -1013,18 +1013,6 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; }
#endif
void migrateQtSettings()
{
// Migration (12.1)
QSettings settings;
if(!settings.value("fMigrationDone121", false).toBool()) {
settings.remove("theme");
settings.remove("nWindowPos");
settings.remove("nWindowSize");
settings.setValue("fMigrationDone121", true);
}
}
void setStyleSheetDirectory(const QString& path)
{
stylesheetDirectory = path;

View File

@ -253,9 +253,6 @@ namespace GUIUtil
bool GetStartOnSystemStartup();
bool SetStartOnSystemStartup(bool fAutoStart);
/** Modify Qt network specific settings on migration */
void migrateQtSettings();
/** Change the stylesheet directory. This is used by
the parameter -custom-css-dir.*/
void setStyleSheetDirectory(const QString& path);

View File

@ -69,8 +69,6 @@ NetworkStyle::NetworkStyle(const QString &_appName, const int iconColorHueShift,
{
// Allow for separate UI settings for testnets
QApplication::setApplicationName(appName);
// Make sure settings migrated properly
GUIUtil::migrateQtSettings();
// load pixmap
QPixmap appIconPixmap(":/icons/dash");

View File

@ -721,6 +721,16 @@ void OptionsModel::checkAndMigrate()
if (settingsVersion < 130000 && settings.contains("nDatabaseCache") && settings.value("nDatabaseCache").toLongLong() == 100)
settings.setValue("nDatabaseCache", (qint64)nDefaultDbCache);
if (settingsVersion < 170000) {
settings.remove("nWindowPos");
settings.remove("nWindowSize");
settings.remove("fMigrationDone121");
settings.remove("bUseInstantX");
settings.remove("bUseInstantSend");
settings.remove("bUseDarkSend");
settings.remove("bUsePrivateSend");
}
settings.setValue(strSettingsVersionKey, CLIENT_VERSION);
}

View File

@ -94,24 +94,6 @@ SendCoinsDialog::SendCoinsDialog(bool _fCoinJoin, QWidget* parent) :
connect(ui->checkBoxCoinControlChange, SIGNAL(stateChanged(int)), this, SLOT(coinControlChangeChecked(int)));
connect(ui->lineEditCoinControlChange, SIGNAL(textEdited(const QString &)), this, SLOT(coinControlChangeEdited(const QString &)));
// Dash specific
QSettings settings;
//TODO remove Darksend sometime after 0.14.1
if (settings.contains("bUseDarkSend")) {
settings.setValue("bUseCoinJoin", settings.value("bUseDarkSend").toBool());
settings.remove("bUseDarkSend");
}
if (!settings.contains("bUseCoinJoin"))
settings.setValue("bUseCoinJoin", false);
//TODO remove InstantX sometime after 0.14.1
if (settings.contains("bUseInstantX")) {
settings.remove("bUseInstantX");
}
if (settings.contains("bUseInstantSend")) {
settings.remove("bUseInstantSend");
}
// Coin Control: clipboard actions
QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this);
QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this);
@ -136,6 +118,7 @@ SendCoinsDialog::SendCoinsDialog(bool _fCoinJoin, QWidget* parent) :
ui->labelCoinControlChange->addAction(clipboardChangeAction);
// init transaction fee section
QSettings settings;
if (!settings.contains("fFeeSectionMinimized"))
settings.setValue("fFeeSectionMinimized", true);
if (!settings.contains("nFeeRadio") && settings.contains("nTransactionFee") && settings.value("nTransactionFee").toLongLong() > 0) // compatibility