mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
add settings reset functionality
This commit is contained in:
+11
-3
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "settingsmanager.h"
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
@@ -31,6 +32,16 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
QCoreApplication::setOrganizationName("iDescriptor");
|
||||
QCoreApplication::setApplicationName("iDescriptor");
|
||||
QCoreApplication::setApplicationVersion(APP_VERSION);
|
||||
|
||||
if (a.arguments().contains("--reset-settings")) {
|
||||
SettingsManager::sharedInstance()->clear();
|
||||
QMessageBox::information(nullptr, "Settings Reset",
|
||||
"All application settings have been reset to "
|
||||
"their default values.");
|
||||
}
|
||||
#ifdef WIN32
|
||||
QString appPath = QCoreApplication::applicationDirPath();
|
||||
QString gstPluginPath =
|
||||
@@ -66,9 +77,6 @@ int main(int argc, char *argv[])
|
||||
setenv("GST_PLUGIN_SYSTEM_PATH", gstPluginPath.toUtf8().constData(), 1);
|
||||
setenv("GST_PLUGIN_SCANNER", gstPluginScannerPath.toUtf8().constData(), 1);
|
||||
#endif
|
||||
QCoreApplication::setOrganizationName("iDescriptor");
|
||||
QCoreApplication::setApplicationName("iDescriptor");
|
||||
QCoreApplication::setApplicationVersion(APP_VERSION);
|
||||
#ifndef __APPLE__
|
||||
QApplication::setStyle(QStyleFactory::create("Fusion"));
|
||||
#endif
|
||||
|
||||
@@ -50,9 +50,12 @@ void SettingsManager::showSettingsDialog()
|
||||
SettingsManager::SettingsManager(QObject *parent) : QObject{parent}
|
||||
{
|
||||
m_settings = new QSettings(this);
|
||||
}
|
||||
|
||||
// Clean up any invalid favorite places on startup
|
||||
// cleanupFavoritePlaces();
|
||||
void SettingsManager::clear()
|
||||
{
|
||||
m_settings->clear();
|
||||
m_settings->sync();
|
||||
}
|
||||
|
||||
QString SettingsManager::devdiskimgpath() const
|
||||
|
||||
@@ -95,6 +95,7 @@ public:
|
||||
// Reset to defaults
|
||||
void resetToDefaults();
|
||||
|
||||
void clear();
|
||||
signals:
|
||||
void favoritePlacesChanged();
|
||||
void recentLocationsChanged();
|
||||
|
||||
Reference in New Issue
Block a user