mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-07 02:35:33 +08:00
[Windows registry] Allow to clean all swift registry entries
* for uninstallation * few users reported a hanging (white screen) swift issue, solved by "cleaning the registry" see https://discordapp.com/channels/539048679160676382/539925070550794240/664557031784448010
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>450</width>
|
||||
<height>750</height>
|
||||
<height>800</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>375</width>
|
||||
<height>600</height>
|
||||
<height>650</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
||||
@@ -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<CSwiftLauncher> 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()
|
||||
{ }
|
||||
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
<item>
|
||||
<widget class="QToolBox" name="tb_Launcher">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="tabSpacing">
|
||||
<number>6</number>
|
||||
@@ -214,6 +214,14 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pg_CoreMode">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>450</width>
|
||||
<height>365</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>&Core mode</string>
|
||||
</attribute>
|
||||
@@ -528,7 +536,7 @@
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<spacer name="vs_Tools">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -541,8 +549,31 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QGroupBox" name="gb_ToolsP3dFsx">
|
||||
<property name="title">
|
||||
<string>P3D/FSX</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_P3DConfigDirs">
|
||||
<property name="text">
|
||||
<string>P3D config dirs.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_FSXConfigDirs">
|
||||
<property name="text">
|
||||
<string>FSX config dirs.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QGroupBox" name="gb_Log">
|
||||
<widget class="QGroupBox" name="gb_ToolsLog">
|
||||
<property name="title">
|
||||
<string>Log</string>
|
||||
</property>
|
||||
@@ -571,23 +602,16 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QGroupBox" name="gb_P3dFsx">
|
||||
<item row="4" column="0">
|
||||
<widget class="QGroupBox" name="gb_ToolsWindows">
|
||||
<property name="title">
|
||||
<string>P3D/FSX</string>
|
||||
<string>Windows</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<layout class="QVBoxLayout" name="vl_ClearRegistry">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_P3DConfigDirs">
|
||||
<widget class="QPushButton" name="pb_ClearRegistry">
|
||||
<property name="text">
|
||||
<string>P3D config dirs.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_FSXConfigDirs">
|
||||
<property name="text">
|
||||
<string>FSX config dirs.</string>
|
||||
<string>clear registry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -840,6 +864,12 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>BlackGui::COverlayMessagesFrame</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/overlaymessagesframe.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CDbLoadOverviewComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
@@ -852,12 +882,6 @@
|
||||
<header>blackgui/components/logcomponent.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::COverlayMessagesFrame</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>blackgui/overlaymessagesframe.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BlackGui::Components::CInfoBarWebReadersStatusSmallComponent</class>
|
||||
<extends>QFrame</extends>
|
||||
|
||||
Reference in New Issue
Block a user