diff --git a/src/core/configurator.cpp b/src/core/configurator.cpp index 1bea6fb..220bf37 100644 --- a/src/core/configurator.cpp +++ b/src/core/configurator.cpp @@ -205,13 +205,24 @@ const bool Configurator::isStartAtLogin() return loadValue("startAtLogin", false).toBool(); } -void Configurator::setSystemProxy(bool flag) { +void Configurator::setAutoUpdate(bool autoUpdate) +{ + saveValue("autoUpdate", autoUpdate); +} + +const bool Configurator::isAutoUpdate() +{ + return loadValue("autoUpdate", true).toBool(); +} + +void Configurator::setSystemProxy(bool flag) +{ saveValue("systemProxy", flag); if (flag) { NetworkProxy httpProxy("http", "127.0.0.1", getHttpPort(), NetworkProxyMode::GLOBAL_MODE); NetworkProxyHelper::setSystemProxy(httpProxy); - #ifndef Q_OS_WIN +#ifndef Q_OS_WIN NetworkProxy socksProxy("socks", "127.0.0.1", getSocksPort(), NetworkProxyMode::GLOBAL_MODE); NetworkProxyHelper::setSystemProxy(socksProxy); diff --git a/src/core/configurator.h b/src/core/configurator.h index 8219561..92540ad 100644 --- a/src/core/configurator.h +++ b/src/core/configurator.h @@ -45,6 +45,9 @@ class Configurator : public QObject { void setStartAtLogin(bool autoStart); const bool isStartAtLogin(); + void setAutoUpdate(bool autoUpdate); + const bool isAutoUpdate(); + void setSystemProxy(bool flag); const bool isSystemProxy(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4513244..70d7be5 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -175,6 +175,7 @@ void MainWindow::createActions() autoUpdateSubConfig = new QAction(tr("Auto Update"), this); autoUpdateSubConfig->setCheckable(true); + autoUpdateSubConfig->setChecked(configurator.isAutoUpdate()); connect(autoUpdateSubConfig, &QAction::triggered, this, &MainWindow::autoUpdateSubConfigChange); about = new QAction(tr("About"), this); @@ -348,8 +349,10 @@ void MainWindow::startAtLoginChange(bool autoStart) void MainWindow::autoUpdateSubConfigChange(bool autoUpdate) { + configurator.setAutoUpdate(autoUpdate); if (autoUpdate) { - + if (!timer->isActive()) + timer->start(); } else { if (timer->isActive()) timer->stop();