diff options
author | DUI-Team Symbio <dui-team@fi.symbio.com> | 2010-03-26 11:11:29 +0200 |
---|---|---|
committer | DUI-Team Symbio <dui-team@fi.symbio.com> | 2010-03-26 11:12:02 +0200 |
commit | 58252f22459db732a550b180eb83f72a59891c79 (patch) | |
tree | b2774ccfb943e2c6184d29ebd7dd83d7edd2b97b | |
parent | 46a73fbc914d64a33e4214f1d078b1b47d7d6c50 (diff) |
Changes: Removed part of DuiTheme API which was not needed anymore.
RevBy: Peer review
-rw-r--r-- | demos/widgetsgallery/listpage.cpp | 10 | ||||
-rw-r--r-- | src/theme/duilocalthemedaemon.cpp | 5 | ||||
-rw-r--r-- | src/theme/duitheme.cpp | 20 | ||||
-rw-r--r-- | src/theme/duitheme.h | 26 | ||||
-rw-r--r-- | src/theme/duitheme_p.h | 8 | ||||
-rw-r--r-- | src/widgets/core/duiwidgetcontroller.cpp | 3 | ||||
-rw-r--r-- | src/widgets/core/duiwidgetcontroller.h | 1 | ||||
-rw-r--r-- | tests/ft_theme/ft_theme.cpp | 4 |
8 files changed, 30 insertions, 47 deletions
diff --git a/demos/widgetsgallery/listpage.cpp b/demos/widgetsgallery/listpage.cpp index c90c079e..05667023 100644 --- a/demos/widgetsgallery/listpage.cpp +++ b/demos/widgetsgallery/listpage.cpp @@ -390,6 +390,7 @@ QList<ThemeInfo> findAvailableThemes() } #ifndef HAVE_GCONF +extern QString Dui_currentTheme(); extern void Dui_changeTheme(const QString &theme); #endif @@ -404,12 +405,19 @@ void ListPage::showThemeSelectionDialog() DuiButtonGroup *group = new DuiButtonGroup(dialog->centralWidget()); +#ifdef HAVE_GCONF + DuiGConfItem themeName("/Dui/theme/name"); + QString currentTheme = themeName.value().toString(); +#else + QString currentTheme = Dui_currentTheme(); +#endif + const int themesCount = themes.count(); for (int i = 0; i < themesCount; ++i) { DuiButton *button = new DuiButton(themes[i].themeIcon, themes[i].themeName); button->setObjectName("theme-selection-button"); button->setCheckable(true); - if (DuiTheme::currentTheme() == themes[i].theme) + if (currentTheme == themes[i].theme) button->setChecked(true); layout->addItem(button, i/4, i%4); diff --git a/src/theme/duilocalthemedaemon.cpp b/src/theme/duilocalthemedaemon.cpp index 68a2bad4..88958c76 100644 --- a/src/theme/duilocalthemedaemon.cpp +++ b/src/theme/duilocalthemedaemon.cpp @@ -30,6 +30,11 @@ using namespace Dui::DuiThemeDaemonProtocol; QString Dui_themeName; DuiLocalThemeDaemon *Dui_localDaemon; +QString DUI_EXPORT Dui_currentTheme() +{ + return Dui_localDaemon->currentTheme(); +} + void DUI_EXPORT Dui_changeTheme(const QString &theme) { Dui_themeName = theme; diff --git a/src/theme/duitheme.cpp b/src/theme/duitheme.cpp index 2c156307..dcdd376e 100644 --- a/src/theme/duitheme.cpp +++ b/src/theme/duitheme.cpp @@ -401,10 +401,10 @@ void DuiTheme::releaseStyle(const DuiStyle *style) DuiStyleSheet::releaseStyle(style); } -DuiWidgetView *DuiTheme::view(const DuiWidgetController *controller) +DuiWidgetView *DuiThemePrivate::view(const DuiWidgetController *controller) { // Best matching view class name - QString viewClassName = instance()->d_ptr->determineViewClassForController(controller); + QString viewClassName = determineViewClassForController(controller); if (viewClassName.isEmpty()) { qWarning() << "Could not find view class for:" << controller->metaObject()->className() << "/" << controller->viewType(); @@ -479,22 +479,6 @@ bool DuiThemePrivate::loadCSS(const QString &filename, DuiTheme::InsertMode mode return false; } -QString DuiTheme::currentTheme() -{ - DuiThemePrivate *d = DuiTheme::instance()->d_func(); - return d->themeDaemon->currentTheme(); -} - -QStringList DuiTheme::findAvailableThemes() -{ - return QStringList(); -} - -void DuiTheme::changeTheme(const QString &theme_id) -{ - Q_UNUSED(theme_id); -} - bool DuiTheme::hasPendingRequests() { return instance()->d_ptr->themeDaemon->hasPendingRequests(); diff --git a/src/theme/duitheme.h b/src/theme/duitheme.h index 4e374267..8b6536a5 100644 --- a/src/theme/duitheme.h +++ b/src/theme/duitheme.h @@ -55,6 +55,7 @@ public: friend class DuiWidgetController; friend class DuiStyle; + friend class DuiWidgetControllerPrivate; typedef QString ViewType; @@ -179,14 +180,6 @@ public: static void releasePixmap(const QPixmap *pixmap); /*! - * Returns a view for the given object. - * \param controller controller needing the view - * \return DuiWidgetView A theme-specific view for the object - * TODO: this should be protected or private method, and only DuiWidgetController should be able to access this. - */ - static DuiWidgetView *view(const DuiWidgetController *controller); - - /*! * \brief Returns system-wide logical colors. */ static const DuiPalette &palette(); @@ -207,23 +200,6 @@ public: static bool loadCSS(const QString &filename, InsertMode mode = Append); /*! - * Returns the current theme in use - */ - static QString currentTheme(); - - /*! - * Finds all available themes installed in the system. - */ - static QStringList findAvailableThemes(); - - /*! - * Sends a signal to theme daemon to change the theme. - * \param theme_id ID of theme to be used - * TODO: check if we want to allow any application to change the theme. - */ - void changeTheme(const QString &theme_id); - - /*! * Checks whether there are pending pixmap requests. */ static bool hasPendingRequests(); diff --git a/src/theme/duitheme_p.h b/src/theme/duitheme_p.h index 38533eb0..4f294128 100644 --- a/src/theme/duitheme_p.h +++ b/src/theme/duitheme_p.h @@ -117,6 +117,14 @@ public: #endif public: + + /*! + * Returns a view for the given object. + * \param controller controller needing the view + * \return DuiWidgetView A theme-specific view for the object + */ + DuiWidgetView *view(const DuiWidgetController *controller); + /*! * Check if the theme has defined a view for this controller, if not, go towards base class * to find one. diff --git a/src/widgets/core/duiwidgetcontroller.cpp b/src/widgets/core/duiwidgetcontroller.cpp index 9b9464ba..d8af600a 100644 --- a/src/widgets/core/duiwidgetcontroller.cpp +++ b/src/widgets/core/duiwidgetcontroller.cpp @@ -24,6 +24,7 @@ #include "duiwidgetview.h" #include "duiwidgetview_p.h" #include "duitheme.h" +#include "duitheme_p.h" #include <DuiDebug> #include <QSet> @@ -270,7 +271,7 @@ void DuiWidgetControllerPrivate::createView() if (!constructingView) { constructingView = true; - view = DuiTheme::view(q); + view = DuiTheme::instance()->d_func()->view(q); constructingView = false; } diff --git a/src/widgets/core/duiwidgetcontroller.h b/src/widgets/core/duiwidgetcontroller.h index 66de4540..e5e77f46 100644 --- a/src/widgets/core/duiwidgetcontroller.h +++ b/src/widgets/core/duiwidgetcontroller.h @@ -328,6 +328,7 @@ private: friend class Ut_DuiOverlay; friend class Ut_DuiPannableViewport; friend class Ut_DuiGrid; + friend class Ft_Theme; #endif }; diff --git a/tests/ft_theme/ft_theme.cpp b/tests/ft_theme/ft_theme.cpp index 6e8de9b5..1c51780c 100644 --- a/tests/ft_theme/ft_theme.cpp +++ b/tests/ft_theme/ft_theme.cpp @@ -162,8 +162,8 @@ void Ft_Theme::testViews() DuiWidgetController widget; widget.setViewType(viewType); - // Create view for a simple widget - DuiWidgetView *view = DuiTheme::view(&widget); + // Fetch view for a simple widget + const DuiWidgetView *view = widget.view(); // Make sure that we got view at the first place if (!viewClass.isEmpty()) { |