* add DesktopFont
* provide button colors svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=868328
This commit is contained in:
parent
8a1d5fc216
commit
1f95d86db4
21
theme.cpp
21
theme.cpp
@ -51,6 +51,7 @@ public:
|
|||||||
ThemePrivate(Theme *theme)
|
ThemePrivate(Theme *theme)
|
||||||
: q(theme),
|
: q(theme),
|
||||||
colorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)),
|
colorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)),
|
||||||
|
buttonColorScheme(QPalette::Active, KColorScheme::Button, KSharedConfigPtr(0)),
|
||||||
defaultWallpaperTheme(DEFAULT_WALLPAPER_THEME),
|
defaultWallpaperTheme(DEFAULT_WALLPAPER_THEME),
|
||||||
defaultWallpaperSuffix(DEFAULT_WALLPAPER_SUFFIX),
|
defaultWallpaperSuffix(DEFAULT_WALLPAPER_SUFFIX),
|
||||||
defaultWallpaperWidth(DEFAULT_WALLPAPER_WIDTH),
|
defaultWallpaperWidth(DEFAULT_WALLPAPER_WIDTH),
|
||||||
@ -94,6 +95,7 @@ public:
|
|||||||
QString themeName;
|
QString themeName;
|
||||||
KSharedConfigPtr colors;
|
KSharedConfigPtr colors;
|
||||||
KColorScheme colorScheme;
|
KColorScheme colorScheme;
|
||||||
|
KColorScheme buttonColorScheme;
|
||||||
KConfigGroup cfg;
|
KConfigGroup cfg;
|
||||||
QFont generalFont;
|
QFont generalFont;
|
||||||
QString defaultWallpaperTheme;
|
QString defaultWallpaperTheme;
|
||||||
@ -263,6 +265,7 @@ void Theme::setThemeName(const QString &themeName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
d->colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, d->colors);
|
d->colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, d->colors);
|
||||||
|
d->buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, d->colors);
|
||||||
d->hasWallpapers = !KStandardDirs::locate("data", "desktoptheme/" + theme + "/wallpapers").isEmpty();
|
d->hasWallpapers = !KStandardDirs::locate("data", "desktoptheme/" + theme + "/wallpapers").isEmpty();
|
||||||
|
|
||||||
if (d->isDefault) {
|
if (d->isDefault) {
|
||||||
@ -396,6 +399,14 @@ QColor Theme::color(ColorRole role) const
|
|||||||
case BackgroundColor:
|
case BackgroundColor:
|
||||||
return d->colorScheme.background().color();
|
return d->colorScheme.background().color();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ButtonTextColor:
|
||||||
|
return d->buttonColorScheme.foreground(KColorScheme::NormalText).color();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ButtonBackgroundColor:
|
||||||
|
return d->buttonColorScheme.background(KColorScheme::ActiveBackground).color();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QColor();
|
return QColor();
|
||||||
@ -410,7 +421,17 @@ void Theme::setFont(const QFont &font, FontRole role)
|
|||||||
QFont Theme::font(FontRole role) const
|
QFont Theme::font(FontRole role) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(role)
|
Q_UNUSED(role)
|
||||||
|
switch (role) {
|
||||||
|
case DesktopFont: {
|
||||||
|
KConfigGroup cg(KGlobal::config(), "General");
|
||||||
|
return cg.readEntry("desktopFont", QFont("Sans Serif", 10));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case DefaultFont:
|
||||||
|
default:
|
||||||
return d->generalFont;
|
return d->generalFont;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QFontMetrics Theme::fontMetrics() const
|
QFontMetrics Theme::fontMetrics() const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user