mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
fix:Adding com.deepin.dde.dock.module.launcher also needs to hide the multitasking view and show the desktop icon
添加com.deepin.dde.dock.module.launcher中还需要隐藏多任务视图和显示桌面图标
This commit is contained in:
parent
5422441836
commit
a969d811b7
@ -33,6 +33,7 @@
|
||||
#include <QStandardPaths>
|
||||
#include <QString>
|
||||
#include <QApplication>
|
||||
#include <QGSettings>
|
||||
|
||||
#include <DGuiApplicationHelper>
|
||||
#include <DWindowManagerHelper>
|
||||
@ -45,6 +46,12 @@
|
||||
|
||||
DWIDGET_USE_NAMESPACE
|
||||
|
||||
static QGSettings *GSettingsByLaunch()
|
||||
{
|
||||
static QGSettings settings("com.deepin.dde.dock.module.launcher");
|
||||
return &settings;
|
||||
}
|
||||
|
||||
MainPanelControl::MainPanelControl(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_mainPanelLayout(new QBoxLayout(QBoxLayout::LeftToRight, this))
|
||||
@ -66,6 +73,7 @@ MainPanelControl::MainPanelControl(QWidget *parent)
|
||||
, m_appSpliter(new QLabel(this))
|
||||
, m_traySpliter(new QLabel(this))
|
||||
, m_isHover(false)
|
||||
, m_isEnableLaunch(true)
|
||||
{
|
||||
init();
|
||||
updateMainPanelLayout();
|
||||
@ -128,6 +136,29 @@ void MainPanelControl::init()
|
||||
//桌面
|
||||
m_mainPanelLayout->addWidget(m_desktopWidget);
|
||||
|
||||
connect(GSettingsByLaunch(), &QGSettings::changed, this, &MainPanelControl::onGSettingsChanged);
|
||||
}
|
||||
|
||||
void MainPanelControl::onGSettingsChanged(const QString &key)
|
||||
{
|
||||
if (key != "enable") {
|
||||
return;
|
||||
}
|
||||
|
||||
QGSettings *setting = GSettingsByLaunch();
|
||||
|
||||
if (setting->keys().contains("enable")) {
|
||||
const bool isEnable = GSettingsByLaunch()->keys().contains("enable") && GSettingsByLaunch()->get("enable").toBool();
|
||||
if(isEnable && setting->get("enable").toBool()){
|
||||
m_fixedAreaWidget->setVisible(true);
|
||||
m_fixedSpliter->setVisible(true);
|
||||
m_isEnableLaunch = true;
|
||||
} else {
|
||||
m_fixedAreaWidget->setVisible(false);
|
||||
m_fixedSpliter->setVisible(false);
|
||||
m_isEnableLaunch = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainPanelControl::setDisplayMode(DisplayMode mode)
|
||||
@ -751,6 +782,14 @@ void MainPanelControl::itemUpdated(DockItem *item)
|
||||
resizeDockIcon();
|
||||
}
|
||||
|
||||
void MainPanelControl::showEvent(QShowEvent* event) {
|
||||
QTimer::singleShot(0, this, [=] {
|
||||
onGSettingsChanged("enable");
|
||||
});
|
||||
|
||||
return QWidget::showEvent(event);
|
||||
}
|
||||
|
||||
void MainPanelControl::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
@ -763,6 +802,7 @@ void MainPanelControl::paintEvent(QPaintEvent *event)
|
||||
painter.setOpacity(0.1);
|
||||
}
|
||||
|
||||
if(m_isEnableLaunch)
|
||||
painter.fillRect(m_fixedSpliter->geometry(), color);
|
||||
painter.fillRect(m_appSpliter->geometry(), color);
|
||||
painter.fillRect(m_traySpliter->geometry(), color);
|
||||
|
@ -97,6 +97,11 @@ public slots:
|
||||
void removeItem(DockItem *item);
|
||||
void itemUpdated(DockItem *item);
|
||||
|
||||
// void
|
||||
void onGSettingsChanged(const QString &key);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event) override;
|
||||
private:
|
||||
QBoxLayout *m_mainPanelLayout;
|
||||
QWidget *m_fixedAreaWidget;
|
||||
@ -123,6 +128,7 @@ private:
|
||||
int m_trayIconCount;
|
||||
TrayPluginItem *m_tray = nullptr;
|
||||
bool m_isHover;//判断鼠标是否移到desktop区域
|
||||
bool m_isEnableLaunch;//判断是否使能了com.deepin.dde.dock.module.launcher
|
||||
};
|
||||
|
||||
#endif // MAINPANELCONTROL_H
|
||||
|
@ -151,6 +151,9 @@ DockSettings::DockSettings(QWidget *parent)
|
||||
resetFrontendGeometry();
|
||||
|
||||
QTimer::singleShot(0, this, [ = ] {onOpacityChanged(m_dockInter->opacity());});
|
||||
QTimer::singleShot(0, this, [=] {
|
||||
onGSettingsChanged("enable");
|
||||
});
|
||||
}
|
||||
|
||||
DockSettings &DockSettings::Instance()
|
||||
@ -221,6 +224,10 @@ const QRect DockSettings::windowRect(const Position position, const bool hide) c
|
||||
|
||||
void DockSettings::showDockSettingsMenu()
|
||||
{
|
||||
QTimer::singleShot(0, this, [=] {
|
||||
onGSettingsChanged("enable");
|
||||
});
|
||||
|
||||
m_autoHide = false;
|
||||
|
||||
// create actions
|
||||
|
Loading…
x
Reference in New Issue
Block a user