From a70dd8c299c4f0fe67d19bb4bf769cccb5a45645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=BCgler?= Date: Thu, 23 Jan 2014 01:47:42 +0100 Subject: [PATCH] theme.defaultIconSize moves to units.iconSizes.default --- src/declarativeimports/core/units.cpp | 2 +- src/declarativeimports/core/units.h | 6 ++++-- src/plasma/private/theme_p.cpp | 10 ---------- src/plasma/private/theme_p.h | 5 ----- src/plasma/theme.cpp | 5 ----- src/plasma/theme.h | 6 ------ 6 files changed, 5 insertions(+), 29 deletions(-) diff --git a/src/declarativeimports/core/units.cpp b/src/declarativeimports/core/units.cpp index 65ee94028..2619061bc 100644 --- a/src/declarativeimports/core/units.cpp +++ b/src/declarativeimports/core/units.cpp @@ -58,6 +58,7 @@ Units::~Units() void Units::iconLoaderSettingsChanged() { + m_iconSizes->insert("default", QVariant(KIconLoader::global()->currentSize(KIconLoader::Desktop))); m_iconSizes->insert("desktop", QVariant(KIconLoader::global()->currentSize(KIconLoader::Desktop))); m_iconSizes->insert("toolbar", KIconLoader::global()->currentSize(KIconLoader::Toolbar)); m_iconSizes->insert("small", KIconLoader::global()->currentSize(KIconLoader::Small)); @@ -77,7 +78,6 @@ QQmlPropertyMap *Units::iconSizes() const return m_iconSizes; } - qreal Units::dpiScale() const { diff --git a/src/declarativeimports/core/units.h b/src/declarativeimports/core/units.h index 9f3581115..f423687b6 100644 --- a/src/declarativeimports/core/units.h +++ b/src/declarativeimports/core/units.h @@ -82,7 +82,6 @@ public: int smallSpacing() const; int largeSpacing() const; - /** * @returns the number of pixels value density independent pixels correspond to. */ @@ -113,11 +112,14 @@ private Q_SLOTS: private: void updateSpacing(); - int m_gridUnit; Plasma::Theme m_theme; + + int m_gridUnit; qreal m_dpiScale; qreal m_dpi; + QQmlPropertyMap *m_iconSizes; + int m_smallSpacing; int m_largeSpacing; }; diff --git a/src/plasma/private/theme_p.cpp b/src/plasma/private/theme_p.cpp index 6fde9b573..91d32c0ff 100644 --- a/src/plasma/private/theme_p.cpp +++ b/src/plasma/private/theme_p.cpp @@ -59,7 +59,6 @@ ThemePrivate::ThemePrivate(QObject *parent) pixmapCache(0), cacheSize(0), cachesToDiscard(NoCache), - defaultIconSize(KIconLoader::global()->currentSize(KIconLoader::Desktop)), locolor(false), compositingActive(KWindowSystem::self()->compositingActive()), blurActive(false), @@ -91,7 +90,6 @@ ThemePrivate::ThemePrivate(QObject *parent) #endif } installEventFilter(qApp); - updateSpacing(); } ThemePrivate::~ThemePrivate() @@ -579,7 +577,6 @@ bool ThemePrivate::eventFilter(QObject *watched, QEvent *event) colorsChanged(); } if (event->type() == QEvent::ApplicationFontChange || event->type() == QEvent::FontChange) { - updateSpacing(); defaultFontChanged(); smallestFontChanged(); } @@ -587,13 +584,6 @@ bool ThemePrivate::eventFilter(QObject *watched, QEvent *event) return QObject::eventFilter(watched, event); } -void ThemePrivate::updateSpacing() -{ - const int _s = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); - smallSpacing = qMax(2, (int)(_s / 8)); // 1/8 of msize.height, at least 2 - largeSpacing = _s; // msize.height -} - } #include "moc_theme_p.cpp" diff --git a/src/plasma/private/theme_p.h b/src/plasma/private/theme_p.h index 6c490d7c5..3dcd14044 100644 --- a/src/plasma/private/theme_p.h +++ b/src/plasma/private/theme_p.h @@ -77,7 +77,6 @@ public: bool useCache(); void setThemeName(const QString &themeName, bool writeSettings); void processWallpaperSettings(KConfigBase *metadata); - void updateSpacing(); const QString processStyleSheet(const QString &css); const QString svgStyleSheet(); @@ -137,10 +136,6 @@ public: unsigned cacheSize; CacheTypes cachesToDiscard; - int defaultIconSize; - int smallSpacing; - int largeSpacing; - bool locolor : 1; bool compositingActive : 1; bool blurActive : 1; diff --git a/src/plasma/theme.cpp b/src/plasma/theme.cpp index ee3a38e1e..a0ff7c4ef 100644 --- a/src/plasma/theme.cpp +++ b/src/plasma/theme.cpp @@ -535,11 +535,6 @@ QColor Theme::viewFocusColor() const return Plasma::Theme::color(Plasma::Theme::ViewFocusColor); } -int Theme::defaultIconSize() const -{ - return d->defaultIconSize; -} - QSizeF Theme::mSize(const QFont &font) const { return QFontMetrics(font).boundingRect("M").size(); diff --git a/src/plasma/theme.h b/src/plasma/theme.h index 2defacff9..e446ec979 100644 --- a/src/plasma/theme.h +++ b/src/plasma/theme.h @@ -81,8 +81,6 @@ class PLASMA_EXPORT Theme : public QObject Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY themeChanged) Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY themeChanged) - Q_PROPERTY(int defaultIconSize READ defaultIconSize NOTIFY defaultIconSizeChanged) - public: enum ColorRole { TextColor = 0, /**< the text color to be used by items resting on the background */ @@ -358,8 +356,6 @@ class PLASMA_EXPORT Theme : public QObject QColor viewHoverColor() const; QColor viewFocusColor() const; - int defaultIconSize() const; - Q_INVOKABLE QSizeF mSize(const QFont &font = QApplication::font()) const; Q_SIGNALS: @@ -376,8 +372,6 @@ class PLASMA_EXPORT Theme : public QObject void defaultFontChanged(); void smallestFontChanged(); - void defaultIconSizeChanged(); - private: friend class SvgPrivate; friend class ThemePrivate;