From eb784b0d2e3c6519b4e79733982fa200cae9043a Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 28 Aug 2019 12:35:06 +0800 Subject: [PATCH] Move "Check for program updates" checkbox out of Advanced settings --- src/gui/advancedsettings.cpp | 10 ---------- src/gui/advancedsettings.h | 4 ---- src/gui/optionsdialog.cpp | 18 +++++++++++++----- src/gui/optionsdialog.ui | 7 +++++++ 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/gui/advancedsettings.cpp b/src/gui/advancedsettings.cpp index 21621f771..64c7fae0b 100644 --- a/src/gui/advancedsettings.cpp +++ b/src/gui/advancedsettings.cpp @@ -70,9 +70,6 @@ enum AdvSettingsRows SAVE_RESUME_DATA_INTERVAL, CONFIRM_RECHECK_TORRENT, RECHECK_COMPLETED, -#if defined(Q_OS_WIN) || defined(Q_OS_MAC) - UPDATE_CHECK, -#endif // UI related LIST_REFRESH, RESOLVE_HOSTS, @@ -235,9 +232,6 @@ void AdvancedSettings::saveAdvancedSettings() // Seed choking algorithm session->setSeedChokingAlgorithm(static_cast(m_comboBoxSeedChokingAlgorithm.currentIndex())); -#if defined(Q_OS_WIN) || defined(Q_OS_MAC) - pref->setUpdateCheckEnabled(m_checkBoxUpdateCheck.isChecked()); -#endif // Icon theme #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) pref->useSystemIconTheme(m_checkBoxUseIconTheme.isChecked()); @@ -521,10 +515,6 @@ void AdvancedSettings::loadAdvancedSettings() addRow(SEED_CHOKING_ALGORITHM, (tr("Upload choking algorithm") + ' ' + makeLink("https://www.libtorrent.org/reference-Settings.html#seed_choking_algorithm", "(?)")) , &m_comboBoxSeedChokingAlgorithm); -#if defined(Q_OS_WIN) || defined(Q_OS_MAC) - m_checkBoxUpdateCheck.setChecked(pref->isUpdateCheckEnabled()); - addRow(UPDATE_CHECK, tr("Check for software updates"), &m_checkBoxUpdateCheck); -#endif #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) m_checkBoxUseIconTheme.setChecked(pref->useSystemIconTheme()); addRow(USE_ICON_THEME, tr("Use system icon theme"), &m_checkBoxUseIconTheme); diff --git a/src/gui/advancedsettings.h b/src/gui/advancedsettings.h index 706bea138..3f5ffb977 100644 --- a/src/gui/advancedsettings.h +++ b/src/gui/advancedsettings.h @@ -69,10 +69,6 @@ private: QLineEdit m_lineEditAnnounceIP; // OS dependent settings -#if defined(Q_OS_WIN) || defined(Q_OS_MAC) - QCheckBox m_checkBoxUpdateCheck; -#endif - #if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC)) QCheckBox m_checkBoxUseIconTheme; #endif diff --git a/src/gui/optionsdialog.cpp b/src/gui/optionsdialog.cpp index aaaf01e16..f8adb135d 100644 --- a/src/gui/optionsdialog.cpp +++ b/src/gui/optionsdialog.cpp @@ -200,6 +200,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) #if !(defined(Q_OS_WIN) || defined(Q_OS_MAC)) m_ui->groupFileAssociation->setVisible(false); + m_ui->checkProgramUpdates->setVisible(false); #endif m_ui->textWebUIRootFolder->setMode(FileSystemPathEdit::Mode::DirectoryOpen); @@ -215,7 +216,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) connect(m_ui->checkRandomPort, &QAbstractButton::toggled, m_ui->spinPort, &ThisType::setDisabled); // Apply button is activated when a value is changed - // General tab + // Behavior tab connect(m_ui->comboI18n, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton); connect(m_ui->comboTheme, qComboBoxCurrentIndexChanged, this, &ThisType::enableApplyButton); connect(m_ui->confirmDeletion, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); @@ -243,6 +244,7 @@ OptionsDialog::OptionsDialog(QWidget *parent) #if defined(Q_OS_WIN) || defined(Q_OS_MAC) connect(m_ui->checkAssociateTorrents, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); connect(m_ui->checkAssociateMagnetLinks, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); + connect(m_ui->checkProgramUpdates, &QAbstractButton::toggled, this, &ThisType::enableApplyButton); #endif connect(m_ui->checkFileLog, &QGroupBox::toggled, this, &ThisType::enableApplyButton); connect(m_ui->textFileLogPath, &FileSystemPathEdit::selectedPathChanged, this, &ThisType::enableApplyButton); @@ -594,7 +596,7 @@ void OptionsDialog::saveOptions() qApp->installTranslator(translator); } - // General preferences + // Behavior preferences pref->setLocale(locale); if (!m_uiThemeFilePath.isEmpty() @@ -638,6 +640,9 @@ void OptionsDialog::saveOptions() m_ui->checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet()); m_ui->checkAssociateMagnetLinks->setEnabled(!m_ui->checkAssociateMagnetLinks->isChecked()); } +#endif +#if defined(Q_OS_WIN) || defined(Q_OS_MAC) + pref->setUpdateCheckEnabled(m_ui->checkProgramUpdates->isChecked()); #endif auto *const app = static_cast(QCoreApplication::instance()); app->setFileLoggerPath(m_ui->textFileLogPath->selectedPath()); @@ -647,7 +652,7 @@ void OptionsDialog::saveOptions() app->setFileLoggerAgeType(m_ui->comboFileLogAgeType->currentIndex()); app->setFileLoggerDeleteOld(m_ui->checkFileLogDelete->isChecked()); app->setFileLoggerEnabled(m_ui->checkFileLog->isChecked()); - // End General preferences + // End Behavior preferences RSS::Session::instance()->setRefreshInterval(m_ui->spinRSSRefreshInterval->value()); RSS::Session::instance()->setMaxArticlesPerFeed(m_ui->spinRSSMaxArticlesPerFeed->value()); @@ -833,7 +838,7 @@ void OptionsDialog::loadOptions() bool fileLogDelete = true; const Preferences *const pref = Preferences::instance(); - // General preferences + // Behavior preferences setLocale(pref->getLocale()); m_ui->confirmDeletion->setChecked(pref->confirmTorrentDeletion()); m_ui->checkAltRowColors->setChecked(pref->useAlternatingRowColors()); @@ -869,6 +874,9 @@ void OptionsDialog::loadOptions() m_ui->checkAssociateMagnetLinks->setChecked(Preferences::isMagnetLinkAssocSet()); m_ui->checkAssociateMagnetLinks->setEnabled(!m_ui->checkAssociateMagnetLinks->isChecked()); #endif +#if defined(Q_OS_WIN) || defined(Q_OS_MAC) + m_ui->checkProgramUpdates->setChecked(pref->isUpdateCheckEnabled()); +#endif const Application *const app = static_cast(QCoreApplication::instance()); m_ui->checkFileLog->setChecked(app->isFileLoggerEnabled()); @@ -883,7 +891,7 @@ void OptionsDialog::loadOptions() m_ui->spinFileLogSize->setValue(app->fileLoggerMaxSize() / 1024); m_ui->spinFileLogAge->setValue(app->fileLoggerAge()); m_ui->comboFileLogAgeType->setCurrentIndex(app->fileLoggerAgeType()); - // End General preferences + // End Behavior preferences m_ui->checkRSSEnable->setChecked(RSS::Session::instance()->isProcessingEnabled()); m_ui->checkRSSAutoDownloaderEnable->setChecked(RSS::AutoDownloader::instance()->isProcessingEnabled()); diff --git a/src/gui/optionsdialog.ui b/src/gui/optionsdialog.ui index d8a74f9b1..28b3eafaf 100644 --- a/src/gui/optionsdialog.ui +++ b/src/gui/optionsdialog.ui @@ -501,6 +501,13 @@ + + + + Check for program updates + + +