Commit f1322a15 authored by Jan Möbius's avatar Jan Möbius

Logger with dark theme (Thanks to Matthias Möller for the patch)

parent 40d17f03
......@@ -75,10 +75,7 @@ void ColorStatusBar::showMessage(const QString & message, QColor _color, int tim
void ColorStatusBar::slotMessageChanged(const QString & /*message*/)
{
if ( !colored_ ){
QPalette pal = palette();
pal.setColor(QPalette::Active, QPalette::WindowText, QColor(Qt::black) );
setPalette(pal);
setPalette(QPalette{});
} else
colored_ = false;
......
......@@ -89,7 +89,7 @@ slotLog(Logtype _type, QString _message) {
textColor = QColor(0,160,0);
break;
case LOGOUT:
textColor = QColor(0,0,0);
textColor = QPalette{}.windowText().color();
break;
case LOGWARN:
textColor = QColor(160,160,0);
......
......@@ -89,7 +89,8 @@ QtSlideWindow::QtSlideWindow(QString _name, QGraphicsItem *_parent) :
dialog_(0),
down_(false),
animating_(false),
timer_(0) {
timer_(0),
fontHeight_(QFontMetrics(QFont()).height()){
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
setWindowFrameMargins(2, 15, 2, 2);
......@@ -178,13 +179,11 @@ void QtSlideWindow::paintWindowFrame(QPainter *_painter, const QStyleOptionGraph
int h = geometry().height();
_painter->setRenderHint(QPainter::Antialiasing, true);
_painter->setBrush(QBrush(QColor(BACKGROUND_RED, BACKGROUND_GREEN, BACKGROUND_BLUE, BACKGROUND_ALPHA)));
_painter->setPen(QColor(BACKGROUND_RED / 4, BACKGROUND_GREEN / 4, BACKGROUND_BLUE / 4, BACKGROUND_ALPHA));
_painter->drawRoundedRect(-2, -15, w + 4, h + 40, 4, 4);
_painter->setBrush(QPalette{}.window());
_painter->setPen(QPalette{}.windowText().color());
_painter->drawRoundedRect(-2, -4-fontHeight_, w + 4, h + 40, 4, 4);
_painter->setPen(Qt::SolidLine);
_painter->drawText(2, -13, w - 4, 11, Qt::AlignCenter, name_);
_painter->drawText(2, -2-fontHeight_, w - 4, fontHeight_, Qt::AlignCenter, name_);
}
//-----------------------------------------------------------------------------
......
......@@ -153,36 +153,39 @@ class DLLEXPORT QtSlideWindow : public QGraphicsProxyWidget
private:
// name
/// name
QString name_;
// child widget
/// child widget
QWidget *mainWidget_;
// buttons
/// buttons
QtGraphicsButton *autohideButton_;
QtGraphicsButton *detachButton_;
// detached dialog
/// detached dialog
QDialog *dialog_;
// Starting position (for animation)
/// Starting position (for animation)
QPointF startP_;
// Ending position (for animation)
/// Ending position (for animation)
QPointF endP_;
// Track if widget is at bottom position
/// Track if widget is at bottom position
bool down_;
// Animation object
/// Animation object
QPropertyAnimation* animation_;
// Is widget animating in this moment?
/// Is widget animating in this moment?
bool animating_;
// Wait some milliseconds before sliding widget down
/// Wait some milliseconds before sliding widget down
QTimer* timer_;
/// height of the default font
const int fontHeight_;
};
//=============================================================================
......
......@@ -202,31 +202,31 @@ void LoggerWidget::append(const QString& _text, Logtype _type){
switch (_type) {
case LOGINFO:
item->setForeground( QBrush(QColor(Qt::darkGreen)) );
item->setBackground( QBrush(QColor(225,255,225), Qt::Dense4Pattern) );
item->setBackground( QBrush(QColor(225,255,225), Qt::SolidPattern) );
if ( infoButton_->isChecked() )
item->setHidden(false);
break;
case LOGOUT:
item->setForeground( QBrush(QColor(Qt::black)) );
item->setForeground( QPalette{}.windowText() );
break;
case LOGWARN:
item->setForeground( QBrush(QColor(160,160,0)) );
item->setBackground( QBrush(QColor(255,240,200),Qt::Dense4Pattern) );
item->setBackground( QBrush(QColor(255,240,200),Qt::SolidPattern) );
if ( warnButton_->isChecked() )
item->setHidden(false);
break;
case LOGERR:
item->setForeground( QBrush(QColor(Qt::red)) );
item->setBackground( QBrush(QColor(255,225,225),Qt::Dense4Pattern) );
item->setBackground( QBrush(QColor(255,225,225),Qt::SolidPattern) );
if ( errorButton_->isChecked() )
item->setHidden(false);
break;
case LOGSTATUS:
item->setForeground( QBrush(QColor(Qt::blue)) );
item->setBackground( QBrush(QColor(255,225,225),Qt::Dense4Pattern) );
item->setBackground( QBrush(QColor(255,225,225),Qt::SolidPattern) );
if ( errorButton_->isChecked() )
item->setHidden(false);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment