theme.defaultIconSize moves to units.iconSizes.default

This commit is contained in:
Sebastian Kügler 2014-01-23 01:47:42 +01:00
parent f6e495c76c
commit a70dd8c299
6 changed files with 5 additions and 29 deletions

View File

@ -58,6 +58,7 @@ Units::~Units()
void Units::iconLoaderSettingsChanged() 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("desktop", QVariant(KIconLoader::global()->currentSize(KIconLoader::Desktop)));
m_iconSizes->insert("toolbar", KIconLoader::global()->currentSize(KIconLoader::Toolbar)); m_iconSizes->insert("toolbar", KIconLoader::global()->currentSize(KIconLoader::Toolbar));
m_iconSizes->insert("small", KIconLoader::global()->currentSize(KIconLoader::Small)); m_iconSizes->insert("small", KIconLoader::global()->currentSize(KIconLoader::Small));
@ -77,7 +78,6 @@ QQmlPropertyMap *Units::iconSizes() const
return m_iconSizes; return m_iconSizes;
} }
qreal Units::dpiScale() const qreal Units::dpiScale() const
{ {

View File

@ -82,7 +82,6 @@ public:
int smallSpacing() const; int smallSpacing() const;
int largeSpacing() const; int largeSpacing() const;
/** /**
* @returns the number of pixels value density independent pixels correspond to. * @returns the number of pixels value density independent pixels correspond to.
*/ */
@ -113,11 +112,14 @@ private Q_SLOTS:
private: private:
void updateSpacing(); void updateSpacing();
int m_gridUnit;
Plasma::Theme m_theme; Plasma::Theme m_theme;
int m_gridUnit;
qreal m_dpiScale; qreal m_dpiScale;
qreal m_dpi; qreal m_dpi;
QQmlPropertyMap *m_iconSizes; QQmlPropertyMap *m_iconSizes;
int m_smallSpacing; int m_smallSpacing;
int m_largeSpacing; int m_largeSpacing;
}; };

View File

@ -59,7 +59,6 @@ ThemePrivate::ThemePrivate(QObject *parent)
pixmapCache(0), pixmapCache(0),
cacheSize(0), cacheSize(0),
cachesToDiscard(NoCache), cachesToDiscard(NoCache),
defaultIconSize(KIconLoader::global()->currentSize(KIconLoader::Desktop)),
locolor(false), locolor(false),
compositingActive(KWindowSystem::self()->compositingActive()), compositingActive(KWindowSystem::self()->compositingActive()),
blurActive(false), blurActive(false),
@ -91,7 +90,6 @@ ThemePrivate::ThemePrivate(QObject *parent)
#endif #endif
} }
installEventFilter(qApp); installEventFilter(qApp);
updateSpacing();
} }
ThemePrivate::~ThemePrivate() ThemePrivate::~ThemePrivate()
@ -579,7 +577,6 @@ bool ThemePrivate::eventFilter(QObject *watched, QEvent *event)
colorsChanged(); colorsChanged();
} }
if (event->type() == QEvent::ApplicationFontChange || event->type() == QEvent::FontChange) { if (event->type() == QEvent::ApplicationFontChange || event->type() == QEvent::FontChange) {
updateSpacing();
defaultFontChanged(); defaultFontChanged();
smallestFontChanged(); smallestFontChanged();
} }
@ -587,13 +584,6 @@ bool ThemePrivate::eventFilter(QObject *watched, QEvent *event)
return QObject::eventFilter(watched, 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" #include "moc_theme_p.cpp"

View File

@ -77,7 +77,6 @@ public:
bool useCache(); bool useCache();
void setThemeName(const QString &themeName, bool writeSettings); void setThemeName(const QString &themeName, bool writeSettings);
void processWallpaperSettings(KConfigBase *metadata); void processWallpaperSettings(KConfigBase *metadata);
void updateSpacing();
const QString processStyleSheet(const QString &css); const QString processStyleSheet(const QString &css);
const QString svgStyleSheet(); const QString svgStyleSheet();
@ -137,10 +136,6 @@ public:
unsigned cacheSize; unsigned cacheSize;
CacheTypes cachesToDiscard; CacheTypes cachesToDiscard;
int defaultIconSize;
int smallSpacing;
int largeSpacing;
bool locolor : 1; bool locolor : 1;
bool compositingActive : 1; bool compositingActive : 1;
bool blurActive : 1; bool blurActive : 1;

View File

@ -535,11 +535,6 @@ QColor Theme::viewFocusColor() const
return Plasma::Theme::color(Plasma::Theme::ViewFocusColor); return Plasma::Theme::color(Plasma::Theme::ViewFocusColor);
} }
int Theme::defaultIconSize() const
{
return d->defaultIconSize;
}
QSizeF Theme::mSize(const QFont &font) const QSizeF Theme::mSize(const QFont &font) const
{ {
return QFontMetrics(font).boundingRect("M").size(); return QFontMetrics(font).boundingRect("M").size();

View File

@ -81,8 +81,6 @@ class PLASMA_EXPORT Theme : public QObject
Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY themeChanged) Q_PROPERTY(QColor viewHoverColor READ viewHoverColor NOTIFY themeChanged)
Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY themeChanged) Q_PROPERTY(QColor viewFocusColor READ viewFocusColor NOTIFY themeChanged)
Q_PROPERTY(int defaultIconSize READ defaultIconSize NOTIFY defaultIconSizeChanged)
public: public:
enum ColorRole { enum ColorRole {
TextColor = 0, /**< the text color to be used by items resting on the background */ 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 viewHoverColor() const;
QColor viewFocusColor() const; QColor viewFocusColor() const;
int defaultIconSize() const;
Q_INVOKABLE QSizeF mSize(const QFont &font = QApplication::font()) const; Q_INVOKABLE QSizeF mSize(const QFont &font = QApplication::font()) const;
Q_SIGNALS: Q_SIGNALS:
@ -376,8 +372,6 @@ class PLASMA_EXPORT Theme : public QObject
void defaultFontChanged(); void defaultFontChanged();
void smallestFontChanged(); void smallestFontChanged();
void defaultIconSizeChanged();
private: private:
friend class SvgPrivate; friend class SvgPrivate;
friend class ThemePrivate; friend class ThemePrivate;