Merge branch '0607-dev' into 'main'

Fix bug-58306 can show wifi 6 and 6+ icons in Huawei Kilin 990 computer

See merge request kylin-desktop/kylin-nm!16
This commit is contained in:
Zhang Jiaping 2021-06-08 11:33:53 +00:00
commit e0e1f37b44
5 changed files with 49 additions and 18 deletions

View File

@ -20,7 +20,7 @@
#include <QIcon> #include <QIcon>
#define FRAMESPEED 60 //帧与帧之间的间隔时间(ms) #define FRAMESPEED 60 //帧与帧之间的间隔时间(ms)
#define ALLTIME 10*1000 //等待动画持续总时间 #define ALLTIME 40*1000 //等待动画持续总时间
//加载动画控件'loadingGif' //加载动画控件'loadingGif'
LoadingDiv::LoadingDiv(QWidget *parent) : QWidget(parent) LoadingDiv::LoadingDiv(QWidget *parent) : QWidget(parent)

View File

@ -1579,7 +1579,7 @@ void MainWindow::on_btnWifiList_clicked()
// 当前连接的wifi // 当前连接的wifi
OneConnForm *ccf = new OneConnForm(topWifiListWidget, this, confForm, ksnm); 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->setSignal("0", "--", "0");
ccf->setRate("0"); ccf->setRate("0");
ccf->setConnedString(1, tr("Disconnected"), "");//"未连接" ccf->setConnedString(1, tr("Disconnected"), "");//"未连接"
@ -1987,7 +1987,7 @@ void MainWindow::getWifiListDone(QStringList slist)
qDebug()<<"Reconnect finished, cmd = "<<reconnectWifiCmd<<". res = "<<con_res; qDebug()<<"Reconnect finished, cmd = "<<reconnectWifiCmd<<". res = "<<con_res;
if (con_res == 0) { if (con_res == 0) {
m_connected_by_self = true; m_connected_by_self = false;
//回连成功,停止 //回连成功,停止
this->stopLoading(); this->stopLoading();
is_stop_check_net_state = 0; is_stop_check_net_state = 0;
@ -2172,6 +2172,9 @@ QStringList MainWindow::priorityList(QStringList slist){
QString line = slist.at(i); QString line = slist.at(i);
int conSignal = line.mid(indexSignal,3).trimmed().toInt(); int conSignal = line.mid(indexSignal,3).trimmed().toInt();
int conCate = line.mid(indexCate, 1).trimmed().toInt(); int conCate = line.mid(indexCate, 1).trimmed().toInt();
if (!isHuaWei9006C) {
conCate = 0;
}
if(conSignal > 55 && conCate == 2){ if(conSignal > 55 && conCate == 2){
p1.append(line); p1.append(line);
continue; continue;
@ -2298,6 +2301,9 @@ void MainWindow::wifiListOptimize(QStringList& slist)
// int conSignal = currentWifiInfo.mid(indexSignal,3).trimmed().toInt(); // int conSignal = currentWifiInfo.mid(indexSignal,3).trimmed().toInt();
int conFreq = currentWifiInfo.mid(indexFreq,4).trimmed().toInt(); int conFreq = currentWifiInfo.mid(indexFreq,4).trimmed().toInt();
int conCate = currentWifiInfo.mid(indexCate,1).trimmed().toInt(); int conCate = currentWifiInfo.mid(indexCate,1).trimmed().toInt();
if (!isHuaWei9006C) {
conCate = 0;
}
if ("*" == currentWifiInfo.mid(0,indexSignal).trimmed()) { if ("*" == currentWifiInfo.mid(0,indexSignal).trimmed()) {
// hasStarWifiInfo = currentWifiInfo; // hasStarWifiInfo = currentWifiInfo;
@ -2311,6 +2317,9 @@ void MainWindow::wifiListOptimize(QStringList& slist)
// int signal = compareWifiInfo.mid(indexSignal,3).trimmed().toInt(); // int signal = compareWifiInfo.mid(indexSignal,3).trimmed().toInt();
int freq = compareWifiInfo.mid(indexFreq,4).trimmed().toInt(); int freq = compareWifiInfo.mid(indexFreq,4).trimmed().toInt();
int category = compareWifiInfo.mid(indexCate,1).trimmed().toInt(); int category = compareWifiInfo.mid(indexCate,1).trimmed().toInt();
if (!isHuaWei9006C) {
category = 0;
}
if (conName == name) { if (conName == name) {
if (conFreq < 5000 && freq < 5000 && conCate == category) { if (conFreq < 5000 && freq < 5000 && conCate == category) {
//若前面有同频同category的同名wifi它的信号一定比此wifi强 //若前面有同频同category的同名wifi它的信号一定比此wifi强
@ -2447,6 +2456,9 @@ QVector<structWifiProperty> MainWindow::connectableWifiPriorityList(const QStrin
QString wifiname = line.mid(indexName).trimmed(); QString wifiname = line.mid(indexName).trimmed();
QString wifibssid = line.mid(indexBSsid, indexPath-indexBSsid).trimmed(); QString wifibssid = line.mid(indexBSsid, indexPath-indexBSsid).trimmed();
QString wificate = line.mid(indexCate, 1).trimmed(); QString wificate = line.mid(indexCate, 1).trimmed();
if (!isHuaWei9006C) {
wificate = "0";
}
QString wififreq = line.mid(indexFreq, 4).trimmed(); QString wififreq = line.mid(indexFreq, 4).trimmed();
QString wifiObjectPath; QString wifiObjectPath;
if (indexCate >= 0) { if (indexCate >= 0) {
@ -2635,7 +2647,7 @@ void MainWindow::loadWifiListDone(QStringList slist)
// 根据当前连接的wifi 设置OneConnForm // 根据当前连接的wifi 设置OneConnForm
OneConnForm *ccf = new OneConnForm(topWifiListWidget, this, confForm, ksnm); OneConnForm *ccf = new OneConnForm(topWifiListWidget, this, confForm, ksnm);
if (actWifiName == "--" || wifiActState == 1 || actWifiBssidList.at(0) == "--" || actWifiBssid == " ") { 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"); ccf->setSignal("0", "--" , "0");
activeWifiSignalLv = 0; activeWifiSignalLv = 0;
ccf->setConnedString(1, tr("Disconnected"), "");//"未连接" ccf->setConnedString(1, tr("Disconnected"), "");//"未连接"
@ -2769,7 +2781,7 @@ void MainWindow::loadWifiListDone(QStringList slist)
QString m_name; QString m_name;
if (path != "" && !path.isEmpty()) m_name= this->objKyDBus->getWifiSsid(path); if (path != "" && !path.isEmpty()) m_name= this->objKyDBus->getWifiSsid(path);
if (m_name.isEmpty() || m_name == "") { 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)) { if (!canReconnectWifiList.contains(wname)) {
canReconnectWifiList.append(wname); canReconnectWifiList.append(wname);
} else { } else {
@ -2777,7 +2789,7 @@ void MainWindow::loadWifiListDone(QStringList slist)
canReconnectWifiList.append(wname); canReconnectWifiList.append(wname);
} }
} else { } 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)) { if (!canReconnectWifiList.contains(m_name)) {
canReconnectWifiList.append(m_name); canReconnectWifiList.append(m_name);
} else { } else {
@ -2836,9 +2848,9 @@ void MainWindow::loadWifiListDone(QStringList slist)
QString m_name; QString m_name;
if (path != "" && !path.isEmpty()) m_name= this->objKyDBus->getWifiSsid(path); if (path != "" && !path.isEmpty()) m_name= this->objKyDBus->getWifiSsid(path);
if (m_name.isEmpty() || m_name == "") { if (m_name.isEmpty() || m_name == "") {
ocf->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC); ocf->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C);
} else { } 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())) { if (m_wifi_list_pwd_changed.contains(ocf->getName())) {
ocf->setlbPwdTipVisble(true); ocf->setlbPwdTipVisble(true);
@ -3069,9 +3081,9 @@ void MainWindow::updateWifiListDone(QStringList slist)
QString m_name; QString m_name;
if (wpath != "" && !wpath.isEmpty()) m_name= this->objKyDBus->getWifiSsid(wpath); if (wpath != "" && !wpath.isEmpty()) m_name= this->objKyDBus->getWifiSsid(wpath);
if (m_name.isEmpty() || m_name == "") { if (m_name.isEmpty() || m_name == "") {
addItem->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC); addItem->setWifiName(wname, wbssid, actWifiUuid, objKyDBus->dbusWiFiCardName, isHuaWeiPC, isHuaWei9006C);
} else { } 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())) { if (m_wifi_list_pwd_changed.contains(addItem->getName())) {
addItem->setlbPwdTipVisble(true); addItem->setlbPwdTipVisble(true);
@ -3755,7 +3767,7 @@ void MainWindow::disWifiDoneChangeUI()
OneConnForm *ocf = wifiList.at(i); OneConnForm *ocf = wifiList.at(i);
if (ocf->isActive == true) { if (ocf->isActive == true) {
ocf->setSelected(false, false); ocf->setSelected(false, false);
ocf->setWifiName(tr("Not connected"), "--", "--", "--", isHuaWeiPC);//"当前未连接任何 Wifi" ocf->setWifiName(tr("Not connected"), "--", "--", "--", isHuaWeiPC, isHuaWei9006C);//"当前未连接任何 Wifi"
ocf->setSignal("0", "--", "0"); ocf->setSignal("0", "--", "0");
ocf->setConnedString(1, tr("Disconnected"), "");//"未连接" ocf->setConnedString(1, tr("Disconnected"), "");//"未连接"
ocf->lbFreq->hide(); ocf->lbFreq->hide();
@ -4419,6 +4431,7 @@ void MainWindow::PrimaryManager()
QDBusConnection::sessionBus()); QDBusConnection::sessionBus());
isHuaWeiPC = false; isHuaWeiPC = false;
isHuaWei9006C = false;
QDBusMessage message = QDBusMessage::createMethodCall(DBUS_NAME, QDBusMessage message = QDBusMessage::createMethodCall(DBUS_NAME,
DBUS_PATH, DBUS_PATH,
DBUS_INTERFACE, DBUS_INTERFACE,
@ -4426,11 +4439,24 @@ void MainWindow::PrimaryManager()
QDBusMessage response = QDBusConnection::sessionBus().call(message); QDBusMessage response = QDBusConnection::sessionBus().call(message);
if (response.type() == QDBusMessage::ReplyMessage) { if (response.type() == QDBusMessage::ReplyMessage) {
isHuaWeiPC = true; 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)), connect(mDbusXrandInter, SIGNAL(screenPrimaryChanged(int,int,int,int)),
this, SLOT(priScreenChanged(int,int,int,int))); this, SLOT(priScreenChanged(int,int,int,int)));
} }
void MainWindow::toStart() void MainWindow::toStart()

View File

@ -185,6 +185,7 @@ public:
bool isReconnectingLan = false; //是否正在执行lan的回连 bool isReconnectingLan = false; //是否正在执行lan的回连
int addNumberForWifi = 0; //短时间内收到关于wifi连接信号的次数 int addNumberForWifi = 0; //短时间内收到关于wifi连接信号的次数
bool isHuaWeiPC; bool isHuaWeiPC;
bool isHuaWei9006C;
bool isHandlingWiredCableOn = false; bool isHandlingWiredCableOn = false;
bool ifCanReconnectWifiNow = true; bool ifCanReconnectWifiNow = true;
bool isReConnAfterTurnOnWifi = false;//是否是在打开wifi的开关后回连wifi bool isReConnAfterTurnOnWifi = false;//是否是在打开wifi的开关后回连wifi

View File

@ -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()); QFontMetrics fontMetrics(lbNameText->font());
QString showname = fontMetrics.elidedText(name, Qt::ElideRight, 200); QString showname = fontMetrics.elidedText(name, Qt::ElideRight, 200);
@ -501,6 +501,7 @@ void OneConnForm::setWifiName(QString name, QString bssid, QString uuid, QString
wifiUuid = uuid; wifiUuid = uuid;
wifiIfName = ifname; wifiIfName = ifname;
isHuaweiPC = isHW; isHuaweiPC = isHW;
isHuaWei9006C = is9006C;
} }
QString OneConnForm::getName() 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"; signalStyle = "QLabel{border-radius:0px;background:url(:/res/w/wifi";
} }
if ("1" == category) { if (isHuaWei9006C) {
signalStyle += "6"; if ("1" == category) {
} else if ("2" == category) { signalStyle += "6";
signalStyle += "6+"; } else if ("2" == category) {
signalStyle += "6+";
}
} }
if (signal > 75) { if (signal > 75) {

View File

@ -68,7 +68,7 @@ public:
// category:1->normal protocol 1->wifi 6 2->wifi 6+ // category:1->normal protocol 1->wifi 6 2->wifi 6+
void setSignal(QString lv, QString secu,QString category = "0"); void setSignal(QString lv, QString secu,QString category = "0");
int getSignal(); 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(); QString getName();
void setRate(QString rate); void setRate(QString rate);
void setLine(bool isShow); void setLine(bool isShow);
@ -95,6 +95,7 @@ public:
QLabel * lbFreq = nullptr; QLabel * lbFreq = nullptr;
QLabel * lbPwdTip = nullptr; QLabel * lbPwdTip = nullptr;
bool isHuaweiPC; bool isHuaweiPC;
bool isHuaWei9006C;
bool isSelected; bool isSelected;
bool isActive; bool isActive;
bool isConnected; bool isConnected;