diff --git a/launcher/include/launchersettings.h b/launcher/include/launchersettings.h index 946975b..f076586 100644 --- a/launcher/include/launchersettings.h +++ b/launcher/include/launchersettings.h @@ -44,18 +44,23 @@ class LauncherSettings : public QObject [[nodiscard]] QString dalamudDistribServer() const; void setDalamudDistribServer(const QString &value); + Q_INVOKABLE QString defaultDalamudDistribServer() const; [[nodiscard]] QString squareEnixServer() const; void setSquareEnixServer(const QString &value); + Q_INVOKABLE QString defaultSquareEnixServer() const; [[nodiscard]] QString squareEnixLoginServer() const; void setSquareEnixLoginServer(const QString &value); + Q_INVOKABLE QString defaultSquareEnixLoginServer() const; [[nodiscard]] QString mainServer() const; void setMainServer(const QString &value); + Q_INVOKABLE QString defaultMainServer() const; [[nodiscard]] QString preferredProtocol() const; void setPreferredProtocol(const QString &value); + Q_INVOKABLE QString defaultPreferredProtocol() const; [[nodiscard]] QString screenshotDir() const; void setScreenshotDir(const QString &value); diff --git a/launcher/src/launchersettings.cpp b/launcher/src/launchersettings.cpp index 777bfbc..9386198 100644 --- a/launcher/src/launchersettings.cpp +++ b/launcher/src/launchersettings.cpp @@ -79,6 +79,11 @@ void LauncherSettings::setDalamudDistribServer(const QString &value) } } +QString LauncherSettings::defaultDalamudDistribServer() const +{ + return m_config->defaultDalamudDistribServerValue(); +} + QString LauncherSettings::squareEnixServer() const { return m_config->squareEnixServer(); @@ -93,6 +98,11 @@ void LauncherSettings::setSquareEnixServer(const QString &value) } } +QString LauncherSettings::defaultSquareEnixServer() const +{ + return m_config->defaultSquareEnixServerValue(); +} + QString LauncherSettings::squareEnixLoginServer() const { return m_config->squareEnixLoginServer(); @@ -107,6 +117,11 @@ void LauncherSettings::setSquareEnixLoginServer(const QString &value) } } +QString LauncherSettings::defaultSquareEnixLoginServer() const +{ + return m_config->defaultSquareEnixLoginServerValue(); +} + QString LauncherSettings::mainServer() const { return m_config->mainServer(); @@ -121,6 +136,11 @@ void LauncherSettings::setMainServer(const QString &value) } } +QString LauncherSettings::defaultMainServer() const +{ + return m_config->defaultMainServerValue(); +} + QString LauncherSettings::preferredProtocol() const { return m_config->preferredProtocol(); @@ -135,6 +155,11 @@ void LauncherSettings::setPreferredProtocol(const QString &value) } } +QString LauncherSettings::defaultPreferredProtocol() const +{ + return m_config->defaultPreferredProtocolValue(); +} + QString LauncherSettings::screenshotDir() const { return m_config->screenshotDir(); diff --git a/launcher/ui/Settings/DeveloperSettings.qml b/launcher/ui/Settings/DeveloperSettings.qml index 283454e..18488f2 100644 --- a/launcher/ui/Settings/DeveloperSettings.qml +++ b/launcher/ui/Settings/DeveloperSettings.qml @@ -85,6 +85,42 @@ FormCard.FormCardPage { FormCard.FormCard { Layout.fillWidth: true + FormCard.FormButtonDelegate { + id: resetToDefaultsDelegate + + text: i18n("Reset to Defaults") + + onClicked: { + preferredProtocolDelegate.text = LauncherCore.settings.defaultPreferredProtocol(); + dalamudServerDelegate.text = LauncherCore.settings.defaultDalamudDistribServer(); + squareMainServerDelegate.text = LauncherCore.settings.defaultSquareEnixServer(); + loginServerDelegate.text = LauncherCore.settings.defaultSquareEnixLoginServer(); + mainServerDelegate.text = LauncherCore.settings.defaultMainServer(); + } + } + + FormCard.FormDelegateSeparator { + above: resetToDefaultsDelegate + below: localServerDelegate + } + + FormCard.FormButtonDelegate { + id: localServerDelegate + + text: i18n("Set to localhost") + + onClicked: { + preferredProtocolDelegate.text = "http"; + squareMainServerDelegate.text = "ffxiv.local"; + loginServerDelegate.text = "square.local"; + } + } + + FormCard.FormDelegateSeparator { + above: localServerDelegate + below: preferredProtocolDelegate + } + FormCard.FormTextFieldDelegate { id: preferredProtocolDelegate