diff --git a/src/loadingdiv.cpp b/src/loadingdiv.cpp index 60a6694a..ddaeef31 100644 --- a/src/loadingdiv.cpp +++ b/src/loadingdiv.cpp @@ -20,7 +20,7 @@ #include #define FRAMESPEED 60 //帧与帧之间的间隔时间(ms) -#define ALLTIME 10*1000 //等待动画持续总时间 +#define ALLTIME 40*1000 //等待动画持续总时间 //加载动画控件'loadingGif' LoadingDiv::LoadingDiv(QWidget *parent) : QWidget(parent) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e4ede524..1c9866a5 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1579,7 +1579,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"), "");//"未连接" @@ -1987,7 +1987,7 @@ void MainWindow::getWifiListDone(QStringList slist) qDebug()<<"Reconnect finished, cmd = "< 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) { @@ -2635,7 +2647,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"), "");//"未连接" @@ -2769,7 +2781,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 { @@ -2777,7 +2789,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 { @@ -2836,9 +2848,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); @@ -3069,9 +3081,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); @@ -3755,7 +3767,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(); @@ -4419,6 +4431,7 @@ void MainWindow::PrimaryManager() QDBusConnection::sessionBus()); isHuaWeiPC = false; + isHuaWei9006C = false; QDBusMessage message = QDBusMessage::createMethodCall(DBUS_NAME, DBUS_PATH, DBUS_INTERFACE, @@ -4426,11 +4439,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(&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() diff --git a/src/mainwindow.h b/src/mainwindow.h index 93552a9e..fadd01b0 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -185,6 +185,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 diff --git a/src/oneconnform.cpp b/src/oneconnform.cpp index 502ecbac..61374204 100644 --- a/src/oneconnform.cpp +++ b/src/oneconnform.cpp @@ -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) { diff --git a/src/oneconnform.h b/src/oneconnform.h index 1e1418b7..c951bbad 100644 --- a/src/oneconnform.h +++ b/src/oneconnform.h @@ -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;