From 0103f4165c6f79a1f288b7426e08712df9a52a62 Mon Sep 17 00:00:00 2001 From: Fan PengCheng Date: Fri, 24 Jul 2020 16:27:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(accessible):=20=E9=83=A8=E5=88=86=E6=A0=87?= =?UTF-8?q?=E8=AE=B0=E6=8E=A7=E4=BB=B6=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 取出部分控件标记命名中的sni:文字, 解决托盘图标的tips控件标记名会变化的问题 Log: 控件标记的名称稍微修改了下 Change-Id: I68d9a18154e985d974af0d6c7971d86729bb7099 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/578 Reviewed-by: Reviewed-by: fanpengcheng Tested-by: --- frame/controller/dockitemmanager.cpp | 4 ---- frame/window/accessible.h | 13 ++++++++----- plugins/sound/sounditem.cpp | 1 - plugins/tray/snitraywidget.cpp | 3 ++- plugins/tray/system-trays/systemtrayitem.cpp | 2 +- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/frame/controller/dockitemmanager.cpp b/frame/controller/dockitemmanager.cpp index 96cf53f48..77ec6daf5 100644 --- a/frame/controller/dockitemmanager.cpp +++ b/frame/controller/dockitemmanager.cpp @@ -72,12 +72,8 @@ DockItemManager::DockItemManager(QObject *parent) // 刷新图标 QMetaObject::invokeMethod(this, "refershItemsIcon", Qt::QueuedConnection); - - // 自动化测试,需要从后端读取的插件配置中,显示的插件默认需要有enable属性,这里主动向后端写入一次 - m_updatePluginsOrderTimer->start(); } - DockItemManager *DockItemManager::instance(QObject *parent) { if (!INSTANCE) diff --git a/frame/window/accessible.h b/frame/window/accessible.h index 504754a9f..d9e0578c5 100644 --- a/frame/window/accessible.h +++ b/frame/window/accessible.h @@ -16,6 +16,7 @@ #include "../item/components/floatingpreview.h" #include "../plugins/tray/snitraywidget.h" +#include "../plugins/tray/abstracttraywidget.h" #include "../plugins/tray/indicatortraywidget.h" #include "../plugins/tray/xembedtraywidget.h" #include "../plugins/tray/system-trays/systemtrayitem.h" @@ -66,10 +67,11 @@ SET_BUTTON_ACCESSIBLE(PlaceholderItem, "placeholderitem") SET_BUTTON_ACCESSIBLE(AppDragWidget, "appdragwidget") SET_BUTTON_ACCESSIBLE(AppSnapshot, "appsnapshot") SET_BUTTON_ACCESSIBLE(FloatingPreview, "floatingpreview") -SET_BUTTON_ACCESSIBLE(XEmbedTrayWidget, m_w->itemKeyForConfig()) -SET_BUTTON_ACCESSIBLE(IndicatorTrayWidget, m_w->itemKeyForConfig()) -SET_BUTTON_ACCESSIBLE(SNITrayWidget, m_w->itemKeyForConfig()) -SET_BUTTON_ACCESSIBLE(SystemTrayItem, m_w->itemKeyForConfig()) +SET_BUTTON_ACCESSIBLE(XEmbedTrayWidget, m_w->itemKeyForConfig().replace("sni:","")) +SET_BUTTON_ACCESSIBLE(IndicatorTrayWidget, m_w->itemKeyForConfig().replace("sni:","")) +SET_BUTTON_ACCESSIBLE(SNITrayWidget, m_w->itemKeyForConfig().replace("sni:","")) +SET_BUTTON_ACCESSIBLE(AbstractTrayWidget, m_w->itemKeyForConfig().replace("sni:","")) +SET_BUTTON_ACCESSIBLE(SystemTrayItem, m_w->itemKeyForConfig().replace("sni:","")) SET_FORM_ACCESSIBLE(FashionTrayItem, "fashiontrayitem") SET_FORM_ACCESSIBLE(FashionTrayWidgetWrapper, "fashiontraywrapper") SET_BUTTON_ACCESSIBLE(FashionTrayControlWidget, "fashiontraycontrolwidget") @@ -91,7 +93,7 @@ SET_FORM_ACCESSIBLE(MultitaskingWidget, "plugin-multitasking") SET_FORM_ACCESSIBLE(ShowDesktopWidget, "plugin-showdesktop") SET_FORM_ACCESSIBLE(OverlayWarningWidget, "plugin-overlaywarningwidget") SET_FORM_ACCESSIBLE(QWidget, m_w->objectName().isEmpty() ? "widget" : m_w->objectName()) -SET_LABEL_ACCESSIBLE(QLabel, m_w->objectName() == "notifications" ? m_w->objectName() : m_w->text().isEmpty() ? m_w->objectName().isEmpty() ? "text" : m_w->objectName() : m_w->text()) +SET_LABEL_ACCESSIBLE(QLabel, m_w->objectName() == "notifications" ? m_w->objectName() : m_w->text().isEmpty() ? m_w->objectName().isEmpty() ? "text" : m_w->objectName() : m_w->text()) SET_BUTTON_ACCESSIBLE(DIconButton, m_w->objectName().isEmpty() ? "imagebutton" : m_w->objectName()) SET_BUTTON_ACCESSIBLE(DSwitchButton, m_w->text().isEmpty() ? "switchbutton" : m_w->text()) SET_BUTTON_ACCESSIBLE(DesktopWidget, "desktopWidget"); @@ -113,6 +115,7 @@ QAccessibleInterface *accessibleFactory(const QString &classname, QObject *objec USE_ACCESSIBLE(classname, AppSnapshot); USE_ACCESSIBLE(classname, FloatingPreview); USE_ACCESSIBLE(classname, SNITrayWidget); + USE_ACCESSIBLE(classname, AbstractTrayWidget); USE_ACCESSIBLE(classname, SystemTrayItem); USE_ACCESSIBLE(classname, FashionTrayItem); USE_ACCESSIBLE(classname, FashionTrayWidgetWrapper); diff --git a/plugins/sound/sounditem.cpp b/plugins/sound/sounditem.cpp index 9d1ea55db..b38f4a5f8 100644 --- a/plugins/sound/sounditem.cpp +++ b/plugins/sound/sounditem.cpp @@ -46,7 +46,6 @@ SoundItem::SoundItem(QWidget *parent) , m_applet(new SoundApplet(this)) , m_sinkInter(nullptr) { - m_tipsLabel->setObjectName("sound"); m_tipsLabel->setAccessibleName("soundtips"); m_tipsLabel->setVisible(false); diff --git a/plugins/tray/snitraywidget.cpp b/plugins/tray/snitraywidget.cpp index 039484067..6112fb466 100644 --- a/plugins/tray/snitraywidget.cpp +++ b/plugins/tray/snitraywidget.cpp @@ -603,7 +603,8 @@ void SNITrayWidget::showHoverTips() return; m_tipsLabel->setText(tooltip.title); - m_tipsLabel->setAccessibleName(tooltip.title); + m_tipsLabel->setAccessibleName(itemKeyForConfig().replace("sni:","")); + showPopupWindow(m_tipsLabel); } diff --git a/plugins/tray/system-trays/systemtrayitem.cpp b/plugins/tray/system-trays/systemtrayitem.cpp index 3e85d1323..1d837c299 100644 --- a/plugins/tray/system-trays/systemtrayitem.cpp +++ b/plugins/tray/system-trays/systemtrayitem.cpp @@ -52,7 +52,7 @@ SystemTrayItem::SystemTrayItem(PluginsItemInterface *const pluginInter, const QS hLayout->setMargin(0); setLayout(hLayout); - setAccessibleName(m_pluginInter->pluginName() + "-" + m_itemKey); + setAccessibleName(m_itemKey); setAttribute(Qt::WA_TranslucentBackground); if (PopupWindow.isNull()) {