From 3c8ff37491d2c3a2f85d79a19cb7ae2c6ee2a500 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Sun, 30 Oct 2011 19:07:58 +0100 Subject: [PATCH] Theme exports iconloader sizes --- declarativeimports/core/theme.cpp | 31 +++++++++++++++++++ declarativeimports/core/theme_p.h | 15 +++++++++ .../plasmacomponents/qml/IconLoader.qml | 5 ++- .../plasmacomponents/qml/TabButton.qml | 5 ++- .../plasmacomponents/qml/qmldir | 8 +++++ 5 files changed, 58 insertions(+), 6 deletions(-) diff --git a/declarativeimports/core/theme.cpp b/declarativeimports/core/theme.cpp index a67746d11..262afff59 100644 --- a/declarativeimports/core/theme.cpp +++ b/declarativeimports/core/theme.cpp @@ -19,6 +19,8 @@ #include "theme_p.h" +#include + class FontProxySingleton { public: @@ -267,6 +269,35 @@ QString ThemeProxy::styleSheet() const return Plasma::Theme::defaultTheme()->styleSheet(QString()); } +int ThemeProxy::smallIconSize() const +{ + return KIconLoader::SizeSmall; +} + +int ThemeProxy::smallMediumIconSize() const +{ + return KIconLoader::SizeSmallMedium; +} + +int ThemeProxy::mediumIconSize() const +{ + return KIconLoader::SizeMedium; +} + +int ThemeProxy::largeIconSize() const +{ + return KIconLoader::SizeLarge; +} + +int ThemeProxy::hugeIconSize() const +{ + return KIconLoader::SizeHuge; +} + +int ThemeProxy::enormousIconSize() const +{ + return KIconLoader::SizeEnormous; +} #include "theme_p.moc" diff --git a/declarativeimports/core/theme_p.h b/declarativeimports/core/theme_p.h index 2d5dad587..e83e492e2 100644 --- a/declarativeimports/core/theme_p.h +++ b/declarativeimports/core/theme_p.h @@ -129,6 +129,14 @@ class ThemeProxy : public QObject Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY themeChanged) Q_PROPERTY(QString styleSheet READ styleSheet NOTIFY themeChanged) + // icon sizes + Q_PROPERTY(int smallIconSize READ smallIconSize CONSTANT) + Q_PROPERTY(int smallMediumIconSize READ smallMediumIconSize CONSTANT) + Q_PROPERTY(int mediumIconSize READ mediumIconSize CONSTANT) + Q_PROPERTY(int largeIconSize READ largeIconSize CONSTANT) + Q_PROPERTY(int hugeIconSize READ hugeIconSize CONSTANT) + Q_PROPERTY(int enormousIconSize READ enormousIconSize CONSTANT) + public: ThemeProxy(QObject *parent = 0); ~ThemeProxy(); @@ -158,6 +166,13 @@ public: QColor viewFocusColor() const; QString styleSheet() const; + int smallIconSize() const; + int smallMediumIconSize() const; + int mediumIconSize() const; + int largeIconSize() const; + int hugeIconSize() const; + int enormousIconSize() const; + Q_SIGNALS: void themeChanged(); }; diff --git a/declarativeimports/plasmacomponents/qml/IconLoader.qml b/declarativeimports/plasmacomponents/qml/IconLoader.qml index caa4fae5b..62718b845 100644 --- a/declarativeimports/plasmacomponents/qml/IconLoader.qml +++ b/declarativeimports/plasmacomponents/qml/IconLoader.qml @@ -45,9 +45,8 @@ Item { valid = true } - //FIXME: iconloader sizes coming from plasma - implicitWidth: 16 - implicitHeight: 16 + implicitWidth: theme.smallIconSize + implicitHeight: theme.smallIconSize PlasmaCore.Svg { id: svgIcon diff --git a/declarativeimports/plasmacomponents/qml/TabButton.qml b/declarativeimports/plasmacomponents/qml/TabButton.qml index a9d273708..74f97fd99 100644 --- a/declarativeimports/plasmacomponents/qml/TabButton.qml +++ b/declarativeimports/plasmacomponents/qml/TabButton.qml @@ -107,9 +107,8 @@ Item { IconLoader { id: imageLoader - //FIXME: icon sizes in Theme - width : 16 - height : 16 + implicitWidth: theme.smallIconSize + implicitHeight: theme.smallIconSize anchors { left: internal.portrait ? undefined : parent.left diff --git a/declarativeimports/plasmacomponents/qml/qmldir b/declarativeimports/plasmacomponents/qml/qmldir index 8e17d033a..afa9fdeb0 100644 --- a/declarativeimports/plasmacomponents/qml/qmldir +++ b/declarativeimports/plasmacomponents/qml/qmldir @@ -24,6 +24,14 @@ ToolBar 0.1 ToolBar.qml ToolButton 0.1 ToolButton.qml ListItem 0.1 ToolButton.qml +CommonDialog 0.1 CommonDialog.qml +Dialog 0.1 Dialog.qml +QueryDialog 0.1 QueryDialog.qml +SelectionDialog 0.1 SelectionDialog.qml +Page 0.1 Page.qml +PageStack 0.1 PageStack.qml +Window 0.1 Window.qml + TabBar 0.1 TabBar.qml TabButton 0.1 TabButton.qml TabGroup 0.1 TabGroup.qml