[rolisteam/rolisteam] src/binaries/widget: [i18n]: read pref from prefmanager.

Renaud Guezennec <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 870f9546b8853bf4c39a40a5fe6c002d86dc40e1 by Renaud Guezennec.
Committed on 11/07/2026 at 00:50.
Pushed by renaudg into branch 'master'.

[i18n]: read pref from prefmanager.

M  +7    -17   src/binaries/widget/rolisteamapplication.cpp

https://invent.kde.org/rolisteam/rolisteam/-/commit/870f9546b8853bf4c39a40a5fe6c002d86dc40e1

diff --git a/src/binaries/widget/rolisteamapplication.cpp b/src/binaries/widget/rolisteamapplication.cpp
index 9b391a2c1..7c0fff654 100644
--- a/src/binaries/widget/rolisteamapplication.cpp
+++ b/src/binaries/widget/rolisteamapplication.cpp
@@ -188,24 +188,14 @@ GameController* RolisteamApplication::gameCtrl()
 
 void RolisteamApplication::readSettings()
 {
-    QSettings settings(applicationName(), QString("%1_%2/preferences").arg(applicationName(), applicationVersion()));
-    settings.beginGroup("rolisteam/preferences");
-    int size= settings.beginReadArray("preferenceMap");
-    QHash<QString, QVariant> optionDictionary;
-    for(int i= 0; i < size; ++i)
-    {
-        settings.setArrayIndex(i);
-        QString key= settings.value("key").toString();
-        QVariant value= settings.value("value");
-        optionDictionary.insert(key, value);
-    }
-    settings.endArray();
-    settings.endGroup();
+    auto pref= m_game.preferencesManager();
+    if(!pref)
+        return;
 
-    auto system= optionDictionary.value("i18n_system").toBool();
-    auto paths= optionDictionary.value("i18n_path").toStringList();
-    auto hasCustomfile= optionDictionary.value("i18n_hasCustomfile").toBool();
-    auto customFile= optionDictionary.value("i18n_customfile").toString();
+    auto system= pref->value("i18n_system", true).toBool();
+    auto paths= pref->value("i18n_path", {}).toStringList();
+    auto hasCustomfile= pref->value("i18n_hasCustomfile", false).toBool();
+    auto customFile= pref->value("i18n_customfile", {}).toString();
 
     QList<QPair<QString, bool>> params;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.