aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-04-29 18:05:48 -0700
committerRachel Powers <508861+Ryex@users.noreply.github.com>2023-04-29 19:55:24 -0700
commit788fa40c2ae0e9786c070f4593a4e7ff6efc77d3 (patch)
tree3eb86f6640005a4e4a54d7623518f0f9a8a181bf
parent0ce30495796627e7591587ca1e977be98178f225 (diff)
downloadPrismLauncher-788fa40c2ae0e9786c070f4593a4e7ff6efc77d3.tar.gz
PrismLauncher-788fa40c2ae0e9786c070f4593a4e7ff6efc77d3.tar.bz2
PrismLauncher-788fa40c2ae0e9786c070f4593a4e7ff6efc77d3.zip
refactor: Move ini to use QSettings && drop get/setList functions
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
-rw-r--r--launcher/BaseInstance.cpp12
-rw-r--r--launcher/CMakeLists.txt1
-rw-r--r--launcher/FileSystem.cpp3
-rw-r--r--launcher/QVariantUtils.h70
-rw-r--r--launcher/StringUtils.cpp36
-rw-r--r--launcher/StringUtils.h36
-rw-r--r--launcher/minecraft/mod/tasks/LocalModParseTask.cpp6
-rw-r--r--launcher/settings/INIFile.cpp153
-rw-r--r--launcher/settings/INIFile.h76
-rw-r--r--launcher/settings/SettingsObject.cpp13
-rw-r--r--launcher/settings/SettingsObject.h39
-rw-r--r--tests/INIFile_test.cpp24
12 files changed, 219 insertions, 250 deletions
diff --git a/launcher/BaseInstance.cpp b/launcher/BaseInstance.cpp
index ad45aa2d..a8fce879 100644
--- a/launcher/BaseInstance.cpp
+++ b/launcher/BaseInstance.cpp
@@ -188,25 +188,25 @@ bool BaseInstance::shouldStopOnConsoleOverflow() const
QStringList BaseInstance::getLinkedInstances() const
{
- return m_settings->getList<QString>("linkedInstances");
+ return m_settings->get("linkedInstances").toStringList();
}
void BaseInstance::setLinkedInstances(const QStringList& list)
{
- auto linkedInstances = m_settings->getList<QString>("linkedInstances");
- m_settings->setList("linkedInstances", list);
+ auto linkedInstances = m_settings->get("linkedInstances").toStringList();
+ m_settings->set("linkedInstances", list);
}
void BaseInstance::addLinkedInstanceId(const QString& id)
{
- auto linkedInstances = m_settings->getList<QString>("linkedInstances");
+ auto linkedInstances = m_settings->get("linkedInstances").toStringList();
linkedInstances.append(id);
setLinkedInstances(linkedInstances);
}
bool BaseInstance::removeLinkedInstanceId(const QString& id)
{
- auto linkedInstances = m_settings->getList<QString>("linkedInstances");
+ auto linkedInstances = m_settings->get("linkedInstances").toStringList();
int numRemoved = linkedInstances.removeAll(id);
setLinkedInstances(linkedInstances);
return numRemoved > 0;
@@ -214,7 +214,7 @@ bool BaseInstance::removeLinkedInstanceId(const QString& id)
bool BaseInstance::isLinkedToInstanceId(const QString& id) const
{
- auto linkedInstances = m_settings->getList<QString>("linkedInstances");
+ auto linkedInstances = m_settings->get("linkedInstances").toStringList();
return linkedInstances.contains(id);
}
diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt
index 4de0f73b..def73b85 100644
--- a/launcher/CMakeLists.txt
+++ b/launcher/CMakeLists.txt
@@ -26,6 +26,7 @@ set(CORE_SOURCES
MMCZip.cpp
StringUtils.h
StringUtils.cpp
+ QVariantUtils.h
RuntimeContext.h
# Basic instance manipulation tasks (derived from InstanceTask)
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp
index bd985c5b..d98526df 100644
--- a/launcher/FileSystem.cpp
+++ b/launcher/FileSystem.cpp
@@ -329,8 +329,7 @@ bool create_link::operator()(const QString& offset, bool dryRun)
/**
* @brief Make a list of all the links to make
- * @param offset subdirectory form src to link to dest
- * @return if there was an error during the attempt to link
+ * @param offset subdirectory of src to link to dest
*/
void create_link::make_link_list(const QString& offset)
{
diff --git a/launcher/QVariantUtils.h b/launcher/QVariantUtils.h
new file mode 100644
index 00000000..7e422c3e
--- /dev/null
+++ b/launcher/QVariantUtils.h
@@ -0,0 +1,70 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Copyright (C) 2023 flowln <flowlnlnln@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2013-2021 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+
+#include <QVariant>
+#include <QList>
+
+namespace QVariantUtils {
+
+template <typename T>
+inline QList<T> toList(QVariant src) {
+ QVariantList variantList = src.toList();
+
+ QList<T> list_t;
+ list_t.reserve(variantList.size());
+ for (const QVariant& v : variantList)
+ {
+ list_t.append(v.value<T>());
+ }
+ return list_t;
+}
+
+template <typename T>
+inline QVariant fromList(QList<T> val) {
+ QVariantList variantList;
+ variantList.reserve(val.size());
+ for (const T& v : val)
+ {
+ variantList.append(v);
+ }
+
+ return variantList;
+}
+
+} \ No newline at end of file
diff --git a/launcher/StringUtils.cpp b/launcher/StringUtils.cpp
index 2fa56501..d109d63d 100644
--- a/launcher/StringUtils.cpp
+++ b/launcher/StringUtils.cpp
@@ -1,3 +1,39 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Copyright (C) 2023 flowln <flowlnlnln@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2013-2021 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include "StringUtils.h"
#include <QUuid>
diff --git a/launcher/StringUtils.h b/launcher/StringUtils.h
index c4a6ab31..36c8cf8f 100644
--- a/launcher/StringUtils.h
+++ b/launcher/StringUtils.h
@@ -1,3 +1,39 @@
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Copyright (C) 2023 flowln <flowlnlnln@gmail.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2013-2021 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#pragma once
#include <QString>
diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
index da27a505..5342d693 100644
--- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
+++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp
@@ -242,7 +242,7 @@ ModDetails ReadQuiltModInfo(QByteArray contents)
return details;
}
-ModDetails ReadForgeInfo(QByteArray contents)
+ModDetails ReadForgeInfo(QString fileName)
{
ModDetails details;
// Read the data
@@ -250,7 +250,7 @@ ModDetails ReadForgeInfo(QByteArray contents)
details.mod_id = "Forge";
details.homeurl = "http://www.minecraftforge.net/forum/";
INIFile ini;
- if (!ini.loadFile(contents))
+ if (!ini.loadFile(fileName))
return details;
QString major = ini.get("forge.major.number", "0").toString();
@@ -422,7 +422,7 @@ bool processZIP(Mod& mod, ProcessingLevel level)
return false;
}
- details = ReadForgeInfo(file.readAll());
+ details = ReadForgeInfo(file.getFileName());
file.close();
zip.close();
diff --git a/launcher/settings/INIFile.cpp b/launcher/settings/INIFile.cpp
index e48e6f47..f0347cab 100644
--- a/launcher/settings/INIFile.cpp
+++ b/launcher/settings/INIFile.cpp
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: GPL-3.0-only
/*
- * PolyMC - Minecraft Launcher
+ * Prism Launcher - Minecraft Launcher
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Copyright (C) 2023 flowln <flowlnlnln@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -42,132 +43,51 @@
#include <QSaveFile>
#include <QDebug>
-INIFile::INIFile()
-{
-}
-
-QString INIFile::unescape(QString orig)
-{
- QString out;
- QChar prev = QChar::Null;
- for(auto c: orig)
- {
- if(prev == '\\')
- {
- if(c == 'n')
- out += '\n';
- else if(c == 't')
- out += '\t';
- else if(c == '#')
- out += '#';
- else
- out += c;
- prev = QChar::Null;
- }
- else
- {
- if(c == '\\')
- {
- prev = c;
- continue;
- }
- out += c;
- prev = QChar::Null;
- }
- }
- return out;
-}
+#include <QSettings>
-QString INIFile::escape(QString orig)
+INIFile::INIFile()
{
- QString out;
- for(auto c: orig)
- {
- if(c == '\n')
- out += "\\n";
- else if (c == '\t')
- out += "\\t";
- else if(c == '\\')
- out += "\\\\";
- else if(c == '#')
- out += "\\#";
- else
- out += c;
- }
- return out;
}
bool INIFile::saveFile(QString fileName)
{
- QByteArray outArray;
+ QSettings _settings_obj{ fileName, QSettings::Format::IniFormat };
+ _settings_obj.setFallbacksEnabled(false);
+
for (Iterator iter = begin(); iter != end(); iter++)
- {
- QString value = iter.value().toString();
- value = escape(value);
- outArray.append(iter.key().toUtf8());
- outArray.append('=');
- outArray.append(value.toUtf8());
- outArray.append('\n');
- }
+ _settings_obj.setValue(iter.key(), iter.value());
+
+ _settings_obj.sync();
+
+ if (auto status = _settings_obj.status(); status != QSettings::Status::NoError) {
+ // Shouldn't be possible!
+ Q_ASSERT(status != QSettings::Status::FormatError);
+
+ if (status == QSettings::Status::AccessError)
+ qCritical() << "An access error occurred (e.g. trying to write to a read-only file).";
- try
- {
- FS::write(fileName, outArray);
- }
- catch (const Exception &e)
- {
- qCritical() << e.what();
return false;
}
return true;
}
-
bool INIFile::loadFile(QString fileName)
{
- QFile file(fileName);
- if (!file.open(QIODevice::ReadOnly))
+ QSettings _settings_obj{ fileName, QSettings::Format::IniFormat };
+ _settings_obj.setFallbacksEnabled(false);
+
+ if (auto status = _settings_obj.status(); status != QSettings::Status::NoError) {
+ if (status == QSettings::Status::AccessError)
+ qCritical() << "An access error occurred (e.g. trying to write to a read-only file).";
+ if (status == QSettings::Status::FormatError)
+ qCritical() << "A format error occurred (e.g. loading a malformed INI file).";
return false;
- bool success = loadFile(file.readAll());
- file.close();
- return success;
-}
-
-bool INIFile::loadFile(QByteArray file)
-{
- QTextStream in(file);
-#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0)
- in.setCodec("UTF-8");
-#endif
-
- QStringList lines = in.readAll().split('\n');
- for (int i = 0; i < lines.count(); i++)
- {
- QString &lineRaw = lines[i];
- // Ignore comments.
- int commentIndex = 0;
- QString line = lineRaw;
- // Search for comments until no more escaped # are available
- while((commentIndex = line.indexOf('#', commentIndex + 1)) != -1) {
- if(commentIndex > 0 && line.at(commentIndex - 1) == '\\') {
- continue;
- }
- line = line.left(lineRaw.indexOf('#')).trimmed();
- }
-
- int eqPos = line.indexOf('=');
- if (eqPos == -1)
- continue;
- QString key = line.left(eqPos).trimmed();
- QString valueStr = line.right(line.length() - eqPos - 1).trimmed();
-
- valueStr = unescape(valueStr);
-
- QVariant value(valueStr);
- this->operator[](key) = value;
}
+ for (auto&& key : _settings_obj.allKeys())
+ insert(key, _settings_obj.value(key));
+
return true;
}
@@ -184,20 +104,3 @@ void INIFile::set(QString key, QVariant val)
this->operator[](key) = val;
}
-void INIFile::setList(QString key, QVariantList val)
-{
- QString stringList = QJsonDocument(QVariant(val).toJsonArray()).toJson(QJsonDocument::Compact);
-
- this->operator[](key) = stringList;
-}
-
-QVariantList INIFile::getList(QString key, QVariantList def) const
-{
- if (this->contains(key)) {
- auto src = this->operator[](key);
-
- return QJsonDocument::fromJson(src.toByteArray()).toVariant().toList();
- }
-
- return def;
-}
diff --git a/launcher/settings/INIFile.h b/launcher/settings/INIFile.h
index 86bf0898..0d5c05eb 100644
--- a/launcher/settings/INIFile.h
+++ b/launcher/settings/INIFile.h
@@ -1,16 +1,37 @@
-/* Copyright 2013-2021 MultiMC Contributors
+// SPDX-License-Identifier: GPL-3.0-only
+/*
+ * Prism Launcher - Minecraft Launcher
+ * Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
+ * Copyright (C) 2023 flowln <flowlnlnln@gmail.com>
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3.
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * This file incorporates work covered by the following copyright and
+ * permission notice:
+ *
+ * Copyright 2013-2021 MultiMC Contributors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
#pragma once
@@ -28,44 +49,9 @@ class INIFile : public QMap<QString, QVariant>
public:
explicit INIFile();
- bool loadFile(QByteArray file);
bool loadFile(QString fileName);
bool saveFile(QString fileName);
QVariant get(QString key, QVariant def) const;
void set(QString key, QVariant val);
- static QString unescape(QString orig);
- static QString escape(QString orig);
-
- void setList(QString key, QVariantList val);
- template <typename T> void setList(QString key, QList<T> val)
- {
- QVariantList variantList;
- variantList.reserve(val.size());
- for (const T& v : val)
- {
- variantList.append(v);
- }
-
- this->setList(key, variantList);
- }
-
- QVariantList getList(QString key, QVariantList def) const;
- template <typename T> QList<T> getList(QString key, QList<T> def) const
- {
- if (this->contains(key)) {
- QVariant src = this->operator[](key);
- QVariantList variantList = QJsonDocument::fromJson(src.toByteArray()).toVariant().toList();
-
- QList<T>TList;
- TList.reserve(variantList.size());
- for (const QVariant& v : variantList)
- {
- TList.append(v.value<T>());
- }
- return TList;
- }
-
- return def;
- }
};
diff --git a/launcher/settings/SettingsObject.cpp b/launcher/settings/SettingsObject.cpp
index 4c51d6e9..8a0bc045 100644
--- a/launcher/settings/SettingsObject.cpp
+++ b/launcher/settings/SettingsObject.cpp
@@ -121,19 +121,6 @@ bool SettingsObject::contains(const QString &id)
return m_settings.contains(id);
}
-bool SettingsObject::setList(const QString &id, QVariantList value)
-{
- QString stringList = QJsonDocument(QVariant(value).toJsonArray()).toJson(QJsonDocument::Compact);
-
- return set(id, stringList);
-}
-
-QVariantList SettingsObject::getList(const QString &id)
-{
- QVariant value = this->get(id);
- return QJsonDocument::fromJson(value.toByteArray()).toVariant().toList();
-}
-
bool SettingsObject::reload()
{
for (auto setting : m_settings.values())
diff --git a/launcher/settings/SettingsObject.h b/launcher/settings/SettingsObject.h
index ff430172..4d735511 100644
--- a/launcher/settings/SettingsObject.h
+++ b/launcher/settings/SettingsObject.h
@@ -145,45 +145,6 @@ public:
bool contains(const QString &id);
/*!
- * \brief Sets the value of the setting with the given ID with a json list.
- * If no setting with the given ID exists, returns false
- * \param id The ID of the setting to change.
- * \param value The new value of the setting.
- */
- bool setList(const QString &id, QVariantList value);
- template <typename T> bool setList(const QString &id, QList<T> val)
- {
- QVariantList variantList;
- variantList.reserve(val.size());
- for (const T& v : val)
- {
- variantList.append(v);
- }
-
- return setList(id, variantList);
- }
-
- /**
- * \brief Gets the value of the setting with the given ID as if it were a json list.
- * \param id The ID of the setting to change.
- * \return The setting's value as a QVariantList.
- * If no setting with the given ID exists, returns an empty QVariantList.
- */
- QVariantList getList(const QString &id);
- template <typename T> QList<T> getList(const QString &id)
- {
- QVariantList variantList = this->getList(id);
-
- QList<T>TList;
- TList.reserve(variantList.size());
- for (const QVariant& v : variantList)
- {
- TList.append(v.value<T>());
- }
- return TList;
- }
-
- /*!
* \brief Reloads the settings and emit signals for changed settings
* \return True if reloading was successful
*/
diff --git a/tests/INIFile_test.cpp b/tests/INIFile_test.cpp
index d13937c0..4be8133c 100644
--- a/tests/INIFile_test.cpp
+++ b/tests/INIFile_test.cpp
@@ -4,6 +4,7 @@
#include <QVariant>
#include <settings/INIFile.h>
+#include <QVariantUtils.h>
class IniFileTest : public QObject
{
@@ -30,15 +31,6 @@ slots:
QTest::newRow("Escape sequences 2") << "\"\n\n\"";
QTest::newRow("Hashtags") << "some data#something";
}
- void test_Escape()
- {
- QFETCH(QString, through);
-
- QString there = INIFile::escape(through);
- QString back = INIFile::unescape(there);
-
- QCOMPARE(back, through);
- }
void test_SaveLoad()
{
@@ -61,32 +53,30 @@ slots:
void test_SaveLoadLists()
{
- QString slist_strings = "[\"a\",\"b\",\"c\"]";
+ QString slist_strings = "(\"a\",\"b\",\"c\")";
QStringList list_strings = {"a", "b", "c"};
- QString slist_numbers = "[1,2,3,10]";
+ QString slist_numbers = "(1,2,3,10)";
QList<int> list_numbers = {1, 2, 3, 10};
QString filename = "test_SaveLoadLists.ini";
INIFile f;
- f.setList("list_strings", list_strings);
- f.setList("list_numbers", list_numbers);
+ f.set("list_strings", list_strings);
+ f.set("list_numbers", QVariantUtils::fromList(list_numbers));
f.saveFile(filename);
// load
INIFile f2;
f2.loadFile(filename);
- QStringList out_list_strings = f2.getList<QString>("list_strings", QStringList());
+ QStringList out_list_strings = f2.get("list_strings", QStringList()).toStringList();
qDebug() << "OutStringList" << out_list_strings;
- QList<int> out_list_numbers = f2.getList<int>("list_numbers", QList<int>());
+ QList<int> out_list_numbers = QVariantUtils::toList<int>(f2.get("list_numbers", QVariantUtils::fromList(QList<int>())));
qDebug() << "OutNumbersList" << out_list_numbers;
- QCOMPARE(f2.get("list_strings","NOT SET").toString(), slist_strings);
QCOMPARE(out_list_strings, list_strings);
- QCOMPARE(f2.get("list_numbers","NOT SET").toString(), slist_numbers);
QCOMPARE(out_list_numbers, list_numbers);
}
};