mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-05-30 22:01:41 +00:00
chore: resolve v23 merge conflicts
log:
This commit is contained in:
commit
2f185bf3ce
4
.gitignore
vendored
4
.gitignore
vendored
@ -22,3 +22,7 @@ CMakeLists.txt.user*
|
||||
# binary file
|
||||
dde-dock
|
||||
.vscode
|
||||
|
||||
*/dbusinterface/generation_dbus_interface/
|
||||
*/*/dbusinterface/generation_dbus_interface/
|
||||
.transifexrc
|
||||
|
3
.project
3
.project
@ -2,6 +2,5 @@
|
||||
"type": "homebrew" | "opensource",
|
||||
"3rdparty: ["*.xml"],
|
||||
"ignore": ["CHANGELOG.md", "./debian", "README.md", "./cmake", "technology-overview.md", "CMakeLists.txt", "CMakeLists.txt.user", "./plugins/plugin-guide", "./.tx", "*.qrc", "*.svg", "*.png", "*.qm", "*.ts"],
|
||||
"license": ["LICENSE"],
|
||||
"importantFile": ["gschema/com.deepin.dde.dock.module.gschema.xml", "interfaces/constants.h", "interfaces/pluginproxyinterface.h", "interfaces/pluginsiteminterface.h"]
|
||||
"license": ["LICENSE"]
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ Copyright: None
|
||||
License: CC0-1.0
|
||||
|
||||
# xml toml json policy yaml
|
||||
Files: gschema/*.xml plugins/*.xml frame/*.xml .clog.toml plugins/*.json configs/*.json .packit.yaml .tx/config plugins/overlay-warning/com.deepin.dde.dock.overlay.policy plugins/dcc-dock-plugin/.tx/config
|
||||
Files: gschema/*.xml plugins/*.xml frame/*.xml .clog.toml plugins/*.json configs/*.json .packit.yaml .tx/config .tx/deepin.conf plugins/overlay-warning/com.deepin.dde.dock.overlay.policy plugins/dcc-dock-plugin/.tx/config
|
||||
Copyright: None
|
||||
License: CC0-1.0
|
||||
|
||||
@ -56,4 +56,9 @@ License: CC0-1.0
|
||||
# xml2cpp
|
||||
Files: frame/dbus/* plugins/disk-mount/dbus/dbusdiskmount.* plugins/power/dbus/dbuspower.* plugins/shutdown/dbus/dbuspowermanager.* plugins/tray/dbus/dbustraymanager.*
|
||||
Copyright: The Qt Company Ltd.
|
||||
License: CC0-1.0
|
||||
License: CC0-1.0
|
||||
|
||||
# policy kit
|
||||
Files: plugins/overlay-warning/org.deepin.dde.dock.overlay.policy
|
||||
Copyright: UnionTech Software Technology Co., Ltd.
|
||||
License: LGPL-3.0-or-later
|
||||
|
@ -1,10 +1,10 @@
|
||||
[main]
|
||||
host = https://www.transifex.com
|
||||
minimum_perc = 80
|
||||
mode = developer
|
||||
|
||||
[deepin-desktop-environment.dde-dock]
|
||||
file_filter = translations/dde-dock_<lang>.ts
|
||||
minimum_perc = 0
|
||||
source_file = translations/dde-dock.ts
|
||||
source_lang = en
|
||||
type = QT
|
||||
|
||||
|
2
.tx/deepin.conf
Normal file
2
.tx/deepin.conf
Normal file
@ -0,0 +1,2 @@
|
||||
[transifex]
|
||||
branch = m20
|
@ -6,6 +6,11 @@ endif()
|
||||
|
||||
project(dde-dock)
|
||||
|
||||
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
|
||||
set(CMAKE_HAVE_THREADS_LIBRARY 1)
|
||||
set(CMAKE_USE_PTHREADS_INIT 1)
|
||||
set(CMAKE_PREFER_PTHREAD_FLAG ON)
|
||||
|
||||
#set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
@ -45,6 +50,25 @@ if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "sw_64")
|
||||
add_definitions(-DDISABLE_SHOW_ANIMATION)
|
||||
endif()
|
||||
|
||||
function(generation_dbus_interface xmldir outdir)
|
||||
IF(EXISTS ${outdir})
|
||||
file(REMOVE_RECURSE ${outdir})
|
||||
ENDIF()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${outdir})
|
||||
file(GLOB_RECURSE allXmls ${xmldir}/*.xml)
|
||||
foreach(XMLFILE ${allXmls})
|
||||
string(FIND ${XMLFILE} "/" INDEX REVERSE)
|
||||
string(SUBSTRING ${XMLFILE} ${INDEX} -1 classname)
|
||||
string(REPLACE "/" "" classname ${classname})
|
||||
string(REPLACE ".xml" "" classname ${classname})
|
||||
string(REPLACE "." "_" classname ${classname})
|
||||
string(TOLOWER ${classname} filename)
|
||||
|
||||
execute_process(COMMAND qdbusxml2cpp-fix -c ${classname} -p ${outdir}/${filename} ${XMLFILE}
|
||||
WORKING_DIRECTORY ${outdir})
|
||||
endforeach()
|
||||
endfunction(generation_dbus_interface)
|
||||
|
||||
file(GLOB INTERFACES "interfaces/*.h")
|
||||
|
||||
#因为单元测试需要直接测试源代码,而主程序代码中include的单元使用了相对路径
|
||||
@ -59,9 +83,12 @@ include_directories(
|
||||
frame/item
|
||||
frame/item/components
|
||||
frame/item/resources
|
||||
frame/model
|
||||
frame/util
|
||||
frame/window
|
||||
frame/window/components
|
||||
frame/window/tray
|
||||
frame/window/tray/widgets
|
||||
frame/xcb
|
||||
../widgets
|
||||
../interfaces
|
||||
@ -72,11 +99,14 @@ aux_source_directory(frame/dbus DBUS)
|
||||
aux_source_directory(frame/dbus/sni SNI)
|
||||
aux_source_directory(frame/display DISPLAY)
|
||||
aux_source_directory(frame/item ITEM)
|
||||
aux_source_directory(frame/model MODEL)
|
||||
aux_source_directory(frame/item/components ITEMCOMPONENTS)
|
||||
aux_source_directory(frame/item/resources RESOURCES)
|
||||
aux_source_directory(frame/util UTIL)
|
||||
aux_source_directory(frame/window WINDOW)
|
||||
aux_source_directory(frame/window/components WINDOWCOMPONENTS)
|
||||
aux_source_directory(frame/window/tray WINDOWTRAY)
|
||||
aux_source_directory(frame/window/tray/widgets WINDOWTRAYWIDGET)
|
||||
aux_source_directory(frame/xcb XCB)
|
||||
|
||||
file(GLOB SRC_PATH
|
||||
@ -86,16 +116,19 @@ file(GLOB SRC_PATH
|
||||
${SNI}
|
||||
${DISPLAY}
|
||||
${ITEM}
|
||||
${MODEL}
|
||||
${ITEMCOMPONENTS}
|
||||
${UTIL}
|
||||
${WINDOW}
|
||||
${WINDOWCOMPONENTS}
|
||||
${WINDOWTRAY}
|
||||
${WINDOWTRAYWIDGET}
|
||||
${XCB}
|
||||
)
|
||||
|
||||
add_subdirectory("frame")
|
||||
add_subdirectory("plugins")
|
||||
add_subdirectory("tests")
|
||||
#add_subdirectory("tests")
|
||||
|
||||
# Install settings
|
||||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||
@ -125,6 +158,10 @@ install(FILES "cmake/DdeDock/DdeDockConfig.cmake"
|
||||
install(FILES gschema/com.deepin.dde.dock.module.gschema.xml
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/glib-2.0/schemas)
|
||||
|
||||
#dconfig
|
||||
file(GLOB DCONFIG_FILES "configs/*.json")
|
||||
install(FILES ${DCONFIG_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/dsg/configs/dde-dock/)
|
||||
|
||||
# Address Sanitizer 内存错误检测工具,打开下面的编译选项可以看到调试信息,正常运行时不需要这些信息
|
||||
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=address -O2")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address -O2")
|
||||
|
40
configs/com.deepin.dde.dock.dconfig.json
Normal file
40
configs/com.deepin.dde.dock.dconfig.json
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
"magic":"dsg.config.meta",
|
||||
"version":"1.0",
|
||||
"contents":{
|
||||
"Dock_Show_Window_name":{
|
||||
"value":0,
|
||||
"serial":0,
|
||||
"flags":"",
|
||||
"name":"小窗口显示窗口名称",
|
||||
"name[zh_CN]":"小窗口显示窗口名称",
|
||||
"description[zh_CN]":"提供鼠标悬停小窗口标题显示配置,默认为悬停显示: \
|
||||
当配置为全部显示时,鼠标悬停在任务栏图标位置时所有预览窗口显示标题信息; \
|
||||
当配置为悬停显示时,鼠标仅在悬停在预览小窗口时在当前窗口显示标题信息; \
|
||||
当配置为不显示时,鼠标悬停应用位置和预览小窗口位置时都不显示标题信息;",
|
||||
"description":"0 Mouse over show;1 Always show; 2 Always hide",
|
||||
"permissions":"readwrite",
|
||||
"visibility":"public"
|
||||
},
|
||||
"Dock_Quick_Plugins": {
|
||||
"value": ["power", "network", "shutdown", "trash"],
|
||||
"serial": 0,
|
||||
"flags": [],
|
||||
"name": "显示在任务栏上的快捷插件",
|
||||
"name[zh_CN]": "*****",
|
||||
"description": "记录哪些插件的图标在任务栏启动的时候显示在任务栏上",
|
||||
"permissions": "readwrite",
|
||||
"visibility": "private"
|
||||
},
|
||||
"Dock_Quick_Tray_Name": {
|
||||
"value": ["fcitx", "indicator:keybord_layout"],
|
||||
"serial": 0,
|
||||
"flags": [],
|
||||
"name": "显示在任务栏上的托盘图标",
|
||||
"name[zh_CN]": "任务栏上固定的托盘图标",
|
||||
"description": "记录哪些托盘的图标在任务栏启动的时候显示在任务栏上",
|
||||
"permissions": "readwrite",
|
||||
"visibility": "private"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
{
|
||||
"magic":"dsg.config.meta",
|
||||
"version":"1.0",
|
||||
"contents":{
|
||||
"showWindowName":{
|
||||
"value":0,
|
||||
"serial":0,
|
||||
"flags":[],
|
||||
"name":"小窗口显示窗口名称",
|
||||
"name[zh_CN]":"小窗口显示窗口名称",
|
||||
"description[zh_CN]":"提供鼠标悬停小窗口标题显示配置,默认为悬停显示: \
|
||||
当配置为全部显示时,鼠标悬停在任务栏图标位置时所有预览窗口显示标题信息; \
|
||||
当配置为悬停显示时,鼠标仅在悬停在预览小窗口时在当前窗口显示标题信息; \
|
||||
当配置为不显示时,鼠标悬停应用位置和预览小窗口位置时都不显示标题信息;",
|
||||
"description":"0 Mouse over show;1 Always show; 2 Always hide",
|
||||
"permissions":"readwrite",
|
||||
"visibility":"private"
|
||||
},
|
||||
"alwaysHideDock":{
|
||||
"value": false,
|
||||
"serial": 0,
|
||||
"flags":[],
|
||||
"name":"alwaysHideDock",
|
||||
"name[zh_CN]":"一直隐藏",
|
||||
"description[zh_CN]":"当设置为true时,即使鼠标放在任务栏区域也不会显示任务栏;配置即时生效",
|
||||
"description":"ture: Dock is hidden all the time, false: Depend on other settings of dock",
|
||||
"permissions":"readwrite",
|
||||
"visibility":"private"
|
||||
},
|
||||
"toggleDesktopInterval":{
|
||||
"value": 0,
|
||||
"serial": 0,
|
||||
"flags":[],
|
||||
"name":"toggleDesktopInterval",
|
||||
"name[zh_CN]":"显示(或恢复)桌面的悬浮时间间隔",
|
||||
"description[zh_CN]":"显示(或恢复)桌面将在悬停间隔后切换(以毫秒为单位)",
|
||||
"description":"show(or restore) desktop will toggle after the hover interval (in milliseconds)",
|
||||
"permissions":"readwrite",
|
||||
"visibility":"private"
|
||||
},
|
||||
"delayIntervalOnHide":{
|
||||
"value": 0,
|
||||
"serial": 0,
|
||||
"flags":[],
|
||||
"name":"delayIntervalOnHide",
|
||||
"name[zh_CN]":"任务栏隐藏状态时,从当前屏幕显示时的延时显示时间",
|
||||
"description[zh_CN]":"任务栏智能隐藏或一直隐藏时,鼠标移动到当前所在屏幕边缘过一段时间再唤起任务栏(以毫秒为单位)",
|
||||
"description":"When the dock is hidden, move the mouse to the edge of the current screen and then recall the dock (in milliseconds)",
|
||||
"permissions":"readwrite",
|
||||
"visibility":"private"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
{
|
||||
"magic":"dsg.config.meta",
|
||||
"version":"1.0",
|
||||
"contents":{
|
||||
"contextMenu":{
|
||||
"value": ["Shutdown", "Reboot", "Suspend", "Hibernate", "Lock", "Logout", "SwitchUser", "PowerSettings"],
|
||||
"serial": 0,
|
||||
"flags": [],
|
||||
"name": "ContextMenu",
|
||||
"name[zh_CN]": "电源按钮右键菜单",
|
||||
"description[zh_CN]": "电源界面的右键菜单内容,如需不显示某个选项,移除即可;默认值:\"Shutdown\", \"Reboot\", \"Suspend\", \"Hibernate\", \"Lock\", \"Logout\", \"SwitchUser\", \"PowerSettings\";",
|
||||
"description":"",
|
||||
"permissions":"readwrite",
|
||||
"visibility":"private"
|
||||
}
|
||||
}
|
||||
}
|
257
debian/changelog
vendored
257
debian/changelog
vendored
@ -1,4 +1,257 @@
|
||||
dde-dock (3.0.12) unstable; urgency=low
|
||||
dde-dock (6.0.9.2) unstable; urgency=medium
|
||||
|
||||
[ TagBuilder ]
|
||||
* fix: 修复拖动插件到任务栏后所有插件都显示的问题(Bug: 181945)(Influence: 默认所有的快捷面板中的插件都在任务栏显示,从控制中心取消所有插件的勾选,然后从快捷面板拖动一个插件到任务栏,观察任务栏插件显示情况)
|
||||
* fix: 修复切换主题快捷面板插件主题颜色没有变化(Bug: 184085)(Influence: 打开快捷面板,切换主题,观察图标颜色显示是否正常)
|
||||
|
||||
-- lvpeilong <lvpeilong@uniontech.com> Thu, 02 Feb 2023 13:30:36 +0800
|
||||
|
||||
dde-dock (6.0.9.1) unstable; urgency=medium
|
||||
|
||||
[ TagBuilder ]
|
||||
* chore: 更新changelog(Task: 227573)(Influence: 版本号)
|
||||
* fix: 修复移除蓝牙设备后任务栏插件不消失的问题(Bug: 181945)(Influence: 插上蓝牙,从控制中心勾选该插件,在任务栏显示,然后移除蓝牙设备,观察任务栏的蓝牙图标是否消失)
|
||||
* fix: 修复从任务栏向上拖动插件引起任务栏崩溃的问题(Bug: 181945)(Influence: 从任务栏向上拖动插件,观察任务栏是否正常)
|
||||
* fix: 修复从托盘拖动图标到任务栏引起崩溃的问题(Bug: 181945)(Influence: 将托盘图标拖动到任务栏)
|
||||
* fix: 修改插件区域出现重复的电池图标问题(Bug: 184085)(Influence: 任务栏-电池图标状态刷新)
|
||||
* fix: 修复高缩放率下图标显示异常的问题(Bug: 183543, 184089)(Influence: 高分屏,高缩放率,观察任务栏插件区域的图标)
|
||||
* fix: 修复系统主题变化后快捷面板电池颜色显示错误的问题(Bug: 184085)(Influence: 打开快捷面板,在控制中心更改系统颜色,观察快捷面板中系统电池图标是否跟随系统颜色变化)
|
||||
* fix: 更新翻译文案(Task: 226203)(Influence: 从笔记本上观察控制中心个性化中电池的文案)
|
||||
|
||||
-- lvpeilong <lvpeilong@uniontech.com> Wed, 01 Feb 2023 15:26:25 +0800
|
||||
|
||||
dde-dock (6.0.8.1) unstable; urgency=medium
|
||||
|
||||
[ TagBuilder ]
|
||||
* style: 解决编译不通过的问题(Task: 96831)(Influence: gerrit打包)
|
||||
* fix: 修复键盘布局插件不响应键盘布局变化的问题(Task: 225011)(Influence: 社区版,从控制中心不断新增和删除键盘布局,观察布局插件是否显示隐藏)
|
||||
* feat: 加载插件流程移动到插件里单独加载(Task: 222353)(Influence: 加载插件)
|
||||
* feat: 加载基本插件(Task: 222353)(Influence: 插件加载)
|
||||
* fix: 点击插件弹出自己的列表(Task: 222353)(Influence: 点击插件,观察是否弹出插件自己对应的列表,如果没有弹出列表,则触发这个插件的功能)
|
||||
* chore: 删除多余的文件(Task: 222353)(Influence: 无)
|
||||
* fix: 调整插件的尺寸(Task: 222353)(Influence: 观察任务栏插件是否对齐)
|
||||
* fix: 修复移除蓝牙后弹框依然显示的问题(Bug: 181945)(Influence: 点击任务栏的蓝牙图标,弹出蓝牙弹窗,然后移除蓝牙,观察蓝牙的弹窗是否存在)
|
||||
* fix: 优化插件图标样式(Task: 181945)(Influence: 图标样式)
|
||||
* feat: 高效模式下最右侧增加显示桌面区域(Bug: 180859)(Influence: 进入高效模式,鼠标进入最右侧,点击,观察是否可以正常显示桌面)
|
||||
* fix: 修复高缩放率下固定区域图标和回收站图标显示异常的问题(Bug: 182673)(Influence: 1.25倍缩放率下,选择非默认主题,观察任务栏显示桌面、多任务试图和回收站的图标大小是否正常)
|
||||
* fix: 修复高缩放率下插件图标显示异常的问题(Bug: 183543)(Influence: 高分屏,设置缩放率为最高,观察任务栏插件区域的图标显示是否正常)
|
||||
* fix: 修复展开托盘无法通过菜单移除U盘的问题(Bug: 182299)(Influence: 插入U盘,打开托盘区,右键菜单,点击,观察功能是否生效)
|
||||
* fix: 解决任务栏时间日期文字显示异常的问题(Bug: 181387)(Influence: 时间和日期显示)
|
||||
* fix: 修复图标异常问题(Bug: 181723)(Influence: 高缩放率下,观察组合图标显示是否正常)
|
||||
* fix: 根据设计图调整插件位置(Bug: 181251)(Influence: 声音、亮度调整和媒体播放的显示位置)
|
||||
* fix: 修复任务栏适应不同的主题(Bug: 179377)(Influence: 从控制中心修改主题颜色,观察任务栏快捷面板的主题颜色是否发生变化)
|
||||
* fix: 修复快捷面板插件子面板无法关闭主面板的问题(Bug: 222353)(Influence: 进入快捷面板的蓝牙子界面点击设置,进入声音子界面点击设置,进入亮度调整子界面点击设置,在弹出对应的功能后,观察快捷面板是否隐藏)
|
||||
* fix: 修复高效模式下无法打开企业微信的问题(Bug: 182065)(Influence: 进入高效模式,打开企业微信和微信等应用,观察是否正常打开窗口)
|
||||
|
||||
-- zhaoyingzhen <zhaoyingzhen@uniontech.com> Fri, 13 Jan 2023 11:37:21 +0800
|
||||
|
||||
dde-dock (6.0.7) unstable; urgency=medium
|
||||
|
||||
[ TagBuilder ]
|
||||
* fix: 修复插件显示尺寸问题(Bug: 179083)(Influence: 截图-查看截图计时插件是否正常显示)
|
||||
* fix: 任务栏协同不显示安卓设备。(Task: 233323)(Influence: 设备列表不显示安卓设备。)
|
||||
* fix: 修复文案显示错误(Bug: 180959)(Influence: 任务栏最右侧的电源按钮)
|
||||
* fix: 更新翻译文件(Bug: 180959)(Influence: 任务栏-电源,观察电源的文本)
|
||||
|
||||
-- lvpeilong <lvpeilong@uniontech.com> Fri, 06 Jan 2023 16:32:53 +0800
|
||||
|
||||
dde-dock (6.0.6.1) unstable; urgency=medium
|
||||
|
||||
[ TagBuilder ]
|
||||
* fix: 修复向上拖动图标引起任务栏崩溃的问题(Bug: 179427)(Influence: 从任务栏向上拖动快捷图标,观察任务栏是否正常)
|
||||
* fix: 声音插件滚轮调节音量(Bug: 172417)(Influence: 将鼠标放在任务栏声音图标上,滚动滚轮,观察音量大小是否调节)
|
||||
* fix: 增加强制在任务栏显示插件的接口(Task: 226407)(Bug: 179083)(Influence: 截图,观察任务栏是否有计时的图标)
|
||||
* fix: 修复高缩放率下显示问题(Bug: 176421)(Influence: 设置高缩放率,观察开始菜单的位置,任务栏图标占满区域,左右位置,观察任务栏图标是否拥挤)
|
||||
|
||||
-- zhaoyingzhen <zhaoyingzhen@uniontech.com> Thu, 29 Dec 2022 15:13:58 +0800
|
||||
|
||||
dde-dock (6.0.5.1) unstable; urgency=medium
|
||||
|
||||
[ TagBuilder ]
|
||||
* feat: 蓝牙插件适应快捷插件接口(Task: 121387)(Influence: 任务栏-快捷设置-蓝牙)
|
||||
* fix: 修复高缩放率下启动器位置显示错误和无法设置智能隐藏的问题(Bug: 154513, 157413)(Influence: 前提:屏幕分辨率设置为1.25;1、任务栏设置为智能隐藏,将窗口拖动到任务栏下方,观察任务栏是否隐藏;2、观察启动器的位置是否正确)
|
||||
* fix: 修复从任务栏拖动图标分屏后鼠标回到任务栏遮罩不消失的问题(Task: 181523)(Influence: 从任务栏拖动图标到桌面,不松手,然后再回到任务栏,观察遮罩是否消失)
|
||||
* fix: 修复部分托盘无图标的问题(Bug: 160761)(Influence: 安全中心、授权管理等应用的托盘图标)
|
||||
* fix: 修复跨端协同设备数量变化时列表页面显示不全的问题。(Influence: 跨端协同设备变化时,页面显示。)
|
||||
* feat: 高效模式增加加载插件的功能(Task: 112073)(Influence: 高效模式下加载插件)
|
||||
* feat: 适配v20插件加载(Task: 112073)(Influence: 加载v20插件)
|
||||
* fix: 加载系统托盘插件(Task: 112073)(Influence: 插入U盘,查看托盘区域是否有U盘图标)
|
||||
* fix: 托盘跟随高效模式调整任务栏位置(Task: 112073)(Influence: 高效模式下,调整任务栏位置,观察托盘区域是否正常)
|
||||
* fix: 修复任务栏没有加载显示桌面和多任务视图的问题(Task: 112073)(Influence: 任务栏查看是否存在显示桌面和多任务栏视图的插件)
|
||||
* feat: 图标增加toolTip和菜单(Task: 112073)(Influence: 鼠标放入到托盘区域、快捷插件区域,关机区域,观察是否存在toolTip,右键,观察是否弹出菜单)
|
||||
* fix: 实现高效模式下托盘和快捷插件拖动功能(Task: 112073)(Influence: 高效模式,从托盘或快捷面板拖动图标到任务栏)
|
||||
* feat: 快捷面板支持插件控制区域的显示(Task: 208579)(Influence: 快捷面板,观察声音、亮度调整和音乐播放等功能是否显示正常)
|
||||
* feat: 声音插件适配v23(Task: 210309)(Influence: 观察任务栏是否存在声音插件)
|
||||
* style: 消除编译警告信息(Task: 96831)(Influence: 无)
|
||||
* fix: 删除编译警告(Task: 96831)(Influence: 无)
|
||||
* style: 修改快捷区域key值(Task: 96831)(Influence: 无)
|
||||
* fix: 修复快捷面板应用打开详细页面位置错误的问题(Task: 211641)(Influence: 从快捷面板展开蓝牙或者网络右侧的展开按钮,观察是否显示正常)
|
||||
* fix: 解决任务栏跨端协同在paired状态变化后主动请求协同连接的问题。(Influence: 任务栏设备协同连接功能。)
|
||||
* style: 枚举变量的信号传递去掉引用(Task: 96831)(Influence: 无)
|
||||
* fix: 修复快捷面板没有刷新最新状态图的问题(Task: 208069)(Influence: 笔记本上打开快捷面板,拔掉电源或插上电源,观察电池状态是否发生变化)
|
||||
* fix: 修改任务栏加载老版本插件的方式(Task: 112073)(Influence: 任务栏启动的时候,观察老版本的插件(例如U盘插件等其他v20插件)是否正常加载)
|
||||
* fix: 优化快捷面板显示插件区域的方式(Task: 189527)(Influence: 打开快捷面板,观察插件是否正常显示)
|
||||
* feat: 完善onboard插件的接口(Task: 212611)(Influence: 快捷面板观察onboard插件是否正常显示)
|
||||
* fix: 修复时尚模型下图标铺满任务栏的显示问题(Task: 150049)(Influence: 时尚模式下,不断向任务栏添加图标,知道铺满,观察任务栏是否在屏幕可见区域内)
|
||||
* fix: 适配最新版本的dtk(Task: 213083)(Influence: 无)
|
||||
* fix: 修复声音设置错误(Task: 210309)(Influence: 打开快捷设置面板,通过滑动条来调整声音,观察声音是否在设置的范围内,同时观察主面板和子面板两边的声音滑动条是否同步)
|
||||
* fix: 修复鼠标放到任务栏上拖动区域尺寸错误的问题(Task: 213103)(Influence: 任务栏在下方的时候,鼠标放入任务栏上方的位置,观察鼠标形状是否正常)
|
||||
* fix: 修复关机图标与插件区域间距过大的问题(Task: 112073)(Influence: 高效模式下,观察关机图标与左右侧插件和时间的距离)
|
||||
* fix: 修复高效模式下关机按钮显示文本的问题(Task: 112073)(Influence: 高效模式下,调整任务栏到最高,观察关机按钮的显示)
|
||||
* fix: 修复托盘图标显示异常的问题(Task: 213361)(Influence: 观察输入法是否正常显示,将托盘图标从托盘拖动到任务栏,观察该图标是否在展开托盘图标和输入法中间)
|
||||
* fix: 修复部分命令无法执行的问题(Task: 213403)(Influence: 任务栏关机命令观察是否正常执行)
|
||||
* fix: 修复wayland下部分托盘的tooltips显示异常(Bug: 157821)(Influence: 进入wayland,打开音乐,鼠标放入到音乐图标上,观察是否正常显示提示消息)
|
||||
* fix: 修复已打开应用缩略图显示位置偏差(Bug: 165775)(Influence: 鼠标放入到已经打开的应用的上方,观察预览图的位置显示是否正常)
|
||||
* fix: 修复右键插件区域再单击弹出菜单的问题(Bug: 171559)(Influence: 右键插件区域,再左键,观察插件区域菜单是否正常显示)
|
||||
* fix: 修复插件右键菜单不响应的问题(Bug: 164381)(Influence: 右键菜单区域,点击某个菜单项,观察是否正常响应)
|
||||
* fix: 修复任务栏点击时间设置崩溃的问题(Bug: 171511)(Influence: 任务栏右键时间区域,打开时间设置,观察是否正常打开控制中心的时间设置)
|
||||
* fix: 修复拖动无打开窗口触发分屏后自动打开应用的问题(Bug: 154349)(Influence: 从任务栏拖动一个没有打开窗口的应用,观察是否打开应用(正常情况下不会打开应用),释放鼠标,观察应用图标是否回到任务栏上)
|
||||
* fix: 修复wayland下打开快捷面板tooltip没有隐藏的问题(Bug: 171551)(Influence: 进入wayland,鼠标放在任务栏的插件上,点击应用弹出快捷面板,观察toolTip是否消失)
|
||||
* fix: 修复点击快捷面板之外的区域快捷面板不关闭的问题(Bug: 171545, 171583)(Influence: 进入wayland,打开快捷面板,点击快捷面板之外的其他区域,观察快捷面板是否关闭)
|
||||
* fix: 去掉部分插件的右键菜单(Bug: 171753)(Influence: 右键蓝牙、声音等插件,观察是否有右键菜单)
|
||||
* fix: 修复任务栏中拖拽图标到桌面区域图标消失的问题(Bug: 171539)(Influence: 将托盘图标从任务栏快速向上拖动,观察任务栏托盘的图标是否还存在)
|
||||
* style: 修改函数接口调用(Task: 96831)(Influence: 无)
|
||||
* fix: 同步启动器的修改(Bug: 147753)(Influence: 从启动器应用列表-拖拽到任务栏-回收站-卸载应用功能正常)
|
||||
* fix: 修复从托盘拖动应用到任务栏上面图标显示异常的问题(Bug: 171493)(Influence: 将安全中心等图标从托盘拖动到任务栏,观察图标是否重复)
|
||||
* feat: 增加返回给控制中心设置插件和托盘应用的接口(Task: 216841)(Influence: 无)
|
||||
* fix: 修复移除插件后快捷面板显示异常的问题(Bug: 171579)(Influence: 不断插入或者移除蓝牙设备,观察快捷面板是否显示正常)
|
||||
* fix: 修复关闭窗口特效下启动器按钮被遮挡的问题(Task: 216977)(Influence: 关闭窗口特效的时候,观察启动器按钮是否正常显示)
|
||||
* fix: 修复快捷面板弹出位置不准确的问题(Bug: 172213)(Influence: 从任务栏不同的插件图标点击,观察弹出快捷面板的位置)
|
||||
* fix: 电池插件不显示在快捷面板(Bug: 171713)(Influence: 从笔记本上,打开快捷面板,观察是否存在电池图标)
|
||||
* fix: 修复高缩放率下无法点击快捷面板的问题(Task: 218215)(Influence: 在1.25倍缩放率下,展开快捷面板,点击网络插件展开按钮,观察是否可以展开)
|
||||
* fix: 修复蓝牙列表中设备顺序与控制中心不一致的问题(Bug: 171513)(Influence: 打开快捷面板中的蓝牙列表,在多个设备同时存在的情况下,观察设备顺序是否和控制中心一致)
|
||||
* chore: 设置日志格式(Task: 124695)(Influence: 无)
|
||||
* fix: 修复音量插件调节最小刻度不是%2的问题(Bug: 172417)(Influence: 音量插件调节)
|
||||
* fix: 修复亮度插件无法调整到100的问题(Bug: 171869)(Influence: 任务栏-亮度插件调节)
|
||||
* fix: 修复插件展开列表名称显示错误的问题(Task: 218733)(Influence: 从快捷面板打开网络列表,观察标题是否为网络)
|
||||
* fix: 修复快捷面板中音量调节不响应音量增强设置的问题(Bug: 171869)(Influence: 任务栏-音量插件-音量增强时的交互)
|
||||
* fix: 解決协同连接设备时关闭协同服务总开关导致任务栏崩溃的问题。(Bug: 171741)(Influence: 协同连接设备.)
|
||||
* fix: 从任务栏移除托盘图标后放入托盘区(Bug: 171497, 171539)(Influence: 将图标从任务栏移出,松手后图标自动移到托盘区)
|
||||
* fix: 增加对控制中心设置不同主题下图标的接口(Bug: 172365)(Influence: 在控制中心切换主题,观察图标是否发生变化)
|
||||
* fix: 去掉电池的右键菜单(Bug: 171753)(Influence: 右键电池插件,观察是否存在菜单)
|
||||
* fix: 修复移除蓝牙设备后快捷面板依然显示的问题(Bug: 171533)(Influence: 从电脑上移除蓝牙设备,观察快捷区域和快捷面板是否还有蓝牙图标)
|
||||
* fix: 修复从控制中心第一次连接需要密码的网络没有弹出网络面板的问题(Bug: 150395)(Influence: 从控制中心第一次连接需要密码的网络,观察任务栏是否显示网络列表)
|
||||
* fix: 适配v20插件在任务栏的显示(Task: 112073)(Influence: 任务栏显示v20插件)
|
||||
* fix: 修复插入新的蓝牙设备后其他蓝牙设备自动关闭的问题(Bug: 171477)(Influence: 系统中已经存在一个蓝牙设备,且是打开状态,打开快捷面板,进入蓝牙详情页面,插入新的蓝牙设备,观察之前的蓝牙设备是否自动关闭)
|
||||
* fix: 修复快捷面板展开后点击任务栏应用无法打开的问题(Bug: 166029)(Influence: 打开快捷面板,再打开任务栏应用,观察是否在关闭快捷面板的同时打开了任务栏的应用)
|
||||
* fix: 修复任务栏插件音量设备显示错误的问题(Bug: 165853)(Influence: 从任务栏打开音量,进入音量的详情页面,观察是否和控制中心一致)
|
||||
* fix: 修复快捷面板蓝牙状态显示错误的问题(Bug: 171419)(Influence: 点击蓝牙图标,观察快捷面板蓝牙的打开或者关闭的状态)
|
||||
* fix: 完善音量功能(Bug: 172429)(Influence: 从控制中心关闭设备,观察任务栏设备状态是否发生变化)
|
||||
* feat: 插件增加标记(Task: 220099)(Influence: 任务栏插件)
|
||||
* fix: 插件根据标记来决定插件的类型(Task: 220099)(Influence: 任务栏插件类型)
|
||||
* feat: 增加display插件(Task: 220489)(Influence: 展开任务栏快捷面板,观察是否有亮度设置相关的功能)
|
||||
* fix: 移除代码中对显示相关的插件的引用(Task: 220489)(Influence: 无)
|
||||
* fix: 修复wayland下无法拖动任务栏的问题(Task: 220523)(Influence: 进入wayland,鼠标移动到任务栏边缘,观察鼠标形状是否改变,能否正常调整任务栏尺寸)
|
||||
* fix: 修复快捷面板没有自动刷新图标的问题(Task: 220599)(Influence: 执行快捷面板中的截图图标,观察图标是否发生变化)
|
||||
* fix: 新增或移除显示屏插件自动添加或删除(Task: 220489)(Influence: 拔出显示屏后再插入显示屏,观察任务栏快捷面板中的亮度设置插件是否发生变化)
|
||||
* fix: 修复音量增强未响应的问题(Bug: 171869)(Influence: 任务栏-音量-音量增强)
|
||||
* feat: 将音乐播放功能提取为单独的插件(Task: 220489)(Influence: 无)
|
||||
* fix: dock代码中移除音乐插件(Task: 220489)(Influence: 打开音乐播放器,任务栏快捷面板中显示音乐播放面板)
|
||||
* fix: 修复控制中心显示多条重复控件的问题(Bug: 171581)(Influence: 控制中心-个性化,观察蓝牙或者任务栏等插件是否只显示一次)
|
||||
* feat: 增加回收站和电源插件在控制中心的显示和隐藏(Task: 216841)(Influence: 从控制中心勾选或者取消勾选回收站和电源插件,观察任务栏的变化)
|
||||
* fix: 修复wayland下智能隐藏偶尔失效的问题(Bug: 154513)(Influence: 进入wayland,任务栏设置为智能隐藏,从任务栏打开一个窗口,观察智能隐藏是否有效果)
|
||||
* fix: 修复wayland下高效模式设置任务栏struct失效的问题(Bug: 150637)(Influence: 进入wayland-任务栏设置为一直隐藏或智能隐藏,窗体最大化,让任务栏显示隐藏,观察任务栏窗体是否发生变化)
|
||||
* docs: 更新插件开发文档(Task: 221667)(Influence: 无)
|
||||
* feat: 任务栏适配不同主题的插件图标(Task: 222025)(Influence: 切换不同的主题,观察图标是否发生变化)
|
||||
* fix: 插件适配不同主题图标(Task: 222025)(Influence: 切换主题,观察任务栏的图标和控制中心个性化中的图标是否发生了变化)
|
||||
* fix: 去掉插件中读取禁用当前插件的配置(Bug: 175085)(Influence: 插入蓝牙观察是否有蓝牙图标)
|
||||
* fix: 修复从任务栏拖出托盘应用后托盘不弹出的问题(Bug: 171497)(Influence: 从任务栏拖动微信或企业微信,观察托盘是否弹出)
|
||||
* fix: 修改插件接口(Task: 222025)(Influence: 无)
|
||||
* fix: 修复音量调节控件幅度不正确的问题(Bug: 172417)(Influence: 音量控件调节幅度)
|
||||
* feat: 声音插件滚轮调节音量(Bug: 172417)(Influence: 将鼠标放在任务栏声音图标上,滚动滚轮,观察音量大小是否调节)
|
||||
* fix: 修复U盘插件不显示的问题(Task: 223159)(Influence: 系统中使用v20的U盘插件,插入U盘,查看U盘图标是否显示)
|
||||
* fix: 修复调整任务栏位置后显示错误的问题(Task: 218981)(Influence: 时尚模式下,将任务栏从下方调整在左侧,观察托盘面板显示是否正常)
|
||||
* fix: 修复控制中心调整任务栏尺寸缓慢显示的问题(Bug: 171799)(Influence: 从控制中心个性化调整任务栏尺寸,观察任务栏的尺寸是否正常调整)
|
||||
* chore: V23接口改造适配(Task: 207483)(Influence: 无)
|
||||
* fix: 点击任务栏时间显示窗口呼出小组件面板(Task: 165407)(Influence: 点击任务栏时间窗口小组件是否显示。)
|
||||
* fix: 声音调整改成新接口(Bug: 172417)(Influence: 鼠标移动到任务栏的声音图标,滚动鼠标,声音跟着调整)
|
||||
* fix: 修复无法通过蓝牙主面板开启关闭蓝牙的问题(Bug: 171419)(Influence: 打开快捷面板,点击蓝牙图标,观察蓝牙是否正常开启和关闭)
|
||||
* fix: 修复黑色背景下蓝牙列表名称颜色显示错误(Bug: 167961)(Influence: 改变主题,观察蓝牙列表设备名称的颜色是否改变)
|
||||
* fix: 修复反复开关蓝牙导致的崩溃问题(Task: 226123)(Influence: 蓝牙开关功能)
|
||||
* fix: 修复控制中心调节透明度对任务栏无作用的问题(Task: 226127)(Influence: 任务栏透明度调节)
|
||||
* fix: 适配协同后端接口变化修改。(Bug: 176323)(Influence: 协同设备列表显示)
|
||||
|
||||
-- zhaoyingzhen <zhaoyingzhen@uniontech.com> Tue, 13 Dec 2022 21:15:48 +0800
|
||||
|
||||
dde-dock (6.0.4) unstable; urgency=medium
|
||||
|
||||
[ Deepin Packages Builder ]
|
||||
* fix: 修复托盘图标提示信息显示异常的问题(Bug: 150521)(Influence: 托盘提示信息显示)
|
||||
* fix: 时尚模式时间日期tips有wayland默认tittle(Bug: 149173)(Influence: 任务栏时尚模式下时间日期tips是否显示正常)
|
||||
* fix: 修复多任务视图界面点击任意处均导致任务栏显示右键菜单的问题(Bug: 150507)(Influence: 任务栏右键菜单显示的时机)
|
||||
* feat: 拖动任务栏图标实现分屏效果(Task: 163465)(Influence: 从任务栏拖动图标到屏幕上方,查看是否有分屏功能)
|
||||
* feat: 开启AM宏(Task: 162227)(Influence: 无)
|
||||
* fix: 修复从任务栏无法打开控制中心问题(Bug: 149189)(Influence: 任务栏-任务栏设置-打开控制中心 任务栏-蓝牙-蓝牙设置 任务栏-日期-日期时间设置 任务栏-电源-电源设置 任务栏-关机-关机设置 任务栏-声音-声音设置 观察是否正常打开控制中心)
|
||||
* fix: 时尚模式下日期时间增加右键菜单(Task: 162235)(Influence: 任务栏-时尚模式,右键查看日期时间是否存在时间日期菜单)
|
||||
* fix: 修复从最近使用区域移除驻留后应用图标没有驻留到应用区域最末尾(Bug: 147643)(Influence: 任务栏时尚模式下,在最近使用区域移除驻留,观察移除的驻留是否在区域的末尾)
|
||||
* feat: 增加适配控制中心设置是否使用最近区域的功能(Bug: 147717)(Influence: 开关是否显示最近使用应用,时尚模式下观察最近使用应用是否显示或隐藏)
|
||||
* feat: 增加窗口多开的功能(Task: 170977)(Influence: 控制中心开启多开窗口显示,观察应用打开的窗口是否在对应的位置显示)
|
||||
* feat: 任务栏应用拖动到移除驻留(Bug: 147699)(Influence: 拖动任务栏应用到回收站,观察是否可以移除驻留)
|
||||
* fix: 修复wayland环境下应用打开窗口无法显示预览的问题(Bug: 140919)(Influence: wayland-任务栏打开一个应用窗口,鼠标放入到窗口上,查看预览图)
|
||||
* fix: 任务栏代码结构优化解耦(Bug: 137267, 140029, 134527, 146743, 150293)(Influence: 打开任务栏,观察时尚模式下圆角,左右侧区域中间是否连接在一起等)
|
||||
* feat: 删除插件基类的isPrimary接口(Task: 121387)(Influence: 安装网络插件,查看网络插件是否在快捷设置面板中显示两列图标)
|
||||
* fix: 修改v20的接口为v23的接口(Task: 182009)(Influence: 打开控制中心,鼠标移动唤醒任务栏等操作)
|
||||
* fix: 删除任务栏对libdframeworkdbus-dev库的依赖(Task: 182009)(Influence: 打开控制中心,鼠标移动唤醒任务栏、加载插件等,观察相关功能是否正常)
|
||||
* fix: 修复部分托盘服务对应进程状态异常时导致任务栏卡死问题(Bug: 121947)(Influence: 托盘服务)
|
||||
* feat: 添加任务栏跨端协同操作功能。(Task: 119639)(Influence: 任务栏跨端协同功能。)
|
||||
* fix: 修复任务栏在副屏上方鼠标跟随未移动到左侧的问题(Bug: 147641)(Influence: 开启鼠标跟随,任务栏默认在主屏,鼠标移动到副屏幕,任务栏跟随到副屏幕,改变任务栏位置为上,此时任务栏在副屏幕的上方,将鼠标移动到主屏幕的上方,观察任务栏是否移动到主屏幕的上方)
|
||||
* feat: 删除任务栏中控制中心设置插件(Task: 130353)(Influence: 无)
|
||||
* fix: 时尚模式增加阴影(Bug: 137267)(Influence: 时尚模式观察阴影)
|
||||
* feat: 支持通过环境变量的形式指定插件的路径(Issue: 3402)(Influence: 影响插件加载,对旧插件保持兼容)
|
||||
* fix: 修复wayland环境时尚模式下打开企业微信崩溃的问题(Task: 196629)(Influence: 进入wayland桌面,进入时尚模式,打开企业微信,双击,观察企业微信是否正常打开)
|
||||
* fix: 修复高效模式下托盘入口图标没有跟随位置变化而变化(Bug: 147743)(Influence: 时尚模式下改变任务栏位置,观察托盘入口是否发生变化)
|
||||
* style: 优化CMakeList.txt文件(Task: 96831)(Influence: 无)
|
||||
* fix: 修复开启启动器后鼠标再次点击无法关闭启动器的问题(Task: 198183)(Influence: 从任务栏点击鼠标开启启动器,再次点击鼠标,观察启动器是否收缩)
|
||||
* fix: 修复wayland下窗口预览为空的问题(Bug: 140919, 150475)(Influence: 进入wayland,鼠标放入任务栏已经打开的窗口图标上,观察预览图是否显示)
|
||||
* fix: 修复任务栏在右侧智能隐藏失败(Bug: 154513)(Influence: 任务栏右侧智能隐藏,将窗口拖动到任务栏的右侧,观察任务栏是否隐藏)
|
||||
* fix: 修复跨端协同设备列表数量显示不对的问题。(Bug: 203831)(Influence: 跨端协同设备数量,及设备协同连接。)
|
||||
* fix: 修复时尚模式下快捷设置面板显示设置子页面显示不全,导致跨端协同设备列表显示异常问题。(Bug: 160587, 160599)(Influence: 时尚模式下显示设置子页面显示问题。)
|
||||
|
||||
-- baodi <baodi@uniontech.com> Wed, 19 Oct 2022 12:57:31 +0800
|
||||
|
||||
dde-dock (6.0.3) unstable; urgency=medium
|
||||
|
||||
[ TagBuilder ]
|
||||
* fix: 修复debian打包使用AM宏不生效的问题(Task: 133075)(Influence: 任务栏是否使用AM服务)
|
||||
* fix: 修复wayland环境下任务栏右键菜单带有标题栏的问题(Bug: 140873)(Influence: wayland下查看任务栏图表的右键菜单)
|
||||
* fix: 修复任务栏在高缩放率下防呆位置错误(Influence: 高缩放率下,查看防呆区域)
|
||||
* fix: 删除任务栏启动时候用ldd检测libdtk库(Task: 157235)(Influence: 任务栏启动的时候检测是否有ldd报错信息)
|
||||
* feat: 暂时取消使用AM宏(Task: 162227)(Influence: 无)
|
||||
* feat: 增加最近使用应用的功能(Task: 158441)(Influence: 控制中心最近使用区域开启情况下,时尚模式,打开一个没有驻留在任务栏的应用,查看新打开的应用是否在最近打开应用区域)
|
||||
* feat: 增加工具区域的使用(Task: 152867)(Influence: 时尚模式下,查看最近打开区域右侧是否显示回收站,来回切换时尚模式与高效模式,查看回收站位置是否发生变化)
|
||||
* feat: recompile(Influence: recompile)
|
||||
* feat: 点击任务栏时间显示窗口呼出小组件面板。(Task: 165407)(Influence: 点击任务栏时间窗口小组件是否显示。)
|
||||
* fix: 修复拖拽托盘窗口图标至任务栏托盘区域经常失败的问题。(Bug: 147789)(Influence: 拖拽托盘窗口图标至任务栏托盘区域。)
|
||||
* chore: 优化有关slider等相关的操作代码(Influence: 快捷设置面板slider操作。)
|
||||
* fix: 修复从任务栏或其他应用打开控制中心卡死的问题(Bug: 149189)(Influence: 任务栏-任务栏设置-打开控制中心,观察打开的时间)
|
||||
|
||||
-- caixiangrong <caixiangrong@uniontech.com> Mon, 25 Jul 2022 13:10:23 +0800
|
||||
|
||||
dde-dock (6.0.2) unstable; urgency=low
|
||||
|
||||
* release 6.0.2
|
||||
|
||||
-- fanpengcheng <fanpengcheng@uniontech.com> Tue, 21 Jun 2022 16:55:39 +0800
|
||||
|
||||
dde-dock (6.0.1) unstable; urgency=low
|
||||
|
||||
* release Tag 6.0.1
|
||||
|
||||
-- fanpengcheng <fanpengcheng@uniontech.com> Tue, 21 Jun 2022 16:24:49 +0800
|
||||
|
||||
dde-dock (6.0.0.1) unstable; urgency=low
|
||||
|
||||
* release Tag 6.0.0.1
|
||||
|
||||
-- donghualin <donghualin@uniontech.com> Wed, 1 Jun 2022 21:34:29 +0800
|
||||
|
||||
dde-dock (6.0.0.0) unstable; urgency=low
|
||||
|
||||
* release Tag 6.0.0.0
|
||||
|
||||
-- donghualin <donghualin@uniontech.com> Wed, 1 Jun 2022 10:11:29 +0800
|
||||
|
||||
dde-dock (3.0.12-1) unstable; urgency=low
|
||||
|
||||
* Autobuild Tag 3.0.12
|
||||
|
||||
@ -134,4 +387,4 @@ dde-dock (0.0~git20150824-1) unstable; urgency=low
|
||||
|
||||
* Initial release
|
||||
|
||||
-- Deepin Packages Builder <packages@linuxdeepin.com> Mon, 24 Aug 2015 19:03:01 +0800
|
||||
-- Deepin Packages Builder <packages@linuxdeepin.com> Mon, 24 Aug 2015 19:03:01 +0000
|
||||
|
22
debian/control
vendored
22
debian/control
vendored
@ -20,14 +20,16 @@ Build-Depends: debhelper (>= 8.0.0),
|
||||
libdtkcore-dev (>=5.4.14),
|
||||
libdtkcore5-bin (>=5.4.14),
|
||||
libdtkgui-dev (>=5.4.13),
|
||||
libdframeworkdbus-dev (>=5.4.6),
|
||||
libgsettings-qt-dev,
|
||||
libdbusmenu-qt5-dev,
|
||||
libgtest-dev,
|
||||
libgmock-dev,
|
||||
qttools5-dev,
|
||||
dde-control-center-dev,
|
||||
libxcursor-dev
|
||||
libxcursor-dev,
|
||||
libqt5waylandclient5-dev,
|
||||
qtwayland5-private-dev,
|
||||
libxdamage-dev,
|
||||
libdwayland-dev
|
||||
Standards-Version: 3.9.8
|
||||
Homepage: http://www.deepin.org/
|
||||
|
||||
@ -35,20 +37,16 @@ Package: dde-dock
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends},
|
||||
deepin-desktop-schemas (>=5.9.14),
|
||||
libdtkwidget5 (>=5.4.19),
|
||||
libdtkcore5 (>=5.4.14),
|
||||
libdtkgui5 (>=5.4.13),
|
||||
libdframeworkdbus2 (>=5.4.6),
|
||||
dde-qt5xcb-plugin (>=5.0.25),
|
||||
dde-daemon (>=5.13.12),
|
||||
startdde (>=5.8.9),
|
||||
lastore-daemon (>=5.2.9),
|
||||
qtxdg-dev-tools
|
||||
qtxdg-dev-tools,
|
||||
dbus-bin
|
||||
Recommends:
|
||||
dde-disk-mount-plugin,
|
||||
dde-dock-onboard-plugin,
|
||||
dock-network-plugin,
|
||||
dcc-dock-plugin,
|
||||
dde-network-dialog
|
||||
Conflicts:
|
||||
dde-workspace (<< 2.90.5),
|
||||
@ -71,9 +69,3 @@ Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, onboard
|
||||
Description: deepin desktop-environment - dock plugin for onboard
|
||||
Dock plugin for onboard of deepin desktop-environment
|
||||
|
||||
Package: dcc-dock-plugin
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}, onboard
|
||||
Description: deepin desktop-environment - dcc plugin for dock settings
|
||||
Dcc plugin for dock settings of deepin desktop-environment
|
||||
|
2
debian/copyright
vendored
2
debian/copyright
vendored
@ -3,7 +3,7 @@ Upstream-Name: dde-dock
|
||||
|
||||
Files: *
|
||||
Copyright: 2015 Deepin Technology Co., Ltd.
|
||||
License: LGPL-3.0-or-later
|
||||
License: GPL-3+
|
||||
This package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
|
1
debian/dcc-dock-plugin.install
vendored
1
debian/dcc-dock-plugin.install
vendored
@ -1 +0,0 @@
|
||||
usr/lib/dde-control-center/modules/libdcc-dock-plugin.so
|
8
debian/dde-dock.install
vendored
8
debian/dde-dock.install
vendored
@ -1,12 +1,12 @@
|
||||
usr/share
|
||||
usr/bin
|
||||
etc/dde-dock
|
||||
usr/lib/dde-dock/plugins/libdatetime.so
|
||||
usr/lib/dde-dock/plugins/loader/libpluginmanager.so
|
||||
usr/lib/dde-dock/plugins/libshutdown.so
|
||||
usr/lib/dde-dock/plugins/libtrash.so
|
||||
usr/lib/dde-dock/plugins/libtray.so
|
||||
usr/lib/dde-dock/plugins/liboverlay-warning.so
|
||||
usr/lib/dde-dock/plugins/system-trays
|
||||
usr/lib/dde-dock/plugins/quick-trays
|
||||
usr/lib/dde-dock/plugins/libmultitasking.so
|
||||
usr/lib/dde-dock/plugins/libshow-desktop.so
|
||||
usr/lib/dde-dock/plugins/system-trays/libkeyboard-layout.so
|
||||
usr/lib/dde-dock/plugins/libkeyboard-layout.so
|
||||
usr/share/dsg/configs/dde-dock/
|
||||
|
@ -5,12 +5,14 @@ set(BIN_NAME dde-dock)
|
||||
configure_file(environments.h.in environments.h @ONLY)
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=address -O2")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address -O2")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -fsanitize=address -O0")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address -O0")
|
||||
endif()
|
||||
|
||||
generation_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/dbusinterface/xml ${CMAKE_CURRENT_SOURCE_DIR}/dbusinterface/generation_dbus_interface)
|
||||
|
||||
# Sources files
|
||||
file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../widgets/*.h" "../widgets/*.cpp")
|
||||
file(GLOB_RECURSE SRCS "*.h" "*.cpp" "../widgets/*.h" "../widgets/*.cpp" "../interfaces/*.h")
|
||||
|
||||
# Find the library
|
||||
find_package(PkgConfig REQUIRED)
|
||||
@ -19,14 +21,19 @@ find_package(Qt5Concurrent REQUIRED)
|
||||
find_package(Qt5X11Extras REQUIRED)
|
||||
find_package(Qt5DBus REQUIRED)
|
||||
find_package(Qt5Svg REQUIRED)
|
||||
find_package(Qt5WaylandClient REQUIRED)
|
||||
find_package(Qt5XkbCommonSupport REQUIRED)
|
||||
find_package(DtkWidget REQUIRED)
|
||||
find_package(DtkCMake REQUIRED)
|
||||
find_package(dbusmenu-qt5 REQUIRED)
|
||||
|
||||
pkg_check_modules(XCB_EWMH REQUIRED xcb-ewmh x11 xcursor)
|
||||
pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus)
|
||||
pkg_check_modules(XCB_EWMH REQUIRED xcb-image xcb-ewmh xcb-composite xtst x11 dbusmenu-qt5 xext xcursor)
|
||||
pkg_check_modules(QGSettings REQUIRED gsettings-qt)
|
||||
pkg_check_modules(DtkGUI REQUIRED dtkgui)
|
||||
|
||||
set(Wayland_INCLUDE_DIRS /usr/include/DWayland/Client)
|
||||
set(Wayland_LIBRARIES /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/libDWaylandClient.so)
|
||||
|
||||
# driver-manager
|
||||
add_executable(${BIN_NAME}
|
||||
${SRCS}
|
||||
@ -37,23 +44,36 @@ add_executable(${BIN_NAME}
|
||||
target_include_directories(${BIN_NAME} PUBLIC
|
||||
${DtkWidget_INCLUDE_DIRS}
|
||||
${XCB_EWMH_INCLUDE_DIRS}
|
||||
${DFrameworkDBus_INCLUDE_DIRS}
|
||||
${Qt5Gui_PRIVATE_INCLUDE_DIRS}
|
||||
${PROJECT_BINARY_DIR}
|
||||
${QGSettings_INCLUDE_DIRS}
|
||||
${DtkGUI_INCLUDE_DIRS}
|
||||
${Qt5Svg_INCLUDE_DIRS}
|
||||
${dbusmenu-qt5_INCLUDE_DIRS}
|
||||
${Wayland_INCLUDE_DIRS}
|
||||
${Qt5WaylandClient_INCLUDE_DIRS}
|
||||
${Qt5WaylandClient_PRIVATE_INCLUDE_DIRS}
|
||||
${Qt5XkbCommonSupport_PRIVATE_INCLUDE_DIRS}
|
||||
../interfaces
|
||||
../widgets
|
||||
./dbusinterface/generation_dbus_interface
|
||||
./qtdbusextended/
|
||||
./dbusinterface
|
||||
accessible
|
||||
controller
|
||||
dbus
|
||||
display
|
||||
item
|
||||
item/components
|
||||
model
|
||||
pluginadapter
|
||||
screenspliter
|
||||
util
|
||||
window
|
||||
window/components
|
||||
window/tray
|
||||
window/tray/widgets
|
||||
drag
|
||||
xcb
|
||||
../plugins/tray
|
||||
../plugins/show-desktop
|
||||
@ -67,7 +87,6 @@ target_include_directories(${BIN_NAME} PUBLIC
|
||||
|
||||
target_link_libraries(${BIN_NAME} PRIVATE
|
||||
${XCB_EWMH_LIBRARIES}
|
||||
${DFrameworkDBus_LIBRARIES}
|
||||
${DtkWidget_LIBRARIES}
|
||||
${Qt5Widgets_LIBRARIES}
|
||||
${Qt5Gui_LIBRARIES}
|
||||
@ -77,6 +96,11 @@ target_link_libraries(${BIN_NAME} PRIVATE
|
||||
${QGSettings_LIBRARIES}
|
||||
${DtkGUI_LIBRARIES}
|
||||
${Qt5Svg_LIBRARIES}
|
||||
${Wayland_LIBRARIES}
|
||||
${Qt5Wayland_LIBRARIES}
|
||||
${Qt5WaylandClient_LIBRARIES}
|
||||
${Qt5XkbCommonSupport_LIBRARIES}
|
||||
-lpthread -lm
|
||||
)
|
||||
|
||||
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "sw_64")
|
||||
@ -92,6 +116,4 @@ if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
|
||||
endif()
|
||||
|
||||
# bin
|
||||
install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
dconfig_meta_files(APPID org.deepin.dde.dock FILES ../configs/org.deepin.dde.dock.json)
|
||||
install(TARGETS ${BIN_NAME} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
@ -1,165 +1,195 @@
|
||||
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include <QAccessible>
|
||||
#include <QAccessibleWidget>
|
||||
#include <QMap>
|
||||
#include <QMetaEnum>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include "accessibledefine.h"
|
||||
|
||||
inline QString getAccessibleName(QWidget *w, QAccessible::Role r, const QString &fallback)
|
||||
{
|
||||
#define SEPARATOR "_"
|
||||
const QString lowerFallback = fallback.toLower();
|
||||
// 避免重复生成
|
||||
static QMap<QObject *, QString > objnameMap;
|
||||
if (!objnameMap[w].isEmpty())
|
||||
return objnameMap[w];
|
||||
#include "mainwindow.h"
|
||||
#include "mainpanelcontrol.h"
|
||||
#include "desktop_widget.h"
|
||||
#include "tipswidget.h"
|
||||
#include "dockpopupwindow.h"
|
||||
#include "dragwidget.h"
|
||||
|
||||
static QMap< QAccessible::Role, QList< QString > > accessibleMap;
|
||||
QString oldAccessName = w->accessibleName().toLower();
|
||||
oldAccessName.replace(SEPARATOR, "");
|
||||
#include "launcheritem.h"
|
||||
#include "appitem.h"
|
||||
#include "components/previewcontainer.h"
|
||||
#include "pluginsitem.h"
|
||||
#include "traypluginitem.h"
|
||||
#include "placeholderitem.h"
|
||||
#include "components/appdragwidget.h"
|
||||
#include "components/appsnapshot.h"
|
||||
#include "components/floatingpreview.h"
|
||||
|
||||
// 按照类型添加固定前缀
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<QAccessible::Role>();
|
||||
QByteArray prefix = metaEnum.valueToKeys(r);
|
||||
switch (r) {
|
||||
case QAccessible::Button: prefix = "Btn"; break;
|
||||
case QAccessible::StaticText: prefix = "Label"; break;
|
||||
default: break;
|
||||
}
|
||||
#include "snitraywidget.h"
|
||||
#include "abstracttraywidget.h"
|
||||
#include "indicatortraywidget.h"
|
||||
#include "xembedtraywidget.h"
|
||||
#include "system-trays/systemtrayitem.h"
|
||||
#include "fashiontray/fashiontrayitem.h"
|
||||
#include "fashiontray/fashiontraywidgetwrapper.h"
|
||||
#include "fashiontray/fashiontraycontrolwidget.h"
|
||||
#include "fashiontray/containers/attentioncontainer.h"
|
||||
#include "fashiontray/containers/holdcontainer.h"
|
||||
#include "fashiontray/containers/normalcontainer.h"
|
||||
#include "fashiontray/containers/spliteranimated.h"
|
||||
|
||||
// 再加上标识
|
||||
QString accessibleName = QString::fromLatin1(prefix) + SEPARATOR;
|
||||
QString objectName = w->objectName().toLower();
|
||||
accessibleName += oldAccessName.isEmpty() ? (objectName.isEmpty() ?lowerFallback : objectName) : oldAccessName;
|
||||
// 检查名称是否唯一
|
||||
if (accessibleMap[r].contains(accessibleName)) {
|
||||
if (!objnameMap.key(accessibleName)) {
|
||||
objnameMap.remove(objnameMap.key(accessibleName));
|
||||
objnameMap.insert(w, accessibleName);
|
||||
return accessibleName;
|
||||
}
|
||||
// 获取编号,然后+1
|
||||
int pos = accessibleName.indexOf(SEPARATOR);
|
||||
int id = accessibleName.mid(pos + 1).toInt();
|
||||
// 这部分由sound插件单独维护,这样做是因为在标记volumeslider这个类时,需要用到其setValue的实现,
|
||||
// 但插件的源文件dock这边并没有包含,不想引入复杂的包含关系,其实最好的做法就是像sound插件这样,谁维护谁的
|
||||
//#include "../plugins/sound/sounditem.h"
|
||||
//#include "../plugins/sound/soundapplet.h"
|
||||
//#include "../plugins/sound/sinkinputwidget.h"
|
||||
//#include "../plugins/sound/componments/volumeslider.h"
|
||||
//#include "../plugins/sound/componments/horizontalseparator.h"
|
||||
|
||||
QString newAccessibleName;
|
||||
do {
|
||||
// 一直找到一个不重复的名字
|
||||
newAccessibleName = accessibleName + SEPARATOR + QString::number(++id);
|
||||
} while (accessibleMap[r].contains(newAccessibleName));
|
||||
#include "showdesktopwidget.h"
|
||||
#include "datetimewidget.h"
|
||||
#include "onboarditem.h"
|
||||
#include "trashwidget.h"
|
||||
#include "popupcontrolwidget.h"
|
||||
#include "shutdownwidget.h"
|
||||
#include "multitaskingwidget.h"
|
||||
#include "overlaywarningwidget.h"
|
||||
#include "horizontalseperator.h"
|
||||
|
||||
accessibleMap[r].append(newAccessibleName);
|
||||
objnameMap.insert(w, newAccessibleName);
|
||||
#include <DIconButton>
|
||||
#include <DSwitchButton>
|
||||
#include <DPushButton>
|
||||
#include <DListView>
|
||||
#include <DSwitchButton>
|
||||
#include <DSpinner>
|
||||
#include <dloadingindicator.h>
|
||||
|
||||
// 对象销毁后移除占用名称
|
||||
QObject::connect(w, &QWidget::destroyed, [ = ] (QObject *obj) {
|
||||
objnameMap.remove(obj);
|
||||
accessibleMap[r].removeOne(newAccessibleName);
|
||||
});
|
||||
return newAccessibleName;
|
||||
} else {
|
||||
accessibleMap[r].append(accessibleName);
|
||||
objnameMap.insert(w, accessibleName);
|
||||
#include <QScrollBar>
|
||||
|
||||
// 对象销毁后移除占用名称
|
||||
QObject::connect(w, &QWidget::destroyed, [ = ] (QObject *obj) {
|
||||
objnameMap.remove(obj);
|
||||
accessibleMap[r].removeOne(accessibleName);
|
||||
});
|
||||
return accessibleName;
|
||||
}
|
||||
}
|
||||
DWIDGET_USE_NAMESPACE
|
||||
using namespace Dock;
|
||||
|
||||
class Accessible : public QAccessibleWidget {
|
||||
public:
|
||||
Accessible(QWidget *parent, QAccessible::Role r, const QString &accessibleName)
|
||||
: QAccessibleWidget(parent, r)
|
||||
, w(parent)
|
||||
, accessibleName(accessibleName)
|
||||
{}
|
||||
|
||||
// 对于使用dogtail的AT自动化测试工作,实际上只需要使用我们提供的text方法获取控件唯一ID,,然后再通过QAccessibleWidget的rect方法找到其坐标,模拟点击即可
|
||||
// rect没必要重新实现,text方法通过getAccessibleName确定返回唯一值
|
||||
QString text(QAccessible::Text t) const override {
|
||||
switch (t) {
|
||||
case QAccessible::Name:
|
||||
return getAccessibleName(w, this->role(), accessibleName);
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
QWidget *w;
|
||||
QString accessibleName;
|
||||
};
|
||||
// 添加accessible
|
||||
SET_FORM_ACCESSIBLE(MainWindow, "mainwindow")
|
||||
SET_BUTTON_ACCESSIBLE(MainPanelControl, "mainpanelcontrol")
|
||||
SET_LABEL_ACCESSIBLE(TipsWidget, "tips")
|
||||
SET_FORM_ACCESSIBLE(DockPopupWindow, "popupwindow")
|
||||
SET_BUTTON_ACCESSIBLE(LauncherItem, "launcheritem")
|
||||
SET_BUTTON_ACCESSIBLE(AppItem, "appitem")
|
||||
SET_BUTTON_ACCESSIBLE(PreviewContainer, "previewcontainer")
|
||||
SET_BUTTON_ACCESSIBLE(PluginsItem, m_w->pluginName())
|
||||
SET_BUTTON_ACCESSIBLE(TrayPluginItem, m_w->pluginName())
|
||||
SET_BUTTON_ACCESSIBLE(PlaceholderItem, "placeholderitem")
|
||||
SET_BUTTON_ACCESSIBLE(AppDragWidget, "appdragwidget")
|
||||
SET_BUTTON_ACCESSIBLE(AppSnapshot, "appsnapshot")
|
||||
SET_BUTTON_ACCESSIBLE(FloatingPreview, "floatingpreview")
|
||||
SET_BUTTON_ACCESSIBLE(XEmbedTrayWidget, m_w->itemKeyForConfig().replace("sni:", ""))
|
||||
SET_BUTTON_ACCESSIBLE(IndicatorTrayWidget, m_w->itemKeyForConfig().replace("sni:", ""))
|
||||
SET_BUTTON_ACCESSIBLE(SNITrayWidget, m_w->itemKeyForConfig().replace("sni:", ""))
|
||||
SET_BUTTON_ACCESSIBLE(AbstractTrayWidget, m_w->itemKeyForConfig().replace("sni:", ""))
|
||||
SET_BUTTON_ACCESSIBLE(SystemTrayItem, m_w->itemKeyForConfig().replace("sni:", ""))
|
||||
SET_FORM_ACCESSIBLE(FashionTrayItem, "fashiontrayitem")
|
||||
SET_FORM_ACCESSIBLE(FashionTrayWidgetWrapper, "fashiontraywrapper")
|
||||
SET_BUTTON_ACCESSIBLE(FashionTrayControlWidget, "fashiontraycontrolwidget")
|
||||
SET_FORM_ACCESSIBLE(AttentionContainer, "attentioncontainer")
|
||||
SET_FORM_ACCESSIBLE(HoldContainer, "holdcontainer")
|
||||
SET_FORM_ACCESSIBLE(NormalContainer, "normalcontainer")
|
||||
SET_FORM_ACCESSIBLE(SpliterAnimated, "spliteranimated")
|
||||
SET_FORM_ACCESSIBLE(DatetimeWidget, "plugin-datetime")
|
||||
SET_FORM_ACCESSIBLE(OnboardItem, "plugin-onboard")
|
||||
SET_FORM_ACCESSIBLE(TrashWidget, "plugin-trash")
|
||||
SET_BUTTON_ACCESSIBLE(PopupControlWidget, "popupcontrolwidget")
|
||||
SET_FORM_ACCESSIBLE(ShutdownWidget, "plugin-shutdown")
|
||||
SET_FORM_ACCESSIBLE(MultitaskingWidget, "plugin-multitasking")
|
||||
SET_FORM_ACCESSIBLE(ShowDesktopWidget, "plugin-showdesktop")
|
||||
SET_FORM_ACCESSIBLE(OverlayWarningWidget, "plugin-overlaywarningwidget")
|
||||
SET_FORM_ACCESSIBLE(QWidget, m_w->objectName().isEmpty() ? "widget" : m_w->objectName())
|
||||
SET_LABEL_ACCESSIBLE(QLabel, m_w->objectName() == "notifications" ? m_w->objectName() : m_w->text().isEmpty() ? m_w->objectName().isEmpty() ? "text" : m_w->objectName() : m_w->text())
|
||||
SET_BUTTON_ACCESSIBLE(DIconButton, m_w->objectName().isEmpty() ? "imagebutton" : m_w->objectName())
|
||||
SET_BUTTON_ACCESSIBLE(DSwitchButton, m_w->text().isEmpty() ? "switchbutton" : m_w->text())
|
||||
SET_BUTTON_ACCESSIBLE(DesktopWidget, "desktopWidget");
|
||||
SET_FORM_ACCESSIBLE(HorizontalSeperator, "HorizontalSeperator");
|
||||
// 几个没什么用的标记,但为了提醒大家不要遗漏标记控件,还是不要去掉
|
||||
SET_FORM_ACCESSIBLE(DBlurEffectWidget, "DBlurEffectWidget")
|
||||
SET_FORM_ACCESSIBLE(DListView, "DListView")
|
||||
SET_FORM_ACCESSIBLE(DLoadingIndicator, "DLoadingIndicator")
|
||||
SET_FORM_ACCESSIBLE(DSpinner, "DSpinner")
|
||||
SET_FORM_ACCESSIBLE(QMenu, "QMenu")
|
||||
SET_FORM_ACCESSIBLE(QPushButton, "QPushButton")
|
||||
SET_FORM_ACCESSIBLE(QSlider, "QSlider")
|
||||
SET_FORM_ACCESSIBLE(QScrollBar, "QScrollBar")
|
||||
SET_FORM_ACCESSIBLE(QScrollArea, "QScrollArea")
|
||||
SET_FORM_ACCESSIBLE(QFrame, "QFrame")
|
||||
SET_FORM_ACCESSIBLE(QGraphicsView, "QGraphicsView")
|
||||
SET_FORM_ACCESSIBLE(DragWidget, "DragWidget")
|
||||
|
||||
QAccessibleInterface *accessibleFactory(const QString &classname, QObject *object)
|
||||
{
|
||||
Q_UNUSED(classname);
|
||||
// 自动化标记确定不需要的控件,方可加入忽略列表
|
||||
const static QStringList ignoreLst = {"WirelessItem", "WiredItem", "SsidButton", "WirelessList", "AccessPointWidget"};
|
||||
|
||||
static QMap<QString, QAccessible::Role> s_roleMap = {
|
||||
{"MainWindow", QAccessible::Role::Form}
|
||||
, {"MainPanelControl", QAccessible::Role::Button}
|
||||
, {"Dock::TipsWidget", QAccessible::Role::StaticText}
|
||||
, {"DockPopupWindow", QAccessible::Role::Form}
|
||||
, {"LauncherItem", QAccessible::Role::Button}
|
||||
, {"AppItem", QAccessible::Role::Button}
|
||||
, {"PreviewContainer", QAccessible::Role::Button}
|
||||
, {"PluginsItem", QAccessible::Role::Button}
|
||||
, {"TrayPluginItem", QAccessible::Role::Button}
|
||||
, {"PlaceholderItem", QAccessible::Role::Button}
|
||||
, {"AppDragWidget", QAccessible::Role::Button}
|
||||
, {"AppSnapshot", QAccessible::Role::Button}
|
||||
, {"FloatingPreview", QAccessible::Role::Button}
|
||||
, {"XEmbedTrayWidget", QAccessible::Role::Button}
|
||||
, {"IndicatorTrayWidget", QAccessible::Role::Button}
|
||||
, {"SNITrayWidget", QAccessible::Role::Button}
|
||||
, {"AbstractTrayWidget", QAccessible::Role::Button}
|
||||
, {"SystemTrayItem", QAccessible::Role::Button}
|
||||
, {"FashionTrayItem", QAccessible::Role::Form}
|
||||
, {"FashionTrayWidgetWrapper", QAccessible::Role::Form}
|
||||
, {"FashionTrayControlWidget", QAccessible::Role::Button}
|
||||
, {"AttentionContainer", QAccessible::Role::Form}
|
||||
, {"HoldContainer", QAccessible::Role::Form}
|
||||
, {"NormalContainer", QAccessible::Role::Form}
|
||||
, {"SpliterAnimated", QAccessible::Role::Form}
|
||||
, {"DatetimeWidget", QAccessible::Role::Form}
|
||||
, {"OnboardItem", QAccessible::Role::Form}
|
||||
, {"TrashWidget", QAccessible::Role::Form}
|
||||
, {"PopupControlWidget", QAccessible::Role::Button}
|
||||
, {"ShutdownWidget", QAccessible::Role::Form}
|
||||
, {"MultitaskingWidget", QAccessible::Role::Form}
|
||||
, {"ShowDesktopWidget", QAccessible::Role::Form}
|
||||
, {"OverlayWarningWidget", QAccessible::Role::Form}
|
||||
, {"QWidget", QAccessible::Role::Form}
|
||||
, {"QLabel", QAccessible::Role::StaticText}
|
||||
, {"Dtk::Widget::DIconButton", QAccessible::Role::Button}
|
||||
, {"Dtk::Widget::DSwitchButton", QAccessible::Role::Button}
|
||||
, {"DesktopWidget", QAccessible::Role::Button}
|
||||
, {"HorizontalSeperator", QAccessible::Role::Form}
|
||||
};
|
||||
QAccessibleInterface *interface = nullptr;
|
||||
|
||||
static QMap<QString, QString> s_classNameMap = {
|
||||
{"Dock::TipsWidget", "tips"}
|
||||
, {"DatetimeWidget", "plugin-datetime"}
|
||||
, {"OnboardItem", "plugin-onboard"}
|
||||
, {"TrashWidget", "plugin-trash"}
|
||||
, {"ShutdownWidget", "plugin-shutdown"}
|
||||
, {"MultitaskingWidget", "plugin-multitasking"}
|
||||
, {"ShowDesktopWidget", "plugin-showdesktop"}
|
||||
, {"OverlayWarningWidget", "plugin-overlaywarningwidget"}
|
||||
, {"SoundItem", "plugin-sounditem"}
|
||||
};
|
||||
USE_ACCESSIBLE(classname, MainWindow)
|
||||
ELSE_USE_ACCESSIBLE(classname, MainPanelControl)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dock::", ""), TipsWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, DockPopupWindow)
|
||||
ELSE_USE_ACCESSIBLE(classname, LauncherItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, AppItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, PreviewContainer)
|
||||
ELSE_USE_ACCESSIBLE(classname, PluginsItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, TrayPluginItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, PlaceholderItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, AppDragWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, AppSnapshot)
|
||||
ELSE_USE_ACCESSIBLE(classname, FloatingPreview)
|
||||
ELSE_USE_ACCESSIBLE(classname, SNITrayWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, AbstractTrayWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, SystemTrayItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, FashionTrayItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, FashionTrayWidgetWrapper)
|
||||
ELSE_USE_ACCESSIBLE(classname, FashionTrayControlWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, AttentionContainer)
|
||||
ELSE_USE_ACCESSIBLE(classname, HoldContainer)
|
||||
ELSE_USE_ACCESSIBLE(classname, NormalContainer)
|
||||
ELSE_USE_ACCESSIBLE(classname, SpliterAnimated)
|
||||
ELSE_USE_ACCESSIBLE(classname, IndicatorTrayWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, XEmbedTrayWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, DesktopWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, DatetimeWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, OnboardItem)
|
||||
ELSE_USE_ACCESSIBLE(classname, TrashWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, PopupControlWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, ShutdownWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, MultitaskingWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, ShowDesktopWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, OverlayWarningWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, QWidget)
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(classname, QLabel, "spliter_fix")
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(classname, QLabel, "spliter_app")
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(classname, QLabel, "spliter_tray")
|
||||
ELSE_USE_ACCESSIBLE(classname, QLabel)
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DIconButton, "closebutton-2d")
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DIconButton, "closebutton-3d")
|
||||
ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(QString(classname).replace("Dtk::Widget::", ""), DSwitchButton, "")
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DBlurEffectWidget)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DListView)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DLoadingIndicator)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DSpinner)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DSwitchButton)
|
||||
ELSE_USE_ACCESSIBLE(QString(classname).replace("Dtk::Widget::", ""), DIconButton)
|
||||
ELSE_USE_ACCESSIBLE(classname, QMenu)
|
||||
ELSE_USE_ACCESSIBLE(classname, QPushButton)
|
||||
ELSE_USE_ACCESSIBLE(classname, QSlider)
|
||||
ELSE_USE_ACCESSIBLE(classname, QScrollBar)
|
||||
ELSE_USE_ACCESSIBLE(classname, QScrollArea)
|
||||
ELSE_USE_ACCESSIBLE(classname, QFrame)
|
||||
ELSE_USE_ACCESSIBLE(classname, QGraphicsView)
|
||||
ELSE_USE_ACCESSIBLE(classname, DragWidget)
|
||||
ELSE_USE_ACCESSIBLE(classname, HorizontalSeperator);
|
||||
|
||||
if (object->isWidgetType())
|
||||
return new Accessible(qobject_cast<QWidget *>(object)
|
||||
, s_roleMap.value(classname, QAccessible::Role::Form)
|
||||
, s_classNameMap.value(object->metaObject()->className(), object->metaObject()->className()));
|
||||
if (!interface && object->inherits("QWidget") && !ignoreLst.contains(classname)) {
|
||||
QWidget *w = static_cast<QWidget *>(object);
|
||||
// 如果你看到这里的输出,说明代码中仍有控件未兼顾到accessible功能,请帮忙添加
|
||||
if (w->accessibleName().isEmpty())
|
||||
qWarning() << "accessibleFactory()" + QString("Class: " + classname + " cannot access");
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return interface;
|
||||
}
|
||||
|
405
frame/accessible/accessibledefine.h
Normal file
405
frame/accessible/accessibledefine.h
Normal file
@ -0,0 +1,405 @@
|
||||
// Copyright (C) 2018 ~ 2020 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
// 为了方便使用,把相关定义独立出来,如有需要,直接包含这个头文件,然后使用SET_*的宏去设置,USE_*宏开启即可
|
||||
// 注意:对项目中出现的所有的QWidget的派生类都要再启用一次accessiblity,包括qt的原生控件[qt未限制其标记名称为空的情况]
|
||||
// 注意:使用USE_ACCESSIBLE_BY_OBJECTNAME开启accessiblity的时候,一定要再对这个类用一下USE_ACCESSIBLE,否则标记可能会遗漏
|
||||
|
||||
#ifndef ACCESSIBLEINTERFACE_H
|
||||
#define ACCESSIBLEINTERFACE_H
|
||||
|
||||
#include <QAccessible>
|
||||
#include <QAccessibleWidget>
|
||||
#include <QEvent>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include <QObject>
|
||||
#include <QMetaEnum>
|
||||
#include <QMouseEvent>
|
||||
#include <QApplication>
|
||||
|
||||
#define SEPARATOR "_"
|
||||
|
||||
inline QString getAccessibleName(QWidget *w, QAccessible::Role r, const QString &fallback)
|
||||
{
|
||||
const QString lowerFallback = fallback.toLower();
|
||||
// 避免重复生成
|
||||
static QMap< QObject *, QString > objnameMap;
|
||||
if (!objnameMap[w].isEmpty())
|
||||
return objnameMap[w];
|
||||
|
||||
static QMap< QAccessible::Role, QList< QString > > accessibleMap;
|
||||
QString oldAccessName = w->accessibleName().toLower();
|
||||
oldAccessName.replace(SEPARATOR, "");
|
||||
|
||||
// 按照类型添加固定前缀
|
||||
QMetaEnum metaEnum = QMetaEnum::fromType<QAccessible::Role>();
|
||||
QByteArray prefix = metaEnum.valueToKeys(r);
|
||||
switch (r) {
|
||||
case QAccessible::Button: prefix = "Btn"; break;
|
||||
case QAccessible::StaticText: prefix = "Label"; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
// 再加上标识
|
||||
QString accessibleName = QString::fromLatin1(prefix) + SEPARATOR;
|
||||
QString objectName = w->objectName().toLower();
|
||||
accessibleName += oldAccessName.isEmpty() ? (objectName.isEmpty() ?lowerFallback : objectName) : oldAccessName;
|
||||
// 检查名称是否唯一
|
||||
if (accessibleMap[r].contains(accessibleName)) {
|
||||
if (!objnameMap.key(accessibleName)) {
|
||||
objnameMap.remove(objnameMap.key(accessibleName));
|
||||
objnameMap.insert(w, accessibleName);
|
||||
return accessibleName;
|
||||
}
|
||||
// 获取编号,然后+1
|
||||
int pos = accessibleName.indexOf(SEPARATOR);
|
||||
int id = accessibleName.mid(pos + 1).toInt();
|
||||
|
||||
QString newAccessibleName;
|
||||
do {
|
||||
// 一直找到一个不重复的名字
|
||||
newAccessibleName = accessibleName + SEPARATOR + QString::number(++id);
|
||||
} while (accessibleMap[r].contains(newAccessibleName));
|
||||
|
||||
accessibleMap[r].append(newAccessibleName);
|
||||
objnameMap.insert(w, newAccessibleName);
|
||||
|
||||
// 对象销毁后移除占用名称
|
||||
QObject::connect(w, &QWidget::destroyed, [ = ] (QObject *obj) {
|
||||
objnameMap.remove(obj);
|
||||
accessibleMap[r].removeOne(newAccessibleName);
|
||||
});
|
||||
return newAccessibleName;
|
||||
} else {
|
||||
accessibleMap[r].append(accessibleName);
|
||||
objnameMap.insert(w, accessibleName);
|
||||
|
||||
// 对象销毁后移除占用名称
|
||||
QObject::connect(w, &QWidget::destroyed, [ = ] (QObject *obj) {
|
||||
objnameMap.remove(obj);
|
||||
accessibleMap[r].removeOne(accessibleName);
|
||||
});
|
||||
return accessibleName;
|
||||
}
|
||||
}
|
||||
|
||||
// 公共的功能
|
||||
#define FUNC_CREATE(classname,accessibletype,accessdescription) explicit Accessible##classname(classname *w) \
|
||||
: QAccessibleWidget(w,accessibletype,#classname)\
|
||||
, m_w(w)\
|
||||
, m_description(accessdescription)\
|
||||
{}\
|
||||
|
||||
#define FUNC_TEXT(classname,accessiblename) QString Accessible##classname::text(QAccessible::Text t) const{\
|
||||
switch (t) {\
|
||||
case QAccessible::Name:\
|
||||
return getAccessibleName(m_w, this->role(), accessiblename);\
|
||||
case QAccessible::Description:\
|
||||
return m_description;\
|
||||
default:\
|
||||
return QString();\
|
||||
}\
|
||||
}\
|
||||
|
||||
// button控件特有功能
|
||||
#define FUNC_ACTIONNAMES(classname) QStringList Accessible##classname::actionNames() const{\
|
||||
if(!m_w->isEnabled())\
|
||||
return QStringList();\
|
||||
return QStringList() << pressAction()<< showMenuAction();\
|
||||
}\
|
||||
|
||||
#define FUNC_DOACTION(classname) void Accessible##classname::doAction(const QString &actionName){\
|
||||
if(actionName == pressAction())\
|
||||
{\
|
||||
QPointF localPos = m_w->geometry().center();\
|
||||
QMouseEvent event(QEvent::MouseButtonPress,localPos,Qt::LeftButton,Qt::LeftButton,Qt::NoModifier);\
|
||||
qApp->sendEvent(m_w,&event);\
|
||||
}\
|
||||
else if(actionName == showMenuAction())\
|
||||
{\
|
||||
QPointF localPos = m_w->geometry().center();\
|
||||
QMouseEvent event(QEvent::MouseButtonPress,localPos,Qt::RightButton,Qt::RightButton,Qt::NoModifier);\
|
||||
qApp->sendEvent(m_w,&event);\
|
||||
}\
|
||||
}\
|
||||
|
||||
// Label控件特有功能
|
||||
#define FUNC_TEXT_(classname) QString Accessible##classname::text(int startOffset, int endOffset) const{\
|
||||
Q_UNUSED(startOffset)\
|
||||
Q_UNUSED(endOffset)\
|
||||
return m_w->text();\
|
||||
}\
|
||||
|
||||
// Slider控件特有功能
|
||||
#define FUNC_CURRENTVALUE(classname) QVariant Accessible##classname::currentValue() const{\
|
||||
return m_w->value();\
|
||||
}\
|
||||
|
||||
#define FUNC_SETCURRENTVALUE(classname) void Accessible##classname::setCurrentValue(const QVariant &value){\
|
||||
return m_w->setValue(value.toInt());\
|
||||
}\
|
||||
|
||||
#define FUNC_MAXMUMVALUE(classname) QVariant Accessible##classname::maximumValue() const{\
|
||||
return QVariant(m_w->maximum());\
|
||||
}\
|
||||
|
||||
#define FUNC_FUNC_MINIMUMVALUE(classname) QVariant Accessible##classname::minimumValue() const{\
|
||||
return QVariant(m_w->minimum());\
|
||||
}\
|
||||
|
||||
// DSlider控件特有功能函数
|
||||
#define FUNC_FUNC_MINIMUMSTEPSIZE(classname) QVariant Accessible##classname::minimumStepSize() const{\
|
||||
return QVariant(m_w->pageStep());\
|
||||
}\
|
||||
|
||||
#define SET_FORM_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,accessdescription) class Accessible##classname : public QAccessibleWidget\
|
||||
{\
|
||||
public:\
|
||||
FUNC_CREATE(classname,QAccessible::Form,accessdescription)\
|
||||
QString text(QAccessible::Text t) const override;\
|
||||
void *interface_cast(QAccessible::InterfaceType t) override{\
|
||||
switch (t) {\
|
||||
case QAccessible::ActionInterface:\
|
||||
return static_cast<QAccessibleActionInterface*>(this);\
|
||||
default:\
|
||||
return nullptr;\
|
||||
}\
|
||||
}\
|
||||
private:\
|
||||
classname *m_w;\
|
||||
QString m_description;\
|
||||
};\
|
||||
FUNC_TEXT(classname,accessiblename)\
|
||||
|
||||
#define SET_BUTTON_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,accessdescription) class Accessible##classname : public QAccessibleWidget\
|
||||
{\
|
||||
public:\
|
||||
FUNC_CREATE(classname,QAccessible::Button,accessdescription)\
|
||||
QString text(QAccessible::Text t) const override;\
|
||||
void *interface_cast(QAccessible::InterfaceType t) override{\
|
||||
switch (t) {\
|
||||
case QAccessible::ActionInterface:\
|
||||
return static_cast<QAccessibleActionInterface*>(this);\
|
||||
default:\
|
||||
return nullptr;\
|
||||
}\
|
||||
}\
|
||||
QStringList actionNames() const override;\
|
||||
void doAction(const QString &actionName) override;\
|
||||
private:\
|
||||
classname *m_w;\
|
||||
QString m_description;\
|
||||
};\
|
||||
FUNC_TEXT(classname,accessiblename)\
|
||||
FUNC_ACTIONNAMES(classname)\
|
||||
FUNC_DOACTION(classname)\
|
||||
|
||||
#define SET_LABEL_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,accessdescription) class Accessible##classname : public QAccessibleWidget, public QAccessibleTextInterface\
|
||||
{\
|
||||
public:\
|
||||
FUNC_CREATE(classname,QAccessible::StaticText,accessdescription)\
|
||||
QString text(QAccessible::Text t) const override;\
|
||||
void *interface_cast(QAccessible::InterfaceType t) override{\
|
||||
switch (t) {\
|
||||
case QAccessible::ActionInterface:\
|
||||
return static_cast<QAccessibleActionInterface*>(this);\
|
||||
case QAccessible::TextInterface:\
|
||||
return static_cast<QAccessibleTextInterface*>(this);\
|
||||
default:\
|
||||
return nullptr;\
|
||||
}\
|
||||
}\
|
||||
QString text(int startOffset, int endOffset) const override;\
|
||||
void selection(int selectionIndex, int *startOffset, int *endOffset) const override {\
|
||||
Q_UNUSED(selectionIndex)\
|
||||
Q_UNUSED(startOffset)\
|
||||
Q_UNUSED(endOffset)\
|
||||
}\
|
||||
int selectionCount() const override { return 0; }\
|
||||
void addSelection(int startOffset, int endOffset) override {\
|
||||
Q_UNUSED(startOffset)\
|
||||
Q_UNUSED(endOffset)\
|
||||
}\
|
||||
void removeSelection(int selectionIndex) override {\
|
||||
Q_UNUSED(selectionIndex)\
|
||||
}\
|
||||
void setSelection(int selectionIndex, int startOffset, int endOffset) override {\
|
||||
Q_UNUSED(selectionIndex)\
|
||||
Q_UNUSED(startOffset)\
|
||||
Q_UNUSED(endOffset)\
|
||||
}\
|
||||
int cursorPosition() const override { return 0; }\
|
||||
void setCursorPosition(int position) override {\
|
||||
Q_UNUSED(position)\
|
||||
}\
|
||||
int characterCount() const override { return 0; }\
|
||||
QRect characterRect(int offset) const override {\
|
||||
Q_UNUSED(offset)\
|
||||
return QRect();\
|
||||
}\
|
||||
int offsetAtPoint(const QPoint &point) const override {\
|
||||
Q_UNUSED(point)\
|
||||
return 0;\
|
||||
}\
|
||||
void scrollToSubstring(int startIndex, int endIndex) override {\
|
||||
Q_UNUSED(startIndex)\
|
||||
Q_UNUSED(endIndex)\
|
||||
}\
|
||||
QString attributes(int offset, int *startOffset, int *endOffset) const override {\
|
||||
Q_UNUSED(offset)\
|
||||
Q_UNUSED(startOffset)\
|
||||
Q_UNUSED(endOffset)\
|
||||
return QString();\
|
||||
}\
|
||||
private:\
|
||||
classname *m_w;\
|
||||
QString m_description;\
|
||||
};\
|
||||
FUNC_TEXT(classname,accessiblename)\
|
||||
FUNC_TEXT_(classname)\
|
||||
|
||||
#define SET_SLIDER_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,accessdescription) class Accessible##classname : public QAccessibleWidget, public QAccessibleValueInterface\
|
||||
{\
|
||||
public:\
|
||||
FUNC_CREATE(classname,QAccessible::Slider,accessdescription)\
|
||||
QString text(QAccessible::Text t) const override;\
|
||||
void *interface_cast(QAccessible::InterfaceType t) override{\
|
||||
switch (t) {\
|
||||
case QAccessible::ActionInterface:\
|
||||
return static_cast<QAccessibleActionInterface*>(this);\
|
||||
case QAccessible::ValueInterface:\
|
||||
return static_cast<QAccessibleValueInterface*>(this);\
|
||||
default:\
|
||||
return nullptr;\
|
||||
}\
|
||||
}\
|
||||
QVariant currentValue() const override;\
|
||||
void setCurrentValue(const QVariant &value) override;\
|
||||
QVariant maximumValue() const override;\
|
||||
QVariant minimumValue() const override;\
|
||||
QVariant minimumStepSize() const override;\
|
||||
private:\
|
||||
classname *m_w;\
|
||||
QString m_description;\
|
||||
};\
|
||||
FUNC_TEXT(classname,accessiblename)\
|
||||
FUNC_CURRENTVALUE(classname)\
|
||||
FUNC_SETCURRENTVALUE(classname)\
|
||||
FUNC_MAXMUMVALUE(classname)\
|
||||
FUNC_FUNC_MINIMUMVALUE(classname)\
|
||||
FUNC_FUNC_MINIMUMSTEPSIZE(classname)\
|
||||
|
||||
#define SET_EDITABLE_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,accessdescription) class Accessible##classname : public QAccessibleWidget, public QAccessibleEditableTextInterface, public QAccessibleTextInterface\
|
||||
{\
|
||||
public:\
|
||||
FUNC_CREATE(classname,QAccessible::EditableText,accessdescription)\
|
||||
QString text(QAccessible::Text t) const override;\
|
||||
QAccessibleInterface *child(int index) const override { Q_UNUSED(index); return nullptr; }\
|
||||
void *interface_cast(QAccessible::InterfaceType t) override{\
|
||||
switch (t) {\
|
||||
case QAccessible::ActionInterface:\
|
||||
return static_cast<QAccessibleActionInterface*>(this);\
|
||||
case QAccessible::TextInterface:\
|
||||
return static_cast<QAccessibleTextInterface*>(this);\
|
||||
case QAccessible::EditableTextInterface:\
|
||||
return static_cast<QAccessibleEditableTextInterface*>(this);\
|
||||
default:\
|
||||
return nullptr;\
|
||||
}\
|
||||
}\
|
||||
QString text(int startOffset, int endOffset) const override;\
|
||||
void selection(int selectionIndex, int *startOffset, int *endOffset) const override {\
|
||||
Q_UNUSED(selectionIndex)\
|
||||
Q_UNUSED(startOffset)\
|
||||
Q_UNUSED(endOffset)\
|
||||
}\
|
||||
int selectionCount() const override { return 0; }\
|
||||
void addSelection(int startOffset, int endOffset) override {\
|
||||
Q_UNUSED(startOffset)\
|
||||
Q_UNUSED(endOffset)\
|
||||
}\
|
||||
void removeSelection(int selectionIndex) override { Q_UNUSED(selectionIndex);}\
|
||||
void setSelection(int selectionIndex, int startOffset, int endOffset) override {\
|
||||
Q_UNUSED(selectionIndex)\
|
||||
Q_UNUSED(startOffset)\
|
||||
Q_UNUSED(endOffset)\
|
||||
}\
|
||||
int cursorPosition() const override { return 0; }\
|
||||
void setCursorPosition(int position) override {\
|
||||
Q_UNUSED(position)\
|
||||
}\
|
||||
int characterCount() const override { return 0; }\
|
||||
QRect characterRect(int offset) const override { \
|
||||
Q_UNUSED(offset)\
|
||||
return QRect(); }\
|
||||
int offsetAtPoint(const QPoint &point) const override {\
|
||||
Q_UNUSED(point)\
|
||||
return 0; }\
|
||||
void scrollToSubstring(int startIndex, int endIndex) override {\
|
||||
Q_UNUSED(startIndex)\
|
||||
Q_UNUSED(endIndex)\
|
||||
}\
|
||||
QString attributes(int offset, int *startOffset, int *endOffset) const override {\
|
||||
Q_UNUSED(offset)\
|
||||
Q_UNUSED(startOffset)\
|
||||
Q_UNUSED(endOffset)\
|
||||
return QString(); }\
|
||||
void insertText(int offset, const QString &text) override {\
|
||||
Q_UNUSED(offset)\
|
||||
Q_UNUSED(text)\
|
||||
}\
|
||||
void deleteText(int startOffset, int endOffset) override {\
|
||||
Q_UNUSED(startOffset)\
|
||||
Q_UNUSED(endOffset)\
|
||||
}\
|
||||
void replaceText(int startOffset, int endOffset, const QString &text) override {\
|
||||
Q_UNUSED(startOffset)\
|
||||
Q_UNUSED(endOffset)\
|
||||
Q_UNUSED(text)\
|
||||
}\
|
||||
private:\
|
||||
classname *m_w;\
|
||||
QString m_description;\
|
||||
};\
|
||||
FUNC_TEXT(classname,accessiblename)\
|
||||
FUNC_TEXT_(classname)\
|
||||
|
||||
#define USE_ACCESSIBLE(classnamestring,classname) if (classnamestring == QLatin1String(#classname) && object && object->isWidgetType())\
|
||||
{\
|
||||
interface = new Accessible##classname(static_cast<classname *>(object));\
|
||||
}\
|
||||
|
||||
#define ELSE_USE_ACCESSIBLE(classnamestring,classname) else if (classnamestring == QLatin1String(#classname) && object && object->isWidgetType())\
|
||||
{\
|
||||
interface = new Accessible##classname(static_cast<classname *>(object));\
|
||||
}\
|
||||
|
||||
|
||||
// [指定objectname]---适用同一个类,但objectname不同的情况
|
||||
#define USE_ACCESSIBLE_BY_OBJECTNAME(classnamestring,classname,objectname) if (classnamestring == QLatin1String(#classname) && object && (object->objectName() == objectname) && object->isWidgetType())\
|
||||
{\
|
||||
interface = new Accessible##classname(static_cast<classname *>(object));\
|
||||
}\
|
||||
|
||||
#define ELSE_USE_ACCESSIBLE_BY_OBJECTNAME(classnamestring,classname,objectname) else if (classnamestring == QLatin1String(#classname) && object && (object->objectName() == objectname) && object->isWidgetType())\
|
||||
{\
|
||||
interface = new Accessible##classname(static_cast<classname *>(object));\
|
||||
}\
|
||||
|
||||
/*******************************************简化使用*******************************************/
|
||||
#define SET_FORM_ACCESSIBLE(classname,accessiblename) SET_FORM_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,"")
|
||||
|
||||
#define SET_BUTTON_ACCESSIBLE(classname,accessiblename) SET_BUTTON_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,"")
|
||||
|
||||
#define SET_LABEL_ACCESSIBLE(classname,accessiblename) SET_LABEL_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,"")
|
||||
|
||||
#define SET_SLIDER_ACCESSIBLE(classname,accessiblename) SET_SLIDER_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,"")
|
||||
|
||||
#define SET_EDITABLE_ACCESSIBLE(classname,accessiblename) SET_EDITABLE_ACCESSIBLE_WITH_DESCRIPTION(classname,accessiblename,"")
|
||||
/************************************************************************************************/
|
||||
|
||||
#endif // ACCESSIBLEINTERFACE_H
|
@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
@ -8,6 +9,8 @@
|
||||
#include "pluginsitem.h"
|
||||
#include "traypluginitem.h"
|
||||
#include "utils.h"
|
||||
#include "appmultiitem.h"
|
||||
#include "quicksettingcontroller.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGSettings>
|
||||
@ -21,41 +24,46 @@ const QGSettings *DockItemManager::m_dockedSettings = Utils::ModuleSettingsPtr("
|
||||
|
||||
DockItemManager::DockItemManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_appInter(new DBusDock("com.deepin.dde.daemon.Dock", "/com/deepin/dde/daemon/Dock", QDBusConnection::sessionBus(), this))
|
||||
, m_pluginsInter(new DockPluginsController(this))
|
||||
, m_appInter(new DockInter(dockServiceName(), dockServicePath(), QDBusConnection::sessionBus(), this))
|
||||
, m_loadFinished(false)
|
||||
{
|
||||
//固定区域:启动器
|
||||
m_itemList.append(new LauncherItem);
|
||||
|
||||
// 应用区域
|
||||
for (auto entry : m_appInter->entries()) {
|
||||
AppItem *it = new AppItem(m_appSettings, m_activeSettings, m_dockedSettings, entry);
|
||||
AppItem *it = new AppItem(m_appInter, m_appSettings, m_activeSettings, m_dockedSettings, entry);
|
||||
manageItem(it);
|
||||
|
||||
connect(it, &AppItem::requestActivateWindow, m_appInter, &DBusDock::ActivateWindow, Qt::QueuedConnection);
|
||||
connect(it, &AppItem::requestPreviewWindow, m_appInter, &DBusDock::PreviewWindow);
|
||||
connect(it, &AppItem::requestCancelPreview, m_appInter, &DBusDock::CancelPreviewWindow);
|
||||
connect(it, &AppItem::requestUpdateItemMinimizedGeometry, this, [=](const QRect r){
|
||||
Q_EMIT requestUpdateItemMinimizedGeometry(it, r);
|
||||
});
|
||||
connect(it, &AppItem::requestActivateWindow, m_appInter, &DockInter::ActivateWindow, Qt::QueuedConnection);
|
||||
connect(it, &AppItem::requestPreviewWindow, m_appInter, &DockInter::PreviewWindow);
|
||||
connect(it, &AppItem::requestCancelPreview, m_appInter, &DockInter::CancelPreviewWindow);
|
||||
connect(it, &AppItem::windowCountChanged, this, &DockItemManager::onAppWindowCountChanged);
|
||||
connect(this, &DockItemManager::requestUpdateDockItem, it, &AppItem::requestUpdateEntryGeometries);
|
||||
|
||||
m_itemList.append(it);
|
||||
updateMultiItems(it);
|
||||
}
|
||||
|
||||
// 托盘区域和插件区域 由DockPluginsController获取
|
||||
QuickSettingController *quickController = QuickSettingController::instance();
|
||||
connect(quickController, &QuickSettingController::pluginInserted, this, [ = ](PluginsItemInterface *itemInter, const QuickSettingController::PluginAttribute pluginAttr) {
|
||||
if (pluginAttr != QuickSettingController::PluginAttribute::Fixed)
|
||||
return;
|
||||
|
||||
m_pluginItems << itemInter;
|
||||
pluginItemInserted(quickController->pluginItemWidget(itemInter));
|
||||
});
|
||||
|
||||
connect(quickController, &QuickSettingController::pluginRemoved, this, &DockItemManager::onPluginItemRemoved);
|
||||
connect(quickController, &QuickSettingController::pluginUpdated, this, &DockItemManager::onPluginUpdate);
|
||||
connect(quickController, &QuickSettingController::pluginLoaderFinished, this, &DockItemManager::onPluginLoadFinished, Qt::QueuedConnection);
|
||||
|
||||
// 应用信号
|
||||
connect(m_appInter, &DBusDock::EntryAdded, this, &DockItemManager::appItemAdded);
|
||||
connect(m_appInter, &DBusDock::EntryRemoved, this, static_cast<void (DockItemManager::*)(const QString &)>(&DockItemManager::appItemRemoved), Qt::QueuedConnection);
|
||||
connect(m_appInter, &DBusDock::ServiceRestarted, this, &DockItemManager::reloadAppItems);
|
||||
|
||||
// 插件信号
|
||||
connect(m_pluginsInter, &DockPluginsController::pluginItemInserted, this, &DockItemManager::pluginItemInserted, Qt::QueuedConnection);
|
||||
connect(m_pluginsInter, &DockPluginsController::pluginItemRemoved, this, &DockItemManager::pluginItemRemoved, Qt::QueuedConnection);
|
||||
connect(m_pluginsInter, &DockPluginsController::pluginItemUpdated, this, &DockItemManager::itemUpdated, Qt::QueuedConnection);
|
||||
connect(m_pluginsInter, &DockPluginsController::trayVisableCountChanged, this, &DockItemManager::trayVisableCountChanged, Qt::QueuedConnection);
|
||||
connect(m_pluginsInter, &DockPluginsController::pluginLoaderFinished, this, &DockItemManager::onPluginLoadFinished, Qt::QueuedConnection);
|
||||
connect(m_appInter, &DockInter::EntryAdded, this, &DockItemManager::appItemAdded);
|
||||
connect(m_appInter, &DockInter::EntryRemoved, this, static_cast<void (DockItemManager::*)(const QString &)>(&DockItemManager::appItemRemoved), Qt::QueuedConnection);
|
||||
connect(m_appInter, &DockInter::ServiceRestarted, this, &DockItemManager::reloadAppItems);
|
||||
connect(m_appInter, &DockInter::ShowMultiWindowChanged, this, &DockItemManager::onShowMultiWindowChanged);
|
||||
|
||||
DApplication *app = qobject_cast<DApplication *>(qApp);
|
||||
if (app) {
|
||||
@ -64,6 +72,13 @@ DockItemManager::DockItemManager(QObject *parent)
|
||||
|
||||
connect(qApp, &QApplication::aboutToQuit, this, &QObject::deleteLater);
|
||||
|
||||
// 读取已经加载的固定区域插件
|
||||
QList<PluginsItemInterface *> plugins = quickController->pluginItems(QuickSettingController::PluginAttribute::Fixed);
|
||||
for (PluginsItemInterface *plugin : plugins) {
|
||||
m_pluginItems << plugin;
|
||||
pluginItemInserted(quickController->pluginItemWidget(plugin));
|
||||
}
|
||||
|
||||
// 刷新图标
|
||||
QMetaObject::invokeMethod(this, "refreshItemsIcon", Qt::QueuedConnection);
|
||||
}
|
||||
@ -81,22 +96,11 @@ const QList<QPointer<DockItem>> DockItemManager::itemList() const
|
||||
return m_itemList;
|
||||
}
|
||||
|
||||
const QList<PluginsItemInterface *> DockItemManager::pluginList() const
|
||||
{
|
||||
return m_pluginsInter->pluginsMap().keys();
|
||||
}
|
||||
|
||||
bool DockItemManager::appIsOnDock(const QString &appDesktop) const
|
||||
{
|
||||
return m_appInter->IsOnDock(appDesktop);
|
||||
}
|
||||
|
||||
void DockItemManager::startLoadPlugins() const
|
||||
{
|
||||
int delay = Utils::SettingValue("com.deepin.dde.dock", "/com/deepin/dde/dock/", "delay-plugins-time", 0).toInt();
|
||||
QTimer::singleShot(delay, m_pluginsInter, &DockPluginsController::startLoader);
|
||||
}
|
||||
|
||||
void DockItemManager::refreshItemsIcon()
|
||||
{
|
||||
for (auto item : m_itemList) {
|
||||
@ -184,7 +188,7 @@ void DockItemManager::appItemAdded(const QDBusObjectPath &path, const int index)
|
||||
++insertIndex;
|
||||
}
|
||||
|
||||
AppItem *item = new AppItem(m_appSettings, m_activeSettings, m_dockedSettings, path);
|
||||
AppItem *item = new AppItem(m_appInter, m_appSettings, m_activeSettings, m_dockedSettings, path);
|
||||
|
||||
if (m_appIDist.contains(item->appId())) {
|
||||
delete item;
|
||||
@ -193,23 +197,23 @@ void DockItemManager::appItemAdded(const QDBusObjectPath &path, const int index)
|
||||
|
||||
manageItem(item);
|
||||
|
||||
connect(item, &AppItem::requestActivateWindow, m_appInter, &DBusDock::ActivateWindow, Qt::QueuedConnection);
|
||||
connect(item, &AppItem::requestPreviewWindow, m_appInter, &DBusDock::PreviewWindow);
|
||||
connect(item, &AppItem::requestCancelPreview, m_appInter, &DBusDock::CancelPreviewWindow);
|
||||
connect(item, &AppItem::requestUpdateItemMinimizedGeometry, this, [=](const QRect r){
|
||||
Q_EMIT requestUpdateItemMinimizedGeometry(item, r);
|
||||
});
|
||||
connect(item, &AppItem::requestActivateWindow, m_appInter, &DockInter::ActivateWindow, Qt::QueuedConnection);
|
||||
connect(item, &AppItem::requestPreviewWindow, m_appInter, &DockInter::PreviewWindow);
|
||||
connect(item, &AppItem::requestCancelPreview, m_appInter, &DockInter::CancelPreviewWindow);
|
||||
connect(item, &AppItem::windowCountChanged, this, &DockItemManager::onAppWindowCountChanged);
|
||||
connect(this, &DockItemManager::requestUpdateDockItem, item, &AppItem::requestUpdateEntryGeometries);
|
||||
|
||||
m_itemList.insert(insertIndex, item);
|
||||
m_appIDist.append(item->appId());
|
||||
|
||||
if (index != -1) {
|
||||
emit itemInserted(insertIndex - 1, item);
|
||||
return;
|
||||
}
|
||||
int itemIndex = insertIndex;
|
||||
if (index != -1)
|
||||
itemIndex = insertIndex - 1;
|
||||
|
||||
emit itemInserted(insertIndex, item);
|
||||
// 插入dockItem
|
||||
emit itemInserted(itemIndex, item);
|
||||
// 向后插入多开窗口
|
||||
updateMultiItems(item, true);
|
||||
}
|
||||
|
||||
void DockItemManager::appItemRemoved(const QString &appId)
|
||||
@ -243,6 +247,24 @@ void DockItemManager::appItemRemoved(AppItem *appItem)
|
||||
appItem->deleteLater();
|
||||
}
|
||||
|
||||
void DockItemManager::reloadAppItems()
|
||||
{
|
||||
// remove old item
|
||||
for (auto item : m_itemList)
|
||||
if (item->itemType() == DockItem::App)
|
||||
appItemRemoved(static_cast<AppItem *>(item.data()));
|
||||
|
||||
// append new item
|
||||
for (auto path : m_appInter->entries())
|
||||
appItemAdded(path, -1);
|
||||
}
|
||||
|
||||
void DockItemManager::manageItem(DockItem *item)
|
||||
{
|
||||
connect(item, &DockItem::requestRefreshWindowVisible, this, &DockItemManager::requestRefershWindowVisible, Qt::UniqueConnection);
|
||||
connect(item, &DockItem::requestWindowAutoHide, this, &DockItemManager::requestWindowAutoHide, Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
void DockItemManager::pluginItemInserted(PluginsItem *item)
|
||||
{
|
||||
manageItem(item);
|
||||
@ -292,44 +314,155 @@ void DockItemManager::pluginItemInserted(PluginsItem *item)
|
||||
|
||||
m_itemList.insert(insertIndex, item);
|
||||
if(pluginType == DockItem::FixedPlugin)
|
||||
{
|
||||
insertIndex ++;
|
||||
}
|
||||
|
||||
if (!Utils::SettingValue(QString("com.deepin.dde.dock.module.") + item->pluginName(), QByteArray(), "enable", true).toBool())
|
||||
item->setVisible(false);
|
||||
else
|
||||
item->setVisible(true);
|
||||
|
||||
emit itemInserted(insertIndex - firstPluginPosition, item);
|
||||
}
|
||||
|
||||
void DockItemManager::pluginItemRemoved(PluginsItem *item)
|
||||
void DockItemManager::onPluginItemRemoved(PluginsItemInterface *itemInter)
|
||||
{
|
||||
if (!m_pluginItems.contains(itemInter))
|
||||
return;
|
||||
|
||||
PluginsItem *item = QuickSettingController::instance()->pluginItemWidget(itemInter);
|
||||
item->hidePopup();
|
||||
item->hide();
|
||||
|
||||
emit itemRemoved(item);
|
||||
|
||||
m_itemList.removeOne(item);
|
||||
|
||||
if (m_loadFinished) {
|
||||
updatePluginsItemOrderKey();
|
||||
}
|
||||
}
|
||||
|
||||
void DockItemManager::reloadAppItems()
|
||||
void DockItemManager::onPluginUpdate(PluginsItemInterface *itemInter)
|
||||
{
|
||||
// remove old item
|
||||
for (auto item : m_itemList)
|
||||
if (item->itemType() == DockItem::App)
|
||||
appItemRemoved(static_cast<AppItem *>(item.data()));
|
||||
if (!m_pluginItems.contains(itemInter))
|
||||
return;
|
||||
|
||||
// append new item
|
||||
for (auto path : m_appInter->entries())
|
||||
appItemAdded(path, -1);
|
||||
}
|
||||
|
||||
void DockItemManager::manageItem(DockItem *item)
|
||||
{
|
||||
connect(item, &DockItem::requestRefreshWindowVisible, this, &DockItemManager::requestRefershWindowVisible, Qt::UniqueConnection);
|
||||
connect(item, &DockItem::requestWindowAutoHide, this, &DockItemManager::requestWindowAutoHide, Qt::UniqueConnection);
|
||||
Q_EMIT itemUpdated(QuickSettingController::instance()->pluginItemWidget(itemInter));
|
||||
}
|
||||
|
||||
void DockItemManager::onPluginLoadFinished()
|
||||
{
|
||||
updatePluginsItemOrderKey();
|
||||
m_loadFinished = true;
|
||||
}
|
||||
|
||||
void DockItemManager::onAppWindowCountChanged()
|
||||
{
|
||||
AppItem *appItem = static_cast<AppItem *>(sender());
|
||||
updateMultiItems(appItem, true);
|
||||
}
|
||||
|
||||
void DockItemManager::updateMultiItems(AppItem *appItem, bool emitSignal)
|
||||
{
|
||||
// 如果系统设置不开启应用多窗口拆分,则无需之后的操作
|
||||
if (!m_appInter->showMultiWindow())
|
||||
return;
|
||||
|
||||
// 如果开启了多窗口拆分,则同步窗口和多窗口应用的信息
|
||||
const WindowInfoMap &windowInfoMap = appItem->windowsMap();
|
||||
QList<AppMultiItem *> removeItems;
|
||||
// 同步当前已经存在的多开窗口的列表,删除不存在的多开窗口
|
||||
for (int i = 0; i < m_itemList.size(); i++) {
|
||||
QPointer<DockItem> dockItem = m_itemList[i];
|
||||
AppMultiItem *multiItem = qobject_cast<AppMultiItem *>(dockItem.data());
|
||||
if (!multiItem || multiItem->appItem() != appItem)
|
||||
continue;
|
||||
|
||||
// 如果查找到的当前的应用的窗口不需要移除,则继续下一个循环
|
||||
if (!needRemoveMultiWindow(multiItem))
|
||||
continue;
|
||||
|
||||
removeItems << multiItem;
|
||||
}
|
||||
// 从itemList中移除多开窗口
|
||||
for (AppMultiItem *dockItem : removeItems)
|
||||
m_itemList.removeOne(dockItem);
|
||||
if (emitSignal) {
|
||||
// 移除发送每个多开窗口的移除信号
|
||||
for (AppMultiItem *dockItem : removeItems)
|
||||
Q_EMIT itemRemoved(dockItem);
|
||||
}
|
||||
qDeleteAll(removeItems);
|
||||
|
||||
// 遍历当前APP打开的所有窗口的列表,如果不存在多开窗口的应用,则新增,同时发送信号
|
||||
for (auto it = windowInfoMap.begin(); it != windowInfoMap.end(); it++) {
|
||||
if (multiWindowExist(it.key()))
|
||||
continue;
|
||||
|
||||
const WindowInfo &windowInfo = it.value();
|
||||
// 如果不存在这个窗口对应的多开窗口,则新建一个窗口,同时发送窗口新增的信号
|
||||
AppMultiItem *multiItem = new AppMultiItem(appItem, it.key(), windowInfo);
|
||||
m_itemList << multiItem;
|
||||
if (emitSignal)
|
||||
Q_EMIT itemInserted(-1, multiItem);
|
||||
}
|
||||
}
|
||||
|
||||
// 检查对应的窗口是否存在多开窗口
|
||||
bool DockItemManager::multiWindowExist(quint32 winId) const
|
||||
{
|
||||
for (QPointer<DockItem> dockItem : m_itemList) {
|
||||
AppMultiItem *multiItem = qobject_cast<AppMultiItem *>(dockItem.data());
|
||||
if (!multiItem)
|
||||
continue;
|
||||
|
||||
if (multiItem->winId() == winId)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// 检查当前多开窗口是否需要移除
|
||||
// 如果当前多开窗口图标对应的窗口在这个窗口所属的APP中所有打开窗口中不存在,那么则认为该多窗口已经被关闭
|
||||
bool DockItemManager::needRemoveMultiWindow(AppMultiItem *multiItem) const
|
||||
{
|
||||
// 查找多分窗口对应的窗口在应用所有的打开的窗口中是否存在,只要它对应的窗口存在,就无需删除
|
||||
// 只要不存在,就需要删除
|
||||
AppItem *appItem = multiItem->appItem();
|
||||
const WindowInfoMap &windowInfoMap = appItem->windowsMap();
|
||||
for (auto it = windowInfoMap.begin(); it != windowInfoMap.end(); it++) {
|
||||
if (it.key() == multiItem->winId())
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void DockItemManager::onShowMultiWindowChanged()
|
||||
{
|
||||
if (m_appInter->showMultiWindow()) {
|
||||
// 如果当前设置支持窗口多开,那么就依次对每个APPItem加载多开窗口
|
||||
for (int i = 0; i < m_itemList.size(); i++) {
|
||||
const QPointer<DockItem> &dockItem = m_itemList[i];
|
||||
if (dockItem->itemType() != DockItem::ItemType::App)
|
||||
continue;
|
||||
|
||||
updateMultiItems(static_cast<AppItem *>(dockItem.data()), true);
|
||||
}
|
||||
} else {
|
||||
// 如果当前设置不支持窗口多开,则删除所有的多开窗口
|
||||
QList<DockItem *> multiWindows;
|
||||
for (const QPointer<DockItem> &dockItem : m_itemList) {
|
||||
if (dockItem->itemType() != DockItem::AppMultiWindow)
|
||||
continue;
|
||||
|
||||
multiWindows << dockItem.data();
|
||||
}
|
||||
for (DockItem *multiItem : multiWindows) {
|
||||
m_itemList.removeOne(multiItem);
|
||||
Q_EMIT itemRemoved(multiItem);
|
||||
multiItem->deleteLater();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
// SPDX-FileCopyrightText: 2019 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
// Copyright (C) 2019 ~ 2019 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef DOCKITEMMANAGER_H
|
||||
#define DOCKITEMMANAGER_H
|
||||
|
||||
#include "dockpluginscontroller.h"
|
||||
#include "pluginsiteminterface.h"
|
||||
#include "dockitem.h"
|
||||
#include "appitem.h"
|
||||
#include "placeholderitem.h"
|
||||
|
||||
#include <com_deepin_dde_daemon_dock.h>
|
||||
#include "dbusutil.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
using DBusDock = com::deepin::dde::daemon::Dock;
|
||||
class AppMultiItem;
|
||||
class PluginsItem;
|
||||
|
||||
/**
|
||||
* @brief The DockItemManager class
|
||||
@ -29,9 +29,7 @@ public:
|
||||
static DockItemManager *instance(QObject *parent = nullptr);
|
||||
|
||||
const QList<QPointer<DockItem> > itemList() const;
|
||||
const QList<PluginsItemInterface *> pluginList() const;
|
||||
bool appIsOnDock(const QString &appDesktop) const;
|
||||
void startLoadPlugins() const;
|
||||
|
||||
signals:
|
||||
void itemInserted(const int index, DockItem *item) const;
|
||||
@ -40,8 +38,8 @@ signals:
|
||||
void trayVisableCountChanged(const int &count) const;
|
||||
void requestWindowAutoHide(const bool autoHide) const;
|
||||
void requestRefershWindowVisible() const;
|
||||
|
||||
void requestUpdateDockItem() const;
|
||||
void requestUpdateItemMinimizedGeometry(AppItem *item, const QRect) const;
|
||||
|
||||
public slots:
|
||||
void refreshItemsIcon();
|
||||
@ -50,26 +48,36 @@ public slots:
|
||||
|
||||
private Q_SLOTS:
|
||||
void onPluginLoadFinished();
|
||||
void onPluginItemRemoved(PluginsItemInterface *itemInter);
|
||||
void onPluginUpdate(PluginsItemInterface *itemInter);
|
||||
|
||||
void onAppWindowCountChanged();
|
||||
void onShowMultiWindowChanged();
|
||||
|
||||
private:
|
||||
explicit DockItemManager(QObject *parent = nullptr);
|
||||
void appItemAdded(const QDBusObjectPath &path, const int index);
|
||||
void appItemRemoved(const QString &appId);
|
||||
void appItemRemoved(AppItem *appItem);
|
||||
void pluginItemInserted(PluginsItem *item);
|
||||
void pluginItemRemoved(PluginsItem *item);
|
||||
void updatePluginsItemOrderKey();
|
||||
void reloadAppItems();
|
||||
void manageItem(DockItem *item);
|
||||
void pluginItemInserted(PluginsItem *item);
|
||||
|
||||
void updateMultiItems(AppItem *appItem, bool emitSignal = false);
|
||||
bool multiWindowExist(quint32 winId) const;
|
||||
bool needRemoveMultiWindow(AppMultiItem *multiItem) const;
|
||||
|
||||
private:
|
||||
DBusDock *m_appInter;
|
||||
DockPluginsController *m_pluginsInter;
|
||||
DockInter *m_appInter;
|
||||
|
||||
static DockItemManager *INSTANCE;
|
||||
|
||||
QList<QPointer<DockItem>> m_itemList;
|
||||
QList<QString> m_appIDist;
|
||||
QList<PluginsItemInterface *> m_pluginItems;
|
||||
|
||||
bool m_loadFinished; // 记录所有插件是否加载完成
|
||||
|
||||
static const QGSettings *m_appSettings;
|
||||
static const QGSettings *m_activeSettings;
|
||||
|
@ -1,162 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2011 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "dockpluginscontroller.h"
|
||||
#include "pluginsiteminterface.h"
|
||||
#include "traypluginitem.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QDrag>
|
||||
|
||||
DockPluginsController::DockPluginsController(QObject *parent)
|
||||
: AbstractPluginsController(parent)
|
||||
{
|
||||
setObjectName("DockPlugin");
|
||||
}
|
||||
|
||||
void DockPluginsController::itemAdded(PluginsItemInterface *const itemInter, const QString &itemKey)
|
||||
{
|
||||
QMap<PluginsItemInterface *, QMap<QString, QObject *>> &mPluginsMap = pluginsMap();
|
||||
|
||||
// check if same item added
|
||||
if (mPluginsMap.contains(itemInter))
|
||||
if (mPluginsMap[itemInter].contains(itemKey))
|
||||
return;
|
||||
|
||||
// 取 plugin api
|
||||
QPluginLoader *pluginLoader = qobject_cast<QPluginLoader*>(mPluginsMap[itemInter].value("pluginloader"));
|
||||
if (!pluginLoader) {
|
||||
return;
|
||||
}
|
||||
const QJsonObject &meta = pluginLoader->metaData().value("MetaData").toObject();
|
||||
const QString &pluginApi = meta.value("api").toString();
|
||||
|
||||
PluginsItem *item = nullptr;
|
||||
if (itemInter->pluginName() == "tray") {
|
||||
item = new TrayPluginItem(itemInter, itemKey, pluginApi);
|
||||
if (item->graphicsEffect()) {
|
||||
item->graphicsEffect()->setEnabled(false);
|
||||
}
|
||||
connect(static_cast<TrayPluginItem *>(item), &TrayPluginItem::trayVisableCountChanged,
|
||||
this, &DockPluginsController::trayVisableCountChanged, Qt::UniqueConnection);
|
||||
} else {
|
||||
item = new PluginsItem(itemInter, itemKey, pluginApi);
|
||||
}
|
||||
|
||||
mPluginsMap[itemInter][itemKey] = item;
|
||||
|
||||
emit pluginItemInserted(item);
|
||||
}
|
||||
|
||||
void DockPluginsController::itemUpdate(PluginsItemInterface *const itemInter, const QString &itemKey)
|
||||
{
|
||||
PluginsItem *item = static_cast<PluginsItem *>(pluginItemAt(itemInter, itemKey));
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
item->update();
|
||||
|
||||
emit pluginItemUpdated(item);
|
||||
}
|
||||
|
||||
void DockPluginsController::itemRemoved(PluginsItemInterface *const itemInter, const QString &itemKey)
|
||||
{
|
||||
PluginsItem *item = static_cast<PluginsItem *>(pluginItemAt(itemInter, itemKey));
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
item->detachPluginWidget();
|
||||
|
||||
emit pluginItemRemoved(item);
|
||||
|
||||
QMap<PluginsItemInterface *, QMap<QString, QObject *>> &mPluginsMap = pluginsMap();
|
||||
mPluginsMap[itemInter].remove(itemKey);
|
||||
|
||||
// do not delete the itemWidget object(specified in the plugin interface)
|
||||
item->centralWidget()->setParent(nullptr);
|
||||
|
||||
if (item->isDragging()) {
|
||||
QDrag::cancel();
|
||||
}
|
||||
|
||||
// just delete our wrapper object(PluginsItem)
|
||||
item->deleteLater();
|
||||
}
|
||||
|
||||
void DockPluginsController::requestWindowAutoHide(PluginsItemInterface *const itemInter, const QString &itemKey, const bool autoHide)
|
||||
{
|
||||
PluginsItem *item = static_cast<PluginsItem *>(pluginItemAt(itemInter, itemKey));
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
Q_EMIT item->requestWindowAutoHide(autoHide);
|
||||
}
|
||||
|
||||
void DockPluginsController::requestRefreshWindowVisible(PluginsItemInterface *const itemInter, const QString &itemKey)
|
||||
{
|
||||
PluginsItem *item = static_cast<PluginsItem *>(pluginItemAt(itemInter, itemKey));
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
Q_EMIT item->requestRefreshWindowVisible();
|
||||
}
|
||||
|
||||
void DockPluginsController::requestSetAppletVisible(PluginsItemInterface *const itemInter, const QString &itemKey, const bool visible)
|
||||
{
|
||||
PluginsItem *item = static_cast<PluginsItem *>(pluginItemAt(itemInter, itemKey));
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
if (visible) {
|
||||
// 在弹出界面前先隐藏其他插件的tips
|
||||
QMap<PluginsItemInterface *, QMap<QString, QObject *>> &mPluginsMap = pluginsMap();
|
||||
foreach (auto interface, mPluginsMap.keys()) {
|
||||
if (interface != itemInter) {
|
||||
foreach (auto oldItemKey, mPluginsMap[interface].keys()) {
|
||||
if (oldItemKey != "pluginloader") {
|
||||
PluginsItem *oldItem = qobject_cast<PluginsItem *>(pluginItemAt(interface, oldItemKey));
|
||||
if (oldItem) {
|
||||
oldItem->hidePopup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item->showPopupApplet(itemInter->itemPopupApplet(itemKey));
|
||||
} else {
|
||||
item->hidePopup();
|
||||
}
|
||||
}
|
||||
|
||||
void DockPluginsController::startLoader()
|
||||
{
|
||||
loadLocalPlugins();
|
||||
loadSystemPlugins();
|
||||
}
|
||||
|
||||
void DockPluginsController::loadLocalPlugins()
|
||||
{
|
||||
QString pluginsDir(QString("%1/.local/lib/dde-dock/plugins/").arg(QDir::homePath()));
|
||||
|
||||
if (!QDir(pluginsDir).exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug() << "using dock local plugins dir:" << pluginsDir;
|
||||
|
||||
AbstractPluginsController::startLoader(new PluginLoader(pluginsDir, this));
|
||||
}
|
||||
|
||||
void DockPluginsController::loadSystemPlugins()
|
||||
{
|
||||
QString pluginsDir(qApp->applicationDirPath() + "/../plugins");
|
||||
#ifndef QT_DEBUG
|
||||
pluginsDir = "/usr/lib/dde-dock/plugins";
|
||||
#endif
|
||||
qDebug() << "using dock plugins dir:" << pluginsDir;
|
||||
|
||||
AbstractPluginsController::startLoader(new PluginLoader(pluginsDir, this));
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2011 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef DOCKPLUGINSCONTROLLER_H
|
||||
#define DOCKPLUGINSCONTROLLER_H
|
||||
|
||||
#include "pluginsitem.h"
|
||||
#include "pluginproxyinterface.h"
|
||||
#include "abstractpluginscontroller.h"
|
||||
|
||||
#include <com_deepin_dde_daemon_dock.h>
|
||||
|
||||
#include <QPluginLoader>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QDBusConnectionInterface>
|
||||
|
||||
class PluginsItemInterface;
|
||||
class DockPluginsController : public AbstractPluginsController
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class DockItemController;
|
||||
friend class DockItemManager;
|
||||
|
||||
public:
|
||||
explicit DockPluginsController(QObject *parent = nullptr);
|
||||
|
||||
// implements PluginProxyInterface
|
||||
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void requestWindowAutoHide(PluginsItemInterface * const itemInter, const QString &itemKey, const bool autoHide) override;
|
||||
void requestRefreshWindowVisible(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) override;
|
||||
|
||||
void startLoader();
|
||||
|
||||
signals:
|
||||
void pluginItemInserted(PluginsItem *pluginItem) const;
|
||||
void pluginItemRemoved(PluginsItem *pluginItem) const;
|
||||
void pluginItemUpdated(PluginsItem *pluginItem) const;
|
||||
void trayVisableCountChanged(const int &count) const;
|
||||
|
||||
private:
|
||||
void loadLocalPlugins();
|
||||
void loadSystemPlugins();
|
||||
};
|
||||
|
||||
#endif // DOCKPLUGINSCONTROLLER_H
|
139
frame/controller/multiwindowhelper.cpp
Normal file
139
frame/controller/multiwindowhelper.cpp
Normal file
@ -0,0 +1,139 @@
|
||||
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "multiwindowhelper.h"
|
||||
#include "appmultiitem.h"
|
||||
#include "appitem.h"
|
||||
|
||||
MultiWindowHelper::MultiWindowHelper(QWidget *appWidget, QWidget *multiWindowWidget, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_appWidget(appWidget)
|
||||
, m_multiWindowWidget(multiWindowWidget)
|
||||
, m_displayMode(Dock::DisplayMode::Efficient)
|
||||
{
|
||||
m_appWidget->installEventFilter(this);
|
||||
m_multiWindowWidget->installEventFilter(this);
|
||||
}
|
||||
|
||||
void MultiWindowHelper::setDisplayMode(Dock::DisplayMode displayMode)
|
||||
{
|
||||
if (m_displayMode == displayMode)
|
||||
return;
|
||||
|
||||
m_displayMode = displayMode;
|
||||
resetMultiItemPosition();
|
||||
}
|
||||
|
||||
void MultiWindowHelper::addMultiWindow(int, AppMultiItem *item)
|
||||
{
|
||||
int index = itemIndex(item);
|
||||
if (m_displayMode == Dock::DisplayMode::Efficient) {
|
||||
// 将多开窗口项目插入到对应的APP的后面
|
||||
insertChildWidget(m_appWidget, index, item);
|
||||
} else {
|
||||
// 将多开窗口插入到工具区域的前面
|
||||
insertChildWidget(m_multiWindowWidget, index, item);
|
||||
}
|
||||
}
|
||||
|
||||
void MultiWindowHelper::removeMultiWindow(AppMultiItem *item)
|
||||
{
|
||||
if (m_appWidget->children().contains(item))
|
||||
m_appWidget->layout()->removeWidget(item);
|
||||
else
|
||||
m_multiWindowWidget->layout()->removeWidget(item);
|
||||
}
|
||||
|
||||
bool MultiWindowHelper::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == m_appWidget || watched == m_multiWindowWidget) {
|
||||
switch(event->type()) {
|
||||
case QEvent::ChildAdded:
|
||||
case QEvent::ChildRemoved: {
|
||||
/* 这里用异步的方式,因为收到QEvent::ChildAdded信号的时候,
|
||||
此时应用还没有插入到Widget中,收到QEvent::ChildRemoved信号的时候,
|
||||
此时应用还未从任务栏上移除,通过异步的方式保证同步新增或移除成功后才执行,这样更新的界面才是最准确的
|
||||
*/
|
||||
QMetaObject::invokeMethod(this, &MultiWindowHelper::requestUpdate, Qt::QueuedConnection);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
int MultiWindowHelper::itemIndex(AppMultiItem *item)
|
||||
{
|
||||
if (m_displayMode != Dock::DisplayMode::Efficient)
|
||||
return -1;
|
||||
|
||||
// 高效模式,查找对应的应用或者这个应用所有的子窗口所在的位置,然后插入到最大的值的后面
|
||||
int lastIndex = -1;
|
||||
for (int i = 0; i < m_appWidget->layout()->count(); i++) {
|
||||
DockItem *dockItem = qobject_cast<DockItem *>(m_appWidget->layout()->itemAt(i)->widget());
|
||||
if (!dockItem)
|
||||
continue;
|
||||
|
||||
if (dockItem != item->appItem()) {
|
||||
AppMultiItem *multiItem = qobject_cast<AppMultiItem *>(dockItem);
|
||||
if (!multiItem || multiItem->appItem() != item->appItem())
|
||||
continue;
|
||||
}
|
||||
|
||||
lastIndex = i;
|
||||
}
|
||||
|
||||
if (lastIndex >= 0)
|
||||
return ++lastIndex;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void MultiWindowHelper::insertChildWidget(QWidget *parentWidget, int index, AppMultiItem *item)
|
||||
{
|
||||
QBoxLayout *layout = static_cast<QBoxLayout *>(parentWidget->layout());
|
||||
if (index >= 0)
|
||||
layout->insertWidget(index, item);
|
||||
else
|
||||
layout->addWidget(item);
|
||||
}
|
||||
|
||||
void MultiWindowHelper::resetMultiItemPosition()
|
||||
{
|
||||
QWidget *fromWidget = nullptr;
|
||||
QWidget *toWidget = nullptr;
|
||||
|
||||
if (m_displayMode == Dock::DisplayMode::Efficient) {
|
||||
// 从时尚模式变换为高效模式
|
||||
fromWidget = m_multiWindowWidget;
|
||||
toWidget = m_appWidget;
|
||||
} else {
|
||||
// 从高效模式变换到时尚模式
|
||||
fromWidget = m_appWidget;
|
||||
toWidget = m_multiWindowWidget;
|
||||
}
|
||||
|
||||
QList<AppMultiItem *> moveWidgetItem;
|
||||
for (int i = 0; i < fromWidget->layout()->count(); i++) {
|
||||
AppMultiItem *multiItem = qobject_cast<AppMultiItem *>(fromWidget->layout()->itemAt(i)->widget());
|
||||
if (!multiItem)
|
||||
continue;
|
||||
|
||||
moveWidgetItem << multiItem;
|
||||
}
|
||||
|
||||
QBoxLayout *toLayout = static_cast<QBoxLayout *>(toWidget->layout());
|
||||
for (AppMultiItem *item : moveWidgetItem) {
|
||||
fromWidget->layout()->removeWidget(item);
|
||||
int index = itemIndex(item);
|
||||
if (index >= 0)
|
||||
toLayout->insertWidget(index, item);
|
||||
else
|
||||
toLayout->addWidget(item);
|
||||
}
|
||||
}
|
43
frame/controller/multiwindowhelper.h
Normal file
43
frame/controller/multiwindowhelper.h
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef MULTIWINDOWHELPER_H
|
||||
#define MULTIWINDOWHELPER_H
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class AppMultiItem;
|
||||
|
||||
class MultiWindowHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MultiWindowHelper(QWidget *appWidget, QWidget *multiWindowWidget, QObject *parent = nullptr);
|
||||
|
||||
void setDisplayMode(Dock::DisplayMode displayMode);
|
||||
void addMultiWindow(int, AppMultiItem *item);
|
||||
void removeMultiWindow(AppMultiItem *item);
|
||||
|
||||
Q_SIGNALS:
|
||||
void requestUpdate();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
int itemIndex(AppMultiItem *item);
|
||||
void insertChildWidget(QWidget *parentWidget, int index, AppMultiItem *item);
|
||||
void resetMultiItemPosition();
|
||||
|
||||
private:
|
||||
QWidget *m_appWidget;
|
||||
QWidget *m_multiWindowWidget;
|
||||
Dock::DisplayMode m_displayMode;
|
||||
};
|
||||
|
||||
#endif // MULTIWINDOWHELPER_H
|
164
frame/controller/quicksettingcontroller.cpp
Normal file
164
frame/controller/quicksettingcontroller.cpp
Normal file
@ -0,0 +1,164 @@
|
||||
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "quicksettingcontroller.h"
|
||||
#include "pluginsitem.h"
|
||||
#include "pluginmanagerinterface.h"
|
||||
|
||||
#include <QMetaObject>
|
||||
#include <customevent.h>
|
||||
|
||||
QuickSettingController::QuickSettingController(QObject *parent)
|
||||
: AbstractPluginsController(parent)
|
||||
{
|
||||
qApp->installEventFilter(this);
|
||||
// 只有在非安全模式下才加载插件,安全模式会在等退出安全模式后通过接受事件的方式来加载插件
|
||||
if (!qApp->property("safeMode").toBool())
|
||||
QMetaObject::invokeMethod(this, &QuickSettingController::startLoader, Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
QuickSettingController::~QuickSettingController()
|
||||
{
|
||||
}
|
||||
|
||||
bool QuickSettingController::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == qApp && event->type() == PluginLoadEvent::eventType()) {
|
||||
// 如果收到的是重新加载插件的消息(一般是在退出安全模式后),则直接加载插件即可
|
||||
startLoader();
|
||||
}
|
||||
|
||||
return AbstractPluginsController::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void QuickSettingController::startLoader()
|
||||
{
|
||||
#ifdef QT_DEBUG
|
||||
AbstractPluginsController::startLoader(new PluginLoader(QString("%1/..%2").arg(qApp->applicationDirPath()).arg("/plugins/loader"), this));
|
||||
#else
|
||||
AbstractPluginsController::startLoader(new PluginLoader("/usr/lib/dde-dock/plugins/loader", this));
|
||||
#endif
|
||||
}
|
||||
|
||||
void QuickSettingController::itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey)
|
||||
{
|
||||
// 根据读取到的metaData数据获取当前插件的类型,提供给外部
|
||||
PluginAttribute pluginAttr = pluginAttribute(itemInter);
|
||||
m_quickPlugins[pluginAttr] << itemInter;
|
||||
|
||||
emit pluginInserted(itemInter, pluginAttr);
|
||||
}
|
||||
|
||||
void QuickSettingController::itemUpdate(PluginsItemInterface * const itemInter, const QString &)
|
||||
{
|
||||
updateDockInfo(itemInter, DockPart::QuickPanel);
|
||||
updateDockInfo(itemInter, DockPart::QuickShow);
|
||||
updateDockInfo(itemInter, DockPart::SystemPanel);
|
||||
}
|
||||
|
||||
void QuickSettingController::itemRemoved(PluginsItemInterface * const itemInter, const QString &)
|
||||
{
|
||||
for (auto it = m_quickPlugins.begin(); it != m_quickPlugins.end(); it++) {
|
||||
QList<PluginsItemInterface *> &plugins = m_quickPlugins[it.key()];
|
||||
if (!plugins.contains(itemInter))
|
||||
continue;
|
||||
|
||||
plugins.removeOne(itemInter);
|
||||
if (plugins.isEmpty()) {
|
||||
QuickSettingController::PluginAttribute pluginclass = it.key();
|
||||
m_quickPlugins.remove(pluginclass);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Q_EMIT pluginRemoved(itemInter);
|
||||
}
|
||||
|
||||
void QuickSettingController::requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible)
|
||||
{
|
||||
// 设置插件列表可见事件
|
||||
Q_EMIT requestAppletVisible(itemInter, itemKey, visible);
|
||||
}
|
||||
|
||||
void QuickSettingController::updateDockInfo(PluginsItemInterface * const itemInter, const DockPart &part)
|
||||
{
|
||||
Q_EMIT pluginUpdated(itemInter, part);
|
||||
}
|
||||
|
||||
QuickSettingController::PluginAttribute QuickSettingController::pluginAttribute(PluginsItemInterface * const itemInter) const
|
||||
{
|
||||
// 工具插件,例如回收站
|
||||
if (itemInter->flags() & PluginFlag::Type_Tool)
|
||||
return PluginAttribute::Tool;
|
||||
|
||||
// 系统插件,例如关机按钮
|
||||
if (itemInter->flags() & PluginFlag::Type_System)
|
||||
return PluginAttribute::System;
|
||||
|
||||
// 托盘插件,例如磁盘图标
|
||||
if (itemInter->flags() & PluginFlag::Type_Tray)
|
||||
return PluginAttribute::Tray;
|
||||
|
||||
// 固定插件,例如显示桌面和多任务试图
|
||||
if (itemInter->flags() & PluginFlag::Type_Fixed)
|
||||
return PluginAttribute::Fixed;
|
||||
|
||||
// 通用插件,一般的插件都是通用插件,就是放在快捷插件区域的那些插件
|
||||
if (itemInter->flags() & PluginFlag::Type_Common)
|
||||
return PluginAttribute::Quick;
|
||||
|
||||
// 基本插件,不在任务栏上显示的插件
|
||||
return PluginAttribute::None;
|
||||
}
|
||||
|
||||
QString QuickSettingController::itemKey(PluginsItemInterface *pluginItem) const
|
||||
{
|
||||
PluginManagerInterface *pManager = pluginManager();
|
||||
if (pManager)
|
||||
return pManager->itemKey(pluginItem);
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
QuickSettingController *QuickSettingController::instance()
|
||||
{
|
||||
static QuickSettingController instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
QList<PluginsItemInterface *> QuickSettingController::pluginItems(const PluginAttribute &pluginClass) const
|
||||
{
|
||||
return m_quickPlugins.value(pluginClass);
|
||||
}
|
||||
|
||||
QJsonObject QuickSettingController::metaData(PluginsItemInterface *pluginItem)
|
||||
{
|
||||
PluginManagerInterface *pManager = pluginManager();
|
||||
if (pManager)
|
||||
return pManager->metaData(pluginItem);
|
||||
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
PluginsItem *QuickSettingController::pluginItemWidget(PluginsItemInterface *pluginItem)
|
||||
{
|
||||
if (m_pluginItemWidgetMap.contains(pluginItem))
|
||||
return m_pluginItemWidgetMap[pluginItem];
|
||||
|
||||
PluginsItem *widget = new PluginsItem(pluginItem, itemKey(pluginItem), metaData(pluginItem));
|
||||
m_pluginItemWidgetMap[pluginItem] = widget;
|
||||
return widget;
|
||||
}
|
||||
|
||||
QList<PluginsItemInterface *> QuickSettingController::pluginInSettings()
|
||||
{
|
||||
PluginManagerInterface *pManager = pluginManager();
|
||||
if (!pManager)
|
||||
return QList<PluginsItemInterface *>();
|
||||
|
||||
// 返回可用于在控制中心显示的插件
|
||||
return pManager->pluginsInSetting();
|
||||
}
|
64
frame/controller/quicksettingcontroller.h
Normal file
64
frame/controller/quicksettingcontroller.h
Normal file
@ -0,0 +1,64 @@
|
||||
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef QUICKSETTINGCONTROLLER_H
|
||||
#define QUICKSETTINGCONTROLLER_H
|
||||
|
||||
#include "abstractpluginscontroller.h"
|
||||
#include "pluginsiteminterface.h"
|
||||
|
||||
class QuickSettingItem;
|
||||
class PluginsItem;
|
||||
|
||||
class QuickSettingController : public AbstractPluginsController
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum class PluginAttribute {
|
||||
None = 0, // 不在任何区域显示的插件
|
||||
Quick, // 快捷区域插件
|
||||
Tool, // 工具插件(回收站和窗管开发的另一套插件)
|
||||
System, // 系统插件(关机插件)
|
||||
Tray, // 托盘插件(U盘图标等)
|
||||
Fixed // 固定区域插件(显示桌面和多任务视图)
|
||||
};
|
||||
|
||||
public:
|
||||
static QuickSettingController *instance();
|
||||
QList<PluginsItemInterface *> pluginItems(const PluginAttribute &pluginClass) const;
|
||||
QJsonObject metaData(PluginsItemInterface *pluginItem);
|
||||
PluginsItem *pluginItemWidget(PluginsItemInterface *pluginItem);
|
||||
QList<PluginsItemInterface *> pluginInSettings();
|
||||
PluginAttribute pluginAttribute(PluginsItemInterface * const itemInter) const;
|
||||
QString itemKey(PluginsItemInterface *pluginItem) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void pluginInserted(PluginsItemInterface *itemInter, const PluginAttribute);
|
||||
void pluginRemoved(PluginsItemInterface *itemInter);
|
||||
void pluginUpdated(PluginsItemInterface *, const DockPart);
|
||||
void requestAppletVisible(PluginsItemInterface * itemInter, const QString &itemKey, bool visible);
|
||||
|
||||
protected:
|
||||
explicit QuickSettingController(QObject *parent = Q_NULLPTR);
|
||||
~QuickSettingController() override;
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
void startLoader();
|
||||
|
||||
protected:
|
||||
void itemAdded(PluginsItemInterface * const itemInter, const QString &itemKey) override;
|
||||
void itemUpdate(PluginsItemInterface * const itemInter, const QString &) override;
|
||||
void itemRemoved(PluginsItemInterface * const itemInter, const QString &) override;
|
||||
void requestSetAppletVisible(PluginsItemInterface * const itemInter, const QString &itemKey, const bool visible) override;
|
||||
|
||||
void updateDockInfo(PluginsItemInterface * const itemInter, const DockPart &part) override;
|
||||
|
||||
private:
|
||||
QMap<PluginAttribute, QList<PluginsItemInterface *>> m_quickPlugins;
|
||||
QMap<PluginsItemInterface *, PluginsItem *> m_pluginItemWidgetMap;
|
||||
};
|
||||
|
||||
#endif // CONTAINERPLUGINSCONTROLLER_H
|
234
frame/controller/recentapphelper.cpp
Normal file
234
frame/controller/recentapphelper.cpp
Normal file
@ -0,0 +1,234 @@
|
||||
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "recentapphelper.h"
|
||||
#include "appitem.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#define ENTRY_NONE 0
|
||||
#define ENTRY_NORMAL 1
|
||||
#define ENTRY_RECENT 2
|
||||
|
||||
RecentAppHelper::RecentAppHelper(QWidget *appWidget, QWidget *recentWidget, DockInter *dockInter, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_appWidget(appWidget)
|
||||
, m_recentWidget(recentWidget)
|
||||
, m_dockInter(dockInter)
|
||||
{
|
||||
m_appWidget->installEventFilter(this);
|
||||
m_recentWidget->installEventFilter(this);
|
||||
}
|
||||
|
||||
void RecentAppHelper::setDisplayMode(Dock::DisplayMode displayMode)
|
||||
{
|
||||
bool lastVisible = dockAppIsVisible();
|
||||
m_displayMode = displayMode;
|
||||
updateRecentVisible();
|
||||
updateDockAppVisible(lastVisible);
|
||||
}
|
||||
|
||||
// 当在应用区域调整位置的时候,需要重新设置索引
|
||||
void RecentAppHelper::resetAppInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void RecentAppHelper::addAppItem(int index, DockItem *dockItem)
|
||||
{
|
||||
if (appInRecent(dockItem)) {
|
||||
addRecentAreaItem(index, dockItem);
|
||||
updateRecentVisible();
|
||||
} else {
|
||||
bool lastVisible = dockAppIsVisible();
|
||||
addAppAreaItem(index, dockItem);
|
||||
updateDockAppVisible(lastVisible);
|
||||
}
|
||||
|
||||
AppItem *appItem = qobject_cast<AppItem *>(dockItem);
|
||||
|
||||
connect(appItem, &AppItem::modeChanged, this, &RecentAppHelper::onModeChanged);
|
||||
}
|
||||
|
||||
void RecentAppHelper::removeAppItem(DockItem *dockItem)
|
||||
{
|
||||
if (m_recentWidget->children().contains(dockItem))
|
||||
removeRecentAreaItem(dockItem);
|
||||
else
|
||||
removeAppAreaItem(dockItem);
|
||||
}
|
||||
|
||||
bool RecentAppHelper::recentIsVisible() const
|
||||
{
|
||||
return m_recentWidget->isVisible();
|
||||
}
|
||||
|
||||
bool RecentAppHelper::dockAppIsVisible() const
|
||||
{
|
||||
return (m_displayMode == Dock::DisplayMode::Efficient
|
||||
|| m_appWidget->layout()->count() > 0);
|
||||
}
|
||||
|
||||
void RecentAppHelper::updateDockInter(DockInter *dockInter)
|
||||
{
|
||||
m_dockInter = dockInter;
|
||||
}
|
||||
|
||||
bool RecentAppHelper::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == m_appWidget || watched == m_recentWidget) {
|
||||
switch(event->type()) {
|
||||
case QEvent::ChildAdded:
|
||||
case QEvent::ChildRemoved: {
|
||||
QMetaObject::invokeMethod(this, [ this ] {
|
||||
/* 这里用异步的方式,因为收到QEvent::ChildAdded信号的时候,
|
||||
此时应用还没有插入到Widget中,收到QEvent::ChildRemoved信号的时候,
|
||||
此时应用还未从任务栏上移除,通过异步的方式保证同步新增或移除成功后才执行,这样更新的界面才是最准确的
|
||||
*/
|
||||
Q_EMIT requestUpdate();
|
||||
}, Qt::QueuedConnection);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return QObject::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
void RecentAppHelper::onModeChanged(int mode)
|
||||
{
|
||||
AppItem *appItem = qobject_cast<AppItem *>(sender());
|
||||
if (!appItem)
|
||||
return;
|
||||
|
||||
auto moveItemToWidget = [ = ](QWidget *widget) {
|
||||
int index = getEntryIndex(appItem, widget);
|
||||
removeAppItem(appItem);
|
||||
QBoxLayout *layout = static_cast<QBoxLayout *>(widget->layout());
|
||||
layout->insertWidget(index, appItem);
|
||||
};
|
||||
|
||||
if (mode == ENTRY_NORMAL) {
|
||||
// 添加到应用区域
|
||||
moveItemToWidget(m_appWidget);
|
||||
} else if (mode == ENTRY_RECENT) {
|
||||
// 添加到最近打开应用区域
|
||||
moveItemToWidget(m_recentWidget);
|
||||
}
|
||||
updateRecentVisible();
|
||||
}
|
||||
|
||||
bool RecentAppHelper::appInRecent(DockItem *item) const
|
||||
{
|
||||
AppItem *appItem = qobject_cast<AppItem *>(item);
|
||||
if (!appItem)
|
||||
return false;
|
||||
|
||||
return (appItem->mode() == ENTRY_RECENT);
|
||||
}
|
||||
|
||||
void RecentAppHelper::addAppAreaItem(int index, DockItem *wdg)
|
||||
{
|
||||
QBoxLayout *boxLayout = static_cast<QBoxLayout *>(m_appWidget->layout());
|
||||
boxLayout->insertWidget(index, wdg);
|
||||
}
|
||||
|
||||
void RecentAppHelper::addRecentAreaItem(int index, DockItem *wdg)
|
||||
{
|
||||
QBoxLayout *recentLayout = static_cast<QBoxLayout *>(m_recentWidget->layout());
|
||||
recentLayout->insertWidget(index, wdg);
|
||||
}
|
||||
|
||||
void RecentAppHelper::updateRecentVisible()
|
||||
{
|
||||
bool lastRecentVisible = m_recentWidget->isVisible();
|
||||
bool recentVisible = lastRecentVisible;
|
||||
|
||||
if (m_displayMode == Dock::DisplayMode::Efficient) {
|
||||
// 如果是高效模式,不显示最近打开应用区域
|
||||
m_recentWidget->setVisible(false);
|
||||
recentVisible = false;
|
||||
} else {
|
||||
QBoxLayout *recentLayout = static_cast<QBoxLayout *>(m_recentWidget->layout());
|
||||
qInfo() << "recent Widget count:" << recentLayout->count() << ", app Widget count" << m_appWidget->layout()->count();
|
||||
// 如果是时尚模式,则判断当前打开应用数量是否为0,为0则不显示,否则显示
|
||||
recentVisible = (recentLayout->count() > 0);
|
||||
m_recentWidget->setVisible(recentVisible);
|
||||
}
|
||||
|
||||
if (lastRecentVisible != recentVisible)
|
||||
Q_EMIT recentVisibleChanged(recentVisible);
|
||||
}
|
||||
|
||||
void RecentAppHelper::updateDockAppVisible(bool lastVisible)
|
||||
{
|
||||
bool visible = dockAppIsVisible();
|
||||
if (lastVisible != visible)
|
||||
Q_EMIT dockAppVisibleChanged(visible);
|
||||
}
|
||||
|
||||
void RecentAppHelper::removeRecentAreaItem(DockItem *wdg)
|
||||
{
|
||||
QBoxLayout *recentLayout = static_cast<QBoxLayout *>(m_recentWidget->layout());
|
||||
recentLayout->removeWidget(wdg);
|
||||
updateRecentVisible();
|
||||
}
|
||||
|
||||
void RecentAppHelper::removeAppAreaItem(DockItem *wdg)
|
||||
{
|
||||
QBoxLayout *boxLayout = static_cast<QBoxLayout *>(m_appWidget->layout());
|
||||
bool lastVisible = dockAppIsVisible();
|
||||
boxLayout->removeWidget(wdg);
|
||||
updateDockAppVisible(lastVisible);
|
||||
}
|
||||
|
||||
int RecentAppHelper::getEntryIndex(DockItem *dockItem, QWidget *widget) const
|
||||
{
|
||||
AppItem *appItem = qobject_cast<AppItem *>(dockItem);
|
||||
if (!appItem)
|
||||
return -1;
|
||||
|
||||
// 查找当前的应用在所有的应用中的排序
|
||||
QStringList entryIds = m_dockInter->GetEntryIDs();
|
||||
int index = entryIds.indexOf(appItem->appId());
|
||||
if (index < 0)
|
||||
return -1;
|
||||
|
||||
QList<AppItem *> filterAppItems = appItems(widget);
|
||||
// 获取当前在最近应用中的所有的APP,并计算它的位置
|
||||
int lastIndex = -1;
|
||||
// 从后面向前面遍历,找到对应的位置,插入
|
||||
for (int i = filterAppItems.size() - 1; i >= 0; i--) {
|
||||
AppItem *item = filterAppItems[i];
|
||||
// 如果所在的索引在要查找的APP索引的后面,说明当前的索引在要查找的索引之后,跳过即可
|
||||
// 如果所在索引不在列表中(一般情况下不存在,这里是容错处理),也跳过
|
||||
int curIndex = entryIds.indexOf(item->appId());
|
||||
if (item == appItem || curIndex < 0 || curIndex >= index)
|
||||
continue;
|
||||
|
||||
if (lastIndex < curIndex)
|
||||
lastIndex = curIndex;
|
||||
}
|
||||
|
||||
return ++lastIndex;
|
||||
}
|
||||
|
||||
QList<AppItem *> RecentAppHelper::appItems(QWidget *widget) const
|
||||
{
|
||||
QLayout *layout = widget->layout();
|
||||
|
||||
QList<AppItem *> dockItems;
|
||||
for (int i = 0; i < layout->count(); i++) {
|
||||
AppItem *dockItem = qobject_cast<AppItem *>(layout->itemAt(i)->widget());
|
||||
if (!dockItem)
|
||||
continue;
|
||||
|
||||
dockItems << dockItem;
|
||||
}
|
||||
|
||||
return dockItems;
|
||||
}
|
68
frame/controller/recentapphelper.h
Normal file
68
frame/controller/recentapphelper.h
Normal file
@ -0,0 +1,68 @@
|
||||
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef RECENTAPPHELPER_H
|
||||
#define RECENTAPPHELPER_H
|
||||
|
||||
#include "constants.h"
|
||||
#include "dbusutil.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class DockItem;
|
||||
class AppItem;
|
||||
class QWidget;
|
||||
|
||||
/** 用来管理最近打开区域和APP应用区域交互的类
|
||||
* @brief The RecentAppManager class
|
||||
*/
|
||||
|
||||
class RecentAppHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RecentAppHelper(QWidget *appWidget, QWidget *recentWidget, DockInter *dockInter, QObject *parent = nullptr);
|
||||
void setDisplayMode(Dock::DisplayMode displayMode);
|
||||
void resetAppInfo();
|
||||
void addAppItem(int index, DockItem *appItem);
|
||||
void removeAppItem(DockItem *dockItem);
|
||||
bool recentIsVisible() const;
|
||||
bool dockAppIsVisible() const;
|
||||
void updateDockInter(DockInter *dockInter);
|
||||
|
||||
Q_SIGNALS:
|
||||
void requestUpdate();
|
||||
void recentVisibleChanged(bool); // 最近区域是否可见发生变化的信号
|
||||
void dockAppVisibleChanged(bool); // 驻留应用区域是否可见发生变化的信号
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
|
||||
private:
|
||||
bool appInRecent(DockItem *item) const;
|
||||
void addAppAreaItem(int index, DockItem *wdg);
|
||||
void addRecentAreaItem(int index, DockItem *wdg);
|
||||
void updateRecentVisible();
|
||||
void updateDockAppVisible(bool lastVisible);
|
||||
|
||||
void removeRecentAreaItem(DockItem *wdg);
|
||||
void removeAppAreaItem(DockItem *wdg);
|
||||
|
||||
int getEntryIndex(DockItem *dockItem, QWidget *widget) const;
|
||||
|
||||
QList<AppItem *> appItems(QWidget *widget) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onModeChanged(int mode);
|
||||
|
||||
private:
|
||||
QWidget *m_appWidget;
|
||||
QWidget *m_recentWidget;
|
||||
Dock::DisplayMode m_displayMode;
|
||||
DockInter *m_dockInter;
|
||||
};
|
||||
|
||||
#endif // RECENTAPPHELPER_H
|
203
frame/controller/toolapphelper.cpp
Normal file
203
frame/controller/toolapphelper.cpp
Normal file
@ -0,0 +1,203 @@
|
||||
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "toolapphelper.h"
|
||||
#include "dockitem.h"
|
||||
#include "pluginsitem.h"
|
||||
#include "quicksettingcontroller.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QBoxLayout>
|
||||
|
||||
ToolAppHelper::ToolAppHelper(QWidget *toolAreaWidget, QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_toolAreaWidget(toolAreaWidget)
|
||||
, m_displayMode(DisplayMode::Efficient)
|
||||
, m_position(Dock::Position::Bottom)
|
||||
{
|
||||
connect(QuickSettingController::instance(), &QuickSettingController::pluginInserted, this, [ = ](PluginsItemInterface *itemInter, const QuickSettingController::PluginAttribute pluginAttr) {
|
||||
if (pluginAttr != QuickSettingController::PluginAttribute::Tool)
|
||||
return;
|
||||
|
||||
pluginItemAdded(itemInter);
|
||||
});
|
||||
connect(QuickSettingController::instance(), &QuickSettingController::pluginRemoved, this, [ = ](PluginsItemInterface *itemInter) {
|
||||
pluginItemRemoved(itemInter);
|
||||
});
|
||||
|
||||
QList<PluginsItemInterface *> pluginItems = QuickSettingController::instance()->pluginItems(QuickSettingController::PluginAttribute::Tool);
|
||||
for (PluginsItemInterface *pluginItem : pluginItems)
|
||||
pluginItemAdded(pluginItem);
|
||||
|
||||
updateToolArea();
|
||||
}
|
||||
|
||||
void ToolAppHelper::setDisplayMode(DisplayMode displayMode)
|
||||
{
|
||||
m_displayMode = displayMode;
|
||||
moveToolWidget();
|
||||
updateWidgetStatus();
|
||||
}
|
||||
|
||||
void ToolAppHelper::setPosition(Position position)
|
||||
{
|
||||
m_toolAreaWidget->setFixedSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
|
||||
m_position = position;
|
||||
}
|
||||
|
||||
bool ToolAppHelper::toolIsVisible() const
|
||||
{
|
||||
return m_toolAreaWidget->isVisible();
|
||||
}
|
||||
|
||||
void ToolAppHelper::appendToToolArea(int index, DockItem *dockItem)
|
||||
{
|
||||
dockItem->setParent(m_toolAreaWidget);
|
||||
QBoxLayout *boxLayout = static_cast<QBoxLayout *>(m_toolAreaWidget->layout());
|
||||
if (index >= 0)
|
||||
boxLayout->insertWidget(index, dockItem);
|
||||
else
|
||||
boxLayout->addWidget(dockItem);
|
||||
|
||||
Q_EMIT requestUpdate();
|
||||
}
|
||||
|
||||
bool ToolAppHelper::removeToolArea(PluginsItemInterface *itemInter)
|
||||
{
|
||||
QBoxLayout *boxLayout = static_cast<QBoxLayout *>(m_toolAreaWidget->layout());
|
||||
for (int i = 0; i < boxLayout->count(); i++) {
|
||||
PluginsItem *dockItem = qobject_cast<PluginsItem *>(boxLayout->itemAt(i)->widget());
|
||||
if (dockItem && dockItem->pluginItem() == itemInter) {
|
||||
boxLayout->removeWidget(dockItem);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ToolAppHelper::moveToolWidget()
|
||||
{
|
||||
for (int i = m_toolAreaWidget->layout()->count() - 1; i >= 0; i--) {
|
||||
QLayoutItem *layoutItem = m_toolAreaWidget->layout()->itemAt(i);
|
||||
if (!layoutItem)
|
||||
continue;
|
||||
|
||||
PluginsItem *pluginWidget = qobject_cast<PluginsItem *>(layoutItem->widget());
|
||||
if (!pluginWidget)
|
||||
continue;
|
||||
|
||||
m_toolAreaWidget->layout()->removeWidget(pluginWidget);
|
||||
}
|
||||
|
||||
if (m_displayMode == Dock::DisplayMode::Fashion) {
|
||||
QuickSettingController *quickController = QuickSettingController::instance();
|
||||
QList<PluginsItemInterface *> plugins = quickController->pluginItems(QuickSettingController::PluginAttribute::Tool);
|
||||
for (PluginsItemInterface *plugin : plugins) {
|
||||
PluginsItem *pluginWidget = quickController->pluginItemWidget(plugin);
|
||||
m_toolAreaWidget->layout()->addWidget(pluginWidget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ToolAppHelper::updateToolArea()
|
||||
{
|
||||
bool oldVisible = m_toolAreaWidget->isVisible();
|
||||
QLayout *layout = m_toolAreaWidget->layout();
|
||||
if (m_position == Dock::Position::Bottom || m_position == Dock::Position::Top) {
|
||||
int size = 0;
|
||||
for (int i = 0; i < layout->count(); i++) {
|
||||
PluginsItem *dockItem = qobject_cast<PluginsItem *>(layout->itemAt(i)->widget());
|
||||
if (!dockItem)
|
||||
continue;
|
||||
|
||||
size += dockItem->width();
|
||||
}
|
||||
m_toolAreaWidget->setFixedWidth(size);
|
||||
m_toolAreaWidget->setVisible(size > 0);
|
||||
} else {
|
||||
int size = 0;
|
||||
for (int i = 0; i < layout->count(); i++) {
|
||||
PluginsItem *dockItem = qobject_cast<PluginsItem *>(layout->itemAt(i)->widget());
|
||||
if (!dockItem)
|
||||
continue;
|
||||
|
||||
size += dockItem->height();
|
||||
}
|
||||
m_toolAreaWidget->setFixedHeight(size);
|
||||
m_toolAreaWidget->setVisible(size > 0);
|
||||
}
|
||||
bool isVisible = m_toolAreaWidget->isVisible();
|
||||
if (oldVisible != isVisible)
|
||||
Q_EMIT toolVisibleChanged(isVisible);
|
||||
}
|
||||
|
||||
void ToolAppHelper::updateWidgetStatus()
|
||||
{
|
||||
bool oldVisible = toolIsVisible();
|
||||
if (m_displayMode == DisplayMode::Efficient) {
|
||||
// 高效模式
|
||||
m_toolAreaWidget->setVisible(false);
|
||||
} else {
|
||||
// 时尚模式
|
||||
m_toolAreaWidget->setVisible(m_toolAreaWidget->layout()->count() > 0);
|
||||
}
|
||||
bool visible = toolIsVisible();
|
||||
if (oldVisible != visible)
|
||||
Q_EMIT toolVisibleChanged(visible);
|
||||
}
|
||||
|
||||
bool ToolAppHelper::pluginInTool(PluginsItemInterface *itemInter) const
|
||||
{
|
||||
return (QuickSettingController::instance()->pluginAttribute(itemInter) == QuickSettingController::PluginAttribute::Tool);
|
||||
}
|
||||
|
||||
void ToolAppHelper::pluginItemAdded(PluginsItemInterface *itemInter)
|
||||
{
|
||||
if (m_displayMode != Dock::DisplayMode::Fashion || pluginExists(itemInter))
|
||||
return;
|
||||
|
||||
QuickSettingController *quickController = QuickSettingController::instance();
|
||||
if (pluginInTool(itemInter)) {
|
||||
PluginsItem *pluginItem = quickController->pluginItemWidget(itemInter);
|
||||
appendToToolArea(0, pluginItem);
|
||||
updateToolArea();
|
||||
Q_EMIT requestUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void ToolAppHelper::pluginItemRemoved(PluginsItemInterface *itemInter)
|
||||
{
|
||||
QuickSettingController *quickController = QuickSettingController::instance();
|
||||
if (pluginInTool(itemInter)) {
|
||||
PluginsItem *pluginItem = quickController->pluginItemWidget(itemInter);
|
||||
removeToolArea(pluginItem->pluginItem());
|
||||
updateToolArea();
|
||||
Q_EMIT requestUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
bool ToolAppHelper::pluginExists(PluginsItemInterface *itemInter) const
|
||||
{
|
||||
QBoxLayout *boxLayout = static_cast<QBoxLayout *>(m_toolAreaWidget->layout());
|
||||
if (!boxLayout)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < boxLayout->count() ; i++) {
|
||||
QLayoutItem *layoutItem = boxLayout->itemAt(i);
|
||||
if (!layoutItem)
|
||||
continue;
|
||||
|
||||
PluginsItem *pluginItem = qobject_cast<PluginsItem *>(layoutItem->widget());
|
||||
if (!pluginItem)
|
||||
continue;
|
||||
|
||||
// 如果当前的插件的接口已经存在,则无需再次插入
|
||||
if (pluginItem->pluginItem() == itemInter)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
54
frame/controller/toolapphelper.h
Normal file
54
frame/controller/toolapphelper.h
Normal file
@ -0,0 +1,54 @@
|
||||
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef TOOLAPPHELPER_H
|
||||
#define TOOLAPPHELPER_H
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class QWidget;
|
||||
class DockItem;
|
||||
class PluginsItem;
|
||||
class PluginsItemInterface;
|
||||
|
||||
using namespace Dock;
|
||||
|
||||
class ToolAppHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ToolAppHelper(QWidget *toolAreaWidget, QObject *parent = nullptr);
|
||||
|
||||
void setDisplayMode(DisplayMode displayMode);
|
||||
void setPosition(Dock::Position position);
|
||||
bool toolIsVisible() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void requestUpdate();
|
||||
void toolVisibleChanged(bool);
|
||||
|
||||
private:
|
||||
void appendToToolArea(int index, DockItem *dockItem);
|
||||
bool removeToolArea(PluginsItemInterface *itemInter);
|
||||
void moveToolWidget();
|
||||
void updateToolArea();
|
||||
|
||||
void updateWidgetStatus();
|
||||
bool pluginInTool(PluginsItemInterface *itemInter) const;
|
||||
void pluginItemAdded(PluginsItemInterface *itemInter);
|
||||
void pluginItemRemoved(PluginsItemInterface *itemInter);
|
||||
bool pluginExists(PluginsItemInterface *itemInter) const;
|
||||
|
||||
private:
|
||||
QWidget *m_toolAreaWidget;
|
||||
DisplayMode m_displayMode;
|
||||
Dock::Position m_position;
|
||||
QList<DockItem *> m_sequentPluginItems;
|
||||
};
|
||||
|
||||
#endif // TOOLAPPHELPER_H
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusClientManager -p dbusclientmanager dde-dock-ClientManager.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* This file may have been hand-edited. Look for HAND-EDIT comments
|
||||
* before re-generating it.
|
||||
*/
|
||||
|
||||
#include "dbusclientmanager.h"
|
||||
|
||||
/*
|
||||
* Implementation of interface class DBusClientManager
|
||||
*/
|
||||
|
||||
DBusClientManager::DBusClientManager(QObject *parent)
|
||||
: QDBusAbstractInterface("com.deepin.daemon.Dock", "/dde/dock/ClientManager", staticInterfaceName(), QDBusConnection::sessionBus(), parent)
|
||||
{
|
||||
QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged","sa{sv}as", this, SLOT(__propertyChanged__(QDBusMessage)));
|
||||
}
|
||||
|
||||
DBusClientManager::~DBusClientManager()
|
||||
{
|
||||
QDBusConnection::sessionBus().disconnect(service(), path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(propertyChanged(QDBusMessage)));
|
||||
}
|
||||
|
@ -1,89 +0,0 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusClientManager -p dbusclientmanager dde-dock-ClientManager.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* Do not edit! All changes made to it will be lost.
|
||||
*/
|
||||
|
||||
#ifndef DBUSCLIENTMANAGER_H_1465195317
|
||||
#define DBUSCLIENTMANAGER_H_1465195317
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
/*
|
||||
* Proxy class for interface dde.dock.ClientManager
|
||||
*/
|
||||
class DBusClientManager: public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_SLOT void __propertyChanged__(const QDBusMessage& msg)
|
||||
{
|
||||
QList<QVariant> arguments = msg.arguments();
|
||||
if (3 != arguments.count())
|
||||
return;
|
||||
QString interfaceName = msg.arguments().at(0).toString();
|
||||
if (interfaceName !="dde.dock.ClientManager")
|
||||
return;
|
||||
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
|
||||
foreach(const QString &prop, changedProps.keys()) {
|
||||
const QMetaObject* self = metaObject();
|
||||
for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
|
||||
QMetaProperty p = self->property(i);
|
||||
if (p.name() == prop) {
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public:
|
||||
static inline const char *staticInterfaceName()
|
||||
{ return "dde.dock.ClientManager"; }
|
||||
|
||||
public:
|
||||
explicit DBusClientManager(QObject *parent = 0);
|
||||
|
||||
~DBusClientManager();
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<bool> ActivateWindow(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("ActivateWindow"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<bool> CloseWindow(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("CloseWindow"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<uint> CurrentActiveWindow()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("CurrentActiveWindow"), argumentList);
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
void ActiveWindowChanged(uint activeWinId);
|
||||
// begin property changed signals
|
||||
};
|
||||
|
||||
namespace dde {
|
||||
namespace dock {
|
||||
typedef ::DBusClientManager ClientManager;
|
||||
}
|
||||
}
|
||||
#endif
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -p DBusDisplay -c DBusDisplay com.deepin.daemon.Display.xml
|
||||
* Command line was: qdbusxml2cpp -p DBusDisplay -c DBusDisplay org.deepin.dde.Display1.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -p DBusDisplay -c DBusDisplay com.deepin.daemon.Display.xml
|
||||
* Command line was: qdbusxml2cpp -p DBusDisplay -c DBusDisplay org.deepin.dde.Display1.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
@ -44,7 +44,7 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, DisplayRect &rect
|
||||
QDebug operator<<(QDebug deg, const DisplayRect &rect);
|
||||
|
||||
/*
|
||||
* Proxy class for interface com.deepin.daemon.Display
|
||||
* Proxy class for interface org.deepin.dde.Display1
|
||||
*/
|
||||
class DBusDisplay: public QDBusAbstractInterface
|
||||
{
|
||||
@ -56,7 +56,7 @@ class DBusDisplay: public QDBusAbstractInterface
|
||||
if (3 != arguments.count())
|
||||
return;
|
||||
QString interfaceName = msg.arguments().at(0).toString();
|
||||
if (interfaceName !="com.deepin.daemon.Display")
|
||||
if (interfaceName !="org.deepin.dde.Display1")
|
||||
return;
|
||||
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
|
||||
QStringList keys = changedProps.keys();
|
||||
@ -72,11 +72,11 @@ class DBusDisplay: public QDBusAbstractInterface
|
||||
}
|
||||
public:
|
||||
static inline const char *staticInterfaceName()
|
||||
{ return "com.deepin.daemon.Display"; }
|
||||
{ return "org.deepin.dde.Display1"; }
|
||||
static inline const char *staticServiceName()
|
||||
{ return "com.deepin.daemon.Display"; }
|
||||
{ return "org.deepin.dde.Display1"; }
|
||||
static inline const char *staticObjectPath()
|
||||
{ return "/com/deepin/daemon/Display"; }
|
||||
{ return "/org/deepin/dde/Display1"; }
|
||||
|
||||
public:
|
||||
explicit DBusDisplay(QObject *parent = 0);
|
||||
|
@ -1,31 +1,81 @@
|
||||
// SPDX-FileCopyrightText: 2016 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dbusdockadaptors.h"
|
||||
#include "utils.h"
|
||||
#include "dockitemmanager.h"
|
||||
#include "windowmanager.h"
|
||||
#include "quicksettingcontroller.h"
|
||||
#include "pluginsitem.h"
|
||||
#include "settingconfig.h"
|
||||
#include "customevent.h"
|
||||
|
||||
#include <DGuiApplicationHelper>
|
||||
|
||||
#include <QScreen>
|
||||
#include <QDebug>
|
||||
#include <QGSettings>
|
||||
#include <QDBusMetaType>
|
||||
|
||||
DBusDockAdaptors::DBusDockAdaptors(MainWindow* parent)
|
||||
const QSize defaultIconSize = QSize(20, 20);
|
||||
|
||||
QDebug operator<<(QDebug argument, const DockItemInfo &info)
|
||||
{
|
||||
argument << "name:" << info.name << ", displayName:" << info.displayName
|
||||
<< "itemKey:" << info.itemKey << "SettingKey:" << info.settingKey
|
||||
<< "icon_light:" << info.iconLight << "icon_dark:" << info.iconDark << "visible:" << info.visible;
|
||||
return argument;
|
||||
}
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const DockItemInfo &info)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << info.name << info.displayName << info.itemKey << info.settingKey << info.iconLight << info.iconDark << info.visible;
|
||||
arg.endStructure();
|
||||
return arg;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, DockItemInfo &info)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg >> info.name >> info.displayName >> info.itemKey >> info.settingKey >> info.iconLight >> info.iconDark >> info.visible;
|
||||
arg.endStructure();
|
||||
return arg;
|
||||
}
|
||||
|
||||
void registerPluginInfoMetaType()
|
||||
{
|
||||
qRegisterMetaType<DockItemInfo>("DockItemInfo");
|
||||
qDBusRegisterMetaType<DockItemInfo>();
|
||||
qRegisterMetaType<DockItemInfos>("DockItemInfos");
|
||||
qDBusRegisterMetaType<DockItemInfos>();
|
||||
}
|
||||
|
||||
DBusDockAdaptors::DBusDockAdaptors(WindowManager* parent)
|
||||
: QDBusAbstractAdaptor(parent)
|
||||
, m_gsettings(Utils::SettingsPtr("com.deepin.dde.dock.mainwindow", QByteArray(), this))
|
||||
, m_windowManager(parent)
|
||||
{
|
||||
connect(parent, &MainWindow::panelGeometryChanged, this, [=] {
|
||||
connect(parent, &WindowManager::panelGeometryChanged, this, [ = ] {
|
||||
emit DBusDockAdaptors::geometryChanged(geometry());
|
||||
|
||||
// 手动触发PropertiesChanged信号,可能是qt不支持属性自动触发
|
||||
QDBusMessage msg = QDBusMessage::createSignal("/com/deepin/dde/Dock", "org.freedesktop.DBus.Properties", "PropertiesChanged");
|
||||
QList<QVariant> arguments;
|
||||
arguments.push_back("com.deepin.dde.Dock");
|
||||
QVariantMap changedProps;
|
||||
changedProps.insert("geometry", geometry());
|
||||
arguments.push_back(changedProps);
|
||||
msg.setArguments(arguments);
|
||||
QDBusConnection::connectToBus(QDBusConnection::SessionBus, "com.deepin.dde.Dock").send(msg);
|
||||
});
|
||||
|
||||
if (m_gsettings) {
|
||||
@ -36,12 +86,13 @@ DBusDockAdaptors::DBusDockAdaptors(MainWindow* parent)
|
||||
});
|
||||
}
|
||||
|
||||
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
||||
connect(DockItemManager::instance(), &DockItemManager::itemInserted, this, [ = ] (const int index, DockItem *item) {
|
||||
Q_UNUSED(index);
|
||||
if (item->itemType() == DockItem::Plugins
|
||||
|| item->itemType() == DockItem::FixedPlugin) {
|
||||
PluginsItem *pluginItem = static_cast<PluginsItem *>(item);
|
||||
for (auto *p : DockItemManager::instance()->pluginList()) {
|
||||
for (auto *p : allPlugin) {
|
||||
if (p->pluginName() == pluginItem->pluginName()) {
|
||||
Q_EMIT pluginVisibleChanged(p->pluginDisplayName(), getPluginVisible(p->pluginDisplayName()));
|
||||
}
|
||||
@ -53,13 +104,15 @@ DBusDockAdaptors::DBusDockAdaptors(MainWindow* parent)
|
||||
if (item->itemType() == DockItem::Plugins
|
||||
|| item->itemType() == DockItem::FixedPlugin) {
|
||||
PluginsItem *pluginItem = static_cast<PluginsItem *>(item);
|
||||
for (auto *p : DockItemManager::instance()->pluginList()) {
|
||||
for (auto *p : allPlugin) {
|
||||
if (p->pluginName() == pluginItem->pluginName()) {
|
||||
Q_EMIT pluginVisibleChanged(p->pluginDisplayName(), getPluginVisible(p->pluginDisplayName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
registerPluginInfoMetaType();
|
||||
}
|
||||
|
||||
DBusDockAdaptors::~DBusDockAdaptors()
|
||||
@ -67,27 +120,31 @@ DBusDockAdaptors::~DBusDockAdaptors()
|
||||
|
||||
}
|
||||
|
||||
MainWindow *DBusDockAdaptors::parent() const
|
||||
{
|
||||
return static_cast<MainWindow *>(QObject::parent());
|
||||
}
|
||||
|
||||
void DBusDockAdaptors::callShow()
|
||||
{
|
||||
return parent()->callShow();
|
||||
m_windowManager->callShow();
|
||||
}
|
||||
|
||||
void DBusDockAdaptors::ReloadPlugins()
|
||||
{
|
||||
return parent()->relaodPlugins();
|
||||
if (qApp->property("PLUGINSLOADED").toBool())
|
||||
return;
|
||||
|
||||
// 发送事件,通知代理来加载插件
|
||||
PluginLoadEvent event;
|
||||
QCoreApplication::sendEvent(qApp, &event);
|
||||
|
||||
qApp->setProperty("PLUGINSLOADED", true);
|
||||
// 退出安全模式
|
||||
qApp->setProperty("safeMode", false);
|
||||
}
|
||||
|
||||
QStringList DBusDockAdaptors::GetLoadedPlugins()
|
||||
{
|
||||
auto pluginList = DockItemManager::instance()->pluginList();
|
||||
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
||||
QStringList nameList;
|
||||
QMap<QString, QString> map;
|
||||
for (auto plugin : pluginList) {
|
||||
for (auto plugin : allPlugin) {
|
||||
// 托盘本身也是一个插件,这里去除掉这个特殊的插件,还有一些没有实际名字的插件
|
||||
if (plugin->pluginName() == "tray"
|
||||
|| plugin->pluginDisplayName().isEmpty()
|
||||
@ -99,7 +156,7 @@ QStringList DBusDockAdaptors::GetLoadedPlugins()
|
||||
}
|
||||
|
||||
// 排序,保持和原先任务栏右键菜单中的插件列表顺序一致
|
||||
qSort(nameList.begin(), nameList.end(), [ = ] (const QString &name1, const QString &name2) {
|
||||
std::sort(nameList.begin(), nameList.end(), [ = ] (const QString &name1, const QString &name2) {
|
||||
return name1 > name2;
|
||||
});
|
||||
|
||||
@ -111,15 +168,53 @@ QStringList DBusDockAdaptors::GetLoadedPlugins()
|
||||
return newList;
|
||||
}
|
||||
|
||||
DockItemInfos DBusDockAdaptors::plugins()
|
||||
{
|
||||
#define DOCK_QUICK_PLUGINS "Dock_Quick_Plugins"
|
||||
// 获取本地加载的插件
|
||||
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
||||
DockItemInfos pluginInfos;
|
||||
QStringList quickSettingKeys = SETTINGCONFIG->value(DOCK_QUICK_PLUGINS).toStringList();
|
||||
for (PluginsItemInterface *plugin : allPlugin) {
|
||||
DockItemInfo info;
|
||||
info.name = plugin->pluginName();
|
||||
info.displayName = plugin->pluginDisplayName();
|
||||
info.itemKey = plugin->pluginName();
|
||||
info.settingKey = DOCK_QUICK_PLUGINS;
|
||||
info.visible = quickSettingKeys.contains(info.itemKey);
|
||||
QSize pixmapSize;
|
||||
QIcon lightIcon = getSettingIcon(plugin, pixmapSize, DGuiApplicationHelper::ColorType::LightType);
|
||||
if (!lightIcon.isNull()) {
|
||||
QBuffer buffer(&info.iconLight);
|
||||
if (buffer.open(QIODevice::WriteOnly)) {
|
||||
QPixmap pixmap = lightIcon.pixmap(pixmapSize);
|
||||
pixmap.save(&buffer, "png");
|
||||
}
|
||||
}
|
||||
QIcon darkIcon = getSettingIcon(plugin, pixmapSize, DGuiApplicationHelper::ColorType::DarkType);
|
||||
if (!darkIcon.isNull()) {
|
||||
QBuffer buffer(&info.iconDark);
|
||||
if (buffer.open(QIODevice::WriteOnly)) {
|
||||
QPixmap pixmap = darkIcon.pixmap(pixmapSize);
|
||||
pixmap.save(&buffer, "png");
|
||||
}
|
||||
}
|
||||
pluginInfos << info;
|
||||
}
|
||||
|
||||
return pluginInfos;
|
||||
}
|
||||
|
||||
void DBusDockAdaptors::resizeDock(int offset, bool dragging)
|
||||
{
|
||||
parent()->resizeDock(offset, dragging);
|
||||
m_windowManager->resizeDock(offset, dragging);
|
||||
}
|
||||
|
||||
// 返回每个插件的识别Key(所以此值应始终不变),供个性化插件根据key去匹配每个插件对应的图标
|
||||
QString DBusDockAdaptors::getPluginKey(const QString &pluginName)
|
||||
{
|
||||
for (auto plugin : DockItemManager::instance()->pluginList()) {
|
||||
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
||||
for (auto plugin : allPlugin) {
|
||||
if (plugin->pluginDisplayName() == pluginName)
|
||||
return plugin->pluginName();
|
||||
}
|
||||
@ -129,7 +224,8 @@ QString DBusDockAdaptors::getPluginKey(const QString &pluginName)
|
||||
|
||||
bool DBusDockAdaptors::getPluginVisible(const QString &pluginName)
|
||||
{
|
||||
for (auto *p : DockItemManager::instance()->pluginList()) {
|
||||
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
||||
for (auto *p : allPlugin) {
|
||||
if (!p->pluginIsAllowDisable())
|
||||
continue;
|
||||
|
||||
@ -150,7 +246,8 @@ bool DBusDockAdaptors::getPluginVisible(const QString &pluginName)
|
||||
|
||||
void DBusDockAdaptors::setPluginVisible(const QString &pluginName, bool visible)
|
||||
{
|
||||
for (auto *p : DockItemManager::instance()->pluginList()) {
|
||||
QList<PluginsItemInterface *> allPlugin = localPlugins();
|
||||
for (auto *p : allPlugin) {
|
||||
if (!p->pluginIsAllowDisable())
|
||||
continue;
|
||||
|
||||
@ -172,9 +269,20 @@ void DBusDockAdaptors::setPluginVisible(const QString &pluginName, bool visible)
|
||||
qInfo() << "Unable to set information for this plugin";
|
||||
}
|
||||
|
||||
void DBusDockAdaptors::setItemOnDock(const QString settingKey, const QString &itemKey, bool visible)
|
||||
{
|
||||
QStringList settings = SETTINGCONFIG->value(settingKey).toStringList();
|
||||
if (visible && !settings.contains(itemKey))
|
||||
settings << itemKey;
|
||||
else if (!visible && settings.contains(itemKey))
|
||||
settings.removeOne(itemKey);
|
||||
|
||||
SETTINGCONFIG->setValue(settingKey, settings);
|
||||
}
|
||||
|
||||
QRect DBusDockAdaptors::geometry() const
|
||||
{
|
||||
return parent()->geometry();
|
||||
return m_windowManager->geometry();
|
||||
}
|
||||
|
||||
bool DBusDockAdaptors::showInPrimary() const
|
||||
@ -198,17 +306,67 @@ bool DBusDockAdaptors::isPluginValid(const QString &name)
|
||||
if (!Utils::SettingValue("com.deepin.dde.dock.module." + name, QByteArray(), "enable", true).toBool())
|
||||
return false;
|
||||
|
||||
// 在非wayland环境下,未开启窗口特效时,不显示多任务视图插件
|
||||
if (name == "multitasking" && !DWindowManagerHelper::instance()->hasComposite() && !Utils::IS_WAYLAND_DISPLAY)
|
||||
// 未开启窗口特效时,不显示多任务视图插件
|
||||
if (name == "multitasking" && !DWindowManagerHelper::instance()->hasComposite())
|
||||
return false;
|
||||
|
||||
// 录屏插件不显示,插件名如果有变化,建议发需求,避免任务栏反复适配
|
||||
if (name == "deepin-screen-recorder-plugin")
|
||||
return false;
|
||||
|
||||
// 远程助手只有在启动时才会加载在任务栏,不需要在控制中心加载
|
||||
if (name == "uos-remote-assistance")
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QList<PluginsItemInterface *> DBusDockAdaptors::localPlugins() const
|
||||
{
|
||||
return QuickSettingController::instance()->pluginInSettings();
|
||||
}
|
||||
|
||||
QIcon DBusDockAdaptors::getSettingIcon(PluginsItemInterface *plugin, QSize &pixmapSize, DGuiApplicationHelper::ColorType colorType) const
|
||||
{
|
||||
auto iconSize = [](const QIcon &icon) {
|
||||
QList<QSize> iconSizes = icon.availableSizes();
|
||||
if (iconSizes.size() > 0)
|
||||
return iconSizes[0];
|
||||
|
||||
return defaultIconSize;
|
||||
};
|
||||
// 先获取控制中心的设置图标
|
||||
QIcon icon = plugin->icon(DockPart::DCCSetting, colorType);
|
||||
if (!icon.isNull()) {
|
||||
pixmapSize = iconSize(icon);
|
||||
return icon;
|
||||
}
|
||||
|
||||
// 如果插件中没有设置图标,则根据插件的类型,获取其他的图标
|
||||
QuickSettingController::PluginAttribute pluginAttr = QuickSettingController::instance()->pluginAttribute(plugin);
|
||||
switch(pluginAttr) {
|
||||
case QuickSettingController::PluginAttribute::System: {
|
||||
icon = plugin->icon(DockPart::SystemPanel, colorType);
|
||||
pixmapSize = defaultIconSize;
|
||||
QList<QSize> iconSizes = icon.availableSizes();
|
||||
if (iconSizes.size() > 0)
|
||||
pixmapSize = iconSizes[0];
|
||||
break;
|
||||
}
|
||||
case QuickSettingController::PluginAttribute::Quick: {
|
||||
icon = plugin->icon(DockPart::QuickShow, colorType);
|
||||
if (icon.isNull())
|
||||
icon = plugin->icon(DockPart::QuickPanel, colorType);
|
||||
pixmapSize = defaultIconSize;
|
||||
QList<QSize> iconSizes = icon.availableSizes();
|
||||
if (iconSizes.size() > 0)
|
||||
pixmapSize = iconSizes[0];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (icon.isNull()) {
|
||||
icon = QIcon(":/icons/resources/dcc_dock_plug_in.svg");
|
||||
pixmapSize = QSize(20, 20);
|
||||
}
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
@ -1,24 +1,68 @@
|
||||
// SPDX-FileCopyrightText: 2016 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DBUSDOCKADAPTORS_H
|
||||
#define DBUSDOCKADAPTORS_H
|
||||
|
||||
#include <QtDBus/QtDBus>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QtDBus/QtDBus>
|
||||
#include <QDBusArgument>
|
||||
|
||||
/*
|
||||
* Adaptor class for interface com.deepin.dde.Dock
|
||||
* Adaptor class for interface org.deepin.dde.Dock1
|
||||
*/
|
||||
class QGSettings;
|
||||
class WindowManager;
|
||||
class PluginsItemInterface;
|
||||
|
||||
struct DockItemInfo
|
||||
{
|
||||
QString name;
|
||||
QString displayName;
|
||||
QString itemKey;
|
||||
QString settingKey;
|
||||
QByteArray iconLight;
|
||||
QByteArray iconDark;
|
||||
bool visible;
|
||||
};
|
||||
|
||||
QDebug operator<<(QDebug argument, const DockItemInfo &info);
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const DockItemInfo &info);
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, DockItemInfo &info);
|
||||
|
||||
Q_DECLARE_METATYPE(DockItemInfo)
|
||||
|
||||
typedef QList<DockItemInfo> DockItemInfos;
|
||||
|
||||
Q_DECLARE_METATYPE(DockItemInfos)
|
||||
|
||||
void registerPluginInfoMetaType();
|
||||
|
||||
class DBusDockAdaptors: public QDBusAbstractAdaptor
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_CLASSINFO("D-Bus Interface", "com.deepin.dde.Dock")
|
||||
Q_CLASSINFO("D-Bus Interface", "org.deepin.dde.Dock1")
|
||||
Q_CLASSINFO("D-Bus Introspection", ""
|
||||
" <interface name=\"com.deepin.dde.Dock\">\n"
|
||||
" <interface name=\"org.deepin.dde.Dock1\">\n"
|
||||
" <property access=\"read\" type=\"(iiii)\" name=\"geometry\"/>\n"
|
||||
" <property access=\"readwrite\" type=\"b\" name=\"showInPrimary\"/>\n"
|
||||
" <method name=\"callShow\"/>"
|
||||
@ -26,6 +70,10 @@ class DBusDockAdaptors: public QDBusAbstractAdaptor
|
||||
" <method name=\"GetLoadedPlugins\">"
|
||||
" <arg name=\"list\" type=\"as\" direction=\"out\"/>"
|
||||
" </method>"
|
||||
" <method name=\"plugins\">>"
|
||||
" <arg type=\"a(sssssb)\" direction=\"out\"/>"
|
||||
" <annotation value=\"PluginInfos\" name=\"org.qtproject.QtDBus.QtTypeName.Out0\"/>\n"
|
||||
" </method>"
|
||||
" <method name=\"resizeDock\">"
|
||||
" <arg name=\"offset\" type=\"i\" direction=\"in\"/>"
|
||||
" <arg name=\"dragging\" type=\"b\" direction=\"in\"/>"
|
||||
@ -42,6 +90,10 @@ class DBusDockAdaptors: public QDBusAbstractAdaptor
|
||||
" <arg name=\"pluginName\" type=\"s\" direction=\"in\"/>"
|
||||
" <arg name=\"visible\" type=\"b\" direction=\"in\"/>"
|
||||
" </method>"
|
||||
" <method name=\"setItemOnDock\">"
|
||||
" <arg name=\"itemKey\" type=\"s\" direction=\"in\"/>"
|
||||
" <arg name=\"visible\" type=\"b\" direction=\"in\"/>"
|
||||
" </method>"
|
||||
" <signal name=\"pluginVisibleChanged\">"
|
||||
" <arg type=\"s\"/>"
|
||||
" <arg type=\"b\"/>"
|
||||
@ -52,16 +104,15 @@ class DBusDockAdaptors: public QDBusAbstractAdaptor
|
||||
Q_PROPERTY(bool showInPrimary READ showInPrimary WRITE setShowInPrimary NOTIFY showInPrimaryChanged)
|
||||
|
||||
public:
|
||||
explicit DBusDockAdaptors(MainWindow *parent);
|
||||
explicit DBusDockAdaptors(WindowManager *parent);
|
||||
virtual ~DBusDockAdaptors();
|
||||
|
||||
MainWindow *parent() const;
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
void callShow();
|
||||
void ReloadPlugins();
|
||||
|
||||
QStringList GetLoadedPlugins();
|
||||
DockItemInfos plugins();
|
||||
|
||||
void resizeDock(int offset, bool dragging);
|
||||
|
||||
@ -69,6 +120,7 @@ public Q_SLOTS: // METHODS
|
||||
|
||||
bool getPluginVisible(const QString &pluginName);
|
||||
void setPluginVisible(const QString &pluginName, bool visible);
|
||||
void setItemOnDock(const QString settingKey, const QString &itemKey, bool visible);
|
||||
|
||||
public: // PROPERTIES
|
||||
QRect geometry() const;
|
||||
@ -83,9 +135,12 @@ signals:
|
||||
|
||||
private:
|
||||
bool isPluginValid(const QString &name);
|
||||
QList<PluginsItemInterface *> localPlugins() const;
|
||||
QIcon getSettingIcon(PluginsItemInterface *plugin, QSize &pixmapSize, DGuiApplicationHelper::ColorType colorType) const;
|
||||
|
||||
private:
|
||||
QGSettings *m_gsettings;
|
||||
WindowManager *m_windowManager;
|
||||
};
|
||||
|
||||
#endif //DBUSDOCKADAPTORS
|
||||
|
@ -1,6 +1,34 @@
|
||||
// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusMenu -p dbusmenu com.deepin.menu.Menu.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* This file may have been hand-edited. Look for HAND-EDIT comments
|
||||
* before re-generating it.
|
||||
*/
|
||||
|
||||
#include "dbusmenu.h"
|
||||
|
||||
|
@ -1,6 +1,33 @@
|
||||
// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusMenu -p dbusmenu com.deepin.menu.Menu.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* Do not edit! All changes made to it will be lost.
|
||||
*/
|
||||
|
||||
#ifndef DBUSMENU_H_1436158836
|
||||
#define DBUSMENU_H_1436158836
|
||||
|
@ -1,6 +1,34 @@
|
||||
// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusMenuManager -p dbusmenumanager com.deepin.menu.Manager.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* This file may have been hand-edited. Look for HAND-EDIT comments
|
||||
* before re-generating it.
|
||||
*/
|
||||
|
||||
#include "dbusmenumanager.h"
|
||||
|
||||
|
@ -1,6 +1,33 @@
|
||||
// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: sbw <sbw@sbw.so>
|
||||
*
|
||||
* Maintainer: sbw <sbw@sbw.so>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file was generated by qdbusxml2cpp version 0.8
|
||||
* Command line was: qdbusxml2cpp -c DBusMenuManager -p dbusmenumanager com.deepin.menu.Manager.xml
|
||||
*
|
||||
* qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
*
|
||||
* This is an auto-generated file.
|
||||
* Do not edit! All changes made to it will be lost.
|
||||
*/
|
||||
|
||||
#ifndef DBUSMENUMANAGER_H_1436158928
|
||||
#define DBUSMENUMANAGER_H_1436158928
|
||||
|
339
frame/dbus/dockinterface.cpp
Normal file
339
frame/dbus/dockinterface.cpp
Normal file
@ -0,0 +1,339 @@
|
||||
/*
|
||||
* Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* Maintainer: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dockinterface.h"
|
||||
|
||||
#include "org_deepin_dde_daemon_dock1.h"
|
||||
|
||||
// 因为 types/dockrect.h 文件中定义了DockRect类,而在此处也定义了DockRect,
|
||||
// 所以在此处先加上DOCKRECT_H宏(types/dockrect.h文件中定义的宏)来禁止包含types/dockrect.h头文件
|
||||
// 否则会出现重复定义的错误
|
||||
#define DOCKRECT_H
|
||||
|
||||
/*
|
||||
* Implementation of interface class __Dock
|
||||
*/
|
||||
|
||||
class DockPrivate
|
||||
{
|
||||
public:
|
||||
DockPrivate() = default;
|
||||
|
||||
// begin member variables
|
||||
int DisplayMode;
|
||||
QStringList DockedApps;
|
||||
QList<QDBusObjectPath> Entries;
|
||||
DockRect FrontendWindowRect;
|
||||
int HideMode;
|
||||
int HideState;
|
||||
uint HideTimeout;
|
||||
uint IconSize;
|
||||
double Opacity;
|
||||
int Position;
|
||||
uint ShowTimeout;
|
||||
uint WindowSize;
|
||||
uint WindowSizeEfficient;
|
||||
uint WindowSizeFashion;
|
||||
|
||||
public:
|
||||
QMap<QString, QDBusPendingCallWatcher *> m_processingCalls;
|
||||
QMap<QString, QList<QVariant>> m_waittingCalls;
|
||||
};
|
||||
|
||||
// 窗管中提供的ActiveWindow接口,MinimizeWindow目前还在开发过程中,因此,关于这两个接口暂时使用v23的后端接口
|
||||
// 等窗管完成了这几个接口后,删除此处v20的接口,改成v23提供的新接口即可
|
||||
using DockInter = org::deepin::dde::daemon::Dock1;
|
||||
/**
|
||||
* @brief 任务栏的部分DBUS接口是通过窗管获取的,由于AM后端并未提供窗管的相关接口,因此,
|
||||
* 此处先将窗管的接口集成进来,作为私有类,只提供任务栏接口使用
|
||||
*/
|
||||
class WM : public QDBusAbstractInterface
|
||||
{
|
||||
public:
|
||||
static inline const char *staticInterfaceName()
|
||||
{ return "com.deepin.wm"; }
|
||||
|
||||
public:
|
||||
explicit WM(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = Q_NULLPTR);
|
||||
~WM();
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
|
||||
inline QDBusPendingReply<> ActivateWindow(uint in0)
|
||||
{
|
||||
return m_dockInter->ActivateWindow(in0);
|
||||
}
|
||||
|
||||
QDBusPendingReply<> MinimizeWindow(uint in0)
|
||||
{
|
||||
return m_dockInter->MinimizeWindow(in0);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> CancelPreviewWindow()
|
||||
{
|
||||
return asyncCallWithArgumentList(QStringLiteral("CancelPreviewWindow"), QList<QVariant>());
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> PreviewWindow(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("CancelPreviewWindow"), argumentList);
|
||||
}
|
||||
|
||||
private:
|
||||
DockInter *m_dockInter;
|
||||
};
|
||||
|
||||
WM::WM(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
|
||||
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
|
||||
, m_dockInter(new DockInter("org.deepin.dde.daemon.Dock1", "/org/deepin/dde/daemon/Dock1", QDBusConnection::sessionBus(), this))
|
||||
{
|
||||
}
|
||||
|
||||
WM::~WM()
|
||||
{
|
||||
}
|
||||
|
||||
Dde_Dock::Dde_Dock(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
|
||||
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
|
||||
, d_ptr(new DockPrivate)
|
||||
, m_wm(new WM("com.deepin.wm", "/com/deepin/wm", QDBusConnection::sessionBus(), this))
|
||||
{
|
||||
QDBusConnection::sessionBus().connect(this->service(), this->path(),
|
||||
"org.freedesktop.DBus.Properties",
|
||||
"PropertiesChanged","sa{sv}as",
|
||||
this,
|
||||
SLOT(onPropertyChanged(const QDBusMessage &)));
|
||||
|
||||
if (QMetaType::type("DockRect") == QMetaType::UnknownType)
|
||||
registerDockRectMetaType();
|
||||
}
|
||||
|
||||
Dde_Dock::~Dde_Dock()
|
||||
{
|
||||
qDeleteAll(d_ptr->m_processingCalls.values());
|
||||
delete d_ptr;
|
||||
}
|
||||
|
||||
void Dde_Dock::onPropertyChanged(const QDBusMessage& msg)
|
||||
{
|
||||
QList<QVariant> arguments = msg.arguments();
|
||||
if (3 != arguments.count())
|
||||
return;
|
||||
|
||||
QString interfaceName = msg.arguments().at(0).toString();
|
||||
if (interfaceName != staticInterfaceName())
|
||||
return;
|
||||
|
||||
QVariantMap changedProps = qdbus_cast<QVariantMap>(arguments.at(1).value<QDBusArgument>());
|
||||
QStringList keys = changedProps.keys();
|
||||
foreach(const QString &prop, keys) {
|
||||
const QMetaObject* self = metaObject();
|
||||
for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
|
||||
QMetaProperty p = self->property(i);
|
||||
if (p.name() == prop)
|
||||
Q_EMIT p.notifySignal().invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Dde_Dock::displayMode()
|
||||
{
|
||||
return qvariant_cast<int>(property("DisplayMode"));
|
||||
}
|
||||
|
||||
void Dde_Dock::setDisplayMode(int value)
|
||||
{
|
||||
setProperty("DisplayMode", QVariant::fromValue(value));
|
||||
}
|
||||
|
||||
QStringList Dde_Dock::dockedApps()
|
||||
{
|
||||
return qvariant_cast<QStringList>(property("DockedApps"));
|
||||
}
|
||||
|
||||
QList<QDBusObjectPath> Dde_Dock::entries()
|
||||
{
|
||||
return qvariant_cast<QList<QDBusObjectPath>>(property("Entries"));
|
||||
}
|
||||
|
||||
DockRect Dde_Dock::frontendWindowRect()
|
||||
{
|
||||
return qvariant_cast<DockRect>(property("FrontendWindowRect"));
|
||||
}
|
||||
|
||||
int Dde_Dock::hideMode()
|
||||
{
|
||||
return qvariant_cast<int>(property("HideMode"));
|
||||
}
|
||||
|
||||
void Dde_Dock::setHideMode(int value)
|
||||
{
|
||||
internalPropSet("HideMode", QVariant::fromValue(value));
|
||||
}
|
||||
|
||||
int Dde_Dock::hideState()
|
||||
{
|
||||
return qvariant_cast<int>(property("HideState"));
|
||||
}
|
||||
|
||||
uint Dde_Dock::hideTimeout()
|
||||
{
|
||||
return qvariant_cast<uint>(property("HideTimeout"));
|
||||
}
|
||||
|
||||
void Dde_Dock::setHideTimeout(uint value)
|
||||
{
|
||||
setProperty("HideTimeout", QVariant::fromValue(value));
|
||||
}
|
||||
|
||||
uint Dde_Dock::iconSize()
|
||||
{
|
||||
return qvariant_cast<uint>(property("IconSize"));
|
||||
}
|
||||
|
||||
void Dde_Dock::setIconSize(uint value)
|
||||
{
|
||||
setProperty("IconSize", QVariant::fromValue(value));
|
||||
}
|
||||
|
||||
double Dde_Dock::opacity()
|
||||
{
|
||||
return qvariant_cast<double>(property("Opacity"));
|
||||
}
|
||||
|
||||
void Dde_Dock::setOpacity(double value)
|
||||
{
|
||||
setProperty("Opacity", QVariant::fromValue(value));
|
||||
}
|
||||
|
||||
int Dde_Dock::position()
|
||||
{
|
||||
return qvariant_cast<int>(property("Position"));
|
||||
}
|
||||
|
||||
void Dde_Dock::setPosition(int value)
|
||||
{
|
||||
setProperty("Position", QVariant::fromValue(value));
|
||||
}
|
||||
|
||||
uint Dde_Dock::showTimeout()
|
||||
{
|
||||
return qvariant_cast<uint>(property("ShowTimeout"));
|
||||
}
|
||||
|
||||
void Dde_Dock::setShowTimeout(uint value)
|
||||
{
|
||||
setProperty("ShowTimeout", QVariant::fromValue(value));
|
||||
}
|
||||
|
||||
uint Dde_Dock::windowSize()
|
||||
{
|
||||
return qvariant_cast<uint>(property("WindowSize"));
|
||||
}
|
||||
|
||||
void Dde_Dock::setWindowSize(uint value)
|
||||
{
|
||||
setProperty("WindowSize", QVariant::fromValue(value));
|
||||
}
|
||||
|
||||
uint Dde_Dock::windowSizeEfficient()
|
||||
{
|
||||
return qvariant_cast<uint>(property("WindowSizeEfficient"));
|
||||
}
|
||||
|
||||
void Dde_Dock::setWindowSizeEfficient(uint value)
|
||||
{
|
||||
setProperty("WindowSizeEfficient", QVariant::fromValue(value));
|
||||
}
|
||||
|
||||
uint Dde_Dock::windowSizeFashion()
|
||||
{
|
||||
return qvariant_cast<uint>(property("WindowSizeFashion"));
|
||||
}
|
||||
|
||||
void Dde_Dock::setWindowSizeFashion(uint value)
|
||||
{
|
||||
setProperty("WindowSizeFashion", QVariant::fromValue(value));
|
||||
}
|
||||
|
||||
bool Dde_Dock::showRecent() const
|
||||
{
|
||||
return qvariant_cast<bool>(property("ShowRecent"));
|
||||
}
|
||||
|
||||
bool Dde_Dock::showMultiWindow() const
|
||||
{
|
||||
return qvariant_cast<bool>(property("ShowMultiWindow"));
|
||||
}
|
||||
|
||||
QDBusPendingReply<> Dde_Dock::ActivateWindow(uint in0)
|
||||
{
|
||||
return m_wm->ActivateWindow(in0);
|
||||
}
|
||||
|
||||
QDBusPendingReply<> Dde_Dock::PreviewWindow(uint in0)
|
||||
{
|
||||
return m_wm->PreviewWindow(in0);
|
||||
}
|
||||
|
||||
QDBusPendingReply<> Dde_Dock::CancelPreviewWindow()
|
||||
{
|
||||
return m_wm->CancelPreviewWindow();
|
||||
}
|
||||
|
||||
QDBusPendingReply<> Dde_Dock::MinimizeWindow(uint in0)
|
||||
{
|
||||
return m_wm->MinimizeWindow(in0);
|
||||
}
|
||||
|
||||
void Dde_Dock::CallQueued(const QString &callName, const QList<QVariant> &args)
|
||||
{
|
||||
if (d_ptr->m_waittingCalls.contains(callName)) {
|
||||
d_ptr->m_waittingCalls[callName] = args;
|
||||
return;
|
||||
}
|
||||
|
||||
if (d_ptr->m_processingCalls.contains(callName)) {
|
||||
d_ptr->m_waittingCalls.insert(callName, args);
|
||||
} else {
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(asyncCallWithArgumentList(callName, args));
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, this, &Dde_Dock::onPendingCallFinished);
|
||||
d_ptr->m_processingCalls.insert(callName, watcher);
|
||||
}
|
||||
}
|
||||
|
||||
void Dde_Dock::onPendingCallFinished(QDBusPendingCallWatcher *w)
|
||||
{
|
||||
w->deleteLater();
|
||||
const auto callName = d_ptr->m_processingCalls.key(w);
|
||||
Q_ASSERT(!callName.isEmpty());
|
||||
if (callName.isEmpty())
|
||||
return;
|
||||
|
||||
d_ptr->m_processingCalls.remove(callName);
|
||||
if (!d_ptr->m_waittingCalls.contains(callName))
|
||||
return;
|
||||
|
||||
const auto args = d_ptr->m_waittingCalls.take(callName);
|
||||
CallQueued(callName, args);
|
||||
}
|
338
frame/dbus/dockinterface.h
Normal file
338
frame/dbus/dockinterface.h
Normal file
@ -0,0 +1,338 @@
|
||||
/*
|
||||
* Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* Maintainer: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DOCK_INTERFACE
|
||||
#define DOCK_INTERFACE
|
||||
|
||||
#include "types/dockrect.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <QtDBus>
|
||||
|
||||
/*
|
||||
* Proxy class for interface org.deepin.dde.daemon.Dock1
|
||||
*/
|
||||
class DockPrivate;
|
||||
class WM;
|
||||
|
||||
void registerDockRectMetaType();
|
||||
|
||||
class Dde_Dock : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static inline const char *staticInterfaceName()
|
||||
{ return "org.deepin.dde.daemon.Dock1"; }
|
||||
|
||||
public:
|
||||
explicit Dde_Dock(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
|
||||
|
||||
~Dde_Dock();
|
||||
|
||||
Q_PROPERTY(int DisplayMode READ displayMode WRITE setDisplayMode NOTIFY DisplayModeChanged)
|
||||
int displayMode();
|
||||
void setDisplayMode(int value);
|
||||
|
||||
Q_PROPERTY(QStringList DockedApps READ dockedApps NOTIFY DockedAppsChanged)
|
||||
QStringList dockedApps();
|
||||
|
||||
Q_PROPERTY(QList<QDBusObjectPath> Entries READ entries NOTIFY EntriesChanged)
|
||||
QList<QDBusObjectPath> entries();
|
||||
|
||||
Q_PROPERTY(DockRect FrontendWindowRect READ frontendWindowRect NOTIFY FrontendWindowRectChanged)
|
||||
DockRect frontendWindowRect();
|
||||
|
||||
Q_PROPERTY(int HideMode READ hideMode WRITE setHideMode NOTIFY HideModeChanged)
|
||||
int hideMode();
|
||||
void setHideMode(int value);
|
||||
|
||||
Q_PROPERTY(int HideState READ hideState NOTIFY HideStateChanged)
|
||||
int hideState();
|
||||
|
||||
Q_PROPERTY(uint HideTimeout READ hideTimeout WRITE setHideTimeout NOTIFY HideTimeoutChanged)
|
||||
uint hideTimeout();
|
||||
void setHideTimeout(uint value);
|
||||
|
||||
Q_PROPERTY(uint IconSize READ iconSize WRITE setIconSize NOTIFY IconSizeChanged)
|
||||
uint iconSize();
|
||||
void setIconSize(uint value);
|
||||
|
||||
Q_PROPERTY(double Opacity READ opacity WRITE setOpacity NOTIFY OpacityChanged)
|
||||
double opacity();
|
||||
void setOpacity(double value);
|
||||
|
||||
Q_PROPERTY(int Position READ position WRITE setPosition NOTIFY PositionChanged)
|
||||
int position();
|
||||
void setPosition(int value);
|
||||
|
||||
Q_PROPERTY(uint ShowTimeout READ showTimeout WRITE setShowTimeout NOTIFY ShowTimeoutChanged)
|
||||
uint showTimeout();
|
||||
void setShowTimeout(uint value);
|
||||
|
||||
Q_PROPERTY(uint WindowSize READ windowSize WRITE setWindowSize NOTIFY WindowSizeChanged)
|
||||
uint windowSize();
|
||||
void setWindowSize(uint value);
|
||||
|
||||
Q_PROPERTY(uint WindowSizeEfficient READ windowSizeEfficient WRITE setWindowSizeEfficient NOTIFY WindowSizeEfficientChanged)
|
||||
uint windowSizeEfficient();
|
||||
void setWindowSizeEfficient(uint value);
|
||||
|
||||
Q_PROPERTY(uint WindowSizeFashion READ windowSizeFashion WRITE setWindowSizeFashion NOTIFY WindowSizeFashionChanged)
|
||||
uint windowSizeFashion();
|
||||
void setWindowSizeFashion(uint value);
|
||||
|
||||
Q_PROPERTY(bool ShowRecent READ showRecent NOTIFY showRecentChanged)
|
||||
bool showRecent() const;
|
||||
|
||||
Q_PROPERTY(bool ShowMultiWindow READ showMultiWindow NOTIFY ShowMultiWindowChanged)
|
||||
bool showMultiWindow() const;
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
QDBusPendingReply<> ActivateWindow(uint in0);
|
||||
|
||||
QDBusPendingReply<> PreviewWindow(uint in0);
|
||||
|
||||
QDBusPendingReply<> CancelPreviewWindow();
|
||||
|
||||
QDBusPendingReply<> MinimizeWindow(uint in0);
|
||||
|
||||
inline void ActivateWindowQueued(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
|
||||
CallQueued(QStringLiteral("ActivateWindow"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> CloseWindow(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("CloseWindow"), argumentList);
|
||||
}
|
||||
|
||||
inline void CloseWindowQueued(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
|
||||
CallQueued(QStringLiteral("CloseWindow"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QStringList> GetDockedAppsDesktopFiles()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("GetDockedAppsDesktopFiles"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QStringList> GetEntryIDs()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("GetEntryIDs"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QString> GetPluginSettings()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("GetPluginSettings"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<bool> IsDocked(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("IsDocked"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<bool> IsOnDock(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("IsOnDock"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> MergePluginSettings(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("MergePluginSettings"), argumentList);
|
||||
}
|
||||
|
||||
inline void MergePluginSettingsQueued(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
|
||||
CallQueued(QStringLiteral("MergePluginSettings"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> MoveEntry(int in0, int in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
return asyncCallWithArgumentList(QStringLiteral("MoveEntry"), argumentList);
|
||||
}
|
||||
|
||||
inline void MoveEntryQueued(int in0, int in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
|
||||
CallQueued(QStringLiteral("MoveEntry"), argumentList);
|
||||
}
|
||||
|
||||
inline void MoveWindowQueued(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
|
||||
CallQueued(QStringLiteral("MoveWindow"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<QString> QueryWindowIdentifyMethod(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("QueryWindowIdentifyMethod"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> RemovePluginSettings(const QString &in0, const QStringList &in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
return asyncCallWithArgumentList(QStringLiteral("RemovePluginSettings"), argumentList);
|
||||
}
|
||||
|
||||
inline void RemovePluginSettingsQueued(const QString &in0, const QStringList &in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
|
||||
CallQueued(QStringLiteral("RemovePluginSettings"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<bool> RequestDock(const QString &in0, int in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
return asyncCallWithArgumentList(QStringLiteral("RequestDock"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<bool> RequestUndock(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("RequestUndock"), argumentList);
|
||||
}
|
||||
|
||||
inline void SetShowRecent(bool in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
|
||||
CallQueued(QStringLiteral("SetShowRecent"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> SetFrontendWindowRect(int in0, int in1, uint in2, uint in3)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1) << QVariant::fromValue(in2) << QVariant::fromValue(in3);
|
||||
return asyncCallWithArgumentList(QStringLiteral("SetFrontendWindowRect"), argumentList);
|
||||
}
|
||||
|
||||
inline void SetFrontendWindowRectQueued(int in0, int in1, uint in2, uint in3)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1) << QVariant::fromValue(in2) << QVariant::fromValue(in3);
|
||||
|
||||
CallQueued(QStringLiteral("SetFrontendWindowRect"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> SetPluginSettings(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("SetPluginSettings"), argumentList);
|
||||
}
|
||||
|
||||
inline void SetPluginSettingsQueued(const QString &in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
|
||||
CallQueued(QStringLiteral("SetPluginSettings"), argumentList);
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
void DockAppSettingsSynced();
|
||||
void EntryAdded(const QDBusObjectPath &in0, int in1);
|
||||
void EntryRemoved(const QString &in0);
|
||||
void PluginSettingsSynced();
|
||||
void ServiceRestarted();
|
||||
// begin property changed signals
|
||||
void DisplayModeChanged(int value) const;
|
||||
void DockedAppsChanged(const QStringList &value) const;
|
||||
void EntriesChanged(const QList<QDBusObjectPath> &value) const;
|
||||
void FrontendWindowRectChanged(DockRect value) const;
|
||||
void HideModeChanged(int value) const;
|
||||
void HideStateChanged(int value) const;
|
||||
void HideTimeoutChanged(uint value) const;
|
||||
void IconSizeChanged(uint value) const;
|
||||
void OpacityChanged(double value) const;
|
||||
void PositionChanged(int value) const;
|
||||
void ShowTimeoutChanged(uint value) const;
|
||||
void WindowSizeChanged(uint value) const;
|
||||
void WindowSizeEfficientChanged(uint value) const;
|
||||
void WindowSizeFashionChanged(uint value) const;
|
||||
void showRecentChanged(bool) const;
|
||||
void ShowMultiWindowChanged(bool) const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void CallQueued(const QString &callName, const QList<QVariant> &args);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onPendingCallFinished(QDBusPendingCallWatcher *w);
|
||||
void onPropertyChanged(const QDBusMessage& msg);
|
||||
|
||||
private:
|
||||
DockPrivate *d_ptr;
|
||||
WM *m_wm;
|
||||
};
|
||||
|
||||
namespace org {
|
||||
namespace deepin {
|
||||
namespace dde {
|
||||
namespace daemon {
|
||||
typedef ::Dde_Dock DdeDock;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // DOCK_INTERFACE
|
295
frame/dbus/entryinterface.cpp
Normal file
295
frame/dbus/entryinterface.cpp
Normal file
@ -0,0 +1,295 @@
|
||||
/*
|
||||
* Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* Maintainer: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "entryinterface.h"
|
||||
|
||||
/*
|
||||
* Implementation of interface class __Entry
|
||||
*/
|
||||
void registerWindowListMetaType()
|
||||
{
|
||||
qRegisterMetaType<WindowList>();
|
||||
qDBusRegisterMetaType<WindowList>();
|
||||
}
|
||||
|
||||
void registerWindowInfoMapMetaType()
|
||||
{
|
||||
registerWindowInfoMetaType();
|
||||
|
||||
qRegisterMetaType<WindowInfoMap>("WindowInfoMap");
|
||||
qDBusRegisterMetaType<WindowInfoMap>();
|
||||
}
|
||||
|
||||
void registerWindowInfoMetaType()
|
||||
{
|
||||
qRegisterMetaType<WindowInfo>("WindowInfo");
|
||||
qDBusRegisterMetaType<WindowInfo>();
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug argument, const WindowInfo &info)
|
||||
{
|
||||
argument << '(' << info.title << ',' << info.attention << info.uuid << ')';
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &argument, const WindowInfo &info)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument << info.title << info.attention << info.uuid;
|
||||
argument.endStructure();
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &argument, WindowInfo &info)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument >> info.title >> info.attention >> info.uuid;
|
||||
argument.endStructure();
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
bool WindowInfo::operator==(const WindowInfo &rhs) const
|
||||
{
|
||||
return (attention == rhs.attention &&
|
||||
title == rhs.title &&
|
||||
uuid == rhs.uuid);
|
||||
}
|
||||
|
||||
class EntryPrivate
|
||||
{
|
||||
public:
|
||||
EntryPrivate()
|
||||
: CurrentWindow(0)
|
||||
, IsActive(false)
|
||||
, IsDocked(false)
|
||||
, mode(0)
|
||||
{}
|
||||
|
||||
// begin member variables
|
||||
uint CurrentWindow;
|
||||
QString DesktopFile;
|
||||
QString Icon;
|
||||
QString Id;
|
||||
bool IsActive;
|
||||
bool IsDocked;
|
||||
QString Menu;
|
||||
QString Name;
|
||||
|
||||
WindowInfoMap WindowInfos;
|
||||
int mode;
|
||||
|
||||
public:
|
||||
QMap<QString, QDBusPendingCallWatcher *> m_processingCalls;
|
||||
QMap<QString, QList<QVariant>> m_waittingCalls;
|
||||
};
|
||||
|
||||
Dock_Entry::Dock_Entry(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent)
|
||||
: QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent)
|
||||
, d_ptr(new EntryPrivate)
|
||||
{
|
||||
QDBusConnection::sessionBus().connect(this->service(), this->path(),
|
||||
"org.freedesktop.DBus.Properties",
|
||||
"PropertiesChanged","sa{sv}as",
|
||||
this,
|
||||
SLOT(onPropertyChanged(const QDBusMessage &)));
|
||||
|
||||
if (QMetaType::type("WindowList") == QMetaType::UnknownType)
|
||||
registerWindowListMetaType();
|
||||
if (QMetaType::type("WindowInfoMap") == QMetaType::UnknownType)
|
||||
registerWindowInfoMapMetaType();
|
||||
}
|
||||
|
||||
Dock_Entry::~Dock_Entry()
|
||||
{
|
||||
qDeleteAll(d_ptr->m_processingCalls.values());
|
||||
delete d_ptr;
|
||||
}
|
||||
|
||||
void Dock_Entry::onPropertyChanged(const QString &propName, const QVariant &value)
|
||||
{
|
||||
if (propName == QStringLiteral("CurrentWindow")) {
|
||||
const uint &CurrentWindow = qvariant_cast<uint>(value);
|
||||
if (d_ptr->CurrentWindow != CurrentWindow) {
|
||||
d_ptr->CurrentWindow = CurrentWindow;
|
||||
Q_EMIT CurrentWindowChanged(d_ptr->CurrentWindow);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (propName == QStringLiteral("DesktopFile")) {
|
||||
const QString &DesktopFile = qvariant_cast<QString>(value);
|
||||
if (d_ptr->DesktopFile != DesktopFile) {
|
||||
d_ptr->DesktopFile = DesktopFile;
|
||||
Q_EMIT DesktopFileChanged(d_ptr->DesktopFile);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (propName == QStringLiteral("Icon")) {
|
||||
const QString &Icon = qvariant_cast<QString>(value);
|
||||
if (d_ptr->Icon != Icon)
|
||||
{
|
||||
d_ptr->Icon = Icon;
|
||||
Q_EMIT IconChanged(d_ptr->Icon);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (propName == QStringLiteral("IsActive")) {
|
||||
const bool &IsActive = qvariant_cast<bool>(value);
|
||||
if (d_ptr->IsActive != IsActive) {
|
||||
d_ptr->IsActive = IsActive;
|
||||
Q_EMIT IsActiveChanged(d_ptr->IsActive);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (propName == QStringLiteral("IsDocked")) {
|
||||
const bool &IsDocked = qvariant_cast<bool>(value);
|
||||
if (d_ptr->IsDocked != IsDocked) {
|
||||
d_ptr->IsDocked = IsDocked;
|
||||
Q_EMIT IsDockedChanged(d_ptr->IsDocked);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (propName == QStringLiteral("Menu")) {
|
||||
const QString &Menu = qvariant_cast<QString>(value);
|
||||
if (d_ptr->Menu != Menu) {
|
||||
d_ptr->Menu = Menu;
|
||||
Q_EMIT MenuChanged(d_ptr->Menu);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (propName == QStringLiteral("Name")) {
|
||||
const QString &Name = qvariant_cast<QString>(value);
|
||||
if (d_ptr->Name != Name) {
|
||||
d_ptr->Name = Name;
|
||||
Q_EMIT NameChanged(d_ptr->Name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (propName == QStringLiteral("WindowInfos")) {
|
||||
const WindowInfoMap &WindowInfos = qvariant_cast<WindowInfoMap>(value);
|
||||
if (d_ptr->WindowInfos != WindowInfos) {
|
||||
d_ptr->WindowInfos = WindowInfos;
|
||||
Q_EMIT WindowInfosChanged(d_ptr->WindowInfos);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (propName == QStringLiteral("Mode")) {
|
||||
const int mode = qvariant_cast<int>(value);
|
||||
if (d_ptr->mode != mode) {
|
||||
d_ptr->mode = mode;
|
||||
Q_EMIT ModeChanged(d_ptr->mode);
|
||||
}
|
||||
}
|
||||
|
||||
qWarning() << "property not handle: " << propName;
|
||||
return;
|
||||
}
|
||||
|
||||
uint Dock_Entry::currentWindow()
|
||||
{
|
||||
return qvariant_cast<uint>(property("CurrentWindow"));
|
||||
}
|
||||
|
||||
QString Dock_Entry::desktopFile()
|
||||
{
|
||||
return qvariant_cast<QString>(property("DesktopFile"));
|
||||
}
|
||||
|
||||
QString Dock_Entry::icon()
|
||||
{
|
||||
return qvariant_cast<QString>(property("Icon"));
|
||||
}
|
||||
|
||||
QString Dock_Entry::id()
|
||||
{
|
||||
return qvariant_cast<QString>(property("Id"));
|
||||
}
|
||||
|
||||
bool Dock_Entry::isActive()
|
||||
{
|
||||
return qvariant_cast<bool>(property("IsActive"));
|
||||
}
|
||||
|
||||
bool Dock_Entry::isDocked()
|
||||
{
|
||||
return qvariant_cast<bool>(property("IsDocked"));
|
||||
}
|
||||
|
||||
int Dock_Entry::mode() const
|
||||
{
|
||||
return qvariant_cast<int>(property("Mode"));
|
||||
}
|
||||
|
||||
QString Dock_Entry::menu()
|
||||
{
|
||||
return qvariant_cast<QString>(property("Menu"));
|
||||
}
|
||||
|
||||
QString Dock_Entry::name()
|
||||
{
|
||||
return qvariant_cast<QString>(property("Name"));
|
||||
}
|
||||
|
||||
WindowInfoMap Dock_Entry::windowInfos()
|
||||
{
|
||||
return qvariant_cast<WindowInfoMap>(property("WindowInfos"));
|
||||
}
|
||||
|
||||
void Dock_Entry::CallQueued(const QString &callName, const QList<QVariant> &args)
|
||||
{
|
||||
if (d_ptr->m_waittingCalls.contains(callName)) {
|
||||
d_ptr->m_waittingCalls[callName] = args;
|
||||
return;
|
||||
}
|
||||
if (d_ptr->m_processingCalls.contains(callName)) {
|
||||
d_ptr->m_waittingCalls.insert(callName, args);
|
||||
} else {
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(asyncCallWithArgumentList(callName, args));
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished, this, &Dock_Entry::onPendingCallFinished);
|
||||
d_ptr->m_processingCalls.insert(callName, watcher);
|
||||
}
|
||||
}
|
||||
|
||||
void Dock_Entry::onPendingCallFinished(QDBusPendingCallWatcher *w)
|
||||
{
|
||||
w->deleteLater();
|
||||
const auto callName = d_ptr->m_processingCalls.key(w);
|
||||
Q_ASSERT(!callName.isEmpty());
|
||||
if (callName.isEmpty())
|
||||
return;
|
||||
|
||||
d_ptr->m_processingCalls.remove(callName);
|
||||
if (!d_ptr->m_waittingCalls.contains(callName))
|
||||
return;
|
||||
|
||||
const auto args = d_ptr->m_waittingCalls.take(callName);
|
||||
CallQueued(callName, args);
|
||||
}
|
282
frame/dbus/entryinterface.h
Normal file
282
frame/dbus/entryinterface.h
Normal file
@ -0,0 +1,282 @@
|
||||
/*
|
||||
* Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
*
|
||||
* Author: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* Maintainer: donghualin <donghualin@uniontech.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef DOCK_ENTRY_H
|
||||
#define DOCK_ENTRY_H
|
||||
|
||||
#define WINDOWLIST_H
|
||||
#define WINDOWINFOLIST_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <DDBusExtendedAbstractInterface>
|
||||
#include <QtDBus>
|
||||
|
||||
typedef QList<quint32> WindowList;
|
||||
|
||||
void registerWindowListMetaType();
|
||||
|
||||
class WindowInfo
|
||||
{
|
||||
public:
|
||||
friend QDebug operator<<(QDebug argument, const WindowInfo &info);
|
||||
friend QDBusArgument &operator<<(QDBusArgument &argument, const WindowInfo &info);
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, WindowInfo &info);
|
||||
|
||||
bool operator==(const WindowInfo &rhs) const;
|
||||
|
||||
public:
|
||||
bool attention;
|
||||
QString title;
|
||||
QString uuid;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(WindowInfo)
|
||||
|
||||
typedef QMap<quint32, WindowInfo> WindowInfoMap;
|
||||
Q_DECLARE_METATYPE(WindowInfoMap)
|
||||
|
||||
void registerWindowInfoMetaType();
|
||||
void registerWindowInfoMapMetaType();
|
||||
|
||||
/*
|
||||
* Proxy class for interface org.deepin.dde.daemon.Dock1.Entry
|
||||
*/
|
||||
class EntryPrivate;
|
||||
|
||||
class Dock_Entry : public QDBusAbstractInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static inline const char *staticInterfaceName()
|
||||
{ return "org.deepin.dde.daemon.Dock1.Entry"; }
|
||||
|
||||
public:
|
||||
explicit Dock_Entry(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0);
|
||||
|
||||
~Dock_Entry();
|
||||
|
||||
Q_PROPERTY(uint CurrentWindow READ currentWindow NOTIFY CurrentWindowChanged)
|
||||
uint currentWindow();
|
||||
|
||||
Q_PROPERTY(QString DesktopFile READ desktopFile NOTIFY DesktopFileChanged)
|
||||
QString desktopFile();
|
||||
|
||||
Q_PROPERTY(QString Icon READ icon NOTIFY IconChanged)
|
||||
QString icon();
|
||||
|
||||
Q_PROPERTY(QString Id READ id)
|
||||
QString id();
|
||||
|
||||
Q_PROPERTY(bool IsActive READ isActive NOTIFY IsActiveChanged)
|
||||
bool isActive();
|
||||
|
||||
Q_PROPERTY(bool IsDocked READ isDocked NOTIFY IsDockedChanged)
|
||||
bool isDocked();
|
||||
|
||||
Q_PROPERTY(QString Menu READ menu NOTIFY MenuChanged)
|
||||
QString menu();
|
||||
|
||||
Q_PROPERTY(QString Name READ name NOTIFY NameChanged)
|
||||
QString name();
|
||||
|
||||
Q_PROPERTY(WindowInfoMap WindowInfos READ windowInfos NOTIFY WindowInfosChanged)
|
||||
WindowInfoMap windowInfos();
|
||||
|
||||
Q_PROPERTY(int Mode READ mode NOTIFY ModeChanged)
|
||||
int mode() const;
|
||||
|
||||
public Q_SLOTS: // METHODS
|
||||
inline QDBusPendingReply<> Activate(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("Activate"), argumentList);
|
||||
}
|
||||
|
||||
inline void ActivateQueued(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
CallQueued(QStringLiteral("Activate"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> Check()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("Check"), argumentList);
|
||||
}
|
||||
|
||||
inline void CheckQueued()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
CallQueued(QStringLiteral("Check"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> ForceQuit()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("ForceQuit"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> ActiveWindow(quint32 in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << in0;
|
||||
return asyncCallWithArgumentList(QStringLiteral("ActiveWindow"), argumentList);
|
||||
}
|
||||
|
||||
inline void ForceQuitQueued()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
CallQueued(QStringLiteral("ForceQuit"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<WindowList> GetAllowedCloseWindows()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("GetAllowedCloseWindows"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> HandleDragDrop(uint in0, const QStringList &in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
return asyncCallWithArgumentList(QStringLiteral("HandleDragDrop"), argumentList);
|
||||
}
|
||||
|
||||
inline void HandleDragDropQueued(uint in0, const QStringList &in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
CallQueued(QStringLiteral("HandleDragDrop"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> HandleMenuItem(uint in0, const QString &in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
return asyncCallWithArgumentList(QStringLiteral("HandleMenuItem"), argumentList);
|
||||
}
|
||||
|
||||
inline void HandleMenuItemQueued(uint in0, const QString &in1)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0) << QVariant::fromValue(in1);
|
||||
CallQueued(QStringLiteral("HandleMenuItem"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> NewInstance(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
return asyncCallWithArgumentList(QStringLiteral("NewInstance"), argumentList);
|
||||
}
|
||||
|
||||
inline void NewInstanceQueued(uint in0)
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
argumentList << QVariant::fromValue(in0);
|
||||
CallQueued(QStringLiteral("NewInstance"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> PresentWindows()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("PresentWindows"), argumentList);
|
||||
}
|
||||
|
||||
inline void PresentWindowsQueued()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
CallQueued(QStringLiteral("PresentWindows"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> RequestDock()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("RequestDock"), argumentList);
|
||||
}
|
||||
|
||||
inline void RequestDockQueued()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
CallQueued(QStringLiteral("RequestDock"), argumentList);
|
||||
}
|
||||
|
||||
inline QDBusPendingReply<> RequestUndock()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
return asyncCallWithArgumentList(QStringLiteral("RequestUndock"), argumentList);
|
||||
}
|
||||
|
||||
inline void RequestUndockQueued()
|
||||
{
|
||||
QList<QVariant> argumentList;
|
||||
CallQueued(QStringLiteral("RequestUndock"), argumentList);
|
||||
}
|
||||
|
||||
Q_SIGNALS: // SIGNALS
|
||||
// begin property changed signals
|
||||
void IsActiveChanged(bool value) const;
|
||||
void IsDockedChanged(bool value) const;
|
||||
void MenuChanged(const QString &value) const;
|
||||
void IconChanged(const QString &value) const;
|
||||
void NameChanged(const QString &value) const;
|
||||
void DesktopFileChanged(const QString &value) const;
|
||||
void CurrentWindowChanged(uint32_t value) const;
|
||||
|
||||
void WindowInfosChanged(WindowInfoMap value) const;
|
||||
void ModeChanged(int value) const;
|
||||
|
||||
private:
|
||||
QVariant asyncProperty(const QString &propertyName);
|
||||
|
||||
public Q_SLOTS:
|
||||
void CallQueued(const QString &callName, const QList<QVariant> &args);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onPendingCallFinished(QDBusPendingCallWatcher *w);
|
||||
void onPropertyChanged(const QString &propName, const QVariant &value);
|
||||
|
||||
private:
|
||||
EntryPrivate *d_ptr;
|
||||
};
|
||||
|
||||
namespace org {
|
||||
namespace deepin {
|
||||
namespace dde {
|
||||
namespace daemon {
|
||||
namespace dock {
|
||||
typedef ::Dock_Entry DockEntry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // DOCK_ENTRY_H
|
@ -1,4 +1,4 @@
|
||||
<interface name="com.deepin.dde.daemon.Dock">
|
||||
<interface name="org.deepin.dde.daemon.Dock1">
|
||||
<method name="ActivateWindow">
|
||||
<arg type="u" direction="in"></arg>
|
||||
</method>
|
38
frame/dbusinterface/types/arealist.cpp
Normal file
38
frame/dbusinterface/types/arealist.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "arealist.h"
|
||||
|
||||
bool MonitRect::operator ==(const MonitRect &rect)
|
||||
{
|
||||
return x1 == rect.x1 && y1 == rect.y1 && x2 == rect.x2 && y2 == rect.y2;
|
||||
}
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const MonitRect &rect)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << rect.x1 << rect.y1 << rect.x2 << rect.y2;
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, MonitRect &rect)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg >> rect.x1 >> rect.y1 >> rect.x2 >> rect.y2;
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
void registerAreaListMetaType()
|
||||
{
|
||||
qRegisterMetaType<MonitRect>("MonitRect");
|
||||
qDBusRegisterMetaType<MonitRect>();
|
||||
|
||||
qRegisterMetaType<AreaList>("AreaList");
|
||||
qDBusRegisterMetaType<AreaList>();
|
||||
}
|
32
frame/dbusinterface/types/arealist.h
Normal file
32
frame/dbusinterface/types/arealist.h
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef AREALIST_H
|
||||
#define AREALIST_H
|
||||
|
||||
#include <QDBusMetaType>
|
||||
#include <QRect>
|
||||
#include <QList>
|
||||
|
||||
struct MonitRect {
|
||||
int x1;
|
||||
int y1;
|
||||
int x2;
|
||||
int y2;
|
||||
|
||||
bool operator ==(const MonitRect& rect);
|
||||
};
|
||||
|
||||
typedef QList<MonitRect> AreaList;
|
||||
|
||||
Q_DECLARE_METATYPE(MonitRect)
|
||||
Q_DECLARE_METATYPE(AreaList)
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const MonitRect &rect);
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, MonitRect &rect);
|
||||
|
||||
void registerAreaListMetaType();
|
||||
|
||||
#endif // AREALIST_H
|
14
frame/dbusinterface/types/audioport.cpp
Normal file
14
frame/dbusinterface/types/audioport.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include <QDBusMetaType>
|
||||
|
||||
#include "audioport.h"
|
||||
|
||||
void registerAudioPortMetaType()
|
||||
{
|
||||
qRegisterMetaType<AudioPort>("AudioPort");
|
||||
qDBusRegisterMetaType<AudioPort>();
|
||||
}
|
56
frame/dbusinterface/types/audioport.h
Normal file
56
frame/dbusinterface/types/audioport.h
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef AUDIOPORT_H
|
||||
#define AUDIOPORT_H
|
||||
|
||||
#include <QDBusMetaType>
|
||||
#include <QString>
|
||||
#include <QDBusArgument>
|
||||
#include <QDebug>
|
||||
|
||||
class AudioPort
|
||||
{
|
||||
public:
|
||||
QString name;
|
||||
QString description;
|
||||
uchar availability; // 0 for Unknown, 1 for Not Available, 2 for Available.
|
||||
|
||||
friend QDebug operator<<(QDebug argument, const AudioPort &port) {
|
||||
argument << port.description;
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
friend QDBusArgument &operator<<(QDBusArgument &argument, const AudioPort &port) {
|
||||
argument.beginStructure();
|
||||
argument << port.name << port.description << port.availability;
|
||||
argument.endStructure();
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, AudioPort &port) {
|
||||
argument.beginStructure();
|
||||
argument >> port.name >> port.description >> port.availability;
|
||||
argument.endStructure();
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
bool operator==(const AudioPort what) const {
|
||||
return what.name == name && what.description == description && what.availability == availability;
|
||||
}
|
||||
|
||||
bool operator!=(const AudioPort what) const {
|
||||
return what.name != name || what.description != description || what.availability != availability;
|
||||
}
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(AudioPort)
|
||||
|
||||
void registerAudioPortMetaType();
|
||||
|
||||
#endif // AUDIOPORT_H
|
12
frame/dbusinterface/types/audioportlist.cpp
Normal file
12
frame/dbusinterface/types/audioportlist.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "audioportlist.h"
|
||||
|
||||
void registerAudioPortListMetaType()
|
||||
{
|
||||
qRegisterMetaType<AudioPortList>("AudioPortList");
|
||||
qDBusRegisterMetaType<AudioPortList>();
|
||||
}
|
20
frame/dbusinterface/types/audioportlist.h
Normal file
20
frame/dbusinterface/types/audioportlist.h
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef AUDIOPORTLIST_H
|
||||
#define AUDIOPORTLIST_H
|
||||
|
||||
#include <QDBusMetaType>
|
||||
#include <QList>
|
||||
|
||||
#include "audioport.h"
|
||||
|
||||
typedef QList<AudioPort> AudioPortList;
|
||||
|
||||
Q_DECLARE_METATYPE(AudioPortList)
|
||||
|
||||
void registerAudioPortListMetaType();
|
||||
|
||||
#endif // AUDIOPORTLIST_H
|
12
frame/dbusinterface/types/brightnessmap.cpp
Normal file
12
frame/dbusinterface/types/brightnessmap.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "brightnessmap.h"
|
||||
|
||||
void registerBrightnessMapMetaType()
|
||||
{
|
||||
qRegisterMetaType<BrightnessMap>("BrightnessMap");
|
||||
qDBusRegisterMetaType<BrightnessMap>();
|
||||
}
|
16
frame/dbusinterface/types/brightnessmap.h
Normal file
16
frame/dbusinterface/types/brightnessmap.h
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef BRIGHTNESSMAP_H
|
||||
#define BRIGHTNESSMAP_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QDBusMetaType>
|
||||
|
||||
typedef QMap<QString, double> BrightnessMap;
|
||||
|
||||
void registerBrightnessMapMetaType();
|
||||
|
||||
#endif // BRIGHTNESSMAP_H
|
43
frame/dbusinterface/types/dbusimagelist.cpp
Normal file
43
frame/dbusinterface/types/dbusimagelist.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "dbusimagelist.h"
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &argument, const DBusImage &image)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument << image.width << image.height << image.pixels;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &argument, DBusImage &image)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument >> image.width >> image.height >> image.pixels;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
void registerDBusImageListMetaType()
|
||||
{
|
||||
qRegisterMetaType<DBusImage>("DBusImage");
|
||||
qDBusRegisterMetaType<DBusImage>();
|
||||
|
||||
qRegisterMetaType<DBusImageList>("DBusImageList");
|
||||
qDBusRegisterMetaType<DBusImageList>();
|
||||
}
|
||||
|
||||
bool operator ==(const DBusImage &a, const DBusImage &b)
|
||||
{
|
||||
return a.width == b.width
|
||||
&& a.height == b.height
|
||||
&& a.pixels == b.pixels;
|
||||
}
|
||||
|
||||
bool operator !=(const DBusImage &a, const DBusImage &b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
32
frame/dbusinterface/types/dbusimagelist.h
Normal file
32
frame/dbusinterface/types/dbusimagelist.h
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef DBUSIMAGELIST_H
|
||||
#define DBUSIMAGELIST_H
|
||||
|
||||
#include <QDBusMetaType>
|
||||
#include <QRect>
|
||||
#include <QList>
|
||||
|
||||
struct DBusImage
|
||||
{
|
||||
int width;
|
||||
int height;
|
||||
QByteArray pixels;
|
||||
};
|
||||
Q_DECLARE_METATYPE(DBusImage)
|
||||
|
||||
typedef QList<DBusImage> DBusImageList;
|
||||
Q_DECLARE_METATYPE(DBusImageList)
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument&, const DBusImage&);
|
||||
const QDBusArgument &operator>>(const QDBusArgument&, DBusImage&);
|
||||
|
||||
bool operator ==(const DBusImage&, const DBusImage&);
|
||||
bool operator !=(const DBusImage&, const DBusImage&);
|
||||
|
||||
void registerDBusImageListMetaType();
|
||||
|
||||
#endif // DBUSIMAGELIST_H
|
41
frame/dbusinterface/types/dbustooltip.cpp
Normal file
41
frame/dbusinterface/types/dbustooltip.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "dbustooltip.h"
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &argument, const DBusToolTip &tip)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument << tip.iconName << tip.iconPixmap << tip.title << tip.description;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &argument, DBusToolTip &tip)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument >> tip.iconName >> tip.iconPixmap >> tip.title >> tip.description;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
bool operator ==(const DBusToolTip &a, const DBusToolTip &b)
|
||||
{
|
||||
return a.iconName == b.iconName
|
||||
&& a.iconPixmap == b.iconPixmap
|
||||
&& a.title == b.title
|
||||
&& a.description == b.description;
|
||||
}
|
||||
|
||||
bool operator !=(const DBusToolTip &a, const DBusToolTip &b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
void registerDBusToolTipMetaType()
|
||||
{
|
||||
qRegisterMetaType<DBusToolTip>("DBusToolTip");
|
||||
qDBusRegisterMetaType<DBusToolTip>();
|
||||
}
|
32
frame/dbusinterface/types/dbustooltip.h
Normal file
32
frame/dbusinterface/types/dbustooltip.h
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef DBUSTOOLTIP_H
|
||||
#define DBUSTOOLTIP_H
|
||||
|
||||
#include "dbusimagelist.h"
|
||||
|
||||
#include <QDBusMetaType>
|
||||
#include <QRect>
|
||||
#include <QList>
|
||||
|
||||
struct DBusToolTip
|
||||
{
|
||||
QString iconName;
|
||||
DBusImageList iconPixmap;
|
||||
QString title;
|
||||
QString description;
|
||||
};
|
||||
Q_DECLARE_METATYPE(DBusToolTip)
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument&, const DBusToolTip&);
|
||||
const QDBusArgument &operator>>(const QDBusArgument&, DBusToolTip&);
|
||||
|
||||
bool operator ==(const DBusToolTip&, const DBusToolTip&);
|
||||
bool operator !=(const DBusToolTip&, const DBusToolTip&);
|
||||
|
||||
void registerDBusToolTipMetaType();
|
||||
|
||||
#endif // DBUSTOOLTIP_H
|
54
frame/dbusinterface/types/dockrect.cpp
Normal file
54
frame/dbusinterface/types/dockrect.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "dockrect.h"
|
||||
#include <QDebug>
|
||||
|
||||
DockRect::DockRect()
|
||||
: x(0)
|
||||
, y(0)
|
||||
, w(0)
|
||||
, h(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const DockRect &rect)
|
||||
{
|
||||
debug << QString("DockRect(%1, %2, %3, %4)").arg(rect.x)
|
||||
.arg(rect.y)
|
||||
.arg(rect.w)
|
||||
.arg(rect.h);
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
DockRect::operator QRect() const
|
||||
{
|
||||
return QRect(x, y, w, h);
|
||||
}
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const DockRect &rect)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << rect.x << rect.y << rect.w << rect.h;
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, DockRect &rect)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg >> rect.x >> rect.y >> rect.w >> rect.h;
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
void registerDockRectMetaType()
|
||||
{
|
||||
qRegisterMetaType<DockRect>("DockRect");
|
||||
qDBusRegisterMetaType<DockRect>();
|
||||
}
|
32
frame/dbusinterface/types/dockrect.h
Normal file
32
frame/dbusinterface/types/dockrect.h
Normal file
@ -0,0 +1,32 @@
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef DOCKRECT_H
|
||||
#define DOCKRECT_H
|
||||
|
||||
#include <QRect>
|
||||
#include <QDBusMetaType>
|
||||
|
||||
struct DockRect
|
||||
{
|
||||
public:
|
||||
DockRect();
|
||||
operator QRect() const;
|
||||
|
||||
friend QDebug operator<<(QDebug debug, const DockRect &rect);
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &arg, DockRect &rect);
|
||||
friend QDBusArgument &operator<<(QDBusArgument &arg, const DockRect &rect);
|
||||
|
||||
private:
|
||||
int x;
|
||||
int y;
|
||||
uint w;
|
||||
uint h;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(DockRect)
|
||||
|
||||
void registerDockRectMetaType();
|
||||
|
||||
#endif // DOCKRECT_H
|
12
frame/dbusinterface/types/keyboardlayoutlist.cpp
Normal file
12
frame/dbusinterface/types/keyboardlayoutlist.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "keyboardlayoutlist.h"
|
||||
|
||||
void registerKeyboardLayoutListMetaType()
|
||||
{
|
||||
qRegisterMetaType<KeyboardLayoutList>("KeyboardLayoutList");
|
||||
qDBusRegisterMetaType<KeyboardLayoutList>();
|
||||
}
|
18
frame/dbusinterface/types/keyboardlayoutlist.h
Normal file
18
frame/dbusinterface/types/keyboardlayoutlist.h
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef KEYBOARDLAYOUTLIST_H
|
||||
#define KEYBOARDLAYOUTLIST_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
#include <QDBusMetaType>
|
||||
|
||||
typedef QMap<QString, QString> KeyboardLayoutList;
|
||||
|
||||
void registerKeyboardLayoutListMetaType();
|
||||
|
||||
#endif // KEYBOARDLAYOUTLIST_H
|
56
frame/dbusinterface/types/resolution.cpp
Normal file
56
frame/dbusinterface/types/resolution.cpp
Normal file
@ -0,0 +1,56 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "resolution.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
void registerResolutionMetaType()
|
||||
{
|
||||
qRegisterMetaType<Resolution>("Resolution");
|
||||
qDBusRegisterMetaType<Resolution>();
|
||||
}
|
||||
|
||||
Resolution::Resolution()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool Resolution::operator!=(const Resolution &other) const
|
||||
{
|
||||
return m_width != other.m_width || m_height != other.m_height || m_rate != other.m_rate;
|
||||
}
|
||||
|
||||
bool Resolution::operator==(const Resolution &other) const
|
||||
{
|
||||
return !(other != *this);
|
||||
}
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const Resolution &value)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << quint32(value.id()) << quint16(value.width()) << quint16(value.height()) << value.rate();
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, Resolution &value)
|
||||
{
|
||||
quint32 id;
|
||||
quint16 w, h;
|
||||
double rate;
|
||||
|
||||
arg.beginStructure();
|
||||
arg >> id >> w >> h >> rate;
|
||||
arg.endStructure();
|
||||
|
||||
value.setId(id);
|
||||
value.setWidth(w);
|
||||
value.setHeight(h);
|
||||
value.setRate(rate);
|
||||
|
||||
return arg;
|
||||
}
|
45
frame/dbusinterface/types/resolution.h
Normal file
45
frame/dbusinterface/types/resolution.h
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef RESOLUTION_H
|
||||
#define RESOLUTION_H
|
||||
|
||||
#include <QDBusMetaType>
|
||||
|
||||
class Resolution
|
||||
{
|
||||
public:
|
||||
friend QDBusArgument &operator<<(QDBusArgument &arg, const Resolution &value);
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &arg, Resolution &value);
|
||||
|
||||
explicit Resolution();
|
||||
|
||||
bool operator!=(const Resolution &other) const;
|
||||
bool operator==(const Resolution &other) const;
|
||||
|
||||
int id() const { return m_id; }
|
||||
int width() const { return m_width; }
|
||||
int height() const { return m_height; }
|
||||
double rate() const { return m_rate; }
|
||||
|
||||
private:
|
||||
void setId(const int id) { m_id = id; }
|
||||
void setWidth(const int w) { m_width = w; }
|
||||
void setHeight(const int h) { m_height = h; }
|
||||
void setRate(const double rate) { m_rate = rate; }
|
||||
|
||||
private:
|
||||
int m_id;
|
||||
int m_width;
|
||||
int m_height;
|
||||
double m_rate;
|
||||
};
|
||||
|
||||
|
||||
Q_DECLARE_METATYPE(Resolution)
|
||||
|
||||
void registerResolutionMetaType();
|
||||
|
||||
#endif // RESOLUTION_H
|
14
frame/dbusinterface/types/resolutionlist.cpp
Normal file
14
frame/dbusinterface/types/resolutionlist.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "resolutionlist.h"
|
||||
|
||||
void registerResolutionListMetaType()
|
||||
{
|
||||
registerResolutionMetaType();
|
||||
|
||||
qRegisterMetaType<ResolutionList>("ResolutionList");
|
||||
qDBusRegisterMetaType<ResolutionList>();
|
||||
}
|
17
frame/dbusinterface/types/resolutionlist.h
Normal file
17
frame/dbusinterface/types/resolutionlist.h
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef RESOLUTIONLIST_H
|
||||
#define RESOLUTIONLIST_H
|
||||
|
||||
#include "resolution.h"
|
||||
|
||||
#include <QList>
|
||||
|
||||
typedef QList<Resolution> ResolutionList;
|
||||
|
||||
void registerResolutionListMetaType();
|
||||
|
||||
#endif // RESOLUTIONLIST_H
|
54
frame/dbusinterface/types/screenrect.cpp
Normal file
54
frame/dbusinterface/types/screenrect.cpp
Normal file
@ -0,0 +1,54 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "screenrect.h"
|
||||
|
||||
ScreenRect::ScreenRect()
|
||||
: x(0),
|
||||
y(0),
|
||||
w(0),
|
||||
h(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const ScreenRect &rect)
|
||||
{
|
||||
debug << QString("ScreenRect(%1, %2, %3, %4)").arg(rect.x)
|
||||
.arg(rect.y)
|
||||
.arg(rect.w)
|
||||
.arg(rect.h);
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
ScreenRect::operator QRect() const
|
||||
{
|
||||
return QRect(x, y, w, h);
|
||||
}
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const ScreenRect &rect)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << rect.x << rect.y << rect.w << rect.h;
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, ScreenRect &rect)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg >> rect.x >> rect.y >> rect.w >> rect.h;
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
void registerScreenRectMetaType()
|
||||
{
|
||||
qRegisterMetaType<ScreenRect>("ScreenRect");
|
||||
qDBusRegisterMetaType<ScreenRect>();
|
||||
}
|
35
frame/dbusinterface/types/screenrect.h
Normal file
35
frame/dbusinterface/types/screenrect.h
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef SCREENRECT_H
|
||||
#define SCREENRECT_H
|
||||
|
||||
#include <QRect>
|
||||
#include <QDBusArgument>
|
||||
#include <QDebug>
|
||||
#include <QDBusMetaType>
|
||||
|
||||
struct ScreenRect
|
||||
{
|
||||
public:
|
||||
ScreenRect();
|
||||
operator QRect() const;
|
||||
|
||||
friend QDebug operator<<(QDebug debug, const ScreenRect &rect);
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &arg, ScreenRect &rect);
|
||||
friend QDBusArgument &operator<<(QDBusArgument &arg, const ScreenRect &rect);
|
||||
|
||||
private:
|
||||
qint16 x;
|
||||
qint16 y;
|
||||
quint16 w;
|
||||
quint16 h;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ScreenRect)
|
||||
|
||||
void registerScreenRectMetaType();
|
||||
|
||||
#endif // SCREENRECT_H
|
43
frame/dbusinterface/types/touchscreeninfolist.cpp
Normal file
43
frame/dbusinterface/types/touchscreeninfolist.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "touchscreeninfolist.h"
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const TouchscreenInfo &info)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << info.id << info.name << info.deviceNode << info.serialNumber;
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, TouchscreenInfo &info)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg >> info.id >> info.name >> info.deviceNode >> info.serialNumber;
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
bool TouchscreenInfo::operator==(const TouchscreenInfo &info)
|
||||
{
|
||||
return id == info.id && name == info.name && deviceNode == info.deviceNode && serialNumber == info.serialNumber;
|
||||
}
|
||||
|
||||
void registerTouchscreenInfoMetaType()
|
||||
{
|
||||
qRegisterMetaType<TouchscreenInfo>("TouchscreenInfo");
|
||||
qDBusRegisterMetaType<TouchscreenInfo>();
|
||||
}
|
||||
|
||||
void registerTouchscreenInfoListMetaType()
|
||||
{
|
||||
registerTouchscreenInfoMetaType();
|
||||
|
||||
qRegisterMetaType<TouchscreenInfoList>("TouchscreenInfoList");
|
||||
qDBusRegisterMetaType<TouchscreenInfoList>();
|
||||
}
|
32
frame/dbusinterface/types/touchscreeninfolist.h
Normal file
32
frame/dbusinterface/types/touchscreeninfolist.h
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef TOUCHSCREENINFOLIST_H
|
||||
#define TOUCHSCREENINFOLIST_H
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QDBusMetaType>
|
||||
|
||||
struct TouchscreenInfo {
|
||||
qint32 id;
|
||||
QString name;
|
||||
QString deviceNode;
|
||||
QString serialNumber;
|
||||
|
||||
bool operator ==(const TouchscreenInfo& info);
|
||||
};
|
||||
|
||||
typedef QList<TouchscreenInfo> TouchscreenInfoList;
|
||||
|
||||
Q_DECLARE_METATYPE(TouchscreenInfo)
|
||||
Q_DECLARE_METATYPE(TouchscreenInfoList)
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const TouchscreenInfo &info);
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, TouchscreenInfo &info);
|
||||
|
||||
void registerTouchscreenInfoListMetaType();
|
||||
|
||||
#endif // !TOUCHSCREENINFOLIST_H
|
43
frame/dbusinterface/types/touchscreeninfolist_v2.cpp
Normal file
43
frame/dbusinterface/types/touchscreeninfolist_v2.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "touchscreeninfolist_v2.h"
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const TouchscreenInfo_V2 &info)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << info.id << info.name << info.deviceNode << info.serialNumber << info.UUID;
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, TouchscreenInfo_V2 &info)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg >> info.id >> info.name >> info.deviceNode >> info.serialNumber >> info.UUID;
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
bool TouchscreenInfo_V2::operator==(const TouchscreenInfo_V2 &info)
|
||||
{
|
||||
return id == info.id && name == info.name && deviceNode == info.deviceNode && serialNumber == info.serialNumber && UUID == info.UUID;
|
||||
}
|
||||
|
||||
void registerTouchscreenInfoV2MetaType()
|
||||
{
|
||||
qRegisterMetaType<TouchscreenInfo_V2>("TouchscreenInfo_V2");
|
||||
qDBusRegisterMetaType<TouchscreenInfo_V2>();
|
||||
}
|
||||
|
||||
void registerTouchscreenInfoList_V2MetaType()
|
||||
{
|
||||
registerTouchscreenInfoV2MetaType();
|
||||
|
||||
qRegisterMetaType<TouchscreenInfoList_V2>("TouchscreenInfoList_V2");
|
||||
qDBusRegisterMetaType<TouchscreenInfoList_V2>();
|
||||
}
|
33
frame/dbusinterface/types/touchscreeninfolist_v2.h
Normal file
33
frame/dbusinterface/types/touchscreeninfolist_v2.h
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef TOUCHSCREENINFOLISTV2_H
|
||||
#define TOUCHSCREENINFOLISTV2_H
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QDBusMetaType>
|
||||
|
||||
struct TouchscreenInfo_V2 {
|
||||
qint32 id;
|
||||
QString name;
|
||||
QString deviceNode;
|
||||
QString serialNumber;
|
||||
QString UUID;
|
||||
|
||||
bool operator ==(const TouchscreenInfo_V2& info);
|
||||
};
|
||||
|
||||
typedef QList<TouchscreenInfo_V2> TouchscreenInfoList_V2;
|
||||
|
||||
Q_DECLARE_METATYPE(TouchscreenInfo_V2)
|
||||
Q_DECLARE_METATYPE(TouchscreenInfoList_V2)
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const TouchscreenInfo_V2 &info);
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, TouchscreenInfo_V2 &info);
|
||||
|
||||
void registerTouchscreenInfoList_V2MetaType();
|
||||
|
||||
#endif // !TOUCHSCREENINFOLISTV2_H
|
12
frame/dbusinterface/types/touchscreenmap.cpp
Normal file
12
frame/dbusinterface/types/touchscreenmap.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "touchscreenmap.h"
|
||||
|
||||
void registerTouchscreenMapMetaType()
|
||||
{
|
||||
qRegisterMetaType<TouchscreenMap>("TouchscreenMap");
|
||||
qDBusRegisterMetaType<TouchscreenMap>();
|
||||
}
|
16
frame/dbusinterface/types/touchscreenmap.h
Normal file
16
frame/dbusinterface/types/touchscreenmap.h
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef TOUCHSCREENMAP_H
|
||||
#define TOUCHSCREENMAP_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QDBusMetaType>
|
||||
|
||||
typedef QMap<QString, QString> TouchscreenMap;
|
||||
|
||||
void registerTouchscreenMapMetaType();
|
||||
|
||||
#endif // TOUCHSCREENMAP_H
|
72
frame/dbusinterface/types/zoneinfo.cpp
Normal file
72
frame/dbusinterface/types/zoneinfo.cpp
Normal file
@ -0,0 +1,72 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "zoneinfo.h"
|
||||
|
||||
ZoneInfo::ZoneInfo()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool ZoneInfo::operator ==(const ZoneInfo &what) const
|
||||
{
|
||||
// TODO: 这里只判断这两个成员应该就可以了
|
||||
return m_zoneName == what.m_zoneName &&
|
||||
m_utcOffset == what.m_utcOffset;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug argument, const ZoneInfo & info)
|
||||
{
|
||||
argument << info.m_zoneName << ',' << info.m_zoneCity << ',' << info.m_utcOffset << ',';
|
||||
argument << info.i2 << ',' << info.i3 << ',' << info.i4 << Qt::endl;
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
QDBusArgument &operator<<(QDBusArgument & argument, const ZoneInfo & info)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument << info.m_zoneName << info.m_zoneCity << info.m_utcOffset;
|
||||
argument.beginStructure();
|
||||
argument << info.i2 << info.i3 << info.i4;
|
||||
argument.endStructure();
|
||||
argument.endStructure();
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream & argument, const ZoneInfo & info)
|
||||
{
|
||||
argument << info.m_zoneName << info.m_zoneCity << info.m_utcOffset;
|
||||
argument << info.i2 << info.i3 << info.i4;
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument & argument, ZoneInfo & info)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument >> info.m_zoneName >> info.m_zoneCity >> info.m_utcOffset;
|
||||
argument.beginStructure();
|
||||
argument >> info.i2 >> info.i3 >> info.i4;
|
||||
argument.endStructure();
|
||||
argument.endStructure();
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
const QDataStream &operator>>(QDataStream & argument, ZoneInfo & info)
|
||||
{
|
||||
argument >> info.m_zoneName >> info.m_zoneCity >> info.m_utcOffset;
|
||||
argument >> info.i2 >> info.i3 >> info.i4;
|
||||
|
||||
return argument;
|
||||
}
|
||||
|
||||
void registerZoneInfoMetaType()
|
||||
{
|
||||
qRegisterMetaType<ZoneInfo>("ZoneInfo");
|
||||
qDBusRegisterMetaType<ZoneInfo>();
|
||||
}
|
46
frame/dbusinterface/types/zoneinfo.h
Normal file
46
frame/dbusinterface/types/zoneinfo.h
Normal file
@ -0,0 +1,46 @@
|
||||
// Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef ZONEINFO_H
|
||||
#define ZONEINFO_H
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDataStream>
|
||||
#include <QString>
|
||||
#include <QDBusArgument>
|
||||
#include <QDBusMetaType>
|
||||
|
||||
class ZoneInfo
|
||||
{
|
||||
public:
|
||||
ZoneInfo();
|
||||
|
||||
friend QDebug operator<<(QDebug argument, const ZoneInfo &info);
|
||||
friend QDBusArgument &operator<<(QDBusArgument &argument, const ZoneInfo &info);
|
||||
friend QDataStream &operator<<(QDataStream &argument, const ZoneInfo &info);
|
||||
friend const QDBusArgument &operator>>(const QDBusArgument &argument, ZoneInfo &info);
|
||||
friend const QDataStream &operator>>(QDataStream &argument, ZoneInfo &info);
|
||||
|
||||
bool operator==(const ZoneInfo &what) const;
|
||||
|
||||
public:
|
||||
inline QString getZoneName() const {return m_zoneName;}
|
||||
inline QString getZoneCity() const {return m_zoneCity;}
|
||||
inline int getUTCOffset() const {return m_utcOffset;}
|
||||
|
||||
private:
|
||||
QString m_zoneName;
|
||||
QString m_zoneCity;
|
||||
int m_utcOffset;
|
||||
qint64 i2;
|
||||
qint64 i3;
|
||||
int i4;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ZoneInfo)
|
||||
|
||||
void registerZoneInfoMetaType();
|
||||
|
||||
#endif // ZONEINFO_H
|
101
frame/dbusinterface/xml/org.deepin.dde.Appearance1.xml
Normal file
101
frame/dbusinterface/xml/org.deepin.dde.Appearance1.xml
Normal file
@ -0,0 +1,101 @@
|
||||
<interface name="org.deepin.dde.Appearance1">
|
||||
<!--
|
||||
<method name="Delete">
|
||||
<arg direction="in" type="s" name="ty"/>
|
||||
<arg direction="in" type="s" name="name"/>
|
||||
</method>
|
||||
<method name="GetScaleFactor">
|
||||
<arg direction="out" type="d" name="scaleFactor"/>
|
||||
</method>
|
||||
|
||||
<method name="GetScreenScaleFactors">
|
||||
<arg direction="out" type="a{sd}" name="scaleFactor"/>
|
||||
<annotation value="ScaleFactors"
|
||||
name="org.qtproject.QtDBus.QtTypeName.Out0"/>
|
||||
</method>
|
||||
<method name="GetWallpaperSlideShow">
|
||||
<arg direction="in" type="s" name="monitorName"/>
|
||||
<arg direction="out" type="s" name="slideShow"/>
|
||||
</method>
|
||||
<method name="List">
|
||||
<arg direction="in" type="s" name="ty"/>
|
||||
<arg direction="out" type="s" name="list"/>
|
||||
</method>
|
||||
<method name="Reset"/>
|
||||
<method name="Set">
|
||||
<arg direction="in" type="s" name="ty"/>
|
||||
<arg direction="in" type="s" name="value"/>
|
||||
</method>
|
||||
<method name="SetMonitorBackground">
|
||||
<arg direction="in" type="s" name="monitorName"/>
|
||||
<arg direction="in" type="s" name="imageGile"/>
|
||||
</method>
|
||||
<method name="SetScaleFactor">
|
||||
<arg direction="in" type="d" name="scale"/>
|
||||
</method>
|
||||
<method name="SetScreenScaleFactors">
|
||||
<arg direction="in" type="a{sd}" name="scaleFactor"/>
|
||||
<annotation value="ScaleFactors"
|
||||
name="org.qtproject.QtDBus.QtTypeName.In0"/>
|
||||
</method>
|
||||
<method name="SetWallpaperSlideShow">
|
||||
<arg direction="in" type="s" name="monitorName"/>
|
||||
<arg direction="in" type="s" name="slideShow"/>
|
||||
</method>
|
||||
<method name="Show">
|
||||
<arg direction="in" type="s" name="ty"/>
|
||||
<arg direction="in" type="as" name="names"/>
|
||||
<arg direction="out" type="s" name="detail"/>
|
||||
</method>
|
||||
<method name="Thumbnail">
|
||||
<arg direction="in" type="s" name="ty"/>
|
||||
<arg direction="in" type="s" name="name"/>
|
||||
<arg direction="out" type="s" name="file"/>
|
||||
</method>
|
||||
<method name="SetCurrentWorkspaceBackground">
|
||||
<arg direction="in" type="s" name="uri"/>
|
||||
</method>
|
||||
<method name="GetCurrentWorkspaceBackground">
|
||||
<arg direction="out" type="s" name="uri"/>
|
||||
</method>
|
||||
<method name="SetCurrentWorkspaceBackgroundForMonitor">
|
||||
<arg direction="in" type="s" name="uri"/>
|
||||
<arg direction="in" type="s" name="strMonitorName"/>
|
||||
</method>
|
||||
<method name="GetCurrentWorkspaceBackgroundForMonitor">
|
||||
<arg direction="in" type="s" name="strMonitorName"/>
|
||||
<arg direction="out" type="s" name="uri"/>
|
||||
</method>
|
||||
<method name="SetWorkspaceBackgroundForMonitor">
|
||||
<arg direction="in" type="i" name="index"/>
|
||||
<arg direction="in" type="s" name="strMonitorName"/>
|
||||
<arg direction="in" type="s" name="uri"/>
|
||||
</method>
|
||||
<method name="GetWorkspaceBackgroundForMonitor">
|
||||
<arg direction="in" type="i" name="index"/>
|
||||
<arg direction="in" type="s" name="strMonitorName"/>
|
||||
<arg direction="out" type="s" name="uri"/>
|
||||
</method>
|
||||
-->
|
||||
<property access="readwrite" type="d" name="FontSize"/>
|
||||
<property access="readwrite" type="d" name="Opacity"/>
|
||||
<property access="readwrite" type="i" name="WindowRadius"/>
|
||||
<property access="read" type="s" name="Background"/>
|
||||
<property access="read" type="s" name="GlobalTheme"/>
|
||||
<property access="read" type="s" name="GtkTheme"/>
|
||||
<property access="read" type="s" name="IconTheme"/>
|
||||
<property access="read" type="s" name="CursorTheme"/>
|
||||
<property access="read" type="s" name="MonospaceFont"/>
|
||||
<property access="readwrite" type="s" name="QtActiveColor"/>
|
||||
<property access="read" type="s" name="StandardFont"/>
|
||||
<property access="readwrite" type="s" name="WallpaperSlideShow"/>
|
||||
<property access="read" type="s" name="WallpaperURls"/>
|
||||
<signal name="Changed">
|
||||
<arg type="s" name="ty"/>
|
||||
<arg type="s" name="value"/>
|
||||
</signal>
|
||||
<signal name="Refreshed">
|
||||
<arg type="s" name="type"/>
|
||||
</signal>
|
||||
</interface>
|
||||
|
38
frame/dbusinterface/xml/org.deepin.dde.Audio1.Sink.xml
Normal file
38
frame/dbusinterface/xml/org.deepin.dde.Audio1.Sink.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<interface name="org.deepin.dde.Audio1.Sink">
|
||||
<method name="GetMeter">
|
||||
<arg type="o" direction="out"/>
|
||||
</method>
|
||||
<method name="SetBalance">
|
||||
<arg type="d" direction="in"/>
|
||||
<arg type="b" direction="in"/>
|
||||
</method>
|
||||
<method name="SetFade">
|
||||
<arg type="d" direction="in"/>
|
||||
</method>
|
||||
<method name="SetMute">
|
||||
<arg type="b" direction="in"/>
|
||||
</method>
|
||||
<method name="SetPort">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="SetVolume">
|
||||
<arg type="d" direction="in"/>
|
||||
<arg type="b" direction="in"/>
|
||||
</method>
|
||||
<property name="Name" type="s" access="read"/>\n
|
||||
<property name="Description" type="s" access="read"/>
|
||||
<property name="BaseVolume" type="d" access="read"/>
|
||||
<property name="Mute" type="b" access="read"/>
|
||||
<property name="Volume" type="d" access="read"/>
|
||||
<property name="Balance" type="d" access="read"/>
|
||||
<property name="SupportBalance" type="b" access="read"/>
|
||||
<property name="Fade" type="d" access="read"/>
|
||||
<property name="SupportFade" type="b" access="read"/>
|
||||
<property name="Ports" type="a(ssy)" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="AudioPortList"/>
|
||||
</property>
|
||||
<property name="ActivePort" type="(ssy)" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="AudioPort"/>
|
||||
</property>
|
||||
<property name="Card" type="u" access="read"/>
|
||||
</interface>
|
46
frame/dbusinterface/xml/org.deepin.dde.Audio1.xml
Normal file
46
frame/dbusinterface/xml/org.deepin.dde.Audio1.xml
Normal file
@ -0,0 +1,46 @@
|
||||
<interface name="org.deepin.dde.Audio1">
|
||||
<method name="Reset"/>
|
||||
<method name="SetDefaultSink">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="SetDefaultSource">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="SetBluetoothAudioMode">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="SetPort">
|
||||
<arg type="u" direction="in"/>
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="i" direction="in"/>
|
||||
</method>
|
||||
<method name="SetPortEnabled">
|
||||
<arg type="u" direction="in"/>
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="b" direction="in"/>
|
||||
</method>
|
||||
<method name="IsPortEnabled">
|
||||
<arg type="u" direction="in"/>
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="b" direction="out"/>
|
||||
</method>
|
||||
<signal name="PortEnabledChanged">
|
||||
<arg type="u"></arg>
|
||||
<arg type="s"></arg>
|
||||
<arg type="b"></arg>
|
||||
</signal>
|
||||
<property name="SinkInputs" type="ao" access="read"/>
|
||||
<property name="Sinks" type="ao" access="read"/>
|
||||
<property name="Sources" type="ao" access="read"/>
|
||||
<property name="BluetoothAudioModeOpts" type="as" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QStringList"/>
|
||||
</property>
|
||||
<property name="BluetoothAudioMode" type="s" access="read"/>
|
||||
<property name="Cards" type="s" access="read"/>
|
||||
<property name="CardsWithoutUnavailable" type="s" access="read"/>
|
||||
<property name="DefaultSink" type="o" access="read"/>
|
||||
<property name="DefaultSource" type="o" access="read"/>
|
||||
<property name="MaxUIVolume" type="d" access="read"/>
|
||||
<property name="IncreaseVolume" type="b" access="readwrite"/>
|
||||
<property name="ReduceNoise" type="b" access="readwrite"/>
|
||||
</interface>
|
83
frame/dbusinterface/xml/org.deepin.dde.Display1.xml
Normal file
83
frame/dbusinterface/xml/org.deepin.dde.Display1.xml
Normal file
@ -0,0 +1,83 @@
|
||||
<interface name="org.deepin.dde.Display1">
|
||||
<method name="ApplyChanges"></method>
|
||||
<method name="AssociateTouch">
|
||||
<arg type="s" direction="in"></arg>
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<method name="AssociateTouchByUUID">
|
||||
<arg type="s" direction="in"></arg>
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<method name="ChangeBrightness">
|
||||
<arg type="b" direction="in"></arg>
|
||||
</method>
|
||||
<method name="DeleteCustomMode">
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<method name="GetRealDisplayMode">
|
||||
<arg type="y" direction="out"></arg>
|
||||
</method>
|
||||
<method name="ListOutputNames">
|
||||
<arg type="as" direction="out"></arg>
|
||||
</method>
|
||||
<method name="ListOutputsCommonModes">
|
||||
<arg type="a(uqqd)" direction="out"></arg>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="ResolutionList"/>
|
||||
</method>
|
||||
<method name="ModifyConfigName">
|
||||
<arg type="s" direction="in"></arg>
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<method name="RefreshBrightness"></method>
|
||||
<method name="Reset"></method>
|
||||
<method name="ResetChanges"></method>
|
||||
<method name="Save"></method>
|
||||
<method name="SetAndSaveBrightness">
|
||||
<arg type="s" direction="in"></arg>
|
||||
<arg type="d" direction="in"></arg>
|
||||
</method>
|
||||
<method name="SetBrightness">
|
||||
<arg type="s" direction="in"></arg>
|
||||
<arg type="d" direction="in"></arg>
|
||||
</method>
|
||||
<method name="SetPrimary">
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<method name="SwitchMode">
|
||||
<arg type="y" direction="in"></arg>
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<method name="SetMethodAdjustCCT">
|
||||
<arg type="i" direction="in"></arg>
|
||||
</method>
|
||||
<method name="SetColorTemperature">
|
||||
<arg type="i" direction="in"></arg>
|
||||
</method>
|
||||
<property name="HasChanged" type="b" access="read"></property>
|
||||
<property name="DisplayMode" type="y" access="read"></property>
|
||||
<property name="ScreenWidth" type="q" access="read"></property>
|
||||
<property name="ScreenHeight" type="q" access="read"></property>
|
||||
<property name="Primary" type="s" access="read"></property>
|
||||
<property name="CurrentCustomId" type="s" access="read"></property>
|
||||
<property name="CustomIdList" type="as" access="read"></property>
|
||||
<property name="MaxBacklightBrightness" type="u" access="read"></property>
|
||||
<property name="PrimaryRect" type="(nnqq)" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="ScreenRect"/>
|
||||
</property>
|
||||
<property name="Monitors" type="ao" access="read"></property>
|
||||
<property name="Brightness" type="a{sd}" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="BrightnessMap"/>
|
||||
</property>
|
||||
<property name="Touchscreens" type="a(isss)" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="TouchscreenInfoList"/>
|
||||
</property>
|
||||
<property name="TouchscreensV2" type="a(issss)" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="TouchscreenInfoList_V2"/>
|
||||
</property>
|
||||
<property name="TouchMap" type="a{ss}" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="TouchscreenMap"/>
|
||||
</property>
|
||||
<property name="ColorTemperatureMode" type="i" access="read"></property>
|
||||
<property name="ColorTemperatureManual" type="i" access="read"></property>
|
||||
</interface>
|
||||
|
27
frame/dbusinterface/xml/org.deepin.dde.Gesture1.xml
Normal file
27
frame/dbusinterface/xml/org.deepin.dde.Gesture1.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<interface name="org.deepin.dde.Gesture1">
|
||||
<signal name="TouchSinglePressTimeout">
|
||||
<arg name="time" type="i"></arg>
|
||||
<arg name="scalex" type="d"></arg>
|
||||
<arg name="scaley" type="d"></arg>
|
||||
</signal>
|
||||
<signal name="TouchUpOrCancel">
|
||||
<arg name="scalex" type="d"></arg>
|
||||
<arg name="scaley" type="d"></arg>
|
||||
</signal>
|
||||
<signal name="TouchMoving">
|
||||
<arg name="scalex" type="d"></arg>
|
||||
<arg name="scaley" type="d"></arg>
|
||||
</signal>
|
||||
<signal name="TouchPressTimeout">
|
||||
<arg name="fingers" type="i"></arg>
|
||||
<arg name="time" type="i"></arg>
|
||||
<arg name="scalex" type="d"></arg>
|
||||
<arg name="scaley" type="d"></arg>
|
||||
</signal>
|
||||
<signal name="TouchEdgeEvent">
|
||||
<arg name="direction" type="s"></arg>
|
||||
<arg name="scalex" type="d"></arg>
|
||||
<arg name="scaley" type="d"></arg>
|
||||
</signal>
|
||||
</interface>
|
||||
|
21
frame/dbusinterface/xml/org.deepin.dde.Launcher1.xml
Normal file
21
frame/dbusinterface/xml/org.deepin.dde.Launcher1.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<interface name="org.deepin.dde.Launcher1">
|
||||
<property name="Visible" type="b" access="read"/>
|
||||
<signal name="Closed"></signal>
|
||||
<signal name="Shown"></signal>
|
||||
<signal name="VisibleChanged">
|
||||
<arg name="visible" type="b" direction="out"/>
|
||||
</signal>
|
||||
<method name="Exit"></method>
|
||||
<method name="Hide"></method>
|
||||
<method name="Show"></method>
|
||||
<method name="ShowByMode">
|
||||
<arg name="in0" type="x" direction="in"/>
|
||||
</method>
|
||||
<method name="UninstallApp">
|
||||
<arg name="appKey" type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="Toggle"></method>
|
||||
<method name="IsVisible">
|
||||
<arg type="b" direction="out"/>
|
||||
</method>
|
||||
</interface>
|
62
frame/dbusinterface/xml/org.deepin.dde.Timedate1.xml
Normal file
62
frame/dbusinterface/xml/org.deepin.dde.Timedate1.xml
Normal file
@ -0,0 +1,62 @@
|
||||
<interface name="org.deepin.dde.Timedate1">
|
||||
<signal name="TimeUpdate">
|
||||
</signal>
|
||||
<method name="AddUserTimezone">
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<method name="DeleteUserTimezone">
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<method name="GetZoneInfo">
|
||||
<arg type="s" direction="in"></arg>
|
||||
<arg type="(ssi(xxi))" direction="out"></arg>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value ="ZoneInfo"/>
|
||||
</method>
|
||||
<method name="GetZoneList">
|
||||
<arg type="as" direction="out"></arg>
|
||||
</method>
|
||||
<method name="GetSampleNTPServers">
|
||||
<arg type="as" direction="out"></arg>
|
||||
</method>
|
||||
<method name="SetDate">
|
||||
<arg type="i" direction="in"></arg>
|
||||
<arg type="i" direction="in"></arg>
|
||||
<arg type="i" direction="in"></arg>
|
||||
<arg type="i" direction="in"></arg>
|
||||
<arg type="i" direction="in"></arg>
|
||||
<arg type="i" direction="in"></arg>
|
||||
<arg type="i" direction="in"></arg>
|
||||
</method>
|
||||
<method name="SetLocalRTC">
|
||||
<arg type="b" direction="in"></arg>
|
||||
<arg type="b" direction="in"></arg>
|
||||
</method>
|
||||
<method name="SetNTP">
|
||||
<arg type="b" direction="in"></arg>
|
||||
</method>
|
||||
<method name="SetNTPServer">
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<method name="SetTime">
|
||||
<arg type="x" direction="in"></arg>
|
||||
<arg type="b" direction="in"></arg>
|
||||
</method>
|
||||
<method name="SetTimezone">
|
||||
<arg type="s" direction="in"></arg>
|
||||
</method>
|
||||
<property name="CanNTP" type="b" access="read"></property>
|
||||
<property name="NTP" type="b" access="read"></property>
|
||||
<property name="LocalRTC" type="b" access="read"></property>
|
||||
<property name="Timezone" type="s" access="read"></property>
|
||||
<property name="Use24HourFormat" type="b" access="readwrite"></property>
|
||||
<property name="DSTOffset" type="i" access="readwrite"></property>
|
||||
<property name="UserTimezones" type="as" access="read"></property>
|
||||
<property name="NTPServer" type="s" access="read"></property>
|
||||
<property name="WeekdayFormat" type="i" access="readwrite"></property>
|
||||
<property name="ShortDateFormat" type="i" access="readwrite"></property>
|
||||
<property name="LongDateFormat" type="i" access="readwrite"></property>
|
||||
<property name="ShortTimeFormat" type="i" access="readwrite"></property>
|
||||
<property name="LongTimeFormat" type="i" access="readwrite"></property>
|
||||
<property name="WeekBegins" type="i" access="readwrite"></property>
|
||||
</interface>
|
||||
|
63
frame/dbusinterface/xml/org.deepin.dde.XEventMonitor1.xml
Normal file
63
frame/dbusinterface/xml/org.deepin.dde.XEventMonitor1.xml
Normal file
@ -0,0 +1,63 @@
|
||||
<interface name="org.deepin.dde.XEventMonitor1">
|
||||
<method name="RegisterArea">
|
||||
<arg type="i" direction="in"/>
|
||||
<arg type="i" direction="in"/>
|
||||
<arg type="i" direction="in"/>
|
||||
<arg type="i" direction="in"/>
|
||||
<arg type="i" direction="in"/>
|
||||
<arg type="s" direction="out"/>
|
||||
</method>
|
||||
<method name="RegisterAreas">
|
||||
<arg type="a(iiii)" direction="in"/>
|
||||
<arg type="i" direction="in"/>
|
||||
<arg type="s" direction="out"/>
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="AreaList"/>
|
||||
</method>
|
||||
<method name="RegisterFullScreen">
|
||||
<arg type="s" direction="out"/>
|
||||
</method>
|
||||
<method name="UnregisterArea">
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="b" direction="out"/>
|
||||
</method>
|
||||
<signal name="CursorInto">
|
||||
<arg type="i"/>
|
||||
<arg type="i"/>
|
||||
<arg type="s"/>
|
||||
</signal>
|
||||
<signal name="CursorOut">
|
||||
<arg type="i"/>
|
||||
<arg type="i"/>
|
||||
<arg type="s"/>
|
||||
</signal>
|
||||
<signal name="CursorMove">
|
||||
<arg type="i"/>
|
||||
<arg type="i"/>
|
||||
<arg type="s"/>
|
||||
</signal>
|
||||
<signal name="ButtonPress">
|
||||
<arg type="i"/>
|
||||
<arg type="i"/>
|
||||
<arg type="i"/>
|
||||
<arg type="s"/>
|
||||
</signal>
|
||||
<signal name="ButtonRelease">
|
||||
<arg type="i"/>
|
||||
<arg type="i"/>
|
||||
<arg type="i"/>
|
||||
<arg type="s"/>
|
||||
</signal>
|
||||
<signal name="KeyPress">
|
||||
<arg type="s"/>
|
||||
<arg type="i"/>
|
||||
<arg type="i"/>
|
||||
<arg type="s"/>
|
||||
</signal>
|
||||
<signal name="KeyRelease">
|
||||
<arg type="s"/>
|
||||
<arg type="i"/>
|
||||
<arg type="i"/>
|
||||
<arg type="s"/>
|
||||
</signal>
|
||||
<signal name="CancelAllArea"/>
|
||||
</interface>
|
100
frame/dbusinterface/xml/org.deepin.dde.daemon.Dock1.xml
Normal file
100
frame/dbusinterface/xml/org.deepin.dde.daemon.Dock1.xml
Normal file
@ -0,0 +1,100 @@
|
||||
<interface name="org.deepin.dde.daemon.Dock1">
|
||||
<method name="ActivateWindow">
|
||||
<arg type="u" direction="in"/>
|
||||
</method>
|
||||
<method name="CancelPreviewWindow"/>
|
||||
<method name="CloseWindow">
|
||||
<arg type="u" direction="in"/>
|
||||
</method>
|
||||
<method name="GetDockedAppsDesktopFiles">
|
||||
<arg type="as" direction="out"/>
|
||||
</method>
|
||||
<method name="GetEntryIDs">
|
||||
<arg type="as" direction="out"/>
|
||||
</method>
|
||||
<method name="GetPluginSettings">
|
||||
<arg type="s" direction="out"/>
|
||||
</method>
|
||||
<method name="IsDocked">
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="b" direction="out"/>
|
||||
</method>
|
||||
<method name="IsOnDock">
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="b" direction="out"/>
|
||||
</method>
|
||||
<method name="MakeWindowAbove">
|
||||
<arg type="u" direction="in"/>
|
||||
</method>
|
||||
<method name="MaximizeWindow">
|
||||
<arg type="u" direction="in"/>
|
||||
</method>
|
||||
<method name="MinimizeWindow">
|
||||
<arg type="u" direction="in"/>
|
||||
</method>
|
||||
<method name="MoveEntry">
|
||||
<arg type="i" direction="in"/>
|
||||
<arg type="i" direction="in"/>
|
||||
</method>
|
||||
<method name="MoveWindow">
|
||||
<arg type="u" direction="in"/>
|
||||
</method>
|
||||
<method name="PreviewWindow">
|
||||
<arg type="u" direction="in"/>
|
||||
</method>
|
||||
<method name="QueryWindowIdentifyMethod">
|
||||
<arg type="u" direction="in"/>
|
||||
<arg type="s" direction="out"/>
|
||||
</method>
|
||||
<method name="RemovePluginSettings">
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="as" direction="in"/>
|
||||
</method>
|
||||
<method name="RequestDock">
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="i" direction="in"/>
|
||||
<arg type="b" direction="out"/>
|
||||
</method>
|
||||
<method name="RequestUndock">
|
||||
<arg type="s" direction="in"/>
|
||||
<arg type="b" direction="out"/>
|
||||
</method>
|
||||
<method name="SetFrontendWindowRect">
|
||||
<arg type="i" direction="in"/>
|
||||
<arg type="i" direction="in"/>
|
||||
<arg type="u" direction="in"/>
|
||||
<arg type="u" direction="in"/>
|
||||
</method>
|
||||
<method name="SetPluginSettings">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<method name="MergePluginSettings">
|
||||
<arg type="s" direction="in"/>
|
||||
</method>
|
||||
<signal name="ServiceRestarted"/>
|
||||
<signal name="EntryAdded">
|
||||
<arg type="o"/>
|
||||
<arg type="i"/>
|
||||
</signal>
|
||||
<signal name="EntryRemoved">
|
||||
<arg type="s"/>
|
||||
</signal>
|
||||
<signal name="PluginSettingsSynced"/>
|
||||
<signal name="DockAppSettingsSynced"/>
|
||||
<property name="Entries" type="ao" access="read"/>
|
||||
<property name="HideMode" type="i" access="readwrite"/>
|
||||
<property name="DisplayMode" type="i" access="readwrite"/>
|
||||
<property name="Position" type="i" access="readwrite"/>
|
||||
<property name="IconSize" type="u" access="readwrite"/>
|
||||
<property name="WindowSize" type="u" access="readwrite"/>
|
||||
<property name="WindowSizeEfficient" type="u" access="readwrite"/>
|
||||
<property name="WindowSizeFashion" type="u" access="readwrite"/>
|
||||
<property name="ShowTimeout" type="u" access="readwrite"/>
|
||||
<property name="HideTimeout" type="u" access="readwrite"/>
|
||||
<property name="DockedApps" type="as" access="read"/>
|
||||
<property name="HideState" type="i" access="read"/>
|
||||
<property name="FrontendWindowRect" type="(iiuu)" access="read">
|
||||
<annotation name="org.qtproject.QtDBus.QtTypeName" value="DockRect"/>
|
||||
</property>
|
||||
<property name="Opacity" type="d" access="readwrite"/>
|
||||
</interface>
|
17
frame/dbusinterface/xml/org.freedesktop.FileManager.xml
Normal file
17
frame/dbusinterface/xml/org.freedesktop.FileManager.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<interface name='org.freedesktop.FileManager1'>
|
||||
<method name='ShowFolders'>
|
||||
<arg type='as' name='URIs' direction='in'/>
|
||||
<arg type='s' name='StartupId' direction='in'/>
|
||||
</method>
|
||||
<method name='ShowItems'>
|
||||
<arg type='as' name='URIs' direction='in'/>
|
||||
<arg type='s' name='StartupId' direction='in'/>
|
||||
</method>
|
||||
<method name='ShowItemProperties'>
|
||||
<arg type='as' name='URIs' direction='in'/>
|
||||
<arg type='s' name='StartupId' direction='in'/>
|
||||
</method>
|
||||
<method name='Trash'>
|
||||
<arg type='as' name='URIs' direction='in'/>
|
||||
</method>
|
||||
</interface>
|
61
frame/dbusinterface/xml/org.kde.StatusNotifierItem.xml
Normal file
61
frame/dbusinterface/xml/org.kde.StatusNotifierItem.xml
Normal file
@ -0,0 +1,61 @@
|
||||
<interface name="org.kde.StatusNotifierItem">
|
||||
<property access="read" type="s" name="Category"/>
|
||||
<property access="read" type="s" name="Id"/>
|
||||
<property access="read" type="s" name="Title"/>
|
||||
<property access="read" type="s" name="Status"/>
|
||||
<property access="read" type="i" name="WindowId"/>
|
||||
<!-- An additional path to add to the theme search path to find the icons specified above. -->
|
||||
<property access="read" type="s" name="IconThemePath"/>
|
||||
<property access="read" type="o" name="Menu"/>
|
||||
<property access="read" type="b" name="ItemIsMenu"/>
|
||||
<!-- main icon -->
|
||||
<!-- names are preferred over pixmaps -->
|
||||
<property access="read" type="s" name="IconName"/>
|
||||
<!--struct containing width, height and image data-->
|
||||
<property access="read" type="a(iiay)" name="IconPixmap">
|
||||
<annotation value="DBusImageList" name="org.qtproject.QtDBus.QtTypeName"/>
|
||||
</property>
|
||||
<property access="read" type="s" name="OverlayIconName"/>
|
||||
<property access="read" type="a(iiay)" name="OverlayIconPixmap">
|
||||
<annotation value="DBusImageList" name="org.qtproject.QtDBus.QtTypeName"/>
|
||||
</property>
|
||||
<!-- Requesting attention icon -->
|
||||
<property access="read" type="s" name="AttentionIconName"/>
|
||||
<!--same definition as image-->
|
||||
<property access="read" type="a(iiay)" name="AttentionIconPixmap">
|
||||
<annotation value="DBusImageList" name="org.qtproject.QtDBus.QtTypeName"/>
|
||||
</property>
|
||||
<property access="read" type="s" name="AttentionMovieName"/>
|
||||
<!-- tooltip data -->
|
||||
<!--(iiay) is an image-->
|
||||
<property access="read" type="(sa(iiay)ss)" name="ToolTip">
|
||||
<annotation value="DBusToolTip" name="org.qtproject.QtDBus.QtTypeName"/>
|
||||
</property>
|
||||
<!-- interaction: the systemtray wants the application to do something -->
|
||||
<method name="ContextMenu">
|
||||
<!-- we're passing the coordinates of the icon, so the app knows where to put the popup window -->
|
||||
<arg direction="in" type="i" name="x"/>
|
||||
<arg direction="in" type="i" name="y"/>
|
||||
</method>
|
||||
<method name="Activate">
|
||||
<arg direction="in" type="i" name="x"/>
|
||||
<arg direction="in" type="i" name="y"/>
|
||||
</method>
|
||||
<method name="SecondaryActivate">
|
||||
<arg direction="in" type="i" name="x"/>
|
||||
<arg direction="in" type="i" name="y"/>
|
||||
</method>
|
||||
<method name="Scroll">
|
||||
<arg direction="in" type="i" name="delta"/>
|
||||
<arg direction="in" type="s" name="orientation"/>
|
||||
</method>
|
||||
<!-- Signals: the client wants to change something in the status-->
|
||||
<signal name="NewTitle"/>
|
||||
<signal name="NewIcon"/>
|
||||
<signal name="NewAttentionIcon"/>
|
||||
<signal name="NewOverlayIcon"/>
|
||||
<signal name="NewToolTip"/>
|
||||
<signal name="NewStatus">
|
||||
<arg type="s" name="status"/>
|
||||
</signal>
|
||||
</interface>
|
@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
// Copyright (C) 2018 ~ 2020 Uniontech Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
@ -52,6 +53,17 @@ QScreen *DisplayManager::screen(const QString &screenName) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QScreen *DisplayManager::screenAt(const QPoint &pos) const
|
||||
{
|
||||
for (QScreen *screen : m_screens) {
|
||||
QRect screenGeometry = screen->geometry();
|
||||
if (screenGeometry.contains(pos))
|
||||
return screen;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DisplayManager::primary
|
||||
* @return 主屏幕名称
|
||||
@ -128,6 +140,8 @@ bool DisplayManager::isCopyMode()
|
||||
*/
|
||||
void DisplayManager::updateScreenDockInfo()
|
||||
{
|
||||
// TODO 目前仅仅支持双屏,如果超过双屏,会出现异常,这里可以考虑做成通用的处理规则
|
||||
|
||||
// 先清除原先的数据,然后再更新
|
||||
m_screenPositionMap.clear();
|
||||
|
||||
@ -163,7 +177,7 @@ void DisplayManager::updateScreenDockInfo()
|
||||
return;
|
||||
}
|
||||
|
||||
// 适配任意多个屏幕的情况
|
||||
// 适配多个屏幕的情况
|
||||
for(auto s : m_screens) {
|
||||
QList<QScreen *> otherScreens = m_screens;
|
||||
otherScreens.removeAll(s);
|
||||
@ -264,7 +278,6 @@ void DisplayManager::screenCountChanged()
|
||||
for (auto s : to_remove_list) {
|
||||
disconnect(s);
|
||||
m_screens.removeOne(s);
|
||||
Q_EMIT screenRemoved(s);
|
||||
}
|
||||
|
||||
// 创建关联
|
||||
@ -287,7 +300,6 @@ void DisplayManager::screenCountChanged()
|
||||
connect(s, &QScreen::refreshRateChanged, this, &DisplayManager::dockInfoChanged);
|
||||
|
||||
m_screens.append(s);
|
||||
Q_EMIT screenAdded(s);
|
||||
}
|
||||
|
||||
// 屏幕数量发生变化,应该刷新一下任务栏的显示
|
||||
|
@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
// Copyright (C) 2018 ~ 2020 Uniontech Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
@ -9,20 +10,14 @@
|
||||
|
||||
#include "singleton.h"
|
||||
#include "constants.h"
|
||||
#include "org_deepin_dde_display1.h"
|
||||
|
||||
using DisplayInter = org::deepin::dde::Display1;
|
||||
using namespace Dock;
|
||||
|
||||
class QScreen;
|
||||
class QTimer;
|
||||
class QGSettings;
|
||||
/**
|
||||
* @brief The DisplayManager class
|
||||
* @note 1、对QScreen信息的获取和监听进行了封装,不应该在此程序的其他处再出现类似的代码,而是从当前实例中进行提供
|
||||
* @note 2、对显示相关数据的读写尽可能通过Qt库进行,而不是通过一些DBus服务,
|
||||
* @note 目的一是为了解耦
|
||||
* @note 二是DBus服务的稳定性较低,有部分问题存在
|
||||
* @note 三是DBus服务(特指Display相关)刚开始的目的是为了做一些架构和特殊机器的兼容适配工作,因为qt适配开展较慢,所以才有了DBus服务的存在,目前qt已足够稳定,我们不应该再大量使用后端提供的Display服务
|
||||
*/
|
||||
class DisplayManager: public QObject, public Singleton<DisplayManager>
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -33,6 +28,7 @@ public:
|
||||
|
||||
QList<QScreen *> screens() const;
|
||||
QScreen *screen(const QString &screenName) const;
|
||||
QScreen *screenAt(const QPoint &pos) const;
|
||||
QString primary() const;
|
||||
int screenRawWidth() const;
|
||||
int screenRawHeight() const;
|
||||
@ -48,10 +44,8 @@ private Q_SLOTS:
|
||||
void onGSettingsChanged(const QString &key);
|
||||
|
||||
Q_SIGNALS:
|
||||
void primaryScreenChanged(QScreen *s);
|
||||
void primaryScreenChanged();
|
||||
void screenInfoChanged(); // 屏幕信息发生变化,需要调整任务栏显示,只需要这一个信号,其他的都不要,简化流程
|
||||
void screenAdded(QScreen *s);
|
||||
void screenRemoved(QScreen *s);
|
||||
|
||||
private:
|
||||
QList<QScreen *> m_screens;
|
||||
|
152
frame/drag/quickdragcore.cpp
Normal file
152
frame/drag/quickdragcore.cpp
Normal file
@ -0,0 +1,152 @@
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "quickdragcore.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
#include <QPainter>
|
||||
#include <QPainterPath>
|
||||
#include <QBitmap>
|
||||
#include <QEvent>
|
||||
#include <QDebug>
|
||||
#include <QCoreApplication>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QGuiApplication>
|
||||
|
||||
QuickPluginMimeData::QuickPluginMimeData(PluginsItemInterface *item, QDrag *drag)
|
||||
: QMimeData()
|
||||
, m_item(item)
|
||||
, m_drag(drag)
|
||||
{
|
||||
}
|
||||
|
||||
QuickPluginMimeData::~QuickPluginMimeData()
|
||||
{
|
||||
}
|
||||
|
||||
PluginsItemInterface *QuickPluginMimeData::pluginItemInterface() const
|
||||
{
|
||||
return m_item;
|
||||
}
|
||||
|
||||
QDrag *QuickPluginMimeData::drag() const
|
||||
{
|
||||
return m_drag;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 拖动图标的窗口,可以根据实际情况设置动态图标
|
||||
* @param dragSource
|
||||
*/
|
||||
QuickIconDrag::QuickIconDrag(QObject *dragSource, const QPixmap &pixmap)
|
||||
: QDrag(dragSource)
|
||||
, m_imageWidget(new QWidget)
|
||||
, m_timer(new QTimer(this))
|
||||
, m_sourcePixmap(pixmap)
|
||||
, m_hotPoint(QPoint(0, 0))
|
||||
{
|
||||
m_timer->setInterval(10);
|
||||
connect(m_timer, &QTimer::timeout, this, &QuickIconDrag::onDragMove);
|
||||
m_timer->start();
|
||||
|
||||
m_imageWidget->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool | Qt::WindowDoesNotAcceptFocus);
|
||||
m_imageWidget->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
m_imageWidget->installEventFilter(this);
|
||||
useSourcePixmap();
|
||||
}
|
||||
|
||||
QuickIconDrag::~QuickIconDrag()
|
||||
{
|
||||
m_imageWidget->deleteLater();
|
||||
}
|
||||
|
||||
void QuickIconDrag::updatePixmap(QPixmap pixmap)
|
||||
{
|
||||
if (m_sourcePixmap == pixmap)
|
||||
return;
|
||||
|
||||
m_pixmap = pixmap;
|
||||
m_useSourcePixmap = false;
|
||||
m_imageWidget->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool | Qt::WindowDoesNotAcceptFocus | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
|
||||
m_imageWidget->setFixedSize(pixmap.size());
|
||||
m_imageWidget->show();
|
||||
m_imageWidget->raise();
|
||||
m_imageWidget->update();
|
||||
}
|
||||
|
||||
void QuickIconDrag::useSourcePixmap()
|
||||
{
|
||||
m_useSourcePixmap = true;
|
||||
m_imageWidget->setFixedSize(m_sourcePixmap.size() / qApp->devicePixelRatio());
|
||||
m_imageWidget->show();
|
||||
m_imageWidget->raise();
|
||||
m_imageWidget->update();
|
||||
}
|
||||
|
||||
void QuickIconDrag::setDragHotPot(QPoint point)
|
||||
{
|
||||
m_hotPoint = point;
|
||||
m_imageWidget->update();
|
||||
}
|
||||
|
||||
bool QuickIconDrag::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (watched == m_imageWidget) {
|
||||
switch (event->type()) {
|
||||
case QEvent::Paint: {
|
||||
QPixmap pixmap = m_useSourcePixmap ? m_sourcePixmap : m_pixmap;
|
||||
QPainter painter(m_imageWidget);
|
||||
painter.drawPixmap(QPoint(0, 0), pixmap);
|
||||
|
||||
QPixmap pixmapMask(m_imageWidget->size());
|
||||
pixmapMask.fill(Qt::transparent);
|
||||
QPainter painterMask(&pixmapMask);
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(pixmapMask.rect(), 8, 8);
|
||||
painterMask.fillPath(path, Qt::white);
|
||||
painterMask.setRenderHint(QPainter::Antialiasing, true);
|
||||
painterMask.setCompositionMode(QPainter::CompositionMode_Source);
|
||||
painterMask.drawPixmap(0, 0, pixmap);
|
||||
painterMask.setCompositionMode(QPainter::CompositionMode_DestinationIn);
|
||||
QColor maskColor(Qt::black);
|
||||
maskColor.setAlpha(150);
|
||||
painterMask.fillRect(pixmapMask.rect(), maskColor);
|
||||
painterMask.end();
|
||||
|
||||
// 绘制圆角
|
||||
QBitmap radiusMask(m_imageWidget->size());
|
||||
radiusMask.fill();
|
||||
QPainter radiusPainter(&radiusMask);
|
||||
radiusPainter.setPen(Qt::NoPen);
|
||||
radiusPainter.setBrush(Qt::black);
|
||||
radiusPainter.setRenderHint(QPainter::Antialiasing);
|
||||
radiusPainter.drawRoundedRect(radiusMask.rect(), 8, 8);
|
||||
m_imageWidget->setMask(radiusMask);
|
||||
|
||||
painter.end();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return QDrag::eventFilter(watched, event);
|
||||
}
|
||||
|
||||
QPoint QuickIconDrag::currentPoint() const
|
||||
{
|
||||
QPoint mousePos = QCursor::pos();
|
||||
if (m_useSourcePixmap)
|
||||
return mousePos - m_hotPoint;
|
||||
|
||||
QSize pixmapSize = m_pixmap.size();
|
||||
return (mousePos - QPoint(pixmapSize.width() * (m_hotPoint.x() / m_sourcePixmap.width())
|
||||
, pixmapSize.height() * (m_hotPoint.y() / m_sourcePixmap.height())));
|
||||
}
|
||||
|
||||
void QuickIconDrag::onDragMove()
|
||||
{
|
||||
m_imageWidget->move(currentPoint());
|
||||
}
|
57
frame/drag/quickdragcore.h
Normal file
57
frame/drag/quickdragcore.h
Normal file
@ -0,0 +1,57 @@
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef QUICKDRAGCORE_H
|
||||
#define QUICKDRAGCORE_H
|
||||
|
||||
#include <QMimeData>
|
||||
#include <QDrag>
|
||||
#include <QPixmap>
|
||||
|
||||
class PluginsItemInterface;
|
||||
class QTimer;
|
||||
|
||||
class QuickPluginMimeData : public QMimeData
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QuickPluginMimeData(PluginsItemInterface *item, QDrag *drag);
|
||||
~QuickPluginMimeData();
|
||||
PluginsItemInterface *pluginItemInterface() const;
|
||||
QDrag *drag() const;
|
||||
|
||||
private:
|
||||
PluginsItemInterface *m_item;
|
||||
QDrag *m_drag;
|
||||
};
|
||||
|
||||
class QuickIconDrag : public QDrag
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QuickIconDrag(QObject *dragSource, const QPixmap &pixmap);
|
||||
~QuickIconDrag();
|
||||
void updatePixmap(QPixmap pixmap);
|
||||
void useSourcePixmap();
|
||||
void setDragHotPot(QPoint point);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||
QPoint currentPoint() const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onDragMove();
|
||||
|
||||
private:
|
||||
QWidget *m_imageWidget;
|
||||
QTimer *m_timer;
|
||||
QPixmap m_sourcePixmap;
|
||||
QPixmap m_pixmap;
|
||||
QPoint m_hotPoint;
|
||||
bool m_useSourcePixmap;
|
||||
};
|
||||
|
||||
#endif // QUICKDRAGCORE_H
|
@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: 2011 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
@ -7,6 +8,7 @@
|
||||
#include "xcb_misc.h"
|
||||
#include "appswingeffectbuilder.h"
|
||||
#include "utils.h"
|
||||
#include "screenspliter.h"
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
@ -31,18 +33,17 @@ DCORE_USE_NAMESPACE
|
||||
|
||||
QPoint AppItem::MousePressPos;
|
||||
|
||||
AppItem::AppItem(const QGSettings *appSettings, const QGSettings *activeAppSettings, const QGSettings *dockedAppSettings, const QDBusObjectPath &entry, QWidget *parent)
|
||||
AppItem::AppItem(DockInter *dockInter, const QGSettings *appSettings, const QGSettings *activeAppSettings, const QGSettings *dockedAppSettings, const QDBusObjectPath &entry, QWidget *parent)
|
||||
: DockItem(parent)
|
||||
, m_appSettings(appSettings)
|
||||
, m_activeAppSettings(activeAppSettings)
|
||||
, m_dockedAppSettings(dockedAppSettings)
|
||||
, m_appPreviewTips(nullptr)
|
||||
, m_itemEntryInter(new DockEntryInter("com.deepin.dde.daemon.Dock", entry.path(), QDBusConnection::sessionBus(), this))
|
||||
, m_itemEntryInter(new DockEntryInter(dockServiceName(), entry.path(), QDBusConnection::sessionBus(), this))
|
||||
, m_swingEffectView(nullptr)
|
||||
, m_itemAnimation(nullptr)
|
||||
, m_wmHelper(DWindowManagerHelper::instance())
|
||||
, m_drag(nullptr)
|
||||
, m_dragging(false)
|
||||
, m_retryTimes(0)
|
||||
, m_iconValid(true)
|
||||
, m_lastclickTimes(0)
|
||||
@ -51,6 +52,9 @@ AppItem::AppItem(const QGSettings *appSettings, const QGSettings *activeAppSetti
|
||||
, m_retryObtainIconTimer(new QTimer(this))
|
||||
, m_refershIconTimer(new QTimer(this))
|
||||
, m_themeType(DGuiApplicationHelper::instance()->themeType())
|
||||
, m_createMSecs(QDateTime::currentMSecsSinceEpoch())
|
||||
, m_screenSpliter(ScreenSpliterFactory::createScreenSpliter(this, m_itemEntryInter))
|
||||
, m_dockInter(dockInter)
|
||||
{
|
||||
QHBoxLayout *centralLayout = new QHBoxLayout;
|
||||
centralLayout->setMargin(0);
|
||||
@ -62,7 +66,6 @@ AppItem::AppItem(const QGSettings *appSettings, const QGSettings *activeAppSetti
|
||||
|
||||
m_id = m_itemEntryInter->id();
|
||||
m_active = m_itemEntryInter->isActive();
|
||||
m_currentWindowId = m_itemEntryInter->currentWindow();
|
||||
|
||||
m_updateIconGeometryTimer->setInterval(500);
|
||||
m_updateIconGeometryTimer->setSingleShot(true);
|
||||
@ -77,13 +80,13 @@ AppItem::AppItem(const QGSettings *appSettings, const QGSettings *activeAppSetti
|
||||
connect(m_itemEntryInter, &DockEntryInter::IsActiveChanged, this, static_cast<void (AppItem::*)()>(&AppItem::update));
|
||||
connect(m_itemEntryInter, &DockEntryInter::WindowInfosChanged, this, &AppItem::updateWindowInfos, Qt::QueuedConnection);
|
||||
connect(m_itemEntryInter, &DockEntryInter::IconChanged, this, &AppItem::refreshIcon);
|
||||
|
||||
connect(m_retryObtainIconTimer, &QTimer::timeout, this, &AppItem::refreshIcon, Qt::QueuedConnection);
|
||||
connect(m_itemEntryInter, &DockEntryInter::ModeChanged, this, &AppItem::modeChanged);
|
||||
connect(m_updateIconGeometryTimer, &QTimer::timeout, this, &AppItem::updateWindowIconGeometries, Qt::QueuedConnection);
|
||||
connect(m_retryObtainIconTimer, &QTimer::timeout, this, &AppItem::refreshIcon, Qt::QueuedConnection);
|
||||
|
||||
connect(this, &AppItem::requestUpdateEntryGeometries, this, &AppItem::updateWindowIconGeometries);
|
||||
|
||||
updateWindowInfos(m_itemEntryInter->windowInfos());
|
||||
refreshIcon();
|
||||
|
||||
if (m_appSettings)
|
||||
connect(m_appSettings, &QGSettings::changed, this, &AppItem::onGSettingsChanged);
|
||||
@ -111,6 +114,11 @@ const QString AppItem::appId() const
|
||||
return m_id;
|
||||
}
|
||||
|
||||
QString AppItem::name() const
|
||||
{
|
||||
return m_itemEntryInter->name();
|
||||
}
|
||||
|
||||
bool AppItem::isValid() const
|
||||
{
|
||||
return m_itemEntryInter->isValid() && !m_itemEntryInter->id().isEmpty();
|
||||
@ -121,14 +129,12 @@ bool AppItem::isValid() const
|
||||
// window behaviors like minimization.
|
||||
void AppItem::updateWindowIconGeometries()
|
||||
{
|
||||
// wayland没做处理
|
||||
if (Utils::IS_WAYLAND_DISPLAY)
|
||||
return;
|
||||
|
||||
const QRect r(mapToGlobal(QPoint(0, 0)),
|
||||
mapToGlobal(QPoint(width(), height())));
|
||||
|
||||
if (Utils::IS_WAYLAND_DISPLAY){
|
||||
Q_EMIT requestUpdateItemMinimizedGeometry(r);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!QX11Info::connection()) {
|
||||
qWarning() << "QX11Info::connection() is 0x0";
|
||||
return;
|
||||
@ -164,11 +170,72 @@ void AppItem::setDockInfo(Dock::Position dockPosition, const QRect &dockGeometry
|
||||
}
|
||||
}
|
||||
|
||||
void AppItem::setDraging(bool drag)
|
||||
{
|
||||
if (drag == isDragging())
|
||||
return;
|
||||
|
||||
DockItem::setDraging(drag);
|
||||
if (!drag)
|
||||
m_screenSpliter->releaseSplit();
|
||||
}
|
||||
|
||||
void AppItem::startSplit(const QRect &rect)
|
||||
{
|
||||
m_screenSpliter->startSplit(rect);
|
||||
}
|
||||
|
||||
bool AppItem::supportSplitWindow()
|
||||
{
|
||||
return m_screenSpliter->suportSplitScreen();
|
||||
}
|
||||
|
||||
bool AppItem::splitWindowOnScreen(ScreenSpliter::SplitDirection direction)
|
||||
{
|
||||
return m_screenSpliter->split(direction);
|
||||
}
|
||||
|
||||
int AppItem::mode() const
|
||||
{
|
||||
return m_itemEntryInter->mode();
|
||||
}
|
||||
|
||||
|
||||
DockEntryInter *AppItem::itemEntryInter() const
|
||||
{
|
||||
return m_itemEntryInter;
|
||||
}
|
||||
|
||||
QString AppItem::accessibleName()
|
||||
{
|
||||
return m_itemEntryInter->name();
|
||||
}
|
||||
|
||||
void AppItem::requestDock()
|
||||
{
|
||||
m_itemEntryInter->RequestDock();
|
||||
}
|
||||
|
||||
bool AppItem::isDocked() const
|
||||
{
|
||||
return m_itemEntryInter->isDocked();
|
||||
}
|
||||
|
||||
qint64 AppItem::appOpenMSecs() const
|
||||
{
|
||||
return m_createMSecs;
|
||||
}
|
||||
|
||||
void AppItem::updateMSecs()
|
||||
{
|
||||
m_createMSecs = QDateTime::currentMSecsSinceEpoch();
|
||||
}
|
||||
|
||||
const WindowInfoMap &AppItem::windowsMap() const
|
||||
{
|
||||
return m_windowInfos;
|
||||
}
|
||||
|
||||
void AppItem::moveEvent(QMoveEvent *e)
|
||||
{
|
||||
DockItem::moveEvent(e);
|
||||
@ -183,10 +250,8 @@ void AppItem::moveEvent(QMoveEvent *e)
|
||||
void AppItem::paintEvent(QPaintEvent *e)
|
||||
{
|
||||
DockItem::paintEvent(e);
|
||||
if (m_draging)
|
||||
return;
|
||||
|
||||
if (m_dragging || (m_swingEffectView != nullptr && DockDisplayMode != Fashion))
|
||||
if (isDragging() || (m_swingEffectView != nullptr && DockDisplayMode != Fashion))
|
||||
return;
|
||||
|
||||
QPainter painter(this);
|
||||
@ -207,13 +272,21 @@ void AppItem::paintEvent(QPaintEvent *e)
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(backgroundRect, 8, 8);
|
||||
|
||||
if (m_active) {
|
||||
painter.fillPath(path, QColor(0, 0, 0, 255 * 0.8));
|
||||
} else if (!m_windowInfos.isEmpty()) {
|
||||
if (hasAttention())
|
||||
painter.fillPath(path, QColor(241, 138, 46, 255 * .8));
|
||||
else
|
||||
painter.fillPath(path, QColor(0, 0, 0, 255 * 0.3));
|
||||
// 在没有开启窗口多开的情况下,显示背景色
|
||||
if (!m_dockInter->showMultiWindow()) {
|
||||
if (m_active) {
|
||||
QColor color = Qt::black;
|
||||
color.setAlpha(255 * 0.8);
|
||||
painter.fillPath(path, color);
|
||||
} else if (!m_windowInfos.isEmpty()) {
|
||||
if (hasAttention()) {
|
||||
painter.fillPath(path, QColor(241, 138, 46, 255 * .8));
|
||||
} else {
|
||||
QColor color = Qt::black;
|
||||
color.setAlpha(255 * 0.3);
|
||||
painter.fillPath(path, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!m_windowInfos.isEmpty()) {
|
||||
@ -307,11 +380,16 @@ void AppItem::mouseReleaseEvent(QMouseEvent *e)
|
||||
qDebug() << "app item clicked, name:" << m_itemEntryInter->name()
|
||||
<< "id:" << m_itemEntryInter->id() << "my-id:" << m_id << "icon:" << m_itemEntryInter->icon();
|
||||
|
||||
m_itemEntryInter->Activate(QX11Info::getTimestamp());
|
||||
|
||||
// play launch effect
|
||||
if (m_windowInfos.isEmpty() && DGuiApplicationHelper::isSpecialEffectsEnvironment())
|
||||
playSwingEffect();
|
||||
if (m_dockInter->showMultiWindow()) {
|
||||
// 如果开启了多窗口显示,则直接新建一个窗口
|
||||
m_itemEntryInter->NewInstance(QX11Info::getTimestamp());
|
||||
} else {
|
||||
// 如果没有开启新窗口显示,则
|
||||
m_itemEntryInter->Activate(QX11Info::getTimestamp());
|
||||
// play launch effect
|
||||
if (m_windowInfos.isEmpty() && DGuiApplicationHelper::isSpecialEffectsEnvironment())
|
||||
playSwingEffect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,6 +412,10 @@ void AppItem::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
e->accept();
|
||||
|
||||
// handle preview
|
||||
// if (e->buttons() == Qt::NoButton)
|
||||
// return showPreview();
|
||||
|
||||
// handle drag
|
||||
if (e->buttons() != Qt::LeftButton)
|
||||
return;
|
||||
@ -341,6 +423,10 @@ void AppItem::mouseMoveEvent(QMouseEvent *e)
|
||||
const QPoint pos = e->pos();
|
||||
if (!rect().contains(pos))
|
||||
return;
|
||||
|
||||
const QPoint distance = pos - MousePressPos;
|
||||
if (distance.manhattanLength() > APP_DRAG_THRESHOLD)
|
||||
return startDrag();
|
||||
}
|
||||
|
||||
void AppItem::wheelEvent(QWheelEvent *e)
|
||||
@ -449,7 +535,7 @@ QWidget *AppItem::popupTips()
|
||||
if (checkGSettingsControl())
|
||||
return nullptr;
|
||||
|
||||
if (m_dragging)
|
||||
if (isDragging())
|
||||
return nullptr;
|
||||
|
||||
static TipsWidget appNameTips(topLevelWidget());
|
||||
@ -457,8 +543,9 @@ QWidget *AppItem::popupTips()
|
||||
appNameTips.setObjectName(m_itemEntryInter->name());
|
||||
|
||||
if (!m_windowInfos.isEmpty()) {
|
||||
Q_ASSERT(m_windowInfos.contains(m_currentWindowId));
|
||||
appNameTips.setText(m_windowInfos[m_currentWindowId].title.simplified());
|
||||
const quint32 currentWindow = m_itemEntryInter->currentWindow();
|
||||
Q_ASSERT(m_windowInfos.contains(currentWindow));
|
||||
appNameTips.setText(m_windowInfos[currentWindow].title.simplified());
|
||||
} else {
|
||||
appNameTips.setText(m_itemEntryInter->name().simplified());
|
||||
}
|
||||
@ -466,6 +553,57 @@ QWidget *AppItem::popupTips()
|
||||
return &appNameTips;
|
||||
}
|
||||
|
||||
void AppItem::startDrag()
|
||||
{
|
||||
// 拖拽实现放到mainpanelcontrol
|
||||
|
||||
/*
|
||||
if (!acceptDrops())
|
||||
return;
|
||||
|
||||
if (checkGSettingsControl()) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_dragging = true;
|
||||
update();
|
||||
|
||||
const QPixmap &dragPix = m_appIcon;
|
||||
|
||||
m_drag = new AppDrag(this);
|
||||
m_drag->setMimeData(new QMimeData);
|
||||
|
||||
// handle drag finished here
|
||||
connect(m_drag->appDragWidget(), &AppDragWidget::destroyed, this, [ = ] {
|
||||
m_dragging = false;
|
||||
m_drag.clear();
|
||||
setVisible(true);
|
||||
update();
|
||||
});
|
||||
|
||||
if (m_wmHelper->hasComposite()) {
|
||||
m_drag->setPixmap(dragPix);
|
||||
m_drag->appDragWidget()->setOriginPos(mapToGlobal(appIconPosition()));
|
||||
emit dragStarted();
|
||||
m_drag->exec(Qt::MoveAction);
|
||||
} else {
|
||||
m_drag->QDrag::setPixmap(dragPix);
|
||||
m_drag->setHotSpot(dragPix.rect().center() / dragPix.devicePixelRatioF());
|
||||
emit dragStarted();
|
||||
m_drag->QDrag::exec(Qt::MoveAction);
|
||||
}
|
||||
|
||||
// MainPanel will put this item to Item-Container when received this signal(MainPanel::itemDropped)
|
||||
//emit itemDropped(m_drag->target());
|
||||
|
||||
if (!m_wmHelper->hasComposite()) {
|
||||
if (!m_drag->target()) {
|
||||
m_itemEntryInter->RequestUndock();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
bool AppItem::hasAttention() const
|
||||
{
|
||||
auto it = std::find_if(m_windowInfos.constBegin(), m_windowInfos.constEnd(), [ = ] (const auto &info) {
|
||||
@ -488,8 +626,11 @@ QPoint AppItem::appIconPosition() const
|
||||
|
||||
void AppItem::updateWindowInfos(const WindowInfoMap &info)
|
||||
{
|
||||
// 如果是打开第一个窗口,则更新窗口时间
|
||||
if (m_windowInfos.isEmpty() && !info.isEmpty())
|
||||
updateMSecs();
|
||||
|
||||
m_windowInfos = info;
|
||||
m_currentWindowId = info.firstKey();
|
||||
if (m_appPreviewTips)
|
||||
m_appPreviewTips->setWindowInfos(m_windowInfos, m_itemEntryInter->GetAllowedCloseWindows().value());
|
||||
m_updateIconGeometryTimer->start();
|
||||
@ -503,6 +644,9 @@ void AppItem::updateWindowInfos(const WindowInfoMap &info)
|
||||
}
|
||||
|
||||
update();
|
||||
|
||||
// 通知外面窗体数量发生变化,需要更新多开窗口的信息
|
||||
Q_EMIT windowCountChanged();
|
||||
}
|
||||
|
||||
void AppItem::refreshIcon()
|
||||
@ -540,7 +684,9 @@ void AppItem::refreshIcon()
|
||||
update();
|
||||
|
||||
return;
|
||||
} else if (m_retryTimes > 0) {
|
||||
}
|
||||
|
||||
if (m_retryTimes > 0) {
|
||||
// reset times
|
||||
m_retryTimes = 0;
|
||||
}
|
||||
@ -578,7 +724,6 @@ void AppItem::showPreview()
|
||||
return;
|
||||
|
||||
m_appPreviewTips = new PreviewContainer;
|
||||
m_appPreviewTips->updateDockSize(DockSize);
|
||||
m_appPreviewTips->setWindowInfos(m_windowInfos, m_itemEntryInter->GetAllowedCloseWindows().value());
|
||||
m_appPreviewTips->updateLayoutDirection(DockPosition);
|
||||
|
||||
@ -593,19 +738,11 @@ void AppItem::showPreview()
|
||||
connect(m_appPreviewTips, &PreviewContainer::requestHidePopup, this, &AppItem::onResetPreview);
|
||||
|
||||
// 预览标题显示方式的配置
|
||||
DConfig *config = DConfig::create("org.deepin.dde.dock", "org.deepin.dde.dock");
|
||||
if (config->isValid() && config->keyList().contains("showWindowName"))
|
||||
m_appPreviewTips->setTitleDisplayMode(config->value("showWindowName").toInt());
|
||||
delete config;
|
||||
DConfig config(QString("com.deepin.dde.dock.dconfig"), QString());
|
||||
if (config.isValid() && config.keyList().contains("Dock_Show_Window_name"))
|
||||
m_appPreviewTips->setTitleDisplayMode(config.value("Dock_Show_Window_name").toInt());
|
||||
|
||||
// 设置预览界面是否开启左右两边的圆角
|
||||
if (!PopupWindow.isNull() && m_wmHelper->hasComposite()) {
|
||||
PopupWindow->setLeftRightRadius(true);
|
||||
} else {
|
||||
PopupWindow->setLeftRightRadius(false);
|
||||
}
|
||||
|
||||
showPopupWindow(m_appPreviewTips, true, 18);
|
||||
showPopupWindow(m_appPreviewTips, true);
|
||||
}
|
||||
|
||||
void AppItem::playSwingEffect()
|
||||
|
@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: 2011 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
@ -8,47 +9,58 @@
|
||||
#include "dockitem.h"
|
||||
#include "previewcontainer.h"
|
||||
#include "appdrag.h"
|
||||
#include "dbusclientmanager.h"
|
||||
#include "../widgets/tipswidget.h"
|
||||
#include "dbusutil.h"
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsItem>
|
||||
#include <QGraphicsItemAnimation>
|
||||
#include <DGuiApplicationHelper>
|
||||
|
||||
#include <com_deepin_dde_daemon_dock_entry.h>
|
||||
|
||||
using DockEntryInter = com::deepin::dde::daemon::dock::Entry;
|
||||
class QGSettings;
|
||||
class ScreenSpliter;
|
||||
|
||||
class AppItem : public DockItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AppItem(const QGSettings *appSettings, const QGSettings *activeAppSettings, const QGSettings *dockedAppSettings, const QDBusObjectPath &entry, QWidget *parent = nullptr);
|
||||
explicit AppItem(DockInter *dockInter, const QGSettings *appSettings, const QGSettings *activeAppSettings, const QGSettings *dockedAppSettings, const QDBusObjectPath &entry, QWidget *parent = nullptr);
|
||||
~AppItem() override;
|
||||
|
||||
void checkEntry() override;
|
||||
const QString appId() const;
|
||||
QString name() const;
|
||||
bool isValid() const;
|
||||
void updateWindowIconGeometries();
|
||||
void undock();
|
||||
QWidget *appDragWidget();
|
||||
void setDockInfo(Dock::Position dockPosition, const QRect &dockGeometry);
|
||||
void setDraging(bool drag) override;
|
||||
|
||||
void startSplit(const QRect &rect);
|
||||
bool supportSplitWindow();
|
||||
bool splitWindowOnScreen(ScreenSpliter::SplitDirection direction);
|
||||
int mode() const;
|
||||
DockEntryInter *itemEntryInter() const;
|
||||
inline ItemType itemType() const override { return App; }
|
||||
QPixmap appIcon(){ return m_appIcon; }
|
||||
virtual QString accessibleName() override;
|
||||
inline quint32 getAppItemWindowId() const { return m_currentWindowId; }
|
||||
void requestDock();
|
||||
bool isDocked() const;
|
||||
qint64 appOpenMSecs() const;
|
||||
void updateMSecs();
|
||||
const WindowInfoMap &windowsMap() const;
|
||||
|
||||
signals:
|
||||
void requestActivateWindow(const WId wid) const;
|
||||
void requestPreviewWindow(const WId wid) const;
|
||||
void requestCancelPreview() const;
|
||||
void dragReady(QWidget *dragWidget);
|
||||
|
||||
void requestUpdateEntryGeometries() const;
|
||||
void requestUpdateItemMinimizedGeometry(const QRect) const;
|
||||
void windowCountChanged() const;
|
||||
void modeChanged(int) const;
|
||||
|
||||
private:
|
||||
void moveEvent(QMoveEvent *e) override;
|
||||
@ -68,6 +80,7 @@ private:
|
||||
void invokedMenuItem(const QString &itemId, const bool checked) override;
|
||||
const QString contextMenu() const override;
|
||||
QWidget *popupTips() override;
|
||||
void startDrag();
|
||||
bool hasAttention() const;
|
||||
|
||||
QPoint appIconPosition() const;
|
||||
@ -102,11 +115,9 @@ private:
|
||||
|
||||
QPointer<AppDrag> m_drag;
|
||||
|
||||
bool m_dragging;
|
||||
bool m_active;
|
||||
int m_retryTimes;
|
||||
bool m_iconValid;
|
||||
quint32 m_currentWindowId;
|
||||
quint64 m_lastclickTimes;
|
||||
|
||||
WindowInfoMap m_windowInfos;
|
||||
@ -124,8 +135,12 @@ private:
|
||||
QDate m_curDate; // 保存当前icon的日期来判断是否需要更新日历APP的ICON
|
||||
|
||||
DGuiApplicationHelper::ColorType m_themeType;
|
||||
qint64 m_createMSecs;
|
||||
|
||||
static QPoint MousePressPos;
|
||||
|
||||
ScreenSpliter *m_screenSpliter;
|
||||
DockInter *m_dockInter;
|
||||
};
|
||||
|
||||
#endif // APPITEM_H
|
||||
|
143
frame/item/appmultiitem.cpp
Normal file
143
frame/item/appmultiitem.cpp
Normal file
@ -0,0 +1,143 @@
|
||||
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "appitem.h"
|
||||
#include "appmultiitem.h"
|
||||
#include "imageutil.h"
|
||||
#include "themeappicon.h"
|
||||
|
||||
#include <QBitmap>
|
||||
#include <QMenu>
|
||||
#include <QPixmap>
|
||||
#include <QX11Info>
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
AppMultiItem::AppMultiItem(AppItem *appItem, WId winId, const WindowInfo &windowInfo, QWidget *parent)
|
||||
: DockItem(parent)
|
||||
, m_appItem(appItem)
|
||||
, m_windowInfo(windowInfo)
|
||||
, m_entryInter(appItem->itemEntryInter())
|
||||
, m_winId(winId)
|
||||
, m_menu(new QMenu(this))
|
||||
{
|
||||
initMenu();
|
||||
initConnection();
|
||||
}
|
||||
|
||||
AppMultiItem::~AppMultiItem()
|
||||
{
|
||||
}
|
||||
|
||||
QSize AppMultiItem::suitableSize(int size) const
|
||||
{
|
||||
return QSize(size, size);
|
||||
}
|
||||
|
||||
AppItem *AppMultiItem::appItem() const
|
||||
{
|
||||
return m_appItem;
|
||||
}
|
||||
|
||||
quint32 AppMultiItem::winId() const
|
||||
{
|
||||
return m_winId;
|
||||
}
|
||||
|
||||
const WindowInfo &AppMultiItem::windowInfo() const
|
||||
{
|
||||
return m_windowInfo;
|
||||
}
|
||||
|
||||
DockItem::ItemType AppMultiItem::itemType() const
|
||||
{
|
||||
return DockItem::AppMultiWindow;
|
||||
}
|
||||
|
||||
void AppMultiItem::initMenu()
|
||||
{
|
||||
QAction *actionOpen = new QAction(m_menu);
|
||||
actionOpen->setText(tr("Open"));
|
||||
connect(actionOpen, &QAction::triggered, this, &AppMultiItem::onOpen);
|
||||
m_menu->addAction(actionOpen);
|
||||
}
|
||||
|
||||
void AppMultiItem::initConnection()
|
||||
{
|
||||
connect(m_entryInter, &DockEntryInter::CurrentWindowChanged, this, &AppMultiItem::onCurrentWindowChanged);
|
||||
}
|
||||
|
||||
void AppMultiItem::onOpen()
|
||||
{
|
||||
m_entryInter->ActiveWindow(m_winId);
|
||||
}
|
||||
|
||||
void AppMultiItem::onCurrentWindowChanged(uint32_t value)
|
||||
{
|
||||
if (value != m_winId)
|
||||
return;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
void AppMultiItem::paintEvent(QPaintEvent *)
|
||||
{
|
||||
QPainter painter(this);
|
||||
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
|
||||
|
||||
if (m_pixmap.isNull())
|
||||
m_pixmap = ImageUtil::loadWindowThumb(Utils::IS_WAYLAND_DISPLAY ? m_windowInfo.uuid : QString::number(m_winId));
|
||||
|
||||
DStyleHelper dstyle(style());
|
||||
const int radius = dstyle.pixelMetric(DStyle::PM_FrameRadius);
|
||||
QRect itemRect = rect();
|
||||
itemRect.marginsRemoved(QMargins(6, 6, 6, 6));
|
||||
QPainterPath path;
|
||||
path.addRoundedRect(rect(), radius, radius);
|
||||
painter.fillPath(path, Qt::transparent);
|
||||
|
||||
if (m_entryInter->currentWindow() == m_winId) {
|
||||
QColor backColor = Qt::black;
|
||||
backColor.setAlpha(255 * 0.8);
|
||||
painter.fillPath(path, backColor);
|
||||
}
|
||||
|
||||
itemRect = m_pixmap.rect();
|
||||
int itemWidth = itemRect.width();
|
||||
int itemHeight = itemRect.height();
|
||||
int x = (rect().width() - itemWidth) / 2;
|
||||
int y = (rect().height() - itemHeight) / 2;
|
||||
painter.drawPixmap(QRect(x, y, itemWidth, itemHeight), m_pixmap);
|
||||
|
||||
QPixmap pixmapAppIcon;
|
||||
ThemeAppIcon::getIcon(pixmapAppIcon, m_entryInter->icon(), qMin(width(), height()) * 0.8);
|
||||
if (!pixmapAppIcon.isNull()) {
|
||||
// 绘制下方的图标,下方的小图标大约为应用图标的三分之一的大小
|
||||
//pixmap = pixmap.scaled(pixmap.width() * 0.3, pixmap.height() * 0.3);
|
||||
QRect rectIcon = rect();
|
||||
int iconWidth = rectIcon.width() * 0.3;
|
||||
int iconHeight = rectIcon.height() * 0.3;
|
||||
rectIcon.setX((rect().width() - iconWidth) * 0.5);
|
||||
rectIcon.setY(rect().height() - iconHeight);
|
||||
rectIcon.setWidth(iconWidth);
|
||||
rectIcon.setHeight(iconHeight);
|
||||
painter.drawPixmap(rectIcon, pixmapAppIcon);
|
||||
}
|
||||
}
|
||||
|
||||
void AppMultiItem::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
m_entryInter->ActiveWindow(m_winId);
|
||||
} else {
|
||||
QPoint currentPoint = QCursor::pos();
|
||||
m_menu->exec(currentPoint);
|
||||
}
|
||||
}
|
52
frame/item/appmultiitem.h
Normal file
52
frame/item/appmultiitem.h
Normal file
@ -0,0 +1,52 @@
|
||||
// Copyright (C) 2022 ~ 2022 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#ifndef APPMULTIITEM_H
|
||||
#define APPMULTIITEM_H
|
||||
|
||||
#include "dockitem.h"
|
||||
#include "dbusutil.h"
|
||||
|
||||
class AppItem;
|
||||
|
||||
class AppMultiItem : public DockItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend class AppItem;
|
||||
|
||||
public:
|
||||
AppMultiItem(AppItem *appItem, WId winId, const WindowInfo &windowInfo, QWidget *parent = Q_NULLPTR);
|
||||
~AppMultiItem() override;
|
||||
|
||||
QSize suitableSize(int size) const;
|
||||
AppItem *appItem() const;
|
||||
quint32 winId() const;
|
||||
const WindowInfo &windowInfo() const;
|
||||
|
||||
ItemType itemType() const override;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
void initMenu();
|
||||
void initConnection();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onOpen();
|
||||
void onCurrentWindowChanged(uint32_t value);
|
||||
|
||||
private:
|
||||
AppItem *m_appItem;
|
||||
WindowInfo m_windowInfo;
|
||||
DockEntryInter *m_entryInter;
|
||||
QPixmap m_pixmap;
|
||||
WId m_winId;
|
||||
QMenu *m_menu;
|
||||
};
|
||||
|
||||
#endif // APPMULTIITEM_H
|
3
frame/item/arrow-down.svg
Normal file
3
frame/item/arrow-down.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
||||
<polygon fill="#FFF" fill-rule="evenodd" points="6.659 10.73 5.952 11.437 .563 6.048 5.952 .659 6.659 1.366 1.977 6.048" transform="rotate(-90 9 5)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 244 B |
3
frame/item/arrow-left.svg
Normal file
3
frame/item/arrow-left.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
||||
<polygon fill="#FFF" fill-rule="evenodd" points="6.596 10.671 5.889 11.378 .5 5.989 5.889 .6 6.596 1.307 1.914 5.989" transform="translate(6 4)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 240 B |
3
frame/item/arrow-right.svg
Normal file
3
frame/item/arrow-right.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
||||
<polygon fill="#FFF" fill-rule="evenodd" points="6.5 10.693 5.793 11.4 .404 6.011 5.793 .622 6.5 1.329 1.818 6.011" transform="matrix(-1 0 0 1 14 3.978)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 249 B |
3
frame/item/arrow-up.svg
Normal file
3
frame/item/arrow-up.svg
Normal file
@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20">
|
||||
<polygon fill="#FFF" fill-rule="evenodd" points="6.437 10.73 5.73 11.437 .341 6.048 5.73 .659 6.437 1.366 1.755 6.048" transform="matrix(0 1 1 0 4 6)"/>
|
||||
</svg>
|
After Width: | Height: | Size: 246 B |
@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: 2011 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
@ -10,10 +11,13 @@
|
||||
|
||||
#include <X11/Xcursor/Xcursor.h>
|
||||
|
||||
AppDrag::AppDrag(QObject *dragSource)
|
||||
AppDrag::AppDrag(QObject *dragSource, AppDragWidget *dragWidget)
|
||||
: QDrag(dragSource)
|
||||
, m_appDragWidget(new AppDragWidget)
|
||||
, m_appDragWidget(dragWidget)
|
||||
{
|
||||
if (!m_appDragWidget)
|
||||
m_appDragWidget = new AppDragWidget;
|
||||
|
||||
// delete by itself
|
||||
m_appDragWidget->setVisible(false);
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: 2011 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
@ -13,7 +14,7 @@
|
||||
class AppDrag : public QDrag
|
||||
{
|
||||
public:
|
||||
explicit AppDrag(QObject *dragSource);
|
||||
explicit AppDrag(QObject *dragSource, AppDragWidget *dragWidget = Q_NULLPTR);
|
||||
virtual ~AppDrag();
|
||||
|
||||
void setPixmap(const QPixmap &);
|
||||
|
@ -1,10 +1,20 @@
|
||||
// SPDX-FileCopyrightText: 2011 - 2022 UnionTech Software Technology Co., Ltd.
|
||||
// Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
|
||||
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
#include "../appitem.h"
|
||||
#include "appdragwidget.h"
|
||||
#include "utils.h"
|
||||
#include "displaymanager.h"
|
||||
|
||||
#include "org_deepin_dde_xeventmonitor1.h"
|
||||
|
||||
#define SPLIT_NONE 0
|
||||
#define SPLIT_LEFT 1
|
||||
#define SPLIT_RIGHT 2
|
||||
|
||||
using XEventMonitor = ::org::deepin::dde::XEventMonitor1;
|
||||
|
||||
AppDragWidget::AppDragWidget(QWidget *parent)
|
||||
: QGraphicsView(parent)
|
||||
@ -17,34 +27,29 @@ AppDragWidget::AppDragWidget(QWidget *parent)
|
||||
, m_animGroup(new QParallelAnimationGroup(this))
|
||||
, m_goBackAnim(new QPropertyAnimation(this, "pos", this))
|
||||
, m_dockPosition(Dock::Position::Bottom)
|
||||
, m_removeTips(new TipsWidget(this))
|
||||
, m_popupWindow(new DockPopupWindow(nullptr))
|
||||
, m_distanceMultiple(Utils::SettingValue("com.deepin.dde.dock.distancemultiple", "/com/deepin/dde/dock/distancemultiple/", "distance-multiple", 1.5).toDouble())
|
||||
, m_item(nullptr)
|
||||
, m_cursorPosition(-1, -1)
|
||||
, m_dockScreen(nullptr)
|
||||
{
|
||||
m_removeTips->setText(tr("Remove"));
|
||||
m_removeTips->setObjectName("AppRemoveTips");
|
||||
m_removeTips->setVisible(false);
|
||||
m_removeTips->installEventFilter(this);
|
||||
|
||||
m_popupWindow->setShadowBlurRadius(20);
|
||||
m_popupWindow->setRadius(18);
|
||||
m_popupWindow->setShadowYOffset(2);
|
||||
m_popupWindow->setShadowXOffset(0);
|
||||
m_popupWindow->setArrowWidth(18);
|
||||
m_popupWindow->setArrowHeight(10);
|
||||
m_popupWindow->setRadius(18);
|
||||
|
||||
m_scene->addItem(m_object.get());
|
||||
setScene(m_scene);
|
||||
|
||||
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
if (Utils::IS_WAYLAND_DISPLAY) {
|
||||
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint | Qt::Window);
|
||||
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint | Qt::Window | Qt::FramelessWindowHint);
|
||||
setAttribute(Qt::WA_NativeWindow);
|
||||
initWaylandEnv();
|
||||
} else {
|
||||
setAcceptDrops(true);
|
||||
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
|
||||
}
|
||||
viewport()->setAutoFillBackground(false);
|
||||
setFrameShape(QFrame::NoFrame);
|
||||
@ -52,12 +57,24 @@ AppDragWidget::AppDragWidget(QWidget *parent)
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
setMouseTracking(true);
|
||||
|
||||
setAcceptDrops(true);
|
||||
|
||||
initAnimations();
|
||||
|
||||
m_followMouseTimer->setInterval(16);
|
||||
connect(m_followMouseTimer, &QTimer::timeout, this, &AppDragWidget::onFollowMouse);
|
||||
m_followMouseTimer->start();
|
||||
QTimer::singleShot(0, this, &AppDragWidget::onFollowMouse);
|
||||
if (!Utils::IS_WAYLAND_DISPLAY) {
|
||||
m_followMouseTimer->setInterval(16);
|
||||
connect(m_followMouseTimer, &QTimer::timeout, this, &AppDragWidget::onFollowMouse);
|
||||
m_followMouseTimer->start();
|
||||
QTimer::singleShot(0, this, &AppDragWidget::onFollowMouse);
|
||||
}
|
||||
}
|
||||
|
||||
void AppDragWidget::execFinished()
|
||||
{
|
||||
if (!m_bDragDrop)
|
||||
return;
|
||||
|
||||
dropHandler(QCursor::pos());
|
||||
}
|
||||
|
||||
void AppDragWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
@ -72,24 +89,17 @@ void AppDragWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
void AppDragWidget::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
if (Utils::IS_WAYLAND_DISPLAY) {
|
||||
QGraphicsView::dragEnterEvent(event);
|
||||
} else {
|
||||
event->accept();
|
||||
m_bDragDrop = true;
|
||||
}
|
||||
event->accept();
|
||||
m_bDragDrop = true;
|
||||
}
|
||||
|
||||
void AppDragWidget::dragMoveEvent(QDragMoveEvent *event)
|
||||
{
|
||||
if (Utils::IS_WAYLAND_DISPLAY) {
|
||||
QGraphicsView::dragMoveEvent(event);
|
||||
} else {
|
||||
showRemoveTips();
|
||||
if (isRemoveItem() && m_bDragDrop) {
|
||||
emit requestRemoveItem();
|
||||
}
|
||||
}
|
||||
if (Utils::IS_WAYLAND_DISPLAY)
|
||||
return QGraphicsView::dragMoveEvent(event);
|
||||
|
||||
if (m_bDragDrop)
|
||||
moveHandler(QCursor::pos());
|
||||
}
|
||||
|
||||
/**获取应用的左上角坐标
|
||||
@ -129,7 +139,7 @@ const QPoint AppDragWidget::popupMarkPoint(Dock::Position pos)
|
||||
break;
|
||||
case Bottom:
|
||||
if (!DWindowManagerHelper::instance()->hasComposite()) {
|
||||
p += QPoint(size().width() / 2 , -r.height() / 2);
|
||||
p += QPoint(0 , -r.height() / 2);
|
||||
} else {
|
||||
p += QPoint(r.width() / 2, 0);
|
||||
}
|
||||
@ -146,29 +156,11 @@ const QPoint AppDragWidget::popupMarkPoint(Dock::Position pos)
|
||||
|
||||
void AppDragWidget::dropEvent(QDropEvent *event)
|
||||
{
|
||||
if (Utils::IS_WAYLAND_DISPLAY) {
|
||||
QGraphicsView::dropEvent(event);
|
||||
} else {
|
||||
m_followMouseTimer->stop();
|
||||
m_bDragDrop = false;
|
||||
if (Utils::IS_WAYLAND_DISPLAY)
|
||||
return dropEvent(event);
|
||||
|
||||
if (isRemoveAble(QCursor::pos())) {
|
||||
if (DWindowManagerHelper::instance()->hasComposite()) {
|
||||
showRemoveAnimation();
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
AppItem *appItem = static_cast<AppItem *>((Utils::IS_WAYLAND_DISPLAY && m_item) ? m_item : event->source());
|
||||
appItem->undock();
|
||||
m_popupWindow->setVisible(false);
|
||||
} else {
|
||||
if (DWindowManagerHelper::instance()->hasComposite()) {
|
||||
showGoBackAnimation();
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
m_followMouseTimer->stop();
|
||||
dropHandler(QCursor::pos());
|
||||
}
|
||||
|
||||
void AppDragWidget::hideEvent(QHideEvent *event)
|
||||
@ -178,6 +170,49 @@ void AppDragWidget::hideEvent(QHideEvent *event)
|
||||
QGraphicsView::hideEvent(event);
|
||||
}
|
||||
|
||||
void AppDragWidget::dropHandler(const QPoint &pos)
|
||||
{
|
||||
m_bDragDrop = false;
|
||||
|
||||
if (canSplitWindow(pos)) {
|
||||
if (DWindowManagerHelper::instance()->hasComposite()) {
|
||||
showRemoveAnimation();
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
m_popupWindow->setVisible(false);
|
||||
Q_EMIT requestSplitWindow(splitPosition());
|
||||
} else {
|
||||
if (DWindowManagerHelper::instance()->hasComposite()) {
|
||||
showGoBackAnimation();
|
||||
} else {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AppDragWidget::moveHandler(const QPoint &pos)
|
||||
{
|
||||
if (canSplitWindow(pos)) {
|
||||
QRect screenGeometry = splitGeometry(pos);
|
||||
if (screenGeometry.isValid() && screenGeometry != m_lastMouseGeometry) {
|
||||
qDebug() << "change area:" << screenGeometry;
|
||||
Q_EMIT requestChangedArea(screenGeometry);
|
||||
m_lastMouseGeometry = screenGeometry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AppDragWidget::moveCurrent(const QPoint &destPos)
|
||||
{
|
||||
if (DWindowManagerHelper::instance()->hasComposite()) {
|
||||
move(destPos.x() - width() / 2, destPos.y() - height() / 2);
|
||||
} else {
|
||||
// 窗口特效未开启时会隐藏m_object绘制的图标,移动的图标为QDrag绘制的图标
|
||||
move(destPos.x(), destPos.y());
|
||||
}
|
||||
}
|
||||
|
||||
void AppDragWidget::setAppPixmap(const QPixmap &pix)
|
||||
{
|
||||
if (DWindowManagerHelper::instance()->hasComposite()) {
|
||||
@ -205,7 +240,7 @@ void AppDragWidget::setOriginPos(const QPoint position)
|
||||
|
||||
void AppDragWidget::setPixmapOpacity(qreal opacity)
|
||||
{
|
||||
if (isRemoveAble(QCursor::pos())) {
|
||||
if (canSplitWindow(QCursor::pos())) {
|
||||
m_object->setOpacity(opacity);
|
||||
m_animOpacity->setStartValue(opacity);
|
||||
} else {
|
||||
@ -214,34 +249,6 @@ void AppDragWidget::setPixmapOpacity(qreal opacity)
|
||||
}
|
||||
}
|
||||
|
||||
bool AppDragWidget::isRemoveable(const Position &dockPos, const QRect &doctRect)
|
||||
{
|
||||
const QPoint &p = QCursor::pos();
|
||||
switch (dockPos) {
|
||||
case Dock::Position::Left:
|
||||
if ((p.x() - doctRect.topRight().x()) > (doctRect.width() * 3)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Dock::Position::Top:
|
||||
if ((p.y() - doctRect.bottomLeft().y()) > (doctRect.height() * 3)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Dock::Position::Right:
|
||||
if ((doctRect.topLeft().x() - p.x()) > (doctRect.width() * 3)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Dock::Position::Bottom:
|
||||
if ((doctRect.topLeft().y() - p.y()) > (doctRect.height() * 3)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void AppDragWidget::initAnimations()
|
||||
{
|
||||
m_animScale->setDuration(300);
|
||||
@ -297,12 +304,227 @@ void AppDragWidget::onRemoveAnimationStateChanged(QAbstractAnimation::State newS
|
||||
}
|
||||
}
|
||||
|
||||
/** 判断应用区域图标是否被拖出任务栏
|
||||
* @brief AppDragWidget::canSplitWindow
|
||||
* @return 返回true应用移出任务栏,false应用在任务栏内
|
||||
*/
|
||||
bool AppDragWidget::canSplitWindow(const QPoint &pos) const
|
||||
{
|
||||
switch (m_dockPosition) {
|
||||
case Dock::Position::Left:
|
||||
if ((pos.x() > m_dockGeometry.topRight().x())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Dock::Position::Top:
|
||||
if ((pos.y() > m_dockGeometry.bottomLeft().y())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Dock::Position::Right:
|
||||
if ((m_dockGeometry.topLeft().x() > pos.x())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Dock::Position::Bottom:
|
||||
if ((m_dockGeometry.topLeft().y() > pos.y())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AppDragWidget::splitPosition
|
||||
* @return 1 左分屏;2 右分屏;5 左上;6 右上;9 左下;10 右下;15全屏。这些值是窗管给的
|
||||
*/
|
||||
ScreenSpliter::SplitDirection AppDragWidget::splitPosition() const
|
||||
{
|
||||
QPoint pos = QCursor::pos();
|
||||
QScreen *currentScreen = DisplayManager::instance()->screenAt(pos);
|
||||
|
||||
if (!currentScreen)
|
||||
return ScreenSpliter::None;
|
||||
|
||||
int xCenter = currentScreen->geometry().x() + currentScreen->size().width() / 2;
|
||||
// 1表示左分屏
|
||||
if (pos.x() < xCenter)
|
||||
return ScreenSpliter::Left;
|
||||
|
||||
// 2表示右分屏
|
||||
if (pos.x() > xCenter)
|
||||
return ScreenSpliter::Right;
|
||||
|
||||
return ScreenSpliter::None;
|
||||
}
|
||||
|
||||
void AppDragWidget::adjustDesktopGeometry(QRect &rect) const
|
||||
{
|
||||
QRect rectGeometry = m_dockGeometry;
|
||||
rectGeometry.setWidth(rectGeometry.width() * qApp->devicePixelRatio());
|
||||
rectGeometry.setHeight(rectGeometry.height() * qApp->devicePixelRatio());
|
||||
switch (m_dockPosition) {
|
||||
case Dock::Position::Left: {
|
||||
int leftX = (rectGeometry.x() + rectGeometry.width()) * qApp->devicePixelRatio();
|
||||
if (rect.x() < leftX) {
|
||||
rect.setX(leftX);
|
||||
rect.setWidth(rect.width() - (leftX - rect.x()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Dock::Position::Top: {
|
||||
int topY = (rectGeometry.y() + rectGeometry.height()) * qApp->devicePixelRatio();
|
||||
if (rect.y() < topY) {
|
||||
rect.setY(topY);
|
||||
rect.setHeight(rect.height() - (topY - rect.y()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Dock::Position::Right: {
|
||||
int rightX = rectGeometry.x() * qApp->devicePixelRatio();
|
||||
if (rightX < rect.x() + rect.width() * qApp->devicePixelRatio())
|
||||
rect.setWidth(rect.width() - (rect.x() + rect.width() - rightX));
|
||||
break;
|
||||
}
|
||||
case Dock::Position::Bottom: {
|
||||
int bottomY = rectGeometry.y() * qApp->devicePixelRatio();
|
||||
if (bottomY < rect.y() + rect.height() * qApp->devicePixelRatio())
|
||||
rect.setHeight(rect.height() - (rect.y() + rect.height() - bottomY));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QRect AppDragWidget::splitGeometry(const QPoint &pos) const
|
||||
{
|
||||
QList<QScreen *> screens = DisplayManager::instance()->screens();
|
||||
for (QScreen *screen : screens) {
|
||||
QRect screenGeometry = screen->geometry();
|
||||
screenGeometry.setWidth(screenGeometry.width() * qApp->devicePixelRatio());
|
||||
screenGeometry.setHeight(screenGeometry.height() * qApp->devicePixelRatio());
|
||||
if (!screenGeometry.contains(pos))
|
||||
continue;
|
||||
|
||||
// 左右分屏即可
|
||||
int centerX = screenGeometry.x() + screenGeometry.width() / 2;
|
||||
if (pos.x() < centerX) {
|
||||
// 左分屏
|
||||
QRect rectLeft = screenGeometry;
|
||||
rectLeft.setWidth(screenGeometry.width() / 2);
|
||||
adjustDesktopGeometry(rectLeft);
|
||||
return rectLeft;
|
||||
}
|
||||
if (pos.x() > centerX) {
|
||||
// 右分屏
|
||||
QRect rectRight = screenGeometry;
|
||||
rectRight.setLeft(screenGeometry.x() + screenGeometry.width() / 2);
|
||||
rectRight.setWidth(screenGeometry.width() / 2);
|
||||
adjustDesktopGeometry(rectRight);
|
||||
return rectRight;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return QRect();
|
||||
}
|
||||
|
||||
void AppDragWidget::initWaylandEnv()
|
||||
{
|
||||
if (!Utils::IS_WAYLAND_DISPLAY)
|
||||
return;
|
||||
|
||||
// 由于在wayland环境下无法触发drop事件,导致鼠标无法释放,所以这里暂时用XEventMonitor的方式(具体原因待查)
|
||||
XEventMonitor *extralEventInter = new XEventMonitor(xEventMonitorService, xEventMonitorPath, QDBusConnection::sessionBus());
|
||||
QString key = extralEventInter->RegisterFullScreen();
|
||||
connect(this, &AppDragWidget::destroyed, this, [ key, extralEventInter ] {
|
||||
extralEventInter->UnregisterArea(key);
|
||||
delete extralEventInter;
|
||||
QDrag::cancel();
|
||||
});
|
||||
|
||||
connect(extralEventInter, &XEventMonitor::ButtonRelease, this, &AppDragWidget::onButtonRelease);
|
||||
connect(extralEventInter, &XEventMonitor::CursorMove,this, &AppDragWidget::onCursorMove);
|
||||
}
|
||||
|
||||
void AppDragWidget::onButtonRelease(int, int x, int y, const QString &)
|
||||
{
|
||||
if (!m_bDragDrop)
|
||||
return;
|
||||
|
||||
dropHandler(QPoint(x, y));
|
||||
|
||||
QDrag::cancel();
|
||||
}
|
||||
|
||||
void AppDragWidget::onCursorMove(int x, int y, const QString &)
|
||||
{
|
||||
QPoint pos = QPoint(x, y);
|
||||
moveCurrent(pos);
|
||||
moveHandler(pos);
|
||||
}
|
||||
|
||||
void AppDragWidget::onFollowMouse()
|
||||
{
|
||||
moveCurrent(QCursor::pos());
|
||||
}
|
||||
|
||||
void AppDragWidget::enterEvent(QEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
if (m_goBackAnim->state() != QPropertyAnimation::State::Running
|
||||
&& m_animGroup->state() != QParallelAnimationGroup::Running) {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
QuickDragWidget::QuickDragWidget(QWidget *parent)
|
||||
: AppDragWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QuickDragWidget::~QuickDragWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void QuickDragWidget::dropEvent(QDropEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
m_followMouseTimer->stop();
|
||||
m_bDragDrop = false;
|
||||
|
||||
if (isRemoveAble(QCursor::pos())) {
|
||||
if (DWindowManagerHelper::instance()->hasComposite())
|
||||
showRemoveAnimation();
|
||||
else
|
||||
hide();
|
||||
|
||||
m_popupWindow->setVisible(false);
|
||||
} else {
|
||||
if (DWindowManagerHelper::instance()->hasComposite())
|
||||
showGoBackAnimation();
|
||||
else
|
||||
hide();
|
||||
|
||||
Q_EMIT requestDropItem(event);
|
||||
}
|
||||
}
|
||||
|
||||
void QuickDragWidget::dragMoveEvent(QDragMoveEvent *event)
|
||||
{
|
||||
AppDragWidget::dragMoveEvent(event);
|
||||
requestDragMove(event);
|
||||
}
|
||||
|
||||
/**判断图标拖到一定高度(默认任务栏高度的1.5倍)后是否可以移除
|
||||
* @brief AppDragWidget::isRemoveAble
|
||||
* @param curPos 当前鼠标所在位置
|
||||
* @return 返回true可移除,false不可移除
|
||||
*/
|
||||
bool AppDragWidget::isRemoveAble(const QPoint &curPos)
|
||||
bool QuickDragWidget::isRemoveAble(const QPoint &curPos)
|
||||
{
|
||||
const QPoint &p = curPos;
|
||||
switch (m_dockPosition) {
|
||||
@ -329,109 +551,3 @@ bool AppDragWidget::isRemoveAble(const QPoint &curPos)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**判断应用区域图标是否被拖出任务栏
|
||||
* @brief AppDragWidget::isRemoveItem
|
||||
* @return 返回true应用移出任务栏,false应用在任务栏内
|
||||
*/
|
||||
bool AppDragWidget::isRemoveItem()
|
||||
{
|
||||
const QPoint &p = QCursor::pos();
|
||||
switch (m_dockPosition) {
|
||||
case Dock::Position::Left:
|
||||
if ((p.x() > m_dockGeometry.topRight().x())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Dock::Position::Top:
|
||||
if ((p.y() > m_dockGeometry.bottomLeft().y())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Dock::Position::Right:
|
||||
if ((m_dockGeometry.topLeft().x() > p.x())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Dock::Position::Bottom:
|
||||
if ((m_dockGeometry.topLeft().y() > p.y())) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void AppDragWidget::onFollowMouse()
|
||||
{
|
||||
QPoint destPos = QCursor::pos();
|
||||
move(destPos.x() - width() / 2, destPos.y() - height() / 2);
|
||||
}
|
||||
|
||||
void AppDragWidget::enterEvent(QEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
if (m_goBackAnim->state() != QPropertyAnimation::State::Running
|
||||
&& m_animGroup->state() != QParallelAnimationGroup::Running) {
|
||||
hide();
|
||||
}
|
||||
}
|
||||
|
||||
bool AppDragWidget::event(QEvent *event)
|
||||
{
|
||||
if (Utils::IS_WAYLAND_DISPLAY && event->type() == QEvent::DeferredDelete)
|
||||
requestRemoveSelf(isRemoveAble(m_cursorPosition));
|
||||
|
||||
return QGraphicsView::event(event);
|
||||
}
|
||||
|
||||
/**显示移除应用提示窗口
|
||||
* @brief AppDragWidget::showRemoveTips
|
||||
*/
|
||||
void AppDragWidget::showRemoveTips()
|
||||
{
|
||||
Dock::Position pos = Dock::Position::Bottom;
|
||||
|
||||
DockPopupWindow *popup = m_popupWindow.data();
|
||||
if (isRemoveAble(QCursor::pos())) {
|
||||
QWidget *lastContent = popup->getContent();
|
||||
if (lastContent)
|
||||
lastContent->setVisible(false);
|
||||
|
||||
switch (pos) {
|
||||
case Top: popup->setArrowDirection(DockPopupWindow::ArrowTop); break;
|
||||
case Bottom: popup->setArrowDirection(DockPopupWindow::ArrowBottom); break;
|
||||
case Left: popup->setArrowDirection(DockPopupWindow::ArrowLeft); break;
|
||||
case Right: popup->setArrowDirection(DockPopupWindow::ArrowRight); break;
|
||||
}
|
||||
popup->resize(m_removeTips->sizeHint());
|
||||
popup->setContent(m_removeTips);
|
||||
|
||||
const QPoint p = popupMarkPoint(pos);
|
||||
if (!popup->isVisible())
|
||||
QMetaObject::invokeMethod(popup, "show", Qt::QueuedConnection, Q_ARG(QPoint, p), Q_ARG(bool, true));
|
||||
else
|
||||
popup->show(p, true);
|
||||
|
||||
m_object->setOpacity(0.5);
|
||||
m_animOpacity->setStartValue(0.5);
|
||||
} else {
|
||||
m_object->setOpacity(1.0);
|
||||
m_animOpacity->setStartValue(1.0);
|
||||
if (popup->isVisible())
|
||||
popup->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AppDragWidget::moveEvent(QMoveEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
showRemoveTips();
|
||||
if (Utils::IS_WAYLAND_DISPLAY) {
|
||||
m_cursorPosition = QCursor::pos();
|
||||
if (isRemoveItem()) {
|
||||
emit requestRemoveItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user