mirror of
https://github.com/chenx-dust/EZ4Connect.git
synced 2026-09-20 10:23:33 +08:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user