From 8037e6529c08f65340bb201da91997d262a1b382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 29 Mar 2012 15:46:53 +0200 Subject: [PATCH] Rename ThumbnailItem to WindowThumbnailItem This is for discrimination from the to be added DesktopThumbnailItem. The name for QML is unchanged to keep the public API stable. --- effects.cpp | 8 ++++---- effects.h | 8 ++++---- kcmkwin/kwintabbox/layoutpreview.cpp | 10 +++++----- kcmkwin/kwintabbox/thumbnailitem.cpp | 10 +++++----- kcmkwin/kwintabbox/thumbnailitem.h | 6 +++--- scene.cpp | 4 ++-- scripting/scripting.cpp | 2 +- tabbox/declarative.cpp | 2 +- thumbnailitem.cpp | 12 ++++++------ thumbnailitem.h | 8 ++++---- 10 files changed, 35 insertions(+), 35 deletions(-) diff --git a/effects.cpp b/effects.cpp index 2b48194b4f..7deac29816 100644 --- a/effects.cpp +++ b/effects.cpp @@ -1791,7 +1791,7 @@ EffectWindow* effectWindow(Scene::Window* w) void EffectWindowImpl::registerThumbnail(AbstractThumbnailItem *item) { - if (ThumbnailItem *thumb = qobject_cast(item)) { + if (WindowThumbnailItem *thumb = qobject_cast(item)) { insertThumbnail(thumb); connect(thumb, SIGNAL(destroyed(QObject*)), SLOT(thumbnailDestroyed(QObject*))); connect(thumb, SIGNAL(wIdChanged(qulonglong)), SLOT(thumbnailTargetChanged())); @@ -1801,17 +1801,17 @@ void EffectWindowImpl::registerThumbnail(AbstractThumbnailItem *item) void EffectWindowImpl::thumbnailDestroyed(QObject *object) { // we know it is a ThumbnailItem - m_thumbnails.remove(static_cast(object)); + m_thumbnails.remove(static_cast(object)); } void EffectWindowImpl::thumbnailTargetChanged() { - if (ThumbnailItem *item = qobject_cast(sender())) { + if (WindowThumbnailItem *item = qobject_cast(sender())) { insertThumbnail(item); } } -void EffectWindowImpl::insertThumbnail(ThumbnailItem *item) +void EffectWindowImpl::insertThumbnail(WindowThumbnailItem *item) { EffectWindow *w = effects->findWindow(item->wId()); if (w) { diff --git a/effects.h b/effects.h index 4464775cf8..742aa59fb6 100644 --- a/effects.h +++ b/effects.h @@ -41,7 +41,7 @@ namespace KWin typedef QPair< Effect*, xcb_window_t > InputWindowPair; class AbstractThumbnailItem; -class ThumbnailItem; +class WindowThumbnailItem; class Client; class Compositor; @@ -288,18 +288,18 @@ public: QVariant data(int role) const; void registerThumbnail(AbstractThumbnailItem *item); - QHash > const &thumbnails() const { + QHash > const &thumbnails() const { return m_thumbnails; } private Q_SLOTS: void thumbnailDestroyed(QObject *object); void thumbnailTargetChanged(); private: - void insertThumbnail(ThumbnailItem *item); + void insertThumbnail(WindowThumbnailItem *item); Toplevel* toplevel; Scene::Window* sw; // This one is used only during paint pass. QHash dataMap; - QHash > m_thumbnails; + QHash > m_thumbnails; }; class EffectWindowGroupImpl diff --git a/kcmkwin/kwintabbox/layoutpreview.cpp b/kcmkwin/kwintabbox/layoutpreview.cpp index 4d40b9eb71..9f01f95e01 100644 --- a/kcmkwin/kwintabbox/layoutpreview.cpp +++ b/kcmkwin/kwintabbox/layoutpreview.cpp @@ -60,7 +60,7 @@ LayoutPreview::LayoutPreview(QWidget* parent) kdeclarative.setDeclarativeEngine(engine()); kdeclarative.initialize(); kdeclarative.setupBindings(); - qmlRegisterType("org.kde.kwin", 0, 1, "ThumbnailItem"); + qmlRegisterType("org.kde.kwin", 0, 1, "ThumbnailItem"); rootContext()->setContextProperty("clientModel", model); rootContext()->setContextProperty("sourcePath", QString()); rootContext()->setContextProperty("name", QString()); @@ -157,13 +157,13 @@ QVariant ExampleClientModel::data(const QModelIndex &index, int role) const case Qt::UserRole+4: const QString desktopFile = KDesktopFile(m_nameList.at(index.row())).fileName().split('/').last(); if (desktopFile == "konqbrowser.desktop") { - return ThumbnailItem::Konqueror; + return WindowThumbnailItem::Konqueror; } else if (desktopFile == "KMail2.desktop") { - return ThumbnailItem::KMail; + return WindowThumbnailItem::KMail; } else if (desktopFile == "systemsettings.desktop") { - return ThumbnailItem::Systemsettings; + return WindowThumbnailItem::Systemsettings; } else if (desktopFile == "dolphin.desktop") { - return ThumbnailItem::Dolphin; + return WindowThumbnailItem::Dolphin; } return 0; } diff --git a/kcmkwin/kwintabbox/thumbnailitem.cpp b/kcmkwin/kwintabbox/thumbnailitem.cpp index d65c30ca4e..9dc5426866 100644 --- a/kcmkwin/kwintabbox/thumbnailitem.cpp +++ b/kcmkwin/kwintabbox/thumbnailitem.cpp @@ -29,7 +29,7 @@ along with this program. If not, see . namespace KWin { -ThumbnailItem::ThumbnailItem(QDeclarativeItem* parent) +WindowThumbnailItem::WindowThumbnailItem(QDeclarativeItem* parent) : QDeclarativeItem(parent) , m_wId(0) , m_image() @@ -37,18 +37,18 @@ ThumbnailItem::ThumbnailItem(QDeclarativeItem* parent) setFlags(flags() & ~QGraphicsItem::ItemHasNoContents); } -ThumbnailItem::~ThumbnailItem() +WindowThumbnailItem::~WindowThumbnailItem() { } -void ThumbnailItem::setWId(qulonglong wId) +void WindowThumbnailItem::setWId(qulonglong wId) { m_wId = wId; emit wIdChanged(wId); findImage(); } -void ThumbnailItem::findImage() +void WindowThumbnailItem::findImage() { QString imagePath; switch (m_wId) { @@ -75,7 +75,7 @@ void ThumbnailItem::findImage() } } -void ThumbnailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +void WindowThumbnailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { if (m_image.isNull()) { // no image: default behavior diff --git a/kcmkwin/kwintabbox/thumbnailitem.h b/kcmkwin/kwintabbox/thumbnailitem.h index eeff909074..2eca9baa1e 100644 --- a/kcmkwin/kwintabbox/thumbnailitem.h +++ b/kcmkwin/kwintabbox/thumbnailitem.h @@ -26,13 +26,13 @@ along with this program. If not, see . namespace KWin { -class ThumbnailItem : public QDeclarativeItem +class WindowThumbnailItem : public QDeclarativeItem { Q_OBJECT Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true) public: - explicit ThumbnailItem(QDeclarativeItem *parent = 0); - virtual ~ThumbnailItem(); + explicit WindowThumbnailItem(QDeclarativeItem *parent = 0); + virtual ~WindowThumbnailItem(); qulonglong wId() const { return m_wId; diff --git a/scene.cpp b/scene.cpp index 91e9e8d477..93a3305287 100644 --- a/scene.cpp +++ b/scene.cpp @@ -373,13 +373,13 @@ void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quad effects->paintWindow(effectWindow(w), mask, region, data); // paint thumbnails on top of window EffectWindowImpl *wImpl = static_cast(effectWindow(w)); - for (QHash >::const_iterator it = wImpl->thumbnails().constBegin(); + for (QHash >::const_iterator it = wImpl->thumbnails().constBegin(); it != wImpl->thumbnails().constEnd(); ++it) { if (it.value().isNull()) { continue; } - ThumbnailItem *item = it.key(); + WindowThumbnailItem *item = it.key(); if (!item->isVisible()) { continue; } diff --git a/scripting/scripting.cpp b/scripting/scripting.cpp index 2996288e19..ef7b31be96 100644 --- a/scripting/scripting.cpp +++ b/scripting/scripting.cpp @@ -555,7 +555,7 @@ void KWin::DeclarativeScript::run() kdeclarative.initialize(); kdeclarative.setupBindings(); installScriptFunctions(kdeclarative.scriptEngine()); - qmlRegisterType("org.kde.kwin", 0, 1, "ThumbnailItem"); + qmlRegisterType("org.kde.kwin", 0, 1, "ThumbnailItem"); qmlRegisterType(); qmlRegisterType("org.kde.kwin", 0, 1, "ClientModel"); qmlRegisterType("org.kde.kwin", 0, 1, "ClientModelByScreen"); diff --git a/tabbox/declarative.cpp b/tabbox/declarative.cpp index fb734347f9..859d8a92d7 100644 --- a/tabbox/declarative.cpp +++ b/tabbox/declarative.cpp @@ -156,7 +156,7 @@ DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBox kdeclarative.setDeclarativeEngine(engine()); kdeclarative.initialize(); kdeclarative.setupBindings(); - qmlRegisterType("org.kde.kwin", 0, 1, "ThumbnailItem"); + qmlRegisterType("org.kde.kwin", 0, 1, "ThumbnailItem"); rootContext()->setContextProperty("viewId", static_cast(winId())); rootContext()->setContextProperty("plasmaThemeVariant", plasmaThemeVariant()); if (m_mode == TabBoxConfig::ClientTabBox) { diff --git a/thumbnailitem.cpp b/thumbnailitem.cpp index 4846962835..db30252f80 100644 --- a/thumbnailitem.cpp +++ b/thumbnailitem.cpp @@ -145,7 +145,7 @@ void AbstractThumbnailItem::setSaturation(qreal saturation) } -ThumbnailItem::ThumbnailItem(QDeclarativeItem* parent) +WindowThumbnailItem::WindowThumbnailItem(QDeclarativeItem* parent) : AbstractThumbnailItem(parent) , m_wId(0) , m_client(NULL) @@ -155,11 +155,11 @@ ThumbnailItem::ThumbnailItem(QDeclarativeItem* parent) } } -ThumbnailItem::~ThumbnailItem() +WindowThumbnailItem::~WindowThumbnailItem() { } -void ThumbnailItem::setWId(qulonglong wId) +void WindowThumbnailItem::setWId(qulonglong wId) { if (m_wId == wId) { return; @@ -174,7 +174,7 @@ void ThumbnailItem::setWId(qulonglong wId) emit wIdChanged(wId); } -void ThumbnailItem::setClient(Client *client) +void WindowThumbnailItem::setClient(Client *client) { if (m_client == client) { return; @@ -189,7 +189,7 @@ void ThumbnailItem::setClient(Client *client) } -void ThumbnailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) +void WindowThumbnailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { if (effects) { QDeclarativeItem::paint(painter, option, widget); @@ -206,7 +206,7 @@ void ThumbnailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt pixmap); } -void ThumbnailItem::repaint(KWin::EffectWindow *w) +void WindowThumbnailItem::repaint(KWin::EffectWindow *w) { if (static_cast(w)->window()->window() == m_wId) { update(); diff --git a/thumbnailitem.h b/thumbnailitem.h index f3382cd824..ca05a4238c 100644 --- a/thumbnailitem.h +++ b/thumbnailitem.h @@ -77,14 +77,14 @@ private: qreal m_saturation; }; -class ThumbnailItem : public AbstractThumbnailItem +class WindowThumbnailItem : public AbstractThumbnailItem { Q_OBJECT Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true) Q_PROPERTY(KWin::Client *client READ client WRITE setClient NOTIFY clientChanged) public: - explicit ThumbnailItem(QDeclarativeItem *parent = 0); - virtual ~ThumbnailItem(); + explicit WindowThumbnailItem(QDeclarativeItem *parent = 0); + virtual ~WindowThumbnailItem(); qulonglong wId() const { return m_wId; @@ -116,7 +116,7 @@ qreal AbstractThumbnailItem::saturation() const } inline -Client *ThumbnailItem::client() const +Client *WindowThumbnailItem::client() const { return m_client; }