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.
This commit is contained in:
Martin Gräßlin 2012-03-29 15:46:53 +02:00
parent db91db3a4f
commit 8037e6529c
10 changed files with 35 additions and 35 deletions

View file

@ -1791,7 +1791,7 @@ EffectWindow* effectWindow(Scene::Window* w)
void EffectWindowImpl::registerThumbnail(AbstractThumbnailItem *item)
{
if (ThumbnailItem *thumb = qobject_cast<ThumbnailItem*>(item)) {
if (WindowThumbnailItem *thumb = qobject_cast<WindowThumbnailItem*>(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<ThumbnailItem*>(object));
m_thumbnails.remove(static_cast<WindowThumbnailItem*>(object));
}
void EffectWindowImpl::thumbnailTargetChanged()
{
if (ThumbnailItem *item = qobject_cast<ThumbnailItem*>(sender())) {
if (WindowThumbnailItem *item = qobject_cast<WindowThumbnailItem*>(sender())) {
insertThumbnail(item);
}
}
void EffectWindowImpl::insertThumbnail(ThumbnailItem *item)
void EffectWindowImpl::insertThumbnail(WindowThumbnailItem *item)
{
EffectWindow *w = effects->findWindow(item->wId());
if (w) {

View file

@ -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<ThumbnailItem*, QWeakPointer<EffectWindowImpl> > const &thumbnails() const {
QHash<WindowThumbnailItem*, QWeakPointer<EffectWindowImpl> > 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<int, QVariant> dataMap;
QHash<ThumbnailItem*, QWeakPointer<EffectWindowImpl> > m_thumbnails;
QHash<WindowThumbnailItem*, QWeakPointer<EffectWindowImpl> > m_thumbnails;
};
class EffectWindowGroupImpl

View file

@ -60,7 +60,7 @@ LayoutPreview::LayoutPreview(QWidget* parent)
kdeclarative.setDeclarativeEngine(engine());
kdeclarative.initialize();
kdeclarative.setupBindings();
qmlRegisterType<ThumbnailItem>("org.kde.kwin", 0, 1, "ThumbnailItem");
qmlRegisterType<WindowThumbnailItem>("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;
}

View file

@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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

View file

@ -26,13 +26,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
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;

View file

@ -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<EffectWindowImpl*>(effectWindow(w));
for (QHash<ThumbnailItem*, QWeakPointer<EffectWindowImpl> >::const_iterator it = wImpl->thumbnails().constBegin();
for (QHash<WindowThumbnailItem*, QWeakPointer<EffectWindowImpl> >::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;
}

View file

@ -555,7 +555,7 @@ void KWin::DeclarativeScript::run()
kdeclarative.initialize();
kdeclarative.setupBindings();
installScriptFunctions(kdeclarative.scriptEngine());
qmlRegisterType<ThumbnailItem>("org.kde.kwin", 0, 1, "ThumbnailItem");
qmlRegisterType<WindowThumbnailItem>("org.kde.kwin", 0, 1, "ThumbnailItem");
qmlRegisterType<KWin::ScriptingClientModel::ClientModel>();
qmlRegisterType<KWin::ScriptingClientModel::SimpleClientModel>("org.kde.kwin", 0, 1, "ClientModel");
qmlRegisterType<KWin::ScriptingClientModel::ClientModelByScreen>("org.kde.kwin", 0, 1, "ClientModelByScreen");

View file

@ -156,7 +156,7 @@ DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBox
kdeclarative.setDeclarativeEngine(engine());
kdeclarative.initialize();
kdeclarative.setupBindings();
qmlRegisterType<ThumbnailItem>("org.kde.kwin", 0, 1, "ThumbnailItem");
qmlRegisterType<WindowThumbnailItem>("org.kde.kwin", 0, 1, "ThumbnailItem");
rootContext()->setContextProperty("viewId", static_cast<qulonglong>(winId()));
rootContext()->setContextProperty("plasmaThemeVariant", plasmaThemeVariant());
if (m_mode == TabBoxConfig::ClientTabBox) {

View file

@ -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<KWin::EffectWindowImpl*>(w)->window()->window() == m_wId) {
update();

View file

@ -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;
}