Skip to content

Commit

Permalink
Add buttons to reset server settings to default or localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
redstrate committed Jul 29, 2024
1 parent 2b346cb commit a8190da
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
5 changes: 5 additions & 0 deletions launcher/include/launchersettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
25 changes: 25 additions & 0 deletions launcher/src/launchersettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand All @@ -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();
Expand Down
36 changes: 36 additions & 0 deletions launcher/ui/Settings/DeveloperSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a8190da

Please sign in to comment.