Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Don't use KColorScheme on Qt5

Freya Lupen1cb90830faec
diff --git a/plugins/dockers/logdocker/LogDockerDock.cpp b/plugins/dockers/logdocker/LogDockerDock.cpp
index 30d6a2d737..120567bb5c 100644
--- a/plugins/dockers/logdocker/LogDockerDock.cpp
+++ b/plugins/dockers/logdocker/LogDockerDock.cpp
@@ -441,12 +441,29 @@ void LogDockerDock::changeTheme()
{
clearLog();
+#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
KColorScheme scheme(QPalette::Active, KColorScheme::Window);
s_debug.setForeground(scheme.foreground(KColorScheme::NormalText));
s_info.setForeground(scheme.foreground(KColorScheme::PositiveText));
s_warning.setForeground(scheme.foreground(KColorScheme::NeutralText));
s_critical.setForeground(scheme.foreground(KColorScheme::NegativeText));
s_fatal.setForeground(scheme.foreground(KColorScheme::NegativeText));
+#else
+ QColor background = qApp->palette().window().color();
+ if (background.value() > 100) {
+ s_debug.setForeground(Qt::black);
+ s_info.setForeground(Qt::darkGreen);
+ s_warning.setForeground(Qt::darkYellow);
+ s_critical.setForeground(Qt::darkRed);
+ s_fatal.setForeground(Qt::darkRed);
+ } else {
+ s_debug.setForeground(Qt::white);
+ s_info.setForeground(Qt::green);
+ s_warning.setForeground(Qt::yellow);
+ s_critical.setForeground(Qt::red);
+ s_fatal.setForeground(Qt::red);
+ }
+#endif
s_fatal.setFontWeight(QFont::Bold);
}
diff --git a/plugins/dockers/recorder/recorderdocker_dock.cpp b/plugins/dockers/recorder/recorderdocker_dock.cpp
index e771841ad0..d9624f93bc 100644
--- a/plugins/dockers/recorder/recorderdocker_dock.cpp
+++ b/plugins/dockers/recorder/recorderdocker_dock.cpp
@@ -48,6 +48,7 @@ namespace
const QString keyActionRecordToggle = "recorder_record_toggle";
const QString keyActionExport = "recorder_export";
+#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
QString activeColorPositive;
QString activeColorNeutral;
QString activeColorNegative;
@@ -60,6 +61,20 @@ QColor textColorNeutral;
QColor buttonColorNeutral;
QColor textColorNegative;
QColor buttonColorNegative;
+#else
+const QString activeColorPositive("#5cab25");
+const QString activeColorNeutral("#ca8f14");
+const QString activeColorNegative("#da4453");
+const QString colorNormal("#3e3e3e");
+const QString inactiveColorPositive("#b4e196");
+const QString inactiveColorNeutral("#ffe5af");
+const QString inactiveColorNegative("#f2c4c9");
+
+const QColor textColorNeutral(0xff, 0xe5, 0xaf);
+const QColor buttonColorNeutral(0xca, 0x8f, 0x14);
+const QColor textColorNegative(0xf2, 0xc4, 0xc9);
+const QColor buttonColorNegative(0xda, 0x44, 0x53);
+#endif
}
@@ -581,12 +596,15 @@ void RecorderDockerDock::onMainWindowIsBeingCreated(KisMainWindow *window)
actionCollection->addAction(keyActionRecordToggle, d->recordToggleAction);
actionCollection->addAction(keyActionExport, d->exportAction);
+#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
connect(window, SIGNAL(themeChanged()), this, SLOT(onThemeChanged()));
onThemeChanged();
+#endif
}
void RecorderDockerDock::onThemeChanged()
{
+#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
KColorScheme activeScheme(QPalette::Active, KColorScheme::Window);
activeColorPositive = activeScheme.foreground(KColorScheme::PositiveText).color().name();
activeColorNeutral = activeScheme.foreground(KColorScheme::NeutralText).color().name();
@@ -605,6 +623,7 @@ void RecorderDockerDock::onThemeChanged()
d->updateThreadUi();
d->updateRecIndicator();
+#endif
}
bool RecorderDockerDock::onRecordButtonToggled(bool checked)