Plasma API adjustements:

Theme::colors() => Theme::colorScheme()
Theme::image() => Theme::imagePath()

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=797634
This commit is contained in:
Dmitry Suzdalev 2008-04-16 15:53:16 +00:00
parent 4a5df9c733
commit b237019d4f
6 changed files with 19 additions and 19 deletions

View File

@ -59,8 +59,8 @@ AppletHandle::AppletHandle(Containment *parent, Applet *applet)
m_buttonsOnRight(false), m_buttonsOnRight(false),
m_pendingFade(false) m_pendingFade(false)
{ {
KColorScheme colors(QPalette::Active, KColorScheme::View, Theme::self()->colors()); KColorScheme colorScheme(QPalette::Active, KColorScheme::View, Theme::self()->colorScheme());
m_gradientColor = colors.background(KColorScheme::NormalBackground).color(); m_gradientColor = colorScheme.background(KColorScheme::NormalBackground).color();
QTransform originalMatrix = m_applet->transform(); QTransform originalMatrix = m_applet->transform();
QRectF rect(m_applet->contentsRect()); QRectF rect(m_applet->contentsRect());

View File

@ -109,11 +109,11 @@ void DesktopToolbox::paint(QPainter *painter, const QStyleOptionGraphicsItem *op
painter->translate(boundingRect().topLeft()); painter->translate(boundingRect().topLeft());
QColor color1 = KColorScheme(QPalette::Active, KColorScheme::Window, QColor color1 = KColorScheme(QPalette::Active, KColorScheme::Window,
Plasma::Theme::self()->colors()).background().color(); Plasma::Theme::self()->colorScheme()).background().color();
color1.setAlpha(64); color1.setAlpha(64);
QColor color2 = KColorScheme(QPalette::Active, KColorScheme::Window, QColor color2 = KColorScheme(QPalette::Active, KColorScheme::Window,
Plasma::Theme::self()->colors()).foreground().color(); Plasma::Theme::self()->colorScheme()).foreground().color();
color2.setAlpha(64); color2.setAlpha(64);
QPainterPath p = shape(); QPainterPath p = shape();

View File

@ -119,11 +119,11 @@ void PanelToolbox::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
painter->translate(boundingRect().topLeft()); painter->translate(boundingRect().topLeft());
QColor color1 = KColorScheme(QPalette::Active, KColorScheme::Window, QColor color1 = KColorScheme(QPalette::Active, KColorScheme::Window,
Plasma::Theme::self()->colors()).background().color(); Plasma::Theme::self()->colorScheme()).background().color();
color1.setAlpha(64); color1.setAlpha(64);
QColor color2 = KColorScheme(QPalette::Active, KColorScheme::Window, QColor color2 = KColorScheme(QPalette::Active, KColorScheme::Window,
Plasma::Theme::self()->colors()).foreground().color(); Plasma::Theme::self()->colorScheme()).foreground().color();
color2.setAlpha(64); color2.setAlpha(64);
QPainterPath p = shape(); QPainterPath p = shape();

View File

@ -98,7 +98,7 @@ class Svg::Private
// check if svg wants colorscheme applied // check if svg wants colorscheme applied
createRenderer(); createRenderer();
applyColors = renderer->elementExists("hint-apply-color-scheme"); applyColors = renderer->elementExists("hint-apply-color-scheme");
if (applyColors && !Theme::self()->colors()) { if (applyColors && !Theme::self()->colorScheme()) {
connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(colorsChanged())); connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(colorsChanged()));
} }
@ -234,7 +234,7 @@ class Svg::Private
} }
if (themed && path.isEmpty()) { if (themed && path.isEmpty()) {
path = Plasma::Theme::self()->image(themePath); path = Plasma::Theme::self()->imagePath(themePath);
} }
QHash<QString, SharedSvgRenderer::Ptr>::const_iterator it = renderers.find(path); QHash<QString, SharedSvgRenderer::Ptr>::const_iterator it = renderers.find(path);
@ -296,9 +296,9 @@ class Svg::Private
QString path; QString path;
QList<QString> ids; QList<QString> ids;
QSizeF size; QSizeF size;
Svg::ContentType contentType;
bool themed; bool themed;
bool applyColors; bool applyColors;
Svg::ContentType contentType;
}; };
QHash<QString, SharedSvgRenderer::Ptr> Svg::Private::renderers; QHash<QString, SharedSvgRenderer::Ptr> Svg::Private::renderers;
@ -438,7 +438,7 @@ void Svg::themeChanged()
return; return;
} }
QString newPath = Theme::self()->image(d->themePath); QString newPath = Theme::self()->imagePath(d->themePath);
if (d->path == newPath) { if (d->path == newPath) {
return; return;

View File

@ -231,7 +231,7 @@ QString Theme::Private::findInTheme(const QString &image, const QString &theme)
return search; return search;
} }
QString Theme::image(const QString& name) const QString Theme::imagePath(const QString& name) const
{ {
QString path = d->findInTheme(name, d->themeName); QString path = d->findInTheme(name, d->themeName);
@ -246,21 +246,21 @@ QString Theme::image(const QString& name) const
return path; return path;
} }
KSharedConfigPtr Theme::colors() const KSharedConfigPtr Theme::colorScheme() const
{ {
return d->colors; return d->colors;
} }
QColor Theme::textColor() const QColor Theme::textColor() const
{ {
KColorScheme colors(QPalette::Active, KColorScheme::Window, Theme::self()->colors()); KColorScheme colorScheme(QPalette::Active, KColorScheme::Window, Theme::self()->colorScheme());
return colors.foreground(KColorScheme::NormalText).color(); return colorScheme.foreground(KColorScheme::NormalText).color();
} }
QColor Theme::backgroundColor() const QColor Theme::backgroundColor() const
{ {
KColorScheme colors(QPalette::Active, KColorScheme::Window, Theme::self()->colors()); KColorScheme colorScheme(QPalette::Active, KColorScheme::Window, Theme::self()->colorScheme());
return colors.background().color(); return colorScheme.background().color();
} }
void Theme::setFont(const QFont &font) void Theme::setFont(const QFont &font)

View File

@ -36,7 +36,7 @@ namespace Plasma
* *
* Accessed via Plasma::Theme::self() e.g: * Accessed via Plasma::Theme::self() e.g:
* \code * \code
* QString image = Plasma::Theme::self()->image("widgets/clock") * QString imagePath = Plasma::Theme::self()->imagePath("widgets/clock")
* \endcode * \endcode
* *
* Plasma::Theme provides access to a common and standardized set of graphic * Plasma::Theme provides access to a common and standardized set of graphic
@ -95,14 +95,14 @@ class PLASMA_EXPORT Theme : public QObject
* ".svg" part or a leading slash) * ".svg" part or a leading slash)
* @return the full path to the requested file for the current theme * @return the full path to the requested file for the current theme
*/ */
Q_INVOKABLE QString image( const QString& name ) const; Q_INVOKABLE QString imagePath( const QString& name ) const;
/** /**
* Returns the color scheme configurationthat goes along this theme. * Returns the color scheme configurationthat goes along this theme.
* This can be used with KStatefulBrush and KColorScheme to determine * This can be used with KStatefulBrush and KColorScheme to determine
* the proper colours to use along with the visual elements in this theme. * the proper colours to use along with the visual elements in this theme.
*/ */
Q_INVOKABLE KSharedConfigPtr colors() const; Q_INVOKABLE KSharedConfigPtr colorScheme() const;
/** /**
* Returns the text color to be used by items resting on the background * Returns the text color to be used by items resting on the background