diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-12-28 01:25:33 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-12-28 01:25:33 -0500 |
| commit | 51db1f99f0c4cddc0af224d46d6e5679d18d2a53 (patch) | |
| tree | ddb11e4aef19b1d428c9f71bdc734e59b2e2d25d /src/settings.cpp | |
| parent | 106ed49baecc60dbdf4844ed684df750e5caf3aa (diff) | |
custom browser command
changed some places that used QDesktopServices to use shell::Open() from uibase instead
Diffstat (limited to 'src/settings.cpp')
| -rw-r--r-- | src/settings.cpp | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/src/settings.cpp b/src/settings.cpp index ebb4fabe..6445bfbe 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -66,7 +66,8 @@ Settings::Settings(const QString& path, bool globalInstance) : m_Settings(path, QSettings::IniFormat), m_Game(m_Settings), m_Geometry(m_Settings), m_Widgets(m_Settings, globalInstance), m_Colors(m_Settings), - m_Plugins(m_Settings), m_Paths(m_Settings), m_Network(m_Settings), + m_Plugins(m_Settings), m_Paths(m_Settings), + m_Network(m_Settings, globalInstance), m_Nexus(*this, m_Settings), m_Steam(*this, m_Settings), m_Interface(m_Settings), m_Diagnostics(m_Settings) { @@ -1670,9 +1671,21 @@ void PathSettings::setOverwrite(const QString& path) } -NetworkSettings::NetworkSettings(QSettings& settings) +NetworkSettings::NetworkSettings(QSettings& settings, bool globalInstance) : m_Settings(settings) { + if (globalInstance) { + updateCustomBrowser(); + } +} + +void NetworkSettings::updateCustomBrowser() +{ + if (useCustomBrowser()) { + MOBase::shell::SetUrlHandler(customBrowserCommand()); + } else { + MOBase::shell::SetUrlHandler(""); + } } bool NetworkSettings::offlineMode() const @@ -1804,6 +1817,28 @@ void NetworkSettings::updateFromOldMap() updateServers(servers); } +bool NetworkSettings::useCustomBrowser() const +{ + return get<bool>(m_Settings, "Settings", "use_custom_browser", false); +} + +void NetworkSettings::setUseCustomBrowser(bool b) +{ + set(m_Settings, "Settings", "use_custom_browser", b); + updateCustomBrowser(); +} + +QString NetworkSettings::customBrowserCommand() const +{ + return get<QString>(m_Settings, "Settings", "custom_browser", ""); +} + +void NetworkSettings::setCustomBrowserCommand(const QString& s) +{ + set(m_Settings, "Settings", "custom_browser", s); + updateCustomBrowser(); +} + ServerList NetworkSettings::serversFromOldMap() const { // for 2.2.1 and before |
