fix(network):After receiving the Connection::Update signal from an active connection, the connection is no longer automatically reactivated; When switching resolutions, refresh rate preferentially selects the recommended refresh rate

- 收到已激活的连接的更新信号Connection::Update后,不再自动重新激活连接
  切换分辨率时,刷新率优先选择推荐的刷新率

Related #13231,#13283
This commit is contained in:
luoqing 2023-08-22 17:30:01 +08:00
parent 8b1f78ea7b
commit cdec05d97f
3 changed files with 191 additions and 1 deletions

View File

@ -0,0 +1,121 @@
From c3f02b61332c2cbac185e0306ff2583f639e5ca8 Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Tue, 22 Aug 2023 15:57:19 +0800
Subject: [PATCH] fix(network):After receiving the Connection::Update signal
from an active connection, the connection is no longer automatically
reactivated
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 收到已激活的连接的更新信号Connection::Update后不再自动重新激活连接
Related #13231
---
.../src/plugin/manager/wired-manager.cpp | 69 +++++++++----------
1 file changed, 32 insertions(+), 37 deletions(-)
diff --git a/plugins/network/src/plugin/manager/wired-manager.cpp b/plugins/network/src/plugin/manager/wired-manager.cpp
index ffe33b3..32ac227 100644
--- a/plugins/network/src/plugin/manager/wired-manager.cpp
+++ b/plugins/network/src/plugin/manager/wired-manager.cpp
@@ -91,27 +91,34 @@ void WiredManager::handleActivateSelectedConnection(const QString &connectionPat
auto devicestate = device->state();
KLOG_DEBUG() << "device state:" << devicestate ;
- if(devicestate != Device::Unavailable)
+ if(devicestate == Device::Unavailable)
{
- QDBusPendingReply<QDBusObjectPath> reply =
- NetworkManager::activateConnection(connectionPath, m_devicePath, connectionParameter);
+ StatusNotification::connectitonFailedNotifyByReason(tr("The current device is not available"));
+ return;
+ }
- reply.waitForFinished();
- if (reply.isError())
+ QDBusPendingReply<QDBusObjectPath> reply =
+ NetworkManager::activateConnection(connectionPath, m_devicePath, connectionParameter);
+
+ reply.waitForFinished();
+ if (reply.isError())
+ {
+ // 此处处理进入激活流程失败的原因,并不涉及流程中某个具体阶段失败的原因
+ KLOG_ERROR() << "activate connection failed:" << reply.error();
+ QString errorMessage = reply.error().message();
+ if (errorMessage.contains("device has no carrier"))
{
- // 此处处理进入激活流程失败的原因,并不涉及流程中某个具体阶段失败的原因
- KLOG_ERROR() << "activate connection failed:" << reply.error();
- QString errorMessage = reply.error().message();
- if (errorMessage.contains("device has no carrier"))
- StatusNotification::connectitonFailedNotifyByReason(tr("The carrier is pulled out"));
- else
- StatusNotification::connectitonFailedNotify(connectionPath);
+ StatusNotification::connectitonFailedNotifyByReason(tr("The carrier is pulled out"));
}
else
- KLOG_DEBUG() << "activateConnection reply:" << reply.reply();
+ {
+ StatusNotification::connectitonFailedNotify(connectionPath);
+ }
}
else
- StatusNotification::connectitonFailedNotifyByReason(tr("The current device is not available"));
+ {
+ KLOG_DEBUG() << "activateConnection reply:" << reply.reply();
+ }
}
// 获取到当前激活对象后,开启等待动画,判断完激活状态后停止等待动画
@@ -141,7 +148,7 @@ void WiredManager::handleActiveConnectionAdded(const QString &path)
break;
}
}
- connect(activatedConnection.data(), &ActiveConnection::stateChanged, this, &WiredManager::handleActiveConnectionStateChanged);
+ connect(activatedConnection.data(), &ActiveConnection::stateChanged, this, &WiredManager::handleActiveConnectionStateChanged, Qt::UniqueConnection);
}
}
@@ -214,28 +221,16 @@ void WiredManager::handleConnectionUpdated(const QString &path)
{
KLOG_DEBUG() << "Connection updated:" << path;
Connection::Ptr updateConnection = findConnection(path);
- if (updateConnection->settings()->connectionType() == ConnectionSettings::Wired)
+ if (updateConnection->settings()->connectionType() != ConnectionSettings::Wired)
{
- //移除后再加载进来以更新信息
- ui->connectionShowPage->removeConnectionFromList(path);
- ui->connectionShowPage->addConnection(updateConnection, "");
- if (ui->stackedWidget->currentIndex() != PAGE_SETTING)
- handleReturnPreviousPage();
-
- QString updateConnectionPath = updateConnection->path();
- ActiveConnection::List activeConnectionLists = activeConnections();
- //已连接的网络的配置被修改后,点击保存 ,应该重新连接网络,以使配置生效
- for (auto activeConn : activeConnectionLists)
- {
- if (activeConn->connection()->path() == updateConnectionPath)
- {
- auto deviceLists = activeConn->devices();
- if (deviceLists.contains(m_devicePath))
- {
- QDBusPendingReply<> reply = NetworkManager::deactivateConnection(activeConn->connection()->path());
- handleActivateSelectedConnection(updateConnectionPath, "");
- }
- }
- }
+ return;
+ }
+
+ //移除后再加载进来以更新信息
+ ui->connectionShowPage->removeConnectionFromList(path);
+ ui->connectionShowPage->addConnection(updateConnection, "");
+ if (ui->stackedWidget->currentIndex() != PAGE_SETTING)
+ {
+ handleReturnPreviousPage();
}
}
--
2.33.0

