aboutsummaryrefslogtreecommitdiffstats
path: root/SQLiteStudio3/guiSQLiteStudio/extendedpalette.cpp
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2023-04-30 18:30:36 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2023-04-30 18:30:36 -0400
commit3565aad630864ecdbe53fdaa501ea708555b3c7c (patch)
treec743e4ad0bad39ebdb2f514c7cc52d34a257ebbe /SQLiteStudio3/guiSQLiteStudio/extendedpalette.cpp
parent1fdc150116cad39aae5c5da407c3312b47a59e3a (diff)
New upstream version 3.4.4+dfsg.upstream/3.4.4+dfsg
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/extendedpalette.cpp')
-rw-r--r--SQLiteStudio3/guiSQLiteStudio/extendedpalette.cpp66
1 files changed, 57 insertions, 9 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/extendedpalette.cpp b/SQLiteStudio3/guiSQLiteStudio/extendedpalette.cpp
index 8357810..eba2f4c 100644
--- a/SQLiteStudio3/guiSQLiteStudio/extendedpalette.cpp
+++ b/SQLiteStudio3/guiSQLiteStudio/extendedpalette.cpp
@@ -1,10 +1,10 @@
#include "extendedpalette.h"
+#include "common/unused.h"
#include <QStyle>
#include <QDebug>
ExtendedPalette::ExtendedPalette()
{
-
}
QBrush ExtendedPalette::editorString() const
@@ -27,26 +27,44 @@ void ExtendedPalette::setEditorLineBase(const QBrush &value)
editorLineBaseBrush = value;
}
-void ExtendedPalette::styleChanged(QStyle *style, const QString &themeName)
+bool ExtendedPalette::styleChanged(QStyle *style, const QString &themeName)
{
+ UNUSED(themeName);
QPalette stdPalette = style->standardPalette();
+ if (stdPalette == lastPalette)
+ return false;
+
+ lastPalette = stdPalette;
bool isDark = stdPalette.base().color().lightness() < 128;
- static const QColor stdAltColor = QColor(Qt::green);
+ static const QColor stdStrColor = QColor(Qt::green);
+ static const QColor stdExprColor = QColor(Qt::magenta);
if (stdPalette.text().color().lightness() >= 128)
- editorStringBrush = QBrush(stdAltColor.lighter());
+ editorStringBrush = stdStrColor.lighter();
else
- editorStringBrush = QBrush(stdAltColor.darker());
+ editorStringBrush = stdStrColor.darker();
- if (themeName.toLower() == "macintosh" && isDark)
- editorLineBaseBrush = QBrush(stdPalette.alternateBase().color().darker(300));
+ if (stdPalette.text().color().lightness() >= 128)
+ editorExpressionBrush = stdExprColor.lighter();
else
- editorLineBaseBrush = stdPalette.alternateBase();
+ editorExpressionBrush = stdExprColor;
if (isDark)
+ {
mdiAreaBaseBrush = stdPalette.alternateBase();
+ editorLineNumberBaseBrush = stdPalette.base().color().lighter(130);
+ editorLineBaseBrush = stdPalette.base().color().lighter(130);
+ editorCurrentQueryBrush = stdPalette.base().color().lighter(120);
+ }
else
- mdiAreaBaseBrush = QBrush("#8a8a8a");
+ {
+ editorLineNumberBaseBrush = stdPalette.base().color().darker(120);
+ editorLineBaseBrush = stdPalette.base().color().darker(120);
+ editorCurrentQueryBrush = stdPalette.base().color().darker(110);
+ mdiAreaBaseBrush = QColor(138, 138, 138);
+ }
+
+ return true;
}
QBrush ExtendedPalette::mdiAreaBase() const
@@ -58,3 +76,33 @@ void ExtendedPalette::setMdiAreaBase(const QBrush& value)
{
mdiAreaBaseBrush = value;
}
+
+QBrush ExtendedPalette::editorExpression() const
+{
+ return editorExpressionBrush;
+}
+
+void ExtendedPalette::setEditorExpression(const QBrush& value)
+{
+ editorExpressionBrush = value;
+}
+
+const QBrush& ExtendedPalette::editorCurrentQueryBase() const
+{
+ return editorCurrentQueryBrush;
+}
+
+void ExtendedPalette::setEditorCurrentQueryBase(const QBrush& value)
+{
+ editorCurrentQueryBrush = value;
+}
+
+const QBrush& ExtendedPalette::editorLineNumberBase() const
+{
+ return editorLineNumberBaseBrush;
+}
+
+void ExtendedPalette::setEditorLineNumberBaseBrush(const QBrush& newEditorLineNumberBaseBrush)
+{
+ editorLineNumberBaseBrush = newEditorLineNumberBaseBrush;
+}