From b342f6f884adac9421ae37a2f6cdbacb5d4e8987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E5=A8=81?= Date: Wed, 19 Aug 2020 14:13:35 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E9=9B=86?= =?UTF-8?q?=E4=B8=AD=E7=AE=A1=E6=8E=A7=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E6=89=80=E6=9C=89=E5=8A=9F=E8=83=BD=E5=8F=AF=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E5=85=A8=E5=B1=80=E4=B8=80=E4=B8=AA=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=90=AF=E7=94=A8=E6=88=96=E7=A6=81=E7=94=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 模块可配置显示隐藏,能打开控制中心的右键菜单全屏蔽。 2. gsettings最终生效的设置在各个用户之间是互相隔离的,而且root用户读取不到普通用户的gsettings配置。 3. 集中管控版本右下解关机按钮右菜菜单的锁定功能改为调用SwitchTTYAndShow Log: 引用头文件分类规范化 Task: https://pms.uniontech.com/zentao/task-view-30817.html Change-Id: I5ae833f61864ba1874c8ceb75351d569614ab235 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/2377 Reviewed-by: Reviewed-by: niecheng Reviewed-by: wangwei Tested-by: --- frame/main.cpp | 14 +++++++-- frame/util/pluginloader.cpp | 31 +++++++++++++------ frame/util/utils.h | 16 ++++++++++ plugins/datetime/CMakeLists.txt | 9 +++++- plugins/datetime/datetimeplugin.cpp | 13 +++++--- plugins/network/CMakeLists.txt | 3 ++ plugins/network/item/deviceitem.cpp | 15 ++++++--- plugins/power/CMakeLists.txt | 1 + plugins/power/powerplugin.cpp | 13 +++++--- plugins/shutdown/CMakeLists.txt | 3 ++ plugins/shutdown/shutdownplugin.cpp | 48 +++++++++++++++++++---------- plugins/sound/sounditem.cpp | 32 ++++++++++++------- 12 files changed, 142 insertions(+), 56 deletions(-) diff --git a/frame/main.cpp b/frame/main.cpp index 524230139..bf487ff53 100644 --- a/frame/main.cpp +++ b/frame/main.cpp @@ -21,21 +21,24 @@ #include "window/mainwindow.h" #include "window/accessible.h" +#include "dbus/dbusdockadaptors.h" +#include "util/utils.h" #include "util/themeappicon.h" #include "controller/dockitemmanager.h" #include #include #include +#include +#include + #include #include #include #include #include -#include "dbus/dbusdockadaptors.h" #include - #include #include #include @@ -176,6 +179,13 @@ int main(int argc, char *argv[]) app.setAttribute(Qt::AA_EnableHighDpiScaling, true); app.setAttribute(Qt::AA_UseHighDpiPixmaps, false); + if (Utils::isSettingConfigured("com.deepin.dde.dock.icbc", "/com/deepin/dde/dock/icbc/", "already-clear")) { + QGSettings clear_setting("com.deepin.dde.dock.icbc", "/com/deepin/dde/dock/icbc/"); + clear_setting.set("already-clear", false); + QGSettings apps_setting("com.deepin.dde.dock", "/com/deepin/dde/dock/"); + apps_setting.set("docked-apps", QStringList()); + system("killall dde-session-daemon"); + } QAccessible::installFactory(accessibleFactory); // load dde-network-utils translator diff --git a/frame/util/pluginloader.cpp b/frame/util/pluginloader.cpp index 3b2e90168..b32417dce 100644 --- a/frame/util/pluginloader.cpp +++ b/frame/util/pluginloader.cpp @@ -39,20 +39,31 @@ void PluginLoader::run() static const QGSettings gsetting("com.deepin.dde.dock.disableplugins", "/com/deepin/dde/dock/disableplugins/"); static const auto disable_plugins_list = gsetting.get("disable-plugins-list").toStringList(); - for (QString file : plugins) + for (const QString& file : plugins) { - if (!QLibrary::isLibrary(file)) - continue; - - // TODO: old dock plugins is uncompatible - if (file.startsWith("libdde-dock-")) - continue; - - if (disable_plugins_list.contains(file)) { - qDebug() << "disable loading plugin:" << file; + if (!QLibrary::isLibrary(file)){ +#ifdef QT_DEBUG + qDebug() << "--------not a library: " << pluginsDir.absoluteFilePath(file); +#endif continue; } + // TODO: old dock plugins is uncompatible + if (file.startsWith("libdde-dock-")) { +#ifdef QT_DEBUG + qDebug() << "--------uncompatible library: " << pluginsDir.absoluteFilePath(file); +#endif + continue; + } + + if (disable_plugins_list.contains(file)) { + qDebug() << "disable loading plugin:" << pluginsDir.absoluteFilePath(file); + continue; + } + +#ifdef QT_DEBUG + qDebug() << "----------loaded: " << pluginsDir.absoluteFilePath(file); +#endif emit pluginFounded(pluginsDir.absoluteFilePath(file)); } diff --git a/frame/util/utils.h b/frame/util/utils.h index 9bc30d223..f1005c70a 100644 --- a/frame/util/utils.h +++ b/frame/util/utils.h @@ -2,8 +2,12 @@ #include #include #include +#include namespace Utils { + + #define ICBC_CONF_FILE "/etc/deepin/icbc.conf" + inline QPixmap renderSVG(const QString &path, const QSize &size, const qreal devicePixelRatio) { QImageReader reader; QPixmap pixmap; @@ -55,4 +59,16 @@ namespace Utils { return nullptr; } + + inline bool isSettingConfigured(const QString& id, const QString& path, const QString& keyName) { + if (!QGSettings::isSchemaInstalled(id.toUtf8())) { + return false; + } + QGSettings setting(id.toUtf8(), path.toUtf8()); + QVariant v = setting.get(keyName); + if (!v.isValid()) { + return false; + } + return v.toBool(); + } } diff --git a/plugins/datetime/CMakeLists.txt b/plugins/datetime/CMakeLists.txt index 346652900..e690db4a5 100644 --- a/plugins/datetime/CMakeLists.txt +++ b/plugins/datetime/CMakeLists.txt @@ -12,15 +12,22 @@ find_package(Qt5Svg REQUIRED) find_package(Qt5DBus REQUIRED) find_package(DtkWidget REQUIRED) +pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) +pkg_check_modules(QGSettings REQUIRED gsettings-qt) + add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") add_library(${PLUGIN_NAME} SHARED ${SRCS} datetime.qrc) set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../) -target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ../../interfaces) +target_include_directories(${PLUGIN_NAME} PUBLIC + ${DtkWidget_INCLUDE_DIRS} + ${QGSettings_INCLUDE_DIRS} + ../../interfaces) target_link_libraries(${PLUGIN_NAME} PRIVATE ${Qt5DBus_LIBRARIES} ${DtkWidget_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Svg_LIBRARIES} + ${QGSettings_LIBRARIES} ) install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins) diff --git a/plugins/datetime/datetimeplugin.cpp b/plugins/datetime/datetimeplugin.cpp index 4183293db..ddef3e1d6 100644 --- a/plugins/datetime/datetimeplugin.cpp +++ b/plugins/datetime/datetimeplugin.cpp @@ -21,6 +21,7 @@ #include "datetimeplugin.h" #include "../../widgets/tipswidget.h" +#include "../../frame/util/utils.h" #include #include @@ -159,11 +160,13 @@ const QString DatetimePlugin::itemContextMenu(const QString &itemKey) settings["isActive"] = true; items.push_back(settings); - QMap open; - open["itemId"] = "open"; - open["itemText"] = tr("Time settings"); - open["isActive"] = true; - items.push_back(open); + if (!QFile::exists(ICBC_CONF_FILE)) { + QMap open; + open["itemId"] = "open"; + open["itemText"] = tr("Time settings"); + open["isActive"] = true; + items.push_back(open); + } QMap menu; menu["items"] = items; diff --git a/plugins/network/CMakeLists.txt b/plugins/network/CMakeLists.txt index 708db3f81..746365016 100644 --- a/plugins/network/CMakeLists.txt +++ b/plugins/network/CMakeLists.txt @@ -16,6 +16,7 @@ find_package(DtkWidget REQUIRED) pkg_check_modules(DDE-Network-Utils REQUIRED dde-network-utils) 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} network.qrc) @@ -23,6 +24,7 @@ set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../syst target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} ${DFrameworkDBus_INCLUDE_DIRS} + ${QGSettings_INCLUDE_DIRS} ${DDE-Network-Utils_INCLUDE_DIRS} ../../interfaces ../../frame) @@ -31,6 +33,7 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE ${Qt5Widgets_LIBRARIES} ${Qt5Svg_LIBRARIES} ${Qt5DBus_LIBRARIES} + ${QGSettings_LIBRARIES} ${DDE-Network-Utils_LIBRARIES} ${DFrameworkDBus_LIBRARIES} ) diff --git a/plugins/network/item/deviceitem.cpp b/plugins/network/item/deviceitem.cpp index a61dee298..4a85adfe0 100644 --- a/plugins/network/item/deviceitem.cpp +++ b/plugins/network/item/deviceitem.cpp @@ -20,10 +20,13 @@ */ #include "deviceitem.h" +#include "../frame/util/utils.h" #include #include +#include +#include using namespace dde::network; @@ -62,11 +65,13 @@ const QString DeviceItem::itemContextMenu() enable["isActive"] = true; items.push_back(enable); - QMap settings; - settings["itemId"] = "settings"; - settings["itemText"] = tr("Network settings"); - settings["isActive"] = true; - items.push_back(settings); + if (!QFile::exists(ICBC_CONF_FILE)) { + QMap settings; + settings["itemId"] = "settings"; + settings["itemText"] = tr("Network settings"); + settings["isActive"] = true; + items.push_back(settings); + } QMap menu; menu["items"] = items; diff --git a/plugins/power/CMakeLists.txt b/plugins/power/CMakeLists.txt index a7819a9d3..3f8f4be3d 100644 --- a/plugins/power/CMakeLists.txt +++ b/plugins/power/CMakeLists.txt @@ -13,6 +13,7 @@ find_package(Qt5DBus REQUIRED) find_package(DtkWidget REQUIRED) pkg_check_modules(DFrameworkDBus REQUIRED dframeworkdbus) +pkg_check_modules(QGSettings REQUIRED gsettings-qt) add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") add_library(${PLUGIN_NAME} SHARED ${SRCS} power.qrc) diff --git a/plugins/power/powerplugin.cpp b/plugins/power/powerplugin.cpp index 1d056b69d..7d0e89874 100644 --- a/plugins/power/powerplugin.cpp +++ b/plugins/power/powerplugin.cpp @@ -22,6 +22,7 @@ #include "powerplugin.h" #include "dbus/dbusaccount.h" #include "../widgets/tipswidget.h" +#include "../frame/util/utils.h" #include #include @@ -121,11 +122,13 @@ const QString PowerPlugin::itemContextMenu(const QString &itemKey) QList items; items.reserve(6); - QMap power; - power["itemId"] = "power"; - power["itemText"] = tr("Power settings"); - power["isActive"] = true; - items.push_back(power); + if (!QFile::exists(ICBC_CONF_FILE)) { + QMap power; + power["itemId"] = "power"; + power["itemText"] = tr("Power settings"); + power["isActive"] = true; + items.push_back(power); + } QMap menu; menu["items"] = items; diff --git a/plugins/shutdown/CMakeLists.txt b/plugins/shutdown/CMakeLists.txt index 42500db80..2f123a3a8 100644 --- a/plugins/shutdown/CMakeLists.txt +++ b/plugins/shutdown/CMakeLists.txt @@ -15,18 +15,21 @@ find_package(DtkWidget REQUIRED) #if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") # add_definitions("-DDISABLE_POWER_OPTIONS") #endif() +pkg_check_modules(QGSettings REQUIRED gsettings-qt) add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN") add_library(${PLUGIN_NAME} SHARED ${SRCS} shutdown.qrc) set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../) target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS} + ${QGSettings_INCLUDE_DIRS} ../../interfaces) target_link_libraries(${PLUGIN_NAME} PRIVATE ${DtkWidget_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Svg_LIBRARIES} ${Qt5DBus_LIBRARIES} + ${QGSettings_LIBRARIES} ) install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins) diff --git a/plugins/shutdown/shutdownplugin.cpp b/plugins/shutdown/shutdownplugin.cpp index 38371f911..0402b6103 100644 --- a/plugins/shutdown/shutdownplugin.cpp +++ b/plugins/shutdown/shutdownplugin.cpp @@ -21,6 +21,7 @@ #include "shutdownplugin.h" #include "dbus/dbusaccount.h" +#include "../frame/util/utils.h" #include "../widgets/tipswidget.h" #include @@ -161,21 +162,23 @@ const QString ShutdownPlugin::itemContextMenu(const QString &itemKey) logout["isActive"] = true; items.push_back(logout); - if (DBusAccount().userList().count() > 1) { - QMap switchUser; - switchUser["itemId"] = "SwitchUser"; - switchUser["itemText"] = tr("Switch account"); - switchUser["isActive"] = true; - items.push_back(switchUser); - } + if (!QFile::exists(ICBC_CONF_FILE)) { + if (DBusAccount().userList().count() > 1) { + QMap switchUser; + switchUser["itemId"] = "SwitchUser"; + switchUser["itemText"] = tr("Switch account"); + switchUser["isActive"] = true; + items.push_back(switchUser); + } #ifndef DISABLE_POWER_OPTIONS - QMap power; - power["itemId"] = "power"; - power["itemText"] = tr("Power settings"); - power["isActive"] = true; - items.push_back(power); + QMap power; + power["itemId"] = "power"; + power["itemText"] = tr("Power settings"); + power["isActive"] = true; + items.push_back(power); #endif + } QMap menu; menu["items"] = items; @@ -192,11 +195,22 @@ void ShutdownPlugin::invokedMenuItem(const QString &itemKey, const QString &menu if (menuId == "power") QProcess::startDetached("dbus-send --print-reply --dest=com.deepin.dde.ControlCenter /com/deepin/dde/ControlCenter com.deepin.dde.ControlCenter.ShowModule \"string:power\""); - else if (menuId == "Lock") - QProcess::startDetached("dbus-send", QStringList() << "--print-reply" - << "--dest=com.deepin.dde.lockFront" - << "/com/deepin/dde/lockFront" - << QString("com.deepin.dde.lockFront.Show")); + else if (menuId == "Lock") { + if (QFile::exists(ICBC_CONF_FILE)) { + QDBusMessage send = QDBusMessage::createMethodCall("com.deepin.dde.lockFront", "/com/deepin/dde/lockFront", "com.deepin.dde.lockFront", "SwitchTTYAndShow"); + QDBusConnection conn = QDBusConnection::connectToBus("unix:path=/run/user/1000/bus","unix:path=/run/user/1000/bus"); + QDBusMessage reply = conn.call(send); +#ifdef QT_DEBUG + qInfo()<<"----------"<. */ -#include "sounditem.h" -#include "constants.h" - #include #include #include +#include #include + #include #include +#include + +DWIDGET_USE_NAMESPACE +DGUI_USE_NAMESPACE + +#include "sounditem.h" +#include "constants.h" #include "../widgets/tipswidget.h" #include "../frame/util/imageutil.h" -#include +#include "../frame/util/utils.h" // menu actions #define MUTE "mute" #define SETTINGS "settings" -DWIDGET_USE_NAMESPACE -DGUI_USE_NAMESPACE using namespace Dock; SoundItem::SoundItem(QWidget *parent) @@ -89,11 +93,17 @@ const QString SoundItem::contextMenu() const open["isActive"] = true; items.push_back(open); - QMap settings; - settings["itemId"] = SETTINGS; - settings["itemText"] = tr("Sound settings"); - settings["isActive"] = true; - items.push_back(settings); + if (!QFile::exists(ICBC_CONF_FILE)) { + QMap settings; + settings["itemId"] = SETTINGS; + settings["itemText"] = tr("Sound settings"); + settings["isActive"] = true; + items.push_back(settings); +#ifdef QT_DEBUG + qInfo() << "----------icbc sound setting."; +#endif + } + QMap menu; menu["items"] = items; From 76d0acd6d5e22f21f5969dc07923e24b7cd019b2 Mon Sep 17 00:00:00 2001 From: chenjun Date: Fri, 28 Aug 2020 10:39:24 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=E5=BC=80=E5=A7=8B=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E6=97=B6=E8=8E=B7=E5=8F=96=E6=89=80=E6=9C=89=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E7=9A=84=E6=9C=80=E5=B0=8F=E5=8C=96=E7=8A=B6?= =?UTF-8?q?=E6=80=81=EF=BC=8C=E9=80=80=E5=87=BA=E9=A2=84=E8=A7=88=E6=97=B6?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=BA=94=E7=94=A8=E7=AA=97=E5=8F=A3=E7=9A=84?= =?UTF-8?q?=E6=9C=80=E5=B0=8F=E5=8C=96=E7=8A=B6=E6=80=81=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E6=98=AF=E5=90=A6=E8=A2=AB=E6=9C=80=E5=B0=8F?= =?UTF-8?q?=E5=8C=96=E5=88=B0=E4=BB=BB=E5=8A=A1=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在预览应用时,由于预览会展开应用窗口,将应用由最小化还原为显示状态,而退出预览时又没有重新将应用窗口最小化,修改后在预览时,先获取应用窗口是否已 被最小化到任务栏,然后在退出预览时,根据是否最小化条件,将应用窗口最小化到任务栏 Log: 修复3D模式下任务栏,鼠标划过应用图标上方预览窗口时,应用显示在桌面,鼠标移开时,应用没有退回最小化状态问题 Bug: https://pms.uniontech.com/zentao/bug-view-42002.html Change-Id: I60b5dbdbfc102d6541acc326f713fe2e220ba3fc Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/2854 Reviewed-by: Reviewed-by: lizhongming Tested-by: --- frame/item/components/appsnapshot.cpp | 46 ++++++++++++++++++++++ frame/item/components/appsnapshot.h | 8 +++- frame/item/components/floatingpreview.cpp | 1 + frame/item/components/previewcontainer.cpp | 1 + 4 files changed, 55 insertions(+), 1 deletion(-) diff --git a/frame/item/components/appsnapshot.cpp b/frame/item/components/appsnapshot.cpp index f6c58725d..2855fc7af 100644 --- a/frame/item/components/appsnapshot.cpp +++ b/frame/item/components/appsnapshot.cpp @@ -57,10 +57,12 @@ using namespace Dock; AppSnapshot::AppSnapshot(const WId wid, QWidget *parent) : QWidget(parent) , m_wid(wid) + , m_isWidowHidden(false) , m_title(new TipsWidget) , m_waitLeaveTimer(new QTimer(this)) , m_closeBtn2D(new DIconButton(this)) , m_wmHelper(DWindowManagerHelper::instance()) + , m_dockDaemonInter(new DockDaemonInter("com.deepin.dde.daemon.Dock", "/com/deepin/dde/daemon/Dock", QDBusConnection::sessionBus(), this)) { m_closeBtn2D->setFixedSize(24, 24); m_closeBtn2D->setIconSize(QSize(24, 24)); @@ -85,6 +87,13 @@ AppSnapshot::AppSnapshot(const WId wid, QWidget *parent) QTimer::singleShot(1, this, &AppSnapshot::compositeChanged); } +void AppSnapshot::setWindowState() +{ + if (m_isWidowHidden) { + m_dockDaemonInter->MinimizeWindow(m_wid); + } +} + void AppSnapshot::closeWindow() const { const auto display = QX11Info::display(); @@ -118,6 +127,7 @@ void AppSnapshot::setWindowInfo(const WindowInfo &info) QFontMetrics fm(m_title->font()); QString strTtile = m_title->fontMetrics().elidedText(m_windowInfo.title, Qt::ElideRight, width()); m_title->setText(strTtile); + getWindowState(); } void AppSnapshot::dragEnterEvent(QDragEnterEvent *e) @@ -348,3 +358,39 @@ QRect AppSnapshot::rectRemovedShadow(const QImage &qimage, unsigned char *prop_t return QRect(0, 0, qimage.width(), qimage.height()); } } + +void AppSnapshot::getWindowState() +{ + Atom actual_type; + int actual_format; + unsigned long i, num_items, bytes_after; + unsigned char *properties = nullptr; + + m_isWidowHidden = false; + + const auto display = QX11Info::display(); + Atom atom_prop = XInternAtom(display, "_NET_WM_STATE", true); + if (!atom_prop) { + return; + } + + Status status = XGetWindowProperty(display, m_wid, atom_prop, 0, LONG_MAX, False, AnyPropertyType, &actual_type, &actual_format, &num_items, &bytes_after, &properties); + if (status != Success) { + qDebug() << "Fail to get window state"; + return; + } + + Atom *atoms = reinterpret_cast(properties); + for(i = 0; i < num_items; ++i) { + const char *atomName = XGetAtomName(display, atoms[i]); + + if (strcmp(atomName, "_NET_WM_STATE_HIDDEN") == 0) { + m_isWidowHidden = true; + break; + } + } + + if (properties) { + XFree(properties); + } +} diff --git a/frame/item/components/appsnapshot.h b/frame/item/components/appsnapshot.h index f34dc11ff..9943cb565 100644 --- a/frame/item/components/appsnapshot.h +++ b/frame/item/components/appsnapshot.h @@ -29,6 +29,7 @@ #include #include +#include #include DWIDGET_USE_NAMESPACE @@ -41,6 +42,8 @@ struct SHMInfo; struct _XImage; typedef _XImage XImage; +using DockDaemonInter = com::deepin::dde::daemon::Dock; + namespace Dock { class TipsWidget; } @@ -59,6 +62,7 @@ public: inline const QImage snapshot() const { return m_snapshot; } inline const QRectF snapshotGeometry() const { return m_snapshotSrcRect; } inline const QString title() const { return m_windowInfo.title; } + void setWindowState(); signals: void entered(const WId wid) const; @@ -82,13 +86,14 @@ private: SHMInfo *getImageDSHM(); XImage *getImageXlib(); QRect rectRemovedShadow(const QImage &qimage, unsigned char *prop_to_return_gtk); + void getWindowState(); private: const WId m_wid; WindowInfo m_windowInfo; bool m_closeAble; - + bool m_isWidowHidden; QImage m_snapshot; QRectF m_snapshotSrcRect; @@ -96,6 +101,7 @@ private: QTimer *m_waitLeaveTimer; DIconButton *m_closeBtn2D; DWindowManagerHelper *m_wmHelper; + DockDaemonInter *m_dockDaemonInter; }; #endif // APPSNAPSHOT_H diff --git a/frame/item/components/floatingpreview.cpp b/frame/item/components/floatingpreview.cpp index 81fff56a5..1b14299a2 100644 --- a/frame/item/components/floatingpreview.cpp +++ b/frame/item/components/floatingpreview.cpp @@ -186,6 +186,7 @@ void FloatingPreview::hideEvent(QHideEvent *event) { if (m_tracked) { m_tracked->setContentsMargins(0, 0, 0, 0); + m_tracked->setWindowState(); } QWidget::hideEvent(event); diff --git a/frame/item/components/previewcontainer.cpp b/frame/item/components/previewcontainer.cpp index 042b4637d..e4d91dfb4 100644 --- a/frame/item/components/previewcontainer.cpp +++ b/frame/item/components/previewcontainer.cpp @@ -241,6 +241,7 @@ void PreviewContainer::previewEntered(const WId wid) AppSnapshot *preSnap = m_floatingPreview->trackedWindow(); if (preSnap && preSnap != snap) { preSnap->setContentsMargins(0, 0, 0, 0); + preSnap->setWindowState(); } m_currentWId = wid; From ee2e60bbb77421b21c64d41f7a1095ee342ac935 Mon Sep 17 00:00:00 2001 From: chenjun Date: Thu, 27 Aug 2020 21:09:02 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E7=82=B9=E5=87=BB=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=A0=8F=E6=8F=92=E4=BB=B6=E6=97=B6=EF=BC=8C=E5=8F=AA=E6=9C=89?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E5=9B=BE=E6=A0=87=E5=8C=BA=E5=9F=9F=E6=97=B6?= =?UTF-8?q?=E6=89=8D=E6=9C=89=E6=95=88=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 点击任务栏插件时,根据图标大小,计算点击区域是否为有效区域 Log: 修复任务栏中的图标的可点击范围超出图标显示区域 Bug: https://pms.uniontech.com/zentao/bug-view-43531.html Change-Id: I7345171a6cc97d45d3d2c1dcb7e5ff4f3178757d Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/2833 Reviewed-by: Reviewed-by: lizhongming Tested-by: --- frame/item/dockitem.cpp | 47 +++++++++++++++++-- frame/item/dockitem.h | 12 +++-- frame/item/pluginsitem.cpp | 19 ++++---- plugins/bluetooth/bluetoothitem.cpp | 1 + plugins/datetime/datetimewidget.cpp | 1 + plugins/network/networkitem.cpp | 1 + plugins/onboard/onboarditem.cpp | 29 +++++++++++- plugins/onboard/onboarditem.h | 1 + plugins/power/powerstatuswidget.cpp | 1 + plugins/shutdown/shutdownwidget.cpp | 30 +++++++++++- plugins/shutdown/shutdownwidget.h | 1 + plugins/sound/sounditem.cpp | 2 + plugins/sound/sounditem.h | 6 +-- plugins/trash/trashwidget.cpp | 1 + plugins/tray/abstracttraywidget.cpp | 16 +++++++ plugins/tray/abstracttraywidget.h | 1 + .../fashiontray/fashiontraycontrolwidget.cpp | 47 +++++++++++++++++-- .../fashiontray/fashiontraycontrolwidget.h | 2 + .../fashiontray/fashiontraywidgetwrapper.cpp | 41 +++++++++++++++- .../fashiontray/fashiontraywidgetwrapper.h | 1 + plugins/tray/indicatortraywidget.cpp | 1 + plugins/tray/snitraywidget.cpp | 19 +++++++- plugins/tray/snitraywidget.h | 1 + plugins/tray/system-trays/systemtrayitem.cpp | 34 +++++++++++++- plugins/tray/system-trays/systemtrayitem.h | 1 + plugins/tray/xembedtraywidget.cpp | 6 ++- 26 files changed, 289 insertions(+), 33 deletions(-) diff --git a/frame/item/dockitem.cpp b/frame/item/dockitem.cpp index 4a02f7a9f..43dd8daf7 100644 --- a/frame/item/dockitem.cpp +++ b/frame/item/dockitem.cpp @@ -63,6 +63,7 @@ DockItem::DockItem(QWidget *parent) m_popupAdjustDelayTimer->setInterval(10); m_popupAdjustDelayTimer->setSingleShot(true); + setMouseTracking(true); setGraphicsEffect(m_hoverEffect); connect(m_popupTipsDelayTimer, &QTimer::timeout, this, &DockItem::showHoverTips); @@ -178,9 +179,15 @@ void DockItem::enterEvent(QEvent *e) return; } - m_hover = true; - m_hoverEffect->setHighlighting(true); - m_popupTipsDelayTimer->start(); + if (containCursorPos()) { + m_hover = true; + m_hoverEffect->setHighlighting(true); + m_popupTipsDelayTimer->start(); + } else { + m_hover = false; + m_hoverEffect->setHighlighting(false); + m_popupTipsDelayTimer->stop(); + } update(); @@ -200,6 +207,26 @@ void DockItem::leaveEvent(QEvent *e) hidePopup(); update(); + + QWidget::leaveEvent(e); +} + +void DockItem::mouseMoveEvent(QMouseEvent *e) +{ + if (containCursorPos()) { + m_hover = true; + m_hoverEffect->setHighlighting(true); + m_popupTipsDelayTimer->start(); + } else { + m_hover = false; + m_hoverEffect->setHighlighting(false); + m_popupTipsDelayTimer->stop(); + hidePopup(); + } + + update(); + + QWidget::mouseMoveEvent(e); } const QRect DockItem::perfectIconRect() const @@ -264,6 +291,20 @@ void DockItem::onContextMenuAccepted() emit requestWindowAutoHide(true); } +bool DockItem::containCursorPos() +{ + QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); + QRect rect(this->rect()); + + int iconSize = qMin(rect.width(), rect.height()); + int w = (rect.width() - iconSize) / 2; + int h = (rect.height() - iconSize) / 2; + + rect = rect.adjusted(w, h, -w, -h); + + return rect.contains(cursorPos); +} + void DockItem::showHoverTips() { // another model popup window already exists diff --git a/frame/item/dockitem.h b/frame/item/dockitem.h index 89fb87bc4..5129128f5 100644 --- a/frame/item/dockitem.h +++ b/frame/item/dockitem.h @@ -76,11 +76,12 @@ signals: void requestRefreshWindowVisible() const; protected: - bool event(QEvent *event); - void paintEvent(QPaintEvent *e); - void mousePressEvent(QMouseEvent *e); - void enterEvent(QEvent *e); - void leaveEvent(QEvent *e); + bool event(QEvent *event) override; + void paintEvent(QPaintEvent *e) override; + void mousePressEvent(QMouseEvent *e) override; + void enterEvent(QEvent *e) override; + void leaveEvent(QEvent *e) override; + void mouseMoveEvent(QMouseEvent *e) override; const QRect perfectIconRect() const; const QPoint popupMarkPoint() ; @@ -100,6 +101,7 @@ protected: protected slots: void showContextMenu(); void onContextMenuAccepted(); + bool containCursorPos(); private: void updatePopupPosition(); diff --git a/frame/item/pluginsitem.cpp b/frame/item/pluginsitem.cpp index 2a401274e..57bb54885 100644 --- a/frame/item/pluginsitem.cpp +++ b/frame/item/pluginsitem.cpp @@ -140,7 +140,10 @@ void PluginsItem::mousePressEvent(QMouseEvent *e) return; } - m_hover = false; + if (!containCursorPos()) { + return; + } + update(); if (PopupWindow->isVisible()) @@ -159,8 +162,7 @@ void PluginsItem::mouseMoveEvent(QMouseEvent *e) return; } - if (e->buttons() != Qt::LeftButton) - return DockItem::mouseMoveEvent(e); + DockItem::mouseMoveEvent(e); e->accept(); @@ -175,8 +177,6 @@ void PluginsItem::mouseReleaseEvent(QMouseEvent *e) return; } - DockItem::mouseReleaseEvent(e); - if (e->button() != Qt::LeftButton) return; @@ -187,6 +187,10 @@ void PluginsItem::mouseReleaseEvent(QMouseEvent *e) e->accept(); + if (!containCursorPos()) { + return; + } + const QPoint distance = e->pos() - MousePressPoint; if (distance.manhattanLength() < PLUGIN_ITEM_DRAG_THRESHOLD) mouseClicked(); @@ -198,7 +202,6 @@ void PluginsItem::enterEvent(QEvent *event) return; } - m_hover = true; update(); DockItem::enterEvent(event); @@ -234,10 +237,6 @@ bool PluginsItem::eventFilter(QObject *watched, QEvent *event) return true; } } - if (event->type() == QEvent::MouseButtonRelease) { - m_hover = false; - update(); - } } return false; diff --git a/plugins/bluetooth/bluetoothitem.cpp b/plugins/bluetooth/bluetoothitem.cpp index b8670b1de..31478e2ae 100644 --- a/plugins/bluetooth/bluetoothitem.cpp +++ b/plugins/bluetooth/bluetoothitem.cpp @@ -46,6 +46,7 @@ BluetoothItem::BluetoothItem(QWidget *parent) , m_tipsLabel(new TipsWidget(this)) , m_applet(new BluetoothApplet(this)) { + setMouseTracking(true); m_applet->setVisible(false); m_adapterPowered = m_applet->poweredInitState(); diff --git a/plugins/datetime/datetimewidget.cpp b/plugins/datetime/datetimewidget.cpp index d046e8e27..da6503f27 100644 --- a/plugins/datetime/datetimewidget.cpp +++ b/plugins/datetime/datetimewidget.cpp @@ -41,6 +41,7 @@ DatetimeWidget::DatetimeWidget(QWidget *parent) , m_24HourFormat(false) , m_timeOffset(false) { + setMouseTracking(true); setMinimumSize(PLUGIN_BACKGROUND_MIN_SIZE, PLUGIN_BACKGROUND_MIN_SIZE); } diff --git a/plugins/network/networkitem.cpp b/plugins/network/networkitem.cpp index 0a7381723..4ea929ac5 100644 --- a/plugins/network/networkitem.cpp +++ b/plugins/network/networkitem.cpp @@ -46,6 +46,7 @@ NetworkItem::NetworkItem(QWidget *parent) , m_timer(new QTimer(this)) , m_switchWireTimer(new QTimer(this)) { + setMouseTracking(true); m_timer->setInterval(100); m_tipsWidget->setVisible(false); diff --git a/plugins/onboard/onboarditem.cpp b/plugins/onboard/onboarditem.cpp index a7b293451..d52924fb6 100644 --- a/plugins/onboard/onboarditem.cpp +++ b/plugins/onboard/onboarditem.cpp @@ -121,7 +121,12 @@ const QPixmap OnboardItem::loadSvg(const QString &fileName, const QSize &size) c void OnboardItem::mousePressEvent(QMouseEvent *event) { - m_pressed = true; + if (containCursorPos()) { + m_pressed = true; + } else { + m_pressed = false; + } + update(); QWidget::mousePressEvent(event); @@ -138,7 +143,13 @@ void OnboardItem::mouseReleaseEvent(QMouseEvent *event) void OnboardItem::mouseMoveEvent(QMouseEvent *event) { - m_hover = true; + if (containCursorPos()) { + m_hover = true; + } else { + m_hover = false; + } + + update(); QWidget::mouseMoveEvent(event); } @@ -156,3 +167,17 @@ void OnboardItem::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); } + +bool OnboardItem::containCursorPos() +{ + QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); + QRect rect(this->rect()); + + int iconSize = qMin(rect.width(), rect.height()); + int w = (rect.width() - iconSize) / 2; + int h = (rect.height() - iconSize) / 2; + + rect = rect.adjusted(w, h, -w, -h); + + return rect.contains(cursorPos); +} diff --git a/plugins/onboard/onboarditem.h b/plugins/onboard/onboarditem.h index f2186a039..29b776f05 100644 --- a/plugins/onboard/onboarditem.h +++ b/plugins/onboard/onboarditem.h @@ -44,6 +44,7 @@ private: void mouseMoveEvent(QMouseEvent *event) override; void leaveEvent(QEvent *event) override; void resizeEvent(QResizeEvent *event) override; + bool containCursorPos(); private: Dock::DisplayMode m_displayMode; diff --git a/plugins/power/powerstatuswidget.cpp b/plugins/power/powerstatuswidget.cpp index 17a444808..f489a487d 100644 --- a/plugins/power/powerstatuswidget.cpp +++ b/plugins/power/powerstatuswidget.cpp @@ -35,6 +35,7 @@ PowerStatusWidget::PowerStatusWidget(QWidget *parent) m_powerInter(new DBusPower(this)) { // QIcon::setThemeName("deepin"); + setMouseTracking(true); connect(m_powerInter, &DBusPower::BatteryPercentageChanged, this, static_cast(&PowerStatusWidget::update)); connect(m_powerInter, &DBusPower::BatteryStateChanged, this, static_cast(&PowerStatusWidget::update)); diff --git a/plugins/shutdown/shutdownwidget.cpp b/plugins/shutdown/shutdownwidget.cpp index a303df4ea..7a06ec0bb 100644 --- a/plugins/shutdown/shutdownwidget.cpp +++ b/plugins/shutdown/shutdownwidget.cpp @@ -122,9 +122,28 @@ const QPixmap ShutdownWidget::loadSvg(const QString &fileName, const QSize &size return pixmap; } +bool ShutdownWidget::containCursorPos() +{ + QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); + QRect rect(this->rect()); + + int iconSize = qMin(rect.width(), rect.height()); + int w = (rect.width() - iconSize) / 2; + int h = (rect.height() - iconSize) / 2; + + rect = rect.adjusted(w, h, -w, -h); + + return rect.contains(cursorPos); +} + void ShutdownWidget::mousePressEvent(QMouseEvent *event) { - m_pressed = true; + if (containCursorPos()) { + m_pressed = true; + } else { + m_pressed = false; + } + update(); QWidget::mousePressEvent(event); @@ -141,7 +160,14 @@ void ShutdownWidget::mouseReleaseEvent(QMouseEvent *event) void ShutdownWidget::mouseMoveEvent(QMouseEvent *event) { - m_hover = true; + if (containCursorPos()) { + m_hover = true; + } else { + m_hover = false; + } + + update(); + QWidget::mouseMoveEvent(event); } diff --git a/plugins/shutdown/shutdownwidget.h b/plugins/shutdown/shutdownwidget.h index 414ffe5b4..f0179ed81 100644 --- a/plugins/shutdown/shutdownwidget.h +++ b/plugins/shutdown/shutdownwidget.h @@ -43,6 +43,7 @@ protected: private: const QPixmap loadSvg(const QString &fileName, const QSize &size) const; + bool containCursorPos(); private: Dock::DisplayMode m_displayMode; diff --git a/plugins/sound/sounditem.cpp b/plugins/sound/sounditem.cpp index 6aefa5a13..6265a102d 100644 --- a/plugins/sound/sounditem.cpp +++ b/plugins/sound/sounditem.cpp @@ -50,6 +50,8 @@ SoundItem::SoundItem(QWidget *parent) , m_applet(new SoundApplet(this)) , m_sinkInter(nullptr) { + setMouseTracking(true); + m_tipsLabel->setObjectName("sound"); m_tipsLabel->setAccessibleName("soundtips"); m_tipsLabel->setVisible(false); diff --git a/plugins/sound/sounditem.h b/plugins/sound/sounditem.h index 198b0f26b..69346cd32 100644 --- a/plugins/sound/sounditem.h +++ b/plugins/sound/sounditem.h @@ -52,9 +52,9 @@ signals: void requestContextMenu() const; protected: - void resizeEvent(QResizeEvent *e); - void wheelEvent(QWheelEvent *e); - void paintEvent(QPaintEvent *e); + void resizeEvent(QResizeEvent *e) override; + void wheelEvent(QWheelEvent *e) override; + void paintEvent(QPaintEvent *e) override; private slots: void refreshTips(const bool force = false); diff --git a/plugins/trash/trashwidget.cpp b/plugins/trash/trashwidget.cpp index 47b7c7360..f2436a930 100644 --- a/plugins/trash/trashwidget.cpp +++ b/plugins/trash/trashwidget.cpp @@ -38,6 +38,7 @@ TrashWidget::TrashWidget(QWidget *parent) : QWidget(parent) , m_popupApplet(new PopupControlWidget(this)) { + setMouseTracking(true); m_popupApplet->setVisible(false); connect(m_popupApplet, &PopupControlWidget::emptyChanged, this, &TrashWidget::updateIconAndRefresh); diff --git a/plugins/tray/abstracttraywidget.cpp b/plugins/tray/abstracttraywidget.cpp index 1bf34a61d..190f43b6b 100644 --- a/plugins/tray/abstracttraywidget.cpp +++ b/plugins/tray/abstracttraywidget.cpp @@ -30,6 +30,8 @@ AbstractTrayWidget::AbstractTrayWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) , m_handleMouseReleaseTimer(new QTimer(this)) { + setMouseTracking(true); + m_handleMouseReleaseTimer->setSingleShot(true); m_handleMouseReleaseTimer->setInterval(100); @@ -132,3 +134,17 @@ void AbstractTrayWidget::resizeEvent(QResizeEvent *event) setMaximumWidth(QWIDGETSIZE_MAX); } } + +bool AbstractTrayWidget::containCursorPos() +{ + QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); + QRect rect(this->rect()); + + int iconSize = qMin(rect.width(), rect.height()); + int w = (rect.width() - iconSize) / 2; + int h = (rect.height() - iconSize) / 2; + + rect = rect.adjusted(w, h, -w, -h); + + return rect.contains(cursorPos); +} diff --git a/plugins/tray/abstracttraywidget.h b/plugins/tray/abstracttraywidget.h index 8e450f5c9..bae05bfea 100644 --- a/plugins/tray/abstracttraywidget.h +++ b/plugins/tray/abstracttraywidget.h @@ -60,6 +60,7 @@ protected: void handleMouseRelease(); const QRect perfectIconRect() const; void resizeEvent(QResizeEvent *event) override; + bool containCursorPos(); private: QTimer *m_handleMouseReleaseTimer; diff --git a/plugins/tray/fashiontray/fashiontraycontrolwidget.cpp b/plugins/tray/fashiontray/fashiontraycontrolwidget.cpp index 2238f559c..c27e91066 100644 --- a/plugins/tray/fashiontray/fashiontraycontrolwidget.cpp +++ b/plugins/tray/fashiontray/fashiontraycontrolwidget.cpp @@ -45,6 +45,7 @@ FashionTrayControlWidget::FashionTrayControlWidget(Dock::Position position, QWid m_expandDelayTimer->setInterval(400); m_expandDelayTimer->setSingleShot(true); + setMouseTracking(true); setDockPostion(m_dockPosition); setExpanded(m_expanded); @@ -147,7 +148,10 @@ void FashionTrayControlWidget::mouseReleaseEvent(QMouseEvent *event) if (event->button() == Qt::LeftButton) { event->accept(); - setExpanded(!m_expanded); + + if (containCursorPos()) { + setExpanded(!m_expanded); + } return; } @@ -161,7 +165,12 @@ void FashionTrayControlWidget::mousePressEvent(QMouseEvent *event) return QWidget::mousePressEvent(event); } - m_pressed = true; + if (containCursorPos()) { + m_pressed = true; + } else { + m_pressed = false; + } + update(); QWidget::mousePressEvent(event); @@ -169,7 +178,12 @@ void FashionTrayControlWidget::mousePressEvent(QMouseEvent *event) void FashionTrayControlWidget::enterEvent(QEvent *event) { - m_hover = true; + if (containCursorPos()) { + m_hover = true; + } else { + m_hover = false; + } + update(); QWidget::enterEvent(event); @@ -189,6 +203,19 @@ void FashionTrayControlWidget::resizeEvent(QResizeEvent *event) QWidget::resizeEvent(event); } +void FashionTrayControlWidget::mouseMoveEvent(QMouseEvent *event) +{ + if (containCursorPos()) { + m_hover = true; + } else { + m_hover = false; + } + + update(); + + QWidget::mouseMoveEvent(event); +} + void FashionTrayControlWidget::refreshArrowPixmap() { QString iconPath; @@ -211,3 +238,17 @@ void FashionTrayControlWidget::refreshArrowPixmap() const auto ratio = devicePixelRatioF(); m_arrowPix = ImageUtil::loadSvg(iconPath, ":/icons/resources/", PLUGIN_ICON_MAX_SIZE, ratio); } + +bool FashionTrayControlWidget::containCursorPos() +{ + QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); + QRect rect(this->rect()); + + int iconSize = qMin(rect.width(), rect.height()); + int w = (rect.width() - iconSize) / 2; + int h = (rect.height() - iconSize) / 2; + + rect = rect.adjusted(w, h, -w, -h); + + return rect.contains(cursorPos); +} diff --git a/plugins/tray/fashiontray/fashiontraycontrolwidget.h b/plugins/tray/fashiontray/fashiontraycontrolwidget.h index c3b3c9262..1d5564afd 100644 --- a/plugins/tray/fashiontray/fashiontraycontrolwidget.h +++ b/plugins/tray/fashiontray/fashiontraycontrolwidget.h @@ -48,9 +48,11 @@ protected: void enterEvent(QEvent *event) override; void leaveEvent(QEvent *event) override; void resizeEvent(QResizeEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; private: void refreshArrowPixmap(); + bool containCursorPos(); private: QTimer *m_expandDelayTimer; diff --git a/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp b/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp index a3361eea1..95092c3fe 100644 --- a/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp +++ b/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp @@ -52,6 +52,7 @@ FashionTrayWidgetWrapper::FashionTrayWidgetWrapper(const QString &itemKey, Abstr setStyleSheet("background: transparent;"); setAcceptDrops(true); setObjectName(itemKey); + setMouseTracking(true); m_layout->setSpacing(0); m_layout->setMargin(0); @@ -87,6 +88,10 @@ void FashionTrayWidgetWrapper::paintEvent(QPaintEvent *event) return; } + if (m_itemKey == "sound-item-key") { + qDebug() << m_itemKey << rect() << m_absTrayWidget << m_absTrayWidget->rect(); + } + if (rect().height() > PLUGIN_BACKGROUND_MIN_SIZE) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, true); @@ -136,7 +141,12 @@ void FashionTrayWidgetWrapper::mousePressEvent(QMouseEvent *event) MousePressPoint = event->pos(); } - m_pressed = true; + if (containCursorPos()) { + m_pressed = true; + } else { + m_pressed = false; + } + update(); QWidget::mousePressEvent(event); @@ -169,7 +179,12 @@ void FashionTrayWidgetWrapper::dragEnterEvent(QDragEnterEvent *event) void FashionTrayWidgetWrapper::enterEvent(QEvent *event) { - m_hover = true; + if (containCursorPos()) { + m_hover = true; + } else { + m_hover = false; + } + update(); QWidget::enterEvent(event); @@ -213,6 +228,14 @@ void FashionTrayWidgetWrapper::handleMouseMove(QMouseEvent *event) if(m_absTrayWidget.isNull()) return; + if (containCursorPos()) { + m_hover = true; + } else { + m_hover = false; + } + + update(); + if (event->buttons() != Qt::MouseButton::LeftButton) { return QWidget::mouseMoveEvent(event); } @@ -256,6 +279,20 @@ void FashionTrayWidgetWrapper::onTrayWidgetClicked() setAttention(false); } +bool FashionTrayWidgetWrapper::containCursorPos() +{ + QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); + QRect rect(this->rect()); + + int iconSize = qMin(rect.width(), rect.height()); + int w = (rect.width() - iconSize) / 2; + int h = (rect.height() - iconSize) / 2; + + rect = rect.adjusted(w, h, -w, -h); + + return rect.contains(cursorPos); +} + bool FashionTrayWidgetWrapper::attention() const { return m_attention; diff --git a/plugins/tray/fashiontray/fashiontraywidgetwrapper.h b/plugins/tray/fashiontray/fashiontraywidgetwrapper.h index 2ad938c23..226331ca6 100644 --- a/plugins/tray/fashiontray/fashiontraywidgetwrapper.h +++ b/plugins/tray/fashiontray/fashiontraywidgetwrapper.h @@ -64,6 +64,7 @@ private: void handleMouseMove(QMouseEvent *event); void onTrayWidgetNeedAttention(); void onTrayWidgetClicked(); + bool containCursorPos(); private: QPointer m_absTrayWidget; diff --git a/plugins/tray/indicatortraywidget.cpp b/plugins/tray/indicatortraywidget.cpp index cc03e53a6..b4cffa790 100644 --- a/plugins/tray/indicatortraywidget.cpp +++ b/plugins/tray/indicatortraywidget.cpp @@ -33,6 +33,7 @@ IndicatorTrayWidget::IndicatorTrayWidget(const QString &indicatorName, QWidget * , m_indicatorName(indicatorName) { setAttribute(Qt::WA_TranslucentBackground); + setMouseTracking(true); auto layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); diff --git a/plugins/tray/snitraywidget.cpp b/plugins/tray/snitraywidget.cpp index 039484067..92e38a99e 100644 --- a/plugins/tray/snitraywidget.cpp +++ b/plugins/tray/snitraywidget.cpp @@ -560,7 +560,12 @@ QPixmap SNITrayWidget::newIconPixmap(IconType iconType) void SNITrayWidget::enterEvent(QEvent *event) { - m_popupTipsDelayTimer->start(); + if (containCursorPos()) { + m_popupTipsDelayTimer->start(); + } else { + m_popupTipsDelayTimer->stop(); + hidePopup(); + } AbstractTrayWidget::enterEvent(event); } @@ -576,6 +581,18 @@ void SNITrayWidget::leaveEvent(QEvent *event) AbstractTrayWidget::leaveEvent(event); } +void SNITrayWidget::mouseMoveEvent(QMouseEvent *event) +{ + if (containCursorPos()) { + m_popupTipsDelayTimer->start(); + } else { + m_popupTipsDelayTimer->stop(); + hidePopup(); + } + + AbstractTrayWidget::mouseMoveEvent(event); +} + void SNITrayWidget::showHoverTips() { if (PopupWindow->model()) diff --git a/plugins/tray/snitraywidget.h b/plugins/tray/snitraywidget.h index 2857c2169..1e70d4220 100644 --- a/plugins/tray/snitraywidget.h +++ b/plugins/tray/snitraywidget.h @@ -101,6 +101,7 @@ private Q_SLOTS: void popupWindowAccept(); void enterEvent(QEvent *event) override; void leaveEvent(QEvent *event) override; + void mouseMoveEvent(QMouseEvent *event) override; private: void paintEvent(QPaintEvent *e) override; diff --git a/plugins/tray/system-trays/systemtrayitem.cpp b/plugins/tray/system-trays/systemtrayitem.cpp index 4a0ca8669..05442722a 100644 --- a/plugins/tray/system-trays/systemtrayitem.cpp +++ b/plugins/tray/system-trays/systemtrayitem.cpp @@ -41,6 +41,7 @@ SystemTrayItem::SystemTrayItem(PluginsItemInterface *const pluginInter, const QS , m_itemKey(itemKey) { qDebug() << "load tray plugins item: " << m_pluginInter->pluginName() << itemKey << m_centralWidget; + setMouseTracking(true); m_centralWidget->setParent(this); m_centralWidget->setVisible(true); @@ -202,7 +203,13 @@ void SystemTrayItem::enterEvent(QEvent *event) return; } - m_popupTipsDelayTimer->start(); + if (containCursorPos()) { + m_popupTipsDelayTimer->start(); + } else { + m_popupTipsDelayTimer->stop(); + hidePopup(); + } + update(); AbstractTrayWidget::enterEvent(event); @@ -249,6 +256,19 @@ void SystemTrayItem::mouseReleaseEvent(QMouseEvent *event) return; } + QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); + QRect rect(this->rect()); + + int iconSize = qMin(rect.width(), rect.height()); + int w = (rect.width() - iconSize) / 2; + int h = (rect.height() - iconSize) / 2; + + rect = rect.adjusted(w, h, -w, -h); + + if (!rect.contains(cursorPos)) { + return; + } + if (checkAndResetTapHoldGestureState() && event->source() == Qt::MouseEventSynthesizedByQt) { qDebug() << "SystemTray: tap and hold gesture detected, ignore the synthesized mouse release event"; return; @@ -274,6 +294,18 @@ void SystemTrayItem::showEvent(QShowEvent *event) return AbstractTrayWidget::showEvent(event); } +void SystemTrayItem::mouseMoveEvent(QMouseEvent *event) +{ + if (containCursorPos()) { + m_popupTipsDelayTimer->start(); + } else { + m_popupTipsDelayTimer->stop(); + hidePopup(); + } + + AbstractTrayWidget::mouseMoveEvent(event); +} + const QPoint SystemTrayItem::popupMarkPoint() const { QPoint p(topleftPoint()); diff --git a/plugins/tray/system-trays/systemtrayitem.h b/plugins/tray/system-trays/systemtrayitem.h index 00607e082..36117750f 100644 --- a/plugins/tray/system-trays/systemtrayitem.h +++ b/plugins/tray/system-trays/systemtrayitem.h @@ -72,6 +72,7 @@ protected: void mousePressEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; void showEvent(QShowEvent* event) override; + void mouseMoveEvent(QMouseEvent* event) override; protected: const QPoint popupMarkPoint() const; diff --git a/plugins/tray/xembedtraywidget.cpp b/plugins/tray/xembedtraywidget.cpp index 9c0700bd3..35374ac13 100644 --- a/plugins/tray/xembedtraywidget.cpp +++ b/plugins/tray/xembedtraywidget.cpp @@ -147,7 +147,11 @@ void XEmbedTrayWidget::mouseMoveEvent(QMouseEvent *e) return; } - m_sendHoverEvent->start(); + if (containCursorPos()) { + m_sendHoverEvent->start();; + } else { + m_sendHoverEvent->stop(); + } } void XEmbedTrayWidget::configContainerPosition() From 5b99caf67c985634edac987747a37d4d97b17db1 Mon Sep 17 00:00:00 2001 From: chenjun Date: Tue, 1 Sep 2020 10:30:30 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E7=82=B9=E5=87=BB=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E5=86=85=E6=97=B6=E6=89=8D=E8=83=BD=E5=AF=B9?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=E8=BF=9B=E8=A1=8C=E6=8B=96=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 拖动任务栏插件或托盘图标时,根据图标大小,计算点击区域是否为有效区域 Log: 修复任务栏插件区域的触控区域比鼠标点击的范围更大问题 Bug: https://pms.uniontech.com/zentao/bug-view-45282.html Change-Id: If5cbb131e1115f10bd054f8926b2f35d209c62dd Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/3170 Reviewed-by: Reviewed-by: lizhongming Tested-by: --- frame/item/dockitem.h | 2 +- frame/item/pluginsitem.cpp | 4 ++++ frame/panel/mainpanelcontrol.cpp | 4 ++++ plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/frame/item/dockitem.h b/frame/item/dockitem.h index 5129128f5..f4899fe50 100644 --- a/frame/item/dockitem.h +++ b/frame/item/dockitem.h @@ -60,6 +60,7 @@ public: QSize sizeHint() const override; virtual QString accessibleName(); + bool containCursorPos(); public slots: virtual void refershIcon() {} @@ -101,7 +102,6 @@ protected: protected slots: void showContextMenu(); void onContextMenuAccepted(); - bool containCursorPos(); private: void updatePopupPosition(); diff --git a/frame/item/pluginsitem.cpp b/frame/item/pluginsitem.cpp index 57bb54885..7b7a833f6 100644 --- a/frame/item/pluginsitem.cpp +++ b/frame/item/pluginsitem.cpp @@ -164,6 +164,10 @@ void PluginsItem::mouseMoveEvent(QMouseEvent *e) DockItem::mouseMoveEvent(e); + if (!containCursorPos()) { + return; + } + e->accept(); const QPoint distance = e->pos() - MousePressPoint; diff --git a/frame/panel/mainpanelcontrol.cpp b/frame/panel/mainpanelcontrol.cpp index 286377c64..8e8f09778 100755 --- a/frame/panel/mainpanelcontrol.cpp +++ b/frame/panel/mainpanelcontrol.cpp @@ -611,6 +611,10 @@ bool MainPanelControl::eventFilter(QObject *watched, QEvent *event) if (item->itemType() != DockItem::App && item->itemType() != DockItem::Plugins && item->itemType() != DockItem::FixedPlugin) return false; + if (!item->containCursorPos()) { + return false; + } + const QPoint pos = mouseEvent->globalPos(); const QPoint distance = pos - m_mousePressPos; if (distance.manhattanLength() < QApplication::startDragDistance()) diff --git a/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp b/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp index 95092c3fe..e49ed8373 100644 --- a/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp +++ b/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp @@ -244,6 +244,10 @@ void FashionTrayWidgetWrapper::handleMouseMove(QMouseEvent *event) return; } + if (!containCursorPos()) { + return; + } + event->accept(); QDrag drag(this); From e32e33de858a0d975006e5c8f080df33c589790b Mon Sep 17 00:00:00 2001 From: chenjun Date: Fri, 4 Sep 2020 19:04:40 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=A0=8F=E7=BF=BB=E8=AF=91=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新任务栏翻译文件 Log: 更新任务栏翻译文件 Change-Id: I453c70d77496810c5db21042e8e0e41de2346187 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/3684 Reviewed-by: Reviewed-by: wangshaojun Tested-by: --- .transifexrc | 6 - translations/dde-dock_ca.ts | 2 +- translations/dde-dock_cs.ts | 4 +- translations/dde-dock_de.ts | 2 +- translations/dde-dock_en_AU.ts | 216 +++++++++++++++++++++------- translations/dde-dock_es.ts | 6 +- translations/dde-dock_fr.ts | 2 +- translations/dde-dock_gl_ES.ts | 226 +++++++++++++++++++++-------- translations/dde-dock_hi_IN.ts | 240 ++++++++++++++++++++++--------- translations/dde-dock_hr.ts | 4 +- translations/dde-dock_hu.ts | 40 +++--- translations/dde-dock_it.ts | 4 +- translations/dde-dock_ko.ts | 2 +- translations/dde-dock_nl.ts | 218 ++++++++++++++++++++-------- translations/dde-dock_pt_BR.ts | 50 +++---- translations/dde-dock_ru.ts | 8 +- translations/dde-dock_si.ts | 4 +- translations/dde-dock_sq.ts | 10 +- translations/dde-dock_sr.ts | 6 +- translations/dde-dock_tr.ts | 2 +- translations/dde-dock_ug.ts | 256 +++++++++++++++++++++++---------- translations/dde-dock_uk.ts | 14 +- translations/dde-dock_zh_CN.ts | 4 +- translations/dde-dock_zh_HK.ts | 38 ++--- translations/dde-dock_zh_TW.ts | 24 ++-- 25 files changed, 954 insertions(+), 434 deletions(-) delete mode 100644 .transifexrc diff --git a/.transifexrc b/.transifexrc deleted file mode 100644 index 21c4b05c0..000000000 --- a/.transifexrc +++ /dev/null @@ -1,6 +0,0 @@ -[https://www.transifex.com] -api_hostname = https://api.transifex.com -hostname = https://www.transifex.com -password = 1/fed29a347a3f79abfe438d15d1af9dceac2ba39d -username = api - diff --git a/translations/dde-dock_ca.ts b/translations/dde-dock_ca.ts index 09b6387f5..06cc92952 100644 --- a/translations/dde-dock_ca.ts +++ b/translations/dde-dock_ca.ts @@ -389,7 +389,7 @@ Log out - Tanca la sessió + Surt de la sessió Switch account diff --git a/translations/dde-dock_cs.ts b/translations/dde-dock_cs.ts index 40c5503f4..7a939fe5c 100644 --- a/translations/dde-dock_cs.ts +++ b/translations/dde-dock_cs.ts @@ -319,7 +319,7 @@ Capacity %1, %2 min remaining - Stav %1, %2 min zbývá + Energie %1, %2 min zbývá Capacity %1, %2 hr %3 min remaining @@ -373,7 +373,7 @@ Shut down - Vypínání + Vypnout Suspend diff --git a/translations/dde-dock_de.ts b/translations/dde-dock_de.ts index 30691dedb..cacb1d202 100644 --- a/translations/dde-dock_de.ts +++ b/translations/dde-dock_de.ts @@ -33,7 +33,7 @@ %1 connected - + %1 verbunden Connecting... diff --git a/translations/dde-dock_en_AU.ts b/translations/dde-dock_en_AU.ts index ca8d757e1..967cf5808 100644 --- a/translations/dde-dock_en_AU.ts +++ b/translations/dde-dock_en_AU.ts @@ -6,6 +6,55 @@ Plugin %1 is not compatible with the system. + + BluetoothApplet + + Bluetooth + Bluetooth + + + Bluetooth settings + Bluetooth settings + + + + BluetoothItem + + Turn off + Turn off + + + Turn on + Turn on + + + Bluetooth settings + Bluetooth settings + + + %1 connected + %1 connected + + + Connecting... + Connecting... + + + Bluetooth + Bluetooth + + + Turned off + Turned off + + + + BluetoothPlugin + + Bluetooth + Bluetooth + + DBusAdaptors @@ -20,16 +69,16 @@ Datetime - 12 Hour Time - 12 Hour Time + 12-hour time + 12-hour time - 24 Hour Time - 24 Hour Time + 24-hour time + 24-hour time - Time Settings - Time Settings + Time settings + Time settings @@ -165,12 +214,87 @@ Undock + + NetworkItem + + Disable wired connection + Disable wired connection + + + Enable wired connection + Enable wired connection + + + Disable wireless connection + Disable wireless connection + + + Enable wireless connection + Enable wireless connection + + + Disable network + Disable network + + + Enable network + Enable network + + + Network settings + Network settings + + + Device disabled + Device disabled + + + Wireless connection: %1 + Wireless connection: %1 + + + Wired connection: %1 + Wired connection: %1 + + + Not connected + Not connected + + + Connecting + Connecting + + + Connected but no Internet access + Connected but no Internet access + + + Network cable unplugged + Network cable unplugged + + + Wireless Network + Wireless Network + + + Wired Network + Wired Network + + NetworkPlugin Network Network + + Wired Network + Wired Network + + + Wired Network %1 + Wired Network %1 + OnboardPlugin @@ -201,10 +325,6 @@ Capacity %1, %2 hr %3 min remaining Capacity %1, %2 hr %3 min remaining - - Charged %1 - Charged %1 - Charging %1, %2 min until full Charging %1, %2 min until full @@ -214,12 +334,24 @@ Charging %1, %2 hr %3 min until full - Charging %1 .... - + Charged + Charged - Charged - + Capacity %1 + Capacity %1 + + + Charging %1 + Charging %1 + + + Capacity %1 ... + Capacity %1 ... + + + Capacity %1, fully charged + Capacity %1, fully charged @@ -243,17 +375,13 @@ Shut down Shut down - - Restart - Restart - Suspend Suspend Hibernate - + Hibernate Lock @@ -265,12 +393,16 @@ Switch account - + Switch account Power settings Power settings + + Reboot + Reboot + SoundApplet @@ -287,19 +419,19 @@ SoundItem Unmute - + Unmute Mute Mute - Audio Settings - + Sound settings + Sound settings - Current Volume %1 - + Volume %1 + Volume %1 @@ -317,11 +449,11 @@ Trash - %1 file - + Trash - %1 file Trash - %1 files - + Trash - %1 files @@ -332,40 +464,14 @@ Empty - + Empty TrayPlugin System Tray - - - - - WiredItem - - Unknown - Unknown - - - Wired connection: %1 - - - - - WirelessItem - - No Network - - - - Wireless Connection: %1 - - - - Connected but no Internet access - + System Tray diff --git a/translations/dde-dock_es.ts b/translations/dde-dock_es.ts index bd94c3a4a..dc6e4cb33 100644 --- a/translations/dde-dock_es.ts +++ b/translations/dde-dock_es.ts @@ -311,7 +311,7 @@ PowerPlugin Power - Energía + Apagar Power settings @@ -347,11 +347,11 @@ Capacity %1 ... - + Capacidad %1 .... Capacity %1, fully charged - + Capacidad% 1, completamente cargada diff --git a/translations/dde-dock_fr.ts b/translations/dde-dock_fr.ts index e23c9ad71..880bf6d91 100644 --- a/translations/dde-dock_fr.ts +++ b/translations/dde-dock_fr.ts @@ -45,7 +45,7 @@ Turned off - + Eteint diff --git a/translations/dde-dock_gl_ES.ts b/translations/dde-dock_gl_ES.ts index 834297607..b4ebf8ec7 100644 --- a/translations/dde-dock_gl_ES.ts +++ b/translations/dde-dock_gl_ES.ts @@ -3,33 +3,82 @@ AbstractPluginsController The plugin %1 is not compatible with the system. - + O complemento% 1 non é compatible co sistema. + + + + BluetoothApplet + + Bluetooth + Bluetooth + + + Bluetooth settings + Configuración de Bluetooth + + + + BluetoothItem + + Turn off + Apagar + + + Turn on + Acender + + + Bluetooth settings + Configuración de Bluetooth + + + %1 connected + %1 conectado + + + Connecting... + Conectando... + + + Bluetooth + Bluetooth + + + Turned off + Apagado + + + + BluetoothPlugin + + Bluetooth + Bluetooth DBusAdaptors Add keyboard layout - + Engadir disposición do teclado DatetimePlugin Datetime - + Tempo da data - 12 Hour Time - Horario de 12 horas + 12-hour time + 12 horas de tempo - 24 Hour Time - Horario de 24 horas + 24-hour time + 24 horas de tempo - Time Settings - Axustes da hora + Time settings + Configuración do tempo @@ -51,7 +100,7 @@ DialogManager Are you sure you want to empty %1 items? - + Está seguro que que quere vaciar %1 elementos? Cancel @@ -158,11 +207,78 @@ MultitaskingPlugin Multitasking View - + Vista multitarefa Undock - + Desbordar + + + + NetworkItem + + Disable wired connection + Desactivar a conexión por cable + + + Enable wired connection + Activa a conexión por fíos + + + Disable wireless connection + Desactivar a conexión sen fíos + + + Enable wireless connection + Activar a conexión sen fíos + + + Disable network + Desactivar a rede + + + Enable network + Activar a rede + + + Network settings + Axustes da rede + + + Device disabled + Despositivo desactivado + + + Wireless connection: %1 + Conexión sen fíos:% 1 + + + Wired connection: %1 + Conexión con fíos: %1 + + + Not connected + Sen conexión + + + Connecting + Conectando + + + Connected but no Internet access + Conectado pero sen acceso a internet + + + Network cable unplugged + Cable de rede desconectado + + + Wireless Network + Rede sen fíos + + + Wired Network + Rede con fíos @@ -171,12 +287,20 @@ Network Rede + + Wired Network + Rede con fíos + + + Wired Network %1 + Rede con fíos % 1 + OnboardPlugin Onboard - + A bordo Settings @@ -195,32 +319,40 @@ Capacity %1, %2 min remaining - + Capacidade% 1,% 2 minutos restantes Capacity %1, %2 hr %3 min remaining - - - - Charged %1 - Cargado %1 + Capacidade% 1,% 2 h% 3 minutos restantes Charging %1, %2 min until full - + Cargando% 1,% 2 min ata o completo Charging %1, %2 hr %3 min until full - - - - Charging %1 .... - + Cargando% 1,% 2 h% 3 min ata completar Charged Cargado + + Capacity %1 + Capacidade %1 + + + Charging %1 + Cargando %1 + + + Capacity %1 ... + Capacidade %1... + + + Capacity %1, fully charged + Capacidade% 1, totalmente cargada + ShowDesktopPlugin @@ -230,7 +362,7 @@ Undock - + Desbordar @@ -243,17 +375,13 @@ Shut down Apagar - - Restart - Reiniciar - Suspend Suspender Hibernate - + Hibernar Lock @@ -271,6 +399,10 @@ Power settings Axustes de enerxía + + Reboot + Reiniciar + SoundApplet @@ -294,11 +426,11 @@ Silenciar - Audio Settings - Axustes de son + Sound settings + Configuración do son - Current Volume %1 + Volume %1 Volume %1 @@ -342,32 +474,6 @@ Bandexa do sistema - - WiredItem - - Unknown - Descoñecido - - - Wired connection: %1 - Conexión con fíos: %1 - - - - WirelessItem - - No Network - Sen rede - - - Wireless Connection: %1 - Conexión sen fíos: %1 - - - Connected but no Internet access - Conectado pero sen acceso a internet - - WirelessList diff --git a/translations/dde-dock_hi_IN.ts b/translations/dde-dock_hi_IN.ts index 8157284f8..4f564bcf6 100644 --- a/translations/dde-dock_hi_IN.ts +++ b/translations/dde-dock_hi_IN.ts @@ -3,8 +3,57 @@ AbstractPluginsController The plugin %1 is not compatible with the system. + प्लगिन %1 सिस्टम हेतु संगत नहीं है। + + + + BluetoothApplet + + Bluetooth + ब्लूटूथ + + + Bluetooth settings + ब्लूएटूथ सेवाएं + + + + BluetoothItem + + Turn off + ऑफ करें + + + Turn on + ऑन करें + + + Bluetooth settings + ब्लूएटूथ सेवाएं + + + %1 connected + + Connecting... + + + + Bluetooth + ब्लूटूथ + + + Turned off + + + + + BluetoothPlugin + + Bluetooth + ब्लूटूथ + DBusAdaptors @@ -20,16 +69,16 @@ दिनांक व समय - 12 Hour Time + 12-hour time 12 घंटे का समय - 24 Hour Time + 24-hour time 24 घंटे का समय - Time Settings - समय संबंधी सेटिंग्स + Time settings + समय सेवाएं @@ -51,7 +100,7 @@ DialogManager Are you sure you want to empty %1 items? - + क्या आप निश्चित ही %1 वस्तुएँ हटाना चाहते हैं? Cancel @@ -63,14 +112,14 @@ This action cannot be restored - इस कार्रवाई को पुनः स्थापित नहीं किया जा सकता है + यह कार्य पूर्ववत नहीं हो सकता है DiskControlItem Unknown device - अज्ञात डिवाइस + अज्ञात उपकरण Unknown volume @@ -100,7 +149,7 @@ Efficient Mode - कुशल मोड + दक्षता मोड Top @@ -128,7 +177,7 @@ Smart Hide - उपयोग के अनुरूप छिपाएँ + उपयोग अनुरूप छिपाएँ Mode @@ -158,11 +207,78 @@ MultitaskingPlugin Multitasking View - + बहु-कार्य दृश्य Undock - + डॉक से हटाएँ + + + + NetworkItem + + Disable wired connection + केबल कनेक्शन निष्क्रिय करें + + + Enable wired connection + केबल कनेक्शन सक्रिय करें + + + Disable wireless connection + केबल रहित कनेक्शन निष्क्रिय करें + + + Enable wireless connection + केबल रहित कनेक्शन सक्रिय करें + + + Disable network + नेटवर्क निष्क्रिय करें + + + Enable network + नेटवर्क सक्रिय करें + + + Network settings + नेटवर्क सेटिंग्स + + + Device disabled + उपकरण निष्क्रिय है + + + Wireless connection: %1 + केबल रहित कनेक्शन : %1 + + + Wired connection: %1 + केबल कनेक्शन : %1 + + + Not connected + कनेक्ट नहीं है + + + Connecting + कनेक्ट हो रहा है + + + Connected but no Internet access + कनेक्ट है परंतु नेटवर्क हेतु अभिगम नहीं है + + + Network cable unplugged + नेटवर्क केबल हटी हुई है + + + Wireless Network + बेतार नेटवर्क + + + Wired Network + तार वाला नेटवर्क @@ -171,6 +287,14 @@ Network नेटवर्क + + Wired Network + केबल नेटवर्क + + + Wired Network %1 + केबल नेटवर्क %1 + OnboardPlugin @@ -195,32 +319,40 @@ Capacity %1, %2 min remaining - + क्षमता %1, %2 मिनट शेष Capacity %1, %2 hr %3 min remaining - - - - Charged %1 - चार्ज है %1 + क्षमता %1, %2 घंटे %3 मिनट शेष Charging %1, %2 min until full - + %1 चार्ज हो रहा है, पूर्ण होने में %2 मिनट शेष Charging %1, %2 hr %3 min until full - - - - Charging %1 .... - + %1 चार्ज हो रहा है, पूर्ण होने में %2 घंटे %3 मिनट शेष Charged + + Capacity %1 + + + + Charging %1 + चार्ज हो रहा है %1 + + + Capacity %1 ... + + + + Capacity %1, fully charged + + ShowDesktopPlugin @@ -230,7 +362,7 @@ Undock - + डॉक से हटाएँ @@ -243,17 +375,13 @@ Shut down बंद करें - - Restart - पुनः आरंभ करें - Suspend स्थगित करें Hibernate - हाइबरनेट + सुप्त करें Lock @@ -265,18 +393,22 @@ Switch account - खाता बदलें + अकाउंट बदलें Power settings पॉवर सेटिंग्स + + Reboot + पुनः आरंभ करें + SoundApplet Device - डिवाइस + उपकरण Application @@ -294,12 +426,12 @@ ध्वनि बंद करें - Audio Settings - ऑडियो सेटिंग्स + Sound settings + ध्वनि सेटिंग्स - Current Volume %1 - वर्तमान ध्वनि का स्तर %1 + Volume %1 + ध्वनि %1 @@ -313,15 +445,15 @@ TrashPlugin Trash - रद्दी + ट्रैश Trash - %1 file - कचरा - %1 फ़ाइल + ट्रैश - %1 फाइल Trash - %1 files - कचरा - %1 फ़ाइलें + ट्रैश - %1 फाइलें @@ -332,7 +464,7 @@ Empty - खाली + खाली करें @@ -342,41 +474,15 @@ सिस्टम ट्रे - - WiredItem - - Unknown - अज्ञात - - - Wired connection: %1 - तार वाला कनेक्शन : %1 - - - - WirelessItem - - No Network - कोई नेटवर्क नहीं - - - Wireless Connection: %1 - बेतार कनेक्शन : %1 - - - Connected but no Internet access - कनेक्टेड लेकिन इंटरनेट आक्सेस नही है - - WirelessList Wireless Network - बेतार नेटवर्क + केबल रहित नेटवर्क Wireless Network %1 - बेतार नेटवर्क %1 + केबल रहित नेटवर्क %1 \ No newline at end of file diff --git a/translations/dde-dock_hr.ts b/translations/dde-dock_hr.ts index a4c9a54e5..e504be8ef 100644 --- a/translations/dde-dock_hr.ts +++ b/translations/dde-dock_hr.ts @@ -347,11 +347,11 @@ Capacity %1 ... - + Kapacitet %1... Capacity %1, fully charged - + Kapacitet %1, potpuno napunjen diff --git a/translations/dde-dock_hu.ts b/translations/dde-dock_hu.ts index 9542d8556..0a082140f 100644 --- a/translations/dde-dock_hu.ts +++ b/translations/dde-dock_hu.ts @@ -14,30 +14,30 @@ Bluetooth settings - + Bluetooth beállítások BluetoothItem Turn off - + Kikapcsolás Turn on - + Bekapcsolás Bluetooth settings - + Bluetooth beállítások %1 connected - + %1 kapcsolódva Connecting... - + Kapcsolódás... Bluetooth @@ -45,7 +45,7 @@ Turned off - + Kikapcsolva @@ -70,15 +70,15 @@ 12-hour time - + 12 órás formátum 24-hour time - + 24 órás formátum Time settings - + Idő beállítások @@ -218,19 +218,19 @@ NetworkItem Disable wired connection - + Vezetékes kapcsolat megszüntetése Enable wired connection - + Vezetékes kapcsolat engedélyezése Disable wireless connection - + Vezeték-nélküli kapcsolat megszüntetése Enable wireless connection - + Vezeték-nélküli kapcsolat engedélyezése Disable network @@ -250,7 +250,7 @@ Wireless connection: %1 - + Vezeték-nélküli kapcsolat: %1 Wired connection: %1 @@ -339,7 +339,7 @@ Capacity %1 - + Kapacitás %1 Charging %1 @@ -347,11 +347,11 @@ Capacity %1 ... - + Kapacitás %1... Capacity %1, fully charged - + Kapacitás %1, teljesen feltöltve @@ -427,11 +427,11 @@ Sound settings - + Hang beállítások Volume %1 - + Hangerő: %1% diff --git a/translations/dde-dock_it.ts b/translations/dde-dock_it.ts index 9820abd0f..71bc66ed8 100644 --- a/translations/dde-dock_it.ts +++ b/translations/dde-dock_it.ts @@ -319,11 +319,11 @@ Capacity %1, %2 min remaining - Carica %1, %2 min. rimanenti + Autonomia %1, %2 min. rimanenti Capacity %1, %2 hr %3 min remaining - Carica %1, %2 ore e %3 min. rimanenti + Autonomia %1, %2 ore e %3 min. rimanenti Charging %1, %2 min until full diff --git a/translations/dde-dock_ko.ts b/translations/dde-dock_ko.ts index 295181a75..f2848dc21 100644 --- a/translations/dde-dock_ko.ts +++ b/translations/dde-dock_ko.ts @@ -373,7 +373,7 @@ Shut down - 종료 + 컴퓨터 끄기 Suspend diff --git a/translations/dde-dock_nl.ts b/translations/dde-dock_nl.ts index bb3364dea..b7a1d7634 100644 --- a/translations/dde-dock_nl.ts +++ b/translations/dde-dock_nl.ts @@ -3,7 +3,56 @@ AbstractPluginsController The plugin %1 is not compatible with the system. - De invoegtoepassing is niet verenigbaar met het systeem. + De invoegtoepassing '%1' is niet compatibel met het systeem. + + + + BluetoothApplet + + Bluetooth + Bluetooth + + + Bluetooth settings + Bluetooth-instellingen + + + + BluetoothItem + + Turn off + Uitschakelen + + + Turn on + Inschakelen + + + Bluetooth settings + Bluetooth-instellingen + + + %1 connected + %1 verbonden + + + Connecting... + Bezig met verbinden... + + + Bluetooth + Bluetooth + + + Turned off + Uitgeschakeld + + + + BluetoothPlugin + + Bluetooth + Bluetooth @@ -17,19 +66,19 @@ DatetimePlugin Datetime - DatumTijd + Datum en tijd 12-hour time - + 12-uursklok 24-hour time - + 24-uursklok Time settings - + Tijdinstellingen @@ -51,7 +100,7 @@ DialogManager Are you sure you want to empty %1 items? - Weet u zeker dat u 1% objecten wilt leegmaken? + Weet je zeker dat je 1% objecten wilt verwijderen? Cancel @@ -74,7 +123,7 @@ Unknown volume - Onbekend volume + Onbekende schijf @@ -96,11 +145,11 @@ DockSettings Fashion Mode - Moderne Modus + Moderne modus Efficient Mode - Efficiënte Modus + Efficiënte modus Top @@ -120,11 +169,11 @@ Keep Shown - Blijf weergeven + Altijd tonen Keep Hidden - Altijd verbegen + Altijd verbergen Smart Hide @@ -151,18 +200,85 @@ LauncherItem Launcher - Starter + Programmastarter MultitaskingPlugin Multitasking View - Multitasking Beeld + Multitaskingoverzicht Undock - Undock + Losmaken + + + + NetworkItem + + Disable wired connection + Bekabelde verbinding uitschakelen + + + Enable wired connection + Bekabelde verbinding inschakelen + + + Disable wireless connection + Draadloze verbinding uitschakelen + + + Enable wireless connection + Draadloze verbinding inschakelen + + + Disable network + Netwerk uitschakelen + + + Enable network + Netwerk inschakelen + + + Network settings + Netwerkinstellingen + + + Device disabled + Apparaat uitgeschakeld + + + Wireless connection: %1 + Draadloze verbinding: %1 + + + Wired connection: %1 + Bekabelde verbinding: %1 + + + Not connected + Niet verbonden + + + Connecting + Bezig met verbinden + + + Connected but no Internet access + Verbonden, maar geen internettoegang + + + Network cable unplugged + Geen netwerkkabel aangesloten + + + Wireless Network + Draadloos netwerk + + + Wired Network + Bekabeld netwerk @@ -171,6 +287,14 @@ Network Netwerk + + Wired Network + Bekabeld netwerk + + + Wired Network %1 + Bekabeld netwerk: %1 + OnboardPlugin @@ -195,19 +319,19 @@ Capacity %1, %2 min remaining - Capaciteit %1, %2 min resterend + Capaciteit: %1 - %2 min resterend Capacity %1, %2 hr %3 min remaining - Capaciteit %1, %2 hr %3 min resterend + Capaciteit: %1 - %2 uur en %3 min resterend Charging %1, %2 min until full - Opladen %1, %2 min tot vol + %1 opgeladen - klaar over %2 min Charging %1, %2 hr %3 min until full - Opladen %1, %2 hr %3 min tot vol + %1 opgeladen - klaar over %2 uur en %3 min Charged @@ -215,30 +339,30 @@ Capacity %1 - + Capaciteit: %1 Charging %1 - Laden %1 + Bezig met opladen %1 Capacity %1 ... - + Capaciteit: %1 ... Capacity %1, fully charged - + Capaciteit: %1 - volledig opgeladen ShowDesktopPlugin Show Desktop - Toon Bureaublad + Bureaublad tonen Undock - Undock + Losmaken @@ -269,7 +393,7 @@ Switch account - Account wisselen + Ander account Power settings @@ -288,14 +412,14 @@ Application - Toepassing + Programma SoundItem Unmute - Dempen uit + Ontdempen Mute @@ -303,11 +427,11 @@ Sound settings - + Geluidsinstellingen Volume %1 - + %1 volume @@ -321,15 +445,15 @@ TrashPlugin Trash - Prullenmand + Prullenbak Trash - %1 file - Prullenmand - %1 bestand + Prullenbak - %1 bestand Trash - %1 files - Prullenmand - %1 bestanden + Prullenbak - %1 bestanden @@ -340,7 +464,7 @@ Empty - Leeg + Legen @@ -350,32 +474,6 @@ Systeemvak - - WiredItem - - Unknown - Onbekend - - - Wired connection: %1 - Bedrade verbinding: %1 - - - - WirelessItem - - No Network - Geen netwerk - - - Connected but no Internet access - Verbonden maar geen internettoegang - - - Wireless connection: %1 - - - WirelessList @@ -384,7 +482,7 @@ Wireless Network %1 - Draadloos Netwerk %1 + Draadloos netwerk: %1 \ No newline at end of file diff --git a/translations/dde-dock_pt_BR.ts b/translations/dde-dock_pt_BR.ts index 5cef0607b..316dd364d 100644 --- a/translations/dde-dock_pt_BR.ts +++ b/translations/dde-dock_pt_BR.ts @@ -14,7 +14,7 @@ Bluetooth settings - Configurações de Bluetooth + Configurações do Bluetooth @@ -29,7 +29,7 @@ Bluetooth settings - Configurações de Bluetooth + Configurações do Bluetooth %1 connected @@ -59,7 +59,7 @@ DBusAdaptors Add keyboard layout - Adicionar o layout de teclado + Adicionar layout de teclado @@ -78,7 +78,7 @@ Time settings - Configurações de Data e Hora + Configurações de data e hora @@ -112,7 +112,7 @@ This action cannot be restored - Esta ação não pode ser desfeita + Esta ação não pode ser revertida @@ -138,18 +138,18 @@ Unmount all - Desmontar todos + Desmontar tudo DockSettings Fashion Mode - Modo Fashion + Fashion Efficient Mode - Modo Eficiente + Eficiente Top @@ -169,15 +169,15 @@ Keep Shown - Sempre Exibir + Sempre exibir Keep Hidden - Sempre Ocultar + Sempre ocultar Smart Hide - Ocultar Inteligente + Ocultar inteligente Mode @@ -193,7 +193,7 @@ Plugins - Complementos + Plugins @@ -211,26 +211,26 @@ Undock - Remover da Dock + Remover da dock NetworkItem Disable wired connection - Desativar a conexão cabeada + Desativar conexão cabeada Enable wired connection - Ativar a conexão cabeada + Ativar conexão cabeada Disable wireless connection - Desativar a conexão Wi-Fi + Desativar conexão Wi-Fi Enable wireless connection - Ativar a conexão Wi-Fi + Ativar conexão Wi-Fi Disable network @@ -300,7 +300,7 @@ OnboardPlugin Onboard - Teclado Virtual + Teclado virtual Settings @@ -315,7 +315,7 @@ Power settings - Configurações de Energia + Configurações de energia Capacity %1, %2 min remaining @@ -362,7 +362,7 @@ Undock - Remover da Dock + Remover da dock @@ -389,7 +389,7 @@ Log out - Encerrar sessão + Sair Switch account @@ -397,7 +397,7 @@ Power settings - Configurações de Energia + Configurações de energia Reboot @@ -419,15 +419,15 @@ SoundItem Unmute - Com Áudio + Com áudio Mute - Sem Áudio + Sem áudio Sound settings - Configurações de Som + Configurações de som Volume %1 diff --git a/translations/dde-dock_ru.ts b/translations/dde-dock_ru.ts index d55bd2dad..544f5f0cb 100644 --- a/translations/dde-dock_ru.ts +++ b/translations/dde-dock_ru.ts @@ -185,11 +185,11 @@ Location - Местонахождение + Расположение Status - Статус + Состояние Plugins @@ -200,7 +200,7 @@ LauncherItem Launcher - Выбор Программ + Запуск программ @@ -381,7 +381,7 @@ Hibernate - Спящий Режим + Спящий режим Lock diff --git a/translations/dde-dock_si.ts b/translations/dde-dock_si.ts index 7e10d4fcf..37bff4014 100644 --- a/translations/dde-dock_si.ts +++ b/translations/dde-dock_si.ts @@ -181,7 +181,7 @@ Mode - ආකාරය + ප්‍රකාරය Location @@ -478,7 +478,7 @@ WirelessList Wireless Network - රැහැන් රහිත සම්බන්ධතාවය + රැහැන් රහිත ජාලය Wireless Network %1 diff --git a/translations/dde-dock_sq.ts b/translations/dde-dock_sq.ts index 04833fbb5..f2b753009 100644 --- a/translations/dde-dock_sq.ts +++ b/translations/dde-dock_sq.ts @@ -70,11 +70,11 @@ 12-hour time - orë 12-orëshe + Orë 12-orëshe 24-hour time - orë 24-orëshe + Orë 24-orëshe Time settings @@ -100,7 +100,7 @@ DialogManager Are you sure you want to empty %1 items? - Jeni i sigurt se doni të zbrazni $1 objekte? + Jeni i sigurt se doni të zbrazen $1 objekte? Cancel @@ -145,7 +145,7 @@ DockSettings Fashion Mode - Mënyrë Moda + Mënyra Modë Efficient Mode @@ -331,7 +331,7 @@ Charging %1, %2 hr %3 min until full - Po ngarkohet %1, edhe %2 hr e %3 min deri sa të jetë plot + Po ngarkohet %1, edhe %2 hr e 3% min deri sa të jetë plot Charged diff --git a/translations/dde-dock_sr.ts b/translations/dde-dock_sr.ts index 7b2b7ab50..b577e28c3 100644 --- a/translations/dde-dock_sr.ts +++ b/translations/dde-dock_sr.ts @@ -200,7 +200,7 @@ LauncherItem Launcher - Покретач Програма + Покретач програма @@ -373,7 +373,7 @@ Shut down - Искључи + Искључивање Suspend @@ -389,7 +389,7 @@ Log out - Одјави се + Одјављивање Switch account diff --git a/translations/dde-dock_tr.ts b/translations/dde-dock_tr.ts index 0b39392eb..69ed68d35 100644 --- a/translations/dde-dock_tr.ts +++ b/translations/dde-dock_tr.ts @@ -331,7 +331,7 @@ Charging %1, %2 hr %3 min until full - %1 ve doluyor, tam dolmaya %2 saat %3 dakika kaldı + %1 doluyor, doluma %2 saat %3 dakika var Charged diff --git a/translations/dde-dock_ug.ts b/translations/dde-dock_ug.ts index ce9f7dfb0..562e409b1 100644 --- a/translations/dde-dock_ug.ts +++ b/translations/dde-dock_ug.ts @@ -3,7 +3,56 @@ AbstractPluginsController The plugin %1 is not compatible with the system. - + قىستۇرما %1 بىلەن سىستېما نەشرى ماسلاشمايدۇ + + + + BluetoothApplet + + Bluetooth + كۆكچىش + + + Bluetooth settings + كۆكچىش تەڭشىكى + + + + BluetoothItem + + Turn off + كۆكچىشنى تاقاش + + + Turn on + كۆكچىشنى ئېچىش + + + Bluetooth settings + كۆكچىش تەڭشىكى + + + %1 connected + %1 ئۇلاندى + + + Connecting... + ئۇلىنىۋاتىدۇ... + + + Bluetooth + كۆكچىش + + + Turned off + كۆكچىشنى تاقاش + + + + BluetoothPlugin + + Bluetooth + كۆكچىش @@ -20,15 +69,15 @@ چېسىلا ۋە ۋاقىت - 12 Hour Time + 12-hour time 12 سائەتلىك - 24 Hour Time + 24-hour time 24 سائەتلىك - Time Settings + Time settings ۋاقىت تەڭشىكى @@ -51,7 +100,7 @@ DialogManager Are you sure you want to empty %1 items? - + راستلا ئەخلەت ساندۇقىدىكى %1 تۈرلۈك مەزمۇننى تازىلامسىز؟ Cancel @@ -63,18 +112,18 @@ This action cannot be restored - + بۇ مەشغۇلاتنى ئەسلىگە قايتۇرغىلى بولمايدۇ DiskControlItem Unknown device - + نامەلۇم ئۈسكۈنە Unknown volume - + سىغىمى نامەلۇم @@ -85,7 +134,7 @@ Open - ئېچىش + ئوچۇق Unmount all @@ -96,11 +145,11 @@ DockSettings Fashion Mode - + مودا ھالەت Efficient Mode - + يۇقىرى ئۈنۈملۈك ھالەت Top @@ -151,18 +200,85 @@ LauncherItem Launcher - ئۈستەليۈزى + ئۈستەليۈزى قوزغاتقۇچ MultitaskingPlugin Multitasking View - + كۆپ ۋەزىپە كۆرۈنۈشى Undock - + چىقىرىۋېتىش + + + + NetworkItem + + Disable wired connection + سىملىق تورنى تاقاش + + + Enable wired connection + سىملىق تورنى ئېچىش + + + Disable wireless connection + سىمسىز تورنى تاقاش + + + Enable wireless connection + سىمسىز تورنى ئېچىش + + + Disable network + تورنى تاقاش + + + Enable network + تورنى قوزغىتىش + + + Network settings + تور تەڭشىكى + + + Device disabled + ئۈسكىنە چەكلەش + + + Wireless connection: %1 + سىمسىز تور: %1 + + + Wired connection: %1 + سىملىق تور: %1 + + + Not connected + ئۇلانمىدى + + + Connecting + ئۇلىنىۋاتىدۇ + + + Connected but no Internet access + ئۇلاندى ، لېكىن تورغا چىققىلى بولمايدۇ + + + Network cable unplugged + تور سىمى ئۇلانمىغان + + + Wireless Network + سىمسىز تور + + + Wired Network + سىملىق تور @@ -171,12 +287,20 @@ Network تور + + Wired Network + سىملىق تور + + + Wired Network %1 + سىملىق تور%1 + OnboardPlugin Onboard - + ئېكران كۇنۇپكىسى Settings @@ -187,7 +311,7 @@ PowerPlugin Power - + قۇۋۋەت Power settings @@ -195,27 +319,39 @@ Capacity %1, %2 min remaining - + توك %1 قالدى، %2 مىنۇت يېتىدۇ Capacity %1, %2 hr %3 min remaining - - - - Charged %1 - + توك %1 قالدى، %2 سائەت %3 مىنۇت يېتىدۇ Charging %1, %2 min until full - + زەرەتلىنىۋاتىدۇ%1، يەنە %2 مىنۇتتا توشىدۇ Charging %1, %2 hr %3 min until full - + زەرەتلىنىۋاتىدۇ%1، يەنە %2 سائەت %3 مىنۇتتا توشىدۇ - Charging %1 .... - + Charged + توشتى + + + Capacity %1 + توك%1 + + + Charging %1 + زەرەتلەۋاتىدۇ%1 + + + Capacity %1 ... + توك%1... + + + Capacity %1, fully charged + توك%1، توشتى @@ -226,22 +362,18 @@ Undock - + تۇرغۇنلارنى چىقىرىۋېتىش ShutdownPlugin Power - + قۇۋۋەت Shut down - ئۈسكۈنىنى تاقاش - - - Restart - قايتا قوزغىتىش + تاقاش Suspend @@ -249,7 +381,7 @@ Hibernate - + ئۇخلاش ھالىتى Lock @@ -261,18 +393,22 @@ Switch account - + ئاكونت ئالمىشىش Power settings باتارىيە تەڭشىكى + + Reboot + قايتا قوزغىتىش + SoundApplet Device - + ئۈسكۈنە Application @@ -283,19 +419,19 @@ SoundItem Unmute - + ئاۋازلىق Mute ئاۋازسىز - Audio Settings + Sound settings ئاۋاز تەڭشىكى - Current Volume %1 - + Volume %1 + ئاۋاز%1 @@ -309,59 +445,33 @@ TrashPlugin Trash - + ئەخلەت ساندۇقى Trash - %1 file - + ئەخلەت ساندۇقى - %1ھۆججەت Trash - %1 files - + ئەخلەت ساندۇقى - %1ھۆججەت TrashWidget Open - ئېچىش + ئوچۇق Empty - + قۇرۇق TrayPlugin System Tray - - - - - WiredItem - - Unknown - نامەلۇم - - - Wired connection: %1 - - - - - WirelessItem - - No Network - تور يوق - - - Wireless Connection: %1 - - - - Connected but no Internet access - ئۇلاندى ، لېكىن تورغا چىققىلى بولمايدۇ + سىستېما يۈكلەنگەن دىسكا @@ -372,7 +482,7 @@ Wireless Network %1 - + سىمسىز تور%1 \ No newline at end of file diff --git a/translations/dde-dock_uk.ts b/translations/dde-dock_uk.ts index 623e8911f..400ef79da 100644 --- a/translations/dde-dock_uk.ts +++ b/translations/dde-dock_uk.ts @@ -3,7 +3,7 @@ AbstractPluginsController The plugin %1 is not compatible with the system. - Плагін %1 не сумісний із системою. + Додаток %1 не сумісний із системою. @@ -149,15 +149,15 @@ Efficient Mode - Режим ефективності + Практичний режим Top - Верх + Вгорі Bottom - Вниз + Внизу Left @@ -185,7 +185,7 @@ Location - Місце знаходження + Розташування Status @@ -193,7 +193,7 @@ Plugins - Плагіни + Додатки @@ -412,7 +412,7 @@ Application - Програма + Застосунок diff --git a/translations/dde-dock_zh_CN.ts b/translations/dde-dock_zh_CN.ts index 04ab9e52b..15933d8cc 100644 --- a/translations/dde-dock_zh_CN.ts +++ b/translations/dde-dock_zh_CN.ts @@ -21,11 +21,11 @@ BluetoothItem Turn off - 关闭蓝牙 + 关闭 Turn on - 开启蓝牙 + 开启 Bluetooth settings diff --git a/translations/dde-dock_zh_HK.ts b/translations/dde-dock_zh_HK.ts index ed6a36143..c2c0dc376 100644 --- a/translations/dde-dock_zh_HK.ts +++ b/translations/dde-dock_zh_HK.ts @@ -10,7 +10,7 @@ BluetoothApplet Bluetooth - 蓝牙 + 藍牙 Bluetooth settings @@ -21,11 +21,11 @@ BluetoothItem Turn off - 關閉藍牙 + 關閉 Turn on - 開啟藍牙 + 開啟 Bluetooth settings @@ -41,7 +41,7 @@ Bluetooth - 蓝牙 + 藍牙 Turned off @@ -52,7 +52,7 @@ BluetoothPlugin Bluetooth - 蓝牙 + 藍牙 @@ -108,7 +108,7 @@ Delete - 删除 + 刪除 This action cannot be restored @@ -185,7 +185,7 @@ Location - 檔位置 + 位置 Status @@ -200,7 +200,7 @@ LauncherItem Launcher - 启动器 + 啟動器 @@ -258,7 +258,7 @@ Not connected - 未连接 + 未連接 Connecting @@ -274,22 +274,22 @@ Wireless Network - 无线网络 + 無線網絡 Wired Network - 有线网络 + 有線網絡 NetworkPlugin Network - 网络 + 網絡 Wired Network - 有线网络 + 有線網絡 Wired Network %1 @@ -300,7 +300,7 @@ OnboardPlugin Onboard - 屏幕鍵盤 + 螢幕鍵盤 Settings @@ -373,7 +373,7 @@ Shut down - 关机 + 關機 Suspend @@ -389,7 +389,7 @@ Log out - 注销 + 登出 Switch account @@ -438,14 +438,14 @@ SoundPlugin Sound - 声音 + 聲音 TrashPlugin Trash - 垃圾桶 + 回收站 Trash - %1 file @@ -478,7 +478,7 @@ WirelessList Wireless Network - 无线网络 + 無線網絡 Wireless Network %1 diff --git a/translations/dde-dock_zh_TW.ts b/translations/dde-dock_zh_TW.ts index 2ea57986f..87aa88398 100644 --- a/translations/dde-dock_zh_TW.ts +++ b/translations/dde-dock_zh_TW.ts @@ -21,11 +21,11 @@ BluetoothItem Turn off - 關閉藍牙 + 關閉 Turn on - 開啟藍牙 + 開啟 Bluetooth settings @@ -130,11 +130,11 @@ DiskMountPlugin Disk - Disk + 磁碟 Open - 開放 + 開啟 Unmount all @@ -145,11 +145,11 @@ DockSettings Fashion Mode - 時尚 (Deepin) 模式 + 時尚模式 Efficient Mode - 高效 (Windows) 模式 + 高效模式 Top @@ -161,11 +161,11 @@ Left - Left + 左側 Right - Right + 右側 Keep Shown @@ -185,7 +185,7 @@ Location - Location + 位置 Status @@ -300,7 +300,7 @@ OnboardPlugin Onboard - Onboard + 螢幕鍵盤 Settings @@ -445,7 +445,7 @@ TrashPlugin Trash - 垃圾桶 + 回收桶 Trash - %1 file @@ -460,7 +460,7 @@ TrashWidget Open - 開放 + 開啟 Empty From 88d52e28d1e6cc27c4496db44ce0d42755a42ee9 Mon Sep 17 00:00:00 2001 From: chenjun Date: Thu, 10 Sep 2020 15:51:33 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20=E4=B8=BA=E4=BA=86=E5=B0=86maintain/?= =?UTF-8?q?5.1=E5=88=86=E6=94=AF=E5=90=88=E5=85=A5uos,=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E5=AF=B9=E4=BB=BB=E5=8A=A1=E6=A0=8F=E5=9B=BE=E6=A0=87=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E3=80=81=E7=A7=BB=E5=8A=A8=E3=80=81=E6=8B=96=E5=8A=A8?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 由原来的提交的用鼠标当前坐标是否在图标范围内的判断方式修改为设置图标布局的边距的方式。以便于将maintain/5.1分支合入uos而不影响其他 功能 Log: 重新对任务栏图标可点击、移动或拖动范围进行处理 Change-Id: Icf6df593f468c247c6d4fc5c2ba0936d5135626b Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/4271 Reviewed-by: Reviewed-by: fanpengcheng Tested-by: --- frame/item/dockitem.cpp | 39 +--- frame/item/dockitem.h | 1 - frame/item/pluginsitem.cpp | 12 - frame/panel/mainpanelcontrol.cpp | 206 +++++++++++------- plugins/onboard/onboarditem.cpp | 26 +-- plugins/onboard/onboarditem.h | 1 - plugins/shutdown/shutdownwidget.cpp | 26 +-- plugins/shutdown/shutdownwidget.h | 1 - plugins/tray/abstracttraywidget.cpp | 14 -- plugins/tray/abstracttraywidget.h | 1 - .../containers/abstractcontainer.cpp | 5 - .../fashiontray/fashiontraycontrolwidget.cpp | 44 +--- .../fashiontray/fashiontraycontrolwidget.h | 2 - .../fashiontray/fashiontraywidgetwrapper.cpp | 36 +-- .../fashiontray/fashiontraywidgetwrapper.h | 1 - plugins/tray/snitraywidget.cpp | 19 +- plugins/tray/snitraywidget.h | 1 - plugins/tray/system-trays/systemtrayitem.cpp | 19 +- plugins/tray/system-trays/systemtrayitem.h | 1 - plugins/tray/xembedtraywidget.cpp | 6 +- 20 files changed, 151 insertions(+), 310 deletions(-) diff --git a/frame/item/dockitem.cpp b/frame/item/dockitem.cpp index 43dd8daf7..00e78c638 100644 --- a/frame/item/dockitem.cpp +++ b/frame/item/dockitem.cpp @@ -179,15 +179,9 @@ void DockItem::enterEvent(QEvent *e) return; } - if (containCursorPos()) { - m_hover = true; - m_hoverEffect->setHighlighting(true); - m_popupTipsDelayTimer->start(); - } else { - m_hover = false; - m_hoverEffect->setHighlighting(false); - m_popupTipsDelayTimer->stop(); - } + m_hover = true; + m_hoverEffect->setHighlighting(true); + m_popupTipsDelayTimer->start(); update(); @@ -213,16 +207,9 @@ void DockItem::leaveEvent(QEvent *e) void DockItem::mouseMoveEvent(QMouseEvent *e) { - if (containCursorPos()) { - m_hover = true; - m_hoverEffect->setHighlighting(true); - m_popupTipsDelayTimer->start(); - } else { - m_hover = false; - m_hoverEffect->setHighlighting(false); - m_popupTipsDelayTimer->stop(); - hidePopup(); - } + m_hover = true; + m_hoverEffect->setHighlighting(true); + m_popupTipsDelayTimer->start(); update(); @@ -291,20 +278,6 @@ void DockItem::onContextMenuAccepted() emit requestWindowAutoHide(true); } -bool DockItem::containCursorPos() -{ - QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); - QRect rect(this->rect()); - - int iconSize = qMin(rect.width(), rect.height()); - int w = (rect.width() - iconSize) / 2; - int h = (rect.height() - iconSize) / 2; - - rect = rect.adjusted(w, h, -w, -h); - - return rect.contains(cursorPos); -} - void DockItem::showHoverTips() { // another model popup window already exists diff --git a/frame/item/dockitem.h b/frame/item/dockitem.h index f4899fe50..7d0a46a60 100644 --- a/frame/item/dockitem.h +++ b/frame/item/dockitem.h @@ -60,7 +60,6 @@ public: QSize sizeHint() const override; virtual QString accessibleName(); - bool containCursorPos(); public slots: virtual void refershIcon() {} diff --git a/frame/item/pluginsitem.cpp b/frame/item/pluginsitem.cpp index 7b7a833f6..fe0d7f769 100644 --- a/frame/item/pluginsitem.cpp +++ b/frame/item/pluginsitem.cpp @@ -140,10 +140,6 @@ void PluginsItem::mousePressEvent(QMouseEvent *e) return; } - if (!containCursorPos()) { - return; - } - update(); if (PopupWindow->isVisible()) @@ -164,10 +160,6 @@ void PluginsItem::mouseMoveEvent(QMouseEvent *e) DockItem::mouseMoveEvent(e); - if (!containCursorPos()) { - return; - } - e->accept(); const QPoint distance = e->pos() - MousePressPoint; @@ -191,10 +183,6 @@ void PluginsItem::mouseReleaseEvent(QMouseEvent *e) e->accept(); - if (!containCursorPos()) { - return; - } - const QPoint distance = e->pos() - MousePressPoint; if (distance.manhattanLength() < PLUGIN_ITEM_DRAG_THRESHOLD) mouseClicked(); diff --git a/frame/panel/mainpanelcontrol.cpp b/frame/panel/mainpanelcontrol.cpp index 8e8f09778..d76560638 100755 --- a/frame/panel/mainpanelcontrol.cpp +++ b/frame/panel/mainpanelcontrol.cpp @@ -255,8 +255,12 @@ void MainPanelControl::addTrayAreaItem(int index, QWidget *wdg) void MainPanelControl::addPluginAreaItem(int index, QWidget *wdg) { - m_pluginLayout->insertWidget(index, wdg, 0, Qt::AlignCenter); - resizeDockIcon(); + //因为日期时间插件和其他插件的大小有异,为了方便设置边距,在插件区域布局再添加一层布局设置边距 + //因此在处理插件图标时,需要通过两层布局判断是否为需要的插件,例如拖动插件位置等判断 + QBoxLayout * boxLayout = new QBoxLayout(QBoxLayout::LeftToRight); + boxLayout->addWidget(wdg, 0, Qt::AlignCenter); + m_pluginLayout->insertLayout(index, boxLayout, 0); + resizeDockIcon();; m_pluginAreaWidget->adjustSize(); } @@ -277,7 +281,16 @@ void MainPanelControl::removeTrayAreaItem(QWidget *wdg) void MainPanelControl::removePluginAreaItem(QWidget *wdg) { - m_pluginLayout->removeWidget(wdg); + //因为日期时间插件大小和其他插件有异,为了方便设置边距,各插件中增加一层布局 + //因此remove插件图标时,需要从多的一层布局中取widget进行判断是否需要移除的插件 + for (int i = 0; i < m_pluginLayout->count(); ++i) { + QLayoutItem *layoutItem = m_pluginLayout->itemAt(i); + QLayout *boxLayout = layoutItem->layout(); + if (boxLayout && boxLayout->itemAt(0)->widget() == wdg) { + boxLayout->removeWidget(wdg); + m_pluginLayout->removeItem(layoutItem); + } + } } void MainPanelControl::resizeEvent(QResizeEvent *event) @@ -375,9 +388,17 @@ void MainPanelControl::moveItem(DockItem *sourceItem, DockItem *targetItem) int idx = -1; if (targetItem->itemType() == DockItem::App) idx = m_appAreaSonLayout->indexOf(targetItem); - else if (targetItem->itemType() == DockItem::Plugins) - idx = m_pluginLayout->indexOf(targetItem); - else if (targetItem->itemType() == DockItem::FixedPlugin) + else if (targetItem->itemType() == DockItem::Plugins){ + //因为日期时间插件大小和其他插件大小有异,为了设置边距,在各插件中增加了一层布局 + //因此有拖动图标时,需要从多的一层布局中判断是否相同插件而获取插件位置顺序 + for (int i = 0; i < m_pluginLayout->count(); ++i) { + QLayout *layout = m_pluginLayout->itemAt(i)->layout(); + if (layout && layout->itemAt(0)->widget() == targetItem) { + idx = i; + break; + } + } + } else if (targetItem->itemType() == DockItem::FixedPlugin) idx = m_fixedAreaLayout->indexOf(targetItem); else return; @@ -611,10 +632,6 @@ bool MainPanelControl::eventFilter(QObject *watched, QEvent *event) if (item->itemType() != DockItem::App && item->itemType() != DockItem::Plugins && item->itemType() != DockItem::FixedPlugin) return false; - if (!item->containCursorPos()) { - return false; - } - const QPoint pos = mouseEvent->globalPos(); const QPoint distance = pos - m_mousePressPos; if (distance.manhattanLength() < QApplication::startDragDistance()) @@ -720,22 +737,21 @@ DockItem *MainPanelControl::dropTargetItem(DockItem *sourceItem, QPoint point) for (int i = 0 ; i < parentLayout->count(); ++i) { QLayoutItem *layoutItem = parentLayout->itemAt(i); - DockItem *dockItem = qobject_cast(layoutItem->widget()); + + DockItem *dockItem = nullptr; + if (parentWidget == m_pluginAreaWidget) { + QLayout *layout = layoutItem->layout(); + if (layout) { + dockItem = qobject_cast(layout->itemAt(0)->widget()); + } + } else{ + dockItem = qobject_cast(layoutItem->widget()); + } + if (!dockItem) continue; - QRect rect; - - rect.setTopLeft(dockItem->pos()); - if (dockItem->itemType() == DockItem::Plugins) { - if ((m_position == Position::Top) || (m_position == Position::Bottom)) { - rect.setSize(QSize(PLUGIN_MAX_SIZE, height())); - } else { - rect.setSize(QSize(width(), PLUGIN_MAX_SIZE)); - } - } else { - rect.setSize(dockItem->size()); - } + QRect rect(dockItem->pos(), dockItem->size()); if (rect.contains(point)) { targetItem = dockItem; break; @@ -866,31 +882,39 @@ void MainPanelControl::paintEvent(QPaintEvent *event) void MainPanelControl::resizeDockIcon() { - if (!m_tray) - return; // 插件有点特殊,因为会引入第三方的插件,并不会受dock的缩放影响,我们只能限制我们自己的插件,否则会导致显示错误。 // 以下是受控制的插件 PluginsItem *trashPlugin = nullptr; PluginsItem *shutdownPlugin = nullptr; PluginsItem *keyboardPlugin = nullptr; PluginsItem *notificationPlugin = nullptr; + + //因为日期时间大小和其他插件大小有异,为了设置边距,在各插件中增加了一层布局 + //因此需要通过多一层布局来获取各插件 for (int i = 0; i < m_pluginLayout->count(); ++ i) { - PluginsItem *w = static_cast(m_pluginLayout->itemAt(i)->widget()); - if (w->pluginName() == "trash") { - trashPlugin = w; - } else if (w->pluginName() == "shutdown") { - shutdownPlugin = w; - } else if (w->pluginName() == "onboard") { - keyboardPlugin = w; - } else if (w->pluginName() == "notifications") { - notificationPlugin = w; + QLayout *layout = m_pluginLayout->itemAt(i)->layout(); + if (layout) { + PluginsItem *w = static_cast(m_pluginLayout->itemAt(i)->widget()); + if (w) { + if (w->pluginName() == "trash") { + trashPlugin = w; + } else if (w->pluginName() == "shutdown") { + shutdownPlugin = w; + } else if (w->pluginName() == "onboard") { + keyboardPlugin = w; + } else if (w->pluginName() == "notifications") { + notificationPlugin = w; + } + } } } // 总宽度 int totalLength = ((m_position == Position::Top) || (m_position == Position::Bottom)) ? width() : height(); // 减去托盘间隔区域 - totalLength -= (m_tray->trayVisableItemCount() + 1) * 10; + if (m_tray) { + totalLength -= (m_tray->trayVisableItemCount() + 1) * 10; + } // 减去3个分割线的宽度 totalLength -= 3 * SPLITER_SIZE; @@ -915,7 +939,12 @@ void MainPanelControl::resizeDockIcon() return; // 参与计算的插件的个数(包含托盘和插件,垃圾桶,关机,屏幕键盘) - int pluginCount = m_tray->trayVisableItemCount() + (trashPlugin ? 1 : 0) + (shutdownPlugin ? 1 : 0) + (keyboardPlugin ? 1 : 0) + (notificationPlugin ? 1 : 0); + int pluginCount = 0; + if (m_tray) { + pluginCount = m_tray->trayVisableItemCount() + (trashPlugin ? 1 : 0) + (shutdownPlugin ? 1 : 0) + (keyboardPlugin ? 1 : 0) + (notificationPlugin ? 1 : 0); + } else { + pluginCount = (trashPlugin ? 1 : 0) + (shutdownPlugin ? 1 : 0) + (keyboardPlugin ? 1 : 0) + (notificationPlugin ? 1 : 0); + } // icon个数 int iconCount = m_fixedAreaLayout->count() + m_appAreaSonLayout->count() + pluginCount; // 余数 @@ -956,8 +985,10 @@ void MainPanelControl::resizeDockIcon() void MainPanelControl::calcuDockIconSize(int w, int h, PluginsItem *trashPlugin, PluginsItem *shutdownPlugin, PluginsItem *keyboardPlugin, PluginsItem *notificationPlugin) { + int appItemSize = qMin(w, h); + for (int i = 0; i < m_fixedAreaLayout->count(); ++i) { - m_fixedAreaLayout->itemAt(i)->widget()->setFixedSize(w, h); + m_fixedAreaLayout->itemAt(i)->widget()->setFixedSize(appItemSize, appItemSize); } if (m_position == Dock::Position::Top || m_position == Dock::Position::Bottom) { @@ -971,7 +1002,7 @@ void MainPanelControl::calcuDockIconSize(int w, int h, PluginsItem *trashPlugin, } for (int i = 0; i < m_appAreaSonLayout->count(); ++i) { - m_appAreaSonLayout->itemAt(i)->widget()->setFixedSize(w, h); + m_appAreaSonLayout->itemAt(i)->widget()->setFixedSize(appItemSize, appItemSize); } // 托盘上每个图标大小 @@ -988,58 +1019,83 @@ void MainPanelControl::calcuDockIconSize(int w, int h, PluginsItem *trashPlugin, if (tray_item_size < 20) return; - m_tray->centralWidget()->setProperty("iconSize", tray_item_size); - - // 插件 - if ((m_position == Position::Top) || (m_position == Position::Bottom)) { - if (shutdownPlugin) - shutdownPlugin->setFixedSize(tray_item_size, h - 20); - if (keyboardPlugin) - keyboardPlugin->setFixedSize(tray_item_size, h - 20); - if (notificationPlugin) - notificationPlugin->setFixedSize(tray_item_size, h - 20); - if (trashPlugin) - trashPlugin->setFixedSize(tray_item_size, h - 20); - } else { - if (shutdownPlugin) - shutdownPlugin->setFixedSize(w - 20, tray_item_size); - if (keyboardPlugin) - keyboardPlugin->setFixedSize(w - 20, tray_item_size); - if (notificationPlugin) - notificationPlugin->setFixedSize(w - 20, tray_item_size); - if (trashPlugin) - trashPlugin->setFixedSize(w - 20, tray_item_size); + if (m_tray) { + m_tray->centralWidget()->setProperty("iconSize", tray_item_size); } + if (shutdownPlugin) + shutdownPlugin->setFixedSize(tray_item_size, tray_item_size); + if (keyboardPlugin) + keyboardPlugin->setFixedSize(tray_item_size, tray_item_size); + if (notificationPlugin) + notificationPlugin->setFixedSize(tray_item_size, tray_item_size); + if (trashPlugin) + trashPlugin->setFixedSize(tray_item_size, tray_item_size); + + //因为日期时间大小和其他插件大小有异,为了设置边距,在各插件中增加了一层布局 + //因此需要通过多一层布局来获取各插件 if ((m_position == Position::Top) || (m_position == Position::Bottom)) { // 三方插件 for (int i = 0; i < m_pluginLayout->count(); ++ i) { - PluginsItem *pItem = static_cast(m_pluginLayout->itemAt(i)->widget()); - if (pItem != trashPlugin && pItem != shutdownPlugin && pItem != keyboardPlugin && pItem !=notificationPlugin) { - if (pItem->pluginName() == "datetime"){ - pItem->setFixedSize(pItem->sizeHint().width(), h); - } else if (pItem->pluginName() == "AiAssistant"){ - pItem->setFixedSize(tray_item_size, h - 20); - } else { - pItem->setFixedSize(pItem->sizeHint().width(), h - 20); + QLayout *layout = m_pluginLayout->itemAt(i)->layout(); + if (layout) { + PluginsItem *pItem = static_cast(layout->itemAt(0)->widget()); + if (pItem && pItem != trashPlugin && pItem != shutdownPlugin && pItem != keyboardPlugin && pItem !=notificationPlugin) { + if (pItem->pluginName() == "datetime") { + pItem->setFixedSize(pItem->sizeHint().width(), h); + } else { + pItem->setFixedSize(tray_item_size, tray_item_size); + } } } } } else { // 三方插件 for (int i = 0; i < m_pluginLayout->count(); ++ i) { - PluginsItem *pItem = static_cast(m_pluginLayout->itemAt(i)->widget()); - if (pItem != trashPlugin && pItem != shutdownPlugin && pItem != keyboardPlugin && pItem !=notificationPlugin) { - if (pItem->pluginName() == "datetime"){ - pItem->setFixedSize(w, pItem->sizeHint().height()); - } else if (pItem->pluginName() == "AiAssistant"){ - pItem->setFixedSize(w - 20, tray_item_size); - } else { - pItem->setFixedSize(w - 20, pItem->sizeHint().height()); + QLayout *layout = m_pluginLayout->itemAt(i)->layout(); + if (layout) { + PluginsItem *pItem = static_cast(layout->itemAt(0)->widget()); + if (pItem && pItem != trashPlugin && pItem != shutdownPlugin && pItem != keyboardPlugin && pItem !=notificationPlugin) { + if (pItem->pluginName() == "datetime") { + pItem->setFixedSize(w, pItem->sizeHint().height()); + } else { + pItem->setFixedSize(tray_item_size, tray_item_size); + } } } } } + + int appTopAndBottomMargin = 0; + int appLeftAndRightMargin = 0; + + int trayTopAndBottomMargin = 0; + int trayLeftAndRightMargin = 0; + + if ((m_position == Position::Top) || (m_position == Position::Bottom)) { + appTopAndBottomMargin = (m_fixedAreaWidget->height() - appItemSize) / 2; + trayTopAndBottomMargin = (m_trayAreaWidget->height() - tray_item_size) / 2; + } else { + appLeftAndRightMargin = (m_fixedAreaWidget->width() - appItemSize) / 2; + trayLeftAndRightMargin = (m_trayAreaWidget->width() - tray_item_size) / 2; + } + + m_fixedAreaLayout->setContentsMargins(appLeftAndRightMargin, appTopAndBottomMargin, appLeftAndRightMargin, appTopAndBottomMargin); + m_appAreaSonLayout->setContentsMargins(appLeftAndRightMargin, appTopAndBottomMargin, appLeftAndRightMargin, appTopAndBottomMargin); + m_trayAreaLayout->setContentsMargins(trayLeftAndRightMargin, trayTopAndBottomMargin, trayLeftAndRightMargin, trayTopAndBottomMargin); + + //因为日期时间插件大小和其他插件大小有异,需要单独设置各插件的边距 + //而不对日期时间插件设置边距 + for (int i = 0; i < m_pluginLayout->count(); ++ i) { + QLayout *layout = m_pluginLayout->itemAt(i)->layout(); + if (layout) { + PluginsItem *pItem = static_cast(layout->itemAt(0)->widget()); + + if (pItem && pItem->pluginName() != "datetime") { + layout->setContentsMargins(trayLeftAndRightMargin, trayTopAndBottomMargin, trayLeftAndRightMargin, trayTopAndBottomMargin); + } + } + } } void MainPanelControl::getTrayVisableItemCount() diff --git a/plugins/onboard/onboarditem.cpp b/plugins/onboard/onboarditem.cpp index d52924fb6..e552db10d 100644 --- a/plugins/onboard/onboarditem.cpp +++ b/plugins/onboard/onboarditem.cpp @@ -121,11 +121,7 @@ const QPixmap OnboardItem::loadSvg(const QString &fileName, const QSize &size) c void OnboardItem::mousePressEvent(QMouseEvent *event) { - if (containCursorPos()) { - m_pressed = true; - } else { - m_pressed = false; - } + m_pressed = true; update(); @@ -143,11 +139,7 @@ void OnboardItem::mouseReleaseEvent(QMouseEvent *event) void OnboardItem::mouseMoveEvent(QMouseEvent *event) { - if (containCursorPos()) { - m_hover = true; - } else { - m_hover = false; - } + m_hover = true; update(); @@ -167,17 +159,3 @@ void OnboardItem::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); } - -bool OnboardItem::containCursorPos() -{ - QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); - QRect rect(this->rect()); - - int iconSize = qMin(rect.width(), rect.height()); - int w = (rect.width() - iconSize) / 2; - int h = (rect.height() - iconSize) / 2; - - rect = rect.adjusted(w, h, -w, -h); - - return rect.contains(cursorPos); -} diff --git a/plugins/onboard/onboarditem.h b/plugins/onboard/onboarditem.h index 29b776f05..f2186a039 100644 --- a/plugins/onboard/onboarditem.h +++ b/plugins/onboard/onboarditem.h @@ -44,7 +44,6 @@ private: void mouseMoveEvent(QMouseEvent *event) override; void leaveEvent(QEvent *event) override; void resizeEvent(QResizeEvent *event) override; - bool containCursorPos(); private: Dock::DisplayMode m_displayMode; diff --git a/plugins/shutdown/shutdownwidget.cpp b/plugins/shutdown/shutdownwidget.cpp index 7a06ec0bb..958d4a27e 100644 --- a/plugins/shutdown/shutdownwidget.cpp +++ b/plugins/shutdown/shutdownwidget.cpp @@ -122,27 +122,9 @@ const QPixmap ShutdownWidget::loadSvg(const QString &fileName, const QSize &size return pixmap; } -bool ShutdownWidget::containCursorPos() -{ - QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); - QRect rect(this->rect()); - - int iconSize = qMin(rect.width(), rect.height()); - int w = (rect.width() - iconSize) / 2; - int h = (rect.height() - iconSize) / 2; - - rect = rect.adjusted(w, h, -w, -h); - - return rect.contains(cursorPos); -} - void ShutdownWidget::mousePressEvent(QMouseEvent *event) { - if (containCursorPos()) { - m_pressed = true; - } else { - m_pressed = false; - } + m_pressed = true; update(); @@ -160,11 +142,7 @@ void ShutdownWidget::mouseReleaseEvent(QMouseEvent *event) void ShutdownWidget::mouseMoveEvent(QMouseEvent *event) { - if (containCursorPos()) { - m_hover = true; - } else { - m_hover = false; - } + m_hover = true; update(); diff --git a/plugins/shutdown/shutdownwidget.h b/plugins/shutdown/shutdownwidget.h index f0179ed81..414ffe5b4 100644 --- a/plugins/shutdown/shutdownwidget.h +++ b/plugins/shutdown/shutdownwidget.h @@ -43,7 +43,6 @@ protected: private: const QPixmap loadSvg(const QString &fileName, const QSize &size) const; - bool containCursorPos(); private: Dock::DisplayMode m_displayMode; diff --git a/plugins/tray/abstracttraywidget.cpp b/plugins/tray/abstracttraywidget.cpp index 190f43b6b..52ef6f3a0 100644 --- a/plugins/tray/abstracttraywidget.cpp +++ b/plugins/tray/abstracttraywidget.cpp @@ -134,17 +134,3 @@ void AbstractTrayWidget::resizeEvent(QResizeEvent *event) setMaximumWidth(QWIDGETSIZE_MAX); } } - -bool AbstractTrayWidget::containCursorPos() -{ - QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); - QRect rect(this->rect()); - - int iconSize = qMin(rect.width(), rect.height()); - int w = (rect.width() - iconSize) / 2; - int h = (rect.height() - iconSize) / 2; - - rect = rect.adjusted(w, h, -w, -h); - - return rect.contains(cursorPos); -} diff --git a/plugins/tray/abstracttraywidget.h b/plugins/tray/abstracttraywidget.h index bae05bfea..8e450f5c9 100644 --- a/plugins/tray/abstracttraywidget.h +++ b/plugins/tray/abstracttraywidget.h @@ -60,7 +60,6 @@ protected: void handleMouseRelease(); const QRect perfectIconRect() const; void resizeEvent(QResizeEvent *event) override; - bool containCursorPos(); private: QTimer *m_handleMouseReleaseTimer; diff --git a/plugins/tray/fashiontray/containers/abstractcontainer.cpp b/plugins/tray/fashiontray/containers/abstractcontainer.cpp index a07996198..54c245d2f 100644 --- a/plugins/tray/fashiontray/containers/abstractcontainer.cpp +++ b/plugins/tray/fashiontray/containers/abstractcontainer.cpp @@ -149,11 +149,6 @@ void AbstractContainer::setExpand(const bool expand) refreshVisible(); } -//QSize AbstractContainer::sizeHint() const -//{ -// return totalSize(); -//} - void AbstractContainer::setItemSize(int itemSize) { m_itemSize = itemSize; diff --git a/plugins/tray/fashiontray/fashiontraycontrolwidget.cpp b/plugins/tray/fashiontray/fashiontraycontrolwidget.cpp index c27e91066..d9799f47d 100644 --- a/plugins/tray/fashiontray/fashiontraycontrolwidget.cpp +++ b/plugins/tray/fashiontray/fashiontraycontrolwidget.cpp @@ -149,9 +149,8 @@ void FashionTrayControlWidget::mouseReleaseEvent(QMouseEvent *event) if (event->button() == Qt::LeftButton) { event->accept(); - if (containCursorPos()) { - setExpanded(!m_expanded); - } + setExpanded(!m_expanded); + return; } @@ -165,11 +164,7 @@ void FashionTrayControlWidget::mousePressEvent(QMouseEvent *event) return QWidget::mousePressEvent(event); } - if (containCursorPos()) { - m_pressed = true; - } else { - m_pressed = false; - } + m_pressed = true; update(); @@ -178,11 +173,7 @@ void FashionTrayControlWidget::mousePressEvent(QMouseEvent *event) void FashionTrayControlWidget::enterEvent(QEvent *event) { - if (containCursorPos()) { - m_hover = true; - } else { - m_hover = false; - } + m_hover = true; update(); @@ -203,19 +194,6 @@ void FashionTrayControlWidget::resizeEvent(QResizeEvent *event) QWidget::resizeEvent(event); } -void FashionTrayControlWidget::mouseMoveEvent(QMouseEvent *event) -{ - if (containCursorPos()) { - m_hover = true; - } else { - m_hover = false; - } - - update(); - - QWidget::mouseMoveEvent(event); -} - void FashionTrayControlWidget::refreshArrowPixmap() { QString iconPath; @@ -238,17 +216,3 @@ void FashionTrayControlWidget::refreshArrowPixmap() const auto ratio = devicePixelRatioF(); m_arrowPix = ImageUtil::loadSvg(iconPath, ":/icons/resources/", PLUGIN_ICON_MAX_SIZE, ratio); } - -bool FashionTrayControlWidget::containCursorPos() -{ - QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); - QRect rect(this->rect()); - - int iconSize = qMin(rect.width(), rect.height()); - int w = (rect.width() - iconSize) / 2; - int h = (rect.height() - iconSize) / 2; - - rect = rect.adjusted(w, h, -w, -h); - - return rect.contains(cursorPos); -} diff --git a/plugins/tray/fashiontray/fashiontraycontrolwidget.h b/plugins/tray/fashiontray/fashiontraycontrolwidget.h index 1d5564afd..c3b3c9262 100644 --- a/plugins/tray/fashiontray/fashiontraycontrolwidget.h +++ b/plugins/tray/fashiontray/fashiontraycontrolwidget.h @@ -48,11 +48,9 @@ protected: void enterEvent(QEvent *event) override; void leaveEvent(QEvent *event) override; void resizeEvent(QResizeEvent *event) override; - void mouseMoveEvent(QMouseEvent *event) override; private: void refreshArrowPixmap(); - bool containCursorPos(); private: QTimer *m_expandDelayTimer; diff --git a/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp b/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp index e49ed8373..6b8d5601f 100644 --- a/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp +++ b/plugins/tray/fashiontray/fashiontraywidgetwrapper.cpp @@ -141,11 +141,7 @@ void FashionTrayWidgetWrapper::mousePressEvent(QMouseEvent *event) MousePressPoint = event->pos(); } - if (containCursorPos()) { - m_pressed = true; - } else { - m_pressed = false; - } + m_pressed = true; update(); @@ -179,11 +175,7 @@ void FashionTrayWidgetWrapper::dragEnterEvent(QDragEnterEvent *event) void FashionTrayWidgetWrapper::enterEvent(QEvent *event) { - if (containCursorPos()) { - m_hover = true; - } else { - m_hover = false; - } + m_hover = true; update(); @@ -228,11 +220,7 @@ void FashionTrayWidgetWrapper::handleMouseMove(QMouseEvent *event) if(m_absTrayWidget.isNull()) return; - if (containCursorPos()) { - m_hover = true; - } else { - m_hover = false; - } + m_hover = true; update(); @@ -244,10 +232,6 @@ void FashionTrayWidgetWrapper::handleMouseMove(QMouseEvent *event) return; } - if (!containCursorPos()) { - return; - } - event->accept(); QDrag drag(this); @@ -283,20 +267,6 @@ void FashionTrayWidgetWrapper::onTrayWidgetClicked() setAttention(false); } -bool FashionTrayWidgetWrapper::containCursorPos() -{ - QPoint cursorPos = this->mapFromGlobal(QCursor::pos()); - QRect rect(this->rect()); - - int iconSize = qMin(rect.width(), rect.height()); - int w = (rect.width() - iconSize) / 2; - int h = (rect.height() - iconSize) / 2; - - rect = rect.adjusted(w, h, -w, -h); - - return rect.contains(cursorPos); -} - bool FashionTrayWidgetWrapper::attention() const { return m_attention; diff --git a/plugins/tray/fashiontray/fashiontraywidgetwrapper.h b/plugins/tray/fashiontray/fashiontraywidgetwrapper.h index 226331ca6..2ad938c23 100644 --- a/plugins/tray/fashiontray/fashiontraywidgetwrapper.h +++ b/plugins/tray/fashiontray/fashiontraywidgetwrapper.h @@ -64,7 +64,6 @@ private: void handleMouseMove(QMouseEvent *event); void onTrayWidgetNeedAttention(); void onTrayWidgetClicked(); - bool containCursorPos(); private: QPointer m_absTrayWidget; diff --git a/plugins/tray/snitraywidget.cpp b/plugins/tray/snitraywidget.cpp index 92e38a99e..039484067 100644 --- a/plugins/tray/snitraywidget.cpp +++ b/plugins/tray/snitraywidget.cpp @@ -560,12 +560,7 @@ QPixmap SNITrayWidget::newIconPixmap(IconType iconType) void SNITrayWidget::enterEvent(QEvent *event) { - if (containCursorPos()) { - m_popupTipsDelayTimer->start(); - } else { - m_popupTipsDelayTimer->stop(); - hidePopup(); - } + m_popupTipsDelayTimer->start(); AbstractTrayWidget::enterEvent(event); } @@ -581,18 +576,6 @@ void SNITrayWidget::leaveEvent(QEvent *event) AbstractTrayWidget::leaveEvent(event); } -void SNITrayWidget::mouseMoveEvent(QMouseEvent *event) -{ - if (containCursorPos()) { - m_popupTipsDelayTimer->start(); - } else { - m_popupTipsDelayTimer->stop(); - hidePopup(); - } - - AbstractTrayWidget::mouseMoveEvent(event); -} - void SNITrayWidget::showHoverTips() { if (PopupWindow->model()) diff --git a/plugins/tray/snitraywidget.h b/plugins/tray/snitraywidget.h index 1e70d4220..2857c2169 100644 --- a/plugins/tray/snitraywidget.h +++ b/plugins/tray/snitraywidget.h @@ -101,7 +101,6 @@ private Q_SLOTS: void popupWindowAccept(); void enterEvent(QEvent *event) override; void leaveEvent(QEvent *event) override; - void mouseMoveEvent(QMouseEvent *event) override; private: void paintEvent(QPaintEvent *e) override; diff --git a/plugins/tray/system-trays/systemtrayitem.cpp b/plugins/tray/system-trays/systemtrayitem.cpp index 05442722a..34e4ab411 100644 --- a/plugins/tray/system-trays/systemtrayitem.cpp +++ b/plugins/tray/system-trays/systemtrayitem.cpp @@ -203,12 +203,7 @@ void SystemTrayItem::enterEvent(QEvent *event) return; } - if (containCursorPos()) { - m_popupTipsDelayTimer->start(); - } else { - m_popupTipsDelayTimer->stop(); - hidePopup(); - } + m_popupTipsDelayTimer->start(); update(); @@ -294,18 +289,6 @@ void SystemTrayItem::showEvent(QShowEvent *event) return AbstractTrayWidget::showEvent(event); } -void SystemTrayItem::mouseMoveEvent(QMouseEvent *event) -{ - if (containCursorPos()) { - m_popupTipsDelayTimer->start(); - } else { - m_popupTipsDelayTimer->stop(); - hidePopup(); - } - - AbstractTrayWidget::mouseMoveEvent(event); -} - const QPoint SystemTrayItem::popupMarkPoint() const { QPoint p(topleftPoint()); diff --git a/plugins/tray/system-trays/systemtrayitem.h b/plugins/tray/system-trays/systemtrayitem.h index 36117750f..00607e082 100644 --- a/plugins/tray/system-trays/systemtrayitem.h +++ b/plugins/tray/system-trays/systemtrayitem.h @@ -72,7 +72,6 @@ protected: void mousePressEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override; void showEvent(QShowEvent* event) override; - void mouseMoveEvent(QMouseEvent* event) override; protected: const QPoint popupMarkPoint() const; diff --git a/plugins/tray/xembedtraywidget.cpp b/plugins/tray/xembedtraywidget.cpp index 35374ac13..9c0700bd3 100644 --- a/plugins/tray/xembedtraywidget.cpp +++ b/plugins/tray/xembedtraywidget.cpp @@ -147,11 +147,7 @@ void XEmbedTrayWidget::mouseMoveEvent(QMouseEvent *e) return; } - if (containCursorPos()) { - m_sendHoverEvent->start();; - } else { - m_sendHoverEvent->stop(); - } + m_sendHoverEvent->start(); } void XEmbedTrayWidget::configContainerPosition()