From 36bc2c4e97e2a005eff038122560170473d678da Mon Sep 17 00:00:00 2001 From: Anne-Marie Mahfouf Date: Tue, 22 Apr 2008 21:10:14 +0000 Subject: [PATCH] Plasma::Theme::self() -> Plasma::Theme::defaultTheme() as planned during the sprint svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=799919 --- applet.cpp | 6 +++--- applethandle.cpp | 2 +- desktoptoolbox.cpp | 4 ++-- dialog.cpp | 2 +- paneltoolbox.cpp | 4 ++-- svg.cpp | 12 ++++++------ theme.cpp | 8 ++++---- theme.h | 6 +++--- widgets/icon.cpp | 10 +++++----- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/applet.cpp b/applet.cpp index 163d1f879..212c7cc09 100644 --- a/applet.cpp +++ b/applet.cpp @@ -89,7 +89,7 @@ protected: Q_UNUSED(widget) painter->save(); painter->setRenderHint(QPainter::Antialiasing); - QColor wash = Plasma::Theme::self()->backgroundColor(); + QColor wash = Plasma::Theme::defaultTheme()->backgroundColor(); wash.setAlphaF(.6); painter->fillPath(parentItem()->shape(), wash); painter->restore(); @@ -198,7 +198,7 @@ public: applet->setDrawStandardBackground(true); - connect(Plasma::Theme::self(), SIGNAL(changed()), applet, SLOT(themeChanged())); + connect(Plasma::Theme::defaultTheme(), SIGNAL(changed()), applet, SLOT(themeChanged())); } // put all setup routines for script here. at this point we can assume that @@ -477,7 +477,7 @@ void Applet::setFailedToLaunch(bool failed, const QString& reason) //FIXME: this needs to get the colour from the theme's colour scheme d->failureText->setDefaultTextColor(KStatefulBrush(KColorScheme::Window, KColorScheme::NormalText, - Theme::self()->colors()) + Theme::defaultTheme()->colors()) .brush(QPalette::Normal).color()); failureLayout->addItem(d->failureText); #endif diff --git a/applethandle.cpp b/applethandle.cpp index 07ecac3d0..b9d48757e 100644 --- a/applethandle.cpp +++ b/applethandle.cpp @@ -59,7 +59,7 @@ AppletHandle::AppletHandle(Containment *parent, Applet *applet) m_buttonsOnRight(false), m_pendingFade(false) { - KColorScheme colorScheme(QPalette::Active, KColorScheme::View, Theme::self()->colorScheme()); + KColorScheme colorScheme(QPalette::Active, KColorScheme::View, Theme::defaultTheme()->colorScheme()); m_gradientColor = colorScheme.background(KColorScheme::NormalBackground).color(); QTransform originalMatrix = m_applet->transform(); diff --git a/desktoptoolbox.cpp b/desktoptoolbox.cpp index ba838258b..917b0753d 100644 --- a/desktoptoolbox.cpp +++ b/desktoptoolbox.cpp @@ -119,11 +119,11 @@ void DesktopToolbox::paint(QPainter *painter, const QStyleOptionGraphicsItem *op painter->translate(boundingRect().topLeft()); QColor color1 = KColorScheme(QPalette::Active, KColorScheme::Window, - Plasma::Theme::self()->colorScheme()).background().color(); + Plasma::Theme::defaultTheme()->colorScheme()).background().color(); color1.setAlpha(64); QColor color2 = KColorScheme(QPalette::Active, KColorScheme::Window, - Plasma::Theme::self()->colorScheme()).foreground().color(); + Plasma::Theme::defaultTheme()->colorScheme()).foreground().color(); color2.setAlpha(64); QPainterPath p = shape(); diff --git a/dialog.cpp b/dialog.cpp index 6126173c9..22f211b53 100644 --- a/dialog.cpp +++ b/dialog.cpp @@ -77,7 +77,7 @@ Dialog::Dialog( QWidget * parent, Qt::WindowFlags f ) connect(d->background, SIGNAL(repaintNeeded()), this, SLOT(update())); - connect(Plasma::Theme::self(), SIGNAL(changed()), this, SLOT(themeUpdated())); + connect(Plasma::Theme::defaultTheme(), SIGNAL(changed()), this, SLOT(themeUpdated())); d->themeUpdated(); } diff --git a/paneltoolbox.cpp b/paneltoolbox.cpp index e736e3d53..08b5ed72e 100644 --- a/paneltoolbox.cpp +++ b/paneltoolbox.cpp @@ -124,11 +124,11 @@ void PanelToolbox::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti painter->translate(boundingRect().topLeft()); QColor color1 = KColorScheme(QPalette::Active, KColorScheme::Window, - Plasma::Theme::self()->colorScheme()).background().color(); + Plasma::Theme::defaultTheme()->colorScheme()).background().color(); color1.setAlpha(64); QColor color2 = KColorScheme(QPalette::Active, KColorScheme::Window, - Plasma::Theme::self()->colorScheme()).foreground().color(); + Plasma::Theme::defaultTheme()->colorScheme()).foreground().color(); color2.setAlpha(64); QPainterPath p = shape(); diff --git a/svg.cpp b/svg.cpp index a22a372df..f11c43b85 100644 --- a/svg.cpp +++ b/svg.cpp @@ -80,7 +80,7 @@ class Svg::Private void setImagePath(const QString &imagePath, Svg *q) { if (themed) { - disconnect(Plasma::Theme::self(), SIGNAL(changed()), q, SLOT(themeChanged())); + disconnect(Plasma::Theme::defaultTheme(), SIGNAL(changed()), q, SLOT(themeChanged())); disconnect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(colorsChanged())); } @@ -89,12 +89,12 @@ class Svg::Private if (themed) { themePath = imagePath; - connect(Plasma::Theme::self(), SIGNAL(changed()), q, SLOT(themeChanged())); + connect(Plasma::Theme::defaultTheme(), SIGNAL(changed()), q, SLOT(themeChanged())); // check if svg wants colorscheme applied createRenderer(); applyColors = renderer->elementExists("hint-apply-color-scheme"); - if (applyColors && !Theme::self()->colorScheme()) { + if (applyColors && !Theme::defaultTheme()->colorScheme()) { connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(colorsChanged())); } @@ -174,7 +174,7 @@ class Svg::Private // Apply current color scheme if the svg asks for it if (applyColors) { QImage itmp = p.toImage(); - KIconEffect::colorize(itmp, Theme::self()->backgroundColor(), 1.0); + KIconEffect::colorize(itmp, Theme::defaultTheme()->backgroundColor(), 1.0); p = p.fromImage(itmp); } @@ -190,7 +190,7 @@ class Svg::Private } if (themed && path.isEmpty()) { - path = Plasma::Theme::self()->imagePath(themePath); + path = Plasma::Theme::defaultTheme()->imagePath(themePath); } QHash::const_iterator it = renderers.find(path); @@ -252,7 +252,7 @@ class Svg::Private return; } - QString newPath = Theme::self()->imagePath(themePath); + QString newPath = Theme::defaultTheme()->imagePath(themePath); if (path == newPath) { return; diff --git a/theme.cpp b/theme.cpp index fc2ed5a89..5928db52c 100644 --- a/theme.cpp +++ b/theme.cpp @@ -86,7 +86,7 @@ public: K_GLOBAL_STATIC( ThemeSingleton, privateThemeSelf ) -Theme* Theme::self() +Theme* Theme::defaultTheme() { return &privateThemeSelf->self; } @@ -195,7 +195,7 @@ void Theme::setThemeName(const QString &themeName) d->colors = KSharedConfig::openConfig(colorsFile); } - if (this == self()) { + if (this == defaultTheme()) { // we're the defualt theme, let's save our state KConfigGroup cg = d->config(); if (Private::defaultTheme == d->themeName) { @@ -257,13 +257,13 @@ KSharedConfigPtr Theme::colorScheme() const QColor Theme::textColor() const { - KColorScheme colorScheme(QPalette::Active, KColorScheme::Window, Theme::self()->colorScheme()); + KColorScheme colorScheme(QPalette::Active, KColorScheme::Window, Theme::defaultTheme()->colorScheme()); return colorScheme.foreground(KColorScheme::NormalText).color(); } QColor Theme::backgroundColor() const { - KColorScheme colorScheme(QPalette::Active, KColorScheme::Window, Theme::self()->colorScheme()); + KColorScheme colorScheme(QPalette::Active, KColorScheme::Window, Theme::defaultTheme()->colorScheme()); return colorScheme.background().color(); } diff --git a/theme.h b/theme.h index 4e2adaf17..f4f350cd6 100644 --- a/theme.h +++ b/theme.h @@ -34,9 +34,9 @@ namespace Plasma /** * @short Interface to the Plasma theme * - * Accessed via Plasma::Theme::self() e.g: + * Accessed via Plasma::Theme::defaultTheme() e.g: * \code - * QString imagePath = Plasma::Theme::self()->imagePath("widgets/clock") + * QString imagePath = Plasma::Theme::defaultTheme()->imagePath("widgets/clock") * \endcode * * Plasma::Theme provides access to a common and standardized set of graphic @@ -56,7 +56,7 @@ class PLASMA_EXPORT Theme : public QObject /** * Singleton pattern accessor **/ - static Theme* self(); + static Theme* defaultTheme(); /** * Default constructor. Usually you want to use the singleton instead. diff --git a/widgets/icon.cpp b/widgets/icon.cpp index 0ca238423..69f14bcc2 100644 --- a/widgets/icon.cpp +++ b/widgets/icon.cpp @@ -79,8 +79,8 @@ Icon::Private::~Private() void Icon::readColors() { - d->textColor = Plasma::Theme::self()->textColor(); - d->shadowColor = Plasma::Theme::self()->backgroundColor(); + d->textColor = Plasma::Theme::defaultTheme()->textColor(); + d->shadowColor = Plasma::Theme::defaultTheme()->backgroundColor(); } @@ -288,7 +288,7 @@ Icon::~Icon() void Icon::init() { readColors(); - connect(Plasma::Theme::self(), SIGNAL(changed()), SLOT(readColors())); + connect(Plasma::Theme::defaultTheme(), SIGNAL(changed()), SLOT(readColors())); // setAcceptedMouseButtons(Qt::LeftButton); setAcceptsHoverEvents(true); @@ -391,7 +391,7 @@ QSizeF Icon::Private::displaySizeHint(const QStyleOptionGraphicsItem *option, co horizontalMargin[Private::TextMargin].right; //allow only five lines of text - const qreal maxHeight = numDisplayLines*Plasma::Theme::self()->fontMetrics().lineSpacing(); + const qreal maxHeight = numDisplayLines*Plasma::Theme::defaultTheme()->fontMetrics().lineSpacing(); // To compute the nominal size for the label + info, we'll just append // the information string to the label @@ -1127,7 +1127,7 @@ QSizeF Icon::sizeFromIconSize(const qreal iconWidth) const Private::ItemMargin); } - QFontMetricsF fm = Plasma::Theme::self()->fontMetrics(); + QFontMetricsF fm = Plasma::Theme::defaultTheme()->fontMetrics(); qreal width = 0; if (d->orientation == Qt::Vertical) {