22 #include <QDeclarativePropertyMap>
24 #include <KIconLoader>
26 class FontProxySingleton
30 : defaultFont(Plasma::Theme::DefaultFont),
31 desktopFont(Plasma::Theme::DesktopFont),
32 smallestFont(Plasma::Theme::SmallestFont)
41 K_GLOBAL_STATIC(FontProxySingleton, privateFontProxySingleton)
47 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
48 this, SIGNAL(boldChanged()));
49 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
50 this, SIGNAL(capitalizationChanged()));
51 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
52 this, SIGNAL(familyChanged()));
53 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
54 this, SIGNAL(italicChanged()));
55 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
56 this, SIGNAL(letterSpacingChanged()));
57 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
58 this, SIGNAL(pixelSizeChanged()));
59 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
60 this, SIGNAL(pointSizeChanged()));
61 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
62 this, SIGNAL(strikeoutChanged()));
63 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
64 this, SIGNAL(underlineChanged()));
65 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
66 this, SIGNAL(weightChanged()));
67 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
68 this, SIGNAL(wordSpacingChanged()));
69 connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
70 this, SIGNAL(mSizeChanged()));
94 return Plasma::Theme::defaultTheme()->font(m_fontRole).bold();
104 return Plasma::Theme::defaultTheme()->font(m_fontRole).family();
109 return Plasma::Theme::defaultTheme()->font(m_fontRole).italic();
114 return Plasma::Theme::defaultTheme()->font(m_fontRole).letterSpacing();
119 return Plasma::Theme::defaultTheme()->font(m_fontRole).pixelSize();
124 return Plasma::Theme::defaultTheme()->font(m_fontRole).pointSizeF();
129 return Plasma::Theme::defaultTheme()->font(m_fontRole).strikeOut();
134 return Plasma::Theme::defaultTheme()->font(m_fontRole).underline();
139 return (
FontProxy::Weight)Plasma::Theme::defaultTheme()->font(m_fontRole).weight();
144 return Plasma::Theme::defaultTheme()->font(m_fontRole).wordSpacing();
149 return QFontMetrics(Plasma::Theme::defaultTheme()->font(m_fontRole)).boundingRect(
"M").size();
158 m_defaultIconSize = KIconLoader::global()->currentSize(KIconLoader::Desktop);
160 m_iconSizes =
new QDeclarativePropertyMap(
this);
161 m_iconSizes->insert(
"desktop", QVariant(KIconLoader::global()->currentSize(KIconLoader::Desktop)));
162 m_iconSizes->insert(
"panel", QVariant(KIconLoader::global()->currentSize(KIconLoader::Panel)));
163 m_iconSizes->insert(
"toolbar", KIconLoader::global()->currentSize(KIconLoader::Toolbar));
164 m_iconSizes->insert(
"small", KIconLoader::global()->currentSize(KIconLoader::Small));
165 m_iconSizes->insert(
"dialog", KIconLoader::global()->currentSize(KIconLoader::Dialog));
168 connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()),
this, SLOT(iconLoaderSettingsChanged()));
177 return Plasma::Theme::defaultTheme()->themeName();
197 return Plasma::Theme::defaultTheme()->windowTranslucencyEnabled();
202 return Plasma::Theme::defaultTheme()->homepage();
207 return Plasma::Theme::defaultTheme()->useGlobalSettings();
212 return Plasma::Theme::defaultTheme()->wallpaperPath();
217 return Plasma::Theme::defaultTheme()->wallpaperPath(QSize(width, height));
222 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
227 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::HighlightColor);
232 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
237 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ButtonTextColor);
242 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ButtonBackgroundColor);
247 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::LinkColor);
252 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::VisitedLinkColor);
257 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ButtonHoverColor);
262 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ButtonFocusColor);
267 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewTextColor);
272 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewBackgroundColor);
277 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewHoverColor);
282 return Plasma::Theme::defaultTheme()->color(Plasma::Theme::ViewFocusColor);
287 return Plasma::Theme::defaultTheme()->styleSheet(QString());
292 return KIconLoader::SizeSmall;
297 return KIconLoader::SizeSmallMedium;
302 return KIconLoader::SizeMedium;
307 return KIconLoader::SizeLarge;
312 return KIconLoader::SizeHuge;
317 return KIconLoader::SizeEnormous;
320 void ThemeProxy::iconLoaderSettingsChanged()
322 m_defaultIconSize = KIconLoader::global()->currentSize(KIconLoader::Desktop);
324 m_iconSizes->insert(
"desktop", QVariant(KIconLoader::global()->currentSize(KIconLoader::Desktop)));
325 m_iconSizes->insert(
"toolbar", KIconLoader::global()->currentSize(KIconLoader::Toolbar));
326 m_iconSizes->insert(
"small", KIconLoader::global()->currentSize(KIconLoader::Small));
327 m_iconSizes->insert(
"dialog", KIconLoader::global()->currentSize(KIconLoader::Dialog));
336 return m_defaultIconSize;
QString wallpaperPath() const
QObject * smallestFont() const
QObject * desktopFont() const
QDeclarativePropertyMap * iconSizes() const
qreal wordSpacing() const
void defaultIconSizeChanged()
ThemeProxy(QObject *parent=0)
int mediumIconSize() const
static FontProxy * smallestFont()
QColor highlightColor() const
static FontProxy * defaultFont()
bool windowTranslucencyEnabled() const
int enormousIconSize() const
int largeIconSize() const
bool useGlobalSettings() const
static FontProxy * desktopFont()
qreal letterSpacing() const
Q_INVOKABLE QString wallpaperPathForSize(int width=-1, int height=-1) const
QString styleSheet() const
QColor buttonTextColor() const
QColor backgroundColor() const
QObject * defaultFont() const
QString themeName() const
QColor visitedLinkColor() const
Capitalization capitalization() const
QColor buttonFocusColor() const
QColor viewHoverColor() const
QColor viewBackgroundColor() const
QColor buttonHoverColor() const
int smallMediumIconSize() const
QColor viewTextColor() const
int smallIconSize() const
QColor viewFocusColor() const
int defaultIconSize() const
QColor buttonBackgroundColor() const