From e31eb53f2ba71b9d5e8247e1c7a7bb2389723262 Mon Sep 17 00:00:00 2001 From: chenjun Date: Tue, 23 Mar 2021 13:14:48 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E6=A0=B9=E6=8D=AEcom.deepin.daemon.?= =?UTF-8?q?Timedate=E6=8E=A5=E5=8F=A3=E7=9A=84TimeUpdate=E4=BF=A1=E5=8F=B7?= =?UTF-8?q?=E5=88=B7=E6=96=B0=E6=97=B6=E9=97=B4=E6=97=A5=E6=9C=9F=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E7=9A=84=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在控制中心手动设置当前时间后,任务栏插件大小未更新,造成内容显示不全,连接com.deepin.daemon.Timedate接口的 TimeUpdate信号刷新时间日期插件的布局 Log: 修复12小时制任务栏时间显示不全问题 Bug: https://pms.uniontech.com/zentao/bug-view-67911.html Change-Id: I12e3d4b2e21decbec819f1739eb5b5cffb1e2c6c --- plugins/datetime/datetimewidget.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/datetime/datetimewidget.cpp b/plugins/datetime/datetimewidget.cpp index 50fbc0ef0..4eddd8cc6 100644 --- a/plugins/datetime/datetimewidget.cpp +++ b/plugins/datetime/datetimewidget.cpp @@ -50,6 +50,12 @@ DatetimeWidget::DatetimeWidget(QWidget *parent) connect(m_timedateInter, &Timedate::ShortDateFormatChanged, this, &DatetimeWidget::setShortDateFormat); connect(m_timedateInter, &Timedate::ShortTimeFormatChanged, this, &DatetimeWidget::setShortTimeFormat); + //连接日期时间修改信号,更新日期时间插件的布局 + connect(m_timedateInter, &Timedate::TimeUpdate, this, [ = ]{ + if (isVisible()) { + emit requestUpdateGeometry(); + } + }); } void DatetimeWidget::set24HourFormat(const bool value) From 700067ec93f9b3d9980fa33ec39575757ba2b6ee Mon Sep 17 00:00:00 2001 From: Fan PengCheng Date: Thu, 1 Apr 2021 13:58:04 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=89=BE=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E5=B1=8F=E5=B9=95=E4=BF=A1=E6=81=AF=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E4=BB=BB=E5=8A=A1=E6=A0=8F=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Display服务给出的屏幕名有时候是异常的,比如VGA的屏幕刚接上的时候有时候后端给出的服务名时":0.0",导致获取不到正确的屏幕信息,从而导致任务栏显示位置异常 Log: 修复任务栏偶尔不显示的情况 Bug: https://pms.uniontech.com/zentao/bug-view-69484.html Change-Id: Id6d6505255ddd2fd24bb873dbc9307fa0bb2c5c1 --- frame/util/monitor.cpp | 2 + frame/util/monitor.h | 1 + frame/util/multiscreenworker.cpp | 72 ++++++++++++++++++++++++++++---- frame/util/multiscreenworker.h | 2 + 4 files changed, 68 insertions(+), 9 deletions(-) diff --git a/frame/util/monitor.cpp b/frame/util/monitor.cpp index e7f41ba1b..2d9f988f4 100644 --- a/frame/util/monitor.cpp +++ b/frame/util/monitor.cpp @@ -80,6 +80,8 @@ void Monitor::setName(const QString &name) { qDebug() << "screen name change from :" << m_name << " to: " << name; m_name = name; + + Q_EMIT nameChanged(m_name); } void Monitor::setPath(const QString &path) diff --git a/frame/util/monitor.h b/frame/util/monitor.h index 7309efa32..c4d085c08 100644 --- a/frame/util/monitor.h +++ b/frame/util/monitor.h @@ -104,6 +104,7 @@ public: Q_SIGNALS: void geometryChanged() const; void enableChanged(bool enable) const; + void nameChanged(const QString &name) const; public Q_SLOTS: void setX(const int x); diff --git a/frame/util/multiscreenworker.cpp b/frame/util/multiscreenworker.cpp index 750557614..9368b606c 100644 --- a/frame/util/multiscreenworker.cpp +++ b/frame/util/multiscreenworker.cpp @@ -277,11 +277,23 @@ void MultiScreenWorker::monitorAdded(const QString &path) // 这里有可能在使用Monitor中的数据时,但实际上Monitor数据还未准备好.以Monitor中的信号为准,不能以MonitorInter中信号为准, connect(mon, &Monitor::geometryChanged, this, &MultiScreenWorker::requestUpdateMonitorInfo); connect(mon, &Monitor::enableChanged, this, &MultiScreenWorker::requestUpdateMonitorInfo); + connect(mon, &Monitor::nameChanged, this, &MultiScreenWorker::requestUpdateMonitorInfo); // NOTE: DO NOT using async dbus call. because we need to have a unique name to distinguish each monitor Q_ASSERT(inter->isValid()); mon->setName(inter->name()); +#if 0 // 模拟屏幕名称中途发生变化的情况,测试任务栏是否还能正常显示 + QTimer::singleShot(5000, this, [ = ]{ + if (mon->name() == "VGA-0") + mon->setName(":0.0"); + }); + QTimer::singleShot(10000, this, [ = ]{ + if (mon->name() == ":0.0") + mon->setName("VGA-0"); + }); +#endif + mon->setMonitorEnable(inter->enabled()); mon->setPath(path); mon->setX(inter->x()); @@ -356,6 +368,16 @@ void MultiScreenWorker::onWindowSizeChanged(uint value) void MultiScreenWorker::primaryScreenChanged() { + QString primaryName = m_displayInter->primary(); + if (primaryName.isEmpty() && qApp->primaryScreen()->name().isEmpty()) { + qWarning() << "current primary screen:" << primaryName; + return; + } + + // 后端数据不准确,使用qt获取的数据 + if (primaryName.isEmpty()) + primaryName = qApp->primaryScreen()->name(); + // 先更新主屏信息 m_ds.updatePrimary(m_displayInter->primary()); m_mtrInfo.setPrimary(m_displayInter->primary()); @@ -512,9 +534,8 @@ void MultiScreenWorker::onHideStateChanged() m_hideState = state; // 检查当前屏幕的当前位置是否允许显示,不允许需要更新显示信息(这里应该在函数外部就处理好,不应该走到这里) - Monitor *currentMonitor = monitorByName(m_mtrInfo.validMonitor(), m_ds.current()); + Monitor *currentMonitor = waitAndGetScreen(m_ds.current()); if (!currentMonitor) { - qWarning() << "cannot find monitor by name: " << m_ds.current(); return; } @@ -925,9 +946,9 @@ void MultiScreenWorker::onRequestDelayShowDock(const QString &screenName) m_ds.updateDockedScreen(screenName); - Monitor *currentMonitor = monitorByName(m_mtrInfo.validMonitor(), screenName); + // 检查当前屏幕的当前位置是否允许显示,不允许需要更新显示信息(这里应该在函数外部就处理好,不应该走到这里) + Monitor *currentMonitor = waitAndGetScreen(screenName); if (!currentMonitor) { - qWarning() << "cannot find monitor by name: " << screenName; return; } @@ -985,6 +1006,8 @@ void MultiScreenWorker::initConnection() * 或去修改 qt-dbus-factory,取消 DBusExtendedAbstractInterface::internalPropGet 中将数据写入属性值, * 但是 qt-dbus-factory 修改涉及面较广,需要大量测试确认没有问题,再合入。 */ + connect(qApp, &QApplication::primaryScreenChanged, this, &MultiScreenWorker::primaryScreenChanged, Qt::QueuedConnection); + #if 0 // connect(m_dockInter, &DBusDock::PositionChanged, this, &MultiScreenWorker::onPositionChanged); // connect(m_dockInter, &DBusDock::DisplayModeChanged, this, &MultiScreenWorker::onDisplayModeChanged); @@ -1363,15 +1386,19 @@ QString MultiScreenWorker::getValidScreen(const Position &pos) } } - if (primaryName.isEmpty()) { + if (primaryName.isEmpty() && qApp->primaryScreen()->name().isEmpty()) { qWarning() << "cannnot find primary screen, wait for 3s to update..."; QTimer::singleShot(3000, this, &MultiScreenWorker::requestUpdateMonitorInfo); return QString(); } - Monitor *primaryMonitor = monitorByName(m_mtrInfo.validMonitor(), primaryName); + if (primaryName.isEmpty()) { + primaryName = qApp->primaryScreen()->name(); + m_ds.updatePrimary(primaryName); + } + + Monitor *primaryMonitor = waitAndGetScreen(primaryName); if (!primaryMonitor) { - qWarning() << "cannot find monitor by name: " << primaryName; return QString(); } @@ -1393,9 +1420,8 @@ void MultiScreenWorker::resetDockScreen() { QList monitorList = m_mtrInfo.validMonitor(); if (monitorList.size() == 2) { - Monitor *primaryMonitor = monitorByName(m_mtrInfo.validMonitor(), m_ds.primary()); + Monitor *primaryMonitor = waitAndGetScreen(m_ds.primary()); if (!primaryMonitor) { - qWarning() << "cannot find monitor by name: " << m_ds.primary(); return; } if (!primaryMonitor->dockPosition().docked(position())) { @@ -1878,3 +1904,31 @@ void MultiScreenWorker::onConfigChange(const QString &changeKey) emit requestUpdateMonitorInfo(); } } + +/** + * @brief MultiScreenWorker::wait_and_get_screen 阻塞性质的函数,用于查找屏幕信息,找不到会做等待 + * @param screenName 找对screenName对应的指针,如果一直找不到,那么就是m_mtrInfo数据异常了,基本需要从Display服务中查询数据了 + * @return + */ +Monitor *MultiScreenWorker::waitAndGetScreen(const QString& screenName) +{ + Monitor *currentMonitor = nullptr; + int tryNum =0; + do { + currentMonitor = monitorByName(m_mtrInfo.validMonitor(), screenName); + if (currentMonitor) + break; + + tryNum ++; + qWarning() << "cannot find monitor by name: " << m_ds.current() << ", try " << tryNum << "times"; + + // 阻塞200ms,尝试等待数据正常 + QThread::msleep(200); + } while (!currentMonitor && tryNum <= 30); // 最多等待6秒,还是获取不到就绝对是数据异常了 + + if (!currentMonitor) { + qWarning() << "cannot find monitor by name: " << m_ds.current(); + } + + return currentMonitor; +} diff --git a/frame/util/multiscreenworker.h b/frame/util/multiscreenworker.h index 543cb5232..019d42376 100644 --- a/frame/util/multiscreenworker.h +++ b/frame/util/multiscreenworker.h @@ -356,6 +356,8 @@ private slots: // gsetting配置改变响应槽 void onConfigChange(const QString &changeKey); + Monitor *waitAndGetScreen(const QString& screenName); + private: // 初始化数据信息 void initMembers(); From 3672ac375cad72d8551dce11ed2d7f2485da9f3f Mon Sep 17 00:00:00 2001 From: wubowen Date: Fri, 9 Apr 2021 19:46:32 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=A0=8Fwifi=E5=AE=9A=E6=97=B6=E6=89=AB=E6=8F=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加前端定时扫描wifi列表 Log: 添加任务栏wifi定时扫描 Bug: https://pms.uniontech.com/zentao/bug-view-70639.html Change-Id: I2a8e959f34842134fc43133082cb2c200625d222 --- plugins/network/networkitem.cpp | 17 +++++++++++++++++ plugins/network/networkitem.h | 1 + 2 files changed, 18 insertions(+) diff --git a/plugins/network/networkitem.cpp b/plugins/network/networkitem.cpp index eca406714..5b4a2206f 100644 --- a/plugins/network/networkitem.cpp +++ b/plugins/network/networkitem.cpp @@ -10,6 +10,7 @@ #include #include +#include extern const int ItemWidth; extern const int ItemMargin; @@ -46,6 +47,7 @@ NetworkItem::NetworkItem(QWidget *parent) , m_timeOut(true) , m_timer(new QTimer(this)) , m_switchWireTimer(new QTimer(this)) + , m_wirelessScanTimer(new QTimer(this)) { m_timer->setInterval(100); @@ -142,6 +144,21 @@ NetworkItem::NetworkItem(QWidget *parent) connect(m_switchWiredBtn, &DSwitchButton::toggled, this, &NetworkItem::wiredsEnable); connect(m_switchWirelessBtn, &DSwitchButton::toggled, this, &NetworkItem::wirelessEnable); connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &NetworkItem::onThemeTypeChanged); + + QGSettings *gsetting = new QGSettings("com.deepin.dde.dock", QByteArray(), this); + connect(gsetting, &QGSettings::changed, [&](const QString &key) { + if (key == "wireless-scan-interval") { + m_wirelessScanTimer->setInterval(gsetting->get("wireless-scan-interval").toInt()); + } + }); + connect(m_wirelessScanTimer, &QTimer::timeout, [&] { + for (auto wirelessItem : m_wirelessItems) { + if (wirelessItem) { + wirelessItem->requestWirelessScan(); + } + } + }); + m_wirelessScanTimer->start(gsetting->get("wireless-scan-interval").toInt() * 1000); } QWidget *NetworkItem::itemApplet() diff --git a/plugins/network/networkitem.h b/plugins/network/networkitem.h index 1e7f70b38..97fb93a63 100644 --- a/plugins/network/networkitem.h +++ b/plugins/network/networkitem.h @@ -116,6 +116,7 @@ private: PluginState m_pluginState; QTimer *m_timer; QTimer *m_switchWireTimer; + QTimer *m_wirelessScanTimer; }; #endif // NETWORKITEM_H From 6e4b074565d37f8c3baed48505ded6b240ea927d Mon Sep 17 00:00:00 2001 From: wubowen Date: Fri, 9 Apr 2021 22:10:38 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=A0=8Fwifi=E5=AE=9A=E6=97=B6=E6=89=AB=E6=8F=8F,=E6=98=BE?= =?UTF-8?q?=E7=A4=BAwifi=E9=A1=B5=E9=9D=A2=E6=97=B6=E6=89=AB=E6=8F=8F,?= =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=B0=B1=E5=81=9C=E6=AD=A2=E6=89=AB=E6=8F=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加前端定时扫描wifi列表 Log: 添加任务栏wifi定时扫描,显示wifi页面时扫描,隐藏就停止扫描 Bug: https://pms.uniontech.com/zentao/bug-view-70639.html Change-Id: I5dfdb2c5aa3a63d1fd5a2cf795c3a466c73437ca --- plugins/network/networkitem.cpp | 14 ++++++++++++-- plugins/network/networkitem.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/network/networkitem.cpp b/plugins/network/networkitem.cpp index 5b4a2206f..0aa8d25f3 100644 --- a/plugins/network/networkitem.cpp +++ b/plugins/network/networkitem.cpp @@ -48,6 +48,7 @@ NetworkItem::NetworkItem(QWidget *parent) , m_timer(new QTimer(this)) , m_switchWireTimer(new QTimer(this)) , m_wirelessScanTimer(new QTimer(this)) + , m_wirelessScanInterval(10) { m_timer->setInterval(100); @@ -148,7 +149,8 @@ NetworkItem::NetworkItem(QWidget *parent) QGSettings *gsetting = new QGSettings("com.deepin.dde.dock", QByteArray(), this); connect(gsetting, &QGSettings::changed, [&](const QString &key) { if (key == "wireless-scan-interval") { - m_wirelessScanTimer->setInterval(gsetting->get("wireless-scan-interval").toInt()); + m_wirelessScanInterval = gsetting->get("wireless-scan-interval").toInt(); + m_wirelessScanTimer->setInterval(m_wirelessScanInterval * 1000); } }); connect(m_wirelessScanTimer, &QTimer::timeout, [&] { @@ -158,7 +160,7 @@ NetworkItem::NetworkItem(QWidget *parent) } } }); - m_wirelessScanTimer->start(gsetting->get("wireless-scan-interval").toInt() * 1000); + m_wirelessScanInterval = gsetting->get("wireless-scan-interval").toInt(); } QWidget *NetworkItem::itemApplet() @@ -1104,6 +1106,14 @@ void NetworkItem::updateView() m_applet->setFixedHeight(constDisplayItemCnt * ItemHeight); m_applet->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); } + + if (m_wirelessControlPanel->isVisible()) { + if (!m_wirelessScanTimer->isActive()) + m_wirelessScanTimer->start(m_wirelessScanInterval * 1000); + } else { + if (m_wirelessScanTimer->isActive()) + m_wirelessScanTimer->stop(); + } } void NetworkItem::updateSelf() diff --git a/plugins/network/networkitem.h b/plugins/network/networkitem.h index 97fb93a63..0cc910770 100644 --- a/plugins/network/networkitem.h +++ b/plugins/network/networkitem.h @@ -117,6 +117,7 @@ private: QTimer *m_timer; QTimer *m_switchWireTimer; QTimer *m_wirelessScanTimer; + int m_wirelessScanInterval; }; #endif // NETWORKITEM_H