mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-31 08:20:09 -06:00
Support for dark themes in default settings and restore defaults button
All the colour configurations have been reviewed under an operating-system theme dark theme. Some hard-coded colours in QScintilla editors and Data Browser have been replaced by queries of the system palette or reuse of our settings. New settings for foreground and background colours for QScintilla editors defaulting to system colours. This is mainly needed because if the user saves colour settings for a dark theme and then he changes the system theme back to a light theme, then the foreground colours are preserved while the background would fall back to the system theme leading to an incompatible combination. This also gives more freedom to the user in defining his own colour combinations. Since only the default colour settings adapt to the system theme, and once settings are saved this can no longer happen, a 'Restore Defaults' button is added so the default adapted colour settings can be restored. This is also useful for restoring default behaviour when wanted. Other fixes and improvements: waiting cursor while saving; check boxes in SQL tab for bold, italic and underline when applicable; avoid translation of hidden colour setting names used in code. See related issue #1324.
This commit is contained in:
@@ -110,7 +110,7 @@ void PreferencesDialog::loadSettings()
|
||||
ui->treeSyntaxHighlighting->topLevelItem(i)->setTextColor(2, color);
|
||||
ui->treeSyntaxHighlighting->topLevelItem(i)->setBackgroundColor(2, color);
|
||||
ui->treeSyntaxHighlighting->topLevelItem(i)->setText(2, colorname);
|
||||
if (name != "null") {
|
||||
if (name != "null" && name != "currentline" && name != "background" && name != "foreground") {
|
||||
ui->treeSyntaxHighlighting->topLevelItem(i)->setCheckState(3, Settings::getValue("syntaxhighlighter", name + "_bold").toBool() ? Qt::Checked : Qt::Unchecked);
|
||||
ui->treeSyntaxHighlighting->topLevelItem(i)->setCheckState(4, Settings::getValue("syntaxhighlighter", name + "_italic").toBool() ? Qt::Checked : Qt::Unchecked);
|
||||
ui->treeSyntaxHighlighting->topLevelItem(i)->setCheckState(5, Settings::getValue("syntaxhighlighter", name + "_underline").toBool() ? Qt::Checked : Qt::Unchecked);
|
||||
@@ -181,6 +181,8 @@ void PreferencesDialog::loadSettings()
|
||||
|
||||
void PreferencesDialog::saveSettings()
|
||||
{
|
||||
QApplication::setOverrideCursor(Qt::WaitCursor);
|
||||
|
||||
Settings::setValue("db", "defaultencoding", ui->encodingComboBox->currentText());
|
||||
Settings::setValue("db", "defaultlocation", ui->locationEdit->text());
|
||||
Settings::setValue("db", "savedefaultlocation", ui->comboDefaultLocation->currentIndex());
|
||||
@@ -281,10 +283,11 @@ void PreferencesDialog::saveSettings()
|
||||
|
||||
Settings::setValue("General", "language", newLanguage);
|
||||
Settings::setValue("General", "toolbarStyle", ui->toolbarStyleComboBox->currentIndex());
|
||||
|
||||
Settings::setValue("General", "DBFileExtensions", m_dbFileExtensions.join(";;") );
|
||||
|
||||
accept();
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
void PreferencesDialog::showColourDialog(QTreeWidgetItem* item, int column)
|
||||
@@ -578,3 +581,19 @@ void PreferencesDialog::on_buttonManageFileExtension_clicked()
|
||||
m_dbFileExtensions = manager->getDBFileExtensions();
|
||||
}
|
||||
}
|
||||
|
||||
void PreferencesDialog::on_buttonBox_clicked(QAbstractButton* button)
|
||||
{
|
||||
if (button == ui->buttonBox->button(QDialogButtonBox::Cancel))
|
||||
reject();
|
||||
else if (button == ui->buttonBox->button(QDialogButtonBox::Save))
|
||||
saveSettings();
|
||||
else if (button == ui->buttonBox->button(QDialogButtonBox::RestoreDefaults)) {
|
||||
if (QMessageBox::warning(this, QApplication::applicationName(), tr("Are you sure you want to clear all the saved settings?\nAll your preferences will be lost and default values will be used."),
|
||||
QMessageBox::RestoreDefaults | QMessageBox::Cancel, QMessageBox::Cancel) == QMessageBox::RestoreDefaults)
|
||||
{
|
||||
Settings::restoreDefaults();
|
||||
accept();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user