mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
refactor: using new dbus interface for dock entry
Change-Id: I670870c30427e18518cc39d878e4e93b21a3ed28
This commit is contained in:
parent
9ab72dfdba
commit
c0986e1c37
Notes:
Deepin Code Review
2018-02-22 14:18:31 +08:00
Verified+1: Anonymous Coward #1000004 Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Thu, 22 Feb 2018 14:18:12 +0800 Reviewed-on: https://cr.deepin.io/31797 Project: dde/dde-dock Branch: refs/heads/master
@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#include "dockitemcontroller.h"
|
||||
#include "dbus/dbusdockentry.h"
|
||||
#include "item/appitem.h"
|
||||
#include "item/stretchitem.h"
|
||||
#include "item/launcheritem.h"
|
||||
|
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusDockEntry -p dbusdockentry dde-dock-entry-v1.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* This file may have been hand-edited. Look for HAND-EDIT comments
|
||||
* before re-generating it.
|
||||
*/
|
||||
|
||||
#include "dbusdockentry.h"
|
||||
|
||||
/*
|
||||
* Implementation of interface class DBusDockEntry
|
||||
*/
|
||||
|
||||
DBusDockEntry::DBusDockEntry(const QString &path, QObject *parent)
|
||||
: QDBusAbstractInterface("com.deepin.dde.daemon.Dock", path, staticInterfaceName(), QDBusConnection::sessionBus(), parent)
|
||||
{
|
||||
qRegisterMetaType<WindowDict>("WindowDict");
|
||||
qDBusRegisterMetaType<WindowDict>();
|
||||
|
||||
QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged","sa{sv}as", this, SLOT(__propertyChanged__(QDBusMessage)));
|
||||
}
|
||||
|
||||
DBusDockEntry::~DBusDockEntry()
|
||||
{
|
||||
QDBusConnection::sessionBus().disconnect(service(), path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(propertyChanged(QDBusMessage)));
|
||||
}
|
||||
|
@ -1,157 +0,0 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusDockEntry -p dbusdockentry dde-dock-entry-v1.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* Do not edit! All changes made to it will be lost.
|
||||
*/
|
||||
|
||||
#ifndef DBUSDOCKENTRY_H_1464922075
|
||||
#define DBUSDOCKENTRY_H_1464922075
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
#include <QX11Info>
|
||||
|
||||
typedef QMap<quint32, QString> WindowDict;
|
||||
|
||||
/*
|
||||
* Proxy class for interface dde.dock.Entry
|
||||
*/
|
||||
class DBusDockEntry: public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_SLOT void __propertyChanged__(const QDBusMessage& msg)
|
||||
{
|
||||
QList<QVariant> arguments = msg.arguments();
|
||||
if (3 != arguments.count())
|
||||
return;
|
||||
QString interfaceName = msg.arguments().at(0).toString();
|
||||
if (interfaceName !="com.deepin.dde.daemon.Dock.Entry")
|
||||
return;
|
||||
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
|
||||
foreach(const QString &prop, changedProps.keys()) {
|
||||
const QMetaObject* self = metaObject();
|
||||
for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
|
||||
QMetaProperty p = self->property(i);
|
||||
if (p.name() == prop) {
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public:
|
||||
static inline const char *staticInterfaceName()
|
||||
{ return "com.deepin.dde.daemon.Dock.Entry"; }
|
||||
|
||||
public:
|
||||
explicit DBusDockEntry(const QString &path, QObject *parent = 0);
|
||||
|
||||
~DBusDockEntry();
|
||||
|
||||
Q_PROPERTY(bool IsActive READ active NOTIFY ActiveChanged)
|
||||
inline bool active() const
|
||||
{ return qvariant_cast< bool >(property("IsActive")); }
|
||||
|
||||
Q_PROPERTY(WindowDict WindowTitles READ titles NOTIFY TitlesChanged)
|
||||
inline WindowDict titles() const
|
||||
{ return qvariant_cast< WindowDict >(property("WindowTitles")); }
|
||||
|
||||
Q_PROPERTY(QString Id READ id NOTIFY IdChanged)
|
||||
inline QString id() const
|
||||
{ return qvariant_cast< QString >(property("Id")); }
|
||||
|
||||
Q_PROPERTY(QString Icon READ icon NOTIFY IconChanged)
|
||||
inline QString icon() const
|
||||
{ return qvariant_cast< QString >(property("Icon")); }
|
||||
|
||||
Q_PROPERTY(QString Menu READ menu NOTIFY MenuChanged)
|
||||
inline QString menu() const
|
||||
{ return qvariant_cast< QString >(property("Menu")); }
|
||||
|
||||
Q_PROPERTY(QString Name READ name NOTIFY NameChanged)
|
||||
inline QString name() const
|
||||
{ return qvariant_cast< QString >(property("Name")); }
|
||||
|
||||
Q_PROPERTY(quint32 CurrentWindow READ currentWindow NOTIFY CurrentWindowChanged)
|
||||
inline quint32 currentWindow() const
|
||||
{ return qvariant_cast< quint32 >(property("CurrentWindow")); }
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<> Activate()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
|
||||
argumentList << QVariant::fromValue(quint32(QX11Info::getTimestamp()));
|
||||
|
||||
return asyncCallWithArgumentList(QStringLiteral("Activate"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> NewInstance()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
|
||||
argumentList << QVariant::fromValue(quint32(QX11Info::getTimestamp()));
|
||||
|
||||
return asyncCallWithArgumentList(QStringLiteral("NewInstance"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> HandleMenuItem(const QString &item)
|
||||
{
|
||||
return asyncCall(QStringLiteral("HandleMenuItem"), QVariant::fromValue(quint32(QX11Info::getTimestamp())), item);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> HandleDragDrop(const QStringList &uriList)
|
||||
{
|
||||
return asyncCall(QStringLiteral("HandleDragDrop"), QVariant::fromValue(quint32(QX11Info::getTimestamp())), QVariant::fromValue(uriList));
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> RequestDock()
|
||||
{
|
||||
return asyncCall(QStringLiteral("RequestDock"));
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> Check()
|
||||
{
|
||||
return asyncCall(QStringLiteral("Check"));
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> RequestUndock()
|
||||
{
|
||||
return asyncCall(QStringLiteral("RequestUndock"));
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> PresentWindows()
|
||||
{
|
||||
return asyncCall(QStringLiteral("PresentWindows"));
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
// begin property changed signals
|
||||
void ActiveChanged();
|
||||
void TitlesChanged();
|
||||
void DataChanged();
|
||||
void IdChanged();
|
||||
void TitleChanged();
|
||||
void IconChanged();
|
||||
void MenuChanged();
|
||||
void NameChanged();
|
||||
void CurrentWindowChanged();
|
||||
};
|
||||
|
||||
namespace dde {
|
||||
namespace dock {
|
||||
typedef ::DBusDockEntry Entry;
|
||||
}
|
||||
}
|
||||
#endif
|
@ -8,7 +8,7 @@ DESTDIR = $$_PRO_FILE_PWD_/../
|
||||
TEMPLATE = app
|
||||
CONFIG += c++11 link_pkgconfig
|
||||
|
||||
PKGCONFIG += xcb-ewmh dtkwidget x11
|
||||
PKGCONFIG += xcb-ewmh dtkwidget x11 dframeworkdbus
|
||||
LIBS += -lgomp
|
||||
|
||||
SOURCES += main.cpp \
|
||||
@ -17,7 +17,6 @@ SOURCES += main.cpp \
|
||||
item/dockitem.cpp \
|
||||
panel/mainpanel.cpp \
|
||||
controller/dockitemcontroller.cpp \
|
||||
dbus/dbusdockentry.cpp \
|
||||
dbus/dbusdisplay.cpp \
|
||||
item/appitem.cpp \
|
||||
util/docksettings.cpp \
|
||||
@ -48,7 +47,6 @@ HEADERS += \
|
||||
item/dockitem.h \
|
||||
panel/mainpanel.h \
|
||||
controller/dockitemcontroller.h \
|
||||
dbus/dbusdockentry.h \
|
||||
dbus/dbusdisplay.h \
|
||||
item/appitem.h \
|
||||
util/docksettings.h \
|
||||
|
@ -36,10 +36,70 @@
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsItemAnimation>
|
||||
#include <QTimeLine>
|
||||
#include <QX11Info>
|
||||
|
||||
#define APP_DRAG_THRESHOLD 20
|
||||
|
||||
const static qreal Frames[] = { 0, 0.327013, 0.987033, 1.77584, 2.61157, 3.45043, 4.26461, 5.03411, 5.74306, 6.37782, 6.92583, 7.37484, 7.71245, 7.92557, 8, 7.86164, 7.43184, 6.69344, 5.64142, 4.2916, 2.68986, 0.91694, -0.91694, -2.68986, -4.2916, -5.64142, -6.69344, -7.43184, -7.86164, -8, -7.86164, -7.43184, -6.69344, -5.64142, -4.2916, -2.68986, -0.91694, 0.91694, 2.68986, 4.2916, 5.64142, 6.69344, 7.43184, 7.86164, 8, 7.93082, 7.71592, 7.34672, 6.82071, 6.1458, 5.34493, 4.45847, 3.54153, 2.65507, 1.8542, 1.17929, 0.653279, 0.28408, 0.0691776, 0 };
|
||||
const static qreal Frames[] = { 0,
|
||||
0.327013,
|
||||
0.987033,
|
||||
1.77584,
|
||||
2.61157,
|
||||
3.45043,
|
||||
4.26461,
|
||||
5.03411,
|
||||
5.74306,
|
||||
6.37782,
|
||||
6.92583,
|
||||
7.37484,
|
||||
7.71245,
|
||||
7.92557,
|
||||
8, 7.86164,
|
||||
7.43184,
|
||||
6.69344,
|
||||
5.64142,
|
||||
4.2916,
|
||||
2.68986,
|
||||
0.91694,
|
||||
-0.91694,
|
||||
-2.68986,
|
||||
-4.2916,
|
||||
-5.64142,
|
||||
-6.69344,
|
||||
-7.43184,
|
||||
-7.86164,
|
||||
-8,
|
||||
-7.86164,
|
||||
-7.43184,
|
||||
-6.69344,
|
||||
-5.64142,
|
||||
-4.2916,
|
||||
-2.68986,
|
||||
-0.91694,
|
||||
0.91694,
|
||||
2.68986,
|
||||
4.2916,
|
||||
5.64142,
|
||||
6.69344,
|
||||
7.43184,
|
||||
7.86164,
|
||||
8,
|
||||
7.93082,
|
||||
7.71592,
|
||||
7.34672,
|
||||
6.82071,
|
||||
6.1458,
|
||||
5.34493,
|
||||
4.45847,
|
||||
3.54153,
|
||||
2.65507,
|
||||
1.8542,
|
||||
1.17929,
|
||||
0.653279,
|
||||
0.28408,
|
||||
0.0691776,
|
||||
0,
|
||||
};
|
||||
|
||||
int AppItem::IconBaseSize;
|
||||
QPoint AppItem::MousePressPos;
|
||||
@ -48,7 +108,7 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
||||
: DockItem(parent),
|
||||
m_appNameTips(new QLabel(this)),
|
||||
m_appPreviewTips(new PreviewContainer(this)),
|
||||
m_itemEntry(new DBusDockEntry(entry.path(), this)),
|
||||
m_itemEntryInter(new DockEntryInter("com.deepin.dde.daemon.Dock", entry.path(), QDBusConnection::sessionBus(), this)),
|
||||
|
||||
m_itemView(new QGraphicsView(this)),
|
||||
m_itemScene(new QGraphicsScene(this)),
|
||||
@ -71,9 +131,8 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
||||
centralLayout->setMargin(0);
|
||||
centralLayout->setSpacing(0);
|
||||
|
||||
setAccessibleName(m_itemEntry->name());
|
||||
setAccessibleName(m_itemEntryInter->name());
|
||||
setAcceptDrops(true);
|
||||
// setMouseTracking(true);
|
||||
setLayout(centralLayout);
|
||||
|
||||
m_itemView->setScene(m_itemScene);
|
||||
@ -86,11 +145,11 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
||||
m_itemView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
m_itemView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
m_id = m_itemEntry->id();
|
||||
m_active = m_itemEntry->active();
|
||||
m_id = m_itemEntryInter->id();
|
||||
m_active = m_itemEntryInter->isActive();
|
||||
|
||||
m_appNameTips->setObjectName(m_itemEntry->name());
|
||||
m_appNameTips->setAccessibleName(m_itemEntry->name() + "-tips");
|
||||
m_appNameTips->setObjectName(m_itemEntryInter->name());
|
||||
m_appNameTips->setAccessibleName(m_itemEntryInter->name() + "-tips");
|
||||
m_appNameTips->setVisible(false);
|
||||
m_appNameTips->setStyleSheet("color:white;"
|
||||
"padding:0px 3px;");
|
||||
@ -100,19 +159,19 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
||||
|
||||
m_appPreviewTips->setVisible(false);
|
||||
|
||||
connect(m_itemEntry, &DBusDockEntry::ActiveChanged, this, &AppItem::activeChanged);
|
||||
connect(m_itemEntry, &DBusDockEntry::TitlesChanged, this, &AppItem::updateTitle, Qt::QueuedConnection);
|
||||
connect(m_itemEntry, &DBusDockEntry::IconChanged, this, &AppItem::refershIcon);
|
||||
connect(m_itemEntry, &DBusDockEntry::ActiveChanged, this, static_cast<void (AppItem::*)()>(&AppItem::update));
|
||||
connect(m_itemEntryInter, &DockEntryInter::IsActiveChanged, this, &AppItem::activeChanged);
|
||||
connect(m_itemEntryInter, &DockEntryInter::IsActiveChanged, this, static_cast<void (AppItem::*)()>(&AppItem::update));
|
||||
connect(m_itemEntryInter, &DockEntryInter::WindowInfosChanged, this, &AppItem::updateWindowInfos, Qt::QueuedConnection);
|
||||
connect(m_itemEntryInter, &DockEntryInter::IconChanged, this, &AppItem::refershIcon);
|
||||
|
||||
connect(m_updateIconGeometryTimer, &QTimer::timeout, this, &AppItem::updateWindowIconGeometries, Qt::QueuedConnection);
|
||||
|
||||
connect(m_appPreviewTips, &PreviewContainer::requestActivateWindow, this, &AppItem::requestActivateWindow, Qt::QueuedConnection);
|
||||
connect(m_appPreviewTips, &PreviewContainer::requestPreviewWindow, this, &AppItem::requestPreviewWindow, Qt::QueuedConnection);
|
||||
connect(m_appPreviewTips, &PreviewContainer::requestCancelAndHidePreview, this, &AppItem::cancelAndHidePreview);
|
||||
connect(m_appPreviewTips, &PreviewContainer::requestCheckWindows, m_itemEntry, &DBusDockEntry::Check);
|
||||
connect(m_appPreviewTips, &PreviewContainer::requestCheckWindows, m_itemEntryInter, &DockEntryInter::Check);
|
||||
|
||||
updateTitle();
|
||||
updateWindowInfos();
|
||||
refershIcon();
|
||||
}
|
||||
|
||||
@ -136,7 +195,7 @@ void AppItem::updateWindowIconGeometries()
|
||||
mapToGlobal(QPoint(width(),height())));
|
||||
auto *xcb_misc = XcbMisc::instance();
|
||||
|
||||
for (auto it(m_titles.cbegin()); it != m_titles.cend(); ++it)
|
||||
for (auto it(m_windowInfos.cbegin()); it != m_windowInfos.cend(); ++it)
|
||||
xcb_misc->set_window_icon_geometry(it.key(), r);
|
||||
}
|
||||
|
||||
@ -223,14 +282,14 @@ void AppItem::paintEvent(QPaintEvent *e)
|
||||
|
||||
painter.fillRect(activeRect, QColor(44, 167, 248, 255));
|
||||
}
|
||||
else if (!m_titles.isEmpty())
|
||||
else if (!m_windowInfos.isEmpty())
|
||||
painter.fillRect(backgroundRect, QColor(255, 255, 255, 255 * 0.2));
|
||||
// else
|
||||
// painter.fillRect(backgroundRect, Qt::gray);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_titles.isEmpty())
|
||||
if (!m_windowInfos.isEmpty())
|
||||
{
|
||||
QPoint p;
|
||||
QPixmap pixmap;
|
||||
@ -286,12 +345,12 @@ void AppItem::paintEvent(QPaintEvent *e)
|
||||
void AppItem::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
if (e->button() == Qt::MiddleButton) {
|
||||
m_itemEntry->NewInstance();
|
||||
m_itemEntryInter->NewInstance(QX11Info::getTimestamp());
|
||||
} else if (e->button() == Qt::LeftButton) {
|
||||
|
||||
m_itemEntry->Activate();
|
||||
m_itemEntryInter->Activate(QX11Info::getTimestamp());
|
||||
|
||||
if (!m_titles.isEmpty())
|
||||
if (!m_windowInfos.isEmpty())
|
||||
return;
|
||||
|
||||
// start launching effects
|
||||
@ -383,7 +442,7 @@ void AppItem::wheelEvent(QWheelEvent *e)
|
||||
{
|
||||
QWidget::wheelEvent(e);
|
||||
|
||||
m_itemEntry->PresentWindows();
|
||||
m_itemEntryInter->PresentWindows();
|
||||
}
|
||||
|
||||
void AppItem::resizeEvent(QResizeEvent *e)
|
||||
@ -410,7 +469,7 @@ void AppItem::dragMoveEvent(QDragMoveEvent *e)
|
||||
{
|
||||
DockItem::dragMoveEvent(e);
|
||||
|
||||
if (m_titles.isEmpty())
|
||||
if (m_windowInfos.isEmpty())
|
||||
return;
|
||||
|
||||
if (!PopupWindow->isVisible() || PopupWindow->getContent() != m_appPreviewTips)
|
||||
@ -425,7 +484,7 @@ void AppItem::dropEvent(QDropEvent *e)
|
||||
}
|
||||
|
||||
qDebug() << "accept drop event with URIs: " << uriList;
|
||||
m_itemEntry->HandleDragDrop(uriList);
|
||||
m_itemEntryInter->HandleDragDrop(QX11Info::getTimestamp(), uriList);
|
||||
}
|
||||
|
||||
void AppItem::leaveEvent(QEvent *e)
|
||||
@ -438,7 +497,7 @@ void AppItem::leaveEvent(QEvent *e)
|
||||
|
||||
void AppItem::showHoverTips()
|
||||
{
|
||||
if (!m_titles.isEmpty())
|
||||
if (!m_windowInfos.isEmpty())
|
||||
return showPreview();
|
||||
|
||||
DockItem::showHoverTips();
|
||||
@ -448,12 +507,12 @@ void AppItem::invokedMenuItem(const QString &itemId, const bool checked)
|
||||
{
|
||||
Q_UNUSED(checked);
|
||||
|
||||
m_itemEntry->HandleMenuItem(itemId);
|
||||
m_itemEntryInter->HandleMenuItem(QX11Info::getTimestamp(), itemId);
|
||||
}
|
||||
|
||||
const QString AppItem::contextMenu() const
|
||||
{
|
||||
return m_itemEntry->menu();
|
||||
return m_itemEntryInter->menu();
|
||||
}
|
||||
|
||||
QWidget *AppItem::popupTips()
|
||||
@ -461,13 +520,13 @@ QWidget *AppItem::popupTips()
|
||||
if (m_draging)
|
||||
return nullptr;
|
||||
|
||||
if (!m_titles.isEmpty())
|
||||
if (!m_windowInfos.isEmpty())
|
||||
{
|
||||
const quint32 currentWindow = m_itemEntry->currentWindow();
|
||||
Q_ASSERT(m_titles.contains(currentWindow));
|
||||
m_appNameTips->setText(m_titles[currentWindow]);
|
||||
const quint32 currentWindow = m_itemEntryInter->currentWindow();
|
||||
Q_ASSERT(m_windowInfos.contains(currentWindow));
|
||||
m_appNameTips->setText(m_windowInfos[currentWindow].m_windowTitle);
|
||||
} else {
|
||||
m_appNameTips->setText(m_itemEntry->name());
|
||||
m_appNameTips->setText(m_itemEntryInter->name());
|
||||
}
|
||||
|
||||
return m_appNameTips;
|
||||
@ -491,17 +550,17 @@ void AppItem::startDrag()
|
||||
|
||||
// drag out of dock panel
|
||||
if (!drag->target())
|
||||
m_itemEntry->RequestUndock();
|
||||
m_itemEntryInter->RequestUndock();
|
||||
|
||||
m_draging = false;
|
||||
setVisible(true);
|
||||
update();
|
||||
}
|
||||
|
||||
void AppItem::updateTitle()
|
||||
void AppItem::updateWindowInfos()
|
||||
{
|
||||
m_titles = m_itemEntry->titles();
|
||||
m_appPreviewTips->setWindowInfos(m_titles);
|
||||
m_windowInfos = m_itemEntryInter->windowInfos();
|
||||
m_appPreviewTips->setWindowInfos(m_windowInfos);
|
||||
m_updateIconGeometryTimer->start();
|
||||
|
||||
update();
|
||||
@ -509,7 +568,7 @@ void AppItem::updateTitle()
|
||||
|
||||
void AppItem::refershIcon()
|
||||
{
|
||||
const QString icon = m_itemEntry->icon();
|
||||
const QString icon = m_itemEntryInter->icon();
|
||||
const int iconSize = qMin(width(), height());
|
||||
|
||||
if (DockDisplayMode == Efficient)
|
||||
@ -529,7 +588,7 @@ void AppItem::activeChanged()
|
||||
|
||||
void AppItem::showPreview()
|
||||
{
|
||||
if (m_titles.isEmpty())
|
||||
if (m_windowInfos.isEmpty())
|
||||
return;
|
||||
|
||||
// test cursor position
|
||||
@ -545,7 +604,7 @@ void AppItem::showPreview()
|
||||
// default: return;
|
||||
// }
|
||||
|
||||
m_appPreviewTips->setWindowInfos(m_titles);
|
||||
m_appPreviewTips->setWindowInfos(m_windowInfos);
|
||||
m_appPreviewTips->updateSnapshots();
|
||||
m_appPreviewTips->updateLayoutDirection(DockPosition);
|
||||
|
||||
|
@ -24,12 +24,15 @@
|
||||
|
||||
#include "dockitem.h"
|
||||
#include "components/previewcontainer.h"
|
||||
#include "dbus/dbusdockentry.h"
|
||||
#include "dbus/dbusclientmanager.h"
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsItem>
|
||||
|
||||
#include <com_deepin_dde_daemon_dock_entry.h>
|
||||
|
||||
using DockEntryInter = com::deepin::dde::daemon::dock::Entry;
|
||||
|
||||
class AppItem : public DockItem
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -73,7 +76,7 @@ private:
|
||||
void startDrag();
|
||||
|
||||
private slots:
|
||||
void updateTitle();
|
||||
void updateWindowInfos();
|
||||
void refershIcon();
|
||||
void activeChanged();
|
||||
void showPreview();
|
||||
@ -82,14 +85,14 @@ private slots:
|
||||
private:
|
||||
QLabel *m_appNameTips;
|
||||
PreviewContainer *m_appPreviewTips;
|
||||
DBusDockEntry *m_itemEntry;
|
||||
DockEntryInter *m_itemEntryInter;
|
||||
|
||||
QGraphicsView *m_itemView;
|
||||
QGraphicsScene *m_itemScene;
|
||||
|
||||
bool m_draging;
|
||||
bool m_active;
|
||||
WindowDict m_titles;
|
||||
WindowInfoMap m_windowInfos;
|
||||
QString m_id;
|
||||
QPixmap m_appIcon;
|
||||
QPixmap m_horizontalIndicator;
|
||||
|
@ -55,7 +55,7 @@ PreviewContainer::PreviewContainer(QWidget *parent)
|
||||
connect(m_floatingPreview, &FloatingPreview::requestMove, this, &PreviewContainer::moveFloatingPreview);
|
||||
}
|
||||
|
||||
void PreviewContainer::setWindowInfos(const WindowDict &infos)
|
||||
void PreviewContainer::setWindowInfos(const WindowInfoMap &infos)
|
||||
{
|
||||
// check removed window
|
||||
for (auto it(m_snapshots.begin()); it != m_snapshots.end();)
|
||||
@ -74,7 +74,7 @@ void PreviewContainer::setWindowInfos(const WindowDict &infos)
|
||||
{
|
||||
if (!m_snapshots.contains(it.key()))
|
||||
appendSnapWidget(it.key());
|
||||
m_snapshots[it.key()]->setWindowTitle(it.value());
|
||||
m_snapshots[it.key()]->setWindowTitle(it.value().m_windowTitle);
|
||||
}
|
||||
|
||||
if (m_snapshots.isEmpty())
|
||||
|
@ -26,11 +26,12 @@
|
||||
#include <QBoxLayout>
|
||||
#include <QTimer>
|
||||
|
||||
#include "dbus/dbusdockentry.h"
|
||||
#include "constants.h"
|
||||
#include "appsnapshot.h"
|
||||
#include "floatingpreview.h"
|
||||
|
||||
#include <com_deepin_dde_daemon_dock_entry.h>
|
||||
|
||||
#include <DWindowManagerHelper>
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
@ -49,7 +50,7 @@ signals:
|
||||
void requestCancelAndHidePreview() const;
|
||||
|
||||
public:
|
||||
void setWindowInfos(const WindowDict &infos);
|
||||
void setWindowInfos(const WindowInfoMap &infos);
|
||||
void updateSnapshots();
|
||||
|
||||
public slots:
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include <QResizeEvent>
|
||||
#include <QScreen>
|
||||
#include <QGuiApplication>
|
||||
#include <QX11Info>
|
||||
#include <qpa/qplatformwindow.h>
|
||||
|
||||
#include <DPlatformWindowHandle>
|
||||
|
Loading…
x
Reference in New Issue
Block a user