fix: 按照控制中心的无线网络信号强度处理计算方式,调整任务栏中无线信号强度的处理计算方式

任务栏中无线网络信号强度处理方式未与控制中心中的保持一致,造成显示的信号强度有偏差,重新调整任务栏的处理计算方式

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: <mailman@uniontech.com>
Reviewed-by: fanpengcheng <fanpengcheng@uniontech.com>
Reviewed-by: lizhongming <lizhongming@uniontech.com>
Tested-by: <mailman@uniontech.com>
This commit is contained in:
chenjun 2020-08-06 19:38:35 +08:00 committed by lizhongming
parent 5221be1141
commit 9486e1380d
2 changed files with 12 additions and 8 deletions

View File

@ -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);

View File

@ -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()) {