Fix bug-58306 can show wifi 6 and 6+ icons in Huawei Kilin 990 computer
This commit is contained in:
parent
9e29c4f3f0
commit
4620339ff0
|
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
|||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
|
||||
QApplication a(argc, argv);
|
||||
qInstallMessageHandler(messageOutput);
|
||||
//qInstallMessageHandler(messageOutput);
|
||||
|
||||
qDebug()<<"Kylin Network Manager Is Already Launched";
|
||||
|
||||
|
|
|
@ -1447,7 +1447,7 @@ void MainWindow::on_btnWifiList_clicked()
|
|||
|
||||
// 当前连接的wifi
|
||||
OneConnForm *ccf = new OneConnForm(topWifiListWidget, this, confForm, ksnm);
|
||||
ccf->setWifiName(tr("Not connected"), "--", "--", "--", isHuaWeiPC);//"当前未连接任何 Wifi"
|
||||
ccf->setWifiName(tr("Not connected"), "--", "--", "--", isHuaWeiPC, isHuaWei9006C);//"当前未连接任何 Wifi"
|
||||
ccf->setSignal("0", "--", "0");
|
||||
ccf->setRate("0");
|
||||
ccf->setConnedString(1, tr("Disconnected"), "");//"未连接"
|
||||
|
@ -2033,6 +2033,9 @@ QStringList MainWindow::priorityList(QStringList slist){
|
|||
QString line = slist.at(i);
|
||||
int conSignal = line.mid(indexSignal,3).trimmed().toInt();
|
||||
int conCate = line.mid(indexCate, 1).trimmed().toInt();
|
||||
if (!isHuaWei9006C) {
|
||||
conCate = 0;
|
||||
}
|
||||
if(conSignal > 55 && conCate == 2){
|
||||
p1.append(line);
|
||||
continue;
|
||||
|
@ -2159,6 +2162,9 @@ void MainWindow::wifiListOptimize(QStringList& slist)
|
|||
// int conSignal = currentWifiInfo.mid(indexSignal,3).trimmed().toInt();
|
||||
int conFreq = currentWifiInfo.mid(indexFreq,4).trimmed().toInt();
|
||||
int conCate = currentWifiInfo.mid(indexCate,1).trimmed().toInt();
|
||||
if (!isHuaWei9006C) {
|
||||
conCate = 0;
|
||||
}
|
||||
|
||||
if ("*" == currentWifiInfo.mid(0,indexSignal).trimmed()) {
|
||||
// hasStarWifiInfo = currentWifiInfo;
|
||||
|
@ -2172,6 +2178,9 @@ void MainWindow::wifiListOptimize(QStringList& slist)
|
|||
// int signal = compareWifiInfo.mid(indexSignal,3).trimmed().toInt();
|
||||
int freq = compareWifiInfo.mid(indexFreq,4).trimmed().toInt();
|
||||
int category = compareWifiInfo.mid(indexCate,1).trimmed().toInt();
|
||||
if (!isHuaWei9006C) {
|
||||
category = 0;
|
||||
}
|
||||
if (conName == name) {
|
||||
if (conFreq < 5000 && freq < 5000 && conCate == category) {
|
||||
//若前面有同频同category的同名wifi,它的信号一定比此wifi强
|
||||
|
@ -2308,6 +2317,9 @@ QVector<structWifiProperty> MainWindow::connectableWifiPriorityList(const QStrin
|
|||
QString wifiname = line.mid(indexName).trimmed();
|
||||
QString wifibssid = line.mid(indexBSsid, indexPath-indexBSsid).trimmed();
|
||||
QString wificate = line.mid(indexCate, 1).trimmed();
|
||||
if (!isHuaWei9006C) {
|
||||
wificate = "0";
|
||||
}
|
||||
QString wififreq = line.mid(indexFreq, 4).trimmed();
|
||||
QString wifiObjectPath;
|
||||
if (indexCate >= 0) {
|
||||
|
@ -2496,7 +2508,7 @@ void MainWindow::loadWifiListDone(QStringList slist)
|
|||
// 根据当前连接的wifi 设置OneConnForm
|
||||
OneConnForm *ccf = new OneConnForm(topWifiListWidget, this, confForm, ksnm);
|
||||
if (actWifiName == "--" || wifiActState == 1 || actWifiBssidList.at(0) == "--" || actWifiBssid == " ") {
|
||||
ccf->setWifiName(tr("Not connected"), "--", "--", "--", isHuaWeiPC);//"当前未连接任何 Wifi"
|
||||
ccf->setWifiName(tr("Not connected"), "--", "--", "--", isHuaWeiPC, isHuaWei9006C);//"当前未连接任何 Wifi"
|
||||
ccf->setSignal("0", "--" , "0");
|
||||
activeWifiSignalLv = 0;
|
||||
ccf->setConnedString(1, tr("Disconnected"), "");//"未连接"
|
||||
|
@ -2630,7 +2642,7 @@ void MainWindow::loadWifiListDone(QStringList slist)
|
|||
QString m_name;
|
||||
if (path != "" && !path.isEmpty()) m_name= this->objKyDBus->getWifiSsid(path);
|
||||
if (m_name.isEmpty() || m_name == "") {
|
||||
ccf->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC);
|
||||
ccf->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C);
|
||||
if (!canReconnectWifiList.contains(wname)) {
|
||||
canReconnectWifiList.append(wname);
|
||||
} else {
|
||||
|
@ -2638,7 +2650,7 @@ void MainWindow::loadWifiListDone(QStringList slist)
|
|||
canReconnectWifiList.append(wname);
|
||||
}
|
||||
} else {
|
||||
ccf->setWifiName(m_name, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC);
|
||||
ccf->setWifiName(m_name, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C);
|
||||
if (!canReconnectWifiList.contains(m_name)) {
|
||||
canReconnectWifiList.append(m_name);
|
||||
} else {
|
||||
|
@ -2697,9 +2709,9 @@ void MainWindow::loadWifiListDone(QStringList slist)
|
|||
QString m_name;
|
||||
if (path != "" && !path.isEmpty()) m_name= this->objKyDBus->getWifiSsid(path);
|
||||
if (m_name.isEmpty() || m_name == "") {
|
||||
ocf->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC);
|
||||
ocf->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C);
|
||||
} else {
|
||||
ocf->setWifiName(m_name, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC);
|
||||
ocf->setWifiName(m_name, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C);
|
||||
}
|
||||
if (m_wifi_list_pwd_changed.contains(ocf->getName())) {
|
||||
ocf->setlbPwdTipVisble(true);
|
||||
|
@ -2930,9 +2942,9 @@ void MainWindow::updateWifiListDone(QStringList slist)
|
|||
QString m_name;
|
||||
if (wpath != "" && !wpath.isEmpty()) m_name= this->objKyDBus->getWifiSsid(wpath);
|
||||
if (m_name.isEmpty() || m_name == "") {
|
||||
addItem->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC);
|
||||
addItem->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C);
|
||||
} else {
|
||||
addItem->setWifiName(m_name, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC);
|
||||
addItem->setWifiName(m_name, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C);
|
||||
}
|
||||
if (m_wifi_list_pwd_changed.contains(addItem->getName())) {
|
||||
addItem->setlbPwdTipVisble(true);
|
||||
|
@ -3615,7 +3627,7 @@ void MainWindow::disWifiDoneChangeUI()
|
|||
OneConnForm *ocf = wifiList.at(i);
|
||||
if (ocf->isActive == true) {
|
||||
ocf->setSelected(false, false);
|
||||
ocf->setWifiName(tr("Not connected"), "--", "--", "--", isHuaWeiPC);//"当前未连接任何 Wifi"
|
||||
ocf->setWifiName(tr("Not connected"), "--", "--", "--", isHuaWeiPC, isHuaWei9006C);//"当前未连接任何 Wifi"
|
||||
ocf->setSignal("0", "--", "0");
|
||||
ocf->setConnedString(1, tr("Disconnected"), "");//"未连接"
|
||||
ocf->lbFreq->hide();
|
||||
|
@ -4279,6 +4291,7 @@ void MainWindow::PrimaryManager()
|
|||
QDBusConnection::sessionBus());
|
||||
|
||||
isHuaWeiPC = false;
|
||||
isHuaWei9006C = false;
|
||||
QDBusMessage message = QDBusMessage::createMethodCall(DBUS_NAME,
|
||||
DBUS_PATH,
|
||||
DBUS_INTERFACE,
|
||||
|
@ -4286,11 +4299,24 @@ void MainWindow::PrimaryManager()
|
|||
QDBusMessage response = QDBusConnection::sessionBus().call(message);
|
||||
if (response.type() == QDBusMessage::ReplyMessage) {
|
||||
isHuaWeiPC = true;
|
||||
|
||||
//继续判断是990或者9006c
|
||||
QProcess * processCpuinfo = new QProcess(this);
|
||||
processCpuinfo->start(QString("cat /proc/cpuinfo"));
|
||||
connect(processCpuinfo, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
||||
processCpuinfo->deleteLater();
|
||||
});
|
||||
connect(processCpuinfo, &QProcess::readyReadStandardOutput, this, [ = ]() {
|
||||
QString ctrCpuinfo = processCpuinfo->readAllStandardOutput();
|
||||
if (ctrCpuinfo.indexOf("HUAWEI Kirin 9006C") != -1) {
|
||||
isHuaWei9006C = true;
|
||||
}
|
||||
});
|
||||
processCpuinfo->waitForFinished();
|
||||
}
|
||||
|
||||
connect(mDbusXrandInter, SIGNAL(screenPrimaryChanged(int,int,int,int)),
|
||||
this, SLOT(priScreenChanged(int,int,int,int)));
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::toStart()
|
||||
|
|
|
@ -184,6 +184,7 @@ public:
|
|||
bool isReconnectingLan = false; //是否正在执行lan的回连
|
||||
int addNumberForWifi = 0; //短时间内收到关于wifi连接信号的次数
|
||||
bool isHuaWeiPC;
|
||||
bool isHuaWei9006C;
|
||||
bool isHandlingWiredCableOn = false;
|
||||
bool ifCanReconnectWifiNow = true;
|
||||
bool isReConnAfterTurnOnWifi = false;//是否是在打开wifi的开关后回连wifi
|
||||
|
|
|
@ -491,7 +491,7 @@ void OneConnForm::setConnedString(bool showLable, QString str, QString str1)
|
|||
}
|
||||
}
|
||||
|
||||
void OneConnForm::setWifiName(QString name, QString bssid, QString uuid, QString ifname, bool isHW)
|
||||
void OneConnForm::setWifiName(QString name, QString bssid, QString uuid, QString ifname, bool isHW, bool is9006C)
|
||||
{
|
||||
QFontMetrics fontMetrics(lbNameText->font());
|
||||
QString showname = fontMetrics.elidedText(name, Qt::ElideRight, 200);
|
||||
|
@ -501,6 +501,7 @@ void OneConnForm::setWifiName(QString name, QString bssid, QString uuid, QString
|
|||
wifiUuid = uuid;
|
||||
wifiIfName = ifname;
|
||||
isHuaweiPC = isHW;
|
||||
isHuaWei9006C = is9006C;
|
||||
}
|
||||
|
||||
QString OneConnForm::getName()
|
||||
|
@ -541,10 +542,12 @@ void OneConnForm::setSignal(QString lv, QString secu, QString category)
|
|||
signalStyle = "QLabel{border-radius:0px;background:url(:/res/w/wifi";
|
||||
}
|
||||
|
||||
if ("1" == category) {
|
||||
signalStyle += "6";
|
||||
} else if ("2" == category) {
|
||||
signalStyle += "6+";
|
||||
if (isHuaWei9006C) {
|
||||
if ("1" == category) {
|
||||
signalStyle += "6";
|
||||
} else if ("2" == category) {
|
||||
signalStyle += "6+";
|
||||
}
|
||||
}
|
||||
|
||||
if (signal > 75) {
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
// category:1->normal protocol 1->wifi 6 2->wifi 6+
|
||||
void setSignal(QString lv, QString secu,QString category = "0");
|
||||
int getSignal();
|
||||
void setWifiName(QString name, QString bssid, QString uuid, QString isname, bool isHW);
|
||||
void setWifiName(QString name, QString bssid, QString uuid, QString isname, bool isHW, bool is9006C);
|
||||
QString getName();
|
||||
void setRate(QString rate);
|
||||
void setLine(bool isShow);
|
||||
|
@ -95,6 +95,7 @@ public:
|
|||
QLabel * lbFreq = nullptr;
|
||||
QLabel * lbPwdTip = nullptr;
|
||||
bool isHuaweiPC;
|
||||
bool isHuaWei9006C;
|
||||
bool isSelected;
|
||||
bool isActive;
|
||||
bool isConnected;
|
||||
|
|
Loading…
Reference in New Issue