View File

@ -0,0 +1,63 @@
From 8468d6df5794ede71a39905e2d31f4cadda244b7 Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Wed, 23 Aug 2023 11:11:09 +0800
Subject: [PATCH] feature(display):When switching resolutions, refresh rate
preferentially selects the recommended refresh rate
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 切换分辨率时,刷新率优先选择推荐的刷新率
Related #13283
---
plugins/display/src/display-page.cpp | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/plugins/display/src/display-page.cpp b/plugins/display/src/display-page.cpp
index a885b8b..23b5e8e 100644
--- a/plugins/display/src/display-page.cpp
+++ b/plugins/display/src/display-page.cpp
@@ -263,22 +263,35 @@ void DisplayPage::initExtraComboBoxRefreshRate(QComboBox *comboBox, const QList<
{
comboBox->clear();
- QString recommend;
QList<DisplayModesStu> list = m_displayConfig->listPreferredModes(m_curMonitorPath);
+ double recommendRefreshRate;
if (!list.isEmpty())
{
- double refreshRate = list.first().refreshRate;
- recommend = QString("%1HZ").arg(QString::asprintf("%.2f", refreshRate));
+ recommendRefreshRate = list.first().refreshRate;
}
+ QString strPostfix = tr(" (recommended)");
QList<double> t_refreshRateList = refreshRateList;
std::sort(t_refreshRateList.begin(), t_refreshRateList.end(), std::greater<double>());
foreach (double r, t_refreshRateList)
{
QString text = QString("%1HZ").arg(QString::asprintf("%.2f", r));
- if (text == recommend) text += tr(" (recommended)");
+ if (QString::asprintf("%.2f", r) == QString::asprintf("%.2f", recommendRefreshRate))
+ {
+ text.append(strPostfix);
+ }
comboBox->addItem(text, r);
}
+
+ for (size_t i = 0; i < comboBox->count(); i++)
+ {
+ double refreshRate = comboBox->itemData(i).toDouble();
+ if(QString::asprintf("%.2f", refreshRate) == QString::asprintf("%.2f", recommendRefreshRate))
+ {
+ comboBox->setCurrentIndex(i);
+ break;
+ }
+ }
}
void DisplayPage::selectResolutionComboboxItem(QComboBox *comboBox, const int &w, const int &h)
--
2.33.0

View File

@ -1,12 +1,14 @@
Name: kiran-control-panel
Version: 2.5.5
Release: 1
Release: 2
Summary: Kiran Control Panel
Summary(zh_CN): Kiran桌面控制面板
License: MulanPSL-2.0
Source0: %{name}-%{version}.tar.gz
Patch0001: 0001-fix-network-After-receiving-the-Connection-Update-si.patch
Patch0002: 0002-feature-display-When-switching-resolutions-refresh-r.patch
BuildRequires: gcc-c++
BuildRequires: cmake >= 3.2
@ -162,6 +164,10 @@ make %{?_smp_mflags}
rm -rf %{buildroot}
%changelog
* Wed Aug 23 2023 luoqing <luoqing@kylinsec.com.cn> - 2.5.5-2
- KYOS-F: After receiving the Connection::Update signal from an active connection, the connection is no longer automatically reactivated (#13231)
- KYOS-F: When switching resolutions, refresh rate preferentially selects the recommended refresh rate (#13283)
* Tue Aug 15 2023 luoqing <luoqing@kylinsec.com.cn> - 2.5.5-1
- KYOS-F: Added pop-up prompt when inserting or removing a network cable (#11814)
- KYOS-F: Change the name "Wired Network 1" in the left column to the name of the network card, corresponding to the network tray(10429)