Introduce View Menu

* Move user interface settings from the settings widget into the view menu.
* Add auto-restart prompt to make theme changes easy
This commit is contained in:
Jonathan White 2020-06-28 10:01:24 -04:00
parent 1dd758c66a
commit 4bf6d8d94d
10 changed files with 206 additions and 137 deletions

View file

@ -106,7 +106,6 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
connect(m_generalUi->autoSaveAfterEveryChangeCheckBox, SIGNAL(toggled(bool)), SLOT(autoSaveToggled(bool)));
connect(m_generalUi->hideWindowOnCopyCheckBox, SIGNAL(toggled(bool)), SLOT(hideWindowOnCopyCheckBoxToggled(bool)));
connect(m_generalUi->systrayShowCheckBox, SIGNAL(toggled(bool)), SLOT(systrayToggled(bool)));
connect(m_generalUi->toolbarHideCheckBox, SIGNAL(toggled(bool)), SLOT(toolbarSettingsToggled(bool)));
connect(m_generalUi->rememberLastDatabasesCheckBox, SIGNAL(toggled(bool)), SLOT(rememberDatabasesToggled(bool)));
connect(m_generalUi->resetSettingsButton, SIGNAL(clicked()), SLOT(resetSettings()));
@ -126,7 +125,6 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
m_generalUi->faviconTimeoutSpinBox->installEventFilter(mouseWheelFilter);
m_generalUi->toolButtonStyleComboBox->installEventFilter(mouseWheelFilter);
m_generalUi->languageComboBox->installEventFilter(mouseWheelFilter);
m_generalUi->appThemeSelection->installEventFilter(mouseWheelFilter);
#ifdef WITH_XC_UPDATECHECK
connect(m_generalUi->checkForUpdatesOnStartupCheckBox, SIGNAL(toggled(bool)), SLOT(checkUpdatesToggled(bool)));
@ -210,20 +208,9 @@ void ApplicationSettingsWidget::loadSettings()
m_generalUi->languageComboBox->setCurrentIndex(defaultIndex);
}
m_generalUi->previewHideCheckBox->setChecked(config()->get(Config::GUI_HidePreviewPanel).toBool());
m_generalUi->toolbarHideCheckBox->setChecked(config()->get(Config::GUI_HideToolbar).toBool());
toolbarSettingsToggled(m_generalUi->toolbarHideCheckBox->isChecked());
m_generalUi->toolbarMovableCheckBox->setChecked(config()->get(Config::GUI_MovableToolbar).toBool());
m_generalUi->monospaceNotesCheckBox->setChecked(config()->get(Config::GUI_MonospaceNotes).toBool());
m_generalUi->appThemeSelection->clear();
m_generalUi->appThemeSelection->addItem(tr("Automatic"), "auto");
m_generalUi->appThemeSelection->addItem(tr("Light"), "light");
m_generalUi->appThemeSelection->addItem(tr("Dark"), "dark");
m_generalUi->appThemeSelection->addItem(tr("Classic (Platform-native)"), "classic");
m_generalUi->appThemeSelection->setCurrentIndex(
m_generalUi->appThemeSelection->findData(config()->get(Config::GUI_ApplicationTheme).toString()));
m_generalUi->toolButtonStyleComboBox->clear();
m_generalUi->toolButtonStyleComboBox->addItem(tr("Icon only"), Qt::ToolButtonIconOnly);
m_generalUi->toolButtonStyleComboBox->addItem(tr("Text only"), Qt::ToolButtonTextOnly);
@ -338,14 +325,9 @@ void ApplicationSettingsWidget::saveSettings()
config()->set(Config::FaviconDownloadTimeout, m_generalUi->faviconTimeoutSpinBox->value());
config()->set(Config::GUI_Language, m_generalUi->languageComboBox->currentData().toString());
config()->set(Config::GUI_HidePreviewPanel, m_generalUi->previewHideCheckBox->isChecked());
config()->set(Config::GUI_HideToolbar, m_generalUi->toolbarHideCheckBox->isChecked());
config()->set(Config::GUI_MovableToolbar, m_generalUi->toolbarMovableCheckBox->isChecked());
config()->set(Config::GUI_MonospaceNotes, m_generalUi->monospaceNotesCheckBox->isChecked());
QString theme = m_generalUi->appThemeSelection->currentData().toString();
config()->set(Config::GUI_ApplicationTheme, theme);
config()->set(Config::GUI_ToolButtonStyle, m_generalUi->toolButtonStyleComboBox->currentData().toString());
config()->set(Config::GUI_ShowTrayIcon, m_generalUi->systrayShowCheckBox->isChecked());
@ -481,13 +463,6 @@ void ApplicationSettingsWidget::systrayToggled(bool checked)
m_generalUi->systrayMinimizeToTrayCheckBox->setEnabled(checked);
}
void ApplicationSettingsWidget::toolbarSettingsToggled(bool checked)
{
m_generalUi->toolbarMovableCheckBox->setEnabled(!checked);
m_generalUi->toolButtonStyleComboBox->setEnabled(!checked);
m_generalUi->toolButtonStyleLabel->setEnabled(!checked);
}
void ApplicationSettingsWidget::rememberDatabasesToggled(bool checked)
{
if (!checked) {