Fixed BUG#48193 wifi signal do not same.

This commit is contained in:
andrew-wuhan-huawei-990-pc 2021-04-13 16:41:12 +08:00
parent 52b48cf883
commit 1c4acf265c
2 changed files with 15 additions and 29 deletions

View File

@ -644,6 +644,18 @@ void MainWindow::setTrayIcon(QIcon icon)
trayIcon->setIcon(icon); trayIcon->setIcon(icon);
} }
void MainWindow::setTrayIconOfWifi(int signal){
if (signal > 75) {
setTrayIcon(iconWifiFull);
} else if(signal > 55 && signal <= 75) {
setTrayIcon(iconWifiHigh);
} else if(signal > 35 && signal <= 55) {
setTrayIcon(iconWifiMedium);
} else if( signal <= 35) {
setTrayIcon(iconWifiLow);
}
}
void MainWindow::setTrayLoading(bool isLoading) void MainWindow::setTrayLoading(bool isLoading)
{ {
if (isLoading) { if (isLoading) {
@ -911,18 +923,6 @@ void MainWindow::getActiveInfoAndSetTrayIcon()
} }
index ++; index ++;
} }
//ukui3.0中获取currentActWifiSignalLv的值
if (activeWifiSignalLv > 75) {
currentActWifiSignalLv = 1;
} else if(activeWifiSignalLv > 55 && activeWifiSignalLv <= 75) {
currentActWifiSignalLv = 2;
} else if(activeWifiSignalLv > 35 && activeWifiSignalLv <= 55) {
currentActWifiSignalLv = 3;
} else if( activeWifiSignalLv <= 35) {
currentActWifiSignalLv = 4;
}
// 设置图标 // 设置图标
if (actLanName != "--") { if (actLanName != "--") {
QList<QString> lanstate = objKyDBus->getAtiveLanSsidUuidState(); QList<QString> lanstate = objKyDBus->getAtiveLanSsidUuidState();
@ -935,23 +935,7 @@ void MainWindow::getActiveInfoAndSetTrayIcon()
} }
} else if (actWifiName != "--") { } else if (actWifiName != "--") {
switch (currentActWifiSignalLv) { setTrayIconOfWifi(activeWifiSignalLv);
case 1:
setTrayIcon(iconWifiFull);
break;
case 2:
setTrayIcon(iconWifiHigh);
break;
case 3:
setTrayIcon(iconWifiMedium);
break;
case 4:
setTrayIcon(iconWifiLow);
break;
default:
setTrayIcon(iconWifiFull);
break;
}
} else { } else {
setTrayIcon(iconLanOffline); setTrayIcon(iconLanOffline);
} }
@ -2229,6 +2213,7 @@ void MainWindow::loadWifiListDone(QStringList slist)
//ccf->setRate(wrate); //ccf->setRate(wrate);
int signal = wsignal.toInt() + 11; int signal = wsignal.toInt() + 11;
ccf->setSignal(QString::number(signal), wsecu); ccf->setSignal(QString::number(signal), wsecu);
setTrayIconOfWifi(wsignal.toInt());
activeWifiSignalLv = wsignal.toInt(); activeWifiSignalLv = wsignal.toInt();
//objKyDBus->getWifiMac(wname); //objKyDBus->getWifiMac(wname);
ccf->setWifiInfo(wsecu, wsignal, wbssid, freqState); ccf->setWifiInfo(wsecu, wsignal, wbssid, freqState);

View File

@ -141,6 +141,7 @@ public:
void stopLoading(); void stopLoading();
void setTrayIcon(QIcon icon); void setTrayIcon(QIcon icon);
void setTrayIconOfWifi(int);
void setTrayLoading(bool isLoading); void setTrayLoading(bool isLoading);
void getActiveInfoAndSetTrayIcon(); void getActiveInfoAndSetTrayIcon();