aboutsummaryrefslogtreecommitdiff
path: root/launcher/settings/INIFile.cpp
diff options
context:
space:
mode:
authorTrial97 <alexandru.tripon97@gmail.com>2023-06-15 00:37:32 +0300
committerTrial97 <alexandru.tripon97@gmail.com>2023-06-15 00:37:32 +0300
commitcf4c1605ebe2f1db302928f847398e23236aed16 (patch)
treefe35116ec477d2cabdcce31f1db8fa4b20022157 /launcher/settings/INIFile.cpp
parente0b901169aaa5ebc7b74c15cd3f01f08ee98c4f1 (diff)
downloadPrismLauncher-cf4c1605ebe2f1db302928f847398e23236aed16.tar.gz
PrismLauncher-cf4c1605ebe2f1db302928f847398e23236aed16.tar.bz2
PrismLauncher-cf4c1605ebe2f1db302928f847398e23236aed16.zip
Fixed qt5 build
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
Diffstat (limited to 'launcher/settings/INIFile.cpp')
-rw-r--r--launcher/settings/INIFile.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/launcher/settings/INIFile.cpp b/launcher/settings/INIFile.cpp
index 1d2f9611..37846d11 100644
--- a/launcher/settings/INIFile.cpp
+++ b/launcher/settings/INIFile.cpp
@@ -97,6 +97,20 @@ QString unescape(QString orig)
}
return out;
}
+
+QString unquete(QString str)
+{
+ if ((str.contains(QChar(';')) || str.contains(QChar('=')) || str.contains(QChar(','))) && str.endsWith("\"") && str.startsWith("\"")) {
+#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
+ str = str.remove(0, 1);
+ str = str.remove(str.size() - 1, 1);
+#else
+ str = str.removeFirst().removeLast();
+#endif
+ }
+ return str;
+}
+
bool parseOldFileFormat(QIODevice& device, QSettings::SettingsMap& map)
{
QTextStream in(device.readAll());
@@ -124,11 +138,7 @@ bool parseOldFileFormat(QIODevice& device, QSettings::SettingsMap& map)
QString key = line.left(eqPos).trimmed();
QString valueStr = line.right(line.length() - eqPos - 1).trimmed();
- valueStr = unescape(valueStr);
- if ((valueStr.contains(QChar(';')) || valueStr.contains(QChar('=')) || valueStr.contains(QChar(','))) && valueStr.endsWith("\"") &&
- valueStr.startsWith("\"")) {
- valueStr = valueStr.removeFirst().removeLast();
- }
+ valueStr = unquete(unescape(valueStr));
QVariant value(valueStr);
map.insert(key, value);
@@ -164,8 +174,7 @@ bool INIFile::loadFile(QString fileName)
if (auto valueStr = _settings_obj.value(key).toString();
(valueStr.contains(QChar(';')) || valueStr.contains(QChar('=')) || valueStr.contains(QChar(','))) &&
valueStr.endsWith("\"") && valueStr.startsWith("\"")) {
- valueStr = valueStr.removeFirst().removeLast();
- insert(key, valueStr);
+ insert(key, unquete(valueStr));
} else
insert(key, _settings_obj.value(key));
}