mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
fix: 修复从控制中心第一次连接需要密码的网络没有弹出网络面板的问题
在任务栏插件区域接收到显示面板的请求的时候,先显示快捷面板,然后在快捷面板中显示请求的窗体 Log: Influence: 从控制中心第一次连接需要密码的网络,观察任务栏是否显示网络列表 Bug: https://pms.uniontech.com/bug-view-150395.html Change-Id: Idec2390a55a6236d336c52bf73a10448bc84615f
This commit is contained in:
parent
4c324fe872
commit
f14c19ba9e
@ -55,7 +55,6 @@ QuickSettingItem::QuickSettingItem(PluginsItemInterface *const pluginInter, QWid
|
||||
{
|
||||
setAcceptDrops(true);
|
||||
this->installEventFilter(this);
|
||||
connect(QuickSettingController::instance(), &QuickSettingController::requestAppletShow, this, &QuickSettingItem::onRequestAppletShow);
|
||||
}
|
||||
|
||||
QuickSettingItem::~QuickSettingItem()
|
||||
@ -129,20 +128,6 @@ QColor QuickSettingItem::foregroundColor() const
|
||||
return dpa.color(DPalette::ColorGroup::Normal, DPalette::ColorRole::Text);
|
||||
}
|
||||
|
||||
void QuickSettingItem::onRequestAppletShow(PluginsItemInterface *itemInter, const QString &itemKey)
|
||||
{
|
||||
// 只显示当前的插件的内容
|
||||
if (itemInter != m_pluginInter)
|
||||
return;
|
||||
|
||||
// 显示弹出的内容
|
||||
QWidget *itemApplet = itemInter->itemPopupApplet(itemKey);
|
||||
if (!itemApplet)
|
||||
return;
|
||||
|
||||
Q_EMIT requestShowChildWidget(itemApplet);
|
||||
}
|
||||
|
||||
QuickSettingItem *QuickSettingFactory::createQuickWidget(PluginsItemInterface * const pluginInter)
|
||||
{
|
||||
// 如果显示在面板的图标或者Widget为空,则不让显示(例如电池插件)
|
||||
|
@ -53,7 +53,6 @@ Q_SIGNALS:
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
QColor foregroundColor() const;
|
||||
void onRequestAppletShow(PluginsItemInterface *itemInter, const QString &itemKey);
|
||||
|
||||
private:
|
||||
PluginsItemInterface *m_pluginInter;
|
||||
|
@ -64,6 +64,11 @@ void PluginChildPage::setTitle(const QString &text)
|
||||
m_title->setText(text);
|
||||
}
|
||||
|
||||
void PluginChildPage::setCanBack(bool canBack)
|
||||
{
|
||||
m_back->setVisible(canBack);
|
||||
}
|
||||
|
||||
bool PluginChildPage::isBack()
|
||||
{
|
||||
return m_isBack;
|
||||
|
@ -35,6 +35,7 @@ public:
|
||||
~PluginChildPage() override;
|
||||
void pushWidget(QWidget *widget);
|
||||
void setTitle(const QString &text);
|
||||
void setCanBack(bool canBack);
|
||||
bool isBack();
|
||||
|
||||
Q_SIGNALS:
|
||||
|
@ -224,26 +224,7 @@ bool QuickPluginWindow::eventFilter(QObject *watched, QEvent *event)
|
||||
if (m_dragInfo->canDrag(mouseEvent->pos()))
|
||||
break;
|
||||
|
||||
QuickDockItem *releaseItem = qobject_cast<QuickDockItem *>(watched);
|
||||
if (!releaseItem)
|
||||
break;
|
||||
|
||||
DockPopupWindow *popWindow = QuickSettingContainer::popWindow();
|
||||
if (Utils::IS_WAYLAND_DISPLAY) {
|
||||
// TODO: 临时解决方案,如果是wayland环境,toolTip没有消失,因此,此处直接调用接口来隐藏
|
||||
for (int i = m_mainLayout->count() - 1; i >= 0; i--) {
|
||||
QLayoutItem *layoutItem = m_mainLayout->itemAt(i);
|
||||
if (!layoutItem)
|
||||
continue;
|
||||
|
||||
QuickDockItem *dockItem = qobject_cast<QuickDockItem *>(layoutItem->widget());
|
||||
if (!dockItem)
|
||||
continue;
|
||||
|
||||
dockItem->hideToolTip();
|
||||
}
|
||||
}
|
||||
popWindow->show(popupPoint(releaseItem), true);
|
||||
showPopup(qobject_cast<QuickDockItem *>(watched));
|
||||
} while (false);
|
||||
m_dragInfo->reset();
|
||||
|
||||
@ -369,6 +350,11 @@ void QuickPluginWindow::onUpdatePlugin(PluginsItemInterface *itemInter, const Do
|
||||
dockItem->update();
|
||||
}
|
||||
|
||||
void QuickPluginWindow::onRequestAppletShow(PluginsItemInterface *itemInter, const QString &itemKey)
|
||||
{
|
||||
showPopup(getDockItemByPlugin(itemInter), itemInter->itemPopupApplet(itemKey));
|
||||
}
|
||||
|
||||
void QuickPluginWindow::startDrag()
|
||||
{
|
||||
if (!m_dragInfo->dockItem)
|
||||
@ -429,6 +415,37 @@ QuickDockItem *QuickPluginWindow::getActiveDockItem(QPoint point) const
|
||||
return selectWidget;
|
||||
}
|
||||
|
||||
void QuickPluginWindow::showPopup(QuickDockItem *item, QWidget *childPage)
|
||||
{
|
||||
if (!isVisible() || !item)
|
||||
return;
|
||||
|
||||
bool canBack = true;
|
||||
DockPopupWindow *popWindow = QuickSettingContainer::popWindow();
|
||||
if (!popWindow->isVisible()) {
|
||||
if (Utils::IS_WAYLAND_DISPLAY) {
|
||||
// TODO: 临时解决方案,如果是wayland环境,toolTip没有消失,因此,此处直接调用接口来隐藏
|
||||
for (int i = m_mainLayout->count() - 1; i >= 0; i--) {
|
||||
QLayoutItem *layoutItem = m_mainLayout->itemAt(i);
|
||||
if (!layoutItem)
|
||||
continue;
|
||||
|
||||
QuickDockItem *dockItem = qobject_cast<QuickDockItem *>(layoutItem->widget());
|
||||
if (!dockItem)
|
||||
continue;
|
||||
|
||||
dockItem->hideToolTip();
|
||||
}
|
||||
}
|
||||
|
||||
popWindow->show(popupPoint(item), true);
|
||||
canBack = false;
|
||||
}
|
||||
|
||||
QuickSettingContainer *container = static_cast<QuickSettingContainer *>(popWindow->getContent());
|
||||
container->showPage(childPage, item->pluginItem(), canBack);
|
||||
}
|
||||
|
||||
int QuickPluginWindow::getDropIndex(QPoint point)
|
||||
{
|
||||
QuickDockItem *targetItem = getActiveDockItem(point);
|
||||
@ -534,6 +551,7 @@ void QuickPluginWindow::initConnection()
|
||||
QuickPluginModel *model = QuickPluginModel::instance();
|
||||
connect(model, &QuickPluginModel::requestUpdate, this, &QuickPluginWindow::onRequestUpdate);
|
||||
connect(model, &QuickPluginModel::requestUpdatePlugin, this, &QuickPluginWindow::onUpdatePlugin);
|
||||
connect(QuickSettingController::instance(), &QuickSettingController::requestAppletShow, this, &QuickPluginWindow::onRequestAppletShow);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -69,6 +69,7 @@ private Q_SLOTS:
|
||||
void onPluginDropItem(QDropEvent *event);
|
||||
void onPluginDragMove(QDragMoveEvent *event);
|
||||
void onUpdatePlugin(PluginsItemInterface *itemInter, const DockPart &dockPart);
|
||||
void onRequestAppletShow(PluginsItemInterface * itemInter, const QString &itemKey);
|
||||
|
||||
private:
|
||||
void initUi();
|
||||
@ -79,6 +80,7 @@ private:
|
||||
QPoint popupPoint(QWidget *widget) const;
|
||||
QuickDockItem *getDockItemByPlugin(PluginsItemInterface *item);
|
||||
QuickDockItem *getActiveDockItem(QPoint point) const;
|
||||
void showPopup(QuickDockItem *item, QWidget *childPage = nullptr);
|
||||
|
||||
private:
|
||||
QBoxLayout *m_mainLayout;
|
||||
|
@ -93,10 +93,20 @@ QuickSettingContainer::~QuickSettingContainer()
|
||||
delete m_dragInfo;
|
||||
}
|
||||
|
||||
void QuickSettingContainer::showHomePage()
|
||||
void QuickSettingContainer::showPage(QWidget *widget, PluginsItemInterface *pluginInter, bool canBack)
|
||||
{
|
||||
m_childShowPlugin = nullptr;
|
||||
m_switchLayout->setCurrentIndex(0);
|
||||
if (widget) {
|
||||
m_childShowPlugin = pluginInter;
|
||||
m_childPage->setTitle(pluginInter->pluginDisplayName());
|
||||
m_childPage->setCanBack(canBack);
|
||||
m_childPage->pushWidget(widget);
|
||||
m_switchLayout->setCurrentWidget(m_childPage);
|
||||
} else {
|
||||
m_childShowPlugin = nullptr;
|
||||
m_switchLayout->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
onResizeView();
|
||||
}
|
||||
|
||||
// 根据位置获取箭头的方向
|
||||
@ -120,7 +130,6 @@ DockPopupWindow *QuickSettingContainer::popWindow()
|
||||
{
|
||||
if (m_popWindow) {
|
||||
QuickSettingContainer *container = static_cast<QuickSettingContainer *>(m_popWindow->getContent());
|
||||
container->showHomePage();
|
||||
return m_popWindow;
|
||||
}
|
||||
|
||||
@ -155,6 +164,17 @@ void QuickSettingContainer::setPosition(Position position)
|
||||
}
|
||||
}
|
||||
|
||||
void QuickSettingContainer::showPage(QWidget *widget, const QString &title, bool canBack)
|
||||
{
|
||||
m_childShowPlugin = nullptr;
|
||||
m_childPage->setTitle(title);
|
||||
m_childPage->setCanBack(canBack);
|
||||
m_childPage->pushWidget(widget);
|
||||
m_switchLayout->setCurrentWidget(m_childPage);
|
||||
|
||||
onResizeView();
|
||||
}
|
||||
|
||||
bool QuickSettingContainer::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
switch (event->type()) {
|
||||
@ -183,13 +203,6 @@ bool QuickSettingContainer::eventFilter(QObject *watched, QEvent *event)
|
||||
return QWidget::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void QuickSettingContainer::showWidget(QWidget *widget, const QString &title)
|
||||
{
|
||||
m_childPage->setTitle(title);
|
||||
m_childPage->pushWidget(widget);
|
||||
m_switchLayout->setCurrentWidget(m_childPage);
|
||||
}
|
||||
|
||||
QPoint QuickSettingContainer::hotSpot(const QPixmap &pixmap)
|
||||
{
|
||||
if (m_position == Dock::Position::Left)
|
||||
@ -242,7 +255,7 @@ void QuickSettingContainer::onPluginRemove(PluginsItemInterface *itemInter)
|
||||
m_quickSettings.removeOne(removeItem);
|
||||
removeItem->deleteLater();
|
||||
if (m_childShowPlugin == itemInter)
|
||||
showHomePage();
|
||||
showPage(nullptr);
|
||||
|
||||
updateItemLayout();
|
||||
onResizeView();
|
||||
@ -254,9 +267,7 @@ void QuickSettingContainer::onShowChildWidget(QWidget *childWidget)
|
||||
if (!quickWidget)
|
||||
return;
|
||||
|
||||
m_childShowPlugin = quickWidget->pluginItem();
|
||||
showWidget(childWidget, m_childShowPlugin->pluginDisplayName());
|
||||
onResizeView();
|
||||
showPage(childWidget, quickWidget->pluginItem(), true);
|
||||
}
|
||||
|
||||
void QuickSettingContainer::mouseMoveEvent(QMouseEvent *event)
|
||||
@ -416,8 +427,7 @@ void QuickSettingContainer::initConnection()
|
||||
connect(m_brihtnessWidget->sliderContainer(), &SliderContainer::iconClicked, this, [ this ](const SliderContainer::IconPosition &iconPosition) {
|
||||
if (iconPosition == SliderContainer::RightIcon) {
|
||||
// 点击右侧的按钮,弹出具体的调节的界面
|
||||
showWidget(m_displaySettingWidget, tr("brightness"));
|
||||
onResizeView();
|
||||
showPage(m_displaySettingWidget, tr("brightness"), true);
|
||||
}
|
||||
});
|
||||
connect(m_childPage, &PluginChildPage::back, this, [ this ] {
|
||||
|
@ -54,6 +54,7 @@ class QuickSettingContainer : public QWidget
|
||||
public:
|
||||
static DockPopupWindow *popWindow();
|
||||
static void setPosition(Dock::Position position);
|
||||
void showPage(QWidget *widget, PluginsItemInterface *pluginInter = nullptr, bool canBack = false);
|
||||
|
||||
protected:
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
@ -61,7 +62,7 @@ protected:
|
||||
|
||||
explicit QuickSettingContainer(QWidget *parent = nullptr);
|
||||
~QuickSettingContainer() override;
|
||||
void showHomePage();
|
||||
void showPage(QWidget *widget, const QString &title, bool canBack = false);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onPluginRemove(PluginsItemInterface *itemInter);
|
||||
@ -76,10 +77,6 @@ private:
|
||||
void initConnection();
|
||||
// 调整控件位置
|
||||
void updateItemLayout();
|
||||
// 初始化控件项目
|
||||
// void initQuickItem(PluginsItemInterface *plugin);
|
||||
// 显示具体的窗体
|
||||
void showWidget(QWidget *widget, const QString &title);
|
||||
// 获取拖动图标的热点
|
||||
QPoint hotSpot(const QPixmap &pixmap);
|
||||
// 插入插件
|
||||
|
Loading…
x
Reference in New Issue
Block a user