feat(multitaskingplugin): 多任务视图优化需求

当前设备不支持特效就不显示多任务视图和右键插件

Log: 当前设备不支持特效就不显示多任务视图和右键插件
Task: https://pms.uniontech.com/zentao/task-view-30901.html
Change-Id: Ief4b654831d20056072a160759b08a0c7af30f5c
Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/875
Reviewed-by: <mailman@uniontech.com>
Reviewed-by: wangwei <wangwei@uniontech.com>
Reviewed-by: niecheng <niecheng@uniontech.com>
Tested-by: <mailman@uniontech.com>
This commit is contained in:
yexin 2020-07-29 16:12:17 +08:00 committed by wangwei
parent b043d3315d
commit 9fd43e1c4d
4 changed files with 25 additions and 2 deletions

View File

@ -305,6 +305,8 @@ void DockSettings::showDockSettingsMenu()
m_autoHide = false;
bool hasComposite = DWindowManagerHelper::instance()->hasComposite();
// create actions
QList<QAction *> actions;
for (auto *p : m_itemManager->pluginList()) {
@ -319,6 +321,10 @@ void DockSettings::showDockSettingsMenu()
continue;
}
if (name == "multitasking" && !hasComposite) {
continue;
}
QAction *act = new QAction(display, this);
act->setCheckable(true);
act->setChecked(enable);

View File

@ -16,6 +16,7 @@ add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN")
add_library(${PLUGIN_NAME} SHARED ${SRCS} resource.qrc)
set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../)
target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ../../interfaces)
target_link_libraries(${PLUGIN_NAME} PRIVATE
${Qt5DBus_LIBRARIES}
${DtkWidget_LIBRARIES}

View File

@ -22,9 +22,12 @@
#include "multitaskingplugin.h"
#include "../widgets/tipswidget.h"
#include <DWindowManagerHelper>
#include <QIcon>
#define PLUGIN_STATE_KEY "enable"
DGUI_USE_NAMESPACE
using namespace Dock;
MultitaskingPlugin::MultitaskingPlugin(QObject *parent)
@ -34,6 +37,17 @@ MultitaskingPlugin::MultitaskingPlugin(QObject *parent)
{
m_tipsLabel->setVisible(false);
m_tipsLabel->setObjectName("multitasking");
connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::hasCompositeChanged, this, [ = ] {
if (!m_proxyInter)
return;
if (DWindowManagerHelper::instance()->hasComposite()) {
m_proxyInter->itemAdded(this, PLUGIN_KEY);
} else {
m_proxyInter->itemRemoved(this, PLUGIN_KEY);
}
});
}
const QString MultitaskingPlugin::pluginName() const
@ -165,10 +179,11 @@ PluginsItemInterface::PluginType MultitaskingPlugin::type()
void MultitaskingPlugin::updateVisible()
{
if (pluginIsDisable())
if (pluginIsDisable() || !DWindowManagerHelper::instance()->hasComposite()) {
m_proxyInter->itemRemoved(this, PLUGIN_KEY);
else
} else {
m_proxyInter->itemAdded(this, PLUGIN_KEY);
}
}
void MultitaskingPlugin::loadPlugin()

View File

@ -26,6 +26,7 @@
#include "multitaskingwidget.h"
#include <QLabel>
namespace Dock {
class TipsWidget;
}