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. Pending issues: - Use of stylesheets is incompatible to QPalette. Some colours for previewing settings in the Preferences dialog are eclipsed by the style- sheet See https://github.com/ColinDuquesnoy/QDarkStyleSheet/issues/48 - Changing the style should select matching background and foreground colours for the Browse Data and SQL tabs in Preferences. See issues #1751 #1493 and #1738
@@ -226,6 +226,7 @@ set(SQLB_RESOURCES
|
||||
src/translations/flags/flags.qrc
|
||||
src/translations/translations.qrc
|
||||
src/certs/CaCerts.qrc
|
||||
src/qdarkstyle/style.qrc
|
||||
)
|
||||
|
||||
set(SQLB_MISC
|
||||
|
||||
@@ -2364,6 +2364,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()));
|
||||
|
||||
@@ -187,6 +187,7 @@ void PreferencesDialog::loadSettings()
|
||||
ui->checkRegexDisabled->setChecked(Settings::getValue("extensions", "disableregex").toBool());
|
||||
ui->checkAllowLoadExtension->setChecked(Settings::getValue("extensions", "enable_load_extension").toBool());
|
||||
fillLanguageBox();
|
||||
ui->appStyleCombo->setCurrentIndex(Settings::getValue("General", "appStyle").toInt());
|
||||
ui->toolbarStyleComboMain->setCurrentIndex(Settings::getValue("General", "toolbarStyle").toInt());
|
||||
ui->toolbarStyleComboStructure->setCurrentIndex(Settings::getValue("General", "toolbarStyleStructure").toInt());
|
||||
ui->toolbarStyleComboBrowse->setCurrentIndex(Settings::getValue("General", "toolbarStyleBrowse").toInt());
|
||||
@@ -313,6 +314,7 @@ void PreferencesDialog::saveSettings()
|
||||
tr("The language will change after you restart the application."));
|
||||
|
||||
Settings::setValue("General", "language", newLanguage);
|
||||
Settings::setValue("General", "appStyle", ui->appStyleCombo->currentIndex());
|
||||
|
||||
Settings::setValue("General", "toolbarStyle", ui->toolbarStyleComboMain->currentIndex());
|
||||
Settings::setValue("General", "toolbarStyleStructure", ui->toolbarStyleComboStructure->currentIndex());
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelToolbarStyle">
|
||||
<property name="text">
|
||||
<string>Toolbar style</string>
|
||||
@@ -132,7 +132,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QComboBox" name="toolbarStyleComboMain">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -182,7 +182,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QComboBox" name="toolbarStyleComboStructure">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -232,7 +232,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QComboBox" name="toolbarStyleComboBrowse">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -282,7 +282,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QComboBox" name="toolbarStyleComboSql">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -332,7 +332,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="labelUseRemotes">
|
||||
<property name="text">
|
||||
<string>Show remote options</string>
|
||||
@@ -342,7 +342,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QCheckBox" name="checkUseRemotes">
|
||||
<property name="text">
|
||||
<string>enabled</string>
|
||||
@@ -352,7 +352,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="labelUpdates">
|
||||
<property name="text">
|
||||
<string>Automatic &updates</string>
|
||||
@@ -362,14 +362,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QCheckBox" name="checkUpdates">
|
||||
<property name="text">
|
||||
<string>enabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>DB file extensions</string>
|
||||
@@ -379,14 +379,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="12" column="1">
|
||||
<widget class="QPushButton" name="buttonManageFileExtension">
|
||||
<property name="text">
|
||||
<string>Manage</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="labelMainToolBar">
|
||||
<property name="text">
|
||||
<string>Main Window</string>
|
||||
@@ -399,7 +399,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="labelStructureToolBar">
|
||||
<property name="text">
|
||||
<string>Database Structure</string>
|
||||
@@ -412,7 +412,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="labelBrowseToolBar">
|
||||
<property name="text">
|
||||
<string>Browse Data</string>
|
||||
@@ -425,7 +425,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="labelSqlToolBar">
|
||||
<property name="text">
|
||||
<string>Execute SQL</string>
|
||||
@@ -438,7 +438,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QComboBox" name="toolbarStyleComboEditCell">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@@ -488,7 +488,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="labelEditCellToolBar">
|
||||
<property name="text">
|
||||
<string>Edit Database Cell</string>
|
||||
@@ -501,6 +501,51 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="appStyleCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="minimumContentsLength">
|
||||
<number>35</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Follow the desktop style</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dark style</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelAppStyle">
|
||||
<property name="text">
|
||||
<string>Application style</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>toolbarStyleComboStructure</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab">
|
||||
|
||||
@@ -154,6 +154,10 @@ QVariant Settings::getDefaultValue(const QString& group, const QString& name)
|
||||
if(group == "General" && name == "language")
|
||||
return QLocale::system().name();
|
||||
|
||||
// General/appStyle
|
||||
if(group == "General" && name == "appStyle")
|
||||
return static_cast<int>(FollowDesktopStyle);
|
||||
|
||||
// General/toolbarStyle
|
||||
if(group == "General" && name == "toolbarStyle")
|
||||
return static_cast<int>(Qt::ToolButtonTextBesideIcon);
|
||||
|
||||
@@ -9,6 +9,11 @@ class Settings
|
||||
friend class PreferencesDialog;
|
||||
|
||||
public:
|
||||
|
||||
enum AppStyle {
|
||||
FollowDesktopStyle,
|
||||
DarkStyle
|
||||
};
|
||||
static QVariant getValue(const QString& group, const QString& name);
|
||||
static void setValue(const QString& group, const QString& name, const QVariant& value, bool dont_save_to_disk = false);
|
||||
static void restoreDefaults();
|
||||
|
||||
BIN
src/qdarkstyle/rc/Hmovetoolbar.png
Normal file
|
After Width: | Height: | Size: 220 B |
BIN
src/qdarkstyle/rc/Hsepartoolbar.png
Normal file
|
After Width: | Height: | Size: 172 B |
BIN
src/qdarkstyle/rc/Vmovetoolbar.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src/qdarkstyle/rc/Vsepartoolbar.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
src/qdarkstyle/rc/branch_closed-on.png
Normal file
|
After Width: | Height: | Size: 147 B |
BIN
src/qdarkstyle/rc/branch_closed.png
Normal file
|
After Width: | Height: | Size: 160 B |
BIN
src/qdarkstyle/rc/branch_open-on.png
Normal file
|
After Width: | Height: | Size: 150 B |
BIN
src/qdarkstyle/rc/branch_open.png
Normal file
|
After Width: | Height: | Size: 166 B |
BIN
src/qdarkstyle/rc/checkbox_checked.png
Normal file
|
After Width: | Height: | Size: 492 B |
BIN
src/qdarkstyle/rc/checkbox_checked_disabled.png
Normal file
|
After Width: | Height: | Size: 491 B |
BIN
src/qdarkstyle/rc/checkbox_checked_focus.png
Normal file
|
After Width: | Height: | Size: 252 B |
BIN
src/qdarkstyle/rc/checkbox_indeterminate.png
Normal file
|
After Width: | Height: | Size: 493 B |
BIN
src/qdarkstyle/rc/checkbox_indeterminate_disabled.png
Normal file
|
After Width: | Height: | Size: 492 B |
BIN
src/qdarkstyle/rc/checkbox_indeterminate_focus.png
Normal file
|
After Width: | Height: | Size: 249 B |
BIN
src/qdarkstyle/rc/checkbox_unchecked.png
Normal file
|
After Width: | Height: | Size: 464 B |
BIN
src/qdarkstyle/rc/checkbox_unchecked_disabled.png
Normal file
|
After Width: | Height: | Size: 464 B |
BIN
src/qdarkstyle/rc/checkbox_unchecked_focus.png
Normal file
|
After Width: | Height: | Size: 240 B |
BIN
src/qdarkstyle/rc/close-hover.png
Normal file
|
After Width: | Height: | Size: 598 B |
BIN
src/qdarkstyle/rc/close-pressed.png
Normal file
|
After Width: | Height: | Size: 598 B |
BIN
src/qdarkstyle/rc/close.png
Normal file
|
After Width: | Height: | Size: 586 B |
BIN
src/qdarkstyle/rc/down_arrow.png
Normal file
|
After Width: | Height: | Size: 165 B |
BIN
src/qdarkstyle/rc/down_arrow_disabled.png
Normal file
|
After Width: | Height: | Size: 166 B |
BIN
src/qdarkstyle/rc/left_arrow.png
Normal file
|
After Width: | Height: | Size: 166 B |
BIN
src/qdarkstyle/rc/left_arrow_disabled.png
Normal file
|
After Width: | Height: | Size: 166 B |
BIN
src/qdarkstyle/rc/radio_checked.png
Normal file
|
After Width: | Height: | Size: 940 B |
BIN
src/qdarkstyle/rc/radio_checked_disabled.png
Normal file
|
After Width: | Height: | Size: 972 B |
BIN
src/qdarkstyle/rc/radio_checked_focus.png
Normal file
|
After Width: | Height: | Size: 846 B |
BIN
src/qdarkstyle/rc/radio_unchecked.png
Normal file
|
After Width: | Height: | Size: 728 B |
BIN
src/qdarkstyle/rc/radio_unchecked_disabled.png
Normal file
|
After Width: | Height: | Size: 760 B |
BIN
src/qdarkstyle/rc/radio_unchecked_focus.png
Normal file
|
After Width: | Height: | Size: 646 B |
BIN
src/qdarkstyle/rc/right_arrow.png
Normal file
|
After Width: | Height: | Size: 160 B |
BIN
src/qdarkstyle/rc/right_arrow_disabled.png
Normal file
|
After Width: | Height: | Size: 160 B |
BIN
src/qdarkstyle/rc/sizegrip.png
Normal file
|
After Width: | Height: | Size: 129 B |
BIN
src/qdarkstyle/rc/stylesheet-branch-end.png
Normal file
|
After Width: | Height: | Size: 224 B |
BIN
src/qdarkstyle/rc/stylesheet-branch-more.png
Normal file
|
After Width: | Height: | Size: 182 B |
BIN
src/qdarkstyle/rc/stylesheet-vline.png
Normal file
|
After Width: | Height: | Size: 239 B |
BIN
src/qdarkstyle/rc/transparent.png
Normal file
|
After Width: | Height: | Size: 195 B |
BIN
src/qdarkstyle/rc/undock.png
Normal file
|
After Width: | Height: | Size: 578 B |
BIN
src/qdarkstyle/rc/up_arrow.png
Normal file
|
After Width: | Height: | Size: 158 B |
BIN
src/qdarkstyle/rc/up_arrow_disabled.png
Normal file
|
After Width: | Height: | Size: 159 B |
46
src/qdarkstyle/style.qrc
Normal file
@@ -0,0 +1,46 @@
|
||||
<RCC>
|
||||
<qresource prefix="qss_icons">
|
||||
<file>rc/up_arrow_disabled.png</file>
|
||||
<file>rc/Hmovetoolbar.png</file>
|
||||
<file>rc/stylesheet-branch-end.png</file>
|
||||
<file>rc/branch_closed-on.png</file>
|
||||
<file>rc/stylesheet-vline.png</file>
|
||||
<file>rc/branch_closed.png</file>
|
||||
<file>rc/branch_open-on.png</file>
|
||||
<file>rc/transparent.png</file>
|
||||
<file>rc/right_arrow_disabled.png</file>
|
||||
<file>rc/sizegrip.png</file>
|
||||
<file>rc/close.png</file>
|
||||
<file>rc/close-hover.png</file>
|
||||
<file>rc/close-pressed.png</file>
|
||||
<file>rc/down_arrow.png</file>
|
||||
<file>rc/Vmovetoolbar.png</file>
|
||||
<file>rc/left_arrow.png</file>
|
||||
<file>rc/stylesheet-branch-more.png</file>
|
||||
<file>rc/up_arrow.png</file>
|
||||
<file>rc/right_arrow.png</file>
|
||||
<file>rc/left_arrow_disabled.png</file>
|
||||
<file>rc/Hsepartoolbar.png</file>
|
||||
<file>rc/branch_open.png</file>
|
||||
<file>rc/Vsepartoolbar.png</file>
|
||||
<file>rc/down_arrow_disabled.png</file>
|
||||
<file>rc/undock.png</file>
|
||||
<file>rc/checkbox_checked_disabled.png</file>
|
||||
<file>rc/checkbox_checked_focus.png</file>
|
||||
<file>rc/checkbox_checked.png</file>
|
||||
<file>rc/checkbox_indeterminate.png</file>
|
||||
<file>rc/checkbox_indeterminate_focus.png</file>
|
||||
<file>rc/checkbox_unchecked_disabled.png</file>
|
||||
<file>rc/checkbox_unchecked_focus.png</file>
|
||||
<file>rc/checkbox_unchecked.png</file>
|
||||
<file>rc/radio_checked_disabled.png</file>
|
||||
<file>rc/radio_checked_focus.png</file>
|
||||
<file>rc/radio_checked.png</file>
|
||||
<file>rc/radio_unchecked_disabled.png</file>
|
||||
<file>rc/radio_unchecked_focus.png</file>
|
||||
<file>rc/radio_unchecked.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="qdarkstyle">
|
||||
<file>style.qss</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
46
src/qdarkstyle/style.qrc.depends
Normal file
@@ -0,0 +1,46 @@
|
||||
<RCC>
|
||||
<qresource prefix="qss_icons">
|
||||
<file>rc/up_arrow_disabled.png</file>
|
||||
<file>rc/Hmovetoolbar.png</file>
|
||||
<file>rc/stylesheet-branch-end.png</file>
|
||||
<file>rc/branch_closed-on.png</file>
|
||||
<file>rc/stylesheet-vline.png</file>
|
||||
<file>rc/branch_closed.png</file>
|
||||
<file>rc/branch_open-on.png</file>
|
||||
<file>rc/transparent.png</file>
|
||||
<file>rc/right_arrow_disabled.png</file>
|
||||
<file>rc/sizegrip.png</file>
|
||||
<file>rc/close.png</file>
|
||||
<file>rc/close-hover.png</file>
|
||||
<file>rc/close-pressed.png</file>
|
||||
<file>rc/down_arrow.png</file>
|
||||
<file>rc/Vmovetoolbar.png</file>
|
||||
<file>rc/left_arrow.png</file>
|
||||
<file>rc/stylesheet-branch-more.png</file>
|
||||
<file>rc/up_arrow.png</file>
|
||||
<file>rc/right_arrow.png</file>
|
||||
<file>rc/left_arrow_disabled.png</file>
|
||||
<file>rc/Hsepartoolbar.png</file>
|
||||
<file>rc/branch_open.png</file>
|
||||
<file>rc/Vsepartoolbar.png</file>
|
||||
<file>rc/down_arrow_disabled.png</file>
|
||||
<file>rc/undock.png</file>
|
||||
<file>rc/checkbox_checked_disabled.png</file>
|
||||
<file>rc/checkbox_checked_focus.png</file>
|
||||
<file>rc/checkbox_checked.png</file>
|
||||
<file>rc/checkbox_indeterminate.png</file>
|
||||
<file>rc/checkbox_indeterminate_focus.png</file>
|
||||
<file>rc/checkbox_unchecked_disabled.png</file>
|
||||
<file>rc/checkbox_unchecked_focus.png</file>
|
||||
<file>rc/checkbox_unchecked.png</file>
|
||||
<file>rc/radio_checked_disabled.png</file>
|
||||
<file>rc/radio_checked_focus.png</file>
|
||||
<file>rc/radio_checked.png</file>
|
||||
<file>rc/radio_unchecked_disabled.png</file>
|
||||
<file>rc/radio_unchecked_focus.png</file>
|
||||
<file>rc/radio_unchecked.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="qdarkstyle">
|
||||
<file>style.qss</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
1898
src/qdarkstyle/style.qss
Normal file
@@ -126,7 +126,8 @@ SOURCES += \
|
||||
RESOURCES += icons/icons.qrc \
|
||||
translations/flags/flags.qrc \
|
||||
translations/translations.qrc \
|
||||
certs/CaCerts.qrc
|
||||
certs/CaCerts.qrc \
|
||||
qdarkstyle/style.qrc
|
||||
|
||||
FORMS += \
|
||||
MainWindow.ui \
|
||||
|
||||