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:
parent
db91db3a4f
commit
8037e6529c
10 changed files with 35 additions and 35 deletions
|
@ -1791,7 +1791,7 @@ EffectWindow* effectWindow(Scene::Window* w)
|
||||||
|
|
||||||
void EffectWindowImpl::registerThumbnail(AbstractThumbnailItem *item)
|
void EffectWindowImpl::registerThumbnail(AbstractThumbnailItem *item)
|
||||||
{
|
{
|
||||||
if (ThumbnailItem *thumb = qobject_cast<ThumbnailItem*>(item)) {
|
if (WindowThumbnailItem *thumb = qobject_cast<WindowThumbnailItem*>(item)) {
|
||||||
insertThumbnail(thumb);
|
insertThumbnail(thumb);
|
||||||
connect(thumb, SIGNAL(destroyed(QObject*)), SLOT(thumbnailDestroyed(QObject*)));
|
connect(thumb, SIGNAL(destroyed(QObject*)), SLOT(thumbnailDestroyed(QObject*)));
|
||||||
connect(thumb, SIGNAL(wIdChanged(qulonglong)), SLOT(thumbnailTargetChanged()));
|
connect(thumb, SIGNAL(wIdChanged(qulonglong)), SLOT(thumbnailTargetChanged()));
|
||||||
|
@ -1801,17 +1801,17 @@ void EffectWindowImpl::registerThumbnail(AbstractThumbnailItem *item)
|
||||||
void EffectWindowImpl::thumbnailDestroyed(QObject *object)
|
void EffectWindowImpl::thumbnailDestroyed(QObject *object)
|
||||||
{
|
{
|
||||||
// we know it is a ThumbnailItem
|
// we know it is a ThumbnailItem
|
||||||
m_thumbnails.remove(static_cast<ThumbnailItem*>(object));
|
m_thumbnails.remove(static_cast<WindowThumbnailItem*>(object));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectWindowImpl::thumbnailTargetChanged()
|
void EffectWindowImpl::thumbnailTargetChanged()
|
||||||
{
|
{
|
||||||
if (ThumbnailItem *item = qobject_cast<ThumbnailItem*>(sender())) {
|
if (WindowThumbnailItem *item = qobject_cast<WindowThumbnailItem*>(sender())) {
|
||||||
insertThumbnail(item);
|
insertThumbnail(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EffectWindowImpl::insertThumbnail(ThumbnailItem *item)
|
void EffectWindowImpl::insertThumbnail(WindowThumbnailItem *item)
|
||||||
{
|
{
|
||||||
EffectWindow *w = effects->findWindow(item->wId());
|
EffectWindow *w = effects->findWindow(item->wId());
|
||||||
if (w) {
|
if (w) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace KWin
|
||||||
typedef QPair< Effect*, xcb_window_t > InputWindowPair;
|
typedef QPair< Effect*, xcb_window_t > InputWindowPair;
|
||||||
|
|
||||||
class AbstractThumbnailItem;
|
class AbstractThumbnailItem;
|
||||||
class ThumbnailItem;
|
class WindowThumbnailItem;
|
||||||
|
|
||||||
class Client;
|
class Client;
|
||||||
class Compositor;
|
class Compositor;
|
||||||
|
@ -288,18 +288,18 @@ public:
|
||||||
QVariant data(int role) const;
|
QVariant data(int role) const;
|
||||||
|
|
||||||
void registerThumbnail(AbstractThumbnailItem *item);
|
void registerThumbnail(AbstractThumbnailItem *item);
|
||||||
QHash<ThumbnailItem*, QWeakPointer<EffectWindowImpl> > const &thumbnails() const {
|
QHash<WindowThumbnailItem*, QWeakPointer<EffectWindowImpl> > const &thumbnails() const {
|
||||||
return m_thumbnails;
|
return m_thumbnails;
|
||||||
}
|
}
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void thumbnailDestroyed(QObject *object);
|
void thumbnailDestroyed(QObject *object);
|
||||||
void thumbnailTargetChanged();
|
void thumbnailTargetChanged();
|
||||||
private:
|
private:
|
||||||
void insertThumbnail(ThumbnailItem *item);
|
void insertThumbnail(WindowThumbnailItem *item);
|
||||||
Toplevel* toplevel;
|
Toplevel* toplevel;
|
||||||
Scene::Window* sw; // This one is used only during paint pass.
|
Scene::Window* sw; // This one is used only during paint pass.
|
||||||
QHash<int, QVariant> dataMap;
|
QHash<int, QVariant> dataMap;
|
||||||
QHash<ThumbnailItem*, QWeakPointer<EffectWindowImpl> > m_thumbnails;
|
QHash<WindowThumbnailItem*, QWeakPointer<EffectWindowImpl> > m_thumbnails;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EffectWindowGroupImpl
|
class EffectWindowGroupImpl
|
||||||
|
|
|
@ -60,7 +60,7 @@ LayoutPreview::LayoutPreview(QWidget* parent)
|
||||||
kdeclarative.setDeclarativeEngine(engine());
|
kdeclarative.setDeclarativeEngine(engine());
|
||||||
kdeclarative.initialize();
|
kdeclarative.initialize();
|
||||||
kdeclarative.setupBindings();
|
kdeclarative.setupBindings();
|
||||||
qmlRegisterType<ThumbnailItem>("org.kde.kwin", 0, 1, "ThumbnailItem");
|
qmlRegisterType<WindowThumbnailItem>("org.kde.kwin", 0, 1, "ThumbnailItem");
|
||||||
rootContext()->setContextProperty("clientModel", model);
|
rootContext()->setContextProperty("clientModel", model);
|
||||||
rootContext()->setContextProperty("sourcePath", QString());
|
rootContext()->setContextProperty("sourcePath", QString());
|
||||||
rootContext()->setContextProperty("name", QString());
|
rootContext()->setContextProperty("name", QString());
|
||||||
|
@ -157,13 +157,13 @@ QVariant ExampleClientModel::data(const QModelIndex &index, int role) const
|
||||||
case Qt::UserRole+4:
|
case Qt::UserRole+4:
|
||||||
const QString desktopFile = KDesktopFile(m_nameList.at(index.row())).fileName().split('/').last();
|
const QString desktopFile = KDesktopFile(m_nameList.at(index.row())).fileName().split('/').last();
|
||||||
if (desktopFile == "konqbrowser.desktop") {
|
if (desktopFile == "konqbrowser.desktop") {
|
||||||
return ThumbnailItem::Konqueror;
|
return WindowThumbnailItem::Konqueror;
|
||||||
} else if (desktopFile == "KMail2.desktop") {
|
} else if (desktopFile == "KMail2.desktop") {
|
||||||
return ThumbnailItem::KMail;
|
return WindowThumbnailItem::KMail;
|
||||||
} else if (desktopFile == "systemsettings.desktop") {
|
} else if (desktopFile == "systemsettings.desktop") {
|
||||||
return ThumbnailItem::Systemsettings;
|
return WindowThumbnailItem::Systemsettings;
|
||||||
} else if (desktopFile == "dolphin.desktop") {
|
} else if (desktopFile == "dolphin.desktop") {
|
||||||
return ThumbnailItem::Dolphin;
|
return WindowThumbnailItem::Dolphin;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
ThumbnailItem::ThumbnailItem(QDeclarativeItem* parent)
|
WindowThumbnailItem::WindowThumbnailItem(QDeclarativeItem* parent)
|
||||||
: QDeclarativeItem(parent)
|
: QDeclarativeItem(parent)
|
||||||
, m_wId(0)
|
, m_wId(0)
|
||||||
, m_image()
|
, m_image()
|
||||||
|
@ -37,18 +37,18 @@ ThumbnailItem::ThumbnailItem(QDeclarativeItem* parent)
|
||||||
setFlags(flags() & ~QGraphicsItem::ItemHasNoContents);
|
setFlags(flags() & ~QGraphicsItem::ItemHasNoContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
ThumbnailItem::~ThumbnailItem()
|
WindowThumbnailItem::~WindowThumbnailItem()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThumbnailItem::setWId(qulonglong wId)
|
void WindowThumbnailItem::setWId(qulonglong wId)
|
||||||
{
|
{
|
||||||
m_wId = wId;
|
m_wId = wId;
|
||||||
emit wIdChanged(wId);
|
emit wIdChanged(wId);
|
||||||
findImage();
|
findImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThumbnailItem::findImage()
|
void WindowThumbnailItem::findImage()
|
||||||
{
|
{
|
||||||
QString imagePath;
|
QString imagePath;
|
||||||
switch (m_wId) {
|
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()) {
|
if (m_image.isNull()) {
|
||||||
// no image: default behavior
|
// no image: default behavior
|
||||||
|
|
|
@ -26,13 +26,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
class ThumbnailItem : public QDeclarativeItem
|
class WindowThumbnailItem : public QDeclarativeItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true)
|
Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true)
|
||||||
public:
|
public:
|
||||||
explicit ThumbnailItem(QDeclarativeItem *parent = 0);
|
explicit WindowThumbnailItem(QDeclarativeItem *parent = 0);
|
||||||
virtual ~ThumbnailItem();
|
virtual ~WindowThumbnailItem();
|
||||||
|
|
||||||
qulonglong wId() const {
|
qulonglong wId() const {
|
||||||
return m_wId;
|
return m_wId;
|
||||||
|
|
|
@ -373,13 +373,13 @@ void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quad
|
||||||
effects->paintWindow(effectWindow(w), mask, region, data);
|
effects->paintWindow(effectWindow(w), mask, region, data);
|
||||||
// paint thumbnails on top of window
|
// paint thumbnails on top of window
|
||||||
EffectWindowImpl *wImpl = static_cast<EffectWindowImpl*>(effectWindow(w));
|
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 != wImpl->thumbnails().constEnd();
|
||||||
++it) {
|
++it) {
|
||||||
if (it.value().isNull()) {
|
if (it.value().isNull()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ThumbnailItem *item = it.key();
|
WindowThumbnailItem *item = it.key();
|
||||||
if (!item->isVisible()) {
|
if (!item->isVisible()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -555,7 +555,7 @@ void KWin::DeclarativeScript::run()
|
||||||
kdeclarative.initialize();
|
kdeclarative.initialize();
|
||||||
kdeclarative.setupBindings();
|
kdeclarative.setupBindings();
|
||||||
installScriptFunctions(kdeclarative.scriptEngine());
|
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::ClientModel>();
|
||||||
qmlRegisterType<KWin::ScriptingClientModel::SimpleClientModel>("org.kde.kwin", 0, 1, "ClientModel");
|
qmlRegisterType<KWin::ScriptingClientModel::SimpleClientModel>("org.kde.kwin", 0, 1, "ClientModel");
|
||||||
qmlRegisterType<KWin::ScriptingClientModel::ClientModelByScreen>("org.kde.kwin", 0, 1, "ClientModelByScreen");
|
qmlRegisterType<KWin::ScriptingClientModel::ClientModelByScreen>("org.kde.kwin", 0, 1, "ClientModelByScreen");
|
||||||
|
|
|
@ -156,7 +156,7 @@ DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBox
|
||||||
kdeclarative.setDeclarativeEngine(engine());
|
kdeclarative.setDeclarativeEngine(engine());
|
||||||
kdeclarative.initialize();
|
kdeclarative.initialize();
|
||||||
kdeclarative.setupBindings();
|
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("viewId", static_cast<qulonglong>(winId()));
|
||||||
rootContext()->setContextProperty("plasmaThemeVariant", plasmaThemeVariant());
|
rootContext()->setContextProperty("plasmaThemeVariant", plasmaThemeVariant());
|
||||||
if (m_mode == TabBoxConfig::ClientTabBox) {
|
if (m_mode == TabBoxConfig::ClientTabBox) {
|
||||||
|
|
|
@ -145,7 +145,7 @@ void AbstractThumbnailItem::setSaturation(qreal saturation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ThumbnailItem::ThumbnailItem(QDeclarativeItem* parent)
|
WindowThumbnailItem::WindowThumbnailItem(QDeclarativeItem* parent)
|
||||||
: AbstractThumbnailItem(parent)
|
: AbstractThumbnailItem(parent)
|
||||||
, m_wId(0)
|
, m_wId(0)
|
||||||
, m_client(NULL)
|
, 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) {
|
if (m_wId == wId) {
|
||||||
return;
|
return;
|
||||||
|
@ -174,7 +174,7 @@ void ThumbnailItem::setWId(qulonglong wId)
|
||||||
emit wIdChanged(wId);
|
emit wIdChanged(wId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThumbnailItem::setClient(Client *client)
|
void WindowThumbnailItem::setClient(Client *client)
|
||||||
{
|
{
|
||||||
if (m_client == client) {
|
if (m_client == client) {
|
||||||
return;
|
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) {
|
if (effects) {
|
||||||
QDeclarativeItem::paint(painter, option, widget);
|
QDeclarativeItem::paint(painter, option, widget);
|
||||||
|
@ -206,7 +206,7 @@ void ThumbnailItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opt
|
||||||
pixmap);
|
pixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThumbnailItem::repaint(KWin::EffectWindow *w)
|
void WindowThumbnailItem::repaint(KWin::EffectWindow *w)
|
||||||
{
|
{
|
||||||
if (static_cast<KWin::EffectWindowImpl*>(w)->window()->window() == m_wId) {
|
if (static_cast<KWin::EffectWindowImpl*>(w)->window()->window() == m_wId) {
|
||||||
update();
|
update();
|
||||||
|
|
|
@ -77,14 +77,14 @@ private:
|
||||||
qreal m_saturation;
|
qreal m_saturation;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ThumbnailItem : public AbstractThumbnailItem
|
class WindowThumbnailItem : public AbstractThumbnailItem
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true)
|
Q_PROPERTY(qulonglong wId READ wId WRITE setWId NOTIFY wIdChanged SCRIPTABLE true)
|
||||||
Q_PROPERTY(KWin::Client *client READ client WRITE setClient NOTIFY clientChanged)
|
Q_PROPERTY(KWin::Client *client READ client WRITE setClient NOTIFY clientChanged)
|
||||||
public:
|
public:
|
||||||
explicit ThumbnailItem(QDeclarativeItem *parent = 0);
|
explicit WindowThumbnailItem(QDeclarativeItem *parent = 0);
|
||||||
virtual ~ThumbnailItem();
|
virtual ~WindowThumbnailItem();
|
||||||
|
|
||||||
qulonglong wId() const {
|
qulonglong wId() const {
|
||||||
return m_wId;
|
return m_wId;
|
||||||
|
@ -116,7 +116,7 @@ qreal AbstractThumbnailItem::saturation() const
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
inline
|
||||||
Client *ThumbnailItem::client() const
|
Client *WindowThumbnailItem::client() const
|
||||||
{
|
{
|
||||||
return m_client;
|
return m_client;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue