fix: 修复debian打包使用AM宏不生效的问题

原因:rule中定义的宏只在CMakeLists.txt文件中生效,在c++代码中不生效
解决方案:在CMakeLists.txt文件中直接定义一个宏来判断是否使用AM,这样c++代码中就可以使用CMakeLists.txt文件中的宏

Log:
Influence: 任务栏是否使用AM服务
Task: https://pms.uniontech.com/task-view-133075.html
Change-Id: Icea6ac1ac4d86dfc4f4aab040deabe99a9d1d83c
This commit is contained in:
donghualin 2022-06-28 09:31:40 +00:00
parent c3b956d0dc
commit 5f4429b3f8
3 changed files with 10 additions and 3 deletions

View File

@ -52,6 +52,8 @@ endif()
file(GLOB INTERFACES "interfaces/*.h")
add_compile_definitions(USE_AM)
#include使
#CMakeListsCMakeLists
#

3
debian/rules vendored
View File

@ -12,5 +12,4 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
override_dh_auto_configure:
dh_auto_configure -- \
-DHOST_MULTIARCH="$(DEB_HOST_MULTIARCH)" \
-DUSE_AM=YES
-DHOST_MULTIARCH="$(DEB_HOST_MULTIARCH)"

View File

@ -100,11 +100,17 @@ void LauncherItem::mouseReleaseEvent(QMouseEvent *e)
if (e->button() != Qt::LeftButton)
return;
#ifdef USE_AM
DDBusSender dbusSender = DDBusSender()
.service("org.deepin.dde.Launcher1")
.path("/org/deepin/dde/Launcher1")
.interface("org.deepin.dde.Launcher1");
#else
DDBusSender dbusSender = DDBusSender()
.service("com.deepin.dde.Launcher")
.path("/com/deepin/dde/Launcher")
.interface("com.deepin.dde.Launcher");
#endif
QDBusPendingReply<bool> visibleReply = dbusSender.property("Visible").get();
if (!visibleReply.value())
dbusSender.method("Show").call();