From f62829dcd8ae39d0b4c8aea4246c9fb7ae790f5a Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 19 Jun 2022 08:23:27 +0300 Subject: [PATCH 44/44] Qt: Make settings versioned See osdn #44838 Signed-off-by: Marko Lindqvist --- client/gui-qt/fc_client.cpp | 14 ++++++++++++-- client/gui-qt/shortcuts.cpp | 4 ++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/client/gui-qt/fc_client.cpp b/client/gui-qt/fc_client.cpp index 792cb9b6e1..90f796fcde 100644 --- a/client/gui-qt/fc_client.cpp +++ b/client/gui-qt/fc_client.cpp @@ -610,8 +610,14 @@ int fc_client::gimme_index_of(QString str) ****************************************************************************/ void fc_client::read_settings() { + // This can't be shared between freeciv versions as the content + // might be incompatible. + QString sname = "freeciv-qt-client-set-" + + QString::number(MAJOR_NEW_OPTION_FILE_NAME) + "." + + QString::number(MINOR_NEW_OPTION_FILE_NAME); QSettings s(QSettings::IniFormat, QSettings::UserScope, - "freeciv-qt-client"); + sname); + if (!s.contains("Fonts-set")) { configure_fonts(); } @@ -746,8 +752,12 @@ void fc_client::read_settings() ****************************************************************************/ void fc_client::write_settings() { + QString sname = "freeciv-qt-client-set-" + + QString::number(MAJOR_NEW_OPTION_FILE_NAME) + "." + + QString::number(MINOR_NEW_OPTION_FILE_NAME); QSettings s(QSettings::IniFormat, QSettings::UserScope, - "freeciv-qt-client"); + sname); + s.setValue("Fonts-set", true); s.setValue("Chat-fx-size", qt_settings.chat_fwidth); s.setValue("Chat-fy-size", qt_settings.chat_fheight); diff --git a/client/gui-qt/shortcuts.cpp b/client/gui-qt/shortcuts.cpp index 80a118f435..a0c78f43c4 100644 --- a/client/gui-qt/shortcuts.cpp +++ b/client/gui-qt/shortcuts.cpp @@ -794,7 +794,7 @@ void write_shortcuts() QMap h = fc_shortcuts::hash; // This can't be shared between freeciv versions as shortcut // ids can change incompatible way between versions. - QString sname = "freeciv-qt-client-" + QString sname = "freeciv-qt-client-sc-" + QString::number(MAJOR_NEW_OPTION_FILE_NAME) + "." + QString::number(MINOR_NEW_OPTION_FILE_NAME); QSettings s(QSettings::IniFormat, QSettings::UserScope, @@ -830,7 +830,7 @@ bool read_shortcuts() return false; } - QString sname = "freeciv-qt-client-" + QString sname = "freeciv-qt-client-sc-" + QString::number(MAJOR_NEW_OPTION_FILE_NAME) + "." + QString::number(MINOR_NEW_OPTION_FILE_NAME); QSettings s(QSettings::IniFormat, QSettings::UserScope, -- 2.35.1