@@ -75,8 +75,8 @@ static auto regenerateKits(const std::filesystem::path &directoryPath) -> void {
7575 KitDetector::platformUnix);
7676}
7777
78- static auto getCommandInterpreter ( const QString &externalCommand)
79- -> std::tuple<QString, QStringList> {
78+ static auto
79+ getCommandInterpreter ( const QString &externalCommand) -> std::tuple<QString, QStringList> {
8080 QString interpreter;
8181 QStringList command;
8282
@@ -225,6 +225,14 @@ ProjectManagerPlugin::ProjectManagerPlugin() {
225225
226226 config.pluginName = tr (" Project manager" );
227227 config.description = tr (" Add support for building using CMake/Cargo/Go" );
228+ config.configItems .push_back (
229+ qmdiConfigItem::Builder ()
230+ .setDisplayName (tr (" Black console" ))
231+ .setDescription (tr (" Should the console background be black, or default" ))
232+ .setKey (Config::BlackConsoleKey)
233+ .setType (qmdiConfigItem::Bool)
234+ .setDefaultValue (false )
235+ .build ());
228236 config.configItems .push_back (
229237 qmdiConfigItem::Builder ()
230238 .setDisplayName (tr (" Save before running tasks (build, config etc)" ))
@@ -331,20 +339,32 @@ void ProjectManagerPlugin::on_client_merged(qmdiHost *host) {
331339 issuesDock =
332340 manager->createNewPanel (Panels::South, " projectissues" , tr (" Issues" ), projectIssues);
333341
334- auto *w2 = new QWidget;
342+ auto w2 = new QWidget;
343+ auto font = QFontDatabase::systemFont (QFontDatabase::FixedFont);
335344 outputPanel = new Ui::BuildRunOutput;
336345 outputPanel->setupUi (w2);
337346 outputDock = manager->createNewPanel (Panels::South, " buildoutput" , tr (" Output" ), w2);
338347 outputPanel->commandOuput ->setLineWrapMode (QTextEdit::LineWrapMode::NoWrap);
339348 outputPanel->commandOuput ->viewport ()->setCursor (Qt::CursorShape::IBeamCursor);
340349 outputPanel->commandOuput ->setOpenExternalLinks (false );
341350 outputPanel->commandOuput ->setOpenLinks (false );
342-
343- auto font = QFontDatabase::systemFont (QFontDatabase::FixedFont);
344351 outputPanel->commandOuput ->setFont (font);
345352 outputPanel->commandOuput ->setAcceptRichText (true );
346353 outputPanel->commandOuput ->viewport ()->setCursor (Qt::CursorShape::IBeamCursor);
347354 outputPanel->commandOuput ->setLineWrapMode (QTextEdit::NoWrap);
355+ outputPanel->commandOuput ->clear ();
356+
357+ QTimer::singleShot (0 , [this ]() {
358+ // why in a timer? because at this step, if we set the palette, the widget
359+ // will get inserted "soon" and its palette will change anyway.
360+ if (getConfig ().getBlackConsole ()) {
361+ auto p = outputPanel->commandOuput ->palette ();
362+ p.setColor (QPalette::Base, Qt::black);
363+ p.setColor (QPalette::Text, QColor (192 , 192 , 192 ));
364+ outputPanel->commandOuput ->setPalette (p);
365+ }
366+ });
367+
348368 connect (outputPanel->commandOuput , &QTextBrowser::anchorClicked, outputPanel->commandOuput ,
349369 [this ](const QUrl &link) {
350370 if (!link.isLocalFile ()) {
@@ -617,6 +637,17 @@ void ProjectManagerPlugin::on_client_merged(qmdiHost *host) {
617637 });
618638}
619639
640+ void ProjectManagerPlugin::configurationHasBeenModified () {
641+ IPlugin::configurationHasBeenModified ();
642+
643+ auto p = outputDock->palette ();
644+ if (getConfig ().getBlackConsole ()) {
645+ p.setColor (QPalette::Base, Qt::black);
646+ p.setColor (QPalette::Text, QColor (192 , 192 , 192 ));
647+ }
648+ outputPanel->commandOuput ->setPalette (p);
649+ }
650+
620651void ProjectManagerPlugin::loadConfig (QSettings &settings) {
621652 IPlugin::loadConfig (settings);
622653
0 commit comments