Plasma::Theme::self() -> Plasma::Theme::defaultTheme() as planned during the sprint

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=799919
This commit is contained in:
Anne-Marie Mahfouf 2008-04-22 21:10:14 +00:00
parent f1aba49d18
commit 36bc2c4e97
9 changed files with 27 additions and 27 deletions

View File

@ -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

View File

@ -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();

View File

@ -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();

View File

@ -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();
}

View File

@ -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();

12
svg.cpp
View File

@ -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<QString, SharedSvgRenderer::Ptr>::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;

View File

@ -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();
}

View File

@ -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.

View File

@ -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) {