diff -Nru dde-dock-4.5.9.1/CHANGELOG.md dde-dock-4.6.3.1/CHANGELOG.md
--- dde-dock-4.5.9.1/CHANGELOG.md 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/CHANGELOG.md 2018-04-11 09:44:14.000000000 +0000
@@ -1,4 +1,154 @@
-# 4.5.9.1
+
+## 4.6.3.1 (2018-04-11)
+
+
+### 4.6.3 (2018-03-28)
+
+
+#### Bug Fixes
+
+* Popup Applet not hide when item removed ([0e9d9df0](0e9d9df0))
+* popup not shown ([0a0b60aa](0a0b60aa))
+
+
+
+
+## 4.6.2 (2018-03-22)
+
+
+#### Bug Fixes
+
+* 1px line on top and left ([65100785](65100785))
+* not installed keyboard_layout.json ([3776f361](3776f361))
+* dock hang when receive attention on fastion mode ([1444fa40](1444fa40))
+
+
+
+
+
+## 4.6.1 (2018-03-15)
+
+
+#### Bug Fixes
+
+* sound input sink volume slider not init ([e06a0ac0](e06a0ac0))
+* update trayWidget on fashion mode ([ecb014c9](ecb014c9))
+* hidpi support for indicatortraywidget ([2704bf62](2704bf62))
+* indicatortraywidget connect error pertoires slots ([83cb34e8](83cb34e8))
+* Adapt lintian ([182ba8bd](182ba8bd))
+* dock hide behavior error when popup menu ([ad3f979e](ad3f979e))
+* menu auto hide ([51ee4140](51ee4140))
+* positioned at wrong place ([842e530e](842e530e))
+* show control-center not work ([2774afe4](2774afe4))
+* container item icon not clearly ([7b817246](7b817246))
+* dont show container tips if it's empty ([7ca10744](7ca10744))
+* aliasing border on highlighting app icon ([093d87e9](093d87e9))
+* dock frontend rect not support hiDPI ([9c6c41cb](9c6c41cb))
+* sound slider use svg ([a84062bc](a84062bc))
+* network refresh button support hidpi ([c784f3c5](c784f3c5))
+* network refresh button not visiable when device on ([3807c731](3807c731))
+* **WiFi:** connecting indicator icon is too large ([a005b64f](a005b64f))
+* **attention:** crash when app item destory. ([d40239a3](d40239a3))
+* **container:** item tips color wrong ([e9803aa2](e9803aa2))
+* **dockitem:** popup applet position error ([ec1ca53e](ec1ca53e))
+* **item:** panel will hide when show menu on keep always hide mode ([c29bca64](c29bca64))
+* **network:**
+ * refresh button not set size ([05015516](05015516))
+ * add new wireless disconnect svg ([0421d796](0421d796))
+ * network plugin icon diable using theme icon ([e81ba0ba](e81ba0ba))
+ * plugins icon not support hidpi ([f5b69302](f5b69302))
+ * ap state error when hotspot open ([62eae043](62eae043))
+* **plugin:** wireless not refresh ([bcc5e866](bcc5e866))
+* **power:** power icon shown if switch display mode ([4ff28712](4ff28712))
+* **sound:**
+ * resources not load ([7e94385a](7e94385a))
+ * app mute icon is not support HIDPI ([b5f8253a](b5f8253a))
+ * fallback to default icon ([3e7e65d7](3e7e65d7))
+ * plugins config file locate error ([34ce1bdd](34ce1bdd))
+* **sys-tray:** system tray alignment adjust ([9018711b](9018711b))
+* **sys_tray:** system tray not align vertial center ([a545ce08](a545ce08))
+* **visible:** visible error when display mode changed ([8ed399a5](8ed399a5))
+* **wireless:**
+ * init device enabled state ([ca1c5acd](ca1c5acd))
+ * call dbus frequently ([4d217516](4d217516))
+
+#### Features
+
+* add keybord_layout.json ([e4faf0b5](e4faf0b5))
+* add keyboard layout plugin. ([3d19f67c](3d19f67c))
+* support indicator traywidget ([58fd2df6](58fd2df6))
+* open dde-calendar with dbus call ([fb6ee52b](fb6ee52b))
+* **keyboard_layout:** add new dbus interface ([7ef2fea7](7ef2fea7))
+* **network:**
+ * add refresh animation ([5bb7b22e](5bb7b22e))
+ * support cloned address ([e2983ded](e2983ded))
+* **plugins:** keep order ([e281f088](e281f088))
+* **system-tray:** using native popup ([354cfd9f](354cfd9f))
+
+
+
+
+## 4.6.0 (2018-03-12)
+
+
+#### Features
+
+* add keyboard layout plugin. ([3d19f67c](3d19f67c))
+* support indicator traywidget ([58fd2df6](58fd2df6))
+* open dde-calendar with dbus call ([fb6ee52b](fb6ee52b))
+* **network:**
+ * add refresh animation ([5bb7b22e](5bb7b22e))
+ * support cloned address ([e2983ded](e2983ded))
+* **plugins:** keep order ([e281f088](e281f088))
+* **system-tray:** using native popup ([354cfd9f](354cfd9f))
+
+#### Bug Fixes
+
+* sound input sink volume slider not init ([e06a0ac0](e06a0ac0))
+* update trayWidget on fashion mode ([ecb014c9](ecb014c9))
+* hidpi support for indicatortraywidget ([2704bf62](2704bf62))
+* indicatortraywidget connect error pertoires slots ([83cb34e8](83cb34e8))
+* Adapt lintian ([182ba8bd](182ba8bd))
+* dock hide behavior error when popup menu ([ad3f979e](ad3f979e))
+* menu auto hide ([51ee4140](51ee4140))
+* positioned at wrong place ([842e530e](842e530e))
+* show control-center not work ([2774afe4](2774afe4))
+* container item icon not clearly ([7b817246](7b817246))
+* dont show container tips if it's empty ([7ca10744](7ca10744))
+* aliasing border on highlighting app icon ([093d87e9](093d87e9))
+* dock frontend rect not support hiDPI ([9c6c41cb](9c6c41cb))
+* sound slider use svg ([a84062bc](a84062bc))
+* network refresh button support hidpi ([c784f3c5](c784f3c5))
+* network refresh button not visiable when device on ([3807c731](3807c731))
+* **WiFi:** connecting indicator icon is too large ([a005b64f](a005b64f))
+* **attention:** crash when app item destory. ([d40239a3](d40239a3))
+* **container:** item tips color wrong ([e9803aa2](e9803aa2))
+* **item:** panel will hide when show menu on keep always hide mode ([c29bca64](c29bca64))
+* **network:**
+ * refresh button not set size ([05015516](05015516))
+ * add new wireless disconnect svg ([0421d796](0421d796))
+ * network plugin icon diable using theme icon ([e81ba0ba](e81ba0ba))
+ * plugins icon not support hidpi ([f5b69302](f5b69302))
+ * ap state error when hotspot open ([62eae043](62eae043))
+* **plugin:** wireless not refresh ([bcc5e866](bcc5e866))
+* **power:** power icon shown if switch display mode ([4ff28712](4ff28712))
+* **sound:**
+ * resources not load ([7e94385a](7e94385a))
+ * app mute icon is not support HIDPI ([b5f8253a](b5f8253a))
+ * fallback to default icon ([3e7e65d7](3e7e65d7))
+ * plugins config file locate error ([34ce1bdd](34ce1bdd))
+* **sys_tray:** system tray not align vertial center ([a545ce08](a545ce08))
+* **visible:** visible error when display mode changed ([8ed399a5](8ed399a5))
+
+
+
+# 4.5.12
+ Fix item not update when wm changed
+
+# 4.5.11
+ UI improve
+
+# 4.5.10
Minor bug fixes.
# 4.5.9
diff -Nru dde-dock-4.5.9.1/CMakeLists.txt dde-dock-4.6.3.1/CMakeLists.txt
--- dde-dock-4.5.9.1/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/CMakeLists.txt 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,47 @@
+cmake_minimum_required(VERSION 3.7)
+
+set(VERSION 4.0)
+
+project(dde-dock)
+
+#set(CMAKE_VERBOSE_MAKEFILE ON)
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_AUTORCC ON)
+set(CMAKE_CXX_FLAGS "-g -Wall")
+
+if (DEFINED DOCK_TRAY_USE_NATIVE_POPUP)
+ add_definitions(-DDOCK_TRAY_USE_NATIVE_POPUP)
+endif ()
+
+if (NOT (${CMAKE_BUILD_TYPE} MATCHES "Debug"))
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast")
+
+ # generate qm
+ execute_process(COMMAND bash "translate_generation.sh"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+endif ()
+
+file(GLOB INTERFACES "interfaces/*.h")
+
+add_subdirectory("frame")
+add_subdirectory("plugins")
+
+# Install settings
+if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ set(CMAKE_INSTALL_PREFIX /usr)
+endif ()
+
+## qm files
+file(GLOB QM_FILES "translations/*.qm")
+install(FILES ${QM_FILES}
+ DESTINATION share/dde-dock/translations)
+
+## dev files
+install (FILES ${INTERFACES}
+ DESTINATION include/dde-dock)
+
+## services files
+install(FILES frame/com.deepin.dde.Dock.service
+ DESTINATION /usr/share/dbus-1/services)
diff -Nru dde-dock-4.5.9.1/dde-dock.pro dde-dock-4.6.3.1/dde-dock.pro
--- dde-dock-4.5.9.1/dde-dock.pro 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/dde-dock.pro 1970-01-01 00:00:00.000000000 +0000
@@ -1,15 +0,0 @@
-
-TEMPLATE = subdirs
-SUBDIRS = frame \
- plugins
-
-# Automating generation .qm files from .ts files
-CONFIG(release, debug|release) {
- !system($$PWD/translate_generation.sh): error("Failed to generate translation")
-}
-TRANSLATIONS = translations/dde-dock.ts
-
-qm_files.path = $${PREFIX}/share/dde-dock/translations/
-qm_files.files = translations/*.qm
-
-INSTALLS = qm_files
diff -Nru dde-dock-4.5.9.1/debian/changelog dde-dock-4.6.3.1/debian/changelog
--- dde-dock-4.5.9.1/debian/changelog 2018-02-02 07:30:13.000000000 +0000
+++ dde-dock-4.6.3.1/debian/changelog 2018-05-07 03:21:22.000000000 +0000
@@ -1,6 +1,6 @@
-dde-dock (4.5.9.1-1) artful; urgency=low
+dde-dock (4.6.3.1-1) bionic; urgency=low
[ shuttle ]
- * Auto Version update.
+ * ['Autobuild release: 17146c0ebfcabd1eaac4730c953dba9e92ffa859']
- -- lilongyu Fri, 02 Feb 2018 15:30:08 +0800
+ -- lilongyu Mon, 07 May 2018 11:21:18 +0800
diff -Nru dde-dock-4.5.9.1/debian/control dde-dock-4.6.3.1/debian/control
--- dde-dock-4.5.9.1/debian/control 2018-02-02 07:30:27.000000000 +0000
+++ dde-dock-4.6.3.1/debian/control 2018-04-11 09:44:14.000000000 +0000
@@ -13,6 +13,7 @@
qtbase5-private-dev,
libdframeworkdbus-dev,
libgsettings-qt-dev,
+ cmake, clang
Standards-Version: 3.9.8
Homepage: http://www.deepin.org/
diff -Nru dde-dock-4.5.9.1/debian/dde-dock.install dde-dock-4.6.3.1/debian/dde-dock.install
--- dde-dock-4.5.9.1/debian/dde-dock.install 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/debian/dde-dock.install 2018-04-11 09:44:14.000000000 +0000
@@ -1,3 +1,4 @@
/usr/share
/usr/bin
/usr/lib
+/etc/dde-dock
\ No newline at end of file
diff -Nru dde-dock-4.5.9.1/debian/rules dde-dock-4.6.3.1/debian/rules
--- dde-dock-4.5.9.1/debian/rules 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/debian/rules 2018-04-11 09:44:14.000000000 +0000
@@ -2,19 +2,20 @@
# -*- makefile -*-
export QT_SELECT=5
+DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+ifeq ($(DEB_BUILD_ARCH), mips64el)
+ export CC = /usr/bin/clang
+ export CXX = /usr/bin/clang++
+endif
+
+
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@ --parallel
-ifeq ($(DEB_BUILD_ARCH), mips64el)
override_dh_auto_configure:
- dh_auto_configure -- QMAKE_CC=clang QMAKE_CXX=clang++
-endif
-
-ifeq ($(DEB_BUILD_ARCH), mipsel)
-override_dh_auto_configure:
- dh_auto_configure -- QMAKE_CC=clang QMAKE_CXX=clang++
-endif
+ dh_auto_configure -- \
+ -DDOCK_TRAY_USE_NATIVE_POPUP=YES
diff -Nru dde-dock-4.5.9.1/frame/CMakeLists.txt dde-dock-4.6.3.1/frame/CMakeLists.txt
--- dde-dock-4.5.9.1/frame/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/frame/CMakeLists.txt 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,40 @@
+cmake_minimum_required(VERSION 3.7)
+
+set(BIN_NAME dde-dock)
+
+configure_file(environments.h.in environments.h @ONLY)
+
+# Sources files
+file(GLOB_RECURSE SRCS "*.h" "*.cpp")
+
+# Find the library
+find_package(PkgConfig REQUIRED)
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Concurrent REQUIRED)
+find_package(Qt5X11Extras REQUIRED)
+find_package(Qt5DBus REQUIRED)
+find_package(DtkWidget REQUIRED)
+
+pkg_check_modules(XCB_EWMH REQUIRED xcb-ewmh x11)
+pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus)
+
+# driver-manager
+add_executable(${BIN_NAME} ${SRCS} ${INTERFACES} item/resources.qrc)
+target_include_directories(${BIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS}
+ ${XCB_EWMH_INCLUDE_DIRS}
+ ${DFrameworkDBus_INCLUDE_DIRS}
+ ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
+ ${PROJECT_BINARY_DIR}
+ ../interfaces)
+target_link_libraries(${BIN_NAME} PRIVATE
+ ${XCB_EWMH_LIBRARIES}
+ ${DFrameworkDBus_LIBRARIES}
+ ${DtkWidget_LIBRARIES}
+ ${Qt5Widgets_LIBRARIES}
+ ${Qt5Concurrent_LIBRARIES}
+ ${Qt5X11Extras_LIBRARIES}
+ ${Qt5DBus_LIBRARIES}
+)
+
+# bin
+install(TARGETS ${BIN_NAME} DESTINATION bin)
diff -Nru dde-dock-4.5.9.1/frame/controller/dockitemcontroller.cpp dde-dock-4.6.3.1/frame/controller/dockitemcontroller.cpp
--- dde-dock-4.5.9.1/frame/controller/dockitemcontroller.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/controller/dockitemcontroller.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -20,7 +20,6 @@
*/
#include "dockitemcontroller.h"
-#include "dbus/dbusdockentry.h"
#include "item/appitem.h"
#include "item/stretchitem.h"
#include "item/launcheritem.h"
@@ -309,14 +308,15 @@
else
{
insertIndex = m_itemList.size();
- for (int i(firstPluginPosition); i != m_itemList.size(); ++i)
+ for (int i(firstPluginPosition + 1); i != m_itemList.size() + 1; ++i)
{
- PluginsItem *pItem = static_cast(m_itemList[i]);
+ PluginsItem *pItem = static_cast(m_itemList[i - 1]);
Q_ASSERT(pItem);
- if (itemSortKey <= pItem->itemSortKey())
+ const int sortKey = pItem->itemSortKey();
+ if (sortKey != -1 && itemSortKey > sortKey)
continue;
- insertIndex = i;
+ insertIndex = i - 1;
break;
}
}
@@ -329,6 +329,8 @@
void DockItemController::pluginItemRemoved(PluginsItem *item)
{
+ item->hidePopup();
+
if (m_containerItem->contains(item))
m_containerItem->removeItem(item);
else
@@ -348,3 +350,38 @@
for (auto path : m_appInter->entries())
appItemAdded(path, -1);
}
+
+void DockItemController::sortPluginItems()
+{
+ int firstPluginIndex = -1;
+ for (int i(0); i != m_itemList.size(); ++i)
+ {
+ if (m_itemList[i]->itemType() == DockItem::Plugins)
+ {
+ firstPluginIndex = i;
+ break;
+ }
+ }
+
+ if (firstPluginIndex == -1)
+ return;
+
+ std::sort(m_itemList.begin() + firstPluginIndex, m_itemList.end(), [](DockItem *a, DockItem *b) -> bool {
+ PluginsItem *pa = static_cast(a);
+ PluginsItem *pb = static_cast(b);
+
+ const int aKey = pa->itemSortKey();
+ const int bKey = pb->itemSortKey();
+
+ if (bKey == -1)
+ return true;
+ if (aKey == -1)
+ return false;
+
+ return aKey < bKey;
+ });
+
+ // reset order
+ for (int i(firstPluginIndex); i != m_itemList.size(); ++i)
+ emit itemMoved(m_itemList[i], i);
+}
diff -Nru dde-dock-4.5.9.1/frame/controller/dockitemcontroller.h dde-dock-4.6.3.1/frame/controller/dockitemcontroller.h
--- dde-dock-4.5.9.1/frame/controller/dockitemcontroller.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/controller/dockitemcontroller.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -55,6 +55,7 @@
public slots:
void refershItemsIcon();
+ void sortPluginItems();
void updatePluginsItemOrderKey();
void itemMove(DockItem * const moveItem, DockItem * const replaceItem);
void itemDroppedIntoContainer(DockItem * const item);
diff -Nru dde-dock-4.5.9.1/frame/controller/dockpluginloader.cpp dde-dock-4.6.3.1/frame/controller/dockpluginloader.cpp
--- dde-dock-4.5.9.1/frame/controller/dockpluginloader.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/controller/dockpluginloader.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -33,7 +33,7 @@
void DockPluginLoader::run()
{
#ifdef QT_DEBUG
- const QDir pluginsDir("plugins");
+ const QDir pluginsDir("../plugins");
#else
const QDir pluginsDir("../lib/dde-dock/plugins");
#endif
diff -Nru dde-dock-4.5.9.1/frame/controller/dockpluginloader.h dde-dock-4.6.3.1/frame/controller/dockpluginloader.h
--- dde-dock-4.5.9.1/frame/controller/dockpluginloader.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/controller/dockpluginloader.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/controller/dockpluginscontroller.cpp dde-dock-4.6.3.1/frame/controller/dockpluginscontroller.cpp
--- dde-dock-4.5.9.1/frame/controller/dockpluginscontroller.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/controller/dockpluginscontroller.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/controller/dockpluginscontroller.h dde-dock-4.6.3.1/frame/controller/dockpluginscontroller.h
--- dde-dock-4.5.9.1/frame/controller/dockpluginscontroller.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/controller/dockpluginscontroller.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/dbus/dbusdockadaptors.cpp dde-dock-4.6.3.1/frame/dbus/dbusdockadaptors.cpp
--- dde-dock-4.5.9.1/frame/dbus/dbusdockadaptors.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/dbus/dbusdockadaptors.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/dbus/dbusdockadaptors.h dde-dock-4.6.3.1/frame/dbus/dbusdockadaptors.h
--- dde-dock-4.5.9.1/frame/dbus/dbusdockadaptors.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/dbus/dbusdockadaptors.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2016 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/dbus/dbusdockentry.cpp dde-dock-4.6.3.1/frame/dbus/dbusdockentry.cpp
--- dde-dock-4.5.9.1/frame/dbus/dbusdockentry.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/dbus/dbusdockentry.cpp 1970-01-01 00:00:00.000000000 +0000
@@ -1,31 +0,0 @@
-/*
- * This file was generated by qdbusxml2cpp version 0.8
- * Command line was: qdbusxml2cpp -c DBusDockEntry -p dbusdockentry dde-dock-entry-v1.xml
- *
- * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
- *
- * This is an auto-generated file.
- * This file may have been hand-edited. Look for HAND-EDIT comments
- * before re-generating it.
- */
-
-#include "dbusdockentry.h"
-
-/*
- * Implementation of interface class DBusDockEntry
- */
-
-DBusDockEntry::DBusDockEntry(const QString &path, QObject *parent)
- : QDBusAbstractInterface("com.deepin.dde.daemon.Dock", path, staticInterfaceName(), QDBusConnection::sessionBus(), parent)
-{
- qRegisterMetaType("WindowDict");
- qDBusRegisterMetaType();
-
- QDBusConnection::sessionBus().connect(this->service(), this->path(), "org.freedesktop.DBus.Properties", "PropertiesChanged","sa{sv}as", this, SLOT(__propertyChanged__(QDBusMessage)));
-}
-
-DBusDockEntry::~DBusDockEntry()
-{
- QDBusConnection::sessionBus().disconnect(service(), path(), "org.freedesktop.DBus.Properties", "PropertiesChanged", "sa{sv}as", this, SLOT(propertyChanged(QDBusMessage)));
-}
-
diff -Nru dde-dock-4.5.9.1/frame/dbus/dbusdockentry.h dde-dock-4.6.3.1/frame/dbus/dbusdockentry.h
--- dde-dock-4.5.9.1/frame/dbus/dbusdockentry.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/dbus/dbusdockentry.h 1970-01-01 00:00:00.000000000 +0000
@@ -1,157 +0,0 @@
-/*
- * This file was generated by qdbusxml2cpp version 0.8
- * Command line was: qdbusxml2cpp -c DBusDockEntry -p dbusdockentry dde-dock-entry-v1.xml
- *
- * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
- *
- * This is an auto-generated file.
- * Do not edit! All changes made to it will be lost.
- */
-
-#ifndef DBUSDOCKENTRY_H_1464922075
-#define DBUSDOCKENTRY_H_1464922075
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-
-typedef QMap WindowDict;
-
-/*
- * Proxy class for interface dde.dock.Entry
- */
-class DBusDockEntry: public QDBusAbstractInterface
-{
- Q_OBJECT
-
- Q_SLOT void __propertyChanged__(const QDBusMessage& msg)
- {
- QList arguments = msg.arguments();
- if (3 != arguments.count())
- return;
- QString interfaceName = msg.arguments().at(0).toString();
- if (interfaceName !="com.deepin.dde.daemon.Dock.Entry")
- return;
- QVariantMap changedProps = qdbus_cast(arguments.at(1).value());
- foreach(const QString &prop, changedProps.keys()) {
- const QMetaObject* self = metaObject();
- for (int i=self->propertyOffset(); i < self->propertyCount(); ++i) {
- QMetaProperty p = self->property(i);
- if (p.name() == prop) {
- Q_EMIT p.notifySignal().invoke(this);
- }
- }
- }
- }
-public:
- static inline const char *staticInterfaceName()
- { return "com.deepin.dde.daemon.Dock.Entry"; }
-
-public:
- explicit DBusDockEntry(const QString &path, QObject *parent = 0);
-
- ~DBusDockEntry();
-
- Q_PROPERTY(bool IsActive READ active NOTIFY ActiveChanged)
- inline bool active() const
- { return qvariant_cast< bool >(property("IsActive")); }
-
- Q_PROPERTY(WindowDict WindowTitles READ titles NOTIFY TitlesChanged)
- inline WindowDict titles() const
- { return qvariant_cast< WindowDict >(property("WindowTitles")); }
-
- Q_PROPERTY(QString Id READ id NOTIFY IdChanged)
- inline QString id() const
- { return qvariant_cast< QString >(property("Id")); }
-
- Q_PROPERTY(QString Icon READ icon NOTIFY IconChanged)
- inline QString icon() const
- { return qvariant_cast< QString >(property("Icon")); }
-
- Q_PROPERTY(QString Menu READ menu NOTIFY MenuChanged)
- inline QString menu() const
- { return qvariant_cast< QString >(property("Menu")); }
-
- Q_PROPERTY(QString Name READ name NOTIFY NameChanged)
- inline QString name() const
- { return qvariant_cast< QString >(property("Name")); }
-
- Q_PROPERTY(quint32 CurrentWindow READ currentWindow NOTIFY CurrentWindowChanged)
- inline quint32 currentWindow() const
- { return qvariant_cast< quint32 >(property("CurrentWindow")); }
-
-public Q_SLOTS: // METHODS
- inline QDBusPendingReply<> Activate()
- {
- QList argumentList;
-
- argumentList << QVariant::fromValue(quint32(QX11Info::getTimestamp()));
-
- return asyncCallWithArgumentList(QStringLiteral("Activate"), argumentList);
- }
-
- inline QDBusPendingReply<> NewInstance()
- {
- QList argumentList;
-
- argumentList << QVariant::fromValue(quint32(QX11Info::getTimestamp()));
-
- return asyncCallWithArgumentList(QStringLiteral("NewInstance"), argumentList);
- }
-
- inline QDBusPendingReply<> HandleMenuItem(const QString &item)
- {
- return asyncCall(QStringLiteral("HandleMenuItem"), QVariant::fromValue(quint32(QX11Info::getTimestamp())), item);
- }
-
- inline QDBusPendingReply<> HandleDragDrop(const QStringList &uriList)
- {
- return asyncCall(QStringLiteral("HandleDragDrop"), QVariant::fromValue(quint32(QX11Info::getTimestamp())), QVariant::fromValue(uriList));
- }
-
- inline QDBusPendingReply<> RequestDock()
- {
- return asyncCall(QStringLiteral("RequestDock"));
- }
-
- inline QDBusPendingReply<> Check()
- {
- return asyncCall(QStringLiteral("Check"));
- }
-
- inline QDBusPendingReply<> RequestUndock()
- {
- return asyncCall(QStringLiteral("RequestUndock"));
- }
-
- inline QDBusPendingReply<> PresentWindows()
- {
- return asyncCall(QStringLiteral("PresentWindows"));
- }
-
-Q_SIGNALS: // SIGNALS
-// begin property changed signals
-void ActiveChanged();
-void TitlesChanged();
-void DataChanged();
-void IdChanged();
-void TitleChanged();
-void IconChanged();
-void MenuChanged();
-void NameChanged();
-void CurrentWindowChanged();
-};
-
-namespace dde {
- namespace dock {
- typedef ::DBusDockEntry Entry;
- }
-}
-#endif
diff -Nru dde-dock-4.5.9.1/frame/dbus/dbusmenu.cpp dde-dock-4.6.3.1/frame/dbus/dbusmenu.cpp
--- dde-dock-4.5.9.1/frame/dbus/dbusmenu.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/dbus/dbusmenu.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/dbus/dbusmenu.h dde-dock-4.6.3.1/frame/dbus/dbusmenu.h
--- dde-dock-4.5.9.1/frame/dbus/dbusmenu.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/dbus/dbusmenu.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/dbus/dbusmenumanager.cpp dde-dock-4.6.3.1/frame/dbus/dbusmenumanager.cpp
--- dde-dock-4.5.9.1/frame/dbus/dbusmenumanager.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/dbus/dbusmenumanager.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/dbus/dbusmenumanager.h dde-dock-4.6.3.1/frame/dbus/dbusmenumanager.h
--- dde-dock-4.5.9.1/frame/dbus/dbusmenumanager.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/dbus/dbusmenumanager.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/environments.h.in dde-dock-4.6.3.1/frame/environments.h.in
--- dde-dock-4.5.9.1/frame/environments.h.in 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/frame/environments.h.in 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,6 @@
+#ifndef __ENVIRONMENTS_H_
+#define __ENVIRONMENTS_H_
+
+#define VERSION "@VERSION@"
+
+#endif
diff -Nru dde-dock-4.5.9.1/frame/frame.pro dde-dock-4.6.3.1/frame/frame.pro
--- dde-dock-4.5.9.1/frame/frame.pro 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/frame.pro 1970-01-01 00:00:00.000000000 +0000
@@ -1,86 +0,0 @@
-
-include(../interfaces/interfaces.pri)
-
-QT += core gui gui-private widgets dbus x11extras svg
-
-TARGET = dde-dock
-DESTDIR = $$_PRO_FILE_PWD_/../
-TEMPLATE = app
-CONFIG += c++11 link_pkgconfig
-
-PKGCONFIG += xcb-ewmh dtkwidget x11
-LIBS += -lgomp
-
-SOURCES += main.cpp \
- window/mainwindow.cpp \
- xcb/xcb_misc.cpp \
- item/dockitem.cpp \
- panel/mainpanel.cpp \
- controller/dockitemcontroller.cpp \
- dbus/dbusdockentry.cpp \
- dbus/dbusdisplay.cpp \
- item/appitem.cpp \
- util/docksettings.cpp \
- dbus/dbusclientmanager.cpp \
- dbus/dbusdock.cpp \
- util/themeappicon.cpp \
- item/launcheritem.cpp \
- dbus/dbusmenumanager.cpp \
- dbus/dbusmenu.cpp \
- item/pluginsitem.cpp \
- controller/dockpluginscontroller.cpp \
- util/imagefactory.cpp \
- util/dockpopupwindow.cpp \
- item/stretchitem.cpp \
- item/placeholderitem.cpp \
- controller/dockpluginloader.cpp \
- item/containeritem.cpp \
- item/components/containerwidget.cpp \
- dbus/dbusdockadaptors.cpp \
- item/components/appsnapshot.cpp \
- item/components/floatingpreview.cpp \
- item/components/previewcontainer.cpp
-
-HEADERS += \
- window/mainwindow.h \
- xcb/xcb_misc.h \
- item/dockitem.h \
- panel/mainpanel.h \
- controller/dockitemcontroller.h \
- dbus/dbusdockentry.h \
- dbus/dbusdisplay.h \
- item/appitem.h \
- util/docksettings.h \
- dbus/dbusclientmanager.h \
- dbus/dbusdock.h \
- util/themeappicon.h \
- item/launcheritem.h \
- dbus/dbusmenumanager.h \
- dbus/dbusmenu.h \
- item/pluginsitem.h \
- controller/dockpluginscontroller.h \
- util/imagefactory.h \
- util/dockpopupwindow.h \
- item/stretchitem.h \
- item/placeholderitem.h \
- controller/dockpluginloader.h \
- item/containeritem.h \
- item/components/containerwidget.h \
- dbus/dbusdockadaptors.h \
- item/components/appsnapshot.h \
- item/components/floatingpreview.h \
- item/components/previewcontainer.h
-
-dbus_service.files += com.deepin.dde.Dock.service
-dbus_service.path = /usr/share/dbus-1/services
-
-headers.files += ../interfaces/constants.h \
- ../interfaces/pluginproxyinterface.h \
- ../interfaces/pluginsiteminterface.h
-headers.path = /usr/include/dde-dock
-
-target.path = $${PREFIX}/bin/
-INSTALLS += target dbus_service headers
-
-RESOURCES += \
- item/resources.qrc
diff -Nru dde-dock-4.5.9.1/frame/item/appitem.cpp dde-dock-4.6.3.1/frame/item/appitem.cpp
--- dde-dock-4.5.9.1/frame/item/appitem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/appitem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -34,12 +34,71 @@
#include
#include
#include
-#include
#include
+#include
#define APP_DRAG_THRESHOLD 20
-const static qreal Frames[] = { 0, 0.327013, 0.987033, 1.77584, 2.61157, 3.45043, 4.26461, 5.03411, 5.74306, 6.37782, 6.92583, 7.37484, 7.71245, 7.92557, 8, 7.86164, 7.43184, 6.69344, 5.64142, 4.2916, 2.68986, 0.91694, -0.91694, -2.68986, -4.2916, -5.64142, -6.69344, -7.43184, -7.86164, -8, -7.86164, -7.43184, -6.69344, -5.64142, -4.2916, -2.68986, -0.91694, 0.91694, 2.68986, 4.2916, 5.64142, 6.69344, 7.43184, 7.86164, 8, 7.93082, 7.71592, 7.34672, 6.82071, 6.1458, 5.34493, 4.45847, 3.54153, 2.65507, 1.8542, 1.17929, 0.653279, 0.28408, 0.0691776, 0 };
+const static qreal Frames[] = { 0,
+ 0.327013,
+ 0.987033,
+ 1.77584,
+ 2.61157,
+ 3.45043,
+ 4.26461,
+ 5.03411,
+ 5.74306,
+ 6.37782,
+ 6.92583,
+ 7.37484,
+ 7.71245,
+ 7.92557,
+ 8, 7.86164,
+ 7.43184,
+ 6.69344,
+ 5.64142,
+ 4.2916,
+ 2.68986,
+ 0.91694,
+ -0.91694,
+ -2.68986,
+ -4.2916,
+ -5.64142,
+ -6.69344,
+ -7.43184,
+ -7.86164,
+ -8,
+ -7.86164,
+ -7.43184,
+ -6.69344,
+ -5.64142,
+ -4.2916,
+ -2.68986,
+ -0.91694,
+ 0.91694,
+ 2.68986,
+ 4.2916,
+ 5.64142,
+ 6.69344,
+ 7.43184,
+ 7.86164,
+ 8,
+ 7.93082,
+ 7.71592,
+ 7.34672,
+ 6.82071,
+ 6.1458,
+ 5.34493,
+ 4.45847,
+ 3.54153,
+ 2.65507,
+ 1.8542,
+ 1.17929,
+ 0.653279,
+ 0.28408,
+ 0.0691776,
+ 0,
+ };
int AppItem::IconBaseSize;
QPoint AppItem::MousePressPos;
@@ -48,12 +107,12 @@
: DockItem(parent),
m_appNameTips(new QLabel(this)),
m_appPreviewTips(new PreviewContainer(this)),
- m_itemEntry(new DBusDockEntry(entry.path(), this)),
+ m_itemEntryInter(new DockEntryInter("com.deepin.dde.daemon.Dock", entry.path(), QDBusConnection::sessionBus(), this)),
- m_itemView(new QGraphicsView(this)),
+ m_swingEffectView(new QGraphicsView(this)),
m_itemScene(new QGraphicsScene(this)),
- m_draging(false),
+ m_dragging(false),
m_appIcon(QPixmap()),
@@ -67,30 +126,29 @@
m_largeWatcher(new QFutureWatcher(this))
{
QHBoxLayout *centralLayout = new QHBoxLayout;
- centralLayout->addWidget(m_itemView);
+ centralLayout->addWidget(m_swingEffectView);
centralLayout->setMargin(0);
centralLayout->setSpacing(0);
- setAccessibleName(m_itemEntry->name());
+ setAccessibleName(m_itemEntryInter->name());
setAcceptDrops(true);
-// setMouseTracking(true);
setLayout(centralLayout);
- m_itemView->setScene(m_itemScene);
- m_itemView->setAlignment(Qt::AlignCenter);
- m_itemView->setVisible(false);
- m_itemView->setFrameStyle(QFrame::NoFrame);
- m_itemView->setContentsMargins(0, 0, 0, 0);
- m_itemView->setRenderHints(QPainter::SmoothPixmapTransform);
- m_itemView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
- m_itemView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- m_itemView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_swingEffectView->setScene(m_itemScene);
+ m_swingEffectView->setAlignment(Qt::AlignCenter);
+ m_swingEffectView->setVisible(false);
+ m_swingEffectView->setFrameStyle(QFrame::NoFrame);
+ m_swingEffectView->setContentsMargins(0, 0, 0, 0);
+ m_swingEffectView->setRenderHints(QPainter::SmoothPixmapTransform);
+ m_swingEffectView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
+ m_swingEffectView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ m_swingEffectView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
- m_id = m_itemEntry->id();
- m_active = m_itemEntry->active();
+ m_id = m_itemEntryInter->id();
+ m_active = m_itemEntryInter->isActive();
- m_appNameTips->setObjectName(m_itemEntry->name());
- m_appNameTips->setAccessibleName(m_itemEntry->name() + "-tips");
+ m_appNameTips->setObjectName(m_itemEntryInter->name());
+ m_appNameTips->setAccessibleName(m_itemEntryInter->name() + "-tips");
m_appNameTips->setVisible(false);
m_appNameTips->setStyleSheet("color:white;"
"padding:0px 3px;");
@@ -100,24 +158,26 @@
m_appPreviewTips->setVisible(false);
- connect(m_itemEntry, &DBusDockEntry::ActiveChanged, this, &AppItem::activeChanged);
- connect(m_itemEntry, &DBusDockEntry::TitlesChanged, this, &AppItem::updateTitle, Qt::QueuedConnection);
- connect(m_itemEntry, &DBusDockEntry::IconChanged, this, &AppItem::refershIcon);
- connect(m_itemEntry, &DBusDockEntry::ActiveChanged, this, static_cast(&AppItem::update));
+ connect(m_itemEntryInter, &DockEntryInter::IsActiveChanged, this, &AppItem::activeChanged);
+ connect(m_itemEntryInter, &DockEntryInter::IsActiveChanged, this, static_cast(&AppItem::update));
+ connect(m_itemEntryInter, &DockEntryInter::WindowInfosChanged, this, &AppItem::updateWindowInfos, Qt::QueuedConnection);
+ connect(m_itemEntryInter, &DockEntryInter::IconChanged, this, &AppItem::refershIcon);
connect(m_updateIconGeometryTimer, &QTimer::timeout, this, &AppItem::updateWindowIconGeometries, Qt::QueuedConnection);
connect(m_appPreviewTips, &PreviewContainer::requestActivateWindow, this, &AppItem::requestActivateWindow, Qt::QueuedConnection);
connect(m_appPreviewTips, &PreviewContainer::requestPreviewWindow, this, &AppItem::requestPreviewWindow, Qt::QueuedConnection);
connect(m_appPreviewTips, &PreviewContainer::requestCancelAndHidePreview, this, &AppItem::cancelAndHidePreview);
- connect(m_appPreviewTips, &PreviewContainer::requestCheckWindows, m_itemEntry, &DBusDockEntry::Check);
+ connect(m_appPreviewTips, &PreviewContainer::requestCheckWindows, m_itemEntryInter, &DockEntryInter::Check);
- updateTitle();
+ updateWindowInfos(m_itemEntryInter->windowInfos());
refershIcon();
}
AppItem::~AppItem()
{
+ stopSwingEffect();
+
m_appNameTips->deleteLater();
m_appPreviewTips->deleteLater();
}
@@ -136,7 +196,7 @@
mapToGlobal(QPoint(width(),height())));
auto *xcb_misc = XcbMisc::instance();
- for (auto it(m_titles.cbegin()); it != m_titles.cend(); ++it)
+ for (auto it(m_windowInfos.cbegin()); it != m_windowInfos.cend(); ++it)
xcb_misc->set_window_icon_geometry(it.key(), r);
}
@@ -177,7 +237,7 @@
{
DockItem::paintEvent(e);
- if (m_draging || m_itemView->isVisible())
+ if (m_dragging || (m_swingEffectView->isVisible() && DockDisplayMode != Fashion))
return;
QPainter painter(this);
@@ -190,23 +250,11 @@
// draw background
QRectF backgroundRect = itemRect;
- if (DockDisplayMode == Efficient)
- {
- switch (DockPosition)
- {
- case Top:
- case Bottom:
-// backgroundRect = itemRect;//.marginsRemoved(QMargins(2, 0, 2, 0));
-// backgroundRect = itemRect.marginsRemoved(QMargins(0, 1, 0, 1));
- case Left:
- case Right:
- backgroundRect = itemRect.marginsRemoved(QMargins(1, 1, 1, 1));
-// backgroundRect = itemRect.marginsRemoved(QMargins(1, 0, 1, 0));
- }
- }
if (DockDisplayMode == Efficient)
{
+ backgroundRect = itemRect.marginsRemoved(QMargins(1, 1, 1, 1));
+
if (m_active)
{
painter.fillRect(backgroundRect, QColor(44, 167, 248, 255 * 0.3));
@@ -223,14 +271,17 @@
painter.fillRect(activeRect, QColor(44, 167, 248, 255));
}
- else if (!m_titles.isEmpty())
- painter.fillRect(backgroundRect, QColor(255, 255, 255, 255 * 0.2));
- // else
- // painter.fillRect(backgroundRect, Qt::gray);
+ else if (!m_windowInfos.isEmpty())
+ {
+ if (hasAttention())
+ painter.fillRect(backgroundRect, QColor(241, 138, 46, 255 * .8));
+ else
+ painter.fillRect(backgroundRect, QColor(255, 255, 255, 255 * 0.2));
+ }
}
else
{
- if (!m_titles.isEmpty())
+ if (!m_windowInfos.isEmpty())
{
QPoint p;
QPixmap pixmap;
@@ -270,6 +321,9 @@
}
}
+ if (m_swingEffectView->isVisible())
+ return;
+
// icon
const QPixmap &pixmap = m_appIcon;
if (pixmap.isNull())
@@ -280,65 +334,20 @@
const int iconX = itemRect.center().x() - pixmap.rect().center().x() / ratio;
const int iconY = itemRect.center().y() - pixmap.rect().center().y() / ratio;
- // draw ligher/normal icon
- if (!m_hover)
- painter.drawPixmap(iconX, iconY, pixmap);
- else
- painter.drawPixmap(iconX, iconY, ImageFactory::lighterEffect(pixmap));
+ painter.drawPixmap(iconX, iconY, pixmap);
}
void AppItem::mouseReleaseEvent(QMouseEvent *e)
{
if (e->button() == Qt::MiddleButton) {
- m_itemEntry->NewInstance();
+ m_itemEntryInter->NewInstance(QX11Info::getTimestamp());
} else if (e->button() == Qt::LeftButton) {
- m_itemEntry->Activate();
-
- if (!m_titles.isEmpty())
- return;
-
- // start launching effects
- m_itemScene->clear();
- const auto ratio = qApp->devicePixelRatio();
- const QRect r = rect();
- const QPixmap &icon = m_appIcon;
- QGraphicsPixmapItem *item = m_itemScene->addPixmap(icon);
- item->setTransformationMode(Qt::SmoothTransformation);
- item->setPos(QPointF(r.center()) - QPointF(icon.rect().center()) / ratio);
- m_itemScene->setSceneRect(r);
- m_itemView->setSceneRect(r);
- m_itemView->setFixedSize(r.size());
-// m_itemView->setSceneRect((r.width() - icon.width()) / 2, (r.height() - icon.height()) / 2, r.width(), r.height());
+ m_itemEntryInter->Activate(QX11Info::getTimestamp());
- QTimeLine *tl = new QTimeLine;
- tl->setDuration(1200);
- tl->setFrameRange(0, 60);
- tl->setLoopCount(1);
- tl->setEasingCurve(QEasingCurve::Linear);
- tl->setStartFrame(0);
- tl->start();
-
- QGraphicsItemAnimation *ani = new QGraphicsItemAnimation;
- ani->setItem(item);
- ani->setTimeLine(tl);
-
- const int px = qreal(-icon.rect().center().x()) / ratio;
- const int py = qreal(-icon.rect().center().y()) / ratio - 18.;
- const QPoint pos = r.center() + QPoint(0, 18);
- for (int i(0); i != 60; ++i)
- {
- ani->setPosAt(i / 60.0, pos);
- ani->setTranslationAt(i / 60.0, px, py);
- ani->setRotationAt(i / 60.0, Frames[i]);
- }
-
- connect(tl, &QTimeLine::finished, tl, &QTimeLine::deleteLater);
- connect(tl, &QTimeLine::finished, ani, &QGraphicsItemAnimation::deleteLater);
- connect(tl, &QTimeLine::finished, m_itemScene, &QGraphicsScene::clear);
- connect(tl, &QTimeLine::finished, m_itemView, &QGraphicsView::hide);
-
- m_itemView->setVisible(true);
+ // play launch effect
+ if (m_windowInfos.isEmpty())
+ playSwingEffect();
}
}
@@ -387,7 +396,7 @@
{
QWidget::wheelEvent(e);
- m_itemEntry->PresentWindows();
+ m_itemEntryInter->PresentWindows();
}
void AppItem::resizeEvent(QResizeEvent *e)
@@ -414,7 +423,7 @@
{
DockItem::dragMoveEvent(e);
- if (m_titles.isEmpty())
+ if (m_windowInfos.isEmpty())
return;
if (!PopupWindow->isVisible() || PopupWindow->getContent() != m_appPreviewTips)
@@ -429,7 +438,7 @@
}
qDebug() << "accept drop event with URIs: " << uriList;
- m_itemEntry->HandleDragDrop(uriList);
+ m_itemEntryInter->HandleDragDrop(QX11Info::getTimestamp(), uriList);
}
void AppItem::leaveEvent(QEvent *e)
@@ -442,7 +451,7 @@
void AppItem::showHoverTips()
{
- if (!m_titles.isEmpty())
+ if (!m_windowInfos.isEmpty())
return showPreview();
DockItem::showHoverTips();
@@ -452,26 +461,26 @@
{
Q_UNUSED(checked);
- m_itemEntry->HandleMenuItem(itemId);
+ m_itemEntryInter->HandleMenuItem(QX11Info::getTimestamp(), itemId);
}
const QString AppItem::contextMenu() const
{
- return m_itemEntry->menu();
+ return m_itemEntryInter->menu();
}
QWidget *AppItem::popupTips()
{
- if (m_draging)
+ if (m_dragging)
return nullptr;
- if (!m_titles.isEmpty())
+ if (!m_windowInfos.isEmpty())
{
- const quint32 currentWindow = m_itemEntry->currentWindow();
- Q_ASSERT(m_titles.contains(currentWindow));
- m_appNameTips->setText(m_titles[currentWindow]);
+ const quint32 currentWindow = m_itemEntryInter->currentWindow();
+ Q_ASSERT(m_windowInfos.contains(currentWindow));
+ m_appNameTips->setText(m_windowInfos[currentWindow].title);
} else {
- m_appNameTips->setText(m_itemEntry->name());
+ m_appNameTips->setText(m_itemEntryInter->name());
}
return m_appNameTips;
@@ -479,7 +488,7 @@
void AppItem::startDrag()
{
- m_draging = true;
+ m_dragging = true;
update();
const QPixmap &dragPix = m_appIcon;
@@ -495,25 +504,42 @@
// drag out of dock panel
if (!drag->target())
- m_itemEntry->RequestUndock();
+ m_itemEntryInter->RequestUndock();
- m_draging = false;
+ m_dragging = false;
setVisible(true);
update();
}
-void AppItem::updateTitle()
+bool AppItem::hasAttention() const
+{
+ for (const auto &info : m_windowInfos)
+ if (info.attention)
+ return true;
+ return false;
+}
+
+void AppItem::updateWindowInfos(const WindowInfoMap &info)
{
- m_titles = m_itemEntry->titles();
- m_appPreviewTips->setWindowInfos(m_titles);
+ m_windowInfos = info;
+ m_appPreviewTips->setWindowInfos(m_windowInfos);
m_updateIconGeometryTimer->start();
+ // process attention effect
+ if (hasAttention())
+ {
+ if (DockDisplayMode == DisplayMode::Fashion)
+ playSwingEffect();
+ } else {
+ stopSwingEffect();
+ }
+
update();
}
void AppItem::refershIcon()
{
- const QString icon = m_itemEntry->icon();
+ const QString icon = m_itemEntryInter->icon();
const int iconSize = qMin(width(), height());
if (DockDisplayMode == Efficient)
@@ -533,7 +559,7 @@
void AppItem::showPreview()
{
- if (m_titles.isEmpty())
+ if (m_windowInfos.isEmpty())
return;
// test cursor position
@@ -549,11 +575,11 @@
// default: return;
// }
- m_appPreviewTips->setWindowInfos(m_titles);
+ showPopupWindow(m_appPreviewTips, true);
+
+ m_appPreviewTips->setWindowInfos(m_windowInfos);
m_appPreviewTips->updateSnapshots();
m_appPreviewTips->updateLayoutDirection(DockPosition);
-
- showPopupWindow(m_appPreviewTips, true);
}
void AppItem::cancelAndHidePreview()
@@ -562,3 +588,71 @@
emit requestCancelPreview();
}
+void AppItem::playSwingEffect()
+{
+ // NOTE(sbw): return if animation view already playing
+ if (m_swingEffectView->isVisible())
+ return;
+
+ stopSwingEffect();
+ if (!m_itemAnimation.timeLine())
+ {
+ QTimeLine *tl = new QTimeLine(1200, this);
+ tl->setFrameRange(0, 60);
+ tl->setLoopCount(1);
+ tl->setEasingCurve(QEasingCurve::Linear);
+ tl->setStartFrame(0);
+
+ m_itemAnimation.setTimeLine(tl);
+ }
+
+ const auto ratio = qApp->devicePixelRatio();
+ const QRect r = rect();
+ const QPixmap &icon = m_appIcon;
+
+ QGraphicsPixmapItem *item = m_itemScene->addPixmap(icon);
+ item->setTransformationMode(Qt::SmoothTransformation);
+ item->setPos(QPointF(r.center()) - QPointF(icon.rect().center()) / ratio);
+
+ m_itemAnimation.setItem(item);
+ m_itemScene->setSceneRect(r);
+ m_swingEffectView->setSceneRect(r);
+ m_swingEffectView->setFixedSize(r.size());
+
+ const int px = qreal(-icon.rect().center().x()) / ratio;
+ const int py = qreal(-icon.rect().center().y()) / ratio - 18.;
+ const QPoint pos = r.center() + QPoint(0, 18);
+ for (int i(0); i != 60; ++i)
+ {
+ m_itemAnimation.setPosAt(i / 60.0, pos);
+ m_itemAnimation.setTranslationAt(i / 60.0, px, py);
+ m_itemAnimation.setRotationAt(i / 60.0, Frames[i]);
+ }
+
+ QTimeLine *tl = m_itemAnimation.timeLine();
+ connect(tl, &QTimeLine::finished, m_swingEffectView, &QGraphicsView::hide);
+ connect(tl, &QTimeLine::finished, this, &AppItem::checkAttentionEffect);
+
+ tl->start();
+ m_swingEffectView->setVisible(true);
+}
+
+void AppItem::stopSwingEffect()
+{
+ // stop swing effect
+ m_swingEffectView->setVisible(false);
+
+ if (m_itemAnimation.timeLine())
+ m_itemAnimation.timeLine()->stop();
+ m_itemAnimation.clear();
+ m_itemScene->clear();
+}
+
+void AppItem::checkAttentionEffect()
+{
+ QTimer::singleShot(1000, this, [=] {
+ if (DockDisplayMode == DisplayMode::Fashion && hasAttention())
+ playSwingEffect();
+ });
+}
+
diff -Nru dde-dock-4.5.9.1/frame/item/appitem.h dde-dock-4.6.3.1/frame/item/appitem.h
--- dde-dock-4.5.9.1/frame/item/appitem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/appitem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -24,11 +24,15 @@
#include "dockitem.h"
#include "components/previewcontainer.h"
-#include "dbus/dbusdockentry.h"
#include "dbus/dbusclientmanager.h"
#include
#include
+#include
+
+#include
+
+using DockEntryInter = com::deepin::dde::daemon::dock::Entry;
class AppItem : public DockItem
{
@@ -71,25 +75,30 @@
QWidget *popupTips();
void startDrag();
+ bool hasAttention() const;
private slots:
- void updateTitle();
+ void updateWindowInfos(const WindowInfoMap &info);
void refershIcon();
void activeChanged();
void showPreview();
void cancelAndHidePreview();
+ void playSwingEffect();
+ void stopSwingEffect();
+ void checkAttentionEffect();
private:
QLabel *m_appNameTips;
PreviewContainer *m_appPreviewTips;
- DBusDockEntry *m_itemEntry;
+ DockEntryInter *m_itemEntryInter;
- QGraphicsView *m_itemView;
+ QGraphicsView *m_swingEffectView;
QGraphicsScene *m_itemScene;
+ QGraphicsItemAnimation m_itemAnimation;
- bool m_draging;
+ bool m_dragging;
bool m_active;
- WindowDict m_titles;
+ WindowInfoMap m_windowInfos;
QString m_id;
QPixmap m_appIcon;
QPixmap m_horizontalIndicator;
diff -Nru dde-dock-4.5.9.1/frame/item/components/appsnapshot.cpp dde-dock-4.6.3.1/frame/item/components/appsnapshot.cpp
--- dde-dock-4.5.9.1/frame/item/components/appsnapshot.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/components/appsnapshot.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -46,6 +46,7 @@
m_closeBtn->setHoverPic(":/icons/resources/close_round_hover.svg");
m_closeBtn->setPressPic(":/icons/resources/close_round_press.svg");
m_closeBtn->setVisible(false);
+ m_title->setStyleSheet("color: white;");
QHBoxLayout *centralLayout = new QHBoxLayout;
centralLayout->addWidget(m_title);
@@ -86,12 +87,15 @@
const bool composite = m_wmHelper->hasComposite();
m_title->setVisible(!composite);
-// m_closeBtn->setVisible(!composite);
+
+ QTimer::singleShot(1, this, &AppSnapshot::fetchSnapshot);
}
-void AppSnapshot::setWindowTitle(const QString &title)
+void AppSnapshot::setWindowInfo(const WindowInfo &info)
{
- m_title->setText(title);
+ m_windowInfo = info;
+
+ m_title->setText(m_windowInfo.title);
}
void AppSnapshot::dragEnterEvent(QDragEnterEvent *e)
@@ -180,6 +184,7 @@
QWidget::paintEvent(e);
QPainter painter(this);
+ painter.setRenderHint(QPainter::Antialiasing);
if (!m_wmHelper->hasComposite())
{
@@ -194,9 +199,15 @@
const QRect r = rect().marginsRemoved(QMargins(8, 8, 8, 8));
const auto ratio = devicePixelRatioF();
+ // draw attention background
+ if (m_windowInfo.attention)
+ {
+ painter.setBrush(QColor(241, 138, 46, 255 * .8));
+ painter.setPen(Qt::NoPen);
+ painter.drawRoundedRect(rect(), 5, 5);
+ }
+
// draw image
-// QImage im = m_snapshot.scaled(r.size() * ratio, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-// im.setDevicePixelRatio(ratio);
const QImage &im = m_snapshot;
const QRect ir = im.rect();
@@ -205,6 +216,13 @@
painter.drawImage(offset_x, offset_y, im);
}
+void AppSnapshot::resizeEvent(QResizeEvent *e)
+{
+ QWidget::resizeEvent(e);
+
+ QTimer::singleShot(1, this, &AppSnapshot::fetchSnapshot);
+}
+
void AppSnapshot::mousePressEvent(QMouseEvent *e)
{
QWidget::mousePressEvent(e);
diff -Nru dde-dock-4.5.9.1/frame/item/components/appsnapshot.h dde-dock-4.6.3.1/frame/item/components/appsnapshot.h
--- dde-dock-4.5.9.1/frame/item/components/appsnapshot.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/components/appsnapshot.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -30,6 +30,8 @@
#include
#include
+#include
+
DWIDGET_USE_NAMESPACE
#define SNAP_WIDTH 200
@@ -43,8 +45,9 @@
explicit AppSnapshot(const WId wid, QWidget *parent = 0);
WId wid() const { return m_wid; }
+ bool attentioned() const { return m_windowInfo.attention; }
const QImage snapshot() const { return m_snapshot; }
- const QString title() const { return m_title->text(); }
+ const QString title() const { return m_windowInfo.title; }
signals:
void entered(const WId wid) const;
@@ -55,18 +58,20 @@
void fetchSnapshot();
void closeWindow() const;
void compositeChanged() const;
- void setWindowTitle(const QString &title);
+ void setWindowInfo(const WindowInfo &info);
private:
void dragEnterEvent(QDragEnterEvent *e);
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);
void paintEvent(QPaintEvent *e);
+ void resizeEvent(QResizeEvent *e);
void mousePressEvent(QMouseEvent *e);
private:
const WId m_wid;
+ WindowInfo m_windowInfo;
QImage m_snapshot;
QLabel *m_title;
DImageButton *m_closeBtn;
diff -Nru dde-dock-4.5.9.1/frame/item/components/containerwidget.cpp dde-dock-4.6.3.1/frame/item/components/containerwidget.cpp
--- dde-dock-4.5.9.1/frame/item/components/containerwidget.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/components/containerwidget.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/item/components/containerwidget.h dde-dock-4.6.3.1/frame/item/components/containerwidget.h
--- dde-dock-4.5.9.1/frame/item/components/containerwidget.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/components/containerwidget.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/item/components/floatingpreview.cpp dde-dock-4.6.3.1/frame/item/components/floatingpreview.cpp
--- dde-dock-4.5.9.1/frame/item/components/floatingpreview.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/components/floatingpreview.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/item/components/floatingpreview.h dde-dock-4.6.3.1/frame/item/components/floatingpreview.h
--- dde-dock-4.5.9.1/frame/item/components/floatingpreview.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/components/floatingpreview.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/item/components/hoverhighlighteffect.cpp dde-dock-4.6.3.1/frame/item/components/hoverhighlighteffect.cpp
--- dde-dock-4.5.9.1/frame/item/components/hoverhighlighteffect.cpp 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/components/hoverhighlighteffect.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: sbw
+ *
+ * Maintainer: sbw
+ *
+ * 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 "hoverhighlighteffect.h"
+#include "util/imagefactory.h"
+
+#include
+#include
+
+HoverHighlightEffect::HoverHighlightEffect(QObject *parent)
+ : QGraphicsEffect(parent)
+
+ , m_highlighting(false)
+{
+
+}
+
+void HoverHighlightEffect::draw(QPainter *painter)
+{
+ const QPixmap pix = sourcePixmap(Qt::DeviceCoordinates);
+
+ if (m_highlighting)
+ {
+ painter->drawPixmap(0, 0, ImageFactory::lighterEffect(pix));
+ } else {
+ painter->drawPixmap(0, 0, pix);
+ }
+}
diff -Nru dde-dock-4.5.9.1/frame/item/components/hoverhighlighteffect.h dde-dock-4.6.3.1/frame/item/components/hoverhighlighteffect.h
--- dde-dock-4.5.9.1/frame/item/components/hoverhighlighteffect.h 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/components/hoverhighlighteffect.h 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: sbw
+ *
+ * Maintainer: sbw
+ *
+ * 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 HOVERHIGHLIGHTEFFECT_H
+#define HOVERHIGHLIGHTEFFECT_H
+
+#include
+
+class HoverHighlightEffect : public QGraphicsEffect
+{
+ Q_OBJECT
+
+public:
+ explicit HoverHighlightEffect(QObject *parent = nullptr);
+
+ void setHighlighting(const bool highlighting) { m_highlighting = highlighting; }
+
+protected:
+ void draw(QPainter *painter);
+
+private:
+ bool m_highlighting;
+};
+
+#endif // HOVERHIGHLIGHTEFFECT_H
diff -Nru dde-dock-4.5.9.1/frame/item/components/previewcontainer.cpp dde-dock-4.6.3.1/frame/item/components/previewcontainer.cpp
--- dde-dock-4.5.9.1/frame/item/components/previewcontainer.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/components/previewcontainer.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -55,7 +55,7 @@
connect(m_floatingPreview, &FloatingPreview::requestMove, this, &PreviewContainer::moveFloatingPreview);
}
-void PreviewContainer::setWindowInfos(const WindowDict &infos)
+void PreviewContainer::setWindowInfos(const WindowInfoMap &infos)
{
// check removed window
for (auto it(m_snapshots.begin()); it != m_snapshots.end();)
@@ -74,7 +74,7 @@
{
if (!m_snapshots.contains(it.key()))
appendSnapWidget(it.key());
- m_snapshots[it.key()]->setWindowTitle(it.value());
+ m_snapshots[it.key()]->setWindowInfo(it.value());
}
if (m_snapshots.isEmpty())
@@ -165,6 +165,10 @@
m_windowListLayout->addWidget(snap);
m_snapshots.insert(wid, snap);
+
+ // refresh if visible
+ if (isVisible())
+ snap->fetchSnapshot();
}
void PreviewContainer::enterEvent(QEvent *e)
@@ -184,6 +188,9 @@
void PreviewContainer::dragEnterEvent(QDragEnterEvent *e)
{
+ if (!m_wmHelper->hasComposite())
+ return;
+
e->accept();
m_needActivate = false;
diff -Nru dde-dock-4.5.9.1/frame/item/components/previewcontainer.h dde-dock-4.6.3.1/frame/item/components/previewcontainer.h
--- dde-dock-4.5.9.1/frame/item/components/previewcontainer.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/components/previewcontainer.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -26,11 +26,12 @@
#include
#include
-#include "dbus/dbusdockentry.h"
#include "constants.h"
#include "appsnapshot.h"
#include "floatingpreview.h"
+#include
+
#include
DWIDGET_USE_NAMESPACE
@@ -49,7 +50,7 @@
void requestCancelAndHidePreview() const;
public:
- void setWindowInfos(const WindowDict &infos);
+ void setWindowInfos(const WindowInfoMap &infos);
void updateSnapshots();
public slots:
diff -Nru dde-dock-4.5.9.1/frame/item/containeritem.cpp dde-dock-4.6.3.1/frame/item/containeritem.cpp
--- dde-dock-4.5.9.1/frame/item/containeritem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/containeritem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -32,6 +32,10 @@
m_containerWidget->setVisible(false);
m_popupTips->setText(tr("Click to display hidden icon"));
m_popupTips->setVisible(false);
+ m_popupTips->setStyleSheet("QLabel {"
+ "color: white;"
+ "margin: 2px 4px;"
+ "}");
setAcceptDrops(true);
}
@@ -40,8 +44,8 @@
{
if (dropping)
showPopupApplet(m_containerWidget);
- else
- hidePopup();
+// else
+// hidePopup();
m_dropping = dropping;
update();
diff -Nru dde-dock-4.5.9.1/frame/item/containeritem.h dde-dock-4.6.3.1/frame/item/containeritem.h
--- dde-dock-4.5.9.1/frame/item/containeritem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/containeritem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/item/dockitem.cpp dde-dock-4.6.3.1/frame/item/dockitem.cpp
--- dde-dock-4.5.9.1/frame/item/dockitem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/dockitem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -22,6 +22,7 @@
#include "dockitem.h"
#include "dbus/dbusmenu.h"
#include "dbus/dbusmenumanager.h"
+#include "components/hoverhighlighteffect.h"
#include
#include
@@ -35,6 +36,8 @@
m_hover(false),
m_popupShown(false),
+ m_hoverEffect(new HoverHighlightEffect(this)),
+
m_popupTipsDelayTimer(new QTimer(this)),
m_popupAdjustDelayTimer(new QTimer(this)),
@@ -55,11 +58,13 @@
m_popupTipsDelayTimer->setInterval(500);
m_popupTipsDelayTimer->setSingleShot(true);
- m_popupAdjustDelayTimer->setInterval(100);
+ m_popupAdjustDelayTimer->setInterval(10);
m_popupAdjustDelayTimer->setSingleShot(true);
+ setGraphicsEffect(m_hoverEffect);
+
connect(m_popupTipsDelayTimer, &QTimer::timeout, this, &DockItem::showHoverTips);
- connect(m_popupAdjustDelayTimer, &QTimer::timeout, this, &DockItem::updatePopupPosition);
+ connect(m_popupAdjustDelayTimer, &QTimer::timeout, this, &DockItem::updatePopupPosition, Qt::QueuedConnection);
}
DockItem::~DockItem()
@@ -78,13 +83,33 @@
DockDisplayMode = mode;
}
+bool DockItem::event(QEvent *event)
+{
+ if (m_popupShown)
+ {
+ switch (event->type())
+ {
+ case QEvent::Paint:
+ if (!m_popupAdjustDelayTimer->isActive())
+ m_popupAdjustDelayTimer->start();
+ break;
+ default:;
+ }
+ }
+
+ return QWidget::event(event);
+}
+
void DockItem::updatePopupPosition()
{
Q_ASSERT(sender() == m_popupAdjustDelayTimer);
- if (!m_popupShown || !PopupWindow->isVisible())
+ if (!m_popupShown || !PopupWindow->model())
return;
+ if (PopupWindow->getContent() != m_lastPopupWidget.data())
+ return popupWindowAccept();
+
const QPoint p = popupMarkPoint();
PopupWindow->show(p, PopupWindow->model());
}
@@ -94,13 +119,6 @@
QWidget::paintEvent(e);
}
-void DockItem::moveEvent(QMoveEvent *e)
-{
- QWidget::moveEvent(e);
-
- m_popupAdjustDelayTimer->start();
-}
-
void DockItem::mousePressEvent(QMouseEvent *e)
{
m_popupTipsDelayTimer->stop();
@@ -113,6 +131,7 @@
void DockItem::enterEvent(QEvent *e)
{
m_hover = true;
+ m_hoverEffect->setHighlighting(true);
m_popupTipsDelayTimer->start();
update();
@@ -125,6 +144,7 @@
QWidget::leaveEvent(e);
m_hover = false;
+ m_hoverEffect->setHighlighting(false);
m_popupTipsDelayTimer->stop();
// auto hide if popup is not model window
@@ -182,11 +202,8 @@
DBusMenu *menuInter = new DBusMenu(path.path(), this);
connect(menuInter, &DBusMenu::ItemInvoked, this, &DockItem::invokedMenuItem);
- connect(menuInter, &DBusMenu::MenuUnregistered, this, [=] {
- emit requestRefershWindowVisible();
- emit requestWindowAutoHide(true);
- menuInter->deleteLater();
- });
+ connect(menuInter, &DBusMenu::ItemInvoked, menuInter, &DBusMenu::deleteLater);
+ connect(menuInter, &DBusMenu::MenuUnregistered, this, &DockItem::onContextMenuAccepted, Qt::QueuedConnection);
menuInter->ShowMenu(QString(QJsonDocument(menuObject).toJson()));
@@ -194,10 +211,16 @@
emit requestWindowAutoHide(false);
}
+void DockItem::onContextMenuAccepted()
+{
+ emit requestRefershWindowVisible();
+ emit requestWindowAutoHide(true);
+}
+
void DockItem::showHoverTips()
{
// another model popup window is alread exists
- if (PopupWindow->isVisible() && PopupWindow->model())
+ if (PopupWindow->model())
return;
// if not in geometry area
@@ -215,6 +238,7 @@
void DockItem::showPopupWindow(QWidget * const content, const bool model)
{
m_popupShown = true;
+ m_lastPopupWidget = content;
if (model)
emit requestWindowAutoHide(false);
@@ -256,7 +280,7 @@
void DockItem::showPopupApplet(QWidget * const applet)
{
// another model popup window is alread exists
- if (PopupWindow->isVisible() && PopupWindow->model())
+ if (PopupWindow->model())
return;
showPopupWindow(applet, true);
@@ -310,6 +334,7 @@
void DockItem::hidePopup()
{
m_popupTipsDelayTimer->stop();
+ m_popupAdjustDelayTimer->stop();
m_popupShown = false;
PopupWindow->hide();
diff -Nru dde-dock-4.5.9.1/frame/item/dockitem.h dde-dock-4.6.3.1/frame/item/dockitem.h
--- dde-dock-4.5.9.1/frame/item/dockitem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/dockitem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -24,8 +24,10 @@
#include "constants.h"
#include "util/dockpopupwindow.h"
+#include "components/hoverhighlighteffect.h"
#include
+#include
#include
@@ -65,8 +67,8 @@
void requestRefershWindowVisible() const;
protected:
+ bool event(QEvent *event);
void paintEvent(QPaintEvent *e);
- void moveEvent(QMoveEvent *e);
void mousePressEvent(QMouseEvent *e);
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);
@@ -87,6 +89,7 @@
protected slots:
void showContextMenu();
+ void onContextMenuAccepted();
private:
void updatePopupPosition();
@@ -95,6 +98,9 @@
bool m_hover;
bool m_popupShown;
+ QPointer m_lastPopupWidget;
+ QPointer m_hoverEffect;
+
QTimer *m_popupTipsDelayTimer;
QTimer *m_popupAdjustDelayTimer;
diff -Nru dde-dock-4.5.9.1/frame/item/launcheritem.cpp dde-dock-4.6.3.1/frame/item/launcheritem.cpp
--- dde-dock-4.5.9.1/frame/item/launcheritem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/launcheritem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -70,11 +70,7 @@
const int iconX = rect().center().x() - pixmap.rect().center().x() / ratio;
const int iconY = rect().center().y() - pixmap.rect().center().y() / ratio;
- // draw ligher/normal icon
- if (!m_hover)
- painter.drawPixmap(iconX, iconY, pixmap);
- else
- painter.drawPixmap(iconX, iconY, ImageFactory::lighterEffect(pixmap));
+ painter.drawPixmap(iconX, iconY, pixmap);
}
void LauncherItem::resizeEvent(QResizeEvent *e)
diff -Nru dde-dock-4.5.9.1/frame/item/launcheritem.h dde-dock-4.6.3.1/frame/item/launcheritem.h
--- dde-dock-4.5.9.1/frame/item/launcheritem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/launcheritem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/item/placeholderitem.cpp dde-dock-4.6.3.1/frame/item/placeholderitem.cpp
--- dde-dock-4.5.9.1/frame/item/placeholderitem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/placeholderitem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/item/placeholderitem.h dde-dock-4.6.3.1/frame/item/placeholderitem.h
--- dde-dock-4.5.9.1/frame/item/placeholderitem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/placeholderitem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/item/pluginsitem.cpp dde-dock-4.6.3.1/frame/item/pluginsitem.cpp
--- dde-dock-4.5.9.1/frame/item/pluginsitem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/pluginsitem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -40,7 +40,7 @@
m_pluginInter(pluginInter),
m_centralWidget(m_pluginInter->itemWidget(itemKey)),
m_itemKey(itemKey),
- m_draging(false)
+ m_dragging(false)
{
qDebug() << "load plugins item: " << pluginInter->pluginName() << itemKey << m_centralWidget;
@@ -153,7 +153,7 @@
bool PluginsItem::eventFilter(QObject *o, QEvent *e)
{
- if (m_draging)
+ if (m_dragging)
if (o == m_centralWidget && e->type() == QEvent::Paint)
return true;
@@ -187,7 +187,7 @@
{
const QPixmap pixmap = grab();
- m_draging = true;
+ m_dragging = true;
update();
QMimeData *mime = new QMimeData;
@@ -203,7 +203,7 @@
Q_UNUSED(result);
emit itemDropped(drag->target());
- m_draging = false;
+ m_dragging = false;
setVisible(true);
update();
}
diff -Nru dde-dock-4.5.9.1/frame/item/pluginsitem.h dde-dock-4.6.3.1/frame/item/pluginsitem.h
--- dde-dock-4.5.9.1/frame/item/pluginsitem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/pluginsitem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -69,7 +69,7 @@
PluginsItemInterface * const m_pluginInter;
QWidget *m_centralWidget;
const QString m_itemKey;
- bool m_draging;
+ bool m_dragging;
static QPoint MousePressPoint;
};
diff -Nru dde-dock-4.5.9.1/frame/item/stretchitem.cpp dde-dock-4.6.3.1/frame/item/stretchitem.cpp
--- dde-dock-4.5.9.1/frame/item/stretchitem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/stretchitem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -27,6 +27,7 @@
: DockItem(parent)
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ setMinimumSize(0, 0);
}
void StretchItem::mousePressEvent(QMouseEvent *e)
diff -Nru dde-dock-4.5.9.1/frame/item/stretchitem.h dde-dock-4.6.3.1/frame/item/stretchitem.h
--- dde-dock-4.5.9.1/frame/item/stretchitem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/item/stretchitem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/main.cpp dde-dock-4.6.3.1/frame/main.cpp
--- dde-dock-4.5.9.1/frame/main.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/main.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -85,7 +85,7 @@
RegisterDdeSession();
- QTimer::singleShot(500, &mw, &MainWindow::launch);
+ QTimer::singleShot(1, &mw, &MainWindow::launch);
return app.exec();
}
diff -Nru dde-dock-4.5.9.1/frame/panel/mainpanel.cpp dde-dock-4.6.3.1/frame/panel/mainpanel.cpp
--- dde-dock-4.5.9.1/frame/panel/mainpanel.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/panel/mainpanel.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -25,63 +25,36 @@
#include
#include
-DockItem *MainPanel::DragingItem = nullptr;
+DockItem *MainPanel::DraggingItem = nullptr;
PlaceholderItem *MainPanel::RequestDockItem = nullptr;
const char *RequestDockKey = "RequestDock";
MainPanel::MainPanel(QWidget *parent)
- : QFrame(parent),
+ : DBlurEffectWidget(parent),
m_position(Dock::Top),
m_displayMode(Dock::Fashion),
m_itemLayout(new QBoxLayout(QBoxLayout::LeftToRight)),
m_itemAdjustTimer(new QTimer(this)),
- m_itemController(DockItemController::instance(this)),
-
- m_effectWidget(new DBlurEffectWidget(this)),
- m_wmHelper(DWindowManagerHelper::instance())
+ m_itemController(DockItemController::instance(this))
{
m_itemLayout->setSpacing(0);
m_itemLayout->setContentsMargins(0, 0, 0, 0);
- m_effectWidget->setBlurRectXRadius(0);
- m_effectWidget->setBlurRectYRadius(0);
- m_effectWidget->setMaskColor(DBlurEffectWidget::DarkColor);
- m_effectWidget->setBlendMode(DBlurEffectWidget::BehindWindowBlend);
- m_effectWidget->setDisabled(true);
- m_effectWidget->move(0, 0);
+ setBlurRectXRadius(0);
+ setBlurRectYRadius(0);
+ setBlendMode(BehindWindowBlend);
setAcceptDrops(true);
setAccessibleName("dock-mainpanel");
setObjectName("MainPanel");
setStyleSheet("QWidget #MainPanel {"
-// "border:" xstr(PANEL_BORDER) "px solid rgba(162, 162, 162, .2);"
// "background-color:rgba(10, 10, 10, .6);"
"}"
- "QWidget #MainPanel[displayMode='1'] {"
- "border:none;"
- "}"
- // Top
- "QWidget #MainPanel[displayMode='0'][position='0'] {"
-// "border-bottom-left-radius:5px;"
-// "border-bottom-right-radius:5px;"
- "}"
- // Right
- "QWidget #MainPanel[displayMode='0'][position='1'] {"
-// "border-top-left-radius:5px;"
-// "border-bottom-left-radius:5px;"
- "}"
- // Bottom
- "QWidget #MainPanel[displayMode='0'][position='2'] {"
-// "border-top-left-radius:6px;"
-// "border-top-right-radius:6px;"
- "}"
- // Left
- "QWidget #MainPanel[displayMode='0'][position='3'] {"
-// "border-top-right-radius:5px;"
-// "border-bottom-right-radius:5px;"
- "}"
+// "QWidget #MainPanel[displayMode='1'] {"
+// "border:none;"
+// "}"
"QWidget #MainPanel[position='0'] {"
"padding:0 " xstr(PANEL_PADDING) "px;"
"border-top:none;"
@@ -130,9 +103,15 @@
switch (m_position)
{
case Position::Top:
- case Position::Bottom: m_itemLayout->setDirection(QBoxLayout::LeftToRight); break;
+ case Position::Bottom:
+ m_itemLayout->setDirection(QBoxLayout::LeftToRight);
+ m_itemLayout->setContentsMargins(1, 0, 1, 0);
+ break;
case Position::Left:
- case Position::Right: m_itemLayout->setDirection(QBoxLayout::TopToBottom); break;
+ case Position::Right:
+ m_itemLayout->setDirection(QBoxLayout::TopToBottom);
+ m_itemLayout->setContentsMargins(0, 1, 0, 1);
+ break;
}
m_itemAdjustTimer->start();
@@ -181,51 +160,29 @@
return int(m_position);
}
-void MainPanel::moveEvent(QMoveEvent* e)
+void MainPanel::setEffectEnabled(const bool enabled)
{
- QFrame::moveEvent(e);
+ if (enabled)
+ setMaskColor(QColor(0, 0, 0, 255 * 0.4));
+ else
+ setMaskColor(QColor(55, 63, 71));
- emit geometryChanged();
+ m_itemAdjustTimer->start();
}
-void MainPanel::paintEvent(QPaintEvent *e)
+void MainPanel::moveEvent(QMoveEvent* e)
{
- QWidget::paintEvent(e);
+ DBlurEffectWidget::moveEvent(e);
-// QPainter p(this);
-// p.setRenderHint(QPainter::Antialiasing);
-
-// if (m_displayMode == Dock::Fashion && m_wmHelper->hasComposite()) {
-// QPen pen;
-// pen.setWidth(1);
-// pen.setColor(QColor(162, 162, 162, 255 * 0.2));
-
-// const QRect r = rect();
-// // border radius
-// const int br = 8;
-
-// // draw border
-// QRect borderRect = r;
-// switch (m_position)
-// {
-// case Top: borderRect.setTop(-br); break;
-// case Bottom: borderRect.setBottom(r.bottom() + br); break;
-// case Left: borderRect.setLeft(-br); break;
-// case Right: borderRect.setRight(r.right() + br); break;
-// }
-
-// p.setPen(pen);
-// p.setBrush(Qt::transparent);
-// p.drawRoundedRect(borderRect, br, br);
-// }
+ emit geometryChanged();
}
void MainPanel::resizeEvent(QResizeEvent *e)
{
- QWidget::resizeEvent(e);
+ DBlurEffectWidget::resizeEvent(e);
m_itemAdjustTimer->start();
- m_effectWidget->resize(e->size());
+// m_effectWidget->resize(e->size());
emit geometryChanged();
}
@@ -240,11 +197,11 @@
if (dragSourceItem)
{
e->accept();
- if (DragingItem)
- DragingItem->show();
+ if (DraggingItem)
+ DraggingItem->show();
return;
} else {
- DragingItem = nullptr;
+ DraggingItem = nullptr;
}
if (!e->mimeData()->formats().contains(RequestDockKey))
@@ -266,16 +223,16 @@
// internal drag swap
if (e->source())
{
- if (dst == DragingItem)
+ if (dst == DraggingItem)
return;
- if (!DragingItem)
+ if (!DraggingItem)
return;
- if (m_itemController->itemIsInContainer(DragingItem))
+ if (m_itemController->itemIsInContainer(DraggingItem))
return;
- m_itemController->itemMove(DragingItem, dst);
+ m_itemController->itemMove(DraggingItem, dst);
} else {
- DragingItem = nullptr;
+ DraggingItem = nullptr;
if (!RequestDockItem)
{
@@ -313,15 +270,15 @@
RequestDockItem = nullptr;
}
- if (DragingItem && DragingItem->itemType() != DockItem::Plugins)
- DragingItem->hide();
+ if (DraggingItem && DraggingItem->itemType() != DockItem::Plugins)
+ DraggingItem->hide();
}
void MainPanel::dropEvent(QDropEvent *e)
{
Q_UNUSED(e)
- DragingItem = nullptr;
+ DraggingItem = nullptr;
if (RequestDockItem)
{
@@ -378,6 +335,9 @@
{
Q_ASSERT(sender() == m_itemAdjustTimer);
+ // ensure all item is update, whatever layout is changed
+ QTimer::singleShot(1, this, static_cast(&MainPanel::update));
+
const auto ratio = devicePixelRatioF();
QSize itemSize;
@@ -466,8 +426,8 @@
}
}
- const int w = width() - PANEL_BORDER * 2 - PANEL_PADDING * 2;
- const int h = height() - PANEL_BORDER * 2 - PANEL_PADDING * 2;
+ const int w = width() - PANEL_BORDER * 2 - PANEL_PADDING * 2 - PANEL_MARGIN * 2;
+ const int h = height() - PANEL_BORDER * 2 - PANEL_PADDING * 2 - PANEL_MARGIN * 2;
// test if panel can display all items completely
bool containsCompletely = false;
@@ -475,11 +435,11 @@
{
case Dock::Top:
case Dock::Bottom:
- containsCompletely = totalWidth <= w; break;
+ containsCompletely = totalWidth <= w; break;
case Dock::Left:
case Dock::Right:
- containsCompletely = totalHeight <= h; break;
+ containsCompletely = totalHeight <= h; break;
default:
Q_ASSERT(false);
@@ -494,13 +454,11 @@
int base;
if (m_position == Dock::Top || m_position == Dock::Bottom)
{
-// qDebug() << "width: " << totalWidth << width();
overflow = totalWidth;
base = w;
}
else
{
-// qDebug() << "height: " << totalHeight << height();
overflow = totalHeight;
base = h;
}
@@ -540,8 +498,6 @@
// ensure all extra space assigned
Q_ASSERT(extraDecrease == 0);
-
- update();
}
///
@@ -590,17 +546,17 @@
}
///
-/// \brief MainPanel::itemDragStarted handle managed item draging
+/// \brief MainPanel::itemDragStarted handle managed item dragging
///
void MainPanel::itemDragStarted()
{
- DragingItem = qobject_cast(sender());
+ DraggingItem = qobject_cast(sender());
- if (DragingItem->itemType() == DockItem::Plugins)
+ if (DraggingItem->itemType() == DockItem::Plugins)
{
- if (static_cast(DragingItem)->allowContainer())
+ if (static_cast(DraggingItem)->allowContainer())
{
- qobject_cast(DragingItem)->hidePopup();
+ qobject_cast(DraggingItem)->hidePopup();
m_itemController->setDropping(true);
}
}
@@ -609,7 +565,7 @@
rect.setTopLeft(mapToGlobal(pos()));
rect.setSize(size());
- DragingItem->setVisible(rect.contains(QCursor::pos()));
+ DraggingItem->setVisible(rect.contains(QCursor::pos()));
}
///
diff -Nru dde-dock-4.5.9.1/frame/panel/mainpanel.h dde-dock-4.6.3.1/frame/panel/mainpanel.h
--- dde-dock-4.5.9.1/frame/panel/mainpanel.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/panel/mainpanel.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -35,12 +35,13 @@
#define xstr(s) str(s)
#define str(s) #s
#define PANEL_BORDER 0
-#define PANEL_PADDING 6
-#define WINDOW_OVERFLOW 5
+#define PANEL_PADDING 0
+#define PANEL_MARGIN 1
+#define WINDOW_OVERFLOW 4
DWIDGET_USE_NAMESPACE
-class MainPanel : public QFrame
+class MainPanel : public DBlurEffectWidget
{
Q_OBJECT
Q_PROPERTY(int displayMode READ displayMode DESIGNABLE true)
@@ -54,6 +55,8 @@
int displayMode() const;
int position() const;
+ void setEffectEnabled(const bool enabled);
+
signals:
void requestWindowAutoHide(const bool autoHide) const;
void requestRefershWindowVisible() const;
@@ -61,7 +64,6 @@
private:
void moveEvent(QMoveEvent *e);
- void paintEvent(QPaintEvent *e);
void resizeEvent(QResizeEvent *e);
void dragEnterEvent(QDragEnterEvent *e);
void dragMoveEvent(QDragMoveEvent *e);
@@ -87,10 +89,7 @@
QTimer *m_itemAdjustTimer;
DockItemController *m_itemController;
- DBlurEffectWidget *m_effectWidget;
- DWindowManagerHelper *m_wmHelper;
-
- static DockItem *DragingItem;
+ static DockItem *DraggingItem;
static PlaceholderItem *RequestDockItem;
};
diff -Nru dde-dock-4.5.9.1/frame/util/dockpopupwindow.cpp dde-dock-4.6.3.1/frame/util/dockpopupwindow.cpp
--- dde-dock-4.5.9.1/frame/util/dockpopupwindow.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/util/dockpopupwindow.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -58,7 +58,7 @@
bool DockPopupWindow::model() const
{
- return m_model;
+ return isVisible() && m_model;
}
void DockPopupWindow::setContent(QWidget *content)
@@ -122,7 +122,14 @@
return false;
// FIXME: ensure position move after global mouse release event
- QTimer::singleShot(100, this, [this] { if (isVisible()) show(m_lastPoint, m_model); });
+ if (isVisible())
+ {
+ QTimer::singleShot(10, this, [=] {
+ // NOTE(sbw): double check is necessary, in this time, the popup maybe already hided.
+ if (isVisible())
+ show(m_lastPoint, m_model);
+ });
+ }
return false;
}
diff -Nru dde-dock-4.5.9.1/frame/util/dockpopupwindow.h dde-dock-4.6.3.1/frame/util/dockpopupwindow.h
--- dde-dock-4.5.9.1/frame/util/dockpopupwindow.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/util/dockpopupwindow.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/util/docksettings.cpp dde-dock-4.6.3.1/frame/util/docksettings.cpp
--- dde-dock-4.5.9.1/frame/util/docksettings.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/util/docksettings.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -130,7 +130,7 @@
connect(&m_settingsMenu, &WhiteMenu::triggered, this, &DockSettings::menuActionClicked);
connect(m_dockInter, &DBusDock::PositionChanged, this, &DockSettings::onPositionChanged);
connect(m_dockInter, &DBusDock::IconSizeChanged, this, &DockSettings::iconSizeChanged);
- connect(m_dockInter, &DBusDock::DisplayModeChanged, this, &DockSettings::displayModeChanged);
+ connect(m_dockInter, &DBusDock::DisplayModeChanged, this, &DockSettings::onDisplayModeChanged);
connect(m_dockInter, &DBusDock::HideModeChanged, this, &DockSettings::hideModeChanged, Qt::QueuedConnection);
connect(m_dockInter, &DBusDock::HideStateChanged, this, &DockSettings::hideStateChanged);
connect(m_dockInter, &DBusDock::ServiceRestarted, this, &DockSettings::resetFrontendGeometry);
@@ -206,7 +206,8 @@
{
m_autoHide = false;
- qDeleteAll(m_hideSubMenu->actions());
+ // create actions
+ QList actions;
for (auto *p : m_itemController->pluginList())
{
if (!p->pluginIsAllowDisable())
@@ -221,9 +222,19 @@
act->setChecked(enable);
act->setData(name);
- m_hideSubMenu->addAction(act);
+ actions << act;
}
+ // sort by name
+ std::sort(actions.begin(), actions.end(), [] (QAction *a, QAction *b) -> bool {
+ return a->data().toString() > b->data().toString();
+ });
+
+ // add actions
+ qDeleteAll(m_hideSubMenu->actions());
+ for (auto act : actions)
+ m_hideSubMenu->addAction(act);
+
m_fashionModeAct.setChecked(m_displayMode == Fashion);
m_efficientModeAct.setChecked(m_displayMode == Efficient);
m_topPosAct.setChecked(m_position == Top);
@@ -241,7 +252,6 @@
m_keepHiddenAct.setChecked(m_hideMode == KeepHidden);
m_smartHideAct.setChecked(m_hideMode == SmartHide);
-
m_settingsMenu.exec(QCursor::pos());
setAutoHide(true);
@@ -306,22 +316,23 @@
void DockSettings::onPositionChanged()
{
-// qDebug() << Q_FUNC_INFO;
const Position prevPos = m_position;
const Position nextPos = Dock::Position(m_dockInter->position());
if (prevPos == nextPos)
return;
- m_position = nextPos;
- DockItem::setDockPosition(m_position);
- qApp->setProperty(PROP_POSITION, QVariant::fromValue(m_position));
+ emit positionChanged(prevPos);
- calculateWindowConfig();
+ QTimer::singleShot(200, this, [this, nextPos] {
+ m_position = nextPos;
+ DockItem::setDockPosition(nextPos);
+ qApp->setProperty(PROP_POSITION, QVariant::fromValue(nextPos));
- emit positionChanged(prevPos);
+ calculateWindowConfig();
- m_itemController->refershItemsIcon();
+ m_itemController->refershItemsIcon();
+ });
}
void DockSettings::iconSizeChanged()
@@ -335,7 +346,7 @@
emit dataChanged();
}
-void DockSettings::displayModeChanged()
+void DockSettings::onDisplayModeChanged()
{
// qDebug() << Q_FUNC_INFO;
m_displayMode = Dock::DisplayMode(m_dockInter->displayMode());
@@ -344,7 +355,9 @@
calculateWindowConfig();
- emit dataChanged();
+ emit displayModeChanegd();
+
+ QTimer::singleShot(1, m_itemController, &DockItemController::sortPluginItems);
}
void DockSettings::hideModeChanged()
@@ -518,8 +531,8 @@
}
}
- const int perfectWidth = visibleItemCount * defaultWidth + PANEL_BORDER * 2 + PANEL_PADDING * 2 + WINDOW_OVERFLOW;
- const int perfectHeight = visibleItemCount * defaultHeight + PANEL_BORDER * 2 + PANEL_PADDING * 2 + WINDOW_OVERFLOW;
+ const int perfectWidth = visibleItemCount * defaultWidth + PANEL_BORDER * 2 + PANEL_PADDING * 2 + PANEL_MARGIN * 2;
+ const int perfectHeight = visibleItemCount * defaultHeight + PANEL_BORDER * 2 + PANEL_PADDING * 2 + PANEL_MARGIN * 2;
const int calcWidth = qMin(m_primaryRect.width() - FASHION_MODE_PADDING * 2, perfectWidth);
const int calcHeight = qMin(m_primaryRect.height() - FASHION_MODE_PADDING * 2, perfectHeight);
switch (m_position)
diff -Nru dde-dock-4.5.9.1/frame/util/docksettings.h dde-dock-4.6.3.1/frame/util/docksettings.h
--- dde-dock-4.5.9.1/frame/util/docksettings.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/util/docksettings.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -84,6 +84,7 @@
void dataChanged() const;
void positionChanged(const Position prevPosition) const;
void autoHideChanged(const bool autoHide) const;
+ void displayModeChanegd() const;
void windowVisibleChanged() const;
void windowHideModeChanged() const;
void windowGeometryChanged() const;
@@ -96,7 +97,7 @@
void menuActionClicked(QAction *action);
void onPositionChanged();
void iconSizeChanged();
- void displayModeChanged();
+ void onDisplayModeChanged();
void hideModeChanged();
void hideStateChanged();
void dockItemCountChanged();
diff -Nru dde-dock-4.5.9.1/frame/util/imagefactory.cpp dde-dock-4.6.3.1/frame/util/imagefactory.cpp
--- dde-dock-4.5.9.1/frame/util/imagefactory.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/util/imagefactory.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -44,13 +44,14 @@
for (int j(0); j != width; ++j)
{
QRgb &rgba = *(QRgb*)scanLine;
- if (qAlpha(rgba) == 0xff && (qRed(rgba) || qGreen(rgba) || qBlue(rgba))) {
- const QColor hsv = QColor::fromRgba(rgba).toHsv();
- // check brightness first, color with max brightness processed with lighter will
- // become white like color which will ruin the whole image in general cases.
- if (hsv.value() < 255) {
- rgba = QColor::fromRgba(rgba).lighter(delta).rgba();
- }
+ if (qAlpha(rgba) == 0xff) {
+ rgba = QColor::fromRgba(rgba).light(delta).rgba();
+// const QColor hsv = QColor::fromRgba(rgba).toHsv();
+// // check brightness first, color with max brightness processed with lighter will
+// // become white like color which will ruin the whole image in general cases.
+// if (hsv.value() < 255) {
+// rgba = QColor::fromRgba(rgba).lighter(delta).rgba();
+// }
}
scanLine += bytesPerPixel;
}
diff -Nru dde-dock-4.5.9.1/frame/util/imagefactory.h dde-dock-4.6.3.1/frame/util/imagefactory.h
--- dde-dock-4.5.9.1/frame/util/imagefactory.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/util/imagefactory.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/util/themeappicon.cpp dde-dock-4.6.3.1/frame/util/themeappicon.cpp
--- dde-dock-4.5.9.1/frame/util/themeappicon.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/util/themeappicon.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/util/themeappicon.h dde-dock-4.6.3.1/frame/util/themeappicon.h
--- dde-dock-4.5.9.1/frame/util/themeappicon.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/util/themeappicon.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/window/mainwindow.cpp dde-dock-4.6.3.1/frame/window/mainwindow.cpp
--- dde-dock-4.5.9.1/frame/window/mainwindow.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/window/mainwindow.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -27,6 +27,7 @@
#include
#include
#include
+#include
#include
#include
@@ -94,6 +95,7 @@
setAttribute(Qt::WA_TranslucentBackground);
setAcceptDrops(true);
+ DPlatformWindowHandle::enableDXcbForWindow(this, true);
m_platformWindowHandle.setEnableBlurWindow(false);
m_platformWindowHandle.setTranslucentBackground(true);
m_platformWindowHandle.setWindowRadius(0);
@@ -159,11 +161,13 @@
return QWidget::event(e);
}
-void MainWindow::resizeEvent(QResizeEvent *e)
+void MainWindow::showEvent(QShowEvent *e)
{
- QWidget::resizeEvent(e);
+ QWidget::showEvent(e);
- m_shadowMaskOptimizeTimer->start();
+ m_platformWindowHandle.setEnableBlurWindow(false);
+ m_platformWindowHandle.setShadowOffset(QPoint());
+ m_platformWindowHandle.setShadowRadius(0);
}
void MainWindow::mousePressEvent(QMouseEvent *e)
@@ -267,13 +271,16 @@
void MainWindow::compositeChanged()
{
- const int duration = m_wmHelper->hasComposite() ? 300 : 0;
+ const bool composite = m_wmHelper->hasComposite();
+ const int duration = composite ? 300 : 0;
m_sizeChangeAni->setDuration(duration);
m_posChangeAni->setDuration(duration);
m_panelShowAni->setDuration(duration);
m_panelHideAni->setDuration(duration);
+ m_mainPanel->setEffectEnabled(composite);
+ m_shadowMaskOptimizeTimer->start();
m_positionUpdateTimer->start();
}
@@ -315,18 +322,20 @@
}
}
+ // using platform window to set real window position
windowHandle()->handle()->setGeometry(QRect(rp.x(), rp.y(), wx, hx));
}
void MainWindow::initConnections()
{
connect(m_settings, &DockSettings::dataChanged, m_positionUpdateTimer, static_cast(&QTimer::start));
- connect(m_settings, &DockSettings::windowGeometryChanged, this, &MainWindow::updateGeometry, Qt::DirectConnection);
connect(m_settings, &DockSettings::positionChanged, this, &MainWindow::positionChanged);
+ connect(m_settings, &DockSettings::autoHideChanged, this, &MainWindow::updatePanelVisible);
+ connect(m_settings, &DockSettings::windowGeometryChanged, this, &MainWindow::updateGeometry, Qt::DirectConnection);
connect(m_settings, &DockSettings::windowHideModeChanged, this, &MainWindow::setStrutPartial, Qt::QueuedConnection);
connect(m_settings, &DockSettings::windowHideModeChanged, [this] { resetPanelEnvironment(true); });
connect(m_settings, &DockSettings::windowVisibleChanged, this, &MainWindow::updatePanelVisible, Qt::QueuedConnection);
- connect(m_settings, &DockSettings::autoHideChanged, this, &MainWindow::updatePanelVisible);
+ connect(m_settings, &DockSettings::displayModeChanegd, m_positionUpdateTimer, static_cast(&QTimer::start));
connect(m_mainPanel, &MainPanel::requestRefershWindowVisible, this, &MainWindow::updatePanelVisible, Qt::QueuedConnection);
connect(m_mainPanel, &MainPanel::requestWindowAutoHide, m_settings, &DockSettings::setAutoHide);
@@ -393,7 +402,7 @@
narrow(prevPos);
// reset position & layout and slide out
- QTimer::singleShot(100, this, [&] {
+ QTimer::singleShot(200, this, [&] {
resetPanelEnvironment(false, true);
updateGeometry();
expand();
@@ -420,8 +429,10 @@
updateGeometry();
// make sure strut partial is set after the size/position animation;
- const int inter = qMax(m_sizeChangeAni->duration(), m_posChangeAni->duration());
- QTimer::singleShot(inter + 100, this, &MainWindow::setStrutPartial);
+ const int duration = qMax(m_sizeChangeAni->duration(), m_posChangeAni->duration());
+
+ QTimer::singleShot(duration, this, &MainWindow::setStrutPartial);
+ QTimer::singleShot(duration, this, &MainWindow::updatePanelVisible);
}
void MainWindow::updateGeometry()
@@ -463,6 +474,7 @@
internalMove(windowRect.topLeft());
m_mainPanel->update();
+ m_shadowMaskOptimizeTimer->start();
}
void MainWindow::clearStrutPartial()
@@ -593,6 +605,8 @@
m_panelShowAni->setStartValue(startPos);
m_panelShowAni->setEndValue(finishPos);
m_panelShowAni->start();
+ m_shadowMaskOptimizeTimer->start();
+ m_platformWindowHandle.setShadowRadius(0);
}
}
@@ -613,6 +627,7 @@
m_panelHideAni->setStartValue(m_mainPanel->pos());
m_panelHideAni->setEndValue(finishPos);
m_panelHideAni->start();
+ m_platformWindowHandle.setShadowRadius(0);
}
void MainWindow::resetPanelEnvironment(const bool visible, const bool resetPosition)
@@ -645,6 +660,7 @@
}
m_mainPanel->move(finishPos);
+ m_mainPanel->updateDockPosition(position);
}
void MainWindow::updatePanelVisible()
@@ -680,21 +696,13 @@
if (!m_launched)
return;
- qApp->processEvents();
if (m_shadowMaskOptimizeTimer->isActive())
return;
- if (m_settings->displayMode() == Efficient ||
- m_panelHideAni->state() == QPropertyAnimation::Running ||
- m_panelShowAni->state() == QPauseAnimation::Running ||
- !m_wmHelper->hasComposite())
- {
- m_platformWindowHandle.setShadowRadius(0);
- m_platformWindowHandle.setWindowRadius(0);
- } else {
- m_platformWindowHandle.setShadowRadius(60);
- m_platformWindowHandle.setWindowRadius(5);
- }
+ const bool composite = m_wmHelper->hasComposite();
+ const bool isFasion = m_settings->displayMode() == Fashion;
+
+ m_platformWindowHandle.setWindowRadius(composite && isFasion ? 5 : 0);
}
void MainWindow::positionCheck()
diff -Nru dde-dock-4.5.9.1/frame/window/mainwindow.h dde-dock-4.6.3.1/frame/window/mainwindow.h
--- dde-dock-4.5.9.1/frame/window/mainwindow.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/window/mainwindow.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -50,7 +50,7 @@
private:
using QWidget::show;
bool event(QEvent *e);
- void resizeEvent(QResizeEvent *e);
+ void showEvent(QShowEvent *e);
void mousePressEvent(QMouseEvent *e);
void keyPressEvent(QKeyEvent *e);
void enterEvent(QEvent *e);
diff -Nru dde-dock-4.5.9.1/frame/xcb/xcb_misc.cpp dde-dock-4.6.3.1/frame/xcb/xcb_misc.cpp
--- dde-dock-4.5.9.1/frame/xcb/xcb_misc.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/xcb/xcb_misc.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/frame/xcb/xcb_misc.h dde-dock-4.6.3.1/frame/xcb/xcb_misc.h
--- dde-dock-4.5.9.1/frame/xcb/xcb_misc.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/frame/xcb/xcb_misc.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/.gitignore dde-dock-4.6.3.1/.gitignore
--- dde-dock-4.5.9.1/.gitignore 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/.gitignore 2018-04-11 09:44:14.000000000 +0000
@@ -14,6 +14,7 @@
build*/
*.pro.user*
+CMakeLists.txt.user
*.DS_Store
*.qm
diff -Nru dde-dock-4.5.9.1/interfaces/constants.h dde-dock-4.6.3.1/interfaces/constants.h
--- dde-dock-4.5.9.1/interfaces/constants.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/interfaces/constants.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/interfaces/interfaces.pri dde-dock-4.6.3.1/interfaces/interfaces.pri
--- dde-dock-4.5.9.1/interfaces/interfaces.pri 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/interfaces/interfaces.pri 1970-01-01 00:00:00.000000000 +0000
@@ -1,15 +0,0 @@
-DEFINES += QT_MESSAGELOGCONTEXT
-
-HEADERS += \
- $$PWD/pluginsiteminterface.h \
- $$PWD/constants.h \
- $$PWD/pluginproxyinterface.h
-
-SOURCES += \
-
-INCLUDEPATH += $$PWD
-
-isEmpty(PREFIX)
-{
- PREFIX = /usr
-}
diff -Nru dde-dock-4.5.9.1/interfaces/pluginproxyinterface.h dde-dock-4.6.3.1/interfaces/pluginproxyinterface.h
--- dde-dock-4.5.9.1/interfaces/pluginproxyinterface.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/interfaces/pluginproxyinterface.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/interfaces/pluginsiteminterface.h dde-dock-4.6.3.1/interfaces/pluginsiteminterface.h
--- dde-dock-4.5.9.1/interfaces/pluginsiteminterface.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/interfaces/pluginsiteminterface.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/CMakeLists.txt dde-dock-4.6.3.1/plugins/CMakeLists.txt
--- dde-dock-4.5.9.1/plugins/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/CMakeLists.txt 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,9 @@
+
+add_subdirectory("datetime")
+#add_subdirectory("disk-mount")
+add_subdirectory("network")
+add_subdirectory("shutdown")
+add_subdirectory("sound")
+add_subdirectory("system-tray")
+#add_subdirectory("trash")
+add_subdirectory("keyboard-layout")
\ No newline at end of file
diff -Nru dde-dock-4.5.9.1/plugins/datetime/CMakeLists.txt dde-dock-4.6.3.1/plugins/datetime/CMakeLists.txt
--- dde-dock-4.5.9.1/plugins/datetime/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/datetime/CMakeLists.txt 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,24 @@
+
+set(PLUGIN_NAME "datetime")
+
+project(${PLUGIN_NAME})
+
+# Sources files
+file(GLOB SRCS "*.h" "*.cpp")
+
+find_package(PkgConfig REQUIRED)
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Svg REQUIRED)
+find_package(DtkWidget REQUIRED)
+
+add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN")
+add_library(${PLUGIN_NAME} SHARED ${SRCS} resources.qrc)
+set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../)
+target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ../../interfaces)
+target_link_libraries(${PLUGIN_NAME} PRIVATE
+ ${DtkWidget_LIBRARIES}
+ ${Qt5Widgets_LIBRARIES}
+ ${Qt5Svg_LIBRARIES}
+)
+
+install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)
diff -Nru dde-dock-4.5.9.1/plugins/datetime/datetimeplugin.cpp dde-dock-4.6.3.1/plugins/datetime/datetimeplugin.cpp
--- dde-dock-4.5.9.1/plugins/datetime/datetimeplugin.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/datetime/datetimeplugin.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -22,13 +22,15 @@
#include "datetimeplugin.h"
#include
+#include
DatetimePlugin::DatetimePlugin(QObject *parent)
: QObject(parent),
m_dateTipsLabel(new QLabel),
- m_refershTimer(new QTimer(this))
+ m_refershTimer(new QTimer(this)),
+ m_settings("deepin", "dde-dock-datetime")
{
m_dateTipsLabel->setObjectName("datetime");
m_dateTipsLabel->setStyleSheet("color:white;"
@@ -82,7 +84,16 @@
{
Q_UNUSED(itemKey);
- return -1;
+ const QString key = QString("pos_%1").arg(displayMode());
+ return m_settings.value(key, 0).toInt();
+}
+
+void DatetimePlugin::setSortKey(const QString &itemKey, const int order)
+{
+ Q_UNUSED(itemKey);
+
+ const QString key = QString("pos_%1").arg(displayMode());
+ m_settings.setValue(key, order);
}
QWidget *DatetimePlugin::itemWidget(const QString &itemKey)
diff -Nru dde-dock-4.5.9.1/plugins/datetime/datetimeplugin.h dde-dock-4.6.3.1/plugins/datetime/datetimeplugin.h
--- dde-dock-4.5.9.1/plugins/datetime/datetimeplugin.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/datetime/datetimeplugin.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -27,6 +27,7 @@
#include
#include
+#include
class DatetimePlugin : public QObject, PluginsItemInterface
{
@@ -45,7 +46,8 @@
bool pluginIsAllowDisable() override { return true; }
bool pluginIsDisable() override;
- int itemSortKey(const QString &itemKey) override;
+ int itemSortKey(const QString &itemKey);
+ void setSortKey(const QString &itemKey, const int order);
QWidget *itemWidget(const QString &itemKey) override;
QWidget *itemTipsWidget(const QString &itemKey) override;
@@ -65,6 +67,7 @@
QTimer *m_refershTimer;
QString m_currentTimeString;
+ QSettings m_settings;
};
#endif // DATETIMEPLUGIN_H
diff -Nru dde-dock-4.5.9.1/plugins/datetime/datetime.pro dde-dock-4.6.3.1/plugins/datetime/datetime.pro
--- dde-dock-4.5.9.1/plugins/datetime/datetime.pro 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/datetime/datetime.pro 1970-01-01 00:00:00.000000000 +0000
@@ -1,25 +0,0 @@
-
-include(../../interfaces/interfaces.pri)
-
-QT += widgets svg
-TEMPLATE = lib
-CONFIG += plugin c++11 link_pkgconfig
-PKGCONFIG +=
-
-TARGET = $$qtLibraryTarget(datetime)
-DESTDIR = $$_PRO_FILE_PWD_/../
-DISTFILES += datetime.json
-
-HEADERS += \
- datetimeplugin.h \
- datetimewidget.h
-
-SOURCES += \
- datetimeplugin.cpp \
- datetimewidget.cpp
-
-target.path = $${PREFIX}/lib/dde-dock/plugins/
-INSTALLS += target
-
-RESOURCES += \
- resources.qrc
diff -Nru dde-dock-4.5.9.1/plugins/datetime/datetimewidget.cpp dde-dock-4.6.3.1/plugins/datetime/datetimewidget.cpp
--- dde-dock-4.5.9.1/plugins/datetime/datetimewidget.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/datetime/datetimewidget.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -167,7 +167,7 @@
const int tips_height = tips_width / 2;
QPixmap tips;
- if (current.time().hour() > 12)
+ if (current.time().hour() > 11)
tips = loadSvg(":/icons/resources/icons/tips-pm.svg", QSize(tips_width, tips_height));
else
tips = loadSvg(":/icons/resources/icons/tips-am.svg", QSize(tips_width, tips_height));
diff -Nru dde-dock-4.5.9.1/plugins/datetime/datetimewidget.h dde-dock-4.6.3.1/plugins/datetime/datetimewidget.h
--- dde-dock-4.5.9.1/plugins/datetime/datetimewidget.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/datetime/datetimewidget.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/CMakeLists.txt dde-dock-4.6.3.1/plugins/disk-mount/CMakeLists.txt
--- dde-dock-4.5.9.1/plugins/disk-mount/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/CMakeLists.txt 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,24 @@
+
+set(PLUGIN_NAME "disk-mount")
+
+project(${PLUGIN_NAME})
+
+# Sources files
+file(GLOB SRCS "*.h" "*.cpp")
+
+find_package(PkgConfig REQUIRED)
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Svg REQUIRED)
+find_package(DtkWidget REQUIRED)
+
+add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN")
+add_library(${PLUGIN_NAME} SHARED ${SRCS} resources.qrc)
+set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../)
+target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ../../interfaces)
+target_link_libraries(${PLUGIN_NAME} PRIVATE
+ ${DtkWidget_LIBRARIES}
+ ${Qt5Widgets_LIBRARIES}
+ ${Qt5Svg_LIBRARIES}
+)
+
+install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/dbus/variant/diskinfo.cpp dde-dock-4.6.3.1/plugins/disk-mount/dbus/variant/diskinfo.cpp
--- dde-dock-4.5.9.1/plugins/disk-mount/dbus/variant/diskinfo.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/dbus/variant/diskinfo.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/dbus/variant/diskinfo.h dde-dock-4.6.3.1/plugins/disk-mount/dbus/variant/diskinfo.h
--- dde-dock-4.5.9.1/plugins/disk-mount/dbus/variant/diskinfo.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/dbus/variant/diskinfo.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -25,7 +25,6 @@
#include
#include
#include
-#include
class DiskInfo
{
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/diskcontrolitem.cpp dde-dock-4.6.3.1/plugins/disk-mount/diskcontrolitem.cpp
--- dde-dock-4.5.9.1/plugins/disk-mount/diskcontrolitem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/diskcontrolitem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/diskcontrolitem.h dde-dock-4.6.3.1/plugins/disk-mount/diskcontrolitem.h
--- dde-dock-4.5.9.1/plugins/disk-mount/diskcontrolitem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/diskcontrolitem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/diskcontrolwidget.cpp dde-dock-4.6.3.1/plugins/disk-mount/diskcontrolwidget.cpp
--- dde-dock-4.5.9.1/plugins/disk-mount/diskcontrolwidget.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/diskcontrolwidget.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/diskcontrolwidget.h dde-dock-4.6.3.1/plugins/disk-mount/diskcontrolwidget.h
--- dde-dock-4.5.9.1/plugins/disk-mount/diskcontrolwidget.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/diskcontrolwidget.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/diskmountplugin.cpp dde-dock-4.6.3.1/plugins/disk-mount/diskmountplugin.cpp
--- dde-dock-4.5.9.1/plugins/disk-mount/diskmountplugin.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/diskmountplugin.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/diskmountplugin.h dde-dock-4.6.3.1/plugins/disk-mount/diskmountplugin.h
--- dde-dock-4.5.9.1/plugins/disk-mount/diskmountplugin.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/diskmountplugin.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/disk-mount.pro dde-dock-4.6.3.1/plugins/disk-mount/disk-mount.pro
--- dde-dock-4.5.9.1/plugins/disk-mount/disk-mount.pro 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/disk-mount.pro 1970-01-01 00:00:00.000000000 +0000
@@ -1,35 +0,0 @@
-
-include(../../interfaces/interfaces.pri)
-
-QT += widgets svg dbus
-TEMPLATE = lib
-CONFIG += plugin c++11 link_pkgconfig
-PKGCONFIG += dtkwidget
-
-TARGET = $$qtLibraryTarget(disk-mount)
-DESTDIR = $$_PRO_FILE_PWD_/../
-DISTFILES += disk-mount.json
-
-HEADERS += \
- diskmountplugin.h \
- dbus/dbusdiskmount.h \
- dbus/variant/diskinfo.h \
- diskcontrolwidget.h \
- diskpluginitem.h \
- imageutil.h \
- diskcontrolitem.h
-
-SOURCES += \
- diskmountplugin.cpp \
- dbus/dbusdiskmount.cpp \
- dbus/variant/diskinfo.cpp \
- diskcontrolwidget.cpp \
- diskpluginitem.cpp \
- imageutil.cpp \
- diskcontrolitem.cpp
-
-target.path = $${PREFIX}/lib/dde-dock/plugins/
-INSTALLS += target
-
-RESOURCES += \
- resources.qrc
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/diskpluginitem.cpp dde-dock-4.6.3.1/plugins/disk-mount/diskpluginitem.cpp
--- dde-dock-4.5.9.1/plugins/disk-mount/diskpluginitem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/diskpluginitem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/diskpluginitem.h dde-dock-4.6.3.1/plugins/disk-mount/diskpluginitem.h
--- dde-dock-4.5.9.1/plugins/disk-mount/diskpluginitem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/diskpluginitem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/imageutil.cpp dde-dock-4.6.3.1/plugins/disk-mount/imageutil.cpp
--- dde-dock-4.5.9.1/plugins/disk-mount/imageutil.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/imageutil.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/disk-mount/imageutil.h dde-dock-4.6.3.1/plugins/disk-mount/imageutil.h
--- dde-dock-4.5.9.1/plugins/disk-mount/imageutil.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/disk-mount/imageutil.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/keyboard-layout/CMakeLists.txt dde-dock-4.6.3.1/plugins/keyboard-layout/CMakeLists.txt
--- dde-dock-4.5.9.1/plugins/keyboard-layout/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/keyboard-layout/CMakeLists.txt 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,36 @@
+
+set(PLUGIN_NAME "keyboard-layout")
+
+project(${PLUGIN_NAME})
+
+# Sources files
+file(GLOB_RECURSE SRCS "*.h" "*.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)
+target_link_libraries(${PLUGIN_NAME} PRIVATE
+ ${DtkWidget_LIBRARIES}
+ ${DFrameworkDBus_LIBRARIES}
+ ${QGSettings_LIBRARIES}
+ ${Qt5Widgets_LIBRARIES}
+ ${Qt5Svg_LIBRARIES}
+ ${Qt5DBus_LIBRARIES}
+)
+
+install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)
+install(FILES ./keybord_layout.json DESTINATION /etc/dde-dock/indicator)
diff -Nru dde-dock-4.5.9.1/plugins/keyboard-layout/dbusadaptors.cpp dde-dock-4.6.3.1/plugins/keyboard-layout/dbusadaptors.cpp
--- dde-dock-4.5.9.1/plugins/keyboard-layout/dbusadaptors.cpp 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/keyboard-layout/dbusadaptors.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: rekols
+ *
+ * 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 "dbusadaptors.h"
+#include
+
+DBusAdaptors::DBusAdaptors(QObject *parent)
+ : QDBusAbstractAdaptor(parent),
+ m_keyboard(new Keyboard("com.deepin.daemon.InputDevices",
+ "/com/deepin/daemon/InputDevice/Keyboard",
+ QDBusConnection::sessionBus(), this))
+{
+ connect(m_keyboard, &Keyboard::CurrentLayoutChanged, this,
+ [=] {
+ emit layoutChanged(layout());
+ });
+}
+
+DBusAdaptors::~DBusAdaptors()
+{
+}
+
+QString DBusAdaptors::layout() const
+{
+ return QString(m_keyboard->currentLayout()).split(';').first();
+}
diff -Nru dde-dock-4.5.9.1/plugins/keyboard-layout/dbusadaptors.h dde-dock-4.6.3.1/plugins/keyboard-layout/dbusadaptors.h
--- dde-dock-4.5.9.1/plugins/keyboard-layout/dbusadaptors.h 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/keyboard-layout/dbusadaptors.h 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: rekols
+ *
+ * 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 DBUSADAPTORS_H
+#define DBUSADAPTORS_H
+
+#include
+#include
+
+using Keyboard = com::deepin::daemon::inputdevice::Keyboard;
+
+class DBusAdaptors : public QDBusAbstractAdaptor
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "com.deepin.dde.Keyboard")
+ Q_CLASSINFO("D-Bus Introspection", ""
+ " \n"
+ " \n"
+ " "
+ " "
+ " "
+ " \n"
+ "")
+
+public:
+ DBusAdaptors(QObject *parent = nullptr);
+ ~DBusAdaptors();
+
+public:
+ Q_PROPERTY(QString layout READ layout NOTIFY layoutChanged)
+ QString layout() const;
+
+signals:
+ void layoutChanged(QString text);
+
+private:
+ Keyboard *m_keyboard;
+};
+
+#endif
diff -Nru dde-dock-4.5.9.1/plugins/keyboard-layout/keyboard.json dde-dock-4.6.3.1/plugins/keyboard-layout/keyboard.json
--- dde-dock-4.5.9.1/plugins/keyboard-layout/keyboard.json 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/keyboard-layout/keyboard.json 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,3 @@
+{
+ "api": "1.0"
+}
diff -Nru dde-dock-4.5.9.1/plugins/keyboard-layout/keyboardplugin.cpp dde-dock-4.6.3.1/plugins/keyboard-layout/keyboardplugin.cpp
--- dde-dock-4.5.9.1/plugins/keyboard-layout/keyboardplugin.cpp 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/keyboard-layout/keyboardplugin.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: rekols
+ *
+ * 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 "keyboardplugin.h"
+
+KeyboardPlugin::KeyboardPlugin(QObject *parent)
+ : QObject(parent)
+{
+}
+
+KeyboardPlugin::~KeyboardPlugin()
+{
+}
+
+const QString KeyboardPlugin::pluginName() const
+{
+ return "keyboard";
+}
+
+const QString KeyboardPlugin::pluginDisplayName() const
+{
+ return "Keyboard";
+}
+
+void KeyboardPlugin::init(PluginProxyInterface *proxyInter)
+{
+ m_proxyInter = proxyInter;
+ m_dbusAdaptors = new DBusAdaptors(this);
+
+ QDBusConnection::sessionBus().registerService("com.deepin.dde.Keyboard");
+ QDBusConnection::sessionBus().registerObject("/com/deepin/dde/Keyboard", "com.deepin.dde.Keyboard", this);
+}
+
+QWidget* KeyboardPlugin::itemWidget(const QString &itemKey)
+{
+ Q_UNUSED(itemKey);
+
+ return nullptr;
+}
+
+QWidget* KeyboardPlugin::itemTipsWidget(const QString &itemKey)
+{
+ Q_UNUSED(itemKey);
+
+ return nullptr;
+}
diff -Nru dde-dock-4.5.9.1/plugins/keyboard-layout/keyboardplugin.h dde-dock-4.6.3.1/plugins/keyboard-layout/keyboardplugin.h
--- dde-dock-4.5.9.1/plugins/keyboard-layout/keyboardplugin.h 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/keyboard-layout/keyboardplugin.h 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: rekols
+ *
+ * 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 KEYBOARDPLUGIN_H
+#define KEYBOARDPLUGIN_H
+
+#include "pluginsiteminterface.h"
+#include "dbusadaptors.h"
+
+class KeyboardPlugin : public QObject , PluginsItemInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(PluginsItemInterface)
+ Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "keyboard.json")
+
+public:
+ KeyboardPlugin(QObject *parent = nullptr);
+ ~KeyboardPlugin();
+
+ const QString pluginName() const override;
+ const QString pluginDisplayName() const override;
+ void init(PluginProxyInterface *proxyInter) override;
+
+ QWidget *itemWidget(const QString &itemKey) override;
+ QWidget *itemTipsWidget(const QString &itemKey) override;
+
+private:
+ DBusAdaptors *m_dbusAdaptors;
+};
+
+#endif
diff -Nru dde-dock-4.5.9.1/plugins/keyboard-layout/keybord_layout.json dde-dock-4.6.3.1/plugins/keyboard-layout/keybord_layout.json
--- dde-dock-4.5.9.1/plugins/keyboard-layout/keybord_layout.json 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/keyboard-layout/keybord_layout.json 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,10 @@
+{
+ "data": {
+ "text": {
+ "dbus_service": "com.deepin.dde.Keyboard",
+ "dbus_path": "/com/deepin/dde/Keyboard",
+ "dbus_interface": "com.deepin.dde.Keyboard",
+ "dbus_properties": "layout"
+ }
+ }
+}
diff -Nru dde-dock-4.5.9.1/plugins/network/CMakeLists.txt dde-dock-4.6.3.1/plugins/network/CMakeLists.txt
--- dde-dock-4.5.9.1/plugins/network/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/CMakeLists.txt 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,28 @@
+
+set(PLUGIN_NAME "network")
+
+project(${PLUGIN_NAME})
+
+# Sources files
+file(GLOB_RECURSE SRCS "*.h" "*.cpp")
+
+find_package(PkgConfig REQUIRED)
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Svg REQUIRED)
+find_package(Qt5DBus REQUIRED)
+find_package(DtkWidget REQUIRED)
+
+add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN")
+add_library(${PLUGIN_NAME} SHARED ${SRCS} resources.qrc)
+set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../)
+target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS}
+ ${Qt5DBus_INCLUDE_DIRS}
+ ../../interfaces)
+target_link_libraries(${PLUGIN_NAME} PRIVATE
+ ${DtkWidget_LIBRARIES}
+ ${Qt5Widgets_LIBRARIES}
+ ${Qt5Svg_LIBRARIES}
+ ${Qt5DBus_LIBRARIES}
+)
+
+install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/accesspoint.cpp dde-dock-4.6.3.1/plugins/network/item/applet/accesspoint.cpp
--- dde-dock-4.5.9.1/plugins/network/item/applet/accesspoint.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/accesspoint.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/accesspoint.h dde-dock-4.6.3.1/plugins/network/item/applet/accesspoint.h
--- dde-dock-4.5.9.1/plugins/network/item/applet/accesspoint.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/accesspoint.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/accesspointwidget.cpp dde-dock-4.6.3.1/plugins/network/item/applet/accesspointwidget.cpp
--- dde-dock-4.5.9.1/plugins/network/item/applet/accesspointwidget.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/accesspointwidget.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/accesspointwidget.h dde-dock-4.6.3.1/plugins/network/item/applet/accesspointwidget.h
--- dde-dock-4.5.9.1/plugins/network/item/applet/accesspointwidget.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/accesspointwidget.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/devicecontrolwidget.cpp dde-dock-4.6.3.1/plugins/network/item/applet/devicecontrolwidget.cpp
--- dde-dock-4.5.9.1/plugins/network/item/applet/devicecontrolwidget.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/devicecontrolwidget.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -21,12 +21,12 @@
#include "devicecontrolwidget.h"
#include "horizontalseperator.h"
-#include "refreshbutton.h"
#include
#include
#include
#include
+#include
DWIDGET_USE_NAMESPACE
@@ -39,24 +39,20 @@
m_switchBtn = new DSwitchButton;
- m_refreshBtn = new RefreshButton;
-
const QPixmap pixmap = DHiDPIHelper::loadNxPixmap(":/wireless/resources/wireless/refresh_normal.svg");
- m_refreshView = new QWidget;
- m_refreshView->setFixedSize(pixmap.size() / devicePixelRatioF());
- m_refreshView->hide();
-
- m_loadingIndicator = new DLoadingIndicator(m_refreshView);
+ m_loadingIndicator = new DLoadingIndicator;
m_loadingIndicator->setImageSource(pixmap);
m_loadingIndicator->setLoading(false);
+ m_loadingIndicator->setSmooth(true);
m_loadingIndicator->setAniDuration(1000);
m_loadingIndicator->setAniEasingCurve(QEasingCurve::InOutCirc);
+ m_loadingIndicator->installEventFilter(this);
+ m_loadingIndicator->setFixedSize(pixmap.size() / devicePixelRatioF());
QHBoxLayout *infoLayout = new QHBoxLayout;
infoLayout->addWidget(m_deviceName);
- infoLayout->addWidget(m_refreshBtn);
- infoLayout->addWidget(m_refreshView);
+ infoLayout->addWidget(m_loadingIndicator);
infoLayout->addSpacing(10);
infoLayout->addWidget(m_switchBtn);
infoLayout->setSpacing(0);
@@ -78,7 +74,6 @@
setFixedHeight(30);
connect(m_switchBtn, &DSwitchButton::checkedChanged, this, &DeviceControlWidget::deviceEnableChanged);
- connect(m_refreshBtn, &RefreshButton::clicked, this, &DeviceControlWidget::refreshNetwork);
}
void DeviceControlWidget::setDeviceName(const QString &name)
@@ -90,22 +85,30 @@
{
m_switchBtn->blockSignals(true);
m_switchBtn->setChecked(enable);
+ m_loadingIndicator->setVisible(enable);
m_switchBtn->blockSignals(false);
+}
+
+bool DeviceControlWidget::eventFilter(QObject *watched, QEvent *event)
+{
+ if (watched == m_loadingIndicator) {
+ if (event->type() == QEvent::MouseButtonPress) {
+ if (!m_loadingIndicator->loading()) {
+ refreshNetwork();
+ }
+ }
+ }
- m_refreshBtn->setVisible(enable);
+ return QWidget::eventFilter(watched, event);
}
void DeviceControlWidget::refreshNetwork()
{
emit requestRefresh();
- m_refreshBtn->hide();
m_loadingIndicator->setLoading(true);
- m_refreshView->show();
QTimer::singleShot(1000, this, [=] {
- m_refreshBtn->show();
- m_refreshView->hide();
m_loadingIndicator->setLoading(false);
});
}
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/devicecontrolwidget.h dde-dock-4.6.3.1/plugins/network/item/applet/devicecontrolwidget.h
--- dde-dock-4.5.9.1/plugins/network/item/applet/devicecontrolwidget.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/devicecontrolwidget.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -31,7 +31,6 @@
DWIDGET_USE_NAMESPACE
-class RefreshButton;
class DeviceControlWidget : public QWidget
{
Q_OBJECT
@@ -47,6 +46,9 @@
void deviceEnableChanged(const bool enable) const;
void requestRefresh() const;
+protected:
+ bool eventFilter(QObject *watched, QEvent *event) Q_DECL_OVERRIDE;
+
private slots:
void refreshNetwork();
@@ -54,8 +56,6 @@
QLabel *m_deviceName;
Dtk::Widget::DSwitchButton *m_switchBtn;
// HorizontalSeperator *m_seperator;
- RefreshButton *m_refreshBtn;
- QWidget *m_refreshView;
DLoadingIndicator *m_loadingIndicator;
};
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/horizontalseperator.cpp dde-dock-4.6.3.1/plugins/network/item/applet/horizontalseperator.cpp
--- dde-dock-4.5.9.1/plugins/network/item/applet/horizontalseperator.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/horizontalseperator.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/horizontalseperator.h dde-dock-4.6.3.1/plugins/network/item/applet/horizontalseperator.h
--- dde-dock-4.5.9.1/plugins/network/item/applet/horizontalseperator.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/horizontalseperator.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/refreshbutton.cpp dde-dock-4.6.3.1/plugins/network/item/applet/refreshbutton.cpp
--- dde-dock-4.5.9.1/plugins/network/item/applet/refreshbutton.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/refreshbutton.cpp 1970-01-01 00:00:00.000000000 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
- *
- * Author: sbw
- *
- * Maintainer: sbw
- *
- * 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 "refreshbutton.h"
-
-#include
-#include
-#include
-
-RefreshButton::RefreshButton(QWidget *parent) : QLabel(parent)
-{
- setAttribute(Qt::WA_TranslucentBackground);
-
- m_normalPixmap = loadPixmap(":/wireless/resources/wireless/refresh_normal.svg");
- m_hoverPixmap = loadPixmap(":/wireless/resources/wireless/refresh_hover.svg");
- m_pressPixmap = loadPixmap(":/wireless/resources/wireless/refresh_press.svg");
-
- setPixmap(m_normalPixmap);
-}
-
-void RefreshButton::enterEvent(QEvent *event)
-{
- QLabel::enterEvent(event);
-
- setPixmap(m_hoverPixmap);
-}
-
-void RefreshButton::leaveEvent(QEvent *event)
-{
- QLabel::leaveEvent(event);
-
- setPixmap(m_normalPixmap);
-}
-
-void RefreshButton::mousePressEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton)
- setPixmap(m_pressPixmap);
-}
-
-void RefreshButton::mouseReleaseEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton)
- emit clicked();
-
- setPixmap(m_normalPixmap);
-}
-
-QPixmap RefreshButton::loadPixmap(const QString &file)
-{
- QPixmap pixmap;
-
- const qreal ratio = devicePixelRatioF();
-
- QImageReader reader;
- reader.setFileName(file);
- if (reader.canRead()) {
- reader.setScaledSize(reader.size() * ratio);
- pixmap = QPixmap::fromImage(reader.read());
- pixmap.setDevicePixelRatio(ratio);
- }
-
- return pixmap;
-}
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/refreshbutton.h dde-dock-4.6.3.1/plugins/network/item/applet/refreshbutton.h
--- dde-dock-4.5.9.1/plugins/network/item/applet/refreshbutton.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/refreshbutton.h 1970-01-01 00:00:00.000000000 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
- *
- * Author: sbw
- *
- * Maintainer: sbw
- *
- * 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 REFRESHBUTTON_H
-#define REFRESHBUTTON_H
-
-#include
-
-class RefreshButton : public QLabel
-{
- Q_OBJECT
-public:
- explicit RefreshButton(QWidget *parent = nullptr);
-
-signals:
- void clicked();
-
-protected:
- void enterEvent(QEvent *event) Q_DECL_OVERRIDE;
- void leaveEvent(QEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
-
-private:
- QPixmap loadPixmap(const QString &file);
-
-private:
- QPixmap m_normalPixmap;
- QPixmap m_hoverPixmap;
- QPixmap m_pressPixmap;
-
-};
-
-#endif // REFRESHBUTTON_H
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/wirelessapplet.cpp dde-dock-4.6.3.1/plugins/network/item/applet/wirelessapplet.cpp
--- dde-dock-4.5.9.1/plugins/network/item/applet/wirelessapplet.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/wirelessapplet.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -24,7 +24,7 @@
#include
#include
-#include
+#include
#include
#include
@@ -77,6 +77,9 @@
m_centralLayout->setSpacing(0);
m_centralLayout->setMargin(0);
+ // initialization state.
+ m_deviceEnabled = m_networkInter->IsDeviceEnabled(m_device.dbusPath());
+
setWidget(m_centralWidget);
setFrameStyle(QFrame::NoFrame);
setFixedWidth(300);
@@ -167,7 +170,7 @@
void WirelessList::setDeviceInfo(const int index)
{
// set device enable state
- m_controlPanel->setDeviceEnabled(m_networkInter->IsDeviceEnabled(m_device.dbusPath()));
+ m_controlPanel->setDeviceEnabled(m_deviceEnabled);
// set device name
if (index == -1)
@@ -371,7 +374,11 @@
if (devPath != m_device.path())
return;
- m_controlPanel->setDeviceEnabled(enable);
+ if (m_deviceEnabled != enable) {
+ m_deviceEnabled = enable;
+ m_controlPanel->setDeviceEnabled(enable);
+ m_updateAPTimer->start();
+ }
}
void WirelessList::activateAP(const QDBusObjectPath &apPath, const QString &ssid)
diff -Nru dde-dock-4.5.9.1/plugins/network/item/applet/wirelessapplet.h dde-dock-4.6.3.1/plugins/network/item/applet/wirelessapplet.h
--- dde-dock-4.5.9.1/plugins/network/item/applet/wirelessapplet.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/applet/wirelessapplet.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -90,6 +90,7 @@
QWidget *m_centralWidget;
DeviceControlWidget *m_controlPanel;
DBusNetwork *m_networkInter;
+ bool m_deviceEnabled;
};
#endif // WIRELESSAPPLET_H
diff -Nru dde-dock-4.5.9.1/plugins/network/item/deviceitem.cpp dde-dock-4.6.3.1/plugins/network/item/deviceitem.cpp
--- dde-dock-4.5.9.1/plugins/network/item/deviceitem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/deviceitem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/item/deviceitem.h dde-dock-4.6.3.1/plugins/network/item/deviceitem.h
--- dde-dock-4.5.9.1/plugins/network/item/deviceitem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/deviceitem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/item/wireditem.cpp dde-dock-4.6.3.1/plugins/network/item/wireditem.cpp
--- dde-dock-4.5.9.1/plugins/network/item/wireditem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/wireditem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -65,7 +65,7 @@
QWidget *WiredItem::itemPopup()
{
- m_itemTips->setText(tr("Unknow"));
+ m_itemTips->setText(tr("Unknown"));
do {
if (!m_connected)
diff -Nru dde-dock-4.5.9.1/plugins/network/item/wireditem.h dde-dock-4.6.3.1/plugins/network/item/wireditem.h
--- dde-dock-4.5.9.1/plugins/network/item/wireditem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/wireditem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/item/wirelessitem.cpp dde-dock-4.6.3.1/plugins/network/item/wirelessitem.cpp
--- dde-dock-4.5.9.1/plugins/network/item/wirelessitem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/wirelessitem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/item/wirelessitem.h dde-dock-4.6.3.1/plugins/network/item/wirelessitem.h
--- dde-dock-4.5.9.1/plugins/network/item/wirelessitem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/item/wirelessitem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/networkdevice.cpp dde-dock-4.6.3.1/plugins/network/networkdevice.cpp
--- dde-dock-4.5.9.1/plugins/network/networkdevice.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/networkdevice.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/networkdevice.h dde-dock-4.6.3.1/plugins/network/networkdevice.h
--- dde-dock-4.5.9.1/plugins/network/networkdevice.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/networkdevice.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/networkmanager.cpp dde-dock-4.6.3.1/plugins/network/networkmanager.cpp
--- dde-dock-4.5.9.1/plugins/network/networkmanager.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/networkmanager.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/networkmanager.h dde-dock-4.6.3.1/plugins/network/networkmanager.h
--- dde-dock-4.5.9.1/plugins/network/networkmanager.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/networkmanager.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/networkplugin.cpp dde-dock-4.6.3.1/plugins/network/networkplugin.cpp
--- dde-dock-4.5.9.1/plugins/network/networkplugin.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/networkplugin.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -143,6 +143,18 @@
return nullptr;
}
+int NetworkPlugin::itemSortKey(const QString &itemKey)
+{
+ const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
+ return m_settings.value(key, 0).toInt();
+}
+
+void NetworkPlugin::setSortKey(const QString &itemKey, const int order)
+{
+ const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
+ m_settings.setValue(key, order);
+}
+
void NetworkPlugin::deviceAdded(const NetworkDevice &device)
{
DeviceItem *item = nullptr;
diff -Nru dde-dock-4.5.9.1/plugins/network/networkplugin.h dde-dock-4.6.3.1/plugins/network/networkplugin.h
--- dde-dock-4.5.9.1/plugins/network/networkplugin.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/networkplugin.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -51,6 +51,9 @@
QWidget *itemTipsWidget(const QString &itemKey);
QWidget *itemPopupApplet(const QString &itemKey);
+ int itemSortKey(const QString &itemKey);
+ void setSortKey(const QString &itemKey, const int order);
+
private slots:
void deviceAdded(const NetworkDevice &device);
void deviceRemoved(const NetworkDevice &device);
diff -Nru dde-dock-4.5.9.1/plugins/network/network.pro dde-dock-4.6.3.1/plugins/network/network.pro
--- dde-dock-4.5.9.1/plugins/network/network.pro 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/network.pro 1970-01-01 00:00:00.000000000 +0000
@@ -1,50 +0,0 @@
-
-include(../../interfaces/interfaces.pri)
-
-QT += widgets svg dbus
-TEMPLATE = lib
-CONFIG += plugin c++11 link_pkgconfig
-PKGCONFIG += dtkwidget
-
-TARGET = $$qtLibraryTarget(network)
-DESTDIR = $$_PRO_FILE_PWD_/../
-DISTFILES += network.json
-
-HEADERS += \
- networkplugin.h \
- item/wireditem.h \
- dbus/dbusnetwork.h \
- networkmanager.h \
- networkdevice.h \
- util/imageutil.h \
- item/deviceitem.h \
- item/wirelessitem.h \
- item/applet/wirelessapplet.h \
- item/applet/devicecontrolwidget.h \
- item/applet/accesspoint.h \
- item/applet/accesspointwidget.h \
- item/applet/horizontalseperator.h \
- item/applet/refreshbutton.h
-
-SOURCES += \
- networkplugin.cpp \
- item/wireditem.cpp \
- dbus/dbusnetwork.cpp \
- networkmanager.cpp \
- networkdevice.cpp \
- util/imageutil.cpp \
- item/deviceitem.cpp \
- item/wirelessitem.cpp \
- item/applet/wirelessapplet.cpp \
- item/applet/devicecontrolwidget.cpp \
- item/applet/accesspoint.cpp \
- item/applet/accesspointwidget.cpp \
- item/applet/horizontalseperator.cpp \
- item/applet/refreshbutton.cpp
-
-target.path = $${PREFIX}/lib/dde-dock/plugins/
-INSTALLS += target
-
-RESOURCES += \
- resources.qrc
-
diff -Nru dde-dock-4.5.9.1/plugins/network/util/imageutil.cpp dde-dock-4.6.3.1/plugins/network/util/imageutil.cpp
--- dde-dock-4.5.9.1/plugins/network/util/imageutil.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/util/imageutil.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/network/util/imageutil.h dde-dock-4.6.3.1/plugins/network/util/imageutil.h
--- dde-dock-4.5.9.1/plugins/network/util/imageutil.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/network/util/imageutil.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/plugin-guide/home_monitor/home_monitor.json dde-dock-4.6.3.1/plugins/plugin-guide/home_monitor/home_monitor.json
--- dde-dock-4.5.9.1/plugins/plugin-guide/home_monitor/home_monitor.json 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/plugin-guide/home_monitor/home_monitor.json 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,3 @@
+{
+ "api": "1.0"
+}
diff -Nru dde-dock-4.5.9.1/plugins/plugin-guide/home_monitor/homemonitorplugin.cpp dde-dock-4.6.3.1/plugins/plugin-guide/home_monitor/homemonitorplugin.cpp
--- dde-dock-4.5.9.1/plugins/plugin-guide/home_monitor/homemonitorplugin.cpp 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/plugin-guide/home_monitor/homemonitorplugin.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,28 @@
+#include "homemonitorplugin.h"
+
+HomeMonitorPlugin::HomeMonitorPlugin(QObject *parent)
+ : QObject(parent)
+{
+
+}
+
+const QString HomeMonitorPlugin::pluginName() const
+{
+ return QStringLiteral("home_monitor");
+}
+
+void HomeMonitorPlugin::init(PluginProxyInterface *proxyInter)
+{
+ m_proxyInter = proxyInter;
+
+ m_pluginWidget = new InformationWidget;
+
+ m_proxyInter->itemAdded(this, QString());
+}
+
+QWidget *HomeMonitorPlugin::itemWidget(const QString &itemKey)
+{
+ Q_UNUSED(itemKey);
+
+ return m_pluginWidget;
+}
diff -Nru dde-dock-4.5.9.1/plugins/plugin-guide/home_monitor/homemonitorplugin.h dde-dock-4.6.3.1/plugins/plugin-guide/home_monitor/homemonitorplugin.h
--- dde-dock-4.5.9.1/plugins/plugin-guide/home_monitor/homemonitorplugin.h 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/plugin-guide/home_monitor/homemonitorplugin.h 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,28 @@
+#ifndef HOMEMONITORPLUGIN_H
+#define HOMEMONITORPLUGIN_H
+
+#include "informationwidget.h"
+
+#include
+
+#include
+
+class HomeMonitorPlugin : public QObject, PluginsItemInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(PluginsItemInterface)
+ Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "home_monitor.json")
+
+public:
+ explicit HomeMonitorPlugin(QObject *parent = nullptr);
+
+ const QString pluginName() const override;
+ void init(PluginProxyInterface *proxyInter) override;
+
+ QWidget *itemWidget(const QString &itemKey) override;
+
+private:
+ InformationWidget *m_pluginWidget;
+};
+
+#endif // HOMEMONITORPLUGIN_H
diff -Nru dde-dock-4.5.9.1/plugins/plugin-guide/home_monitor/informationwidget.cpp dde-dock-4.6.3.1/plugins/plugin-guide/home_monitor/informationwidget.cpp
--- dde-dock-4.5.9.1/plugins/plugin-guide/home_monitor/informationwidget.cpp 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/plugin-guide/home_monitor/informationwidget.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,33 @@
+#include "informationwidget.h"
+
+#include
+#include
+
+InformationWidget::InformationWidget(QWidget *parent)
+ : QWidget(parent)
+
+ , m_infoLabel(new QLabel)
+{
+ m_infoLabel->setStyleSheet("QLabel {"
+ "color: white;"
+ "}");
+
+ QVBoxLayout *centralLayout = new QVBoxLayout;
+ centralLayout->addWidget(m_infoLabel);
+ centralLayout->setSpacing(0);
+ centralLayout->setMargin(0);
+
+ setLayout(centralLayout);
+
+ QTimer::singleShot(1, this, &InformationWidget::refreshInfo);
+}
+
+void InformationWidget::refreshInfo()
+{
+ // TODO: fetch info
+ const int remain = 50;
+ const int total = 100;
+
+ // update display
+ m_infoLabel->setText(tr("Home:\n%1G/%2G").arg(remain).arg(total));
+}
diff -Nru dde-dock-4.5.9.1/plugins/plugin-guide/home_monitor/informationwidget.h dde-dock-4.6.3.1/plugins/plugin-guide/home_monitor/informationwidget.h
--- dde-dock-4.5.9.1/plugins/plugin-guide/home_monitor/informationwidget.h 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/plugin-guide/home_monitor/informationwidget.h 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,21 @@
+#ifndef INFORMATIONWIDGET_H
+#define INFORMATIONWIDGET_H
+
+#include
+#include
+
+class InformationWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit InformationWidget(QWidget *parent = nullptr);
+
+private slots:
+ void refreshInfo();
+
+private:
+ QLabel *m_infoLabel;
+};
+
+#endif // INFORMATIONWIDGET_H
diff -Nru dde-dock-4.5.9.1/plugins/plugin-guide/plugins-developer-guide.md dde-dock-4.6.3.1/plugins/plugin-guide/plugins-developer-guide.md
--- dde-dock-4.5.9.1/plugins/plugin-guide/plugins-developer-guide.md 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/plugin-guide/plugins-developer-guide.md 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,180 @@
+# 从零构建 dde-dock 的插件
+本教程将展示一个简单的 dde-dock 插件的开发过程,插件开发者可跟随此步骤为 dde-dock 创造出更多具有丰富功能的插件。
+
+在本教程中,将创建一个可以实时显示用户家目录(`~/`)使用情况的小工具。
+
+### 插件的工作原理
+dde-dock 插件本质是一个按 Qt 插件标准所开发的共享库文件(`so`)。通过 dde-dock 预定的规范与提供的接口,共同完成 dde-dock 的功能扩展。
+
+## 准备环境
+插件的开发环境可以是任意的,只要是符合 Qt 插件规范及 dde-dock 插件规范的共享库文件,都可以被当作 dde-dock 插件载入。下面以 Qt + qmake 为例进行说明:
+
+### 安装依赖
+以 Deepin 15.5 环境为基础,至少先安装如下的包:
+
+- dde-dock-dev
+- qt5-qmake
+- qtbase5-dev-tools
+- libqt5core5a
+- libqt5widgets5
+- pkg-config
+
+## 基本的项目结构
+
+### 创建必需的项目目录与文件
+插件名称叫做`home_monitor`,所以创建以下的目录结构:
+```
+home_monitor
+├── home_monitor.json
+├── homemonitorplugin.cpp
+├── homemonitorplugin.h
+└── home_monitor.pro
+```
+
+`home_monitor.pro`文件内容如下:
+``` qmake
+# 添加所需的 Qt 模块
+QT += widgets
+# 指定生成目标为共享库
+TEMPLATE = lib
+# 指定生成目标为 Qt 插件
+CONFIG += plugin c++11
+
+# 指定生成目标的名称
+TARGET = $$qtLibraryTarget(home_monitor)
+# 指定生成目标的目录
+DESTDIR = $$_PRO_FILE_PWD_
+# 添加必要的文件到插件中
+DISTFILES += home_monitor.json
+
+HEADERS += \
+ homemonitorplugin.h
+
+SOURCES += \
+ homemonitorplugin.cpp
+
+# 以下是安装相关的设定
+isEmpty(PREFIX) {
+ PREFIX = /usr
+}
+
+target.path = $${PREFIX}/lib/dde-dock/plugins/
+INSTALLS += target
+```
+
+`home_monitor.json`文件指明了当前插件所使用的 dde-dock 的接口版本,dde-dock 在加载此插件时,会检测自己的接口版本是否与插件的接口版本一致,当双方的接口版本不一致时,dde-dock 为了安全将阻止加载对应的插件。
+
+在 dde-dock 内建的插件代码中,可以找到当前具体的接口版本,目前只有 1.0 版本。
+``` json
+{
+ "api": "1.0"
+}
+```
+
+`homemonitorplugin.h`包含了类`HomeMonitorPlugin`,它继承自`PluginItemInterface`,这代表了它是一个实现了 dde-dock 接口的插件。
+
+`PluginItemInterface`中包含众多的功能接口以丰富插件的功能,具体的接口功能与用法可以查看对应文件中的文档。大多数接口在没有特定需求的时候都是无需处理的,需要所有插件显式处理的接口只有`pluginName`、`init`、`itemWidget`三个接口。
+``` c++
+#ifndef HOMEMONITORPLUGIN_H
+#define HOMEMONITORPLUGIN_H
+
+#include
+
+#include
+
+class HomeMonitorPlugin : public QObject, PluginsItemInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(PluginsItemInterface)
+ Q_PLUGIN_METADATA(IID "com.deepin.dock.PluginsItemInterface" FILE "home_monitor.json")
+
+public:
+ explicit HomeMonitorPlugin(QObject *parent = nullptr);
+
+ // 返回插件的名称,必须是唯一值,不可以和其它插件冲突
+ const QString pluginName() const override;
+ // 插件初始化函数
+ void init(PluginProxyInterface *proxyInter) override;
+
+ // 返回插件的 widget
+ QWidget *itemWidget(const QString &itemKey) override;
+};
+
+#endif // HOMEMONITORPLUGIN_H
+```
+
+`homemonitorplugin.cpp`中包含对应接口的实现
+``` c++
+#include "homemonitorplugin.h"
+
+HomeMonitorPlugin::HomeMonitorPlugin(QObject *parent)
+ : QObject(parent)
+{
+
+}
+
+const QString HomeMonitorPlugin::pluginName() const
+{
+ return QStringLiteral("home_monitor");
+}
+
+void HomeMonitorPlugin::init(PluginProxyInterface *proxyInter)
+{
+ m_proxyInter = proxyInter;
+}
+
+QWidget *HomeMonitorPlugin::itemWidget(const QString &itemKey)
+{
+ Q_UNUSED(itemKey);
+
+ return nullptr;
+}
+```
+
+## 测试插件加载
+### 从源码构建
+为了不污染源码目录,推荐在源码目录中创建`build`进行构建:
+``` sh
+cd home_monitor
+mkdir build
+cd build
+qmake ..
+make -j4
+```
+### 安装
+```
+sudo make install
+```
+
+可以看到有`home_monitor.so`文件被安装在了 dde-dock 的插件目录。
+
+``` sh
+install -m 755 -p ../../home_monitor/libhome_monitor.so /usr/lib/dde-dock/plugins/libhome_monitor.so
+```
+
+### 测试加载
+执行`pkill dde-dock; dde-dock`来重新运行 dde-dock,在终端输出中如果出现以下的输出,说明插件的加载已经正常。
+```
+init plugin: "home_monitor"
+init plugin finished: "home_monitor"
+```
+
+## 创建自己的 widget
+按照一般的业务逻辑处理,这部分不是本教程的重点,可以参考完整代码及其它插件进行实现。
+
+## 添加 widget 到 dde-dock 面板上
+在`init`方法中获取到了`PluginProxyInterface`对象,调用此对象的`itemAdded`即可实现向 dde-dock 面板上添加项目。
+第二个`QString`类型的参数代表了本插件所提供的 item 的 id,当一个插件提供多个 item 时,不同 item 之间的 id 要保证唯一。
+``` c++
+proxyInter->itemAdded(this, QString());
+```
+
+在调用`itemAdded`之后,dde-dock 会在合适的时机调用插件的`itemWidget`接口以获取需要显示的 widget。在 itemWidget 接口中分析 itemKey,返回与之对应的 widget 对象,当插件只有一个可显示项目时,itemKey 可以忽略。
+``` c++
+QWidget *HomeMonitorPlugin::itemWidget(const QString &itemKey)
+{
+ Q_UNUSED(itemKey);
+
+ return m_pluginWidget;
+}
+```
\ No newline at end of file
diff -Nru dde-dock-4.5.9.1/plugins/plugins.pro dde-dock-4.6.3.1/plugins/plugins.pro
--- dde-dock-4.5.9.1/plugins/plugins.pro 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/plugins.pro 1970-01-01 00:00:00.000000000 +0000
@@ -1,9 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = \
- datetime \
- shutdown \
- system-tray \
- #disk-mount \
- network \
- #trash \
- sound
diff -Nru dde-dock-4.5.9.1/plugins/shutdown/CMakeLists.txt dde-dock-4.6.3.1/plugins/shutdown/CMakeLists.txt
--- dde-dock-4.5.9.1/plugins/shutdown/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/shutdown/CMakeLists.txt 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,24 @@
+
+set(PLUGIN_NAME "shutdown")
+
+project(${PLUGIN_NAME})
+
+# Sources files
+file(GLOB_RECURSE SRCS "*.h" "*.cpp")
+
+find_package(PkgConfig REQUIRED)
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Svg REQUIRED)
+find_package(DtkWidget REQUIRED)
+
+add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN")
+add_library(${PLUGIN_NAME} SHARED ${SRCS} resources.qrc)
+set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../)
+target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ../../interfaces)
+target_link_libraries(${PLUGIN_NAME} PRIVATE
+ ${DtkWidget_LIBRARIES}
+ ${Qt5Widgets_LIBRARIES}
+ ${Qt5Svg_LIBRARIES}
+)
+
+install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)
diff -Nru dde-dock-4.5.9.1/plugins/shutdown/dbus/dbusaccount.cpp dde-dock-4.6.3.1/plugins/shutdown/dbus/dbusaccount.cpp
--- dde-dock-4.5.9.1/plugins/shutdown/dbus/dbusaccount.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/shutdown/dbus/dbusaccount.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/shutdown/dbus/dbusaccount.h dde-dock-4.6.3.1/plugins/shutdown/dbus/dbusaccount.h
--- dde-dock-4.5.9.1/plugins/shutdown/dbus/dbusaccount.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/shutdown/dbus/dbusaccount.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2015 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/shutdown/pluginwidget.cpp dde-dock-4.6.3.1/plugins/shutdown/pluginwidget.cpp
--- dde-dock-4.5.9.1/plugins/shutdown/pluginwidget.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/shutdown/pluginwidget.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/shutdown/pluginwidget.h dde-dock-4.6.3.1/plugins/shutdown/pluginwidget.h
--- dde-dock-4.5.9.1/plugins/shutdown/pluginwidget.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/shutdown/pluginwidget.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/shutdown/powerstatuswidget.cpp dde-dock-4.6.3.1/plugins/shutdown/powerstatuswidget.cpp
--- dde-dock-4.5.9.1/plugins/shutdown/powerstatuswidget.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/shutdown/powerstatuswidget.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -92,14 +92,9 @@
percentageStr = "000";
}
- QString iconStr;
-
- if (plugged) {
- iconStr = "battery-charged-symbolic";
- } else {
- iconStr = QString("battery-%1-symbolic").arg(percentageStr);
- }
-
+ const QString iconStr = QString("battery-%1-%2")
+ .arg(percentageStr)
+ .arg(plugged ? "plugged-symbolic" : "symbolic");
const auto ratio = devicePixelRatioF();
QPixmap pix = QIcon::fromTheme(iconStr).pixmap(QSize(16, 16) * ratio);
pix.setDevicePixelRatio(ratio);
diff -Nru dde-dock-4.5.9.1/plugins/shutdown/powerstatuswidget.h dde-dock-4.6.3.1/plugins/shutdown/powerstatuswidget.h
--- dde-dock-4.5.9.1/plugins/shutdown/powerstatuswidget.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/shutdown/powerstatuswidget.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/shutdown/shutdownplugin.cpp dde-dock-4.6.3.1/plugins/shutdown/shutdownplugin.cpp
--- dde-dock-4.5.9.1/plugins/shutdown/shutdownplugin.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/shutdown/shutdownplugin.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -228,6 +228,18 @@
updateBatteryVisible();
}
+int ShutdownPlugin::itemSortKey(const QString &itemKey)
+{
+ const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
+ return m_settings.value(key, 0).toInt();
+}
+
+void ShutdownPlugin::setSortKey(const QString &itemKey, const int order)
+{
+ const QString key = QString("pos_%1_%2").arg(itemKey).arg(displayMode());
+ m_settings.setValue(key, order);
+}
+
void ShutdownPlugin::updateBatteryVisible()
{
const bool exist = !m_powerInter->batteryPercentage().isEmpty();
diff -Nru dde-dock-4.5.9.1/plugins/shutdown/shutdownplugin.h dde-dock-4.6.3.1/plugins/shutdown/shutdownplugin.h
--- dde-dock-4.5.9.1/plugins/shutdown/shutdownplugin.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/shutdown/shutdownplugin.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -56,6 +56,9 @@
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked) override;
void displayModeChanged(const Dock::DisplayMode displayMode) override;
+ int itemSortKey(const QString &itemKey);
+ void setSortKey(const QString &itemKey, const int order);
+
private:
void updateBatteryVisible();
void requestContextMenu(const QString &itemKey);
diff -Nru dde-dock-4.5.9.1/plugins/shutdown/shutdown.pro dde-dock-4.6.3.1/plugins/shutdown/shutdown.pro
--- dde-dock-4.5.9.1/plugins/shutdown/shutdown.pro 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/shutdown/shutdown.pro 1970-01-01 00:00:00.000000000 +0000
@@ -1,31 +0,0 @@
-
-include(../../interfaces/interfaces.pri)
-
-QT += widgets svg
-TEMPLATE = lib
-CONFIG += plugin c++11 link_pkgconfig
-PKGCONFIG +=
-
-TARGET = $$qtLibraryTarget(shutdown)
-DESTDIR = $$_PRO_FILE_PWD_/../
-DISTFILES += shutdown.json
-
-HEADERS += \
- shutdownplugin.h \
- dbus/dbuspower.h \
- pluginwidget.h \
- powerstatuswidget.h \
- dbus/dbusaccount.h
-
-SOURCES += \
- shutdownplugin.cpp \
- dbus/dbuspower.cpp \
- pluginwidget.cpp \
- powerstatuswidget.cpp \
- dbus/dbusaccount.cpp
-
-target.path = $${PREFIX}/lib/dde-dock/plugins/
-INSTALLS += target
-
-RESOURCES += \
- resources.qrc
diff -Nru dde-dock-4.5.9.1/plugins/sound/CMakeLists.txt dde-dock-4.6.3.1/plugins/sound/CMakeLists.txt
--- dde-dock-4.5.9.1/plugins/sound/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/CMakeLists.txt 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,32 @@
+
+set(PLUGIN_NAME "sound")
+
+project(${PLUGIN_NAME})
+
+# Sources files
+file(GLOB_RECURSE SRCS "*.h" "*.cpp")
+
+find_package(PkgConfig REQUIRED)
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Svg REQUIRED)
+find_package(DtkWidget 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} resources/resources.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)
+target_link_libraries(${PLUGIN_NAME} PRIVATE
+ ${DtkWidget_LIBRARIES}
+ ${DFrameworkDBus_LIBRARIES}
+ ${QGSettings_LIBRARIES}
+ ${Qt5Widgets_LIBRARIES}
+ ${Qt5Svg_LIBRARIES}
+)
+
+install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)
diff -Nru dde-dock-4.5.9.1/plugins/sound/componments/horizontalseparator.cpp dde-dock-4.6.3.1/plugins/sound/componments/horizontalseparator.cpp
--- dde-dock-4.5.9.1/plugins/sound/componments/horizontalseparator.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/componments/horizontalseparator.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/sound/componments/horizontalseparator.h dde-dock-4.6.3.1/plugins/sound/componments/horizontalseparator.h
--- dde-dock-4.5.9.1/plugins/sound/componments/horizontalseparator.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/componments/horizontalseparator.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/sound/componments/volumeslider.cpp dde-dock-4.6.3.1/plugins/sound/componments/volumeslider.cpp
--- dde-dock-4.5.9.1/plugins/sound/componments/volumeslider.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/componments/volumeslider.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -86,18 +86,20 @@
void VolumeSlider::mouseMoveEvent(QMouseEvent *e)
{
const int value = minimum() + (double((maximum()) - minimum()) * e->x() / rect().width());
+ const int normalized = std::max(std::min(1000, value), 0);
- QSlider::setValue(std::max(std::min(1000, value), 0));
- emit valueChanged(std::max(std::min(1000, value), 0));
+ QSlider::setValue(normalized);
+
+ emit valueChanged(normalized);
}
void VolumeSlider::mouseReleaseEvent(QMouseEvent *e)
{
- if (e->button() == Qt::LeftButton) {
+ if (e->button() == Qt::LeftButton)
+ {
m_pressed = false;
emit requestPlaySoundEffect();
}
- // QTimer::singleShot(100, [this] {m_pressed = false;});
}
void VolumeSlider::wheelEvent(QWheelEvent *e)
diff -Nru dde-dock-4.5.9.1/plugins/sound/componments/volumeslider.h dde-dock-4.6.3.1/plugins/sound/componments/volumeslider.h
--- dde-dock-4.5.9.1/plugins/sound/componments/volumeslider.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/componments/volumeslider.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/sound/dbus/dbussink.h dde-dock-4.6.3.1/plugins/sound/dbus/dbussink.h
--- dde-dock-4.5.9.1/plugins/sound/dbus/dbussink.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/dbus/dbussink.h 2018-04-11 09:44:14.000000000 +0000
@@ -119,6 +119,14 @@
return asyncCallWithArgumentList(QStringLiteral("SetMute"), argumentList);
}
+ inline void SetMuteQueued(bool in0)
+ {
+ QList argumentList;
+ argumentList << QVariant::fromValue(in0);
+
+ CallQueued("SetMute", argumentList);
+ }
+
inline QDBusPendingReply<> SetPort(const QString &in0)
{
QList argumentList;
@@ -133,6 +141,53 @@
return asyncCallWithArgumentList(QStringLiteral("SetVolume"), argumentList);
}
+ inline void SetVolumeQueued(double volume, bool feedBack)
+ {
+ QList argumentList;
+ argumentList << QVariant::fromValue(volume) << QVariant::fromValue(feedBack);
+
+ CallQueued("SetVolume", argumentList);
+ }
+
+private:
+ inline void CallQueued(const QString &callName, const QList &args)
+ {
+ if (m_waittingCalls.contains(callName))
+ {
+ m_waittingCalls[callName] = args;
+ return;
+ }
+
+ if (m_processingCalls.contains(callName))
+ {
+ m_waittingCalls.insert(callName, args);
+ } else {
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(asyncCallWithArgumentList(callName, args));
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, &DBusSink::onPendingCallFinished);
+
+ m_processingCalls.insert(callName, watcher);
+ }
+ }
+
+private slots:
+ void onPendingCallFinished(QDBusPendingCallWatcher *w)
+ {
+ w->deleteLater();
+
+ const auto callName = m_processingCalls.key(w);
+ Q_ASSERT(!callName.isEmpty());
+ if (callName.isEmpty())
+ return;
+
+ m_processingCalls.remove(callName);
+
+ if (!m_waittingCalls.contains(callName))
+ return;
+
+ const auto args = m_waittingCalls.take(callName);
+ CallQueued(callName, args);
+ }
+
Q_SIGNALS: // SIGNALS
// begin property changed signals
void BalanceChanged();
@@ -144,6 +199,10 @@
void SupportBalanceChanged();
void SupportFadeChanged();
void VolumeChanged();
+
+private:
+ QMap m_processingCalls;
+ QMap> m_waittingCalls;
};
namespace com {
diff -Nru dde-dock-4.5.9.1/plugins/sound/dbus/dbussinkinput.h dde-dock-4.6.3.1/plugins/sound/dbus/dbussinkinput.h
--- dde-dock-4.5.9.1/plugins/sound/dbus/dbussinkinput.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/dbus/dbussinkinput.h 2018-04-11 09:44:14.000000000 +0000
@@ -109,6 +109,14 @@
return asyncCallWithArgumentList(QStringLiteral("SetMute"), argumentList);
}
+ inline void SetMuteQueued(bool in0)
+ {
+ QList argumentList;
+ argumentList << QVariant::fromValue(in0);
+
+ CallQueued("SetMute", argumentList);
+ }
+
inline QDBusPendingReply<> SetVolume(double volume, bool feedBack)
{
QList argumentList;
@@ -116,6 +124,53 @@
return asyncCallWithArgumentList(QStringLiteral("SetVolume"), argumentList);
}
+ inline void SetVolumeQueued(double volume, bool feedBack)
+ {
+ QList argumentList;
+ argumentList << QVariant::fromValue(volume) << QVariant::fromValue(feedBack);
+
+ CallQueued("SetVolume", argumentList);
+ }
+
+private:
+ inline void CallQueued(const QString &callName, const QList &args)
+ {
+ if (m_waittingCalls.contains(callName))
+ {
+ m_waittingCalls[callName] = args;
+ return;
+ }
+
+ if (m_processingCalls.contains(callName))
+ {
+ m_waittingCalls.insert(callName, args);
+ } else {
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(asyncCallWithArgumentList(callName, args));
+ connect(watcher, &QDBusPendingCallWatcher::finished, this, &DBusSinkInput::onPendingCallFinished);
+
+ m_processingCalls.insert(callName, watcher);
+ }
+ }
+
+private slots:
+ void onPendingCallFinished(QDBusPendingCallWatcher *w)
+ {
+ w->deleteLater();
+
+ const auto callName = m_processingCalls.key(w);
+ Q_ASSERT(!callName.isEmpty());
+ if (callName.isEmpty())
+ return;
+
+ m_processingCalls.remove(callName);
+
+ if (!m_waittingCalls.contains(callName))
+ return;
+
+ const auto args = m_waittingCalls.take(callName);
+ CallQueued(callName, args);
+ }
+
Q_SIGNALS: // SIGNALS
// begin property changed signals
void BalanceChanged();
@@ -126,6 +181,10 @@
void SupportBalanceChanged();
void SupportFadeChanged();
void VolumeChanged();
+
+private:
+ QMap m_processingCalls;
+ QMap> m_waittingCalls;
};
namespace com {
diff -Nru dde-dock-4.5.9.1/plugins/sound/sinkinputwidget.cpp dde-dock-4.6.3.1/plugins/sound/sinkinputwidget.cpp
--- dde-dock-4.5.9.1/plugins/sound/sinkinputwidget.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/sinkinputwidget.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -24,6 +24,7 @@
#include
#include
#include
+#include
DWIDGET_USE_NAMESPACE
@@ -48,7 +49,6 @@
m_volumeIcon->setAccessibleName("app-" + iconName + "-icon");
m_volumeIcon->setPixmap(getIconFromTheme(iconName, QSize(24, 24)));
m_volumeSlider->setAccessibleName("app-" + iconName + "-slider");
- m_volumeSlider->setValue(m_inputInter->volume() * 1000);
QHBoxLayout *centralLayout = new QHBoxLayout;
centralLayout->addWidget(m_volumeIcon);
@@ -61,29 +61,32 @@
connect(m_volumeSlider, &VolumeSlider::requestPlaySoundEffect, this, &SinkInputWidget::onPlaySoundEffect);
connect(m_volumeIcon, &DImageButton::clicked, this, &SinkInputWidget::setMute);
connect(m_inputInter, &DBusSinkInput::MuteChanged, this, &SinkInputWidget::setMuteIcon);
+ connect(m_inputInter, &DBusSinkInput::VolumeChanged, this, [=] { m_volumeSlider->setValue(m_inputInter->volume() * 1000); });
setLayout(centralLayout);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
setFixedHeight(30);
setMuteIcon();
+
+ emit m_inputInter->VolumeChanged();
}
void SinkInputWidget::setVolume(const int value)
{
- m_inputInter->SetVolume(double(value) / 1000.0, false);
+ m_inputInter->SetVolumeQueued(double(value) / 1000.0, false);
}
void SinkInputWidget::setMute()
{
- m_inputInter->SetMute(!m_inputInter->mute());
+ m_inputInter->SetMuteQueued(!m_inputInter->mute());
}
void SinkInputWidget::setMuteIcon()
{
if (m_inputInter->mute()) {
const auto ratio = devicePixelRatioF();
- QPixmap muteIcon(QString(":/icons/image/audio-volume-muted-symbolic.svg"));
+ QPixmap muteIcon = DHiDPIHelper::loadNxPixmap(":/icons/image/audio-volume-muted-symbolic.svg");
QPixmap appIconSource(getIconFromTheme(m_inputInter->icon(), QSize(24, 24)));
QPixmap temp(appIconSource.size());
@@ -109,5 +112,5 @@
void SinkInputWidget::onPlaySoundEffect()
{
// set the mute property to false to play sound effects.
- m_inputInter->SetMute(false);
+ m_inputInter->SetMuteQueued(false);
}
diff -Nru dde-dock-4.5.9.1/plugins/sound/sinkinputwidget.h dde-dock-4.6.3.1/plugins/sound/sinkinputwidget.h
--- dde-dock-4.5.9.1/plugins/sound/sinkinputwidget.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/sinkinputwidget.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/sound/soundapplet.cpp dde-dock-4.6.3.1/plugins/sound/soundapplet.cpp
--- dde-dock-4.5.9.1/plugins/sound/soundapplet.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/soundapplet.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -179,7 +179,7 @@
//Keep the same units. slider is 1000.0f, maxVolue need multiplication 10.
float m_maxVolume = std::min(1000, m_gsetting->get("output-volume-max").toInt() * 10);
- m_defSinkInter->SetVolume(m_volumeSlider->value() / 1000.0f * (m_maxVolume / 1000.0f), false);
+ m_defSinkInter->SetVolumeQueued(m_volumeSlider->value() / 1000.0f * (m_maxVolume / 1000.0f), false);
}
void SoundApplet::sinkInputsChanged()
@@ -208,7 +208,7 @@
void SoundApplet::toggleMute()
{
- m_defSinkInter->SetMute(!m_defSinkInter->mute());
+ m_defSinkInter->SetMuteQueued(!m_defSinkInter->mute());
}
void SoundApplet::delayLoad()
@@ -231,5 +231,5 @@
void SoundApplet::onPlaySoundEffect()
{
// set the mute property to false to play sound effects.
- m_defSinkInter->SetMute(false);
+ m_defSinkInter->SetMuteQueued(false);
}
diff -Nru dde-dock-4.5.9.1/plugins/sound/soundapplet.h dde-dock-4.6.3.1/plugins/sound/soundapplet.h
--- dde-dock-4.5.9.1/plugins/sound/soundapplet.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/soundapplet.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/sound/sounditem.cpp dde-dock-4.6.3.1/plugins/sound/sounditem.cpp
--- dde-dock-4.5.9.1/plugins/sound/sounditem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/sounditem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -101,7 +101,7 @@
Q_UNUSED(checked);
if (menuId == MUTE)
- m_sinkInter->SetMute(!m_sinkInter->mute());
+ m_sinkInter->SetMuteQueued(!m_sinkInter->mute());
else if (menuId == SETTINS)
QProcess::startDetached("dbus-send --print-reply --dest=com.deepin.dde.ControlCenter /com/deepin/dde/ControlCenter com.deepin.dde.ControlCenter.ShowModule \"string:sound\"");
}
@@ -147,7 +147,7 @@
QWidget::paintEvent(e);
QPainter painter(this);
- painter.drawPixmap(rect().center() - m_iconPixmap.rect().center() / qApp->devicePixelRatio(), m_iconPixmap);
+ painter.drawPixmap(rect().center() - m_iconPixmap.rect().center() / m_iconPixmap.devicePixelRatioF(), m_iconPixmap);
}
void SoundItem::refershIcon()
diff -Nru dde-dock-4.5.9.1/plugins/sound/sounditem.h dde-dock-4.6.3.1/plugins/sound/sounditem.h
--- dde-dock-4.5.9.1/plugins/sound/sounditem.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/sounditem.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
diff -Nru dde-dock-4.5.9.1/plugins/sound/soundplugin.cpp dde-dock-4.6.3.1/plugins/sound/soundplugin.cpp
--- dde-dock-4.5.9.1/plugins/sound/soundplugin.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/soundplugin.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -20,6 +20,7 @@
*/
#include "soundplugin.h"
+#include
#define STATE_KEY "enable"
@@ -28,7 +29,6 @@
m_settings("deepin", "dde-dock-sound"),
m_soundItem(nullptr)
{
-
}
const QString SoundPlugin::pluginName() const
@@ -101,3 +101,19 @@
m_soundItem->invokeMenuItem(menuId, checked);
}
+
+int SoundPlugin::itemSortKey(const QString &itemKey)
+{
+ Q_UNUSED(itemKey);
+
+ const QString key = QString("pos_%1").arg(displayMode());
+ return m_settings.value(key, 0).toInt();
+}
+
+void SoundPlugin::setSortKey(const QString &itemKey, const int order)
+{
+ Q_UNUSED(itemKey);
+
+ const QString key = QString("pos_%1").arg(displayMode());
+ m_settings.setValue(key, order);
+}
diff -Nru dde-dock-4.5.9.1/plugins/sound/soundplugin.h dde-dock-4.6.3.1/plugins/sound/soundplugin.h
--- dde-dock-4.5.9.1/plugins/sound/soundplugin.h 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/soundplugin.h 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw
*
@@ -50,6 +50,9 @@
const QString itemContextMenu(const QString &itemKey);
void invokedMenuItem(const QString &itemKey, const QString &menuId, const bool checked);
+ int itemSortKey(const QString &itemKey);
+ void setSortKey(const QString &itemKey, const int order);
+
private:
QSettings m_settings;
SoundItem *m_soundItem;
diff -Nru dde-dock-4.5.9.1/plugins/sound/sound.pro dde-dock-4.6.3.1/plugins/sound/sound.pro
--- dde-dock-4.5.9.1/plugins/sound/sound.pro 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/sound/sound.pro 1970-01-01 00:00:00.000000000 +0000
@@ -1,39 +0,0 @@
-
-include(../../interfaces/interfaces.pri)
-
-QT += widgets svg dbus
-TEMPLATE = lib
-CONFIG += plugin c++11 link_pkgconfig
-PKGCONFIG += gsettings-qt dtkwidget
-
-TARGET = $$qtLibraryTarget(sound)
-DESTDIR = $$_PRO_FILE_PWD_/../
-DISTFILES += sound.json
-
-HEADERS += \
- soundplugin.h \
- sounditem.h \
- soundapplet.h \
- dbus/dbusaudio.h \
- dbus/dbussink.h \
- componments/horizontalseparator.h \
- componments/volumeslider.h \
- dbus/dbussinkinput.h \
- sinkinputwidget.h
-
-SOURCES += \
- soundplugin.cpp \
- sounditem.cpp \
- soundapplet.cpp \
- dbus/dbusaudio.cpp \
- dbus/dbussink.cpp \
- componments/horizontalseparator.cpp \
- componments/volumeslider.cpp \
- dbus/dbussinkinput.cpp \
- sinkinputwidget.cpp
-
-target.path = $${PREFIX}/lib/dde-dock/plugins/
-INSTALLS += target
-
-RESOURCES += \
- resources/resources.qrc
diff -Nru dde-dock-4.5.9.1/plugins/system-tray/abstracttraywidget.cpp dde-dock-4.6.3.1/plugins/system-tray/abstracttraywidget.cpp
--- dde-dock-4.5.9.1/plugins/system-tray/abstracttraywidget.cpp 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/system-tray/abstracttraywidget.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: sbw
+ *
+ * Maintainer: sbw
+ *
+ * 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 "abstracttraywidget.h"
+
+#include
+#include
+
+AbstractTrayWidget::AbstractTrayWidget(QWidget *parent, Qt::WindowFlags f):
+ QWidget(parent, f)
+{
+
+}
+
+AbstractTrayWidget::~AbstractTrayWidget()
+{
+
+}
+
+void AbstractTrayWidget::mouseReleaseEvent(QMouseEvent *e)
+{
+ const QPoint point(e->pos() - rect().center());
+ if (point.manhattanLength() > 24)
+ return;
+
+ e->accept();
+
+ QPoint globalPos = QCursor::pos();
+ uint8_t buttonIndex = XCB_BUTTON_INDEX_1;
+
+ switch (e->button()) {
+ case Qt:: MiddleButton:
+ buttonIndex = XCB_BUTTON_INDEX_2;
+ break;
+ case Qt::RightButton:
+ buttonIndex = XCB_BUTTON_INDEX_3;
+ break;
+ default:
+ break;
+ }
+
+ sendClick(buttonIndex, globalPos.x(), globalPos.y());
+}
diff -Nru dde-dock-4.5.9.1/plugins/system-tray/abstracttraywidget.h dde-dock-4.6.3.1/plugins/system-tray/abstracttraywidget.h
--- dde-dock-4.5.9.1/plugins/system-tray/abstracttraywidget.h 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/system-tray/abstracttraywidget.h 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
+ *
+ * Author: sbw
+ *
+ * Maintainer: sbw
+ *
+ * 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 .
+ */
+
+#pragma once
+
+#include
+
+class QDBusMessage;
+class AbstractTrayWidget: public QWidget
+{
+ Q_OBJECT
+public:
+ explicit AbstractTrayWidget(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
+ virtual ~AbstractTrayWidget();
+
+ virtual void setActive(const bool active) = 0;
+ virtual void updateIcon() = 0;
+ virtual void sendClick(uint8_t, int, int) = 0;
+ virtual const QImage trayImage() = 0;
+
+Q_SIGNALS:
+ void iconChanged();
+
+protected:
+ void mouseReleaseEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
+};
+
diff -Nru dde-dock-4.5.9.1/plugins/system-tray/CMakeLists.txt dde-dock-4.6.3.1/plugins/system-tray/CMakeLists.txt
--- dde-dock-4.5.9.1/plugins/system-tray/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/system-tray/CMakeLists.txt 2018-04-11 09:44:14.000000000 +0000
@@ -0,0 +1,34 @@
+
+set(PLUGIN_NAME "system-tray")
+
+project(${PLUGIN_NAME})
+
+# Sources files
+file(GLOB_RECURSE SRCS "*.h" "*.cpp")
+
+find_package(PkgConfig REQUIRED)
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Svg REQUIRED)
+find_package(Qt5DBus REQUIRED)
+find_package(Qt5X11Extras REQUIRED)
+find_package(DtkWidget REQUIRED)
+
+pkg_check_modules(XCB_LIBS REQUIRED xcb-ewmh xcb xcb-image xcb-composite xtst xcb-icccm)
+
+add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN")
+add_library(${PLUGIN_NAME} SHARED ${SRCS} resources.qrc)
+set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../)
+target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS}
+ ${Qt5DBus_INCLUDE_DIRS}
+ ${XCB_LIBS_INCLUDE_DIRS}
+ ../../interfaces)
+target_link_libraries(${PLUGIN_NAME} PRIVATE
+ ${DtkWidget_LIBRARIES}
+ ${Qt5Widgets_LIBRARIES}
+ ${Qt5X11Extras_LIBRARIES}
+ ${Qt5DBus_LIBRARIES}
+ ${Qt5Svg_LIBRARIES}
+ ${XCB_LIBS_LIBRARIES}
+)
+
+install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)
diff -Nru dde-dock-4.5.9.1/plugins/system-tray/fashiontrayitem.cpp dde-dock-4.6.3.1/plugins/system-tray/fashiontrayitem.cpp
--- dde-dock-4.5.9.1/plugins/system-tray/fashiontrayitem.cpp 2018-01-03 07:28:11.000000000 +0000
+++ dde-dock-4.6.3.1/plugins/system-tray/fashiontrayitem.cpp 2018-04-11 09:44:14.000000000 +0000
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011 ~ 2017 Deepin Technology Co., Ltd.
+ * Copyright (C) 2011 ~ 2018 Deepin Technology Co., Ltd.
*
* Author: sbw