allow using the global theme
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=806696
This commit is contained in:
parent
8d75ba14c2
commit
d14534ba12
31
theme.cpp
31
theme.cpp
@ -47,7 +47,8 @@ public:
|
||||
: q(theme),
|
||||
locolor(false),
|
||||
compositingActive(KWindowSystem::compositingActive()),
|
||||
isDefault(false)
|
||||
isDefault(false),
|
||||
useGlobal(true)
|
||||
{
|
||||
generalFont = QApplication::font();
|
||||
}
|
||||
@ -56,11 +57,14 @@ public:
|
||||
{
|
||||
if (!cfg.isValid()) {
|
||||
QString groupName = "Theme";
|
||||
QString app = KGlobal::mainComponent().componentName();
|
||||
|
||||
if (!app.isEmpty() && app != "plasma") {
|
||||
kDebug() << "using theme for app" << app;
|
||||
groupName.append("-").append(app);
|
||||
if (!useGlobal) {
|
||||
QString app = KGlobal::mainComponent().componentName();
|
||||
|
||||
if (!app.isEmpty() && app != "plasma") {
|
||||
kDebug() << "using theme for app" << app;
|
||||
groupName.append("-").append(app);
|
||||
}
|
||||
}
|
||||
|
||||
cfg = KConfigGroup(KSharedConfig::openConfig("plasmarc"), groupName);
|
||||
@ -80,12 +84,13 @@ public:
|
||||
KSharedConfigPtr colors;
|
||||
KConfigGroup cfg;
|
||||
QFont generalFont;
|
||||
bool locolor;
|
||||
bool compositingActive;
|
||||
bool isDefault;
|
||||
#ifdef Q_WS_X11
|
||||
KSelectionWatcher *compositeWatch;
|
||||
#endif
|
||||
bool locolor : 1;
|
||||
bool compositingActive : 1;
|
||||
bool isDefault : 1;
|
||||
bool useGlobal : 1;
|
||||
};
|
||||
|
||||
PackageStructure::Ptr Theme::Private::packageStructure(0);
|
||||
@ -299,6 +304,16 @@ bool Theme::windowTranslucencyEnabled() const
|
||||
return d->compositingActive;
|
||||
}
|
||||
|
||||
void Theme::setUseGlobalSettings(bool useGlobal)
|
||||
{
|
||||
d->useGlobal = useGlobal;
|
||||
}
|
||||
|
||||
bool Theme::useGlobalSettings() const
|
||||
{
|
||||
return d->useGlobal;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include <theme.moc>
|
||||
|
14
theme.h
14
theme.h
@ -139,6 +139,20 @@ class PLASMA_EXPORT Theme : public QObject
|
||||
*/
|
||||
Q_INVOKABLE bool windowTranslucencyEnabled() const;
|
||||
|
||||
/**
|
||||
* Tells the theme whether to follow the global settings or use application
|
||||
* specific settings
|
||||
*
|
||||
* @arg useGlobal pass in true to follow the global settings
|
||||
*/
|
||||
void setUseGlobalSettings(bool useGlobal);
|
||||
|
||||
/**
|
||||
* @return true if the global settings are followed, false if application
|
||||
* specific settings are used.
|
||||
*/
|
||||
bool useGlobalSettings() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* Emitted when the user changes the theme. SVGs should be reloaded at
|
||||
|
Loading…
x
Reference in New Issue
Block a user