mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
chore: migrate map settings to json string
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
89be378ef6
commit
8c710fb8de
8 changed files with 54 additions and 22 deletions
|
|
@ -44,6 +44,7 @@
|
|||
#include <QTextStream>
|
||||
|
||||
#include <QSettings>
|
||||
#include "Json.h"
|
||||
|
||||
INIFile::INIFile() {}
|
||||
|
||||
|
|
@ -151,16 +152,22 @@ bool parseOldFileFormat(QIODevice& device, QSettings::SettingsMap& map)
|
|||
|
||||
QVariant migrateQByteArrayToBase64(QString key, QVariant value)
|
||||
{
|
||||
if (key.startsWith("WideBarVisibility_") || (key.startsWith("UI/") && key.endsWith("_Page/Columns"))) {
|
||||
return QString::fromUtf8(value.toByteArray().toBase64());
|
||||
}
|
||||
static const QStringList otherByteArrays = { "MainWindowState", "MainWindowGeometry", "ConsoleWindowState",
|
||||
"ConsoleWindowGeometry", "PagedGeometry", "NewInstanceGeometry",
|
||||
"ModDownloadGeometry", "RPDownloadGeometry", "TPDownloadGeometry",
|
||||
"ShaderDownloadGeometry" };
|
||||
if (key.startsWith("WideBarVisibility_") || (key.startsWith("UI/") && key.endsWith("_Page/Columns"))) {
|
||||
return QString::fromUtf8(value.toByteArray().toBase64());
|
||||
}
|
||||
if (otherByteArrays.contains(key)) {
|
||||
return QString::fromUtf8(value.toByteArray());
|
||||
}
|
||||
if (key == "linkedInstances") {
|
||||
return Json::fromStringList(value.toStringList());
|
||||
}
|
||||
if (key == "Env") {
|
||||
return Json::fromMap(value.toMap());
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue