Merge pull request #120 from huanchuang/master

本次和上次的表头信息中,path的开始位置不一定一样;使用相应的path位置
This commit is contained in:
chenlelin 2021-04-25 19:48:03 +08:00 committed by GitHub
commit 36081fff60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -2398,7 +2398,7 @@ void MainWindow::updateWifiListDone(QStringList slist)
//获取表头信息
QString lastHeadLine = oldWifiSlist.at(0);
int lastIndexName;
int lastIndexName, lastIndexPath;
lastHeadLine = lastHeadLine.trimmed();
bool isChineseInIt = lastHeadLine.contains(QRegExp("[\\x4e00-\\x9fa5]+"));
if (isChineseInIt) {
@ -2406,6 +2406,7 @@ void MainWindow::updateWifiListDone(QStringList slist)
} else {
lastIndexName = lastHeadLine.indexOf("BSSID") + 19;
}
lastIndexPath = lastHeadLine.indexOf("DBUS-PATH");
QString headLine = slist.at(0);
int indexSecu, indexFreq, indexBSsid, indexName, indexPath, indexCate;
@ -2432,7 +2433,7 @@ void MainWindow::updateWifiListDone(QStringList slist)
//列表中去除已经减少的wifi
for (int i=1; i<oldWifiSlist.size(); i++){
QString line = oldWifiSlist.at(i);
QString lastWname = line.mid(lastIndexName, indexPath - lastIndexName).trimmed();
QString lastWname = line.mid(lastIndexName, lastIndexPath - lastIndexName).trimmed();
for (int j=1; j<slist.size(); j++){
QString line = slist.at(j);
QString wname = line.mid(indexName, indexPath - indexName).trimmed();
@ -2510,7 +2511,7 @@ void MainWindow::updateWifiListDone(QStringList slist)
for (int j=1; j < oldWifiSlist.size(); j++) {
QString line = oldWifiSlist.at(j);
QString lastWname = line.mid(lastIndexName, indexPath - lastIndexName).trimmed();
QString lastWname = line.mid(lastIndexName, lastIndexPath - lastIndexName).trimmed();
if (lastWname == wname){break;} //上一次的wifi列表已经有名为wname的wifi则停止
if (j == oldWifiSlist.size()-1) { //到lastSlist最后一个都没找到执行下面流程
QList<OneConnForm *> wifiList = wifiListWidget->findChildren<OneConnForm *>();