diff --git a/src/blackgui/guiapplication.cpp b/src/blackgui/guiapplication.cpp index 2ce0d3751..16460e005 100644 --- a/src/blackgui/guiapplication.cpp +++ b/src/blackgui/guiapplication.cpp @@ -91,6 +91,31 @@ namespace BlackGui return l; } + const QString &CGuiApplication::settingsOrganization() + { + static const QString o("swift-project.org"); + return o; + } + + bool CGuiApplication::removeAllWindowsSwiftRegistryEntries() + { + if (!CBuildConfig::isRunningOnWindowsNtPlatform()) { return false; } + + // On Windows, NativeFormat settings are stored in the following registry paths: + // HKEY_CURRENT_USER\Software\MySoft\Star Runner. + // HKEY_CURRENT_USER\Software\MySoft\OrganizationDefaults. + // HKEY_LOCAL_MACHINE\Software\MySoft\Star Runner. + // HKEY_LOCAL_MACHINE\Software\MySoft\OrganizationDefaults. + + QSettings s1("HKEY_CURRENT_USER\\Software\\" + settingsOrganization(), QSettings::NativeFormat); + s1.remove(""); + + QSettings s2("HKEY_LOCAL_MACHINE\\Software\\" + settingsOrganization(), QSettings::NativeFormat); + s2.remove(""); + + return true; + } + CGuiApplication::CGuiApplication(const QString &applicationName, CApplicationInfo::Application application, const QPixmap &icon) : CApplication(applicationName, application, false) { @@ -372,7 +397,7 @@ namespace BlackGui bool CGuiApplication::saveWindowGeometryAndState(const QMainWindow *window) const { if (!window) { return false; } - QSettings settings("swift-project.org", this->getApplicationName()); + QSettings settings(settingsOrganization(), this->getApplicationName()); settings.setValue("geometry", window->saveGeometry()); settings.setValue("windowState", window->saveState()); return true; @@ -381,7 +406,7 @@ namespace BlackGui void CGuiApplication::resetWindowGeometryAndState() { QByteArray ba; - QSettings settings("swift-project.org", this->getApplicationName()); + QSettings settings(settingsOrganization(), this->getApplicationName()); settings.setValue("geometry", ba); settings.setValue("windowState", ba); } diff --git a/src/blackgui/guiapplication.h b/src/blackgui/guiapplication.h index 5029ae625..d47f80adc 100644 --- a/src/blackgui/guiapplication.h +++ b/src/blackgui/guiapplication.h @@ -82,6 +82,12 @@ namespace BlackGui //! Own log categories static const BlackMisc::CLogCategoryList &getLogCategories(); + //! Organization string used for settings, is the registry key under windows + static const QString &settingsOrganization(); + + //! Remove all registry entries + static bool removeAllWindowsSwiftRegistryEntries(); + //! Constructor CGuiApplication(const QString &applicationName = executable(), BlackMisc::CApplicationInfo::Application application = BlackMisc::CApplicationInfo::Unknown, const QPixmap &icon = BlackMisc::CIcons::swift64()); diff --git a/src/swiftguistandard/swiftguistd.ui b/src/swiftguistandard/swiftguistd.ui index 1957ec14c..0a53a9076 100644 --- a/src/swiftguistandard/swiftguistd.ui +++ b/src/swiftguistandard/swiftguistd.ui @@ -7,13 +7,13 @@ 0 0 450 - 750 + 800 375 - 600 + 650 diff --git a/src/swiftlauncher/swiftlauncher.cpp b/src/swiftlauncher/swiftlauncher.cpp index a754d107a..1e0daba8b 100644 --- a/src/swiftlauncher/swiftlauncher.cpp +++ b/src/swiftlauncher/swiftlauncher.cpp @@ -96,6 +96,13 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) : m_checkTimer.setInterval(2500); m_checkTimer.start(); + // platform specific tool + ui->gb_ToolsWindows->setEnabled(CBuildConfig::isRunningOnWindowsNtPlatform()); + if (CBuildConfig::isRunningOnWindowsNtPlatform()) + { + connect(ui->pb_ClearRegistry, &QPushButton::released, this, &CSwiftLauncher::clearWindowsRegistry); + } + const QPointer myself(this); if (sGui->isInstallerOptionSet()) { @@ -163,6 +170,18 @@ void CSwiftLauncher::installerMode() if (startWizard) { this->startWizard(); } } +void CSwiftLauncher::clearWindowsRegistry() +{ + if (!CBuildConfig::isRunningOnWindowsNtPlatform()) { return; } + const QMessageBox::StandardButton ret = QMessageBox::warning(this, + tr("Registry swift applications"), + tr("Do you really want to delete all entries?\nThis cannot be undone!"), + QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, + QMessageBox::No); + if (ret != QMessageBox::Yes) { return; } + CGuiApplication::removeAllWindowsSwiftRegistryEntries(); +} + CSwiftLauncher::~CSwiftLauncher() { } diff --git a/src/swiftlauncher/swiftlauncher.h b/src/swiftlauncher/swiftlauncher.h index fdca66e23..3de9ad06d 100644 --- a/src/swiftlauncher/swiftlauncher.h +++ b/src/swiftlauncher/swiftlauncher.h @@ -216,6 +216,9 @@ private: //! Run in installer mode void installerMode(); + //! Clear Windows registry + void clearWindowsRegistry(); + //! Command line static QString toCmdLine(const QString &exe, const QStringList &exeArgs); }; diff --git a/src/swiftlauncher/swiftlauncher.ui b/src/swiftlauncher/swiftlauncher.ui index 4d052ceca..b2d4f89e9 100644 --- a/src/swiftlauncher/swiftlauncher.ui +++ b/src/swiftlauncher/swiftlauncher.ui @@ -88,7 +88,7 @@ - 2 + 4 6 @@ -214,6 +214,14 @@ + + + 0 + 0 + 450 + 365 + + &Core mode @@ -528,7 +536,7 @@ 3 - + Qt::Vertical @@ -541,8 +549,31 @@ + + + + P3D/FSX + + + + + + P3D config dirs. + + + + + + + FSX config dirs. + + + + + + - + Log @@ -571,23 +602,16 @@ - - + + - P3D/FSX + Windows - + - + - P3D config dirs. - - - - - - - FSX config dirs. + clear registry @@ -840,6 +864,12 @@ + + BlackGui::COverlayMessagesFrame + QFrame +
blackgui/overlaymessagesframe.h
+ 1 +
BlackGui::Components::CDbLoadOverviewComponent QFrame @@ -852,12 +882,6 @@
blackgui/components/logcomponent.h
1
- - BlackGui::COverlayMessagesFrame - QFrame -
blackgui/overlaymessagesframe.h
- 1 -
BlackGui::Components::CInfoBarWebReadersStatusSmallComponent QFrame