fix: 修复快捷面板插件子面板无法关闭主面板的问题

在子插件点击相应的功能按钮的时候,调用requestSetAppletVisible方法来隐藏面板

Log: 优化快捷面板插件功能
Influence: 进入快捷面板的蓝牙子界面点击设置,进入声音子界面点击设置,进入亮度调整子界面点击设置,在弹出对应的功能后,观察快捷面板是否隐藏
Task: https://pms.uniontech.com/task-view-222353.html
Change-Id: Ifeb450497c17220545fbda10c159f1e50b00c534
This commit is contained in:
donghualin 2023-01-14 19:45:12 +08:00
parent b337d88dd4
commit f295b434f8
11 changed files with 23 additions and 5 deletions

View File

@ -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()

View File

@ -62,6 +62,7 @@ signals:
void requestContextMenu() const;
void noAdapter();
void justHasAdapter();
void requestHide();
private:
Dock::TipsWidget *m_tipsLabel;

View File

@ -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);
});

View File

@ -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);

View File

@ -102,6 +102,7 @@ signals:
void justHasAdapter();
void powerChanged(bool state);
void deviceStateChanged(const Device *device);
void requestHide();
public slots:
// 蓝牙适配器增加

View File

@ -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());

View File

@ -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();
});
}

View File

@ -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();

View File

@ -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();
}
}

View File

@ -53,6 +53,7 @@ public:
Q_SIGNALS:
void enableChanged(bool);
void requestHide();
protected:
bool eventFilter(QObject *watcher, QEvent *event) override;

View File

@ -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()