Skip to content
This repository has been archived by the owner on Dec 17, 2017. It is now read-only.

Commit

Permalink
potential solution for #553 - Cpuload: adjust text color with theme
Browse files Browse the repository at this point in the history
  • Loading branch information
pvanek committed Apr 21, 2013
1 parent f00a36e commit 73a1fbe
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 3 deletions.
10 changes: 7 additions & 3 deletions razorqt-panel/plugin-cpuload/razorcpuload.cpp
Expand Up @@ -49,6 +49,8 @@ RazorCpuLoad::RazorCpuLoad(IRazorPanelPlugin* plugin, QWidget* parent):
m_barOrientation(TopDownBar),
m_timerID(-1)
{
setObjectName("RazorCpuLoad");

QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(&m_stuff);

Expand Down Expand Up @@ -157,8 +159,11 @@ void RazorCpuLoad::paintEvent ( QPaintEvent * )

p.fillRect(r1, shade);

if( m_showText )
p.drawText(rect(), Qt::AlignCenter, QString::number(m_avg));
if (m_showText)
{
p.setPen(fontColor);
p.drawText(rect(), Qt::AlignCenter, QString::number(m_avg));
}
}


Expand All @@ -183,4 +188,3 @@ void RazorCpuLoad::settingsChanged()
m_timerID = startTimer(m_updateInterval);
update();
}

8 changes: 8 additions & 0 deletions razorqt-panel/plugin-cpuload/razorcpuload.h
Expand Up @@ -34,6 +34,9 @@ class IRazorPanelPlugin;
class RazorCpuLoad: public QFrame
{
Q_OBJECT

Q_PROPERTY(QColor fontColor READ getFontColor WRITE setFontColor)

public:
/**
Describes orientation of cpu load bar
Expand All @@ -51,6 +54,9 @@ class RazorCpuLoad: public QFrame

void settingsChanged();

void setFontColor(QColor value) { fontColor = value; }
QColor getFontColor() const { return fontColor; }

protected:
void virtual timerEvent(QTimerEvent *event);
void virtual paintEvent ( QPaintEvent * event );
Expand All @@ -71,6 +77,8 @@ class RazorCpuLoad: public QFrame
int m_timerID;

QFont m_font;

QColor fontColor;
};


Expand Down
7 changes: 7 additions & 0 deletions razorqt-resources/themes/a-mego/razor-panel.qss
Expand Up @@ -301,3 +301,10 @@ TrayIcon {
font-size: 12pt;
color: #aaaaaa;
}

/*
* CPU monitor
*/
#RazorCpuLoad {
qproperty-fontColor: #aaaaaa;
}
7 changes: 7 additions & 0 deletions razorqt-resources/themes/ambiance/razor-panel.qss
Expand Up @@ -302,3 +302,10 @@ TrayIcon {
#WorldClockPopup{
font-size: 12pt;
}

/*
* CPU monitor
*/
#RazorCpuLoad {
qproperty-fontColor: #cacaca;
}
7 changes: 7 additions & 0 deletions razorqt-resources/themes/green/razor-panel.qss
Expand Up @@ -264,3 +264,10 @@ TrayIcon {
font-size: 12pt;
color: #606060;
}

/*
* CPU monitor
*/
#RazorCpuLoad {
qproperty-fontColor: #606060;
}
7 changes: 7 additions & 0 deletions razorqt-resources/themes/light/razor-panel.qss
Expand Up @@ -264,3 +264,10 @@ TrayIcon {
font-size: 12pt;
color: #606060;
}

/*
* CPU monitor
*/
#RazorCpuLoad {
qproperty-fontColor: #606060;
}

0 comments on commit 73a1fbe

Please sign in to comment.