remove the ThemePrivate singleton
This commit is contained in:
parent
2006df44cc
commit
fe9ebd86a8
|
@ -46,25 +46,6 @@ QHash<QString, ThemePrivate *> ThemePrivate::themes = QHash<QString, ThemePrivat
|
||||||
QHash<QString, int> ThemePrivate::themesRefCount = QHash<QString, int>();
|
QHash<QString, int> ThemePrivate::themesRefCount = QHash<QString, int>();
|
||||||
|
|
||||||
|
|
||||||
class ThemePrivateSingleton
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ThemePrivateSingleton()
|
|
||||||
{
|
|
||||||
self.isDefault = true;
|
|
||||||
|
|
||||||
//FIXME: if/when kconfig gets change notification, this will be unnecessary
|
|
||||||
KDirWatch::self()->addFile(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QLatin1Char('/') + ThemePrivate::themeRcFile);
|
|
||||||
QObject::connect(KDirWatch::self(), SIGNAL(created(QString)), &self, SLOT(settingsFileChanged(QString)));
|
|
||||||
QObject::connect(KDirWatch::self(), SIGNAL(dirty(QString)), &self, SLOT(settingsFileChanged(QString)));
|
|
||||||
}
|
|
||||||
|
|
||||||
ThemePrivate self;
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_GLOBAL_STATIC(ThemePrivateSingleton, themePrivateSelf)
|
|
||||||
|
|
||||||
|
|
||||||
ThemePrivate::ThemePrivate(QObject *parent)
|
ThemePrivate::ThemePrivate(QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
colorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)),
|
colorScheme(QPalette::Active, KColorScheme::Window, KSharedConfigPtr(0)),
|
||||||
|
@ -114,11 +95,6 @@ ThemePrivate::~ThemePrivate()
|
||||||
delete pixmapCache;
|
delete pixmapCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemePrivate *ThemePrivate::self()
|
|
||||||
{
|
|
||||||
return &themePrivateSelf()->self;
|
|
||||||
}
|
|
||||||
|
|
||||||
KConfigGroup &ThemePrivate::config()
|
KConfigGroup &ThemePrivate::config()
|
||||||
{
|
{
|
||||||
if (!cfg.isValid()) {
|
if (!cfg.isValid()) {
|
||||||
|
|
|
@ -68,8 +68,6 @@ public:
|
||||||
ThemePrivate(QObject *parent = 0);
|
ThemePrivate(QObject *parent = 0);
|
||||||
~ThemePrivate();
|
~ThemePrivate();
|
||||||
|
|
||||||
static ThemePrivate *self();
|
|
||||||
|
|
||||||
KConfigGroup &config();
|
KConfigGroup &config();
|
||||||
|
|
||||||
QString findInTheme(const QString &image, const QString &theme, bool cache = true);
|
QString findInTheme(const QString &image, const QString &theme, bool cache = true);
|
||||||
|
|
|
@ -73,8 +73,7 @@ Theme *Theme::defaultTheme()
|
||||||
}
|
}
|
||||||
|
|
||||||
Theme::Theme(QObject *parent)
|
Theme::Theme(QObject *parent)
|
||||||
: QObject(parent),
|
: QObject(parent)
|
||||||
d(ThemePrivate::self())
|
|
||||||
{
|
{
|
||||||
if (!ThemePrivate::globalTheme) {
|
if (!ThemePrivate::globalTheme) {
|
||||||
ThemePrivate::globalTheme = new ThemePrivate;
|
ThemePrivate::globalTheme = new ThemePrivate;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user