From fc8f45e8a4fbac8b223b3ba9ebe826cd938144d3 Mon Sep 17 00:00:00 2001 From: chenjun Date: Mon, 3 Aug 2020 15:01:59 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix:=20=E9=87=8D=E6=96=B0=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A0=8F=E5=9B=BE=E6=A0=87=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在计算任务栏宽度时,多次减掉图标间隔的距离,计算得到的固定图标大小偏小,而在启动器等多个固定图标偏小的情况下,会在任务栏上多出空白,由于应用图标 是按自适应扩展布局的,造成应用图标比启动器等固定图标偏大 Log: 修复任务栏在左方和右方时,固定区域三个图标比其他区域图标要小问题 Bug: https://pms.uniontech.com/zentao/bug-view-40639.html Change-Id: I2aaeca3950b025b7eba71a6f90c66a90571196fd Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/1141 Reviewed-by: Reviewed-by: lizhongming Tested-by: --- frame/panel/mainpanelcontrol.cpp | 85 ++++++++++++-------------------- 1 file changed, 32 insertions(+), 53 deletions(-) diff --git a/frame/panel/mainpanelcontrol.cpp b/frame/panel/mainpanelcontrol.cpp index 37a0d05b6..286377c64 100755 --- a/frame/panel/mainpanelcontrol.cpp +++ b/frame/panel/mainpanelcontrol.cpp @@ -828,6 +828,8 @@ void MainPanelControl::showEvent(QShowEvent *event) void MainPanelControl::paintEvent(QPaintEvent *event) { + Q_UNUSED(event); + QPainter painter(this); QColor color; if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) { @@ -885,12 +887,10 @@ void MainPanelControl::resizeDockIcon() int totalLength = ((m_position == Position::Top) || (m_position == Position::Bottom)) ? width() : height(); // 减去托盘间隔区域 totalLength -= (m_tray->trayVisableItemCount() + 1) * 10; - // 减去插件间隔 - totalLength -= (m_pluginLayout->count() + 1) * 10; // 减去3个分割线的宽度 totalLength -= 3 * SPLITER_SIZE; - // 减去所有插件宽度,加上参与计算的3个插件宽度 + // 减去所有插件宽度,加上参与计算的4个插件宽度 if ((m_position == Position::Top) || (m_position == Position::Bottom)) { totalLength -= m_pluginAreaWidget->width(); if (trashPlugin) totalLength += trashPlugin->width(); @@ -912,32 +912,28 @@ void MainPanelControl::resizeDockIcon() // 参与计算的插件的个数(包含托盘和插件,垃圾桶,关机,屏幕键盘) int pluginCount = m_tray->trayVisableItemCount() + (trashPlugin ? 1 : 0) + (shutdownPlugin ? 1 : 0) + (keyboardPlugin ? 1 : 0) + (notificationPlugin ? 1 : 0); - // icon个数 int iconCount = m_fixedAreaLayout->count() + m_appAreaSonLayout->count() + pluginCount; - - int iconSize = 0; - // 余数 int yu = (totalLength % iconCount); // icon宽度 = (总宽度-余数)/icon个数 - iconSize = (totalLength - yu) / iconCount; - - if (iconSize < 20 || iconSize > 40) { - - // 减去插件和托盘的宽度 - if (iconSize < 20) - totalLength -= 20 * pluginCount; - else - totalLength -= 40 * pluginCount; - - iconCount -= pluginCount; - - // 余数 - yu = (totalLength % iconCount); - // icon宽度 = (总宽度-余数)/icon个数 - iconSize = (totalLength - yu) / iconCount; + int iconSize = (totalLength - yu) / iconCount; + //计算插件图标的最大或最小值 + int tray_item_size = qBound(20, iconSize, 40); + if ((m_position == Position::Top) || (m_position == Position::Bottom)) { + tray_item_size = qMin(tray_item_size,height()); + tray_item_size = std::min(tray_item_size, height() - 20); + } else { + tray_item_size = qMin(tray_item_size,width()); + tray_item_size = std::min(tray_item_size, width() - 20); } + //减去插件图标的大小后重新计算固定图标和应用图标的平均大小 + totalLength -= tray_item_size * pluginCount; + iconCount -= pluginCount; + // 余数 + yu = (totalLength % iconCount); + // icon宽度 = (总宽度-余数)/icon个数 + iconSize = (totalLength - yu) / iconCount; if ((m_position == Position::Top) || (m_position == Position::Bottom)) { if (iconSize >= height()) { @@ -956,7 +952,7 @@ void MainPanelControl::resizeDockIcon() void MainPanelControl::calcuDockIconSize(int w, int h, PluginsItem *trashPlugin, PluginsItem *shutdownPlugin, PluginsItem *keyboardPlugin, PluginsItem *notificationPlugin) { - for (int i = 0; i < m_fixedAreaLayout->count(); ++ i) { + for (int i = 0; i < m_fixedAreaLayout->count(); ++i) { m_fixedAreaLayout->itemAt(i)->widget()->setFixedSize(w, h); } @@ -964,31 +960,15 @@ void MainPanelControl::calcuDockIconSize(int w, int h, PluginsItem *trashPlugin, m_fixedSpliter->setFixedSize(SPLITER_SIZE, int(w * 0.6)); m_appSpliter->setFixedSize(SPLITER_SIZE, int(w * 0.6)); m_traySpliter->setFixedSize(SPLITER_SIZE, int(w * 0.5)); - // 垃圾桶 - if (trashPlugin) - trashPlugin->setFixedSize(std::min(w, h - 20), h - 20); - - for (int i = 0; i < m_appAreaSonLayout->count(); ++ i) { - m_appAreaSonLayout->itemAt(i)->widget()->setMaximumWidth(h); - m_appAreaSonLayout->itemAt(i)->widget()->setMaximumHeight(QWIDGETSIZE_MAX); - } - } else { m_fixedSpliter->setFixedSize(int(h * 0.6), SPLITER_SIZE); m_appSpliter->setFixedSize(int(h * 0.6), SPLITER_SIZE); m_traySpliter->setFixedSize(int(h * 0.5), SPLITER_SIZE); - // 垃圾桶 - if (trashPlugin) - trashPlugin->setFixedSize(w - 20, std::min(w - 20, h)); - - - for (int i = 0; i < m_appAreaSonLayout->count(); ++ i) { - m_appAreaSonLayout->itemAt(i)->widget()->setMaximumHeight(w); - m_appAreaSonLayout->itemAt(i)->widget()->setMaximumWidth(QWIDGETSIZE_MAX); - } } - // 插件和托盘 + for (int i = 0; i < m_appAreaSonLayout->count(); ++i) { + m_appAreaSonLayout->itemAt(i)->widget()->setFixedSize(w, h); + } // 托盘上每个图标大小 int tray_item_size = 20; @@ -1004,28 +984,27 @@ void MainPanelControl::calcuDockIconSize(int w, int h, PluginsItem *trashPlugin, if (tray_item_size < 20) return; - if ((m_position == Position::Top) || (m_position == Position::Bottom)) { - m_tray->centralWidget()->setProperty("iconSize", tray_item_size); + 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) { + if (notificationPlugin) notificationPlugin->setFixedSize(tray_item_size, h - 20); - } - + if (trashPlugin) + trashPlugin->setFixedSize(tray_item_size, h - 20); } else { - m_tray->centralWidget()->setProperty("iconSize", tray_item_size); - if (shutdownPlugin) shutdownPlugin->setFixedSize(w - 20, tray_item_size); if (keyboardPlugin) keyboardPlugin->setFixedSize(w - 20, tray_item_size); - if (notificationPlugin) { + if (notificationPlugin) notificationPlugin->setFixedSize(w - 20, tray_item_size); - } + if (trashPlugin) + trashPlugin->setFixedSize(w - 20, tray_item_size); } if ((m_position == Position::Top) || (m_position == Position::Bottom)) { From 5221be11416617132594b6127142370a07dac251 Mon Sep 17 00:00:00 2001 From: chenjun Date: Mon, 3 Aug 2020 11:28:48 +0800 Subject: [PATCH 2/7] =?UTF-8?q?fix:=20=E6=8C=89=E9=9C=80=E6=B1=82=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E8=B0=83=E6=95=B4=E6=89=98=E7=9B=98=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E9=BB=98=E8=AE=A4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根据需求文档https://shimo.im/sheets/8YQY9vyC9VRWCDC6/MODOC 重新调整托盘区域插件默认排序 Log: 修复托盘区域的挂载图标和插件区域的电源,时间图标顺序与需求不符问题 Bug: https://pms.uniontech.com/zentao/bug-view-40690.html Change-Id: I6962228101de5497e910c4053c1b7e942bec87f7 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/1123 Reviewed-by: Reviewed-by: lizhongming Reviewed-by: pengwenhao Tested-by: --- plugins/keyboard-layout/keyboardplugin.cpp | 2 +- plugins/network/networkplugin.cpp | 2 +- plugins/sound/soundplugin.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/keyboard-layout/keyboardplugin.cpp b/plugins/keyboard-layout/keyboardplugin.cpp index 665c41554..b60c6b5c6 100644 --- a/plugins/keyboard-layout/keyboardplugin.cpp +++ b/plugins/keyboard-layout/keyboardplugin.cpp @@ -82,7 +82,7 @@ int KeyboardPlugin::itemSortKey(const QString &itemKey) { const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient); - return m_proxyInter->getValue(this, key, 2).toInt(); + return m_proxyInter->getValue(this, key, 1).toInt(); } void KeyboardPlugin::setSortKey(const QString &itemKey, const int order) diff --git a/plugins/network/networkplugin.cpp b/plugins/network/networkplugin.cpp index 32ef0f5f5..e929cabce 100644 --- a/plugins/network/networkplugin.cpp +++ b/plugins/network/networkplugin.cpp @@ -141,7 +141,7 @@ int NetworkPlugin::itemSortKey(const QString &itemKey) { const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient); - return m_proxyInter->getValue(this, key, 2).toInt(); + return m_proxyInter->getValue(this, key, 3).toInt(); } void NetworkPlugin::setSortKey(const QString &itemKey, const int order) diff --git a/plugins/sound/soundplugin.cpp b/plugins/sound/soundplugin.cpp index 3f5b10767..1b3667fd4 100644 --- a/plugins/sound/soundplugin.cpp +++ b/plugins/sound/soundplugin.cpp @@ -113,7 +113,7 @@ int SoundPlugin::itemSortKey(const QString &itemKey) { const QString key = QString("pos_%1_%2").arg(itemKey).arg(Dock::Efficient); - return m_proxyInter->getValue(this, key, 1).toInt(); + return m_proxyInter->getValue(this, key, 2).toInt(); } void SoundPlugin::setSortKey(const QString &itemKey, const int order) From 9486e1380d098f4b3866eea963979b98ab31759e Mon Sep 17 00:00:00 2001 From: chenjun Date: Thu, 6 Aug 2020 19:38:35 +0800 Subject: [PATCH 3/7] =?UTF-8?q?fix:=20=E6=8C=89=E7=85=A7=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E7=9A=84=E6=97=A0=E7=BA=BF=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E5=BC=BA=E5=BA=A6=E5=A4=84=E7=90=86=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=96=B9=E5=BC=8F=EF=BC=8C=E8=B0=83=E6=95=B4=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=A0=8F=E4=B8=AD=E6=97=A0=E7=BA=BF=E4=BF=A1=E5=8F=B7?= =?UTF-8?q?=E5=BC=BA=E5=BA=A6=E7=9A=84=E5=A4=84=E7=90=86=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 任务栏中无线网络信号强度处理方式未与控制中心中的保持一致,造成显示的信号强度有偏差,重新调整任务栏的处理计算方式 Log: 修复WIFI无线网络信号较差,不能达到满格效果问题 Bug: https://pms.uniontech.com/zentao/bug-view-25443.html Change-Id: Idbb977c670d22161ba9270737cc39fc14abfd560 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/1098 Reviewed-by: Reviewed-by: fanpengcheng Reviewed-by: lizhongming Tested-by: --- plugins/network/item/applet/accesspointwidget.cpp | 14 +++++++++----- plugins/network/item/applet/wirelesslist.cpp | 6 +++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/plugins/network/item/applet/accesspointwidget.cpp b/plugins/network/item/applet/accesspointwidget.cpp index dac3ef5c9..4d2850673 100644 --- a/plugins/network/item/applet/accesspointwidget.cpp +++ b/plugins/network/item/applet/accesspointwidget.cpp @@ -161,12 +161,16 @@ void AccessPointWidget::setStrengthIcon(const int strength) const QSize s = QSize(16, 16); QString type; - if (strength == 100) - type = "80"; - else if (strength < 20) + if (5 >= strength) type = "0"; - else - type = QString::number(strength / 10 & ~0x1) + "0"; + else if (5 < strength && 30 >= strength) + type = "20"; + else if (30 < strength && 55 >= strength) + type = "40"; + else if (55 < strength && 65 >= strength) + type = "60"; + else if (65 < strength) + type = "80"; QString iconString = QString("wireless-%1-symbolic").arg(type); bool isLight = (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType); diff --git a/plugins/network/item/applet/wirelesslist.cpp b/plugins/network/item/applet/wirelesslist.cpp index bb5954f67..c61161ce6 100644 --- a/plugins/network/item/applet/wirelesslist.cpp +++ b/plugins/network/item/applet/wirelesslist.cpp @@ -122,12 +122,12 @@ void WirelessList::APAdded(const QJsonObject &apInfo) AccessPoint ap(apInfo); const auto mIndex = m_apList.indexOf(ap); if (mIndex != -1) { - if(ap.strength() < 20 && ap.path() == m_apList.at(mIndex).path()) + if(ap.strength() < 5 && ap.path() == m_apList.at(mIndex).path()) m_apList.removeAt(mIndex); else m_apList.replace(mIndex, ap); } else { - if(ap.strength() < 20) + if(ap.strength() < 5) return; m_apList.append(ap); } @@ -188,7 +188,7 @@ void WirelessList::APPropertiesChanged(const QJsonObject &apInfo) { AccessPoint ap(apInfo); const auto mIndex = m_apList.indexOf(ap); - if(ap.strength() < 20) + if(ap.strength() < 5) { if(mIndex != -1){ if (ap.path() == m_apList.at(mIndex).path()) { From aa0f599124db8ed6de78bcc11a8951ea0916679d Mon Sep 17 00:00:00 2001 From: chenjun Date: Wed, 5 Aug 2020 18:11:56 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix:=20=E5=85=B3=E9=97=AD=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E4=B8=8D=E4=BD=BF=E7=94=A8=E6=B0=B4=E5=B9=B3=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E6=98=BE=E7=A4=BA=EF=BC=8C=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E4=BD=8D=E7=BD=AE=E5=9C=A8=E5=8F=B3=E4=BE=A7?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关闭按钮和应用程序标题使用的水平布局显示,当鼠标进入提示窗口时,显示关闭按钮,应用标题会向左缩放,造成文字偏左,因此关闭按钮不使用水平布局显示, 当需要显示关闭按钮时,实时计算按钮位置,在右侧显示 Log: 修复2D模式下,鼠标hover在预览信息上,文字会移动到信息边框的最左边问题 Bug: https://pms.uniontech.com/zentao/bug-view-41363.html Change-Id: I6d6fe44c021639813b7ec73b648a82203ff10551 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/1343 Tested-by: lizhongming Reviewed-by: lizhongming Reviewed-by: niecheng --- frame/item/components/appsnapshot.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/frame/item/components/appsnapshot.cpp b/frame/item/components/appsnapshot.cpp index f7011a8b3..f6c58725d 100644 --- a/frame/item/components/appsnapshot.cpp +++ b/frame/item/components/appsnapshot.cpp @@ -74,12 +74,8 @@ AppSnapshot::AppSnapshot(const WId wid, QWidget *parent) QHBoxLayout *centralLayout = new QHBoxLayout; centralLayout->addWidget(m_title); - centralLayout->addWidget(m_closeBtn2D); - centralLayout->setSpacing(5); centralLayout->setMargin(0); - centralLayout->setAlignment(m_closeBtn2D, Qt::AlignRight); - setLayout(centralLayout); setAcceptDrops(true); resize(SNAP_WIDTH, SNAP_HEIGHT); @@ -202,6 +198,7 @@ void AppSnapshot::enterEvent(QEvent *e) QWidget::enterEvent(e); if (!m_wmHelper->hasComposite()) { + m_closeBtn2D->move(width() - m_closeBtn2D->width() - 5, (height() - m_closeBtn2D->height()) / 2); m_closeBtn2D->setVisible(true); } else { emit entered(wid()); From 4d5f6d4d30a04cf9469777e558f1d82c240a3d31 Mon Sep 17 00:00:00 2001 From: chenjun Date: Thu, 6 Aug 2020 11:24:42 +0800 Subject: [PATCH 5/7] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=A0=8F=E9=9A=90=E8=97=8F=E6=97=B6=EF=BC=8C=E5=94=A4=E9=86=92?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A0=8F=E7=9B=91=E8=A7=86=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E4=B8=BA15=E5=83=8F=E7=B4=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 和产品确定了,唤醒任务栏固定区域根据位置,在屏幕上、下、左或右方15像素区域内 Log: 设置任务栏为一直隐藏时,鼠标放到任务栏区域内,仍然唤不醒任务栏,只有移动到屏幕的最下边缘,才能唤醒任务栏 Bug: https://pms.uniontech.com/zentao/bug-view-41515.html Change-Id: I1304896ae48feb4bcdde71e6bbc8de5e5628d0be Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/1367 Reviewed-by: Reviewed-by: lizhongming Reviewed-by: niecheng Tested-by: --- frame/window/mainwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frame/window/mainwindow.cpp b/frame/window/mainwindow.cpp index 27ddbcd40..8b6bd6394 100644 --- a/frame/window/mainwindow.cpp +++ b/frame/window/mainwindow.cpp @@ -1057,7 +1057,8 @@ void MainWindow::updateRegionMonitorWatch() QList screensRect = m_settings->monitorsRect(); QList monitorAreas; - int val = 3; + //任务栏隐藏时,唤醒监视区域大小,上下15像素 左右15像素 + int val = 15; int x, y, w, h; auto func = [&](MonitRect & monitRect) { From 5b52964b05953b20e9a040d9c0f145380fff7c0c Mon Sep 17 00:00:00 2001 From: chenjun Date: Mon, 17 Aug 2020 10:20:39 +0800 Subject: [PATCH 6/7] =?UTF-8?q?fix:=20=E6=8C=89=E7=85=A7=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E7=9A=84=E6=97=A0=E7=BA=BF=E7=BD=91=E7=BB=9C?= =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E5=BC=BA=E5=BA=A6=E5=A4=84=E7=90=86=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=96=B9=E5=BC=8F=EF=BC=8C=E8=B0=83=E6=95=B4=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=A0=8F=E4=B8=AD=E6=97=A0=E7=BA=BF=E4=BF=A1=E5=8F=B7?= =?UTF-8?q?=E5=BC=BA=E5=BA=A6=E7=9A=84=E5=A4=84=E7=90=86=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 任务栏中无线网络信号强度处理方式未与控制中心中的保持一致,造成显示的信号强度有偏差,重新调整任务栏的处理计算方式 Log: 修复WIFI无线网络信号较差,不能达到满格效果问题 Bug: https://pms.uniontech.com/zentao/bug-view-25443.html Change-Id: Ifc90e9ad8b015b59c1518e8b28114f41e881a859 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/2119 Reviewed-by: Reviewed-by: lizhongming Reviewed-by: wangwei Tested-by: --- plugins/network/networkitem.cpp | 42 +++++++++++++++------------------ plugins/network/networkitem.h | 1 + 2 files changed, 20 insertions(+), 23 deletions(-) diff --git a/plugins/network/networkitem.cpp b/plugins/network/networkitem.cpp index c1f232cc8..0a7381723 100644 --- a/plugins/network/networkitem.cpp +++ b/plugins/network/networkitem.cpp @@ -312,15 +312,7 @@ void NetworkItem::refreshIcon() case Connected: case Aconnected: strength = getStrongestAp(); - if (strength < 0) - strength = 100; - if (strength == 100) { - stateString = "80"; - } else if (strength < 20) { - stateString = "0"; - } else { - stateString = QString::number(strength / 10 & ~0x1) + "0"; - } + stateString = getStrengthStateString(strength); iconString = QString("wireless-%1-symbolic").arg(stateString); break; case Bconnected: @@ -340,13 +332,7 @@ void NetworkItem::refreshIcon() m_timer->start(); if (m_switchWire) { strength = QTime::currentTime().msec() / 10 % 100; - if (strength == 100) { - stateString = "80"; - } else if (strength < 20) { - stateString = "0"; - } else { - stateString = QString::number(strength / 10 & ~0x1) + "0"; - } + stateString = getStrengthStateString(strength); iconString = QString("wireless-%1-symbolic").arg(stateString); if (height() <= PLUGIN_BACKGROUND_MIN_SIZE && DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) @@ -369,13 +355,7 @@ void NetworkItem::refreshIcon() case Aconnecting: { m_timer->start(); strength = QTime::currentTime().msec() / 10 % 100; - if (strength == 100) { - stateString = "80"; - } else if (strength < 20) { - stateString = "0"; - } else { - stateString = QString::number(strength / 10 & ~0x1) + "0"; - } + stateString = getStrengthStateString(strength); iconString = QString("wireless-%1-symbolic").arg(stateString); if (height() <= PLUGIN_BACKGROUND_MIN_SIZE && DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) @@ -469,6 +449,22 @@ bool NetworkItem::eventFilter(QObject *obj, QEvent *event) return false; } +QString NetworkItem::getStrengthStateString(int strength) +{ + if (5 >= strength) + return "0"; + else if (5 < strength && 30 >= strength) + return "20"; + else if (30 < strength && 55 >= strength) + return "40"; + else if (55 < strength && 65 >= strength) + return "60"; + else if (65 < strength) + return "80"; + else + return "0"; +} + void NetworkItem::wiredsEnable(bool enable) { for (auto wiredItem : m_wiredItems) { diff --git a/plugins/network/networkitem.h b/plugins/network/networkitem.h index dfd9412a1..52a3329af 100644 --- a/plugins/network/networkitem.h +++ b/plugins/network/networkitem.h @@ -72,6 +72,7 @@ protected: void resizeEvent(QResizeEvent *e) override; void paintEvent(QPaintEvent *e) override; bool eventFilter(QObject *obj,QEvent *event) override; + QString getStrengthStateString(int strength = 0); private slots: void wiredsEnable(bool enable); From e040b7bfa35f2ccf42d1be4d38b45ce911663534 Mon Sep 17 00:00:00 2001 From: chenwei Date: Tue, 18 Aug 2020 11:18:00 +0800 Subject: [PATCH 7/7] =?UTF-8?q?fix:=20=E4=BB=BB=E5=8A=A1=E6=A0=8F=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E5=BC=B9=E5=87=BA=E8=8F=9C=E5=8D=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复任务栏插件区域应用插件需要点击两下才会弹出菜单 Log: 修复任务栏插件弹出菜单需要点击两下的问题 Change-Id: Ie3c2a4cab18ae11a3fa9b5848da953d0e5ec7782 Reviewed-on: http://gerrit.uniontech.com/c/dde-dock/+/2248 Reviewed-by: Reviewed-by: niecheng Reviewed-by: lizhongming Tested-by: --- frame/util/dockpopupwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frame/util/dockpopupwindow.cpp b/frame/util/dockpopupwindow.cpp index be2916f5a..3c5b04c81 100644 --- a/frame/util/dockpopupwindow.cpp +++ b/frame/util/dockpopupwindow.cpp @@ -42,7 +42,7 @@ DockPopupWindow::DockPopupWindow(QWidget *parent) compositeChanged(); - setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint); + setWindowFlags(Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint | Qt::WindowDoesNotAcceptFocus); setAttribute(Qt::WA_InputMethodEnabled, false); connect(m_acceptDelayTimer, &QTimer::timeout, this, &DockPopupWindow::accept);