Skip to content

Commit

Permalink
fix: quickpannel start app and disappeared self auto
Browse files Browse the repository at this point in the history
快捷面板启动应用系统监示器后快捷面板自动隐藏

Log: quickpannel start app and disappeared self auto

Bug: https://pms.uniontech.com/bug-view-228255.html
Bug: https://pms.uniontech.com/bug-view-228257.html
  • Loading branch information
jeffshuai committed Nov 13, 2023
1 parent 5a2e501 commit 68d2b64
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
12 changes: 12 additions & 0 deletions deepin-system-monitor-plugin/gui/monitor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void MonitorPlugin::init(PluginProxyInterface *proxyInter)
m_quickPanelWidget->setDescription(pluginDisplayName());
QString plugIcon = DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType? "dsm_pluginicon_dark" : "dsm_pluginicon_light";
m_quickPanelWidget->setIcon(QIcon::fromTheme(plugIcon));
connect(m_quickPanelWidget,&QuickPanelWidget::clicked,this,&MonitorPlugin::onClickQuickPanel);
qInfo() << __FUNCTION__ << __LINE__ << "[-MonitorPlugin-] QUICKPANEL20";
#endif

Expand Down Expand Up @@ -193,6 +194,10 @@ void MonitorPlugin::invokedMenuItem(const QString &itemKey, const QString &menuI
//QString cmd("qdbus com.deepin.SystemMonitorMain /com/deepin/SystemMonitorMain com.deepin.SystemMonitorMain.slotRaiseWindow");
QString cmd("gdbus call -e -d com.deepin.SystemMonitorMain -o /com/deepin/SystemMonitorMain -m com.deepin.SystemMonitorMain.slotRaiseWindow");
QTimer::singleShot(200, this, [ = ]() { QProcess::startDetached(cmd); });
#ifdef USE_API_QUICKPANEL20
qInfo() << __FUNCTION__ << __LINE__ << "[-MonitorPlugin-] right ClickQuickPanel";
m_proxyInter->requestSetAppletVisible(this, Dock::QUICK_ITEM_KEY, false);
#endif
}
}

Expand Down Expand Up @@ -485,4 +490,11 @@ QIcon MonitorPlugin::icon(Dock::IconType iconType, Dock::ThemeType) const
{
return( (iconType == Dock::IconType_DCC_Settings) ? QIcon(":/deepin-system-monitor.svg") : QIcon());
}

void MonitorPlugin::onClickQuickPanel()
{
qInfo() << __FUNCTION__ << __LINE__ << "[-MonitorPlugin-] ClickQuickPanel";
m_proxyInter->requestSetAppletVisible(this, Dock::QUICK_ITEM_KEY, false);
DBusInterface::getInstance()->showOrHideDeepinSystemMonitorPluginPopupWidget();
}
#endif
7 changes: 7 additions & 0 deletions deepin-system-monitor-plugin/gui/monitor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ private slots:
//!
void udpateTipsInfo();

#ifdef USE_API_QUICKPANEL20
//!
//! \brief onClickQuickPanel mouse event active
//!
void onClickQuickPanel();
#endif

private:
//!
//! \brief loadPlugin 加载插件
Expand Down
11 changes: 4 additions & 7 deletions deepin-system-monitor-plugin/gui/quickpanelwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "quickpanelwidget.h"
#include "dbus/dbusinterface.h"

#include <QVBoxLayout>

Expand All @@ -19,13 +18,12 @@ QuickPanelWidget::QuickPanelWidget(QWidget* parent)
{
initUI();
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &QuickPanelWidget::refreshBg);
connect(this,&QuickPanelWidget::clicked,this,&QuickPanelWidget::onClickQuickPanel);
}

QuickPanelWidget::~QuickPanelWidget()
{
}

}

void QuickPanelWidget::initUI()
{
Expand Down Expand Up @@ -89,11 +87,10 @@ void QuickPanelWidget::paintEvent(QPaintEvent *event)

void QuickPanelWidget::refreshBg()
{
QString plugIcon = DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType? "dsm_pluginicon_dark" : "dsm_pluginicon_light";
setIcon(QIcon::fromTheme(plugIcon));

m_description->setForegroundRole(m_icon->activeState() && DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType ? QPalette::Highlight : QPalette::NoRole);
update();
}

void QuickPanelWidget::onClickQuickPanel()
{
DBusInterface::getInstance()->showOrHideDeepinSystemMonitorPluginPopupWidget();
}
2 changes: 1 addition & 1 deletion deepin-system-monitor-plugin/gui/quickpanelwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class QuickPanelWidget : public QWidget

private slots:
void refreshBg();
void onClickQuickPanel();

private:
CommonIconButton *m_icon;
DLabel *m_description;
Expand Down

0 comments on commit 68d2b64

Please sign in to comment.