feat: add proxy settings management and refactor auto-start functionality

- Added proxy settings handling in utils and integrated it into the main application logic.
- Refactored auto-start feature to streamline the process across different operating systems.
- Removed outdated code related to auto-start settings from mainwindow and settingwindow.
- Introduced utility functions for better management of system proxy and auto-start settings.
This commit is contained in:
Chenx Dust
2025-01-08 16:40:50 +08:00
parent b285b93622
commit 7a26539967
7 changed files with 263 additions and 144 deletions

View File

@@ -5,6 +5,7 @@
#include "settingwindow.h"
#include "ui_settingwindow.h"
#include "../utils/utils.h"
SettingWindow::SettingWindow(QWidget *parent, QSettings *inputSettings) :
QDialog(parent),
@@ -66,25 +67,7 @@ SettingWindow::SettingWindow(QWidget *parent, QSettings *inputSettings) :
settings->sync();
if (settings->value("Common/AutoStart").toBool())
{
QSettings autoStartSettings(
R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)",
QSettings::NativeFormat
);
autoStartSettings.setValue(
QApplication::applicationName(),
QCoreApplication::applicationFilePath().replace('/', '\\')
);
}
else
{
QSettings autoStartSettings(
R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run)",
QSettings::NativeFormat
);
autoStartSettings.remove(QApplication::applicationName());
}
Utils::setAutoStart(settings->value("Common/AutoStart").toBool());
};
connect(ui->buttonBox, &QDialogButtonBox::accepted, applySettings);