From 1d7144e6f7cd3104bad5a344a0417a59403fb54d Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 8 Dec 2008 17:51:53 +0000 Subject: [PATCH] die hardcoded colors, die! svn path=/trunk/KDE/kdelibs/; revision=894466 --- widgets/signalplotter.cpp | 31 +++++++++++++++++++++---------- widgets/signalplotter.h | 1 + 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/widgets/signalplotter.cpp b/widgets/signalplotter.cpp index b44ea7200..4cd93ea83 100644 --- a/widgets/signalplotter.cpp +++ b/widgets/signalplotter.cpp @@ -39,20 +39,31 @@ #include #include +#include namespace Plasma { class SignalPlotterPrivate { - public: - SignalPlotterPrivate() - : svgBackground(0) - { } +public: + SignalPlotterPrivate() + : svgBackground(0) + { } - ~SignalPlotterPrivate() - { - } + ~SignalPlotterPrivate() + { + } + + void themeChanged() + { + Plasma::Theme *theme = Plasma::Theme::defaultTheme(); + backgroundColor = theme->color(Theme::BackgroundColor); + verticalLinesColor = theme->color(Theme::TextColor); + verticalLinesColor.setAlphaF(0.4); + horizontalLinesColor = theme->color(Theme::TextColor); + horizontalLinesColor.setAlphaF(0.4); + } int precision; uint samples; @@ -116,14 +127,12 @@ SignalPlotter::SignalPlotter(QGraphicsItem *parent) setMinimumSize(QSizeF(16, 16)); d->showVerticalLines = true; - d->verticalLinesColor = QColor("black"); d->verticalLinesDistance = 30; d->verticalLinesScroll = true; d->verticalLinesOffset = 0; d->horizontalScale = 1; d->showHorizontalLines = true; - d->horizontalLinesColor = QColor("black"); d->horizontalLinesCount = 5; d->showLabels = true; @@ -132,7 +141,9 @@ SignalPlotter::SignalPlotter(QGraphicsItem *parent) d->fillPlots = true; d->svgBackground = 0; - d->backgroundColor = QColor(0, 0, 0); + + connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), SLOT(themeChanged())); + d->themeChanged(); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); } diff --git a/widgets/signalplotter.h b/widgets/signalplotter.h index d6282f8be..7b9357c2a 100644 --- a/widgets/signalplotter.h +++ b/widgets/signalplotter.h @@ -440,6 +440,7 @@ protected: private: SignalPlotterPrivate *const d; + Q_PRIVATE_SLOT(d, void themeChanged()) }; } // Plasma namespace