From 234e12f040ec110c2fa034e6a309e47d40c98cbd Mon Sep 17 00:00:00 2001 From: andrew-wuhan-huawei-990-pc Date: Tue, 20 Apr 2021 11:53:00 +0800 Subject: [PATCH] Merge master from 9a0 branch --- nmqrc.qrc | 10 +++ res/w/wifi6+-full-pwd.png | Bin 0 -> 784 bytes res/w/wifi6+-full.png | Bin 0 -> 732 bytes res/w/wifi6+-high-pwd.png | Bin 0 -> 830 bytes res/w/wifi6+-high.png | Bin 0 -> 787 bytes res/w/wifi6+-low-pwd.png | Bin 0 -> 806 bytes res/w/wifi6+-low.png | Bin 0 -> 775 bytes res/w/wifi6+-medium-pwd.png | Bin 0 -> 833 bytes res/w/wifi6+-medium.png | Bin 0 -> 787 bytes res/w/wifi6+-meidum-pwd.png | Bin 0 -> 828 bytes res/w/wifi6+-none.png | Bin 0 -> 759 bytes src/ksimplenm.cpp | 2 +- src/mainwindow.cpp | 138 +++++++++++++++++++++++++++--------- src/mainwindow.h | 5 +- src/oneconnform.cpp | 29 +++++--- src/oneconnform.h | 3 +- 16 files changed, 141 insertions(+), 46 deletions(-) create mode 100644 res/w/wifi6+-full-pwd.png create mode 100644 res/w/wifi6+-full.png create mode 100644 res/w/wifi6+-high-pwd.png create mode 100644 res/w/wifi6+-high.png create mode 100644 res/w/wifi6+-low-pwd.png create mode 100644 res/w/wifi6+-low.png create mode 100644 res/w/wifi6+-medium-pwd.png create mode 100644 res/w/wifi6+-medium.png create mode 100644 res/w/wifi6+-meidum-pwd.png create mode 100644 res/w/wifi6+-none.png diff --git a/nmqrc.qrc b/nmqrc.qrc index 706cb1ca..a5d52211 100644 --- a/nmqrc.qrc +++ b/nmqrc.qrc @@ -89,5 +89,15 @@ res/w/wifi6-medium.png res/w/wifi6-none.png res/w/wifi6-null-pwd.png + res/w/wifi6+-none.png + res/w/wifi6+-meidum-pwd.png + res/w/wifi6+-medium.png + res/w/wifi6+-medium-pwd.png + res/w/wifi6+-low.png + res/w/wifi6+-low-pwd.png + res/w/wifi6+-high.png + res/w/wifi6+-high-pwd.png + res/w/wifi6+-full.png + res/w/wifi6+-full-pwd.png diff --git a/res/w/wifi6+-full-pwd.png b/res/w/wifi6+-full-pwd.png new file mode 100644 index 0000000000000000000000000000000000000000..b4498c0cfaaae58c22994ba848921969529a92d5 GIT binary patch literal 784 zcmV+r1MmEaP)gvj8NQ#2*5QHP9{L-ok8-Cx*QwT5(|g3~Q#r0vP0L z0P49wiG@X%Z6jVn1Wy87d5d_UT- zu7s3h`m1S?-=y#mT39p?*+Tz;_p<;7*E`#G8Ggu48>R0$T{;Ee9Yagn8b{%8cb_`&E0v~UbFSCoN|(os=8iADS6RG z3Fp4!^|}p_e9ANR3|G0vfx?1k?#C1RWwY4`TqD>%d%|)s7*wXw)Dkk#@n(p(&!c)_ zTo;I$-$MY-X+S<}xeKtMBqzp5e7XazEq4&}kTG*2CY(9s#&Wy!5o`)OgT+$0EatN} zO&1PH793okc$DS2KLT~iP?^G=!|{N}(MU*qUs0}^Nu&xX-SRTTfsy`*g|>NQ#m)lH;xl2uW4b^Dli6cY#HEv6$UYTE4;+wgBz*N)9DZi2^R$HY*n| z>Lf!+j$~^F$yvaG4-TJcDDhvtu(>p2hi`D=bG=uFiaFZoKE?{{T zn7AVF5$q7wZOO6(&tazkGOGoE;1c+o6IdPHlI|y(O?eX7XR?(z?+@|Lzy&}jKOL&a zLM2`-nxqYXDH+^%v~mD{(v$6@ZhWs|L~oV(fxo8@trGxdlOt99^>J-Br6eR zkLT4C-N55gqL+J%J$ioVr#CZwNcH9Y9~#)Qd1Mwi?KYei7Uo zwdjNe)qfU%=nMUIZTO=^K$jlPq&Ov0sWTIHy?Iau;CJApU?#U4rjtNj^l+HG^K)cCf=|S0|=fu?eiet z0)UuP6Fmezu3_tic4`42xMcm60Vl9IMfM4H2LO|b4^Ct!XVax6(9ClLQ@XDJ>^;j- zDM(z;*sl3&0c`Pij-YmUx&_2^pLxL2DM~&uPR-H(o0P()$QJF~ZZ#3p~5gGt53Rv!eC-E5HCucseaA1P3wz O0000P)J& zez{!Ih)X|sxG#6_&*%No7791#=KSXqf<&Zd%zuF3%G4WegMCL@4)2GaqZW& z1EA9~PytFSCN~0xK$;aykm2|qa2MFVCd=YH1->GXpGyOPb8&p%Hk1{|22e-T-Lip@(XraR|lHDrv*s9$BoIPm;g|>`mqYPDEe`uW+Exr?myA{n z8)7?k0W_3z`S=MRhaO`Q9!;PI6cq*(c@HGeO+30KGOUw)=K_%E#JFVp!O_ES;@~-O z0E9Uc9|IlW1h&Se%=_#YVPL3xK*nvPM+WaC+cRdl&JpJ?Ve`ZUQ4;#I#!wu-23qD* zA9(Ad89H^cc)+JVBKuUcv1|`q7$XTYNpd!x1oHx@>)@gP;EL=58y$5&g5u-6&gF=# z=-_(DGFY3-S240^(b%~ujr7G6W>+*UNqM@^8JNk5w4HVT7&X}!c_u;1)!x`&LpX1< zrnbZTyoa8^yfwFHOaGY7WN2SG4ai)LX%BFKc4lcmJ2iG4NR$QAPxg`)Vnh7HWlfMEC0EO&q!WYIGmH+?%07*qo IM6N<$f`P1qT>t<8 literal 0 HcmV?d00001 diff --git a/res/w/wifi6+-high.png b/res/w/wifi6+-high.png new file mode 100644 index 0000000000000000000000000000000000000000..5144960f1d0bf59d9ceccdd915b9fee7d0beaefd GIT binary patch literal 787 zcmV+u1MK{XP)7YRAYziclDs<^E9bKG%kaTpIj*g^Dmy|9|mj=mnktlK$NFfcD++2Yr<06U#!n~2* zMw7|jhtG#-veMJ-d3R^tyqTSIrE)j!#(y3`-i`O(eObn16?gzF0r$<8pTKY62QdBf zy7_Bi0(80tG=Tb?!Ht0t5T}s|QXD@59skJKXL2nWaWgbjPERIy=}B!Dy6n_d&(<_#0IIE;L<%}Hd1 ziZ+ZIVmo#Owv=;O{EEeq$5;!GHqZoW3PW!B1PpL?;5l2T!aB&0j)1Te;}Y#>ClA-e z!7i{3ggFDB00+Q6Y)wp>H&`#Cz)07CT(_~lGWboRJz|tahB$u#aPWCv z=Q3okoWXR5X|Oi4TQQ>O(Acp_jnu^pMprW`NqYJ?Gc-4+rR@~`7`0g!d2WKFt6SRF z5YD^Isjcvc^Uy=gn{zvs^vi5E6S>xbDw|6b1i?f#n#6(x$&e&FX*o|+0M6T<>vIJh zgG9`lXu|PchFZ63CzAl2OVqFEu*a{S6xlQ290Ym^&RTR975!GY6u8LyaOUJb0kJiv zBefv$KIC=n7bURHXAGyhdGuKWcGOJKg+<%7OF@@a?K5&HHIR_&BfjqB&3PID*XvI> z-(qTF5I8KO;1Y)rAgb!Os{7sUE%R^rjc)-Wz4Fcf<#0uKE`=zK2#zDwlw2>k5xJXV zZ?`N0r@RSm7!S?WbREy-xufRgC?Izqj(e)`T;v0+ow_}YzM^`?!sD+10|0b5Iv1|B RYhwTa002ovPDHLkV1jV-Y6buR literal 0 HcmV?d00001 diff --git a/res/w/wifi6+-low-pwd.png b/res/w/wifi6+-low-pwd.png new file mode 100644 index 0000000000000000000000000000000000000000..802a36688a99aab68bf22dc074831cfc2a37e8b3 GIT binary patch literal 806 zcmV+>1KIqEP)>7%N-if3^AY>za!rbC&!!j z!&F>);p5%r-Sg|a-#M>Qbhqx-e_nCfgZJKkO7N%y4}mS9VUBzSegHSX^ymJI?;9t; zpefJ-niY$i0As-AB@^caeg-@Rk_}mw;10M%BD2B-5L^O34+Qp(rlfmGv$~!dnQC%x z?XO^S5lnziUIwTZ8pkl4R4E(&>SVEHUP%ET;cvQ3fQP%LY6*B2qOD>gH8R>VY>02? z6X>hp^70%n$7`y3M7k3~I^vs3`XQsrJ;cN+HiM`fLw@XQrw_TJunkaL-Sy3P3B$W zL>ye?bpqcBGA6U5I;u&ZCuI}JNPR>>W>t7+G9Rd|U0z{UX%y2q(%qm&bIPi0+d7Wk zndzKHsH>`ej8axprV}ph#M|g=h~PUMCRX9TT^|GzlTm$AgWhQ2Y)bt!+T12e$9a+7&vO8j=<*yY%R3|pMCn2fKtdd z&}U%-U3nWg0QP|=lDQc3x7T?e9EvQsXy36c%kTCI{GnrHcFp|&2UA{0t|0OEjP2@F zplxoQF?S&iwEasM_SE}hYQV0I8l}qF^G5MFKb^a9DO&8GliwHk9B9Hm8#T6G*LdoH+;u{;Pjj%>B$m`+vDS z1D{2R(jo|ariPNA1uL}ry=US!5*V=)_GAv2)*SMA#OE8ek8b4(*!%C;2_0fiO^o~* kKO^*how`fLAN~?x0E>fcWS|%{RR91007*qoM6N<$g0@_5ng9R* literal 0 HcmV?d00001 diff --git a/res/w/wifi6+-low.png b/res/w/wifi6+-low.png new file mode 100644 index 0000000000000000000000000000000000000000..f7e4a96d829c2664ecee608fc339056c5ff5ca21 GIT binary patch literal 775 zcmV+i1Ni)jP)K@{E<138Q2V6WJN z3*;ra z1n4vbYCw=PxIWMW;xsaTisO0UD^Mz^vN(@{OAxusBmn2)_?yGAF*KmuuQFTLGe@NY z&h_~#oVjokppg}a)FNXK2m5)#hP?_^tf?gl;1BE#UI}n>Lq#nPyDr&s5}Bi-HKm5w zjtzk|%egF`VX>DG)o03GBBUbjEz&nGwQx3|!gi3q3;|)c3`n#mMjn-rUmW+EmUve{ zWLE%fH5h;>(6e(u%B`;sgd|ofPyv$tks=X@{8?qVl#oENOJ+)3<(Z13C!DzY!E6Ha zhB6`sF48K2Yl4Vm7OaX2X!B@X0uiP6n2=E(-AU#*b8CrL80BikJnY%kV72CuQR%Xc z*?R9(Z2^%BRMb}4&~k#fiiF{ zwd(u+E&D@iLOMELluH3PU$+v^j0d0v5;1e40>@_=YQ4#wOagE&QE$*;o5{2a`~c2D zpq=1sna;YCek;rsn8-VDcFp+#h=sfk?O4>>1?v1QXSP73Gbw>ZK4Umtwbnb#0X;q% z=Nxsuo9sU!obKRpn_y&5a=@WN6OVoV+(h)Pq6B2fT^?}0#;b`zU@svDn#_TgS7ZnQ zqHMh@oA-L}H2;>*jL6~p53c#Y93~0RB@v|&!Ex7WN~RZ#L~iETyE82U$E<{P7_Y0+ zJmk~dbJLnnM**pQIBr{sXCgnu+OgTg=sl}f6do@E3;;FyIs7`Zg8%>k002ovPDHLk FV1gB9VtN1o literal 0 HcmV?d00001 diff --git a/res/w/wifi6+-medium-pwd.png b/res/w/wifi6+-medium-pwd.png new file mode 100644 index 0000000000000000000000000000000000000000..68f47cf3c12bc7a15c911e05fed6474731f88c27 GIT binary patch literal 833 zcmV-H1HSx;P)#j3)c4Bv(S6asIH9~A8aD}lDJd1Zinpa#PrqF<5{06=~ zCgbM4JQK0Gg^z4@cV@o%c4m_xxEfdEKabqH2d_Q*kjF;>xDM<9MRVjU@DsQIX1|UO zer!yDK`THNC}&J=0*rw;iA*jb@NM80kl#>c2_6HVLF8L10R)%8cRYceqZ#GClv!QR z9+fI{Ztc%ubLJ&LC-*&4i;QC!PO_v8e+8;oHCvLvd-$7O65!#c$yx%Ae6nREvPVU$ zMh)>DI|6MLTsA*qbG#y}8Lbk15ETo_kFy zymKJZ9Y9}ACLjuobqz?nO^iW>#PS<-fK-2ENR&nXv^LydQ9!XzW=dS7O~Lafoci8_ zofXWR#)&vMOX>vf2_llYt2(MopKsSC5K;Po1sP@0on+pzw)T02QKqMu#)0kztd;Q5 z0UiP^prlL&z-yonn=htwioUMO`eP)4p98fujz2}f-qwB%5nP--G0RhFCC+OeV$x>! z(tIz~z+$nGd#?k#fXFz?<#JQbwbYW~z>utwWS2`X;BS{#^*|jR!e{u00yx}Jh3Cc` zIDtWo0OI%nfe%yE>auoD;ImDiAr+IFX*01mXM+w0if>rypZ&;OO z-Clt^)CV&scZh=(UPod<;=9-!BI~{iTVN;Ew$fg4cJjKMOQN|8HgQx z$!BcVCB||WP?D*2!f|Y!sJnj2uaD)f3eMjBy6=m9 zibDjO(@97I73&;ldcMGa^@qjW&)hfvm%}OWNeWR~1c68DQF3p=lB{m-l-LG=Av>WX z?|^Ad_u@IZyJ{Y6`Ke20*mnF2sA#48SB6KG7k?`&4b zvqYx?&h7n|*mL0&z#uOjR*Q{8Y#ilD8}TZ1v0=TE1im2N_)Y*9H?6FNaNx2nr;sH& z+OXV^*s&3?t;pr&H@qAsWc8GGmk8;IUrO|q%Ps5;=&(-m$OsU18-QecX6&&F@|ojY z(+ckrh;#=qR+9;c14CT{(rzPbL!H7(b98`Ie`JXW#Qs@rxRy{rvCC#!T;-mM<4!np z-3N;a%9~aY32>3t34AArDCULgsDLq#vkHi4y~l!#^7u|MC#Z-gyMne1%2s13-1!1SKUqg^fu=m#EYiT9ULx(VF zv&~ttr)pp_naH`X0%bsK9QeL}&AGN(GVEI-LyBzk(WhJvfV`y&&x~8(03u=#NZ@r4 z@62$k&DuH0ECA$^^&1j)+3QkduYhw1=q8YDkZf?@-wJaCCi5Q1jNOM2R_Ae~79_sQ zo*fA3-B-XWKVy(?srNnBfIVtf(S=q^=KD_w(hjTI6=Y9pAmOa{`SoqqGfxxXv8@g{ z-{#T85U^K7!6gn6K$O+9vUzT=E%I;q!jv7pf9sn6&tZ!2TnbSxA`lPMrDX1csm#qB zYdb{=IAtfa5InS6)7*IGoZD(%j04j9AnvNdGnx1C?$oSd_MW;c<{tk97yv{tIhn|# R;wAt9002ovPDHLkV1kQUXV3ru literal 0 HcmV?d00001 diff --git a/res/w/wifi6+-meidum-pwd.png b/res/w/wifi6+-meidum-pwd.png new file mode 100644 index 0000000000000000000000000000000000000000..5d64fddc0a9bf8c375aa09f7e3aca02008a02631 GIT binary patch literal 828 zcmV-C1H=4@P)>h>OGj}? zSTYpEQVQH4Ay+P4rc7ym0$s|KbhPPkN$K($B&R`^QecWmB*i6?n=4`|xCoX&m^ac} zvmW-oa1c#adb-Ws&di&)Gvj#P-MU-T-h1=8f=3m22y6j0b>u7X1Goa_KM$UN z-Rl(=N3#5LMf9W&v?H4nB@ zn0J&Dad4K^3H&CANoL3DsDM6?ixP+_y~l!#%jixrA6Z+wyu!HDD5kMzcY`&WLuRGh zHsR>KQJqtBbye9PqmbDY>4bAV@izK3MDQIB6J6n^T^~4z$*4Zg^SxFB%jHt;y#?F{ zE~Qs}-@oR3$Sg?5#Eaoi{B(hr*3mJ1Mt>-P!+TcYnY920Fi2PvRRliGQEOE@@Y$nJ z2`GuwfgTf!?95xhA#eaRg}E5>-F`-}wjk|0?b}*qd9Sa)92$bzCHD~yhP)0PSk!t8 zH2JsKyhheTD^Q)=M42b98fcl1Fzj02hpYj;>Lxf>lka|4H|*d`o{4%dG1j|)l3Z&i zTu0gov+m>Zj(@&F_5&;XE{iX3jcfw4CM+0_#UfXefWT2o4fI)X1AX^J=ZhZ25rQq~ zBqD)OJI9$rSKz<;heh4b!nOaG%P81+fankPzifcxy(J zy*r&xA&nOvyVmZ`ym>n_=P0@#_v1g0c+rC^AHF7-I=~}f73i8H*T7HU3Yh$Q|MEv; z0(6=IJs_~*MO&umEmUtn)?OMr*_CTejw49QlLNSliGj2dFw zc>-I?xon8p@hxSLX89pooZK-j$kB-&#yk4eZUfp;xSybB=L z6+l~k1|SNIbPhX5YE@wOl*exa(xgWCawCg%Jy6i%w{ur_jRBJTuQCR zar}+_p)?@_9WSq?0Gw~D#Pj0@*aHd2oan&uNrhT}!T;UJ`L`(hF^1s`&%lx-|WloMb zz6q`W&MRoZqSSaukr-hvR`t pJRkW1_Ky4+MjxqO(Rln8U;riGIl4*B7svnr002ovPDHLkV1fu|R2KjM literal 0 HcmV?d00001 diff --git a/src/ksimplenm.cpp b/src/ksimplenm.cpp index 03a53fab..1f9ba9c4 100644 --- a/src/ksimplenm.cpp +++ b/src/ksimplenm.cpp @@ -89,7 +89,7 @@ void KSimpleNM::execGetWifiList(const QString& wname) if (wname.isEmpty() || wname == "") { cmd = "nmcli -f in-use,signal,security,freq,bssid,ssid,dbus-path device wifi"; } else { - cmd = "nmcli -f in-use,signal,security,freq,bssid,ssid,dbus-path device wifi list ifname " + wname; + cmd = "nmcli -f in-use,signal,security,freq,bssid,ssid,dbus-path,category device wifi list ifname " + wname; } runProcessWifi->start(cmd); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 821f63e8..f4b3dd26 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1675,12 +1675,6 @@ void MainWindow::onRequestRevalueUpdateWifi() // 获取wifi列表回调 void MainWindow::getWifiListDone(QStringList slist) { - //qDebug()<<"------------"; - //foreach (QString str, slist) { - // qDebug()<ksnm->isUseOldWifiSlist) { slist = oldWifiSlist; @@ -1696,19 +1690,12 @@ void MainWindow::getWifiListDone(QStringList slist) } } - //若slist为空,则使用上一次获取到的列表 - //if (slist.size() == 1 && slist.at(0) == "") { - // if (oldWifiSlist.size() == 1 && oldWifiSlist.at(0) == "") { - // return; - // } else { - // slist = oldWifiSlist; - // } - //} + slist = priorityList(slist); if (isHuaWeiPC) { if (slist.size() >= 2) { wifiListOptimize(slist); - getFinalWifiList(slist); +// getFinalWifiList(slist); } } @@ -1732,7 +1719,6 @@ void MainWindow::getWifiListDone(QStringList slist) if (this->is_btnLanList_clicked == 1) { return; } - if (current_wifi_list_state == LOAD_WIFI_LIST) { //qDebug() << "loadwifi的列表"; loadWifiListDone(slist); @@ -1752,11 +1738,9 @@ void MainWindow::getWifiListDone(QStringList slist) void MainWindow::getConnListDone(QStringList slist) { if (isInitConnList) { -// oldConnSlist = slist; for (int i = 1; i < slist.length() - 1; i++) { oldConnSlist << slist.at(i).trimmed(); } -// qDebug()< 75 && conFreq >= 5000){ + p1.append(line); + continue; + }else if(conSignal > 55 && conFreq >= 5000){ + p2.append(line); + continue; + }else if(conSignal > 75){ + p3.append(line); + continue; + }else if(conSignal > 55){ + p4.append(line); + continue; + }else if(conSignal > 35){ + p5.append(line); + continue; + }else if(conSignal > 15){ + p6.append(line); + continue; + }else{ + p7.append(line); + } + } + QVector listVec; + listVec< MainWindow::repetitionFilter(QVector){ + QVector ret; + return ret; +} +QStringList MainWindow::sortApByCategory(QStringList list,int cateIndex){ + QStringList ret; + for(auto line:list){ + int conCate = line.mid(cateIndex).trimmed().toInt(); + if(conCate == 2){ + ret.append(line); + } + } + for(auto line:list){ + int conCate = line.mid(cateIndex).trimmed().toInt(); + if(conCate == 1){ + ret.append(line); + } + } + for(auto line:list){ + int conCate = line.mid(cateIndex).trimmed().toInt(); + if(conCate == 0){ + ret.append(line); + } + } + return ret; +} //进行wifi列表优化选择,分为2.4G和5G进行选择,先每种频率形成一个列表 //同一个列表中同名wifi只有一个,再按信号强度由大到小合并列表 void MainWindow::wifiListOptimize(QStringList& slist) { + if(slist.size() < 2) return ; //这个函数可能会把已经连接的那个wifi给筛选出去 QString headLine = slist.at(0); int indexSignal,indexSecu, indexFreq, indexBSsid, indexName,indexPath; @@ -1811,7 +1880,6 @@ void MainWindow::wifiListOptimize(QStringList& slist) indexName = indexBSsid + 19; indexPath = headLine.indexOf("DBUS-PATH"); } - QStringList targetList; //slist优化,同名同频AP中只留信号最强 targetList< MainWindow::connectableWifiPriorityList(const QStringL if(slist.size()<2) return selectedWifiListStruct; OneConnForm *ocf = new OneConnForm(); QString headLine = slist.at(0); - int indexSignal,indexSecu, indexFreq, indexBSsid, indexName, indexPath; + int indexSignal,indexSecu, indexFreq, indexBSsid, indexName, indexPath,indexCate; headLine = headLine.trimmed(); bool isChineseExist = headLine.contains(QRegExp("[\\x4e00-\\x9fa5]+")); @@ -1932,6 +1997,7 @@ QList MainWindow::connectableWifiPriorityList(const QStringL indexBSsid = headLine.indexOf("BSSID") + 6; indexName = indexBSsid + 19; indexPath = headLine.indexOf("DBUS-PATH"); + indexCate = headLine.indexOf("CATEGORY"); } else { indexSignal = headLine.indexOf("SIGNAL"); indexSecu = headLine.indexOf("SECURITY"); @@ -1939,6 +2005,7 @@ QList MainWindow::connectableWifiPriorityList(const QStringL indexBSsid = headLine.indexOf("BSSID"); indexName = indexBSsid + 19; indexPath = headLine.indexOf("DBUS-PATH"); + indexCate = headLine.indexOf("CATEGORY"); } QStringList tmp = slist; @@ -1946,7 +2013,7 @@ QList MainWindow::connectableWifiPriorityList(const QStringL QString line = tmp.at(iter); QString wifiname = line.mid(indexName,indexPath - indexName).trimmed(); QString wifibssid = line.mid(indexBSsid, indexName-indexBSsid).trimmed(); - QString wifiObjectPath = line.mid(indexPath).trimmed(); + QString wifiObjectPath = line.mid(indexPath,indexCate-indexPath).trimmed(); QString wifiAutoConnection; QString wifiPriority; @@ -1989,7 +2056,6 @@ QList MainWindow::connectableWifiPriorityList(const QStringL qDebug() << "-----------------------> 排序后" << wifiPriorityAfterSort.priority; } } - ocf->deleteLater(); return selectedWifiListStruct; } @@ -2009,7 +2075,6 @@ void MainWindow::loadWifiListDone(QStringList slist) { delete topWifiListWidget; //清空top列表 createTopWifiUI(); //创建topWifiListWidget - // 清空wifi列表 wifiListWidget = new QWidget(scrollAreaw); wifiListWidget->resize(W_LIST_WIDGET, H_WIFI_ITEM_BIG_EXTEND); @@ -2097,7 +2162,7 @@ void MainWindow::loadWifiListDone(QStringList slist) // 填充可用网络列表 QString headLine = slist.at(0); - int indexSignal,indexSecu, indexFreq, indexBSsid, indexName, indexPath; + int indexSignal,indexSecu, indexFreq, indexBSsid, indexName, indexPath, indexCate; headLine = headLine.trimmed(); bool isChineseExist = headLine.contains(QRegExp("[\\x4e00-\\x9fa5]+")); @@ -2108,6 +2173,7 @@ void MainWindow::loadWifiListDone(QStringList slist) indexBSsid = headLine.indexOf("BSSID") + 6; indexName = indexBSsid + 19; indexPath = headLine.indexOf("DBUS-PATH"); + indexCate = headLine.indexOf("CATEGORY"); } else { indexSignal = headLine.indexOf("SIGNAL"); indexSecu = headLine.indexOf("SECURITY"); @@ -2115,6 +2181,7 @@ void MainWindow::loadWifiListDone(QStringList slist) indexBSsid = headLine.indexOf("BSSID"); indexName = indexBSsid + 19; indexPath = headLine.indexOf("DBUS-PATH"); + indexCate = headLine.indexOf("CATEGORY"); } QStringList wnames; int count = 0; @@ -2128,7 +2195,7 @@ void MainWindow::loadWifiListDone(QStringList slist) actWifiName = wname; } if ("*" == line.mid(0,indexSignal).trimmed()) { - //在华为的电脑中,因为前面的优选工作,及时有已经连接的wifi,也可能会被筛选出去 + //在华为的电脑中,因为前面的优选工作,即使有已经连接的wifi,也可能会被筛选出去 actWifiBssid = wbssid; } } @@ -2144,6 +2211,7 @@ void MainWindow::loadWifiListDone(QStringList slist) QString wbssid = line.mid(indexBSsid, 17).trimmed(); QString wname = line.mid(indexName, indexPath - indexName).trimmed(); QString wfreq = line.mid(indexFreq, 4).trimmed(); + QString wcate = line.mid(indexCate).trimmed(); if (!isHuaWeiPC) { //如果不是华为的电脑,选择wifi在这里执行 @@ -2161,6 +2229,9 @@ void MainWindow::loadWifiListDone(QStringList slist) wbssid = actWifiBssidList.at(0); actWifiBssid = actWifiBssidList.at(0); } + if ((wnames.contains(wname) && wbssid != actWifiBssid)) { + continue; //过滤相同名称的wifi + } } int max_freq = wfreq.toInt(); @@ -2248,7 +2319,7 @@ void MainWindow::loadWifiListDone(QStringList slist) } //ocf->setRate(wrate); ocf->setLine(true); - ocf->setSignal(wsignal, wsecu); + ocf->setSignal(wsignal, wsecu, wcate); //objKyDBus->getWifiMac(wname); ocf->setWifiInfo(wsecu, wsignal, wbssid, freqState); ocf->setConnedString(0, tr("Disconnected"), wsecu); @@ -2326,7 +2397,7 @@ void MainWindow::updateWifiListDone(QStringList slist) } QString headLine = slist.at(0); - int indexSecu, indexFreq, indexBSsid, indexName, indexPath; + int indexSecu, indexFreq, indexBSsid, indexName, indexPath, indexCate; headLine = headLine.trimmed(); bool isChineseExist = headLine.contains(QRegExp("[\\x4e00-\\x9fa5]+")); if (isChineseExist) { @@ -2336,6 +2407,7 @@ void MainWindow::updateWifiListDone(QStringList slist) //indexName = headLine.indexOf("SSID") + 6; indexName = indexBSsid + 19; indexPath = headLine.indexOf("DBUS-PATH"); + indexCate= headLine.indexOf("CATEGORY"); } else { indexSecu = headLine.indexOf("SECURITY"); indexFreq = headLine.indexOf("FREQ"); @@ -2343,6 +2415,7 @@ void MainWindow::updateWifiListDone(QStringList slist) //indexName = headLine.indexOf("SSID"); indexName = indexBSsid + 19; indexPath = headLine.indexOf("DBUS-PATH"); + indexCate = headLine.indexOf("CATEGORY"); } //列表中去除已经减少的wifi @@ -2388,6 +2461,7 @@ void MainWindow::updateWifiListDone(QStringList slist) QString wbssid = line.mid(indexBSsid, 17).trimmed(); QString wname = line.mid(indexName, indexPath - indexName).trimmed(); QString wfreq = line.mid(indexFreq, 4).trimmed(); + QString wcate =line.mid(indexCate).trimmed(); if(wname == "" || wname == "--"){continue;} @@ -2454,7 +2528,7 @@ void MainWindow::updateWifiListDone(QStringList slist) } //addItem->setRate(wrate); addItem->setLine(false); - addItem->setSignal(wsignal, wsecu); + addItem->setSignal(wsignal, wsecu, wcate); //objKyDBus->getWifiMac(wname); addItem->setWifiInfo(wsecu, wsignal, wbssid, freqState); addItem->setConnedString(0, tr("Disconnected"), wsecu);//"未连接" diff --git a/src/mainwindow.h b/src/mainwindow.h index c9989877..e955cad3 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -313,7 +313,10 @@ private: QString lastAddedConn = ""; QString oldActLanName = ""; //上一次获取的已连接有线网名称 int oldDbusActLanDNS = 0; //上一次获取的已连接有线网的DNS代号 - void wifiListOptimize(QStringList& slist); //只保留同名同频信号最强AP + void wifiListOptimize(QStringList& slist); //只保留同名同频信号最优AP + QVector repetitionFilter(QVector); + QStringList priorityList(QStringList); + QStringList sortApByCategory(QStringList,int); void getFinalWifiList(QStringList& slist); //获取应该显示在wifi列表中的最优列表参数 QList connectableWifiPriorityList(const QStringList slist); //可连接wifi优先级列表 void devListSort(QList *list); diff --git a/src/oneconnform.cpp b/src/oneconnform.cpp index 85217d99..e41bbbe2 100644 --- a/src/oneconnform.cpp +++ b/src/oneconnform.cpp @@ -434,7 +434,7 @@ void OneConnForm::setLine(bool isShow) } } -void OneConnForm::setSignal(QString lv, QString secu) +void OneConnForm::setSignal(QString lv, QString secu, QString category) { int signal = lv.toInt(); if (secu == "--" || secu == "") { @@ -442,47 +442,54 @@ void OneConnForm::setSignal(QString lv, QString secu) } else { hasPwd = true; } + QString signalStyle = "QLabel{border-radius:0px;background:url(:/res/w/wifi"; + if("1" == category){ + signalStyle += "6"; + }else if("2" == category){ + signalStyle += "6+"; + } if (signal > 75) { if (hasPwd) { - ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-full-pwd.png);}"); + signalStyle += "-full-pwd.png);}"; } else { - ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-full.png);}"); + signalStyle += "-full.png);}"; } signalLv = 1; } if (signal > 55 && signal <= 75) { if (hasPwd) { - ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-high-pwd.png);}"); + signalStyle += "-high-pwd.png);}"; } else { - ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-high.png);}"); + signalStyle += "-high.png);}"; } signalLv = 2; } if (signal > 35 && signal <= 55) { if (hasPwd) { - ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-medium-pwd.png);}"); + signalStyle += "-medium-pwd.png);}"; } else { - ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-medium.png);}"); + signalStyle += "-medium.png);}"; } signalLv = 3; } if (signal > 15 && signal <= 35) { if (hasPwd) { - ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-low-pwd.png);}"); + signalStyle += "-low-pwd.png);}"; } else { - ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-low.png);}"); + signalStyle += "-low.png);}"; } signalLv = 4; } if (signal <= 15) { if (hasPwd) { - ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-none-pwd.png);}"); + signalStyle += "-none-pwd.png);}"; } else { - ui->lbSignal->setStyleSheet("QLabel{border-radius:0px;background:url(:/res/w/wifi-none.png);}"); + signalStyle += "-none.png);}"; } signalLv = 4; } + ui->lbSignal->setStyleSheet(signalStyle); } void OneConnForm::setWifiInfo(QString str1, QString str2, QString str3, int freq) diff --git a/src/oneconnform.h b/src/oneconnform.h index b3132ff1..18056b20 100644 --- a/src/oneconnform.h +++ b/src/oneconnform.h @@ -64,7 +64,8 @@ public: explicit OneConnForm(QWidget *parent = 0, MainWindow *mw = 0, ConfForm *confForm = 0, KSimpleNM *ksnm = 0); ~OneConnForm(); - void setSignal(QString lv, QString secu); + // category:1->normal protocol 1->wifi 6 2->wifi 6+ + void setSignal(QString lv, QString secu,QString category = "0"); void setName(QString name, QString bssid, QString uuid, QString isname); QString getName(); void setRate(QString rate);