New setting allowing to set a dark style using a style-sheet

A new setting allows to follow the system style or set a new dark style
based on a the style-sheet provided by
https://github.com/ColinDuquesnoy/QDarkStyleSheet
The style-sheet is licensed under the MIT license. Images contained in
that project are licensed under CC-BY license.

* Set colours using style-sheet in Data Browser tab of Preferences

The colours of the frame and text-lines previewing the settings in Data
Browser tab need to have being set using a style-sheet, otherwise they
are eclipsed by the dark style-sheet when in use.

* Update preference colours when the application style is changed

In order to have matching colours in all the preferences, the individual
colour settings in Data Browser and SQL tabs are reset to default values
matching the corresponding style setting (dark stylesheet or follow desktop,
which could be dark or light as always).

Additionally, several problems with colour settings in QScintilla have
been fixed:
- We don't use indentation guides
- both sets of lexer colour settings must be used, otherwise the result is
inconsistant and unpredictable:
    * lexer->setDefaultColor|Paper and lexer->setColor|Paper

See issues #1751 #1493 and #1738
This commit is contained in:
mgrojo
2019-03-01 21:07:44 +01:00
53 changed files with 2458 additions and 93 deletions

View File

@@ -2380,6 +2380,24 @@ void MainWindow::reloadSettings()
// Set data browser font
ui->dataTable->reloadSettings();
switch (static_cast<Settings::AppStyle>(Settings::getValue("General", "appStyle").toInt())) {
case Settings::FollowDesktopStyle :
qApp->setStyleSheet("");
break;
case Settings::DarkStyle :
QFile f(":qdarkstyle/style.qss");
if (!f.exists()) {
QMessageBox::warning(this, qApp->applicationName(),
tr("Could not open find resource file: %1").arg(f.fileName()));
} else {
f.open(QFile::ReadOnly | QFile::Text);
QTextStream ts(&f);
qApp->setStyleSheet(ts.readAll());
}
break;
}
setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::getValue("General", "toolbarStyle").toInt()));
ui->dbToolbar->setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::getValue("General", "toolbarStyleStructure").toInt()));
ui->browseToolbar->setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(Settings::getValue("General", "toolbarStyleBrowse").toInt()));