Skip to content
Permalink
Browse files

[themes] Avoid hardcoded black for default console timestamp colors

(fixes #21860)
  • Loading branch information
nirvn committed Apr 17, 2019
1 parent 6befbae commit 32d737503dd95a9e637444029301cffd9ca5341e
Showing with 9 additions and 6 deletions.
  1. +9 −6 src/gui/qgsmessagelogviewer.cpp
@@ -78,30 +78,33 @@ void QgsMessageLogViewer::logMessage( const QString &message, const QString &tag

QString levelString;
QgsSettings settings;
QColor color;
QPalette pal = qApp->palette();
QString defaultColorName = pal.color( QPalette::WindowText ).name();
QString colorName;
switch ( level )
{
case Qgis::Info:
levelString = QStringLiteral( "INFO" );
color = QColor( settings.value( QStringLiteral( "colors/info" ), QStringLiteral( "#000000" ) ).toString() );
colorName = settings.value( QStringLiteral( "colors/info" ), QString() ).toString();
break;
case Qgis::Warning:
levelString = QStringLiteral( "WARNING" );
color = QColor( settings.value( QStringLiteral( "colors/warning" ), QStringLiteral( "#000000" ) ).toString() );
colorName = settings.value( QStringLiteral( "colors/warning" ), QString() ).toString();
break;
case Qgis::Critical:
levelString = QStringLiteral( "CRITICAL" );
color = QColor( settings.value( QStringLiteral( "colors/critical" ), QStringLiteral( "#000000" ) ).toString() );
colorName = settings.value( QStringLiteral( "colors/critical" ), QString() ).toString();
break;
case Qgis::Success:
levelString = QStringLiteral( "SUCCESS" );
color = QColor( settings.value( QStringLiteral( "colors/success" ), QStringLiteral( "#000000" ) ).toString() );
colorName = settings.value( QStringLiteral( "colors/success" ), QString() ).toString();
break;
case Qgis::None:
levelString = QStringLiteral( "NONE" );
color = QColor( settings.value( QStringLiteral( "colors/default" ), QStringLiteral( "#000000" ) ).toString() );
colorName = settings.value( QStringLiteral( "colors/default" ), QString() ).toString();
break;
}
QColor color = QColor( !colorName.isEmpty() ? colorName : defaultColorName );

QString prefix = QStringLiteral( "<font color=\"%1\">%2 &nbsp;&nbsp;&nbsp; %3 &nbsp;&nbsp;&nbsp;</font>" )
.arg( color.name(), QDateTime::currentDateTime().toString( Qt::ISODate ), levelString );

0 comments on commit 32d7375

Please sign in to comment.
You can’t perform that action at this time.