mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 09:23:03 +00:00
modify interface
Change-Id: I9605629e583aa206e54058471d8fdcedd5d35e4f
This commit is contained in:
parent
ddb6f91d4c
commit
6d7a835ae0
@ -55,14 +55,19 @@ void DockPluginsController::itemRemoved(PluginsItemInterface * const itemInter,
|
||||
item->deleteLater();
|
||||
}
|
||||
|
||||
void DockPluginsController::requestPopupApplet(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
void DockPluginsController::setDockAutoHide(const bool autoHide)
|
||||
{
|
||||
PluginsItem *item = pluginItemAt(itemInter, itemKey);
|
||||
|
||||
Q_ASSERT(item);
|
||||
item->showPopupApplet();
|
||||
Q_UNUSED(autoHide);
|
||||
}
|
||||
|
||||
//void DockPluginsController::requestPopupApplet(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
//{
|
||||
// PluginsItem *item = pluginItemAt(itemInter, itemKey);
|
||||
|
||||
// Q_ASSERT(item);
|
||||
// item->showPopupApplet();
|
||||
//}
|
||||
|
||||
void DockPluginsController::loadPlugins()
|
||||
{
|
||||
// Q_ASSERT(m_pluginLoaderList.isEmpty());
|
||||
|
@ -22,7 +22,7 @@ public:
|
||||
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
void requestPopupApplet(PluginsItemInterface * const itemInter, const QString &itemKey);
|
||||
void setDockAutoHide(const bool autoHide);
|
||||
|
||||
signals:
|
||||
void pluginItemInserted(PluginsItem *pluginItem) const;
|
||||
|
@ -36,7 +36,6 @@ public:
|
||||
signals:
|
||||
void dragStarted() const;
|
||||
void menuUnregistered() const;
|
||||
void requestPopupApplet(const QPoint &p, const QWidget *w) const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e);
|
||||
|
@ -49,11 +49,6 @@ void PluginsItem::detachPluginWidget()
|
||||
widget->setParent(nullptr);
|
||||
}
|
||||
|
||||
void PluginsItem::showPopupApplet()
|
||||
{
|
||||
emit requestPopupApplet(popupMarkPoint(), m_pluginInter->itemPopupApplet(m_itemKey));
|
||||
}
|
||||
|
||||
void PluginsItem::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
if (e->button() == Qt::LeftButton)
|
||||
|
@ -14,7 +14,6 @@ public:
|
||||
|
||||
int itemSortKey() const;
|
||||
void detachPluginWidget();
|
||||
void showPopupApplet();
|
||||
|
||||
private:
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
virtual void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) = 0;
|
||||
virtual void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) = 0;
|
||||
virtual void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) = 0;
|
||||
virtual void requestPopupApplet(PluginsItemInterface * const itemInter, const QString &itemKey) = 0;
|
||||
virtual void setDockAutoHide(const bool autoHide) = 0;
|
||||
};
|
||||
|
||||
#endif // PLUGINPROXYINTERFACE_H
|
||||
|
@ -62,34 +62,36 @@ void FashionTrayItem::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
QWidget::mousePressEvent(e);
|
||||
|
||||
emit requestPopupApplet();
|
||||
|
||||
m_pressPoint = e->pos();
|
||||
}
|
||||
|
||||
void FashionTrayItem::mouseReleaseEvent(QMouseEvent *e)
|
||||
{
|
||||
Q_UNUSED(e);
|
||||
const QPoint point = e->pos() - m_pressPoint;
|
||||
|
||||
if (point.manhattanLength() > DRAG_THRESHOLD)
|
||||
return;
|
||||
|
||||
if (!m_activeTray)
|
||||
return;
|
||||
// if (e->button() == Qt::LeftButton)
|
||||
// emit requestPopupApplet();
|
||||
|
||||
QPoint globalPos = mapToGlobal(QPoint(0, 0));
|
||||
uint8_t buttonIndex = XCB_BUTTON_INDEX_1;
|
||||
// if (!m_activeTray)
|
||||
// return;
|
||||
|
||||
switch (e->button()) {
|
||||
case Qt:: MiddleButton:
|
||||
buttonIndex = XCB_BUTTON_INDEX_2;
|
||||
break;
|
||||
case Qt::RightButton:
|
||||
buttonIndex = XCB_BUTTON_INDEX_3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// QPoint globalPos = mapToGlobal(QPoint(0, 0));
|
||||
// uint8_t buttonIndex = XCB_BUTTON_INDEX_1;
|
||||
|
||||
m_activeTray->sendClick(buttonIndex, globalPos.x(), globalPos.y());
|
||||
// switch (e->button()) {
|
||||
// case Qt:: MiddleButton:
|
||||
// buttonIndex = XCB_BUTTON_INDEX_2;
|
||||
// break;
|
||||
// case Qt::RightButton:
|
||||
// buttonIndex = XCB_BUTTON_INDEX_3;
|
||||
// break;
|
||||
// default:
|
||||
// break;
|
||||
// }
|
||||
|
||||
// m_activeTray->sendClick(buttonIndex, globalPos.x(), globalPos.y());
|
||||
}
|
||||
|
@ -15,7 +15,6 @@ public:
|
||||
TrayWidget *activeTray();
|
||||
|
||||
signals:
|
||||
void requestPopupApplet() const;
|
||||
|
||||
public slots:
|
||||
void setActiveTray(TrayWidget *tray);
|
||||
|
@ -23,8 +23,6 @@ void SystemTrayPlugin::init(PluginProxyInterface *proxyInter)
|
||||
{
|
||||
m_proxyInter = proxyInter;
|
||||
|
||||
connect(m_fashionItem, &FashionTrayItem::requestPopupApplet, this, &SystemTrayPlugin::requestPopupApplet);
|
||||
|
||||
connect(m_trayInter, &DBusTrayManager::Added, this, &SystemTrayPlugin::trayAdded);
|
||||
connect(m_trayInter, &DBusTrayManager::Removed, this, &SystemTrayPlugin::trayRemoved);
|
||||
connect(m_trayInter, &DBusTrayManager::Changed, this, &SystemTrayPlugin::trayChanged);
|
||||
@ -52,10 +50,7 @@ QWidget *SystemTrayPlugin::itemWidget(const QString &itemKey)
|
||||
QWidget *SystemTrayPlugin::itemPopupApplet(const QString &itemKey)
|
||||
{
|
||||
Q_ASSERT(itemKey == FASHION_MODE_ITEM);
|
||||
|
||||
// not have other tray icon
|
||||
if (m_trayList.size() < 2)
|
||||
return nullptr;
|
||||
Q_ASSERT(m_trayList.size());
|
||||
|
||||
updateTipsContent();
|
||||
|
||||
@ -65,7 +60,7 @@ QWidget *SystemTrayPlugin::itemPopupApplet(const QString &itemKey)
|
||||
void SystemTrayPlugin::updateTipsContent()
|
||||
{
|
||||
auto trayList = m_trayList.values();
|
||||
trayList.removeOne(m_fashionItem->activeTray());
|
||||
// trayList.removeOne(m_fashionItem->activeTray());
|
||||
|
||||
m_tipsWidget->clear();
|
||||
m_tipsWidget->addWidgets(trayList);
|
||||
@ -132,8 +127,3 @@ void SystemTrayPlugin::switchToMode(const Dock::DisplayMode mode)
|
||||
m_proxyInter->itemAdded(this, QString::number(winId));
|
||||
}
|
||||
}
|
||||
|
||||
void SystemTrayPlugin::requestPopupApplet()
|
||||
{
|
||||
m_proxyInter->requestPopupApplet(this, FASHION_MODE_ITEM);
|
||||
}
|
||||
|
@ -31,7 +31,6 @@ private slots:
|
||||
void trayRemoved(const quint32 winId);
|
||||
void trayChanged(const quint32 winId);
|
||||
void switchToMode(const Dock::DisplayMode mode);
|
||||
void requestPopupApplet();
|
||||
|
||||
private:
|
||||
DBusTrayManager *m_trayInter;
|
||||
|
@ -23,6 +23,9 @@ void TipsWidget::clear()
|
||||
void TipsWidget::addWidgets(QList<TrayWidget *> widgets)
|
||||
{
|
||||
for (auto w : widgets)
|
||||
{
|
||||
w->setVisible(true);
|
||||
m_mainLayout->addWidget(w);
|
||||
}
|
||||
setFixedWidth(widgets.size() * 20 + 20);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user