1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Use local path instead of appData

This commit is contained in:
kelteseth 2018-11-04 13:02:26 +01:00
parent 92c09aa2bd
commit 10262a41be

View File

@ -1,4 +1,5 @@
#include "settings.h" #include "settings.h"
#include <QGuiApplication>
Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListModel* ilm, SDKConnector* sdkc, AppId_t steamID, QGuiApplication* app, QObject* parent) Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListModel* ilm, SDKConnector* sdkc, AppId_t steamID, QGuiApplication* app, QObject* parent)
: QObject(parent) : QObject(parent)
@ -12,7 +13,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
m_qGuiApplication = app; m_qGuiApplication = app;
QFile configTmp; QFile configTmp;
QString appConfigLocation = QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); QString appConfigLocation = QGuiApplication::applicationDirPath();
m_localSettingsPath = QUrl(appConfigLocation); m_localSettingsPath = QUrl(appConfigLocation);
if (!QDir(appConfigLocation).exists()) { if (!QDir(appConfigLocation).exists()) {
if (!QDir().mkdir(appConfigLocation)) { if (!QDir().mkdir(appConfigLocation)) {
@ -30,7 +31,7 @@ Settings::Settings(ProfileListModel* plm, MonitorListModel* mlm, InstalledListMo
} }
QJsonDocument configJsonDocument; QJsonDocument configJsonDocument;
QJsonParseError parseError{}; QJsonParseError parseError {};
QJsonObject configObj; QJsonObject configObj;
configTmp.open(QIODevice::ReadOnly | QIODevice::Text); configTmp.open(QIODevice::ReadOnly | QIODevice::Text);
@ -150,7 +151,7 @@ void Settings::writeSingleSettingConfig(QString name, QVariant value)
{ {
QJsonDocument configJsonDocument; QJsonDocument configJsonDocument;
QJsonParseError parseError{}; QJsonParseError parseError {};
QJsonObject configObj; QJsonObject configObj;
QFile configTmp; QFile configTmp;
@ -263,7 +264,7 @@ void Settings::setPlayAll(bool isPlaying)
void Settings::createDefaultConfig() void Settings::createDefaultConfig()
{ {
QFile file(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation) + "/settings.json"); QFile file(QGuiApplication::applicationDirPath() + "/settings.json");
QFile defaultSettings(":/settings.json"); QFile defaultSettings(":/settings.json");
file.open(QIODevice::WriteOnly | QIODevice::Text); file.open(QIODevice::WriteOnly | QIODevice::Text);