Delete ThemeProxy

This commit is contained in:
Sebastian Kügler 2014-01-22 01:34:56 +01:00
parent e81db11f05
commit 847a61b3d8
2 changed files with 0 additions and 146 deletions

View File

@ -1,71 +0,0 @@
/***************************************************************************
* Copyright 2010 Marco Martin <mart@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#include "theme.h"
#include <QQmlPropertyMap>
#include <QFontMetrics>
#include <kiconloader.h>
#include <QApplication>
#include <QScreen>
#include <QQuickWindow>
#include <QDebug>
//********** Theme *************
ThemeProxy::ThemeProxy(QQmlEngine *parent)
: Plasma::Theme(parent),
m_engine(parent)
{
m_iconSizes = new QQmlPropertyMap(this);
m_iconSizes->insert("desktop", QVariant(KIconLoader::global()->currentSize(KIconLoader::Desktop)));
m_iconSizes->insert("panel", QVariant(KIconLoader::global()->currentSize(KIconLoader::Panel)));
m_iconSizes->insert("toolbar", KIconLoader::global()->currentSize(KIconLoader::Toolbar));
m_iconSizes->insert("small", KIconLoader::global()->currentSize(KIconLoader::Small));
m_iconSizes->insert("dialog", KIconLoader::global()->currentSize(KIconLoader::Dialog));
connect(this, &Plasma::Theme::themeChanged, this, &ThemeProxy::themeChanged);
connect(KIconLoader::global(), SIGNAL(iconLoaderSettingsChanged()), this, SLOT(iconLoaderSettingsChanged()));
}
ThemeProxy::~ThemeProxy()
{
}
void ThemeProxy::iconLoaderSettingsChanged()
{
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));
m_iconSizes->insert("dialog", KIconLoader::global()->currentSize(KIconLoader::Dialog));
emit defaultIconSizeChanged();
emit iconSizesChanged();
}
QQmlPropertyMap *ThemeProxy::iconSizes() const
{
return m_iconSizes;
}
#include "moc_theme.cpp"

View File

@ -1,75 +0,0 @@
/***************************************************************************
* Copyright 2010 Marco Martin <mart@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
#ifndef THEME_PROXY_P
#define THEME_PROXY_P
#include <QApplication>
#include <QObject>
#include <QFont>
#include <QColor>
#include <QJSValue>
#include <QQmlEngine>
#include <QQuickItem>
#include <Plasma/Theme>
class QQmlPropertyMap;
/**
* QML wrapper for kdelibs Plasma::Theme
*
* Exposed as `Theme` in QML.
*/
class ThemeProxy : public Plasma::Theme
{
Q_OBJECT
/**
* icon sizes depending from the context: use those if possible
* Access with theme.iconSizes.desktop theme.iconSizes.small etc.
* available keys are:
* * desktop
* * toolbar
* * small
* * dialog
*/
Q_PROPERTY(QQmlPropertyMap *iconSizes READ iconSizes NOTIFY iconSizesChanged)
public:
ThemeProxy(QQmlEngine *parent = 0);
~ThemeProxy();
QQmlPropertyMap *iconSizes() const;
Q_INVOKABLE int dpi(QQuickItem *item);
private Q_SLOTS:
void iconLoaderSettingsChanged();
Q_SIGNALS:
void themeChanged();
void iconSizesChanged();
private:
QQmlPropertyMap *m_iconSizes;
QQmlEngine *m_engine;
};
#endif