From f7957f39937c42aadecc6ad2b73d006559514e00 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 14 Mar 2012 13:50:14 +0100 Subject: Refactor theme plugin loading. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the old implementation, the QPlatformIntegration was asked for the theme first, so there was no way of overriding that by a custom plugin. Also, there was a memory leak in case the platform theme was actually created by a plugin. QGuiApplication now asks the QPlatformIntegration for a list of potential theme names first, tries to load them using the plugin loader and finally invokes a factory method of QPlatformIntegration in case that fails. The theme is now owned by QGuiApplication. In the XCB plugin, the environment variable DESKTOP_SESSION is queried and appended to the list of themes, making it possible to load plugins for other session types. Change-Id: I1a4b4e061815bca16c65b23e591bb7563a3e44e2 Reviewed-by: Samuel Rødal --- src/platformsupport/themes/genericunix/qgenericunixthemes_p.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/platformsupport/themes/genericunix/qgenericunixthemes_p.h') diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h index a9db29e8cd..cabffc0212 100644 --- a/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes_p.h @@ -67,11 +67,14 @@ class QGenericUnixTheme : public QPlatformTheme public: QGenericUnixTheme() {} - static QPlatformTheme *createUnixTheme(); + static QPlatformTheme *createUnixTheme(const QString &name); + static QStringList themeNames(); virtual QVariant themeHint(ThemeHint hint) const; static QStringList xdgIconThemePaths(); + + static const char *name; }; class QKdeTheme : public QPlatformTheme @@ -88,6 +91,8 @@ public: virtual const QFont *font(Font type) const { return m_resources.fonts[type]; } + static const char *name; + private: QString globalSettingsFile() const; void refresh(); @@ -109,6 +114,8 @@ public: QGnomeTheme() {} virtual QVariant themeHint(ThemeHint hint) const; + static const char *name; + private: }; -- cgit v1.2.3