From f295b434f8f30bfc44cb1a900aa72401fd68c8c7 Mon Sep 17 00:00:00 2001 From: donghualin Date: Sat, 14 Jan 2023 19:45:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=8F=92=E4=BB=B6=E5=AD=90=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=85=B3=E9=97=AD=E4=B8=BB=E9=9D=A2=E6=9D=BF?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在子插件点击相应的功能按钮的时候,调用requestSetAppletVisible方法来隐藏面板 Log: 优化快捷面板插件功能 Influence: 进入快捷面板的蓝牙子界面点击设置,进入声音子界面点击设置,进入亮度调整子界面点击设置,在弹出对应的功能后,观察快捷面板是否隐藏 Task: https://pms.uniontech.com/task-view-222353.html Change-Id: Ifeb450497c17220545fbda10c159f1e50b00c534 --- plugins/bluetooth/bluetoothitem.cpp | 1 + plugins/bluetooth/bluetoothitem.h | 1 + plugins/bluetooth/bluetoothplugin.cpp | 9 ++++++--- plugins/bluetooth/componments/bluetoothapplet.cpp | 1 + plugins/bluetooth/componments/bluetoothapplet.h | 1 + plugins/display/displayplugin.cpp | 3 +++ plugins/display/displaysettingwidget.cpp | 2 +- plugins/display/displaysettingwidget.h | 4 ++++ plugins/sound/sounddeviceswidget.cpp | 2 +- plugins/sound/sounddeviceswidget.h | 1 + plugins/sound/soundplugin.cpp | 3 +++ 11 files changed, 23 insertions(+), 5 deletions(-) diff --git a/plugins/bluetooth/bluetoothitem.cpp b/plugins/bluetooth/bluetoothitem.cpp index d025eb19b..c8c0a3501 100644 --- a/plugins/bluetooth/bluetoothitem.cpp +++ b/plugins/bluetooth/bluetoothitem.cpp @@ -67,6 +67,7 @@ BluetoothItem::BluetoothItem(AdaptersManager *adapterManager, QWidget *parent) connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &BluetoothItem::refreshIcon); connect(m_applet, &BluetoothApplet::noAdapter, this, &BluetoothItem::noAdapter); connect(m_applet, &BluetoothApplet::justHasAdapter, this, &BluetoothItem::justHasAdapter); + connect(m_applet, &BluetoothApplet::requestHide, this, &BluetoothItem::requestHide); } QWidget *BluetoothItem::tipsWidget() diff --git a/plugins/bluetooth/bluetoothitem.h b/plugins/bluetooth/bluetoothitem.h index 89a382f6d..13a276aef 100644 --- a/plugins/bluetooth/bluetoothitem.h +++ b/plugins/bluetooth/bluetoothitem.h @@ -62,6 +62,7 @@ signals: void requestContextMenu() const; void noAdapter(); void justHasAdapter(); + void requestHide(); private: Dock::TipsWidget *m_tipsLabel; diff --git a/plugins/bluetooth/bluetoothplugin.cpp b/plugins/bluetooth/bluetoothplugin.cpp index c7ce93676..9e7923840 100644 --- a/plugins/bluetooth/bluetoothplugin.cpp +++ b/plugins/bluetooth/bluetoothplugin.cpp @@ -60,15 +60,18 @@ void BluetoothPlugin::init(PluginProxyInterface *proxyInter) m_bluetoothWidget.reset(new BluetoothMainWidget(m_adapterManager)); - connect(m_bluetoothItem.data(), &BluetoothItem::justHasAdapter, [&] { + connect(m_bluetoothItem.data(), &BluetoothItem::justHasAdapter, [ this ] { m_proxyInter->itemAdded(this, BLUETOOTH_KEY); }); - connect(m_bluetoothItem.data(), &BluetoothItem::noAdapter, [&] { + connect(m_bluetoothItem.data(), &BluetoothItem::requestHide, [ this ] { + m_proxyInter->requestSetAppletVisible(this, QUICK_ITEM_KEY, false); + }); + connect(m_bluetoothItem.data(), &BluetoothItem::noAdapter, [ this ] { m_proxyInter->requestSetAppletVisible(this, QUICK_ITEM_KEY, false); m_proxyInter->requestSetAppletVisible(this, BLUETOOTH_KEY, false); m_proxyInter->itemRemoved(this, BLUETOOTH_KEY); }); - connect(m_bluetoothWidget.data(), &BluetoothMainWidget::requestExpand, this, [ = ] { + connect(m_bluetoothWidget.data(), &BluetoothMainWidget::requestExpand, this, [ this ] { m_proxyInter->requestSetAppletVisible(this, QUICK_ITEM_KEY, true); }); diff --git a/plugins/bluetooth/componments/bluetoothapplet.cpp b/plugins/bluetooth/componments/bluetoothapplet.cpp index 645aba307..3ec6f9ec2 100644 --- a/plugins/bluetooth/componments/bluetoothapplet.cpp +++ b/plugins/bluetooth/componments/bluetoothapplet.cpp @@ -302,6 +302,7 @@ void BluetoothApplet::initConnect() .method(QString("ShowPage")) .arg(QString("bluetooth")) .call(); + emit requestHide(); }); connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &BluetoothApplet::updateIconTheme); connect(m_airPlaneModeInter, &DBusAirplaneMode::EnabledChanged, this, &BluetoothApplet::setAirplaneModeEnabled); diff --git a/plugins/bluetooth/componments/bluetoothapplet.h b/plugins/bluetooth/componments/bluetoothapplet.h index 87f1b7ca2..20f353c8d 100644 --- a/plugins/bluetooth/componments/bluetoothapplet.h +++ b/plugins/bluetooth/componments/bluetoothapplet.h @@ -102,6 +102,7 @@ signals: void justHasAdapter(); void powerChanged(bool state); void deviceStateChanged(const Device *device); + void requestHide(); public slots: // 蓝牙适配器增加 diff --git a/plugins/display/displayplugin.cpp b/plugins/display/displayplugin.cpp index 41001dba8..01f57a9eb 100644 --- a/plugins/display/displayplugin.cpp +++ b/plugins/display/displayplugin.cpp @@ -73,6 +73,9 @@ void DisplayPlugin::init(PluginProxyInterface *proxyInter) connect(m_displayWidget.data(), &BrightnessWidget::brightClicked, this, [ this ] { m_proxyInter->requestSetAppletVisible(this, QUICK_ITEM_KEY, true); }); + connect(m_displaySettingWidget.data(), &DisplaySettingWidget::requestHide, this, [ this ] { + m_proxyInter->requestSetAppletVisible(this, QUICK_ITEM_KEY, false); + }); connect(m_model.data(), &BrightnessModel::screenVisibleChanged, this, [ this ](bool visible) { if (visible) m_proxyInter->itemAdded(this, pluginName()); diff --git a/plugins/display/displaysettingwidget.cpp b/plugins/display/displaysettingwidget.cpp index d80056e7e..4a630d0cb 100644 --- a/plugins/display/displaysettingwidget.cpp +++ b/plugins/display/displaysettingwidget.cpp @@ -42,7 +42,7 @@ DisplaySettingWidget::DisplaySettingWidget(QWidget *parent) .path("/org/deepin/dde/ControlCenter1") .interface("org.deepin.dde.ControlCenter1") .method("ShowPage").arg(QString("display")).call(); - hide(); + Q_EMIT requestHide(); }); } diff --git a/plugins/display/displaysettingwidget.h b/plugins/display/displaysettingwidget.h index 9ea0b8fc4..e3adcefce 100644 --- a/plugins/display/displaysettingwidget.h +++ b/plugins/display/displaysettingwidget.h @@ -34,9 +34,13 @@ class DevCollaborationWidget; class DisplaySettingWidget : public QWidget { Q_OBJECT + public: explicit DisplaySettingWidget(QWidget *parent = nullptr); +Q_SIGNALS: + void requestHide(); + private: void initUI(); void resizeWidgetHeight(); diff --git a/plugins/sound/sounddeviceswidget.cpp b/plugins/sound/sounddeviceswidget.cpp index 2942c3b5f..3c00da127 100644 --- a/plugins/sound/sounddeviceswidget.cpp +++ b/plugins/sound/sounddeviceswidget.cpp @@ -449,7 +449,7 @@ void SoundDevicesWidget::onSelectIndexChanged(const QModelIndex &index) .path("/org/deepin/dde/ControlCenter1") .interface("org.deepin.dde.ControlCenter1") .method("ShowPage").arg(QString("sound")).call(); - hide(); + emit requestHide(); } } diff --git a/plugins/sound/sounddeviceswidget.h b/plugins/sound/sounddeviceswidget.h index c37814f62..5fd199e96 100644 --- a/plugins/sound/sounddeviceswidget.h +++ b/plugins/sound/sounddeviceswidget.h @@ -53,6 +53,7 @@ public: Q_SIGNALS: void enableChanged(bool); + void requestHide(); protected: bool eventFilter(QObject *watcher, QEvent *event) override; diff --git a/plugins/sound/soundplugin.cpp b/plugins/sound/soundplugin.cpp index 84ac584d9..99f59b796 100644 --- a/plugins/sound/soundplugin.cpp +++ b/plugins/sound/soundplugin.cpp @@ -70,6 +70,9 @@ void SoundPlugin::init(PluginProxyInterface *proxyInter) } connect(m_soundDeviceWidget.data(), &SoundDevicesWidget::enableChanged, m_soundWidget.data(), &SoundWidget::setEnabled); + connect(m_soundDeviceWidget.data(), &SoundDevicesWidget::requestHide, this, [ this ] { + m_proxyInter->requestSetAppletVisible(this, QUICK_ITEM_KEY, false); + }); } void SoundPlugin::pluginStateSwitched()