[education/rkward] rkward/misc: Remove one more hardcoded color

Thomas Friedrichsmeier null at kde.org
Tue Apr 5 19:49:38 BST 2022


Git commit de09f0e52466925d98fb3f2b464365c04bf50c5d by Thomas Friedrichsmeier.
Committed on 05/04/2022 at 18:49.
Pushed by tfry into branch 'master'.

Remove one more hardcoded color

M  +5    -3    rkward/misc/rkprogresscontrol.cpp

https://invent.kde.org/education/rkward/commit/de09f0e52466925d98fb3f2b464365c04bf50c5d

diff --git a/rkward/misc/rkprogresscontrol.cpp b/rkward/misc/rkprogresscontrol.cpp
index 6b6190e0..f0c5ec15 100644
--- a/rkward/misc/rkprogresscontrol.cpp
+++ b/rkward/misc/rkprogresscontrol.cpp
@@ -16,6 +16,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
 #include <QDialogButtonBox>
 
 #include <KLocalizedString>
+#include <KColorScheme>
 
 #include "../rkglobals.h"
 #include "../rbackend/rkrinterface.h"
@@ -52,6 +53,7 @@ private:
 	ROutput::ROutputType last_output_type;
 	bool prevent_close;
 	bool is_done;
+	KColorScheme color_scheme;
 };
 
 
@@ -226,7 +228,7 @@ QString RKProgressControl::fullCommandOutput() {
 
 #include <kstandardguiitem.h>
 
-RKProgressControlDialog::RKProgressControlDialog (const QString &text, const QString &caption, int mode_flags, bool modal) : QDialog (0) {
+RKProgressControlDialog::RKProgressControlDialog(const QString &text, const QString &caption, int mode_flags, bool modal) : QDialog(nullptr), color_scheme(QPalette::Normal) {
 	RK_TRACE (MISC);
 
 	setAttribute (Qt::WA_DeleteOnClose, true);
@@ -313,9 +315,9 @@ void RKProgressControlDialog::addOutput (const ROutput *output) {
 		output_text->insertPlainText ("\n");
 
 		if (output->type == ROutput::Output) {
-			output_text->setTextColor (Qt::black);
+			output_text->setTextColor(color_scheme.foreground(KColorScheme::NormalText).color());
 		} else {
-			output_text->setTextColor (Qt::red);
+			output_text->setTextColor(color_scheme.foreground(KColorScheme::NegativeText).color());
 			if (!detailsbox->isVisible ()) toggleDetails ();
 			error_indicator->show ();
 		}


More information about the rkward-tracker mailing list