From c7826edd4664a9cbb2dad30671deeebdf23ef836 Mon Sep 17 00:00:00 2001 From: donghualin Date: Fri, 16 Sep 2022 20:12:52 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=A0=8F=E5=AF=B9libdframeworkdbus-dev=E5=BA=93=E7=9A=84?= =?UTF-8?q?=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1、删除项目中对libdframeworkdbus-dev库的依赖,通过使用xml2cpp的工具来自动生成dbus接口文件,在使用到dbus库的项目中包含生成文件的目录 2、修改相关服务中v20的接口(com.deepin...)为v23的接口(org.deepin...) Log: Influence: 打开控制中心,鼠标移动唤醒任务栏、加载插件等,观察相关功能是否正常 Task: https://pms.uniontech.com/task-view-182009.html Change-Id: I960c849d06ed271ebbb9f8e479d9879967523581 --- .gitignore | 3 + CMakeLists.txt | 18 + debian/control | 2 +- frame/CMakeLists.txt | 19 +- frame/dbus/dockinterface.cpp | 50 +- frame/dbus/dockinterface.h | 21 +- frame/dbusinterface/types/arealist.cpp | 59 ++ frame/dbusinterface/types/arealist.h | 53 ++ frame/dbusinterface/types/audioport.cpp | 34 ++ frame/dbusinterface/types/audioport.h | 76 +++ frame/dbusinterface/types/audioportlist.cpp | 32 ++ frame/dbusinterface/types/audioportlist.h | 40 ++ frame/dbusinterface/types/brightnessmap.cpp | 32 ++ frame/dbusinterface/types/brightnessmap.h | 36 ++ frame/dbusinterface/types/dbusimagelist.cpp | 59 ++ frame/dbusinterface/types/dbusimagelist.h | 48 ++ frame/dbusinterface/types/dbustooltip.cpp | 57 ++ frame/dbusinterface/types/dbustooltip.h | 48 ++ frame/dbusinterface/types/dockrect.cpp | 50 ++ frame/dbusinterface/types/dockrect.h | 28 + .../types/keyboardlayoutlist.cpp | 32 ++ .../dbusinterface/types/keyboardlayoutlist.h | 38 ++ frame/dbusinterface/types/resolution.cpp | 76 +++ frame/dbusinterface/types/resolution.h | 65 +++ frame/dbusinterface/types/resolutionlist.cpp | 34 ++ frame/dbusinterface/types/resolutionlist.h | 37 ++ frame/dbusinterface/types/screenrect.cpp | 74 +++ frame/dbusinterface/types/screenrect.h | 55 ++ .../types/touchscreeninfolist.cpp | 59 ++ .../dbusinterface/types/touchscreeninfolist.h | 48 ++ .../types/touchscreeninfolist_v2.cpp | 59 ++ .../types/touchscreeninfolist_v2.h | 49 ++ frame/dbusinterface/types/touchscreenmap.cpp | 28 + frame/dbusinterface/types/touchscreenmap.h | 32 ++ frame/dbusinterface/types/zoneinfo.cpp | 92 +++ frame/dbusinterface/types/zoneinfo.h | 66 +++ .../xml/com.deepin.dde.daemon.Dock.xml | 100 ++++ .../xml/org.deepin.api.XEventMonitor.xml | 63 +++ .../xml/org.deepin.daemon.Audio.Sink.xml | 38 ++ .../xml/org.deepin.daemon.Audio.xml | 46 ++ .../xml/org.deepin.daemon.Display.xml | 83 +++ .../xml/org.deepin.daemon.Gesture.xml | 27 + .../xml/org.deepin.daemon.Timedate.xml | 62 +++ .../xml/org.deepin.dde.Launcher.xml | 21 + .../xml/org.freedesktop.FileManager.xml | 17 + .../xml/org.kde.StatusNotifierItem.xml | 61 ++ frame/display/displaymanager.h | 3 +- frame/item/components/appdragwidget.cpp | 4 +- frame/model/volumemodel.cpp | 4 +- frame/model/volumemodel.h | 10 +- frame/qtdbusextended/DBusExtended | 1 + .../DBusExtendedAbstractInterface | 1 + frame/qtdbusextended/dbusextended.h | 35 ++ .../dbusextendedabstractinterface.cpp | 525 ++++++++++++++++++ .../dbusextendedabstractinterface.h | 103 ++++ .../dbusextendedpendingcallwatcher.cpp | 38 ++ .../dbusextendedpendingcallwatcher_p.h | 67 +++ frame/util/dbusutil.h | 12 +- frame/util/multiscreenworker.h | 8 +- frame/util/touchsignalmanager.h | 6 +- frame/window/components/datetimedisplayer.cpp | 2 +- frame/window/components/datetimedisplayer.h | 6 +- frame/window/mainpanelcontrol.h | 2 - frame/window/tray/dbustraymanager.cpp | 4 +- frame/window/tray/dbustraymanager.h | 8 +- frame/window/tray/widgets/snitrayitemwidget.h | 2 +- frame/window/traymanagerwindow.h | 6 +- plugins/CMakeLists.txt | 1 - plugins/airplane-mode/CMakeLists.txt | 24 +- plugins/airplane-mode/airplanemodeitem.cpp | 4 +- plugins/airplane-mode/airplanemodeitem.h | 4 +- .../xml/org.deepin.daemon.AirplaneMode.xml | 16 + plugins/bluetooth/CMakeLists.txt | 25 +- plugins/bluetooth/bluetooth.json | 2 +- .../bluetooth/componments/adaptersmanager.cpp | 10 +- .../bluetooth/componments/adaptersmanager.h | 4 +- .../componments/bluetoothadapteritem.cpp | 2 +- .../componments/bluetoothadapteritem.h | 4 +- .../bluetooth/componments/bluetoothapplet.cpp | 3 +- .../bluetooth/componments/bluetoothapplet.h | 4 +- .../xml/org.deepin.daemon.AirplaneMode.xml | 16 + .../xml/org.deepin.daemon.Bluetooth.xml | 155 ++++++ plugins/datetime/CMakeLists.txt | 21 +- plugins/datetime/datetime.json | 2 +- plugins/datetime/datetimeplugin.cpp | 10 +- plugins/datetime/datetimewidget.cpp | 2 +- plugins/datetime/datetimewidget.h | 4 +- .../datetime/dbusinterface/types/zoneinfo.cpp | 92 +++ .../datetime/dbusinterface/types/zoneinfo.h | 66 +++ .../xml/org.deepin.daemon.Timedate.xml | 62 +++ plugins/keyboard-layout/CMakeLists.txt | 21 +- plugins/keyboard-layout/dbusadaptors.h | 4 +- .../types/keyboardlayoutlist.cpp | 32 ++ .../dbusinterface/types/keyboardlayoutlist.h | 38 ++ ...org.deepin.daemon.InputDevice.Keyboard.xml | 35 ++ plugins/onboard/CMakeLists.txt | 19 +- .../onboard/dbusinterface/types/arealist.cpp | 59 ++ .../onboard/dbusinterface/types/arealist.h | 53 ++ .../xml/org.deepin.dde.daemon.Dock.Entry.xml | 8 + .../xml/org.deepin.dde.daemon.Dock.xml | 3 + plugins/onboard/onboardplugin.cpp | 22 +- plugins/power/CMakeLists.txt | 19 +- plugins/power/dbus/dbusaccount.cpp | 3 +- plugins/power/dbus/dbusaccount.h | 12 +- plugins/power/dbus/dbuspower.cpp | 4 +- plugins/power/dbus/dbuspower.h | 12 +- .../xml/org.deepin.system.SystemPower.xml | 36 ++ plugins/power/power.json | 2 +- plugins/power/powerplugin.cpp | 2 +- plugins/power/powerplugin.h | 4 +- plugins/shutdown/dbus/dbusaccount.cpp | 2 +- plugins/shutdown/dbus/dbusaccount.h | 12 +- plugins/shutdown/dbus/dbuspowermanager.cpp | 2 +- plugins/shutdown/dbus/dbuspowermanager.h | 6 +- plugins/shutdown/shutdownplugin.cpp | 2 +- plugins/sound/CMakeLists.txt | 22 +- .../sound/dbusinterface/types/audioport.cpp | 34 ++ plugins/sound/dbusinterface/types/audioport.h | 76 +++ .../dbusinterface/types/audioportlist.cpp | 32 ++ .../sound/dbusinterface/types/audioportlist.h | 40 ++ .../xml/org.deepin.daemon.Audio.Sink.xml | 38 ++ .../xml/org.deepin.daemon.Audio.xml | 46 ++ plugins/sound/sound.json | 2 +- plugins/sound/soundapplet.cpp | 6 +- plugins/sound/soundapplet.h | 8 +- plugins/sound/sounditem.h | 4 +- plugins/trash/CMakeLists.txt | 19 +- .../xml/org.freedesktop.FileManager.xml | 17 + plugins/trash/trashwidget.cpp | 2 +- plugins/trash/trashwidget.h | 3 +- plugins/tray/CMakeLists.txt | 62 ++- plugins/tray/dbus/dbustraymanager.cpp | 4 +- plugins/tray/dbus/dbustraymanager.h | 8 +- .../dbusinterface/types/dbusimagelist.cpp | 59 ++ .../tray/dbusinterface/types/dbusimagelist.h | 48 ++ .../tray/dbusinterface/types/dbustooltip.cpp | 57 ++ .../tray/dbusinterface/types/dbustooltip.h | 48 ++ plugins/tray/dbusinterface/types/dockrect.cpp | 50 ++ plugins/tray/dbusinterface/types/dockrect.h | 28 + .../xml/com.deepin.dde.daemon.Dock.xml | 100 ++++ .../xml/org.deepin.daemon.Gesture.xml | 27 + .../xml/org.kde.StatusNotifierItem.xml | 61 ++ .../fashiontray/fashiontraywidgetwrapper.h | 6 +- plugins/tray/snitraywidget.h | 2 +- plugins/tray/tray.json | 2 +- 145 files changed, 4551 insertions(+), 279 deletions(-) create mode 100644 frame/dbusinterface/types/arealist.cpp create mode 100644 frame/dbusinterface/types/arealist.h create mode 100644 frame/dbusinterface/types/audioport.cpp create mode 100644 frame/dbusinterface/types/audioport.h create mode 100644 frame/dbusinterface/types/audioportlist.cpp create mode 100644 frame/dbusinterface/types/audioportlist.h create mode 100644 frame/dbusinterface/types/brightnessmap.cpp create mode 100644 frame/dbusinterface/types/brightnessmap.h create mode 100644 frame/dbusinterface/types/dbusimagelist.cpp create mode 100644 frame/dbusinterface/types/dbusimagelist.h create mode 100644 frame/dbusinterface/types/dbustooltip.cpp create mode 100644 frame/dbusinterface/types/dbustooltip.h create mode 100644 frame/dbusinterface/types/dockrect.cpp create mode 100644 frame/dbusinterface/types/dockrect.h create mode 100644 frame/dbusinterface/types/keyboardlayoutlist.cpp create mode 100644 frame/dbusinterface/types/keyboardlayoutlist.h create mode 100644 frame/dbusinterface/types/resolution.cpp create mode 100644 frame/dbusinterface/types/resolution.h create mode 100644 frame/dbusinterface/types/resolutionlist.cpp create mode 100644 frame/dbusinterface/types/resolutionlist.h create mode 100644 frame/dbusinterface/types/screenrect.cpp create mode 100644 frame/dbusinterface/types/screenrect.h create mode 100644 frame/dbusinterface/types/touchscreeninfolist.cpp create mode 100644 frame/dbusinterface/types/touchscreeninfolist.h create mode 100644 frame/dbusinterface/types/touchscreeninfolist_v2.cpp create mode 100644 frame/dbusinterface/types/touchscreeninfolist_v2.h create mode 100644 frame/dbusinterface/types/touchscreenmap.cpp create mode 100644 frame/dbusinterface/types/touchscreenmap.h create mode 100644 frame/dbusinterface/types/zoneinfo.cpp create mode 100644 frame/dbusinterface/types/zoneinfo.h create mode 100644 frame/dbusinterface/xml/com.deepin.dde.daemon.Dock.xml create mode 100644 frame/dbusinterface/xml/org.deepin.api.XEventMonitor.xml create mode 100644 frame/dbusinterface/xml/org.deepin.daemon.Audio.Sink.xml create mode 100644 frame/dbusinterface/xml/org.deepin.daemon.Audio.xml create mode 100644 frame/dbusinterface/xml/org.deepin.daemon.Display.xml create mode 100644 frame/dbusinterface/xml/org.deepin.daemon.Gesture.xml create mode 100644 frame/dbusinterface/xml/org.deepin.daemon.Timedate.xml create mode 100644 frame/dbusinterface/xml/org.deepin.dde.Launcher.xml create mode 100644 frame/dbusinterface/xml/org.freedesktop.FileManager.xml create mode 100644 frame/dbusinterface/xml/org.kde.StatusNotifierItem.xml create mode 100644 frame/qtdbusextended/DBusExtended create mode 100644 frame/qtdbusextended/DBusExtendedAbstractInterface create mode 100644 frame/qtdbusextended/dbusextended.h create mode 100644 frame/qtdbusextended/dbusextendedabstractinterface.cpp create mode 100644 frame/qtdbusextended/dbusextendedabstractinterface.h create mode 100644 frame/qtdbusextended/dbusextendedpendingcallwatcher.cpp create mode 100644 frame/qtdbusextended/dbusextendedpendingcallwatcher_p.h create mode 100644 plugins/airplane-mode/dbusinterface/xml/org.deepin.daemon.AirplaneMode.xml create mode 100644 plugins/bluetooth/dbusinterface/xml/org.deepin.daemon.AirplaneMode.xml create mode 100644 plugins/bluetooth/dbusinterface/xml/org.deepin.daemon.Bluetooth.xml create mode 100644 plugins/datetime/dbusinterface/types/zoneinfo.cpp create mode 100644 plugins/datetime/dbusinterface/types/zoneinfo.h create mode 100644 plugins/datetime/dbusinterface/xml/org.deepin.daemon.Timedate.xml create mode 100644 plugins/keyboard-layout/dbusinterface/types/keyboardlayoutlist.cpp create mode 100644 plugins/keyboard-layout/dbusinterface/types/keyboardlayoutlist.h create mode 100644 plugins/keyboard-layout/dbusinterface/xml/org.deepin.daemon.InputDevice.Keyboard.xml create mode 100644 plugins/onboard/dbusinterface/types/arealist.cpp create mode 100644 plugins/onboard/dbusinterface/types/arealist.h create mode 100644 plugins/onboard/dbusinterface/xml/org.deepin.dde.daemon.Dock.Entry.xml create mode 100644 plugins/onboard/dbusinterface/xml/org.deepin.dde.daemon.Dock.xml create mode 100644 plugins/power/dbusinterface/xml/org.deepin.system.SystemPower.xml create mode 100644 plugins/sound/dbusinterface/types/audioport.cpp create mode 100644 plugins/sound/dbusinterface/types/audioport.h create mode 100644 plugins/sound/dbusinterface/types/audioportlist.cpp create mode 100644 plugins/sound/dbusinterface/types/audioportlist.h create mode 100644 plugins/sound/dbusinterface/xml/org.deepin.daemon.Audio.Sink.xml create mode 100644 plugins/sound/dbusinterface/xml/org.deepin.daemon.Audio.xml create mode 100644 plugins/trash/dbusinterface/xml/org.freedesktop.FileManager.xml create mode 100644 plugins/tray/dbusinterface/types/dbusimagelist.cpp create mode 100644 plugins/tray/dbusinterface/types/dbusimagelist.h create mode 100644 plugins/tray/dbusinterface/types/dbustooltip.cpp create mode 100644 plugins/tray/dbusinterface/types/dbustooltip.h create mode 100644 plugins/tray/dbusinterface/types/dockrect.cpp create mode 100644 plugins/tray/dbusinterface/types/dockrect.h create mode 100644 plugins/tray/dbusinterface/xml/com.deepin.dde.daemon.Dock.xml create mode 100644 plugins/tray/dbusinterface/xml/org.deepin.daemon.Gesture.xml create mode 100644 plugins/tray/dbusinterface/xml/org.kde.StatusNotifierItem.xml diff --git a/.gitignore b/.gitignore index 75e419f14..92a677700 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ CMakeLists.txt.user* # binary file dde-dock .vscode + +*/dbusinterface/generation_dbus_interface/ +*/*/dbusinterface/generation_dbus_interface/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 60e04ce85..c0a0ad527 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,24 @@ if (${EXIT_CODE} EQUAL 0) endif() endif() +function(generation_dbus_interface xmldir outdir) + IF(NOT EXISTS ${outdir}) + execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${outdir}) + ENDIF() + 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") add_compile_definitions(USE_AM) diff --git a/debian/control b/debian/control index 66aa5d90c..fa1f3b86e 100644 --- a/debian/control +++ b/debian/control @@ -20,7 +20,6 @@ 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, @@ -29,6 +28,7 @@ Build-Depends: debhelper (>= 8.0.0), libxcursor-dev, libqt5waylandclient5-dev, qtwayland5-private-dev, + libxdamage-dev, libdwayland-dev Standards-Version: 3.9.8 Homepage: http://www.deepin.org/ diff --git a/frame/CMakeLists.txt b/frame/CMakeLists.txt index 1c6775afd..456d0f599 100644 --- a/frame/CMakeLists.txt +++ b/frame/CMakeLists.txt @@ -9,8 +9,19 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug") 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" + "./dbusinterface/generation_dbus_interface/*.h" + "./dbusinterface/generation_dbus_interface/*.cpp" + "./qtdbusextended/*.h" + "./qtdbusextended/*.cpp" + "./dbusinterface/types/*.h" + "./dbusinterface/types/*.cpp") # Find the library find_package(PkgConfig REQUIRED) @@ -26,7 +37,6 @@ find_package(DtkCMake REQUIRED) find_package(dbusmenu-qt5 REQUIRED) pkg_check_modules(XCB_EWMH REQUIRED xcb-image xcb-ewmh xcb-composite xtst x11 dbusmenu-qt5 xext xcursor) -pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) pkg_check_modules(QGSettings REQUIRED gsettings-qt) pkg_check_modules(DtkGUI REQUIRED dtkgui) @@ -43,7 +53,6 @@ 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} @@ -56,6 +65,9 @@ target_include_directories(${BIN_NAME} PUBLIC ${Qt5XkbCommonSupport_PRIVATE_INCLUDE_DIRS} ../interfaces ../widgets + ./dbusinterface/generation_dbus_interface + ./qtdbusextended/ + ./dbusinterface accessible controller dbus @@ -82,7 +94,6 @@ target_include_directories(${BIN_NAME} PUBLIC target_link_libraries(${BIN_NAME} PRIVATE ${XCB_EWMH_LIBRARIES} - ${DFrameworkDBus_LIBRARIES} ${DtkWidget_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Gui_LIBRARIES} diff --git a/frame/dbus/dockinterface.cpp b/frame/dbus/dockinterface.cpp index f2f222920..8a5ab875f 100644 --- a/frame/dbus/dockinterface.cpp +++ b/frame/dbus/dockinterface.cpp @@ -21,59 +21,13 @@ #include "dockinterface.h" +#include "com_deepin_dde_daemon_dock.h" + #ifdef USE_AM // 因为 types/dockrect.h 文件中定义了DockRect类,而在此处也定义了DockRect, // 所以在此处先加上DOCKRECT_H宏(types/dockrect.h文件中定义的宏)来禁止包含types/dockrect.h头文件 // 否则会出现重复定义的错误 #define DOCKRECT_H -#include - -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"); - qDBusRegisterMetaType(); -} /* * Implementation of interface class __Dock diff --git a/frame/dbus/dockinterface.h b/frame/dbus/dockinterface.h index 70aaf9bee..21cc0a4fc 100644 --- a/frame/dbus/dockinterface.h +++ b/frame/dbus/dockinterface.h @@ -24,6 +24,8 @@ #ifdef USE_AM +#include "types/dockrect.h" + #include #include #include @@ -39,25 +41,6 @@ class DockPrivate; class WM; -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(); class Dde_Dock : public QDBusAbstractInterface diff --git a/frame/dbusinterface/types/arealist.cpp b/frame/dbusinterface/types/arealist.cpp new file mode 100644 index 000000000..e4055ada2 --- /dev/null +++ b/frame/dbusinterface/types/arealist.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * zhaolong + * + * 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 . + */ + +#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"); + qDBusRegisterMetaType(); + + qRegisterMetaType("AreaList"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/arealist.h b/frame/dbusinterface/types/arealist.h new file mode 100644 index 000000000..be61f028c --- /dev/null +++ b/frame/dbusinterface/types/arealist.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * zhaolong + * + * 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 . + */ + +#ifndef AREALIST_H +#define AREALIST_H + +#include +#include +#include + +struct MonitRect { + int x1; + int y1; + int x2; + int y2; + + bool operator ==(const MonitRect& rect); +}; + +typedef QList 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 diff --git a/frame/dbusinterface/types/audioport.cpp b/frame/dbusinterface/types/audioport.cpp new file mode 100644 index 000000000..6ea641338 --- /dev/null +++ b/frame/dbusinterface/types/audioport.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#include + +#include "audioport.h" + +void registerAudioPortMetaType() +{ + qRegisterMetaType("AudioPort"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/audioport.h b/frame/dbusinterface/types/audioport.h new file mode 100644 index 000000000..5b3800759 --- /dev/null +++ b/frame/dbusinterface/types/audioport.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef AUDIOPORT_H +#define AUDIOPORT_H + +#include +#include +#include +#include + +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 diff --git a/frame/dbusinterface/types/audioportlist.cpp b/frame/dbusinterface/types/audioportlist.cpp new file mode 100644 index 000000000..c6d4ad991 --- /dev/null +++ b/frame/dbusinterface/types/audioportlist.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#include "audioportlist.h" + +void registerAudioPortListMetaType() +{ + qRegisterMetaType("AudioPortList"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/audioportlist.h b/frame/dbusinterface/types/audioportlist.h new file mode 100644 index 000000000..c48d47d31 --- /dev/null +++ b/frame/dbusinterface/types/audioportlist.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef AUDIOPORTLIST_H +#define AUDIOPORTLIST_H + +#include +#include + +#include "audioport.h" + +typedef QList AudioPortList; + +Q_DECLARE_METATYPE(AudioPortList) + +void registerAudioPortListMetaType(); + +#endif // AUDIOPORTLIST_H diff --git a/frame/dbusinterface/types/brightnessmap.cpp b/frame/dbusinterface/types/brightnessmap.cpp new file mode 100644 index 000000000..6acab419c --- /dev/null +++ b/frame/dbusinterface/types/brightnessmap.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#include "brightnessmap.h" + +void registerBrightnessMapMetaType() +{ + qRegisterMetaType("BrightnessMap"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/brightnessmap.h b/frame/dbusinterface/types/brightnessmap.h new file mode 100644 index 000000000..0ba1e9d83 --- /dev/null +++ b/frame/dbusinterface/types/brightnessmap.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef BRIGHTNESSMAP_H +#define BRIGHTNESSMAP_H + +#include +#include + +typedef QMap BrightnessMap; + +void registerBrightnessMapMetaType(); + +#endif // BRIGHTNESSMAP_H diff --git a/frame/dbusinterface/types/dbusimagelist.cpp b/frame/dbusinterface/types/dbusimagelist.cpp new file mode 100644 index 000000000..a317fd279 --- /dev/null +++ b/frame/dbusinterface/types/dbusimagelist.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: listenerri + * + * Maintainer: listenerri + * + * 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 . + */ + +#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"); + qDBusRegisterMetaType(); + + qRegisterMetaType("DBusImageList"); + qDBusRegisterMetaType(); +} + +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); +} diff --git a/frame/dbusinterface/types/dbusimagelist.h b/frame/dbusinterface/types/dbusimagelist.h new file mode 100644 index 000000000..cf1aae42a --- /dev/null +++ b/frame/dbusinterface/types/dbusimagelist.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: listenerri + * + * Maintainer: listenerri + * + * 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 . + */ + +#ifndef DBUSIMAGELIST_H +#define DBUSIMAGELIST_H + +#include +#include +#include + +struct DBusImage +{ + int width; + int height; + QByteArray pixels; +}; +Q_DECLARE_METATYPE(DBusImage) + +typedef QList 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 diff --git a/frame/dbusinterface/types/dbustooltip.cpp b/frame/dbusinterface/types/dbustooltip.cpp new file mode 100644 index 000000000..4f3f1766e --- /dev/null +++ b/frame/dbusinterface/types/dbustooltip.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: listenerri + * + * Maintainer: listenerri + * + * 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 . + */ + +#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"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/dbustooltip.h b/frame/dbusinterface/types/dbustooltip.h new file mode 100644 index 000000000..d7b0e1fa8 --- /dev/null +++ b/frame/dbusinterface/types/dbustooltip.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: listenerri + * + * Maintainer: listenerri + * + * 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 . + */ + +#ifndef DBUSTOOLTIP_H +#define DBUSTOOLTIP_H + +#include "dbusimagelist.h" + +#include +#include +#include + +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 diff --git a/frame/dbusinterface/types/dockrect.cpp b/frame/dbusinterface/types/dockrect.cpp new file mode 100644 index 000000000..560714a30 --- /dev/null +++ b/frame/dbusinterface/types/dockrect.cpp @@ -0,0 +1,50 @@ +#include "dockrect.h" +#include + +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"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/dockrect.h b/frame/dbusinterface/types/dockrect.h new file mode 100644 index 000000000..88ae33ea2 --- /dev/null +++ b/frame/dbusinterface/types/dockrect.h @@ -0,0 +1,28 @@ +#ifndef DOCKRECT_H +#define DOCKRECT_H + +#include +#include + +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 diff --git a/frame/dbusinterface/types/keyboardlayoutlist.cpp b/frame/dbusinterface/types/keyboardlayoutlist.cpp new file mode 100644 index 000000000..abb2e010c --- /dev/null +++ b/frame/dbusinterface/types/keyboardlayoutlist.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#include "keyboardlayoutlist.h" + +void registerKeyboardLayoutListMetaType() +{ + qRegisterMetaType("KeyboardLayoutList"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/keyboardlayoutlist.h b/frame/dbusinterface/types/keyboardlayoutlist.h new file mode 100644 index 000000000..046f363fc --- /dev/null +++ b/frame/dbusinterface/types/keyboardlayoutlist.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef KEYBOARDLAYOUTLIST_H +#define KEYBOARDLAYOUTLIST_H + +#include +#include +#include +#include + +typedef QMap KeyboardLayoutList; + +void registerKeyboardLayoutListMetaType(); + +#endif // KEYBOARDLAYOUTLIST_H diff --git a/frame/dbusinterface/types/resolution.cpp b/frame/dbusinterface/types/resolution.cpp new file mode 100644 index 000000000..464fff045 --- /dev/null +++ b/frame/dbusinterface/types/resolution.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#include "resolution.h" + +#include + +void registerResolutionMetaType() +{ + qRegisterMetaType("Resolution"); + qDBusRegisterMetaType(); +} + +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; +} diff --git a/frame/dbusinterface/types/resolution.h b/frame/dbusinterface/types/resolution.h new file mode 100644 index 000000000..80b69cde2 --- /dev/null +++ b/frame/dbusinterface/types/resolution.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef RESOLUTION_H +#define RESOLUTION_H + +#include + +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 diff --git a/frame/dbusinterface/types/resolutionlist.cpp b/frame/dbusinterface/types/resolutionlist.cpp new file mode 100644 index 000000000..8d5d4d3e9 --- /dev/null +++ b/frame/dbusinterface/types/resolutionlist.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#include "resolutionlist.h" + +void registerResolutionListMetaType() +{ + registerResolutionMetaType(); + + qRegisterMetaType("ResolutionList"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/resolutionlist.h b/frame/dbusinterface/types/resolutionlist.h new file mode 100644 index 000000000..926a1dc78 --- /dev/null +++ b/frame/dbusinterface/types/resolutionlist.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef RESOLUTIONLIST_H +#define RESOLUTIONLIST_H + +#include "resolution.h" + +#include + +typedef QList ResolutionList; + +void registerResolutionListMetaType(); + +#endif // RESOLUTIONLIST_H diff --git a/frame/dbusinterface/types/screenrect.cpp b/frame/dbusinterface/types/screenrect.cpp new file mode 100644 index 000000000..f69bca06b --- /dev/null +++ b/frame/dbusinterface/types/screenrect.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#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"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/screenrect.h b/frame/dbusinterface/types/screenrect.h new file mode 100644 index 000000000..08fa3a8d6 --- /dev/null +++ b/frame/dbusinterface/types/screenrect.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef SCREENRECT_H +#define SCREENRECT_H + +#include +#include +#include +#include + +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 diff --git a/frame/dbusinterface/types/touchscreeninfolist.cpp b/frame/dbusinterface/types/touchscreeninfolist.cpp new file mode 100644 index 000000000..8b402d4a7 --- /dev/null +++ b/frame/dbusinterface/types/touchscreeninfolist.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: quezhiyong + * + * Maintainer: quezhiyong + * + * 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 . + */ + +#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"); + qDBusRegisterMetaType(); +} + +void registerTouchscreenInfoListMetaType() +{ + registerTouchscreenInfoMetaType(); + + qRegisterMetaType("TouchscreenInfoList"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/touchscreeninfolist.h b/frame/dbusinterface/types/touchscreeninfolist.h new file mode 100644 index 000000000..de4202082 --- /dev/null +++ b/frame/dbusinterface/types/touchscreeninfolist.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: quezhiyong + * + * Maintainer: quezhiyong + * + * 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 . + */ + +#ifndef TOUCHSCREENINFOLIST_H +#define TOUCHSCREENINFOLIST_H + +#include +#include +#include + +struct TouchscreenInfo { + qint32 id; + QString name; + QString deviceNode; + QString serialNumber; + + bool operator ==(const TouchscreenInfo& info); +}; + +typedef QList 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 diff --git a/frame/dbusinterface/types/touchscreeninfolist_v2.cpp b/frame/dbusinterface/types/touchscreeninfolist_v2.cpp new file mode 100644 index 000000000..cf9695c22 --- /dev/null +++ b/frame/dbusinterface/types/touchscreeninfolist_v2.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: quezhiyong + * + * Maintainer: quezhiyong + * + * 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 . + */ + +#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"); + qDBusRegisterMetaType(); +} + +void registerTouchscreenInfoList_V2MetaType() +{ + registerTouchscreenInfoV2MetaType(); + + qRegisterMetaType("TouchscreenInfoList_V2"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/touchscreeninfolist_v2.h b/frame/dbusinterface/types/touchscreeninfolist_v2.h new file mode 100644 index 000000000..862319d76 --- /dev/null +++ b/frame/dbusinterface/types/touchscreeninfolist_v2.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: quezhiyong + * + * Maintainer: quezhiyong + * + * 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 . + */ + +#ifndef TOUCHSCREENINFOLISTV2_H +#define TOUCHSCREENINFOLISTV2_H + +#include +#include +#include + +struct TouchscreenInfo_V2 { + qint32 id; + QString name; + QString deviceNode; + QString serialNumber; + QString UUID; + + bool operator ==(const TouchscreenInfo_V2& info); +}; + +typedef QList 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 diff --git a/frame/dbusinterface/types/touchscreenmap.cpp b/frame/dbusinterface/types/touchscreenmap.cpp new file mode 100644 index 000000000..9f43d61b4 --- /dev/null +++ b/frame/dbusinterface/types/touchscreenmap.cpp @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: quezhiyong + * + * Maintainer: quezhiyong + * + * 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 . + */ + +#include "touchscreenmap.h" + +void registerTouchscreenMapMetaType() +{ + qRegisterMetaType("TouchscreenMap"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/touchscreenmap.h b/frame/dbusinterface/types/touchscreenmap.h new file mode 100644 index 000000000..fa5db98c2 --- /dev/null +++ b/frame/dbusinterface/types/touchscreenmap.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: quezhiyong + * + * Maintainer: quezhiyong + * + * 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 . + */ + +#ifndef TOUCHSCREENMAP_H +#define TOUCHSCREENMAP_H + +#include +#include + +typedef QMap TouchscreenMap; + +void registerTouchscreenMapMetaType(); + +#endif // TOUCHSCREENMAP_H diff --git a/frame/dbusinterface/types/zoneinfo.cpp b/frame/dbusinterface/types/zoneinfo.cpp new file mode 100644 index 000000000..95b46df3a --- /dev/null +++ b/frame/dbusinterface/types/zoneinfo.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#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 << 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"); + qDBusRegisterMetaType(); +} diff --git a/frame/dbusinterface/types/zoneinfo.h b/frame/dbusinterface/types/zoneinfo.h new file mode 100644 index 000000000..ca7249e36 --- /dev/null +++ b/frame/dbusinterface/types/zoneinfo.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef ZONEINFO_H +#define ZONEINFO_H + +#include +#include +#include +#include +#include + +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 diff --git a/frame/dbusinterface/xml/com.deepin.dde.daemon.Dock.xml b/frame/dbusinterface/xml/com.deepin.dde.daemon.Dock.xml new file mode 100644 index 000000000..ce2cec070 --- /dev/null +++ b/frame/dbusinterface/xml/com.deepin.dde.daemon.Dock.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frame/dbusinterface/xml/org.deepin.api.XEventMonitor.xml b/frame/dbusinterface/xml/org.deepin.api.XEventMonitor.xml new file mode 100644 index 000000000..f19d6af06 --- /dev/null +++ b/frame/dbusinterface/xml/org.deepin.api.XEventMonitor.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frame/dbusinterface/xml/org.deepin.daemon.Audio.Sink.xml b/frame/dbusinterface/xml/org.deepin.daemon.Audio.Sink.xml new file mode 100644 index 000000000..347056803 --- /dev/null +++ b/frame/dbusinterface/xml/org.deepin.daemon.Audio.Sink.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + \n + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/frame/dbusinterface/xml/org.deepin.daemon.Audio.xml b/frame/dbusinterface/xml/org.deepin.daemon.Audio.xml new file mode 100644 index 000000000..056518152 --- /dev/null +++ b/frame/dbusinterface/xml/org.deepin.daemon.Audio.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frame/dbusinterface/xml/org.deepin.daemon.Display.xml b/frame/dbusinterface/xml/org.deepin.daemon.Display.xml new file mode 100644 index 000000000..7862b7175 --- /dev/null +++ b/frame/dbusinterface/xml/org.deepin.daemon.Display.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frame/dbusinterface/xml/org.deepin.daemon.Gesture.xml b/frame/dbusinterface/xml/org.deepin.daemon.Gesture.xml new file mode 100644 index 000000000..e28032954 --- /dev/null +++ b/frame/dbusinterface/xml/org.deepin.daemon.Gesture.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frame/dbusinterface/xml/org.deepin.daemon.Timedate.xml b/frame/dbusinterface/xml/org.deepin.daemon.Timedate.xml new file mode 100644 index 000000000..935a74c77 --- /dev/null +++ b/frame/dbusinterface/xml/org.deepin.daemon.Timedate.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frame/dbusinterface/xml/org.deepin.dde.Launcher.xml b/frame/dbusinterface/xml/org.deepin.dde.Launcher.xml new file mode 100644 index 000000000..bea11ef51 --- /dev/null +++ b/frame/dbusinterface/xml/org.deepin.dde.Launcher.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/frame/dbusinterface/xml/org.freedesktop.FileManager.xml b/frame/dbusinterface/xml/org.freedesktop.FileManager.xml new file mode 100644 index 000000000..fb67a6c59 --- /dev/null +++ b/frame/dbusinterface/xml/org.freedesktop.FileManager.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/frame/dbusinterface/xml/org.kde.StatusNotifierItem.xml b/frame/dbusinterface/xml/org.kde.StatusNotifierItem.xml new file mode 100644 index 000000000..f1858b46e --- /dev/null +++ b/frame/dbusinterface/xml/org.kde.StatusNotifierItem.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/frame/display/displaymanager.h b/frame/display/displaymanager.h index bc4ebfa6d..009394adf 100644 --- a/frame/display/displaymanager.h +++ b/frame/display/displaymanager.h @@ -26,8 +26,7 @@ #include "singleton.h" #include "constants.h" - -#include +#include "org_deepin_daemon_display.h" using DisplayInter = com::deepin::daemon::Display; using namespace Dock; diff --git a/frame/item/components/appdragwidget.cpp b/frame/item/components/appdragwidget.cpp index 5ef5e73e7..f98a5f9ed 100644 --- a/frame/item/components/appdragwidget.cpp +++ b/frame/item/components/appdragwidget.cpp @@ -24,13 +24,13 @@ #include "utils.h" #include "displaymanager.h" -#include +#include "org_deepin_api_xeventmonitor.h" #define SPLIT_NONE 0 #define SPLIT_LEFT 1 #define SPLIT_RIGHT 2 -using XEventMonitor = ::com::deepin::api::XEventMonitor; +using XEventMonitor = ::org::deepin::api::XEventMonitor1; AppDragWidget::AppDragWidget(QWidget *parent) : QGraphicsView(parent) diff --git a/frame/model/volumemodel.cpp b/frame/model/volumemodel.cpp index 45f2b2074..45d2845cd 100644 --- a/frame/model/volumemodel.cpp +++ b/frame/model/volumemodel.cpp @@ -11,8 +11,8 @@ * @param parent */ -static const QString serviceName = QString("com.deepin.daemon.Audio"); -static const QString servicePath = QString("/com/deepin/daemon/Audio"); +static const QString serviceName = QString("org.deepin.daemon.Audio1"); +static const QString servicePath = QString("/org/deepin/daemon/Audio1"); VolumeModel::VolumeModel(QObject *parent) : QObject(parent) diff --git a/frame/model/volumemodel.h b/frame/model/volumemodel.h index 8903cea23..ab3b82e92 100644 --- a/frame/model/volumemodel.h +++ b/frame/model/volumemodel.h @@ -1,13 +1,13 @@ #ifndef VOLUMNMODEL_H #define VOLUMNMODEL_H +#include "org_deepin_daemon_audio.h" +#include "org_deepin_daemon_audio_sink.h" + #include -#include -#include - -using DBusAudio = com::deepin::daemon::Audio; -using DBusSink = com::deepin::daemon::audio::Sink; +using DBusAudio = org::deepin::daemon::Audio1; +using DBusSink = org::deepin::daemon::audio1::Sink; class QDBusMessage; class AudioSink; diff --git a/frame/qtdbusextended/DBusExtended b/frame/qtdbusextended/DBusExtended new file mode 100644 index 000000000..719c49b2a --- /dev/null +++ b/frame/qtdbusextended/DBusExtended @@ -0,0 +1 @@ +#include "dbusextended.h" diff --git a/frame/qtdbusextended/DBusExtendedAbstractInterface b/frame/qtdbusextended/DBusExtendedAbstractInterface new file mode 100644 index 000000000..246af8a14 --- /dev/null +++ b/frame/qtdbusextended/DBusExtendedAbstractInterface @@ -0,0 +1 @@ +#include "dbusextendedabstractinterface.h" diff --git a/frame/qtdbusextended/dbusextended.h b/frame/qtdbusextended/dbusextended.h new file mode 100644 index 000000000..6b27aa24b --- /dev/null +++ b/frame/qtdbusextended/dbusextended.h @@ -0,0 +1,35 @@ +// -*- c++ -*- + +/*! + * + * Copyright (C) 2015 Jolla Ltd. + * + * Contact: Valerio Valerio + * Author: Andres Gomez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef QT_DBUS_EXTENDED_H +#define QT_DBUS_EXTENDED_H + +#if defined(QT_DBUS_EXTENDED_LIBRARY) +# define QT_DBUS_EXTENDED_EXPORT Q_DECL_EXPORT +#else +# define QT_DBUS_EXTENDED_EXPORT Q_DECL_IMPORT +#endif + +#endif /* QT_DBUS_EXTENDED_H */ diff --git a/frame/qtdbusextended/dbusextendedabstractinterface.cpp b/frame/qtdbusextended/dbusextendedabstractinterface.cpp new file mode 100644 index 000000000..54d46f3d3 --- /dev/null +++ b/frame/qtdbusextended/dbusextendedabstractinterface.cpp @@ -0,0 +1,525 @@ +// -*- c++ -*- + +/*! + * + * Copyright (C) 2015 Jolla Ltd. + * + * Contact: Valerio Valerio + * Author: Andres Gomez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "dbusextendedpendingcallwatcher_p.h" + +#include + +#include +#include +#include +#include +#include + +#include +#include + + +Q_GLOBAL_STATIC_WITH_ARGS(QByteArray, dBusInterface, ("org.freedesktop.DBus")) +Q_GLOBAL_STATIC_WITH_ARGS(QByteArray, dBusPropertiesInterface, ("org.freedesktop.DBus.Properties")) +Q_GLOBAL_STATIC_WITH_ARGS(QByteArray, dBusPropertiesChangedSignal, ("PropertiesChanged")) +Q_GLOBAL_STATIC_WITH_ARGS(QByteArray, propertyChangedSignature, ("propertyChanged(QString,QVariant)")) +Q_GLOBAL_STATIC_WITH_ARGS(QByteArray, propertyInvalidatedSignature, ("propertyInvalidated(QString)")) + + +DBusExtendedAbstractInterface::DBusExtendedAbstractInterface(const QString &service, const QString &path, const char *interface, const QDBusConnection &connection, QObject *parent) + : QDBusAbstractInterface(service, path, interface, connection, parent) + , m_sync(true) + , m_useCache(false) + , m_getAllPendingCallWatcher(0) + , m_propertiesChangedConnected(false) +{ + const_cast(connection).connect(QString("org.freedesktop.DBus"), QString("/org/freedesktop/DBus"), QString("org.freedesktop.DBus"), QString("NameOwnerChanged"), this, SLOT(onDBusNameOwnerChanged(QString,QString,QString))); +} + +DBusExtendedAbstractInterface::~DBusExtendedAbstractInterface() +{ +} + +void DBusExtendedAbstractInterface::setSync(bool sync) { setSync(sync, true); } + +/* + * Note: After sync is set to false, it will always return a empty value + * if you call the property's get function directly. So you can only get it + * through the changed signal when you get an property, and it's also a good idea + * to save a cache yourself. + */ + +/* + * 注意: 如果设置 sync 为 false 那么在调用属性的 get 函数获取一个属性时会一直返回空值, + * 解决方法是监听属性的 changed 信号并自行保存一份缓存, 让 changed 信号修改这个缓存 + */ +void DBusExtendedAbstractInterface::setSync(bool sync, bool autoStart) +{ + m_sync = sync; + + // init all properties + if (autoStart && !m_sync && !isValid()) + startServiceProcess(); +} + +void DBusExtendedAbstractInterface::getAllProperties() +{ + m_lastExtendedError = QDBusError(); + + if (!isValid()) { + QString errorMessage = QStringLiteral("This Extended DBus interface is not valid yet."); + m_lastExtendedError = QDBusMessage::createError(QDBusError::Failed, errorMessage); + qDebug() << Q_FUNC_INFO << errorMessage; + return; + } + + if (!m_sync && m_getAllPendingCallWatcher) { + // Call already in place, not repeating ... + return; + } + + QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), *dBusPropertiesInterface(), QStringLiteral("GetAll")); + msg << interface(); + + if (m_sync) { + QDBusMessage reply = connection().call(msg); + + if (reply.type() != QDBusMessage::ReplyMessage) { + m_lastExtendedError = QDBusError(reply); + qWarning() << Q_FUNC_INFO << m_lastExtendedError.message(); + return; + } + + if (reply.signature() != QLatin1String("a{sv}")) { + QString errorMessage = QStringLiteral("Invalid signature \"%1\" in return from call to %2") + .arg(reply.signature(), + QString(*dBusPropertiesInterface())); + qWarning() << Q_FUNC_INFO << errorMessage; + m_lastExtendedError = QDBusError(QDBusError::InvalidSignature, errorMessage); + return; + } + + QVariantMap value = reply.arguments().at(0).toMap(); + onPropertiesChanged(interface(), value, QStringList()); + } else { + QDBusPendingReply async = connection().asyncCall(msg); + m_getAllPendingCallWatcher = new QDBusPendingCallWatcher(async, this); + + connect(m_getAllPendingCallWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(onAsyncGetAllPropertiesFinished(QDBusPendingCallWatcher*))); + return; + } +} + +void DBusExtendedAbstractInterface::connectNotify(const QMetaMethod &signal) +{ + if (signal.methodType() == QMetaMethod::Signal + && (signal.methodSignature() == *propertyChangedSignature() + || signal.methodSignature() == *propertyInvalidatedSignature())) { + if (!m_propertiesChangedConnected) { + QStringList argumentMatch; + argumentMatch << interface(); + connection().connect(service(), path(), *dBusPropertiesInterface(), *dBusPropertiesChangedSignal(), + argumentMatch, QString(), + this, SLOT(onPropertiesChanged(QString, QVariantMap, QStringList))); + + m_propertiesChangedConnected = true; + return; + } + } else { + QDBusAbstractInterface::connectNotify(signal); + } +} + +void DBusExtendedAbstractInterface::disconnectNotify(const QMetaMethod &signal) +{ + if (signal.methodType() == QMetaMethod::Signal + && (signal.methodSignature() == *propertyChangedSignature() + || signal.methodSignature() == *propertyInvalidatedSignature())) { + if (m_propertiesChangedConnected + && 0 == receivers(propertyChangedSignature()->constData()) + && 0 == receivers(propertyInvalidatedSignature()->constData())) { + QStringList argumentMatch; + argumentMatch << interface(); + connection().disconnect(service(), path(), *dBusPropertiesInterface(), *dBusPropertiesChangedSignal(), + argumentMatch, QString(), + this, SLOT(onPropertiesChanged(QString, QVariantMap, QStringList))); + + m_propertiesChangedConnected = false; + return; + } + } else { + QDBusAbstractInterface::disconnectNotify(signal); + } +} + +QVariant DBusExtendedAbstractInterface::internalPropGet(const char *propname, void *propertyPtr) +{ + m_lastExtendedError = QDBusError(); + + if (m_useCache) { + int propertyIndex = metaObject()->indexOfProperty(propname); + QMetaProperty metaProperty = metaObject()->property(propertyIndex); + return QVariant(metaProperty.userType(), propertyPtr); + } + + if (m_sync) { + QVariant ret = property(propname); + + QMetaType::construct(ret.userType(), propertyPtr, ret.constData()); + + return ret; + } else { + if (!isValid()) { + QString errorMessage = QStringLiteral("This Extended DBus interface is not valid yet."); + m_lastExtendedError = QDBusMessage::createError(QDBusError::Failed, errorMessage); + qDebug() << Q_FUNC_INFO << errorMessage; + return QVariant(); + } + + int propertyIndex = metaObject()->indexOfProperty(propname); + + if (-1 == propertyIndex) { + QString errorMessage = QStringLiteral("Got unknown property \"%1\" to read") + .arg(QString::fromLatin1(propname)); + m_lastExtendedError = QDBusMessage::createError(QDBusError::Failed, errorMessage); + qWarning() << Q_FUNC_INFO << errorMessage; + return QVariant(); + } + + QMetaProperty metaProperty = metaObject()->property(propertyIndex); + + if (!metaProperty.isReadable()) { + QString errorMessage = QStringLiteral("Property \"%1\" is NOT readable") + .arg(QString::fromLatin1(propname)); + m_lastExtendedError = QDBusMessage::createError(QDBusError::Failed, errorMessage); + qWarning() << Q_FUNC_INFO << errorMessage; + return QVariant(); + } + + // is this metatype registered? + const char *expectedSignature = ""; + if (int(metaProperty.type()) != QMetaType::QVariant) { + expectedSignature = QDBusMetaType::typeToSignature(metaProperty.userType()); + if (0 == expectedSignature) { + QString errorMessage = + QStringLiteral("Type %1 must be registered with Qt D-Bus " + "before it can be used to read property " + "%2.%3") + .arg(metaProperty.typeName(), + interface(), + propname); + m_lastExtendedError = QDBusMessage::createError(QDBusError::Failed, errorMessage); + qWarning() << Q_FUNC_INFO << errorMessage; + return QVariant(); + } + } + + asyncProperty(propname); + return QVariant(metaProperty.userType(), propertyPtr); + } +} + +void DBusExtendedAbstractInterface::internalPropSet(const char *propname, const QVariant &value, void *propertyPtr) +{ + m_lastExtendedError = QDBusError(); + + if (m_sync) { + setProperty(propname, value); + } else { + if (!isValid()) { + QString errorMessage = QStringLiteral("This interface is not yet valid"); + m_lastExtendedError = QDBusMessage::createError(QDBusError::Failed, errorMessage); + qDebug() << Q_FUNC_INFO << errorMessage; + return; + } + + int propertyIndex = metaObject()->indexOfProperty(propname); + + if (-1 == propertyIndex) { + QString errorMessage = QStringLiteral("Got unknown property \"%1\" to write") + .arg(QString::fromLatin1(propname)); + m_lastExtendedError = QDBusMessage::createError(QDBusError::Failed, errorMessage); + qWarning() << Q_FUNC_INFO << errorMessage; + return; + } + + QMetaProperty metaProperty = metaObject()->property(propertyIndex); + + if (!metaProperty.isWritable()) { + QString errorMessage = QStringLiteral("Property \"%1\" is NOT writable") + .arg(QString::fromLatin1(propname)); + m_lastExtendedError = QDBusMessage::createError(QDBusError::Failed, errorMessage); + qWarning() << Q_FUNC_INFO << errorMessage; + return; + } + + QVariant variant = QVariant(metaProperty.type(), propertyPtr); + variant = value; + + asyncSetProperty(propname, variant); + } +} + +QVariant DBusExtendedAbstractInterface::asyncProperty(const QString &propertyName) +{ + QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), *dBusPropertiesInterface(), QStringLiteral("Get")); + msg << interface() << propertyName; + QDBusPendingReply async = connection().asyncCall(msg); + DBusExtendedPendingCallWatcher *watcher = new DBusExtendedPendingCallWatcher(async, propertyName, QVariant(), this); + + connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(onAsyncPropertyFinished(QDBusPendingCallWatcher*))); + + return QVariant(); +} + +void DBusExtendedAbstractInterface::asyncSetProperty(const QString &propertyName, const QVariant &value) +{ + QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), *dBusPropertiesInterface(), QStringLiteral("Set")); + + msg << interface() << propertyName << QVariant::fromValue(QDBusVariant(value)); + QDBusPendingReply<> async = connection().asyncCall(msg); + DBusExtendedPendingCallWatcher *watcher = new DBusExtendedPendingCallWatcher(async, propertyName, value, this); + + connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(onAsyncSetPropertyFinished(QDBusPendingCallWatcher*))); +} + +void DBusExtendedAbstractInterface::startServiceProcess() +{ + const QString &servName = service(); + + if (isValid()) + { + qWarning() << "Service" << servName << "is already started."; + return; + } + + QDBusMessage msg = QDBusMessage::createMethodCall("org.freedesktop.DBus", "/", *dBusInterface(), QStringLiteral("StartServiceByName")); + msg << servName << quint32(0); + QDBusPendingReply async = connection().asyncCall(msg); + QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(async, this); + + connect(watcher, &QDBusPendingCallWatcher::finished, this, &DBusExtendedAbstractInterface::onStartServiceProcessFinished); +} + +void DBusExtendedAbstractInterface::onStartServiceProcessFinished(QDBusPendingCallWatcher *w) +{ + if (w->isError()) + { + m_lastExtendedError = w->error(); + } else { + m_lastExtendedError = QDBusError(); + } + + QDBusPendingReply reply = *w; + + Q_EMIT serviceStartFinished(reply.value()); + + w->deleteLater(); +} + +void DBusExtendedAbstractInterface::onAsyncPropertyFinished(QDBusPendingCallWatcher *w) +{ + DBusExtendedPendingCallWatcher *watcher = qobject_cast(w); + Q_ASSERT(watcher); + + QDBusPendingReply reply = *watcher; + + if (reply.isError()) { + m_lastExtendedError = reply.error(); + } else { + int propertyIndex = metaObject()->indexOfProperty(watcher->asyncProperty().toLatin1().constData()); + QVariant value = demarshall(interface(), + metaObject()->property(propertyIndex), + reply.value(), + &m_lastExtendedError); + + if (m_lastExtendedError.isValid()) { + Q_EMIT propertyInvalidated(watcher->asyncProperty()); + } else { + Q_EMIT propertyChanged(watcher->asyncProperty(), value); + } + } + + Q_EMIT asyncPropertyFinished(watcher->asyncProperty()); + watcher->deleteLater(); +} + +void DBusExtendedAbstractInterface::onAsyncSetPropertyFinished(QDBusPendingCallWatcher *w) +{ + DBusExtendedPendingCallWatcher *watcher = qobject_cast(w); + Q_ASSERT(watcher); + + QDBusPendingReply<> reply = *watcher; + + if (reply.isError()) { + m_lastExtendedError = reply.error(); + } else { + m_lastExtendedError = QDBusError(); + } + + Q_EMIT asyncSetPropertyFinished(watcher->asyncProperty()); + + // Resetting the property to its previous value after sending the + // finished signal + if (reply.isError()) { + m_lastExtendedError = QDBusError(); + Q_EMIT propertyChanged(watcher->asyncProperty(), watcher->previousValue()); + } + + watcher->deleteLater(); +} + +void DBusExtendedAbstractInterface::onAsyncGetAllPropertiesFinished(QDBusPendingCallWatcher *watcher) +{ + m_getAllPendingCallWatcher = 0; + + QDBusPendingReply reply = *watcher; + + if (reply.isError()) { + m_lastExtendedError = reply.error(); + } else { + m_lastExtendedError = QDBusError(); + } + + Q_EMIT asyncGetAllPropertiesFinished(); + + if (!reply.isError()) { + onPropertiesChanged(interface(), reply.value(), QStringList()); + } + + watcher->deleteLater(); +} + +void DBusExtendedAbstractInterface::onPropertiesChanged(const QString& interfaceName, + const QVariantMap& changedProperties, + const QStringList& invalidatedProperties) +{ + if (interfaceName == interface()) { + QVariantMap::const_iterator i = changedProperties.constBegin(); + while (i != changedProperties.constEnd()) { + int propertyIndex = metaObject()->indexOfProperty(i.key().toLatin1().constData()); + + if (-1 == propertyIndex) { + qDebug() << Q_FUNC_INFO << "Got unknown changed property" << i.key(); + } else { + QVariant value = demarshall(interface(), metaObject()->property(propertyIndex), i.value(), &m_lastExtendedError); + + if (m_lastExtendedError.isValid()) { + Q_EMIT propertyInvalidated(i.key()); + } else { + Q_EMIT propertyChanged(i.key(), value); + } + } + + ++i; + } + + QStringList::const_iterator j = invalidatedProperties.constBegin(); + while (j != invalidatedProperties.constEnd()) { + if (-1 == metaObject()->indexOfProperty(j->toLatin1().constData())) { + qDebug() << Q_FUNC_INFO << "Got unknown invalidated property" << *j; + } else { + m_lastExtendedError = QDBusError(); + Q_EMIT propertyInvalidated(*j); + } + + ++j; + } + } +} + +void DBusExtendedAbstractInterface::onDBusNameOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner) +{ + if (name == service() && oldOwner.isEmpty()) + { + m_dbusOwner = newOwner; + Q_EMIT serviceValidChanged(true); + } + else if (name == m_dbusOwner && newOwner.isEmpty()) + { + m_dbusOwner.clear(); + Q_EMIT serviceValidChanged(false); + } +} + +QVariant DBusExtendedAbstractInterface::demarshall(const QString &interface, const QMetaProperty &metaProperty, const QVariant &value, QDBusError *error) +{ + Q_ASSERT(metaProperty.isValid()); + Q_ASSERT(error != 0); + + if (value.userType() == metaProperty.userType()) { + // No need demarshalling. Passing back straight away ... + *error = QDBusError(); + return value; + } + + QVariant result = QVariant(metaProperty.userType(), (void*)0); + QString errorMessage; + const char *expectedSignature = QDBusMetaType::typeToSignature(metaProperty.userType()); + + if (value.userType() == qMetaTypeId()) { + // demarshalling a DBus argument ... + QDBusArgument dbusArg = value.value(); + + if (expectedSignature == dbusArg.currentSignature().toLatin1()) { + QDBusMetaType::demarshall(dbusArg, metaProperty.userType(), result.data()); + if (!result.isValid()) { + errorMessage = QStringLiteral("Unexpected failure demarshalling " + "upon PropertiesChanged signal arrival " + "for property `%3.%4' (expected type `%5' (%6))") + .arg(interface, + QString::fromLatin1(metaProperty.name()), + QString::fromLatin1(metaProperty.typeName()), + expectedSignature); + } + } else { + errorMessage = QStringLiteral("Unexpected `user type' (%2) " + "upon PropertiesChanged signal arrival " + "for property `%3.%4' (expected type `%5' (%6))") + .arg(dbusArg.currentSignature(), + interface, + QString::fromLatin1(metaProperty.name()), + QString::fromLatin1(metaProperty.typeName()), + QString::fromLatin1(expectedSignature)); + } + } else { + const char *actualSignature = QDBusMetaType::typeToSignature(value.userType()); + + errorMessage = QStringLiteral("Unexpected `%1' (%2) " + "upon PropertiesChanged signal arrival " + "for property `%3.%4' (expected type `%5' (%6))") + .arg(QString::fromLatin1(value.typeName()), + QString::fromLatin1(actualSignature), + interface, + QString::fromLatin1(metaProperty.name()), + QString::fromLatin1(metaProperty.typeName()), + QString::fromLatin1(expectedSignature)); + } + + if (errorMessage.isEmpty()) { + *error = QDBusError(); + } else { + *error = QDBusMessage::createError(QDBusError::InvalidSignature, errorMessage); + qDebug() << Q_FUNC_INFO << errorMessage; + } + + return result; +} diff --git a/frame/qtdbusextended/dbusextendedabstractinterface.h b/frame/qtdbusextended/dbusextendedabstractinterface.h new file mode 100644 index 000000000..812d0ae29 --- /dev/null +++ b/frame/qtdbusextended/dbusextendedabstractinterface.h @@ -0,0 +1,103 @@ +// -*- c++ -*- + +/*! + * + * Copyright (C) 2015 Jolla Ltd. + * + * Contact: Valerio Valerio + * Author: Andres Gomez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#ifndef DBUSEXTENDEDABSTRACTINTERFACE_H +#define DBUSEXTENDEDABSTRACTINTERFACE_H + +#include + +#include +#include + +class QDBusPendingCallWatcher; +class DBusExtendedPendingCallWatcher; + +class QT_DBUS_EXTENDED_EXPORT DBusExtendedAbstractInterface: public QDBusAbstractInterface +{ + Q_OBJECT + +public: + virtual ~DBusExtendedAbstractInterface(); + + Q_PROPERTY(bool sync READ sync WRITE setSync) + inline bool sync() const { return m_sync; } + void setSync(bool sync); + void setSync(bool sync, bool autoStart); + + Q_PROPERTY(bool useCache READ useCache WRITE setUseCache) + inline bool useCache() const { return m_useCache; } + inline void setUseCache(bool useCache) { m_useCache = useCache; } + + void getAllProperties(); + inline QDBusError lastExtendedError() const { return m_lastExtendedError; } + +public Q_SLOTS: + void startServiceProcess(); + +protected: + DBusExtendedAbstractInterface(const QString &service, + const QString &path, + const char *interface, + const QDBusConnection &connection, + QObject *parent); + + void connectNotify(const QMetaMethod &signal); + void disconnectNotify(const QMetaMethod &signal); + QVariant internalPropGet(const char *propname, void *propertyPtr); + void internalPropSet(const char *propname, const QVariant &value, void *propertyPtr); + +Q_SIGNALS: + void serviceValidChanged(const bool valid) const; + void serviceStartFinished(const quint32 ret) const; + void propertyChanged(const QString &propertyName, const QVariant &value); + void propertyInvalidated(const QString &propertyName); + void asyncPropertyFinished(const QString &propertyName); + void asyncSetPropertyFinished(const QString &propertyName); + void asyncGetAllPropertiesFinished(); + +private Q_SLOTS: + void onPropertiesChanged(const QString& interfaceName, + const QVariantMap& changedProperties, + const QStringList& invalidatedProperties); + void onDBusNameOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner); + void onAsyncPropertyFinished(QDBusPendingCallWatcher *w); + void onAsyncSetPropertyFinished(QDBusPendingCallWatcher *w); + void onAsyncGetAllPropertiesFinished(QDBusPendingCallWatcher *watcher); + void onStartServiceProcessFinished(QDBusPendingCallWatcher *w); + +private: + QVariant asyncProperty(const QString &propertyName); + void asyncSetProperty(const QString &propertyName, const QVariant &value); + static QVariant demarshall(const QString &interface, const QMetaProperty &metaProperty, const QVariant &value, QDBusError *error); + + bool m_sync; + bool m_useCache; + QDBusPendingCallWatcher *m_getAllPendingCallWatcher; + QDBusError m_lastExtendedError; + QString m_dbusOwner; + bool m_propertiesChangedConnected; +}; + +#endif /* DBUSEXTENDEDABSTRACTINTERFACE_H */ diff --git a/frame/qtdbusextended/dbusextendedpendingcallwatcher.cpp b/frame/qtdbusextended/dbusextendedpendingcallwatcher.cpp new file mode 100644 index 000000000..a8404d935 --- /dev/null +++ b/frame/qtdbusextended/dbusextendedpendingcallwatcher.cpp @@ -0,0 +1,38 @@ +// -*- c++ -*- + +/*! + * + * Copyright (C) 2015 Jolla Ltd. + * + * Contact: Valerio Valerio + * Author: Andres Gomez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "dbusextendedpendingcallwatcher_p.h" + + +DBusExtendedPendingCallWatcher::DBusExtendedPendingCallWatcher(const QDBusPendingCall &call, const QString &asyncProperty, const QVariant &previousValue, QObject *parent) + : QDBusPendingCallWatcher(call, parent) + , m_asyncProperty(asyncProperty) + , m_previousValue(previousValue) +{ +} + +DBusExtendedPendingCallWatcher::~DBusExtendedPendingCallWatcher() +{ +} diff --git a/frame/qtdbusextended/dbusextendedpendingcallwatcher_p.h b/frame/qtdbusextended/dbusextendedpendingcallwatcher_p.h new file mode 100644 index 000000000..ff7a85da8 --- /dev/null +++ b/frame/qtdbusextended/dbusextendedpendingcallwatcher_p.h @@ -0,0 +1,67 @@ +// -*- c++ -*- + +/*! + * + * Copyright (C) 2015 Jolla Ltd. + * + * Contact: Valerio Valerio + * Author: Andres Gomez + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +// +// W A R N I N G +// ------------- +// +// This file is not part of the public API. This header file may +// change from version to version without notice, or even be +// removed. +// +// We mean it. +// +// + + +#ifndef DBUSEXTENDEDPENDINGCALLWATCHER_P_H +#define DBUSEXTENDEDPENDINGCALLWATCHER_P_H + +#include +#include + +class DBusExtendedPendingCallWatcher: public QDBusPendingCallWatcher +{ + Q_OBJECT + +public: + explicit DBusExtendedPendingCallWatcher(const QDBusPendingCall &call, + const QString &asyncProperty, + const QVariant &previousValue, + QObject *parent = 0); + ~DBusExtendedPendingCallWatcher(); + + Q_PROPERTY(QString AsyncProperty READ asyncProperty) + inline QString asyncProperty() const { return m_asyncProperty; } + + Q_PROPERTY(QVariant PreviousValue READ previousValue) + inline QVariant previousValue() const { return m_previousValue; } + +private: + QString m_asyncProperty; + QVariant m_previousValue; +}; + +#endif /* DBUSEXTENDEDPENDINGCALLWATCHER_P_H */ diff --git a/frame/util/dbusutil.h b/frame/util/dbusutil.h index b540a3f8c..f9c8ff4d3 100644 --- a/frame/util/dbusutil.h +++ b/frame/util/dbusutil.h @@ -44,13 +44,13 @@ const QString controllCenterService = "org.deepin.dde.ControlCenter1"; const QString controllCenterPath = "/org/deepin/dde/ControlCenter1"; const QString controllCenterInterface = "org.deepin.dde.ControlCenter1"; -const QString notificationService = "org.deepin.dde.Notification1"; -const QString notificationPath = "/org/deepin/dde/Notification1"; -const QString notificationInterface = "org.deepin.dde.Notification1"; +const QString notificationService = "com.deepin.dde.Notification"; +const QString notificationPath = "/com/deepin/dde/Notification"; +const QString notificationInterface = "com.deepin.dde.Notification"; -const QString sessionManagerService = "org.deepin.SessionManager1"; -const QString sessionManagerPath = "/org/deepin/SessionManager1"; -const QString sessionManagerInterface = "org.deepin.SessionManager1"; +const QString sessionManagerService = "com.deepin.SessionManager"; +const QString sessionManagerPath = "/com/deepin/SessionManager"; +const QString sessionManagerInterface = "com.deepin.SessionManager"; #else using DockInter = com::deepin::dde::daemon::Dock; using DockEntryInter = com::deepin::dde::daemon::dock::Entry; diff --git a/frame/util/multiscreenworker.h b/frame/util/multiscreenworker.h index f82f77cd0..2ae61f496 100644 --- a/frame/util/multiscreenworker.h +++ b/frame/util/multiscreenworker.h @@ -28,8 +28,8 @@ #include "xcb_misc.h" #include "dbusutil.h" -#include -#include +#include "org_deepin_api_xeventmonitor.h" +#include "org_deepin_dde_launcher.h" #include @@ -53,8 +53,8 @@ DGUI_USE_NAMESPACE #define DRAG_AREA_SIZE (5) #define DOCKSPACE (WINDOWMARGIN * 2) -using XEventMonitor = ::com::deepin::api::XEventMonitor; -using DBusLuncher = ::com::deepin::dde::Launcher; +using XEventMonitor = ::org::deepin::api::XEventMonitor1; +using DBusLuncher = ::org::deepin::dde::Launcher1; using namespace Dock; class QVariantAnimation; diff --git a/frame/util/touchsignalmanager.h b/frame/util/touchsignalmanager.h index 599e407f5..3cd09fd7e 100644 --- a/frame/util/touchsignalmanager.h +++ b/frame/util/touchsignalmanager.h @@ -22,11 +22,11 @@ #ifndef TOUCHSIGNALMANAGER_H #define TOUCHSIGNALMANAGER_H +#include "org_deepin_daemon_gesture.h" + #include -#include - -using Gesture = com::deepin::daemon::Gesture; +using Gesture = com::deepin::daemon::Gesture1; class TouchSignalManager : public QObject { diff --git a/frame/window/components/datetimedisplayer.cpp b/frame/window/components/datetimedisplayer.cpp index 81fe0538c..df5bc4e3f 100644 --- a/frame/window/components/datetimedisplayer.cpp +++ b/frame/window/components/datetimedisplayer.cpp @@ -44,7 +44,7 @@ static QMap timeFormat{{0, "h:mm"}, {1, "hh:mm"}}; DateTimeDisplayer::DateTimeDisplayer(QWidget *parent) : QWidget (parent) - , m_timedateInter(new Timedate("com.deepin.daemon.Timedate", "/com/deepin/daemon/Timedate", QDBusConnection::sessionBus(), this)) + , m_timedateInter(new Timedate("org.deepin.daemon.Timedate1", "/org/deepin/daemon/Timedate1", QDBusConnection::sessionBus(), this)) , m_position(Dock::Position::Bottom) , m_dateFont(DFontSizeManager::instance()->t10()) , m_tipsWidget(new Dock::TipsWidget(this)) diff --git a/frame/window/components/datetimedisplayer.h b/frame/window/components/datetimedisplayer.h index 2c933c07d..587da8a11 100644 --- a/frame/window/components/datetimedisplayer.h +++ b/frame/window/components/datetimedisplayer.h @@ -23,17 +23,17 @@ #include "constants.h" +#include "org_deepin_daemon_timedate.h" + #include #include -#include - namespace Dock { class TipsWidget; } class DockPopupWindow; class QMenu; -using Timedate = com::deepin::daemon::Timedate; +using Timedate = org::deepin::daemon::Timedate1; class DateTimeDisplayer : public QWidget { diff --git a/frame/window/mainpanelcontrol.h b/frame/window/mainpanelcontrol.h index 82e32e498..cf4c7cc20 100755 --- a/frame/window/mainpanelcontrol.h +++ b/frame/window/mainpanelcontrol.h @@ -27,8 +27,6 @@ #include -#include - using namespace Dock; class QBoxLayout; diff --git a/frame/window/tray/dbustraymanager.cpp b/frame/window/tray/dbustraymanager.cpp index 638174b2f..6610d560d 100644 --- a/frame/window/tray/dbustraymanager.cpp +++ b/frame/window/tray/dbustraymanager.cpp @@ -1,6 +1,6 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DBusTrayManager -p dbustraymanager com.deepin.dde.TrayManager.xml + * Command line was: qdbusxml2cpp -c DBusTrayManager -p dbustraymanager org.deepin.dde.TrayManager.xml * * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). * @@ -16,7 +16,7 @@ */ DBusTrayManager::DBusTrayManager(QObject *parent) - : QDBusAbstractInterface("com.deepin.dde.TrayManager", "/com/deepin/dde/TrayManager", staticInterfaceName(), QDBusConnection::sessionBus(), parent) + : QDBusAbstractInterface("org.deepin.dde.TrayManager1", "/org/deepin/dde/TrayManager1", staticInterfaceName(), QDBusConnection::sessionBus(), parent) { qRegisterMetaType("TrayList"); qDBusRegisterMetaType(); diff --git a/frame/window/tray/dbustraymanager.h b/frame/window/tray/dbustraymanager.h index f587babb8..f47136cb5 100644 --- a/frame/window/tray/dbustraymanager.h +++ b/frame/window/tray/dbustraymanager.h @@ -1,6 +1,6 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DBusTrayManager -p dbustraymanager com.deepin.dde.TrayManager.xml + * Command line was: qdbusxml2cpp -c DBusTrayManager -p dbustraymanager org.deepin.dde.TrayManager.xml * * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). * @@ -23,7 +23,7 @@ typedef QList TrayList; /* - * Proxy class for interface com.deepin.dde.TrayManager + * Proxy class for interface org.deepin.dde.TrayManager1 */ class DBusTrayManager: public QDBusAbstractInterface { @@ -35,7 +35,7 @@ class DBusTrayManager: public QDBusAbstractInterface if (3 != arguments.count()) return; QString interfaceName = msg.arguments().at(0).toString(); - if (interfaceName !="com.deepin.dde.TrayManager") + if (interfaceName !="org.deepin.dde.TrayManager1") return; QVariantMap changedProps = qdbus_cast(arguments.at(1).value()); foreach(const QString &prop, changedProps.keys()) { @@ -50,7 +50,7 @@ class DBusTrayManager: public QDBusAbstractInterface } public: static inline const char *staticInterfaceName() - { return "com.deepin.dde.TrayManager"; } + { return "org.deepin.dde.TrayManager1"; } public: explicit DBusTrayManager(QObject *parent = 0); diff --git a/frame/window/tray/widgets/snitrayitemwidget.h b/frame/window/tray/widgets/snitrayitemwidget.h index 6b9488e35..eddcb4732 100644 --- a/frame/window/tray/widgets/snitrayitemwidget.h +++ b/frame/window/tray/widgets/snitrayitemwidget.h @@ -26,7 +26,7 @@ #include "basetraywidget.h" #include "dockpopupwindow.h" -#include +#include "org_kde_statusnotifieritem.h" #include #include diff --git a/frame/window/traymanagerwindow.h b/frame/window/traymanagerwindow.h index e1ff560e6..2e3580849 100644 --- a/frame/window/traymanagerwindow.h +++ b/frame/window/traymanagerwindow.h @@ -24,16 +24,16 @@ #include "constants.h" #include "dbusutil.h" -#include +#include "org_deepin_daemon_timedate.h" -#include +#include namespace Dtk { namespace Gui { class DRegionMonitor; }; namespace Widget { class DBlurEffectWidget; } } using namespace Dtk::Widget; -using Timedate = com::deepin::daemon::Timedate; +using Timedate = org::deepin::daemon::Timedate1; class QuickPluginWindow; class QBoxLayout; diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 133748410..3bcb30dc3 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -11,5 +11,4 @@ add_subdirectory("overlay-warning") add_subdirectory("show-desktop") add_subdirectory("multitasking") add_subdirectory("bluetooth") -#add_subdirectory("dcc-dock-plugin") add_subdirectory("airplane-mode") diff --git a/plugins/airplane-mode/CMakeLists.txt b/plugins/airplane-mode/CMakeLists.txt index 35df5c525..5a8bab952 100644 --- a/plugins/airplane-mode/CMakeLists.txt +++ b/plugins/airplane-mode/CMakeLists.txt @@ -3,8 +3,19 @@ set(PLUGIN_NAME "airplane-mode") project(${PLUGIN_NAME}) +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" "../../frame/util/imageutil.h" "../../frame/util/imageutil.cpp") +file(GLOB_RECURSE SRCS "*.h" + "*.cpp" + "../../widgets/*.h" + "../../widgets/*.cpp" + "../../frame/util/imageutil.h" + "../../frame/util/imageutil.cpp" + "./dbusinterface/generation_dbus_interface/*.h" + "./dbusinterface/generation_dbus_interface/*.cpp" + "../../frame/qtdbusextended/*.h" + "../../frame/qtdbusextended/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) @@ -13,28 +24,27 @@ find_package(Qt5DBus REQUIRED) find_package(DtkWidget REQUIRED) pkg_check_modules(XCB_EWMH REQUIRED xcb-ewmh x11 xcursor) -pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) pkg_check_modules(QGSettings REQUIRED gsettings-qt) add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") add_library(${PLUGIN_NAME} SHARED ${SRCS} resources/airplane_mode.qrc) set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../system-trays) + target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} - ${DFrameworkDBus_INCLUDE_DIRS} ${QGSettings_INCLUDE_DIRS} ../../interfaces ../../widgets ../../frame ../../frame/util - ) + ../../frame/qtdbusextended + ./dbusinterface/generation_dbus_interface) + target_link_libraries(${PLUGIN_NAME} PRIVATE ${XCB_EWMH_LIBRARIES} ${DtkWidget_LIBRARIES} - ${DFrameworkDBus_LIBRARIES} ${QGSettings_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Widgets_LIBRARIES} - ${Qt5Svg_LIBRARIES} -) + ${Qt5Svg_LIBRARIES}) install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins/system-trays) diff --git a/plugins/airplane-mode/airplanemodeitem.cpp b/plugins/airplane-mode/airplanemodeitem.cpp index c78c94370..7147307c3 100644 --- a/plugins/airplane-mode/airplanemodeitem.cpp +++ b/plugins/airplane-mode/airplanemodeitem.cpp @@ -43,8 +43,8 @@ AirplaneModeItem::AirplaneModeItem(QWidget *parent) : QWidget(parent) , m_tipsLabel(new Dock::TipsWidget(this)) , m_applet(new AirplaneModeApplet(this)) - , m_airplaneModeInter(new DBusAirplaneMode("com.deepin.daemon.AirplaneMode", - "/com/deepin/daemon/AirplaneMode", + , m_airplaneModeInter(new DBusAirplaneMode("org.deepin.daemon.AirplaneMode1", + "/org/deepin/daemon/AirplaneMode1", QDBusConnection::systemBus(), this)) { diff --git a/plugins/airplane-mode/airplanemodeitem.h b/plugins/airplane-mode/airplanemodeitem.h index 9147f55f1..8517d475d 100644 --- a/plugins/airplane-mode/airplanemodeitem.h +++ b/plugins/airplane-mode/airplanemodeitem.h @@ -23,11 +23,11 @@ #ifndef AIRPLANEMODEITEM_H #define AIRPLANEMODEITEM_H -#include +#include "org_deepin_daemon_airplanemode.h" #include -using DBusAirplaneMode = com::deepin::daemon::AirplaneMode; +using DBusAirplaneMode = org::deepin::daemon::AirplaneMode1; namespace Dock { class TipsWidget; diff --git a/plugins/airplane-mode/dbusinterface/xml/org.deepin.daemon.AirplaneMode.xml b/plugins/airplane-mode/dbusinterface/xml/org.deepin.daemon.AirplaneMode.xml new file mode 100644 index 000000000..b558d3014 --- /dev/null +++ b/plugins/airplane-mode/dbusinterface/xml/org.deepin.daemon.AirplaneMode.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/plugins/bluetooth/CMakeLists.txt b/plugins/bluetooth/CMakeLists.txt index fe091ff8c..3072dd5c2 100644 --- a/plugins/bluetooth/CMakeLists.txt +++ b/plugins/bluetooth/CMakeLists.txt @@ -3,11 +3,23 @@ set(PLUGIN_NAME "bluetooth") project(${PLUGIN_NAME}) +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" - "../../frame/util/imageutil.h" "../../frame/util/imageutil.cpp" - "../../frame/util/statebutton.h" "../../frame/util/statebutton.cpp" - "../../frame/util/horizontalseperator.h" "../../frame/util/horizontalseperator.cpp") +file(GLOB_RECURSE SRCS "*.h" + "*.cpp" + "../../widgets/*.h" + "../../widgets/*.cpp" + "../../frame/util/imageutil.h" + "../../frame/util/imageutil.cpp" + "../../frame/util/statebutton.h" + "../../frame/util/statebutton.cpp" + "../../frame/util/horizontalseperator.h" + "../../frame/util/horizontalseperator.cpp" + "./dbusinterface/generation_dbus_interface/*.h" + "./dbusinterface/generation_dbus_interface/*.cpp" + "../../frame/qtdbusextended/*.h" + "../../frame/qtdbusextended/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) @@ -16,23 +28,22 @@ find_package(Qt5DBus REQUIRED) find_package(DtkWidget REQUIRED) pkg_check_modules(XCB_EWMH REQUIRED xcb-ewmh x11 xcursor) -pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) pkg_check_modules(QGSettings REQUIRED gsettings-qt) add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") add_library(${PLUGIN_NAME} SHARED ${SRCS} resources/bluetooth.qrc) set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../system-trays) target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} - ${DFrameworkDBus_INCLUDE_DIRS} ${QGSettings_INCLUDE_DIRS} ../../interfaces ../../frame + ../../frame/qtdbusextended + ./dbusinterface/generation_dbus_interface componments) target_link_libraries(${PLUGIN_NAME} PRIVATE ${XCB_EWMH_LIBRARIES} ${DtkWidget_LIBRARIES} - ${DFrameworkDBus_LIBRARIES} ${QGSettings_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Widgets_LIBRARIES} diff --git a/plugins/bluetooth/bluetooth.json b/plugins/bluetooth/bluetooth.json index 71ae6746f..8400bab79 100644 --- a/plugins/bluetooth/bluetooth.json +++ b/plugins/bluetooth/bluetooth.json @@ -1,4 +1,4 @@ { "api": "2.0.0", - "depends-daemon-dbus-service": "com.deepin.daemon.Bluetooth" + "depends-daemon-dbus-service": "org.deepin.daemon.Bluetooth1" } diff --git a/plugins/bluetooth/componments/adaptersmanager.cpp b/plugins/bluetooth/componments/adaptersmanager.cpp index 9f3a6f8d3..59b529fcf 100644 --- a/plugins/bluetooth/componments/adaptersmanager.cpp +++ b/plugins/bluetooth/componments/adaptersmanager.cpp @@ -31,8 +31,8 @@ AdaptersManager::AdaptersManager(QObject *parent) : QObject(parent) - , m_bluetoothInter(new DBusBluetooth("com.deepin.daemon.Bluetooth", - "/com/deepin/daemon/Bluetooth", + , m_bluetoothInter(new DBusBluetooth("org.deepin.daemon.Bluetooth1", + "/org/deepin/daemon/Bluetooth1", QDBusConnection::sessionBus(), this)) { @@ -65,9 +65,9 @@ AdaptersManager::AdaptersManager(QObject *parent) }); #endif - QDBusInterface inter("com.deepin.daemon.Bluetooth", - "/com/deepin/daemon/Bluetooth", - "com.deepin.daemon.Bluetooth", + QDBusInterface inter("org.deepin.daemon.Bluetooth1", + "/org/deepin/daemon/Bluetooth1", + "org.deepin.daemon.Bluetooth1", QDBusConnection::sessionBus()); QDBusReply reply = inter.call(QDBus::Block, "GetAdapters"); const QString replyStr = reply.value(); diff --git a/plugins/bluetooth/componments/adaptersmanager.h b/plugins/bluetooth/componments/adaptersmanager.h index 1602ef809..50f96a90b 100644 --- a/plugins/bluetooth/componments/adaptersmanager.h +++ b/plugins/bluetooth/componments/adaptersmanager.h @@ -23,8 +23,8 @@ #ifndef ADAPTERSMANAGER_H #define ADAPTERSMANAGER_H -#include -using DBusBluetooth = com::deepin::daemon::Bluetooth; +#include "org_deepin_daemon_bluetooth.h" +using DBusBluetooth = org::deepin::daemon::Bluetooth1; class Adapter; class Device; diff --git a/plugins/bluetooth/componments/bluetoothadapteritem.cpp b/plugins/bluetooth/componments/bluetoothadapteritem.cpp index da68c422e..77f563160 100644 --- a/plugins/bluetooth/componments/bluetoothadapteritem.cpp +++ b/plugins/bluetooth/componments/bluetoothadapteritem.cpp @@ -150,7 +150,7 @@ BluetoothAdapterItem::BluetoothAdapterItem(Adapter *adapter, QWidget *parent) , m_itemDelegate(new DStyledItemDelegate(m_deviceListview)) , m_deviceModel(new QStandardItemModel(m_deviceListview)) , m_refreshBtn(new RefreshButton(this)) - , m_bluetoothInter(new DBusBluetooth("com.deepin.daemon.Bluetooth", "/com/deepin/daemon/Bluetooth", QDBusConnection::sessionBus(), this)) + , m_bluetoothInter(new DBusBluetooth("org.deepin.daemon.Bluetooth1", "/org/deepin/daemon/Bluetooth1", QDBusConnection::sessionBus(), this)) , m_showUnnamedDevices(false) , m_seperator(new HorizontalSeperator(this)) { diff --git a/plugins/bluetooth/componments/bluetoothadapteritem.h b/plugins/bluetooth/componments/bluetoothadapteritem.h index 628dfe31e..b26408a5b 100644 --- a/plugins/bluetooth/componments/bluetoothadapteritem.h +++ b/plugins/bluetooth/componments/bluetoothadapteritem.h @@ -32,9 +32,9 @@ #include #include -#include +#include "org_deepin_daemon_bluetooth.h" -using DBusBluetooth = com::deepin::daemon::Bluetooth; +using DBusBluetooth = org::deepin::daemon::Bluetooth1; DWIDGET_USE_NAMESPACE diff --git a/plugins/bluetooth/componments/bluetoothapplet.cpp b/plugins/bluetooth/componments/bluetoothapplet.cpp index fdc6d871b..7d684376c 100644 --- a/plugins/bluetooth/componments/bluetoothapplet.cpp +++ b/plugins/bluetooth/componments/bluetoothapplet.cpp @@ -121,13 +121,12 @@ BluetoothApplet::BluetoothApplet(QWidget *parent) , m_mainLayout(new QVBoxLayout(this)) , m_contentLayout(new QVBoxLayout(m_contentWidget)) , m_seperator(new HorizontalSeperator(this)) - , m_airPlaneModeInter(new DBusAirplaneMode("com.deepin.daemon.AirplaneMode", "/com/deepin/daemon/AirplaneMode", QDBusConnection::systemBus(), this)) + , m_airPlaneModeInter(new DBusAirplaneMode("org.deepin.daemon.AirplaneMode1", "/org/deepin/daemon/AirplaneMode1", QDBusConnection::systemBus(), this)) , m_airplaneModeEnable(false) { initUi(); initConnect(); - QScroller::grabGesture(m_scroarea, QScroller::LeftMouseButtonGesture); QScrollerProperties propertiesOne = QScroller::scroller(m_scroarea)->scrollerProperties(); QVariant overshootPolicyOne = QVariant::fromValue(QScrollerProperties::OvershootAlwaysOff); diff --git a/plugins/bluetooth/componments/bluetoothapplet.h b/plugins/bluetooth/componments/bluetoothapplet.h index 8603980b1..442013499 100644 --- a/plugins/bluetooth/componments/bluetoothapplet.h +++ b/plugins/bluetooth/componments/bluetoothapplet.h @@ -29,7 +29,7 @@ #include -#include +#include "org_deepin_daemon_airplanemode.h" class QVBoxLayout; class QHBoxLayout; @@ -48,7 +48,7 @@ DWIDGET_END_NAMESPACE DWIDGET_USE_NAMESPACE -using DBusAirplaneMode = com::deepin::daemon::AirplaneMode; +using DBusAirplaneMode = org::deepin::daemon::AirplaneMode1; class SettingLabel : public QWidget { diff --git a/plugins/bluetooth/dbusinterface/xml/org.deepin.daemon.AirplaneMode.xml b/plugins/bluetooth/dbusinterface/xml/org.deepin.daemon.AirplaneMode.xml new file mode 100644 index 000000000..b558d3014 --- /dev/null +++ b/plugins/bluetooth/dbusinterface/xml/org.deepin.daemon.AirplaneMode.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/plugins/bluetooth/dbusinterface/xml/org.deepin.daemon.Bluetooth.xml b/plugins/bluetooth/dbusinterface/xml/org.deepin.daemon.Bluetooth.xml new file mode 100644 index 000000000..289f981c5 --- /dev/null +++ b/plugins/bluetooth/dbusinterface/xml/org.deepin.daemon.Bluetooth.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/datetime/CMakeLists.txt b/plugins/datetime/CMakeLists.txt index ee7c614c5..a21a92061 100644 --- a/plugins/datetime/CMakeLists.txt +++ b/plugins/datetime/CMakeLists.txt @@ -3,17 +3,24 @@ set(PLUGIN_NAME "datetime") project(${PLUGIN_NAME}) +generation_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/dbusinterface/xml ${CMAKE_CURRENT_SOURCE_DIR}/dbusinterface/generation_dbus_interface) + # Sources files -file(GLOB SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp") +file(GLOB_RECURSE SRCS "*.h" + "*.cpp" + "../../widgets/*.h" + "../../widgets/*.cpp" + "./dbusinterface/*.h" + "./dbusinterface/*.cpp" + "../../frame/qtdbusextended/*.h" + "../../frame/qtdbusextended/*.cpp" "") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) find_package(Qt5Svg REQUIRED) find_package(Qt5DBus REQUIRED) find_package(DtkWidget REQUIRED) -pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) -pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) pkg_check_modules(QGSettings REQUIRED gsettings-qt) add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") @@ -21,15 +28,17 @@ add_library(${PLUGIN_NAME} SHARED ${SRCS} datetime.qrc) set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../) target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} - ${DFrameworkDBus_INCLUDE_DIRS} ${QGSettings_INCLUDE_DIRS} - ../../interfaces) + ../../interfaces + ../../frame/qtdbusextended + ./dbusinterface/ + ./dbusinterface/generation_dbus_interface) + target_link_libraries(${PLUGIN_NAME} PRIVATE ${Qt5DBus_LIBRARIES} ${DtkWidget_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Svg_LIBRARIES} - ${DFrameworkDBus_LIBRARIES} ${QGSettings_LIBRARIES} ) diff --git a/plugins/datetime/datetime.json b/plugins/datetime/datetime.json index 8c50d97e4..783887388 100644 --- a/plugins/datetime/datetime.json +++ b/plugins/datetime/datetime.json @@ -1,4 +1,4 @@ { "api": "2.0.0", - "depends-daemon-dbus-service": "com.deepin.daemon.Timedate" + "depends-daemon-dbus-service": "org.deepin.daemon.Timedate1" } diff --git a/plugins/datetime/datetimeplugin.cpp b/plugins/datetime/datetimeplugin.cpp index 5b33e482e..99716be84 100644 --- a/plugins/datetime/datetimeplugin.cpp +++ b/plugins/datetime/datetimeplugin.cpp @@ -42,7 +42,7 @@ DatetimePlugin::DatetimePlugin(QObject *parent) , m_pluginLoaded(false) { QDBusConnection sessionBus = QDBusConnection::sessionBus(); - sessionBus.connect("com.deepin.daemon.Timedate", "/com/deepin/daemon/Timedate", "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(propertiesChanged())); + sessionBus.connect("org.deepin.daemon.Timedate1", "/org/deepin/daemon/Timedate1", "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(propertiesChanged())); } PluginsItemInterface::PluginSizePolicy DatetimePlugin::pluginSizePolicy() const @@ -268,11 +268,11 @@ void DatetimePlugin::propertiesChanged() QDBusInterface* DatetimePlugin::timedateInterface() { if (!m_interface) { - if (QDBusConnection::sessionBus().interface()->isServiceRegistered("com.deepin.daemon.Timedate")) { - m_interface = new QDBusInterface("com.deepin.daemon.Timedate", "/com/deepin/daemon/Timedate", "com.deepin.daemon.Timedate", QDBusConnection::sessionBus(), this); + if (QDBusConnection::sessionBus().interface()->isServiceRegistered("org.deepin.daemon.Timedate1")) { + m_interface = new QDBusInterface("org.deepin.daemon.Timedate1", "/org/deepin/daemon/Timedate1", "org.deepin.daemon.Timedate1", QDBusConnection::sessionBus(), this); } else { - const QString path = QString("/com/deepin/daemon/Accounts/User%1").arg(QString::number(getuid())); - QDBusInterface * systemInterface = new QDBusInterface("com.deepin.daemon.Accounts", path, "com.deepin.daemon.Accounts.User", + const QString path = QString("/org/deepin/daemon/Accounts/User%1").arg(QString::number(getuid())); + QDBusInterface * systemInterface = new QDBusInterface("org.deepin.daemon.Accounts1", path, "org.deepin.daemon.Accounts.User", QDBusConnection::systemBus(), this); return systemInterface; } diff --git a/plugins/datetime/datetimewidget.cpp b/plugins/datetime/datetimewidget.cpp index 8923bdd54..8d34940ce 100644 --- a/plugins/datetime/datetimewidget.cpp +++ b/plugins/datetime/datetimewidget.cpp @@ -40,7 +40,7 @@ DatetimeWidget::DatetimeWidget(QWidget *parent) : QWidget(parent) , m_24HourFormat(false) , m_timeOffset(false) - , m_timedateInter(new Timedate("com.deepin.daemon.Timedate", "/com/deepin/daemon/Timedate", QDBusConnection::sessionBus(), this)) + , m_timedateInter(new Timedate("org.deepin.daemon.Timedate1", "/org/deepin/daemon/Timedate1", QDBusConnection::sessionBus(), this)) , m_shortDateFormat("yyyy-MM-dd") , m_shortTimeFormat("hh:mm") { diff --git a/plugins/datetime/datetimewidget.h b/plugins/datetime/datetimewidget.h index 42cba4942..21a2e60bf 100644 --- a/plugins/datetime/datetimewidget.h +++ b/plugins/datetime/datetimewidget.h @@ -22,11 +22,11 @@ #ifndef DATETIMEWIDGET_H #define DATETIMEWIDGET_H -#include +#include "org_deepin_daemon_timedate.h" #include -using Timedate = com::deepin::daemon::Timedate; +using Timedate = org::deepin::daemon::Timedate1; class DatetimeWidget : public QWidget { diff --git a/plugins/datetime/dbusinterface/types/zoneinfo.cpp b/plugins/datetime/dbusinterface/types/zoneinfo.cpp new file mode 100644 index 000000000..95b46df3a --- /dev/null +++ b/plugins/datetime/dbusinterface/types/zoneinfo.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#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 << 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"); + qDBusRegisterMetaType(); +} diff --git a/plugins/datetime/dbusinterface/types/zoneinfo.h b/plugins/datetime/dbusinterface/types/zoneinfo.h new file mode 100644 index 000000000..ca7249e36 --- /dev/null +++ b/plugins/datetime/dbusinterface/types/zoneinfo.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef ZONEINFO_H +#define ZONEINFO_H + +#include +#include +#include +#include +#include + +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 diff --git a/plugins/datetime/dbusinterface/xml/org.deepin.daemon.Timedate.xml b/plugins/datetime/dbusinterface/xml/org.deepin.daemon.Timedate.xml new file mode 100644 index 000000000..935a74c77 --- /dev/null +++ b/plugins/datetime/dbusinterface/xml/org.deepin.daemon.Timedate.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/keyboard-layout/CMakeLists.txt b/plugins/keyboard-layout/CMakeLists.txt index e25ac6a12..76ed7434f 100644 --- a/plugins/keyboard-layout/CMakeLists.txt +++ b/plugins/keyboard-layout/CMakeLists.txt @@ -3,29 +3,38 @@ set(PLUGIN_NAME "keyboard-layout") project(${PLUGIN_NAME}) +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") +file(GLOB_RECURSE SRCS "*.h" + "*.cpp" + "./dbusinterface/generation_dbus_interface/*.h" + "./dbusinterface/generation_dbus_interface/*.cpp" + "../../frame/qtdbusextended/*.h" + "../../frame/qtdbusextended/*.cpp" + "./dbusinterface/types/*.h" + "./dbusinterface/types/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) find_package(Qt5Svg REQUIRED) find_package(DtkWidget REQUIRED) find_package(Qt5DBus REQUIRED) -find_package(DFrameworkdbus REQUIRED) -pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) pkg_check_modules(QGSettings REQUIRED gsettings-qt) add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") add_library(${PLUGIN_NAME} SHARED ${SRCS}) set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../) target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} - ${DFrameworkDBus_INCLUDE_DIRS} ${QGSettings_INCLUDE_DIRS} - ../../interfaces) + ../../interfaces + ./dbusinterface + ./dbusinterface/generation_dbus_interface + ../../frame/qtdbusextended) + target_link_libraries(${PLUGIN_NAME} PRIVATE ${DtkWidget_LIBRARIES} - ${DFrameworkDBus_LIBRARIES} ${QGSettings_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Svg_LIBRARIES} diff --git a/plugins/keyboard-layout/dbusadaptors.h b/plugins/keyboard-layout/dbusadaptors.h index 355165153..99d345cec 100644 --- a/plugins/keyboard-layout/dbusadaptors.h +++ b/plugins/keyboard-layout/dbusadaptors.h @@ -22,9 +22,9 @@ #include #include -#include +#include "org_deepin_daemon_inputdevice_keyboard.h" -using Keyboard = com::deepin::daemon::inputdevice::Keyboard; +using Keyboard = org::deepin::daemon::inputdevice::Keyboard1; class QGSettings; class DBusAdaptors : public QDBusAbstractAdaptor diff --git a/plugins/keyboard-layout/dbusinterface/types/keyboardlayoutlist.cpp b/plugins/keyboard-layout/dbusinterface/types/keyboardlayoutlist.cpp new file mode 100644 index 000000000..abb2e010c --- /dev/null +++ b/plugins/keyboard-layout/dbusinterface/types/keyboardlayoutlist.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#include "keyboardlayoutlist.h" + +void registerKeyboardLayoutListMetaType() +{ + qRegisterMetaType("KeyboardLayoutList"); + qDBusRegisterMetaType(); +} diff --git a/plugins/keyboard-layout/dbusinterface/types/keyboardlayoutlist.h b/plugins/keyboard-layout/dbusinterface/types/keyboardlayoutlist.h new file mode 100644 index 000000000..046f363fc --- /dev/null +++ b/plugins/keyboard-layout/dbusinterface/types/keyboardlayoutlist.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef KEYBOARDLAYOUTLIST_H +#define KEYBOARDLAYOUTLIST_H + +#include +#include +#include +#include + +typedef QMap KeyboardLayoutList; + +void registerKeyboardLayoutListMetaType(); + +#endif // KEYBOARDLAYOUTLIST_H diff --git a/plugins/keyboard-layout/dbusinterface/xml/org.deepin.daemon.InputDevice.Keyboard.xml b/plugins/keyboard-layout/dbusinterface/xml/org.deepin.daemon.InputDevice.Keyboard.xml new file mode 100644 index 000000000..d37690b89 --- /dev/null +++ b/plugins/keyboard-layout/dbusinterface/xml/org.deepin.daemon.InputDevice.Keyboard.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/onboard/CMakeLists.txt b/plugins/onboard/CMakeLists.txt index 46b95e2c7..aa3d2eff3 100644 --- a/plugins/onboard/CMakeLists.txt +++ b/plugins/onboard/CMakeLists.txt @@ -3,8 +3,17 @@ set(PLUGIN_NAME "onboard") project(${PLUGIN_NAME}) +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" + "./dbusinterface/generation_dbus_interface/*.h" + "./dbusinterface/generation_dbus_interface/*.cpp" + "../../frame/qtdbusextended/*.h" + "../../frame/qtdbusextended/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) @@ -15,15 +24,17 @@ find_package(DtkWidget REQUIRED) add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") add_library(${PLUGIN_NAME} SHARED ${SRCS} onboard.qrc) set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../) + target_include_directories(${PLUGIN_NAME} PUBLIC ${Qt5DBus_INCLUDE_DIRS} - ${DFrameworkDBus_INCLUDE_DIRS} - ../../interfaces) + ../../interfaces + ../../frame/qtdbusextended + ./dbusinterface/generation_dbus_interface) + target_link_libraries(${PLUGIN_NAME} PRIVATE ${Qt5Widgets_LIBRARIES} ${Qt5DBus_LIBRARIES} ${DtkGui_LIBRARIES} ${DtkWidget_LIBRARIES} - ${DFrameworkDBus_LIBRARIES} ) install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins) diff --git a/plugins/onboard/dbusinterface/types/arealist.cpp b/plugins/onboard/dbusinterface/types/arealist.cpp new file mode 100644 index 000000000..e4055ada2 --- /dev/null +++ b/plugins/onboard/dbusinterface/types/arealist.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * zhaolong + * + * 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 . + */ + +#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"); + qDBusRegisterMetaType(); + + qRegisterMetaType("AreaList"); + qDBusRegisterMetaType(); +} diff --git a/plugins/onboard/dbusinterface/types/arealist.h b/plugins/onboard/dbusinterface/types/arealist.h new file mode 100644 index 000000000..be61f028c --- /dev/null +++ b/plugins/onboard/dbusinterface/types/arealist.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * zhaolong + * + * 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 . + */ + +#ifndef AREALIST_H +#define AREALIST_H + +#include +#include +#include + +struct MonitRect { + int x1; + int y1; + int x2; + int y2; + + bool operator ==(const MonitRect& rect); +}; + +typedef QList 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 diff --git a/plugins/onboard/dbusinterface/xml/org.deepin.dde.daemon.Dock.Entry.xml b/plugins/onboard/dbusinterface/xml/org.deepin.dde.daemon.Dock.Entry.xml new file mode 100644 index 000000000..89b665e41 --- /dev/null +++ b/plugins/onboard/dbusinterface/xml/org.deepin.dde.daemon.Dock.Entry.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/plugins/onboard/dbusinterface/xml/org.deepin.dde.daemon.Dock.xml b/plugins/onboard/dbusinterface/xml/org.deepin.dde.daemon.Dock.xml new file mode 100644 index 000000000..08573ed35 --- /dev/null +++ b/plugins/onboard/dbusinterface/xml/org.deepin.dde.daemon.Dock.xml @@ -0,0 +1,3 @@ + + + diff --git a/plugins/onboard/onboardplugin.cpp b/plugins/onboard/onboardplugin.cpp index 31777e6d8..d3c522b67 100644 --- a/plugins/onboard/onboardplugin.cpp +++ b/plugins/onboard/onboardplugin.cpp @@ -21,32 +21,20 @@ #include "onboardplugin.h" #include "../widgets/tipswidget.h" -#ifdef USE_AM -#include "dockinterface.h" -#include "entryinterface.h" -#else -#include -#include -#endif + +#include "org_deepin_dde_daemon_dock.h" +#include "org_deepin_dde_daemon_dock_entry.h" #include #include #define PLUGIN_STATE_KEY "enable" -#ifdef USE_AM -using DBusDock = org::deepin::dde::daemon::DdeDock; -using DockEntryInter = org::deepin::dde::daemon::dock::DockEntry; +using DBusDock = org::deepin::dde::daemon::Dock1; +using DockEntryInter = org::deepin::dde::daemon::dock1::Entry; static const QString serviceName = QString("org.deepin.dde.daemon.Dock1"); static const QString servicePath = QString("/org/deepin/dde/daemon/Dock1"); -#else -using DBusDock = com::deepin::dde::daemon::Dock; -using DockEntryInter = com::deepin::dde::daemon::dock::Entry; - -static const QString serviceName = QString("com.deepin.dde.daemon.Dock"); -static const QString servicePath = QString("/com/deepin/dde/daemon/Dock"); -#endif using namespace Dock; OnboardPlugin::OnboardPlugin(QObject *parent) diff --git a/plugins/power/CMakeLists.txt b/plugins/power/CMakeLists.txt index 78dafea75..1cd9e364f 100644 --- a/plugins/power/CMakeLists.txt +++ b/plugins/power/CMakeLists.txt @@ -3,8 +3,17 @@ set(PLUGIN_NAME "power") project(${PLUGIN_NAME}) +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" + "./dbusinterface/generation_dbus_interface/*.h" + "./dbusinterface/generation_dbus_interface/*.cpp" + "../../frame/qtdbusextended/*.h" + "../../frame/qtdbusextended/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) @@ -12,7 +21,6 @@ find_package(Qt5Svg REQUIRED) find_package(Qt5DBus REQUIRED) find_package(DtkWidget REQUIRED) -pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) pkg_check_modules(QGSettings REQUIRED gsettings-qt) add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") @@ -20,15 +28,16 @@ add_library(${PLUGIN_NAME} SHARED ${SRCS} power.qrc) set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../quick-trays) target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} - ${DFrameworkDBus_INCLUDE_DIRS} ${QGSettings_INCLUDE_DIRS} - ../../interfaces) + ../../interfaces + ../../frame/qtdbusextended + ./dbusinterface/generation_dbus_interface) + target_link_libraries(${PLUGIN_NAME} PRIVATE ${DtkWidget_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Svg_LIBRARIES} ${Qt5DBus_LIBRARIES} - ${DFrameworkDBus_LIBRARIES} ${QGSettings_LIBRARIES} ) diff --git a/plugins/power/dbus/dbusaccount.cpp b/plugins/power/dbus/dbusaccount.cpp index 0646685b9..bf0b3173e 100644 --- a/plugins/power/dbus/dbusaccount.cpp +++ b/plugins/power/dbus/dbusaccount.cpp @@ -21,7 +21,7 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DBusAccount -p dbusaccount com.deepin.daemon.Accounts.xml + * Command line was: qdbusxml2cpp -c DBusAccount -p dbusaccount org.deepin.daemon.Accounts.xml * * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). * @@ -46,4 +46,3 @@ DBusAccount::~DBusAccount() { QDBusConnection::systemBus().disconnect(service(), path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(propertyChanged(QDBusMessage))); } - diff --git a/plugins/power/dbus/dbusaccount.h b/plugins/power/dbus/dbusaccount.h index 64ac04af6..a722bd55d 100644 --- a/plugins/power/dbus/dbusaccount.h +++ b/plugins/power/dbus/dbusaccount.h @@ -21,7 +21,7 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DBusAccount -p dbusaccount com.deepin.daemon.Accounts.xml + * Command line was: qdbusxml2cpp -c DBusAccount -p dbusaccount org.deepin.daemon.Accounts.xml * * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). * @@ -42,7 +42,7 @@ #include /* - * Proxy class for interface com.deepin.daemon.Accounts + * Proxy class for interface org.deepin.daemon.Accounts1 */ class DBusAccount: public QDBusAbstractInterface { @@ -55,7 +55,7 @@ class DBusAccount: public QDBusAbstractInterface return; } QString interfaceName = msg.arguments().at(0).toString(); - if (interfaceName != "com.deepin.daemon.Accounts") { + if (interfaceName != "org.deepin.daemon.Accounts1") { return; } QVariantMap changedProps = qdbus_cast(arguments.at(1).value()); @@ -72,11 +72,11 @@ class DBusAccount: public QDBusAbstractInterface } public: static inline const char *staticService() - { return "com.deepin.daemon.Accounts"; } + { return "org.deepin.daemon.Accounts1"; } static inline const char *staticInterfacePath() - { return "/com/deepin/daemon/Accounts"; } + { return "/org/deepin/daemon/Accounts1"; } static inline const char *staticInterfaceName() - { return "com.deepin.daemon.Accounts"; } + { return "org.deepin.daemon.Accounts1"; } public: explicit DBusAccount(QObject *parent = 0); diff --git a/plugins/power/dbus/dbuspower.cpp b/plugins/power/dbus/dbuspower.cpp index 29cdedac3..1c952860c 100644 --- a/plugins/power/dbus/dbuspower.cpp +++ b/plugins/power/dbus/dbuspower.cpp @@ -1,6 +1,6 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DBusPower -p dbuspower com.deepin.daemon.Power.xml + * Command line was: qdbusxml2cpp -c DBusPower -p dbuspower org.deepin.daemon.Power.xml * * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). * @@ -16,7 +16,7 @@ */ DBusPower::DBusPower(QObject *parent) - : QDBusAbstractInterface("com.deepin.daemon.Power", "/com/deepin/daemon/Power", staticInterfaceName(), QDBusConnection::sessionBus(), parent) + : QDBusAbstractInterface("org.deepin.daemon.Power1", "/org/deepin/daemon/Power1", staticInterfaceName(), QDBusConnection::sessionBus(), parent) { qRegisterMetaType("BatteryStateMap"); qDBusRegisterMetaType(); diff --git a/plugins/power/dbus/dbuspower.h b/plugins/power/dbus/dbuspower.h index 47225849b..646c857c7 100644 --- a/plugins/power/dbus/dbuspower.h +++ b/plugins/power/dbus/dbuspower.h @@ -1,6 +1,6 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DBusPower -p dbuspower com.deepin.daemon.Power.xml + * Command line was: qdbusxml2cpp -c DBusPower -p dbuspower org.deepin.daemon.Power.xml * * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). * @@ -26,7 +26,7 @@ Q_DECLARE_METATYPE(BatteryPercentageMap) Q_DECLARE_METATYPE(BatteryStateMap) /* - * Proxy class for interface com.deepin.daemon.Power + * Proxy class for interface org.deepin.daemon.Power */ class DBusPower: public QDBusAbstractInterface { @@ -38,7 +38,7 @@ class DBusPower: public QDBusAbstractInterface if (3 != arguments.count()) return; QString interfaceName = msg.arguments().at(0).toString(); - if (interfaceName !="com.deepin.daemon.Power") + if (interfaceName !="org.deepin.daemon.Power1") return; QVariantMap changedProps = qdbus_cast(arguments.at(1).value()); foreach(const QString &prop, changedProps.keys()) { @@ -53,7 +53,7 @@ class DBusPower: public QDBusAbstractInterface } public: static inline const char *staticInterfaceName() - { return "com.deepin.daemon.Power"; } + { return "org.deepin.daemon.Power1"; } public: explicit DBusPower(QObject *parent = 0); @@ -80,10 +80,10 @@ void BatteryPercentageChanged(); void BatteryStateChanged(); }; -namespace com { +namespace org { namespace deepin { namespace daemon { - typedef ::DBusPower Power; + typedef ::DBusPower Power1; } } } diff --git a/plugins/power/dbusinterface/xml/org.deepin.system.SystemPower.xml b/plugins/power/dbusinterface/xml/org.deepin.system.SystemPower.xml new file mode 100644 index 000000000..632a4ef0a --- /dev/null +++ b/plugins/power/dbusinterface/xml/org.deepin.system.SystemPower.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/power/power.json b/plugins/power/power.json index 388147fa0..bb030c54e 100644 --- a/plugins/power/power.json +++ b/plugins/power/power.json @@ -1,4 +1,4 @@ { "api": "2.0.0", - "depends-daemon-dbus-service": "com.deepin.daemon.Power" + "depends-daemon-dbus-service": "org.deepin.daemon.Power1" } diff --git a/plugins/power/powerplugin.cpp b/plugins/power/powerplugin.cpp index 14d138709..b5aea7bb4 100644 --- a/plugins/power/powerplugin.cpp +++ b/plugins/power/powerplugin.cpp @@ -236,7 +236,7 @@ void PowerPlugin::loadPlugin() m_powerInter = new DBusPower(this); - m_systemPowerInter = new SystemPowerInter("com.deepin.system.Power", "/com/deepin/system/Power", QDBusConnection::systemBus(), this); + m_systemPowerInter = new SystemPowerInter("org.deepin.system.Power1", "/org/deepin/system/Power1", QDBusConnection::systemBus(), this); m_systemPowerInter->setSync(true); connect(GSettingsByApp(), &QGSettings::changed, this, &PowerPlugin::onGSettingsChanged); diff --git a/plugins/power/powerplugin.h b/plugins/power/powerplugin.h index cab3ece65..02911f7ff 100644 --- a/plugins/power/powerplugin.h +++ b/plugins/power/powerplugin.h @@ -26,11 +26,11 @@ #include "powerstatuswidget.h" #include "dbus/dbuspower.h" -#include +#include "org_deepin_system_systempower.h" #include -using SystemPowerInter = com::deepin::system::Power; +using SystemPowerInter = org::deepin::system::Power1; namespace Dock { class TipsWidget; } diff --git a/plugins/shutdown/dbus/dbusaccount.cpp b/plugins/shutdown/dbus/dbusaccount.cpp index 0646685b9..523f6231b 100644 --- a/plugins/shutdown/dbus/dbusaccount.cpp +++ b/plugins/shutdown/dbus/dbusaccount.cpp @@ -21,7 +21,7 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DBusAccount -p dbusaccount com.deepin.daemon.Accounts.xml + * Command line was: qdbusxml2cpp -c DBusAccount -p dbusaccount org.deepin.daemon.Accounts.xml * * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). * diff --git a/plugins/shutdown/dbus/dbusaccount.h b/plugins/shutdown/dbus/dbusaccount.h index 64ac04af6..6eaa00ea2 100644 --- a/plugins/shutdown/dbus/dbusaccount.h +++ b/plugins/shutdown/dbus/dbusaccount.h @@ -21,7 +21,7 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DBusAccount -p dbusaccount com.deepin.daemon.Accounts.xml + * Command line was: qdbusxml2cpp -c DBusAccount -p dbusaccount org.deepin.daemon.Accounts1.xml * * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). * @@ -42,7 +42,7 @@ #include /* - * Proxy class for interface com.deepin.daemon.Accounts + * Proxy class for interface org.deepin.daemon.Accounts */ class DBusAccount: public QDBusAbstractInterface { @@ -55,7 +55,7 @@ class DBusAccount: public QDBusAbstractInterface return; } QString interfaceName = msg.arguments().at(0).toString(); - if (interfaceName != "com.deepin.daemon.Accounts") { + if (interfaceName != "org.deepin.daemon.Accounts1") { return; } QVariantMap changedProps = qdbus_cast(arguments.at(1).value()); @@ -72,11 +72,11 @@ class DBusAccount: public QDBusAbstractInterface } public: static inline const char *staticService() - { return "com.deepin.daemon.Accounts"; } + { return "org.deepin.daemon.Accounts1"; } static inline const char *staticInterfacePath() - { return "/com/deepin/daemon/Accounts"; } + { return "/org/deepin/daemon/Accounts1"; } static inline const char *staticInterfaceName() - { return "com.deepin.daemon.Accounts"; } + { return "org.deepin.daemon.Accounts1"; } public: explicit DBusAccount(QObject *parent = 0); diff --git a/plugins/shutdown/dbus/dbuspowermanager.cpp b/plugins/shutdown/dbus/dbuspowermanager.cpp index 2cc5e4f79..5617c8812 100644 --- a/plugins/shutdown/dbus/dbuspowermanager.cpp +++ b/plugins/shutdown/dbus/dbuspowermanager.cpp @@ -1,6 +1,6 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c PowerManager -p com_deepin_daemon_powermanager com.deepin.daemon.PowerManager.xml + * Command line was: qdbusxml2cpp -c PowerManager -p com_deepin_daemon_powermanager org.deepin.daemon.PowerManager.xml * * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd. * diff --git a/plugins/shutdown/dbus/dbuspowermanager.h b/plugins/shutdown/dbus/dbuspowermanager.h index a9c91e723..f70a85f19 100644 --- a/plugins/shutdown/dbus/dbuspowermanager.h +++ b/plugins/shutdown/dbus/dbuspowermanager.h @@ -1,6 +1,6 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c PowerManager -p com_deepin_daemon_powermanager com.deepin.daemon.PowerManager.xml + * Command line was: qdbusxml2cpp -c PowerManager -p com_deepin_daemon_powermanager org.deepin.daemon.PowerManager.xml * * qdbusxml2cpp is Copyright (C) 2017 The Qt Company Ltd. * @@ -21,14 +21,14 @@ #include /* - * Proxy class for interface com.deepin.daemon.PowerManager + * Proxy class for interface org.deepin.daemon.PowerManager1 */ class DBusPowerManager: public QDBusAbstractInterface { Q_OBJECT public: static inline const char *staticInterfaceName() - { return "com.deepin.daemon.PowerManager"; } + { return "org.deepin.daemon.PowerManager1"; } public: DBusPowerManager(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = nullptr); diff --git a/plugins/shutdown/shutdownplugin.cpp b/plugins/shutdown/shutdownplugin.cpp index 81dec6047..a18263687 100644 --- a/plugins/shutdown/shutdownplugin.cpp +++ b/plugins/shutdown/shutdownplugin.cpp @@ -45,7 +45,7 @@ ShutdownPlugin::ShutdownPlugin(QObject *parent) , m_pluginLoaded(false) , m_shutdownWidget(nullptr) , m_tipsLabel(new TipsWidget) - , m_powerManagerInter(new DBusPowerManager("com.deepin.daemon.PowerManager", "/com/deepin/daemon/PowerManager", QDBusConnection::systemBus(), this)) + , m_powerManagerInter(new DBusPowerManager("org.deepin.daemon.PowerManager1", "/org/deepin/daemon/PowerManager1", QDBusConnection::systemBus(), this)) , m_gsettings(Utils::ModuleSettingsPtr("shutdown", QByteArray(), this)) , m_sessionShellGsettings(Utils::SettingsPtr("com.deepin.dde.session-shell", "/com/deepin/dde/session-shell/", this)) { diff --git a/plugins/sound/CMakeLists.txt b/plugins/sound/CMakeLists.txt index 20f3b3dfc..f101dc90e 100644 --- a/plugins/sound/CMakeLists.txt +++ b/plugins/sound/CMakeLists.txt @@ -3,9 +3,21 @@ set(PLUGIN_NAME "sound") project(${PLUGIN_NAME}) +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" "../../frame/util/imageutil.h" "../../frame/util/imageutil.cpp" - "../../frame/util/horizontalseperator.h" "../../frame/util/horizontalseperator.cpp") +file(GLOB_RECURSE SRCS "*.h" + "*.cpp" + "../../widgets/*.h" + "../../widgets/*.cpp" + "../../frame/util/imageutil.h" + "../../frame/util/imageutil.cpp" + "../../frame/util/horizontalseperator.h" + "../../frame/util/horizontalseperator.cpp" + "./dbusinterface/generation_dbus_interface/*.h" + "./dbusinterface/generation_dbus_interface/*.cpp" + "../../frame/qtdbusextended/*.h" + "../../frame/qtdbusextended/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) @@ -14,24 +26,24 @@ find_package(Qt5DBus REQUIRED) find_package(DtkWidget REQUIRED) pkg_check_modules(XCB_EWMH REQUIRED xcb-ewmh x11 xcursor) -pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) pkg_check_modules(QGSettings REQUIRED gsettings-qt) add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") add_library(${PLUGIN_NAME} SHARED ${SRCS} resources/sound.qrc) set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../system-trays) target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} - ${DFrameworkDBus_INCLUDE_DIRS} ${QGSettings_INCLUDE_DIRS} + ./dbusinterface + ./dbusinterface/generation_dbus_interface ../../interfaces ../../frame ../../frame/accessible + ../../frame/qtdbusextended ) target_link_libraries(${PLUGIN_NAME} PRIVATE ${DtkWidget_LIBRARIES} ${XCB_EWMH_LIBRARIES} - ${DFrameworkDBus_LIBRARIES} ${QGSettings_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Widgets_LIBRARIES} diff --git a/plugins/sound/dbusinterface/types/audioport.cpp b/plugins/sound/dbusinterface/types/audioport.cpp new file mode 100644 index 000000000..6ea641338 --- /dev/null +++ b/plugins/sound/dbusinterface/types/audioport.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#include + +#include "audioport.h" + +void registerAudioPortMetaType() +{ + qRegisterMetaType("AudioPort"); + qDBusRegisterMetaType(); +} diff --git a/plugins/sound/dbusinterface/types/audioport.h b/plugins/sound/dbusinterface/types/audioport.h new file mode 100644 index 000000000..5b3800759 --- /dev/null +++ b/plugins/sound/dbusinterface/types/audioport.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef AUDIOPORT_H +#define AUDIOPORT_H + +#include +#include +#include +#include + +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 diff --git a/plugins/sound/dbusinterface/types/audioportlist.cpp b/plugins/sound/dbusinterface/types/audioportlist.cpp new file mode 100644 index 000000000..c6d4ad991 --- /dev/null +++ b/plugins/sound/dbusinterface/types/audioportlist.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#include "audioportlist.h" + +void registerAudioPortListMetaType() +{ + qRegisterMetaType("AudioPortList"); + qDBusRegisterMetaType(); +} diff --git a/plugins/sound/dbusinterface/types/audioportlist.h b/plugins/sound/dbusinterface/types/audioportlist.h new file mode 100644 index 000000000..c48d47d31 --- /dev/null +++ b/plugins/sound/dbusinterface/types/audioportlist.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: sbw + * kirigaya + * Hualet + * + * Maintainer: sbw + * kirigaya + * Hualet + * + * 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 . + */ + +#ifndef AUDIOPORTLIST_H +#define AUDIOPORTLIST_H + +#include +#include + +#include "audioport.h" + +typedef QList AudioPortList; + +Q_DECLARE_METATYPE(AudioPortList) + +void registerAudioPortListMetaType(); + +#endif // AUDIOPORTLIST_H diff --git a/plugins/sound/dbusinterface/xml/org.deepin.daemon.Audio.Sink.xml b/plugins/sound/dbusinterface/xml/org.deepin.daemon.Audio.Sink.xml new file mode 100644 index 000000000..347056803 --- /dev/null +++ b/plugins/sound/dbusinterface/xml/org.deepin.daemon.Audio.Sink.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + \n + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugins/sound/dbusinterface/xml/org.deepin.daemon.Audio.xml b/plugins/sound/dbusinterface/xml/org.deepin.daemon.Audio.xml new file mode 100644 index 000000000..056518152 --- /dev/null +++ b/plugins/sound/dbusinterface/xml/org.deepin.daemon.Audio.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/sound/sound.json b/plugins/sound/sound.json index 2d486b2fa..181aef926 100644 --- a/plugins/sound/sound.json +++ b/plugins/sound/sound.json @@ -1,4 +1,4 @@ { "api": "2.0.0", - "depends-daemon-dbus-service": "com.deepin.daemon.Audio" + "depends-daemon-dbus-service": "org.deepin.daemon.Audio1" } diff --git a/plugins/sound/soundapplet.cpp b/plugins/sound/soundapplet.cpp index ad22cbd85..c9e78b94e 100644 --- a/plugins/sound/soundapplet.cpp +++ b/plugins/sound/soundapplet.cpp @@ -120,7 +120,7 @@ SoundApplet::SoundApplet(QWidget *parent) , m_deviceLabel(new QLabel(this)) , m_seperator(new HorizontalSeperator(this)) , m_secondSeperator(new HorizontalSeperator(this)) - , m_audioInter(new DBusAudio("com.deepin.daemon.Audio", "/com/deepin/daemon/Audio", QDBusConnection::sessionBus(), this)) + , m_audioInter(new DBusAudio("org.deepin.daemon.Audio1", "/org/deepin/daemon/Audio1", QDBusConnection::sessionBus(), this)) , m_defSinkInter(nullptr) , m_listView(new DListView(this)) , m_model(new QStandardItemModel(m_listView)) @@ -245,7 +245,7 @@ void SoundApplet::initUi() }); connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &SoundApplet::refreshIcon); connect(qApp, &DApplication::iconThemeChanged, this, &SoundApplet::refreshIcon); - QDBusConnection::sessionBus().connect("com.deepin.daemon.Audio", "/com/deepin/daemon/Audio", "org.freedesktop.DBus.Properties" + QDBusConnection::sessionBus().connect("org.deepin.daemon.Audio1", "/org/deepin/daemon/Audio1", "org.freedesktop.DBus.Properties" ,"PropertiesChanged", "sa{sv}as", this, SLOT(haldleDbusSignal(QDBusMessage))); QMetaObject::invokeMethod(this, "onDefaultSinkChanged", Qt::QueuedConnection); @@ -281,7 +281,7 @@ void SoundApplet::onDefaultSinkChanged() } const QDBusObjectPath defSinkPath = m_audioInter->defaultSink(); - m_defSinkInter = new DBusSink("com.deepin.daemon.Audio", defSinkPath.path(), QDBusConnection::sessionBus(), this); + m_defSinkInter = new DBusSink("org.deepin.daemon.Audio1", defSinkPath.path(), QDBusConnection::sessionBus(), this); connect(m_defSinkInter, &DBusSink::VolumeChanged, this, &SoundApplet::onVolumeChanged); connect(m_defSinkInter, &DBusSink::MuteChanged, this, [ = ] { diff --git a/plugins/sound/soundapplet.h b/plugins/sound/soundapplet.h index a82139e00..95aaa8164 100644 --- a/plugins/sound/soundapplet.h +++ b/plugins/sound/soundapplet.h @@ -24,8 +24,8 @@ #include "componments/volumeslider.h" -#include -#include +#include "org_deepin_daemon_audio.h" +#include "org_deepin_daemon_audio_sink.h" #include #include @@ -38,8 +38,8 @@ DWIDGET_USE_NAMESPACE -using DBusAudio = com::deepin::daemon::Audio; -using DBusSink = com::deepin::daemon::audio::Sink; +using DBusAudio = org::deepin::daemon::Audio1; +using DBusSink = org::deepin::daemon::audio1::Sink; class HorizontalSeperator; class QGSettings; diff --git a/plugins/sound/sounditem.h b/plugins/sound/sounditem.h index 701f9ac07..2dd144367 100644 --- a/plugins/sound/sounditem.h +++ b/plugins/sound/sounditem.h @@ -23,14 +23,14 @@ #define SOUNDITEM_H #include "soundapplet.h" -#include +#include "org_deepin_daemon_audio_sink.h" #include #include #define SOUND_KEY "sound-item-key" -using DBusSink = com::deepin::daemon::audio::Sink; +using DBusSink = org::deepin::daemon::audio1::Sink; namespace Dock { class TipsWidget; diff --git a/plugins/trash/CMakeLists.txt b/plugins/trash/CMakeLists.txt index 4e9277316..a08f4c468 100644 --- a/plugins/trash/CMakeLists.txt +++ b/plugins/trash/CMakeLists.txt @@ -3,8 +3,17 @@ set(PLUGIN_NAME "trash") project(${PLUGIN_NAME}) +generation_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/dbusinterface/xml ${CMAKE_CURRENT_SOURCE_DIR}/dbusinterface/generation_dbus_interface) + # Sources files -file(GLOB SRCS "*.h" "*.cpp" "../../widgets/*.h" "../../widgets/*.cpp") +file(GLOB SRCS "*.h" + "*.cpp" + "../../widgets/*.h" + "../../widgets/*.cpp" + "./dbusinterface/generation_dbus_interface/*.h" + "./dbusinterface/generation_dbus_interface/*.cpp" + "../../frame/qtdbusextended/*.h" + "../../frame/qtdbusextended/*.cpp") find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) @@ -12,20 +21,18 @@ find_package(Qt5Svg REQUIRED) find_package(Qt5DBus REQUIRED) find_package(DtkWidget REQUIRED) -pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) - add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") add_library(${PLUGIN_NAME} SHARED ${SRCS} resource.qrc) set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../) target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} - ${DFrameworkDBus_INCLUDE_DIRS} - ../../interfaces) + ../../interfaces + ./dbusinterface/generation_dbus_interface + ../../frame/qtdbusextended) target_link_libraries(${PLUGIN_NAME} PRIVATE ${DtkWidget_LIBRARIES} - ${DFrameworkDBus_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Svg_LIBRARIES} diff --git a/plugins/trash/dbusinterface/xml/org.freedesktop.FileManager.xml b/plugins/trash/dbusinterface/xml/org.freedesktop.FileManager.xml new file mode 100644 index 000000000..fb67a6c59 --- /dev/null +++ b/plugins/trash/dbusinterface/xml/org.freedesktop.FileManager.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/plugins/trash/trashwidget.cpp b/plugins/trash/trashwidget.cpp index 04731016f..6e0e44ae3 100644 --- a/plugins/trash/trashwidget.cpp +++ b/plugins/trash/trashwidget.cpp @@ -239,7 +239,7 @@ void TrashWidget::setDragging(bool state) void TrashWidget::removeApp(const QString &appKey) { - const QString cmd("dbus-send --print-reply --dest=com.deepin.dde.Launcher /com/deepin/dde/Launcher com.deepin.dde.Launcher.UninstallApp string:\"" + appKey + "\""); + const QString cmd("dbus-send --print-reply --dest=org.deepin.dde.Launcher1 /org/deepin/dde/Launcher1 org.deepin.dde.Launcher1.UninstallApp string:\"" + appKey + "\""); QProcess *proc = new QProcess; proc->start(cmd); diff --git a/plugins/trash/trashwidget.h b/plugins/trash/trashwidget.h index 87a7c236f..b0be99c40 100644 --- a/plugins/trash/trashwidget.h +++ b/plugins/trash/trashwidget.h @@ -29,12 +29,13 @@ #include "popupcontrolwidget.h" +#include "org_freedesktop_filemanager.h" + #include #include #include #include -#include using DBusFileManager1 = org::freedesktop::FileManager1; class TrashWidget : public QWidget diff --git a/plugins/tray/CMakeLists.txt b/plugins/tray/CMakeLists.txt index aee5dbd38..e9ba79466 100644 --- a/plugins/tray/CMakeLists.txt +++ b/plugins/tray/CMakeLists.txt @@ -3,21 +3,46 @@ set(PLUGIN_NAME "tray") project(${PLUGIN_NAME}) +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" - "../../frame/util/themeappicon.h" "../../frame/util/themeappicon.cpp" - "../../frame/util/dockpopupwindow.h" "../../frame/util/dockpopupwindow.cpp" - "../../frame/util/abstractpluginscontroller.h" "../../frame/util/abstractpluginscontroller.cpp" - "../../frame/util/pluginloader.h" "../../frame/util/pluginloader.cpp" - "../../frame/dbus/sni/*.h" "../../frame/dbus/sni/*.cpp" - "../../frame/dbus/dbusmenu.h" "../../frame/dbus/dbusmenu.cpp" - "../../frame/dbus/dbusmenumanager.h" "../../frame/dbus/dbusmenumanager.cpp" - "../../frame/dbus/dockinterface.h" "../../frame/dbus/dockinterface.cpp" - "../../widgets/*.h" "../../widgets/*.cpp" - "../../frame/util/imageutil.h" "../../frame/util/imageutil.cpp" - "../../frame/util/menudialog.h" "../../frame/util/menudialog.cpp" - "../../frame/util/touchsignalmanager.h" "../../frame/util/touchsignalmanager.cpp" - "../../frame/controller/proxyplugincontroller.h" "../../frame/controller/proxyplugincontroller.cpp") +file(GLOB_RECURSE SRCS "*.h" + "*.cpp" + "../../widgets/*.h" + "../../widgets/*.cpp" + "../../frame/util/themeappicon.h" + "../../frame/util/themeappicon.cpp" + "../../frame/util/dockpopupwindow.h" + "../../frame/util/dockpopupwindow.cpp" + "../../frame/util/abstractpluginscontroller.h" + "../../frame/util/abstractpluginscontroller.cpp" + "../../frame/util/pluginloader.h" + "../../frame/util/pluginloader.cpp" + "../../frame/dbus/sni/*.h" + "../../frame/dbus/sni/*.cpp" + "../../frame/dbus/dbusmenu.h" + "../../frame/dbus/dbusmenu.cpp" + "../../frame/dbus/dbusmenumanager.h" + "../../frame/dbus/dbusmenumanager.cpp" + "../../frame/dbus/dockinterface.h" + "../../frame/dbus/dockinterface.cpp" + "../../widgets/*.h" + "../../widgets/*.cpp" + "../../frame/util/imageutil.h" + "../../frame/util/imageutil.cpp" + "../../frame/util/menudialog.h" + "../../frame/util/menudialog.cpp" + "../../frame/util/touchsignalmanager.h" + "../../frame/util/touchsignalmanager.cpp" + "../../frame/controller/proxyplugincontroller.h" + "../../frame/controller/proxyplugincontroller.cpp" + "../../frame/qtdbusextended/*.h" + "../../frame/qtdbusextended/*.cpp" + "./dbusinterface/generation_dbus_interface/*.h" + "./dbusinterface/generation_dbus_interface/*.cpp" + "./dbusinterface/types/*.h" + "./dbusinterface/types/*.cpp" +) find_package(PkgConfig REQUIRED) find_package(Qt5Widgets REQUIRED) @@ -29,7 +54,6 @@ find_package(DtkWidget REQUIRED) find_package(dbusmenu-qt5 REQUIRED) pkg_check_modules(XCB_LIBS REQUIRED xcb-ewmh xcb xcb-image xcb-composite xtst x11 xext xcb-icccm dbusmenu-qt5 xcursor) -pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) pkg_check_modules(QGSettings REQUIRED gsettings-qt) add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") @@ -39,11 +63,14 @@ target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${Qt5Gui_PRIVATE_INCLUDE_DIRS} ${XCB_LIBS_INCLUDE_DIRS} - ${DFrameworkDBus_INCLUDE_DIRS} ${QGSettings_INCLUDE_DIRS} ${dbusmenu-qt5_INCLUDE_DIRS} ../../interfaces - ../../frame ) + ../../frame + ../../frame/qtdbusextended + ./dbusinterface + ./dbusinterface/generation_dbus_interface) + target_link_libraries(${PLUGIN_NAME} PRIVATE ${DtkWidget_LIBRARIES} ${Qt5Widgets_LIBRARIES} @@ -52,7 +79,6 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE ${Qt5Svg_LIBRARIES} ${Qt5Concurrent_LIBRARIES} ${XCB_LIBS_LIBRARIES} - ${DFrameworkDBus_LIBRARIES} ${QGSettings_LIBRARIES} pthread ) diff --git a/plugins/tray/dbus/dbustraymanager.cpp b/plugins/tray/dbus/dbustraymanager.cpp index 638174b2f..6610d560d 100644 --- a/plugins/tray/dbus/dbustraymanager.cpp +++ b/plugins/tray/dbus/dbustraymanager.cpp @@ -1,6 +1,6 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DBusTrayManager -p dbustraymanager com.deepin.dde.TrayManager.xml + * Command line was: qdbusxml2cpp -c DBusTrayManager -p dbustraymanager org.deepin.dde.TrayManager.xml * * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). * @@ -16,7 +16,7 @@ */ DBusTrayManager::DBusTrayManager(QObject *parent) - : QDBusAbstractInterface("com.deepin.dde.TrayManager", "/com/deepin/dde/TrayManager", staticInterfaceName(), QDBusConnection::sessionBus(), parent) + : QDBusAbstractInterface("org.deepin.dde.TrayManager1", "/org/deepin/dde/TrayManager1", staticInterfaceName(), QDBusConnection::sessionBus(), parent) { qRegisterMetaType("TrayList"); qDBusRegisterMetaType(); diff --git a/plugins/tray/dbus/dbustraymanager.h b/plugins/tray/dbus/dbustraymanager.h index f587babb8..f47136cb5 100644 --- a/plugins/tray/dbus/dbustraymanager.h +++ b/plugins/tray/dbus/dbustraymanager.h @@ -1,6 +1,6 @@ /* * This file was generated by qdbusxml2cpp version 0.8 - * Command line was: qdbusxml2cpp -c DBusTrayManager -p dbustraymanager com.deepin.dde.TrayManager.xml + * Command line was: qdbusxml2cpp -c DBusTrayManager -p dbustraymanager org.deepin.dde.TrayManager.xml * * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). * @@ -23,7 +23,7 @@ typedef QList TrayList; /* - * Proxy class for interface com.deepin.dde.TrayManager + * Proxy class for interface org.deepin.dde.TrayManager1 */ class DBusTrayManager: public QDBusAbstractInterface { @@ -35,7 +35,7 @@ class DBusTrayManager: public QDBusAbstractInterface if (3 != arguments.count()) return; QString interfaceName = msg.arguments().at(0).toString(); - if (interfaceName !="com.deepin.dde.TrayManager") + if (interfaceName !="org.deepin.dde.TrayManager1") return; QVariantMap changedProps = qdbus_cast(arguments.at(1).value()); foreach(const QString &prop, changedProps.keys()) { @@ -50,7 +50,7 @@ class DBusTrayManager: public QDBusAbstractInterface } public: static inline const char *staticInterfaceName() - { return "com.deepin.dde.TrayManager"; } + { return "org.deepin.dde.TrayManager1"; } public: explicit DBusTrayManager(QObject *parent = 0); diff --git a/plugins/tray/dbusinterface/types/dbusimagelist.cpp b/plugins/tray/dbusinterface/types/dbusimagelist.cpp new file mode 100644 index 000000000..a317fd279 --- /dev/null +++ b/plugins/tray/dbusinterface/types/dbusimagelist.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: listenerri + * + * Maintainer: listenerri + * + * 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 . + */ + +#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"); + qDBusRegisterMetaType(); + + qRegisterMetaType("DBusImageList"); + qDBusRegisterMetaType(); +} + +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); +} diff --git a/plugins/tray/dbusinterface/types/dbusimagelist.h b/plugins/tray/dbusinterface/types/dbusimagelist.h new file mode 100644 index 000000000..cf1aae42a --- /dev/null +++ b/plugins/tray/dbusinterface/types/dbusimagelist.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: listenerri + * + * Maintainer: listenerri + * + * 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 . + */ + +#ifndef DBUSIMAGELIST_H +#define DBUSIMAGELIST_H + +#include +#include +#include + +struct DBusImage +{ + int width; + int height; + QByteArray pixels; +}; +Q_DECLARE_METATYPE(DBusImage) + +typedef QList 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 diff --git a/plugins/tray/dbusinterface/types/dbustooltip.cpp b/plugins/tray/dbusinterface/types/dbustooltip.cpp new file mode 100644 index 000000000..4f3f1766e --- /dev/null +++ b/plugins/tray/dbusinterface/types/dbustooltip.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: listenerri + * + * Maintainer: listenerri + * + * 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 . + */ + +#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"); + qDBusRegisterMetaType(); +} diff --git a/plugins/tray/dbusinterface/types/dbustooltip.h b/plugins/tray/dbusinterface/types/dbustooltip.h new file mode 100644 index 000000000..d7b0e1fa8 --- /dev/null +++ b/plugins/tray/dbusinterface/types/dbustooltip.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd. + * + * Author: listenerri + * + * Maintainer: listenerri + * + * 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 . + */ + +#ifndef DBUSTOOLTIP_H +#define DBUSTOOLTIP_H + +#include "dbusimagelist.h" + +#include +#include +#include + +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 diff --git a/plugins/tray/dbusinterface/types/dockrect.cpp b/plugins/tray/dbusinterface/types/dockrect.cpp new file mode 100644 index 000000000..560714a30 --- /dev/null +++ b/plugins/tray/dbusinterface/types/dockrect.cpp @@ -0,0 +1,50 @@ +#include "dockrect.h" +#include + +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"); + qDBusRegisterMetaType(); +} diff --git a/plugins/tray/dbusinterface/types/dockrect.h b/plugins/tray/dbusinterface/types/dockrect.h new file mode 100644 index 000000000..88ae33ea2 --- /dev/null +++ b/plugins/tray/dbusinterface/types/dockrect.h @@ -0,0 +1,28 @@ +#ifndef DOCKRECT_H +#define DOCKRECT_H + +#include +#include + +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 diff --git a/plugins/tray/dbusinterface/xml/com.deepin.dde.daemon.Dock.xml b/plugins/tray/dbusinterface/xml/com.deepin.dde.daemon.Dock.xml new file mode 100644 index 000000000..ce2cec070 --- /dev/null +++ b/plugins/tray/dbusinterface/xml/com.deepin.dde.daemon.Dock.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/tray/dbusinterface/xml/org.deepin.daemon.Gesture.xml b/plugins/tray/dbusinterface/xml/org.deepin.daemon.Gesture.xml new file mode 100644 index 000000000..e28032954 --- /dev/null +++ b/plugins/tray/dbusinterface/xml/org.deepin.daemon.Gesture.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/tray/dbusinterface/xml/org.kde.StatusNotifierItem.xml b/plugins/tray/dbusinterface/xml/org.kde.StatusNotifierItem.xml new file mode 100644 index 000000000..f1858b46e --- /dev/null +++ b/plugins/tray/dbusinterface/xml/org.kde.StatusNotifierItem.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/tray/fashiontray/fashiontraywidgetwrapper.h b/plugins/tray/fashiontray/fashiontraywidgetwrapper.h index 06bc3ef21..7ea7b2503 100644 --- a/plugins/tray/fashiontray/fashiontraywidgetwrapper.h +++ b/plugins/tray/fashiontray/fashiontraywidgetwrapper.h @@ -24,13 +24,13 @@ #include "../abstracttraywidget.h" +#include "org_deepin_daemon_gesture.h" + #include #include #include -#include - -using Gesture = com::deepin::daemon::Gesture; +using Gesture = com::deepin::daemon::Gesture1; #define TRAY_ITEM_DRAG_MIMEDATA "TrayItemDragDrop" diff --git a/plugins/tray/snitraywidget.h b/plugins/tray/snitraywidget.h index 5a8627dda..65b487fd1 100644 --- a/plugins/tray/snitraywidget.h +++ b/plugins/tray/snitraywidget.h @@ -26,7 +26,7 @@ #include "abstracttraywidget.h" #include "util/dockpopupwindow.h" -#include +#include "org_kde_statusnotifieritem.h" #include #include diff --git a/plugins/tray/tray.json b/plugins/tray/tray.json index bf27feb16..051df050f 100644 --- a/plugins/tray/tray.json +++ b/plugins/tray/tray.json @@ -1,4 +1,4 @@ { "api": "2.0.0", - "depends-daemon-dbus-service": "com.deepin.dde.TrayManager" + "depends-daemon-dbus-service": "org.deepin.dde.TrayManager1" }