Merge pull request #17341 from Chocobo1/tray
Revise behavior of initializing checkboxes
This commit is contained in:
commit
d6314b30a2
@ -262,6 +262,7 @@ OptionsDialog::OptionsDialog(IGUIApplication *app, QWidget *parent)
|
|||||||
|
|
||||||
// Load options
|
// Load options
|
||||||
loadOptions();
|
loadOptions();
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
#ifdef Q_OS_MACOS
|
||||||
m_ui->checkShowSystray->setVisible(false);
|
m_ui->checkShowSystray->setVisible(false);
|
||||||
#else
|
#else
|
||||||
@ -270,8 +271,7 @@ OptionsDialog::OptionsDialog(IGUIApplication *app, QWidget *parent)
|
|||||||
{
|
{
|
||||||
m_ui->checkShowSystray->setChecked(false);
|
m_ui->checkShowSystray->setChecked(false);
|
||||||
m_ui->checkShowSystray->setEnabled(false);
|
m_ui->checkShowSystray->setEnabled(false);
|
||||||
m_ui->labelTrayIconStyle->setVisible(false);
|
m_ui->checkShowSystray->setToolTip(tr("Disabled due to failed to detect system tray presence"));
|
||||||
m_ui->comboTrayIcon->setVisible(false);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -650,8 +650,6 @@ void OptionsDialog::saveOptions()
|
|||||||
auto *pref = Preferences::instance();
|
auto *pref = Preferences::instance();
|
||||||
auto *session = BitTorrent::Session::instance();
|
auto *session = BitTorrent::Session::instance();
|
||||||
|
|
||||||
m_applyButton->setEnabled(false);
|
|
||||||
|
|
||||||
// Load the translation
|
// Load the translation
|
||||||
QString locale = getLocale();
|
QString locale = getLocale();
|
||||||
if (pref->getLocale() != locale)
|
if (pref->getLocale() != locale)
|
||||||
@ -675,10 +673,10 @@ void OptionsDialog::saveOptions()
|
|||||||
pref->setHideZeroValues(m_ui->checkHideZero->isChecked());
|
pref->setHideZeroValues(m_ui->checkHideZero->isChecked());
|
||||||
pref->setHideZeroComboValues(m_ui->comboHideZero->currentIndex());
|
pref->setHideZeroComboValues(m_ui->comboHideZero->currentIndex());
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
pref->setSystemTrayEnabled(systemTrayEnabled());
|
pref->setSystemTrayEnabled(m_ui->checkShowSystray->isChecked());
|
||||||
pref->setTrayIconStyle(TrayIcon::Style(m_ui->comboTrayIcon->currentIndex()));
|
pref->setTrayIconStyle(TrayIcon::Style(m_ui->comboTrayIcon->currentIndex()));
|
||||||
pref->setCloseToTray(closeToTray());
|
pref->setCloseToTray(m_ui->checkCloseToSystray->isChecked());
|
||||||
pref->setMinimizeToTray(minimizeToTray());
|
pref->setMinimizeToTray(m_ui->checkMinimizeToSysTray->isChecked());
|
||||||
#endif
|
#endif
|
||||||
pref->setStartMinimized(startMinimized());
|
pref->setStartMinimized(startMinimized());
|
||||||
pref->setSplashScreenDisabled(isSplashScreenDisabled());
|
pref->setSplashScreenDisabled(isSplashScreenDisabled());
|
||||||
@ -935,12 +933,9 @@ void OptionsDialog::loadOptions()
|
|||||||
|
|
||||||
#ifndef Q_OS_MACOS
|
#ifndef Q_OS_MACOS
|
||||||
m_ui->checkShowSystray->setChecked(pref->systemTrayEnabled());
|
m_ui->checkShowSystray->setChecked(pref->systemTrayEnabled());
|
||||||
if (m_ui->checkShowSystray->isChecked())
|
m_ui->checkMinimizeToSysTray->setChecked(pref->minimizeToTray());
|
||||||
{
|
m_ui->checkCloseToSystray->setChecked(pref->closeToTray());
|
||||||
m_ui->checkMinimizeToSysTray->setChecked(pref->minimizeToTray());
|
m_ui->comboTrayIcon->setCurrentIndex(static_cast<int>(pref->trayIconStyle()));
|
||||||
m_ui->checkCloseToSystray->setChecked(pref->closeToTray());
|
|
||||||
m_ui->comboTrayIcon->setCurrentIndex(static_cast<int>(pref->trayIconStyle()));
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_ui->checkPreventFromSuspendWhenDownloading->setChecked(pref->preventFromSuspendWhenDownloading());
|
m_ui->checkPreventFromSuspendWhenDownloading->setChecked(pref->preventFromSuspendWhenDownloading());
|
||||||
@ -1354,27 +1349,6 @@ bool OptionsDialog::startMinimized() const
|
|||||||
return m_ui->checkStartMinimized->isChecked();
|
return m_ui->checkStartMinimized->isChecked();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_MACOS
|
|
||||||
bool OptionsDialog::systemTrayEnabled() const
|
|
||||||
{
|
|
||||||
return QSystemTrayIcon::isSystemTrayAvailable()
|
|
||||||
? m_ui->checkShowSystray->isChecked()
|
|
||||||
: false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OptionsDialog::minimizeToTray() const
|
|
||||||
{
|
|
||||||
if (!m_ui->checkShowSystray->isChecked()) return false;
|
|
||||||
return m_ui->checkMinimizeToSysTray->isChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool OptionsDialog::closeToTray() const
|
|
||||||
{
|
|
||||||
if (!m_ui->checkShowSystray->isChecked()) return false;
|
|
||||||
return m_ui->checkCloseToSystray->isChecked();
|
|
||||||
}
|
|
||||||
#endif // Q_OS_MACOS
|
|
||||||
|
|
||||||
// Return Share ratio
|
// Return Share ratio
|
||||||
qreal OptionsDialog::getMaxRatio() const
|
qreal OptionsDialog::getMaxRatio() const
|
||||||
{
|
{
|
||||||
@ -1443,8 +1417,8 @@ void OptionsDialog::on_buttonBox_accepted()
|
|||||||
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_applyButton->setEnabled(false);
|
m_applyButton->setEnabled(false);
|
||||||
this->hide();
|
|
||||||
saveOptions();
|
saveOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1468,6 +1442,8 @@ void OptionsDialog::applySettings()
|
|||||||
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
m_ui->tabSelection->setCurrentRow(TAB_WEBUI);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_applyButton->setEnabled(false);
|
||||||
saveOptions();
|
saveOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,11 +123,6 @@ private:
|
|||||||
void initializeLanguageCombo();
|
void initializeLanguageCombo();
|
||||||
// General options
|
// General options
|
||||||
QString getLocale() const;
|
QString getLocale() const;
|
||||||
#ifndef Q_OS_MACOS
|
|
||||||
bool systemTrayEnabled() const;
|
|
||||||
bool minimizeToTray() const;
|
|
||||||
bool closeToTray() const;
|
|
||||||
#endif
|
|
||||||
bool startMinimized() const;
|
bool startMinimized() const;
|
||||||
bool isSplashScreenDisabled() const;
|
bool isSplashScreenDisabled() const;
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
Loading…
x
Reference in New Issue
Block a user