mirror of
https://github.com/redstrate/Astra.git
synced 2025-04-20 11:47:46 +00:00
Move config to app config folder
This stops polluting the .config folder, and makes it tidier to move configs and such.
This commit is contained in:
parent
943cd61990
commit
910e023dc7
4 changed files with 58 additions and 53 deletions
|
@ -7,7 +7,7 @@
|
||||||
SPDX-FileCopyrightText: Joshua Goins <josh@redstrate.com>
|
SPDX-FileCopyrightText: Joshua Goins <josh@redstrate.com>
|
||||||
SPDX-License-Identifier: CC0-1.0
|
SPDX-License-Identifier: CC0-1.0
|
||||||
-->
|
-->
|
||||||
<kcfgfile name="astrarc" />
|
<kcfgfile arg="true" />
|
||||||
<group name="General">
|
<group name="General">
|
||||||
<entry name="CloseWhenLaunched" type="bool">
|
<entry name="CloseWhenLaunched" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
|
@ -20,6 +20,10 @@ SPDX-License-Identifier: CC0-1.0
|
||||||
<entry name="ShowDevTools" type="bool">
|
<entry name="ShowDevTools" type="bool">
|
||||||
<default>false</default>
|
<default>false</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry name="AutoLoginProfile" type="String">
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
<group name="Developer">
|
||||||
<entry name="KeepPatches" type="bool">
|
<entry name="KeepPatches" type="bool">
|
||||||
<default>false</default>
|
<default>false</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -38,8 +42,6 @@ SPDX-License-Identifier: CC0-1.0
|
||||||
<entry name="PreferredProtocol" type="String">
|
<entry name="PreferredProtocol" type="String">
|
||||||
<default>https</default>
|
<default>https</default>
|
||||||
</entry>
|
</entry>
|
||||||
<entry name="AutoLoginProfile" type="String">
|
|
||||||
</entry>
|
|
||||||
<entry key="EncryptArguments" type="bool">
|
<entry key="EncryptArguments" type="bool">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
|
@ -5,5 +5,5 @@ ClassName=Config
|
||||||
Mutators=true
|
Mutators=true
|
||||||
DefaultValueGetters=true
|
DefaultValueGetters=true
|
||||||
GenerateProperties=true
|
GenerateProperties=true
|
||||||
ParentInConstructor=true
|
ParentInConstructor=false
|
||||||
Singleton=true
|
Singleton=false
|
|
@ -10,6 +10,7 @@
|
||||||
#include <qcorotask.h>
|
#include <qcorotask.h>
|
||||||
|
|
||||||
#include "accountmanager.h"
|
#include "accountmanager.h"
|
||||||
|
#include "config.h"
|
||||||
#include "headline.h"
|
#include "headline.h"
|
||||||
#include "profile.h"
|
#include "profile.h"
|
||||||
#include "profilemanager.h"
|
#include "profilemanager.h"
|
||||||
|
@ -243,6 +244,7 @@ private:
|
||||||
SquareLauncher *m_squareLauncher = nullptr;
|
SquareLauncher *m_squareLauncher = nullptr;
|
||||||
|
|
||||||
Headline *m_headline = nullptr;
|
Headline *m_headline = nullptr;
|
||||||
|
Config *m_config = nullptr;
|
||||||
|
|
||||||
int m_currentProfileIndex = 0;
|
int m_currentProfileIndex = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -390,6 +390,7 @@ void LauncherCore::readInitialInformation()
|
||||||
|
|
||||||
LauncherCore::LauncherCore()
|
LauncherCore::LauncherCore()
|
||||||
{
|
{
|
||||||
|
m_config = new Config(KSharedConfig::openConfig("astrarc", KConfig::SimpleConfig, QStandardPaths::AppConfigLocation));
|
||||||
mgr = new QNetworkAccessManager(this);
|
mgr = new QNetworkAccessManager(this);
|
||||||
m_sapphireLauncher = new SapphireLauncher(*this, this);
|
m_sapphireLauncher = new SapphireLauncher(*this, this);
|
||||||
m_squareLauncher = new SquareLauncher(*this, this);
|
m_squareLauncher = new SquareLauncher(*this, this);
|
||||||
|
@ -501,170 +502,170 @@ AccountManager *LauncherCore::accountManager()
|
||||||
|
|
||||||
bool LauncherCore::closeWhenLaunched() const
|
bool LauncherCore::closeWhenLaunched() const
|
||||||
{
|
{
|
||||||
return Config::closeWhenLaunched();
|
return m_config->closeWhenLaunched();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::setCloseWhenLaunched(const bool value)
|
void LauncherCore::setCloseWhenLaunched(const bool value)
|
||||||
{
|
{
|
||||||
if (value != Config::closeWhenLaunched()) {
|
if (value != m_config->closeWhenLaunched()) {
|
||||||
Config::setCloseWhenLaunched(value);
|
m_config->setCloseWhenLaunched(value);
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT closeWhenLaunchedChanged();
|
Q_EMIT closeWhenLaunchedChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LauncherCore::showNews() const
|
bool LauncherCore::showNews() const
|
||||||
{
|
{
|
||||||
return Config::showNews();
|
return m_config->showNews();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::setShowNews(const bool value)
|
void LauncherCore::setShowNews(const bool value)
|
||||||
{
|
{
|
||||||
if (value != Config::showNews()) {
|
if (value != m_config->showNews()) {
|
||||||
Config::setShowNews(value);
|
m_config->setShowNews(value);
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT showNewsChanged();
|
Q_EMIT showNewsChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LauncherCore::showDevTools() const
|
bool LauncherCore::showDevTools() const
|
||||||
{
|
{
|
||||||
return Config::showDevTools();
|
return m_config->showDevTools();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::setShowDevTools(const bool value)
|
void LauncherCore::setShowDevTools(const bool value)
|
||||||
{
|
{
|
||||||
if (value != Config::showDevTools()) {
|
if (value != m_config->showDevTools()) {
|
||||||
Config::setShowDevTools(value);
|
m_config->setShowDevTools(value);
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT showDevToolsChanged();
|
Q_EMIT showDevToolsChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LauncherCore::keepPatches() const
|
bool LauncherCore::keepPatches() const
|
||||||
{
|
{
|
||||||
return Config::keepPatches();
|
return m_config->keepPatches();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::setKeepPatches(const bool value)
|
void LauncherCore::setKeepPatches(const bool value)
|
||||||
{
|
{
|
||||||
if (value != Config::keepPatches()) {
|
if (value != m_config->keepPatches()) {
|
||||||
Config::setKeepPatches(value);
|
m_config->setKeepPatches(value);
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT keepPatchesChanged();
|
Q_EMIT keepPatchesChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LauncherCore::dalamudDistribServer() const
|
QString LauncherCore::dalamudDistribServer() const
|
||||||
{
|
{
|
||||||
return Config::dalamudDistribServer();
|
return m_config->dalamudDistribServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::setDalamudDistribServer(const QString &value)
|
void LauncherCore::setDalamudDistribServer(const QString &value)
|
||||||
{
|
{
|
||||||
if (value != Config::dalamudDistribServer()) {
|
if (value != m_config->dalamudDistribServer()) {
|
||||||
Config::setDalamudDistribServer(value);
|
m_config->setDalamudDistribServer(value);
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT dalamudDistribServerChanged();
|
Q_EMIT dalamudDistribServerChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LauncherCore::squareEnixServer() const
|
QString LauncherCore::squareEnixServer() const
|
||||||
{
|
{
|
||||||
return Config::squareEnixServer();
|
return m_config->squareEnixServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::setSquareEnixServer(const QString &value)
|
void LauncherCore::setSquareEnixServer(const QString &value)
|
||||||
{
|
{
|
||||||
if (value != Config::squareEnixServer()) {
|
if (value != m_config->squareEnixServer()) {
|
||||||
Config::setSquareEnixServer(value);
|
m_config->setSquareEnixServer(value);
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT squareEnixServerChanged();
|
Q_EMIT squareEnixServerChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LauncherCore::squareEnixLoginServer() const
|
QString LauncherCore::squareEnixLoginServer() const
|
||||||
{
|
{
|
||||||
return Config::squareEnixLoginServer();
|
return m_config->squareEnixLoginServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::setSquareEnixLoginServer(const QString &value)
|
void LauncherCore::setSquareEnixLoginServer(const QString &value)
|
||||||
{
|
{
|
||||||
if (value != Config::squareEnixLoginServer()) {
|
if (value != m_config->squareEnixLoginServer()) {
|
||||||
Config::setSquareEnixLoginServer(value);
|
m_config->setSquareEnixLoginServer(value);
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT squareEnixLoginServerChanged();
|
Q_EMIT squareEnixLoginServerChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LauncherCore::xivApiServer() const
|
QString LauncherCore::xivApiServer() const
|
||||||
{
|
{
|
||||||
return Config::xivApiServer();
|
return m_config->xivApiServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::setXivApiServer(const QString &value)
|
void LauncherCore::setXivApiServer(const QString &value)
|
||||||
{
|
{
|
||||||
if (value != Config::xivApiServer()) {
|
if (value != m_config->xivApiServer()) {
|
||||||
Config::setXivApiServer(value);
|
m_config->setXivApiServer(value);
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT xivApiServerChanged();
|
Q_EMIT xivApiServerChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LauncherCore::preferredProtocol() const
|
QString LauncherCore::preferredProtocol() const
|
||||||
{
|
{
|
||||||
return Config::preferredProtocol();
|
return m_config->preferredProtocol();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::setPreferredProtocol(const QString &value)
|
void LauncherCore::setPreferredProtocol(const QString &value)
|
||||||
{
|
{
|
||||||
if (value != Config::preferredProtocol()) {
|
if (value != m_config->preferredProtocol()) {
|
||||||
Config::setPreferredProtocol(value);
|
m_config->setPreferredProtocol(value);
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT preferredProtocolChanged();
|
Q_EMIT preferredProtocolChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LauncherCore::argumentsEncrypted() const
|
bool LauncherCore::argumentsEncrypted() const
|
||||||
{
|
{
|
||||||
return Config::encryptArguments();
|
return m_config->encryptArguments();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::setArgumentsEncrypted(const bool value)
|
void LauncherCore::setArgumentsEncrypted(const bool value)
|
||||||
{
|
{
|
||||||
if (Config::encryptArguments() != value) {
|
if (m_config->encryptArguments() != value) {
|
||||||
Config::setEncryptArguments(value);
|
m_config->setEncryptArguments(value);
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT encryptedArgumentsChanged();
|
Q_EMIT encryptedArgumentsChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] QString LauncherCore::autoLoginProfileName() const
|
[[nodiscard]] QString LauncherCore::autoLoginProfileName() const
|
||||||
{
|
{
|
||||||
return Config::autoLoginProfile();
|
return m_config->autoLoginProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] Profile *LauncherCore::autoLoginProfile() const
|
[[nodiscard]] Profile *LauncherCore::autoLoginProfile() const
|
||||||
{
|
{
|
||||||
if (Config::autoLoginProfile().isEmpty()) {
|
if (m_config->autoLoginProfile().isEmpty()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return m_profileManager->getProfileByUUID(Config::autoLoginProfile());
|
return m_profileManager->getProfileByUUID(m_config->autoLoginProfile());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LauncherCore::setAutoLoginProfile(Profile *profile)
|
void LauncherCore::setAutoLoginProfile(Profile *profile)
|
||||||
{
|
{
|
||||||
if (profile == nullptr) {
|
if (profile == nullptr) {
|
||||||
Config::setAutoLoginProfile({});
|
m_config->setAutoLoginProfile({});
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT autoLoginProfileChanged();
|
Q_EMIT autoLoginProfileChanged();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto uuid = profile->uuid();
|
auto uuid = profile->uuid();
|
||||||
if (uuid != Config::autoLoginProfile()) {
|
if (uuid != m_config->autoLoginProfile()) {
|
||||||
Config::setAutoLoginProfile(uuid);
|
m_config->setAutoLoginProfile(uuid);
|
||||||
Config::self()->save();
|
m_config->save();
|
||||||
Q_EMIT autoLoginProfileChanged();
|
Q_EMIT autoLoginProfileChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue