系统支持wifi6信号连接与区分,效仿panguw分支代码
This commit is contained in:
parent
82d68ac9cc
commit
313fb91960
|
@ -35,6 +35,18 @@
|
|||
|
||||
#define SPACING 8
|
||||
|
||||
#define EXCELLENT_SIGNAL 80
|
||||
#define GOOD_SIGNAL 55
|
||||
#define OK_SIGNAL 30
|
||||
#define LOW_SIGNAL 5
|
||||
#define NONE_SIGNAL 0
|
||||
|
||||
#define SIGNAL_EXCELLENT 1
|
||||
#define SIGNAL_GOOD 2
|
||||
#define SIGNAL_OK 3
|
||||
#define SIGNAL_LOW 4
|
||||
#define SIGNAL_NONE 5
|
||||
|
||||
const QString WIRELESS_SWITCH = "wirelessswitch";
|
||||
const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
|
||||
|
||||
|
@ -49,6 +61,36 @@ const QString KWifiLockLow = "network-wireless-secure-signal-low";
|
|||
const QString KWifiNone = "network-wireless-signal-none";
|
||||
const QString KWifiLockNone = "network-wireless-secure-signal-none";
|
||||
|
||||
const QString KWifi6Symbolic = "ukui-wifi6-full-symbolic";
|
||||
const QString KWifi6PlusSymbolic = "ukui-wifi6+-full-symbolic";
|
||||
|
||||
const QString KWifi6LockSymbolic = "ukui-wifi6-full-pwd-symbolic";
|
||||
const QString KWifi6PlusLockSymbolic= "ukui-wifi6+-full-pwd-symbolic";
|
||||
|
||||
const QString KWifi6Good = "ukui-wifi6-high-symbolic";
|
||||
const QString KWifi6PlusGood = "ukui-wifi6+-high-symbolic";
|
||||
|
||||
const QString KWifi6LockGood = "ukui-wifi6-high-pwd-symbolic";
|
||||
const QString KWifi6PlusLockGood = "ukui-wifi6+-high-pwd-symbolic";
|
||||
|
||||
const QString KWifi6OK = "ukui-wifi6-medium-symbolic";
|
||||
const QString KWifi6PlusOK = "ukui-wifi6-high+-medium-symbolic";
|
||||
|
||||
const QString KWifi6LockOK = "ukui-wifi6-medium-pwd-symbolic";
|
||||
const QString KWifi6PlusLockOK = "ukui-wifi6+-medium-pwd-symbolic";
|
||||
|
||||
const QString KWifi6Low = "ukui-wifi6-low-symbolic";
|
||||
const QString KWifi6PlusLow = "ukui-wifi6+-low-symbolic";
|
||||
|
||||
const QString KWifi6LockLow = "ukui-wifi6-low-pwd-symbolic";
|
||||
const QString KWifi6PlusLockLow = "ukui-wifi6+-low-pwd-symbolic";
|
||||
|
||||
const QString KWifi6None = "ukui-wifi6-none-symbolic";
|
||||
const QString KWifi6PlusNone = "ukui-wifi6+-none-symbolic";
|
||||
|
||||
const QString KWifi6LockNone = "ukui-wifi6-none-pwd-symbolic";
|
||||
const QString KWifi6PlusLockNone = "ukui-wifi6+-none-pwd-symbolic";
|
||||
|
||||
const QString KLanSymbolic = ":/img/plugins/netconnect/eth.svg";
|
||||
const QString NoNetSymbolic = ":/img/plugins/netconnect/nonet.svg";
|
||||
|
||||
|
@ -328,7 +370,7 @@ void WlanConnect::resortWifiList(ItemFrame *frame, QVector<QStringList> list)
|
|||
frame->itemMap[list.at(0).at(0)]->uuid = list.at(0).at(3);
|
||||
frame->uuid = list.at(0).at(3);
|
||||
frame->itemMap[list.at(0).at(0)]->statusLabel->setText(tr("connected"));
|
||||
updateIcon(frame->itemMap[list.at(0).at(0)], list.at(0).at(1), list.at(0).at(2), list.at(0).at(4));
|
||||
updateIcon(frame->itemMap[list.at(0).at(0)], list.at(0).at(1), list.at(0).at(2), list.at(0).at(4), list.at(0).at(5).toInt());
|
||||
frameIndex ++;
|
||||
}
|
||||
} else {
|
||||
|
@ -362,7 +404,7 @@ void WlanConnect::resortWifiList(ItemFrame *frame, QVector<QStringList> list)
|
|||
frame->itemMap[list.at(listIndex).at(0)]->uuid.clear();
|
||||
frame->itemMap[list.at(listIndex).at(0)]->statusLabel->setText("");
|
||||
}
|
||||
updateIcon(frame->itemMap[list.at(listIndex).at(0)], list.at(listIndex).at(1), list.at(listIndex).at(2), list.at(listIndex).at(3));
|
||||
updateIcon(frame->itemMap[list.at(listIndex).at(0)], list.at(listIndex).at(1), list.at(listIndex).at(2), list.at(listIndex).at(3), list.at(listIndex).at(4).toInt());
|
||||
frameIndex++;
|
||||
} else {
|
||||
qDebug() << "not find " << list.at(listIndex).at(0) << " in current list, ignore";
|
||||
|
@ -371,7 +413,7 @@ void WlanConnect::resortWifiList(ItemFrame *frame, QVector<QStringList> list)
|
|||
qDebug() << "resort finish";
|
||||
}
|
||||
|
||||
void WlanConnect::updateIcon(WlanItem *item, QString signalStrength, QString security, QString isApConnection)
|
||||
void WlanConnect::updateIcon(WlanItem *item, QString signalStrength, QString security, QString isApConnection, int category)
|
||||
{
|
||||
qDebug() << "updateIcon" << item->titileLabel->text();
|
||||
|
||||
|
@ -387,7 +429,7 @@ void WlanConnect::updateIcon(WlanItem *item, QString signalStrength, QString sec
|
|||
if (isApConnection == IsApConnection) {
|
||||
iconamePath = KApSymbolic;
|
||||
} else {
|
||||
iconamePath = wifiIcon(isLock, sign);
|
||||
iconamePath = wifiIcon(isLock, sign, category);
|
||||
}
|
||||
QIcon searchIcon = QIcon::fromTheme(iconamePath);
|
||||
if (iconamePath != KLanSymbolic && iconamePath != NoNetSymbolic) {
|
||||
|
@ -597,7 +639,7 @@ void WlanConnect::onNetworkAdd(QString deviceName, QStringList wlanInfo)
|
|||
QMap<QString, ItemFrame *>::iterator iter;
|
||||
for (iter = deviceFrameMap.begin(); iter != deviceFrameMap.end(); iter++) {
|
||||
if (deviceName == iter.key()) {
|
||||
addOneWlanFrame(iter.value(), deviceName, wlanInfo.at(0), wlanInfo.at(1), "", isLock, false, WIRELESS_TYPE, wlanInfo.at(3));
|
||||
addOneWlanFrame(iter.value(), deviceName, wlanInfo.at(0), wlanInfo.at(1), "", isLock, false, WIRELESS_TYPE, wlanInfo.at(3), wlanInfo.at(3).toInt());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -735,21 +777,53 @@ void WlanConnect::runExternalApp() {
|
|||
}
|
||||
|
||||
//根据信号强度分级+安全性分图标
|
||||
QString WlanConnect::wifiIcon(bool isLock, int strength) {
|
||||
switch (strength) {
|
||||
case 1:
|
||||
return isLock ? KWifiLockSymbolic : KWifiSymbolic;
|
||||
case 2:
|
||||
return isLock ? KWifiLockGood : KWifiGood;
|
||||
case 3:
|
||||
return isLock ? KWifiLockOK : KWifiOK;
|
||||
case 4:
|
||||
return isLock ? KWifiLockLow : KWifiLow;
|
||||
case 5:
|
||||
return isLock ? KWifiLockNone : KWifiNone;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
QString WlanConnect::wifiIcon(bool isLock, int strength, int category) {
|
||||
if (category == 0) {
|
||||
switch (strength) {
|
||||
case SIGNAL_EXCELLENT:
|
||||
return isLock ? KWifiLockSymbolic : KWifiSymbolic;
|
||||
case SIGNAL_GOOD:
|
||||
return isLock ? KWifiLockGood : KWifiGood;
|
||||
case SIGNAL_OK:
|
||||
return isLock ? KWifiLockOK : KWifiOK;
|
||||
case SIGNAL_LOW:
|
||||
return isLock ? KWifiLockLow : KWifiLow;
|
||||
case SIGNAL_NONE:
|
||||
return isLock ? KWifiLockNone : KWifiNone;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
} else if (category == 1) {
|
||||
switch (strength) {
|
||||
case SIGNAL_EXCELLENT:
|
||||
return isLock ? KWifi6LockSymbolic : KWifi6Symbolic;
|
||||
case SIGNAL_GOOD:
|
||||
return isLock ? KWifi6LockGood : KWifi6Good;
|
||||
case SIGNAL_OK:
|
||||
return isLock ? KWifi6LockOK : KWifi6OK;
|
||||
case SIGNAL_LOW:
|
||||
return isLock ? KWifi6LockLow : KWifi6Low;
|
||||
case SIGNAL_NONE:
|
||||
return isLock ? KWifi6LockNone : KWifi6None;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
switch (strength) {
|
||||
case SIGNAL_EXCELLENT:
|
||||
return isLock ? KWifi6PlusLockSymbolic : KWifi6PlusSymbolic;
|
||||
case SIGNAL_GOOD:
|
||||
return isLock ? KWifi6PlusLockGood : KWifi6PlusGood;
|
||||
case SIGNAL_OK:
|
||||
return isLock ? KWifi6PlusLockOK : KWifi6PlusOK;
|
||||
case SIGNAL_LOW:
|
||||
return isLock ? KWifi6PlusLockLow : KWifi6PlusLow;
|
||||
case SIGNAL_NONE:
|
||||
return isLock ? KWifi6PlusLockNone : KWifi6PlusNone;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//根据信号强度分级
|
||||
|
@ -757,15 +831,15 @@ int WlanConnect::setSignal(QString lv) {
|
|||
int signal = lv.toInt();
|
||||
int signalLv = 0;
|
||||
|
||||
if (signal > 75) {
|
||||
if (signal > EXCELLENT_SIGNAL) {
|
||||
signalLv = 1;
|
||||
} else if (signal > 55 && signal <= 75) {
|
||||
} else if (signal > GOOD_SIGNAL) {
|
||||
signalLv = 2;
|
||||
} else if (signal > 35 && signal <= 55) {
|
||||
} else if (signal > OK_SIGNAL) {
|
||||
signalLv = 3;
|
||||
} else if (signal > 15 && signal <= 35) {
|
||||
} else if (signal > LOW_SIGNAL) {
|
||||
signalLv = 4;
|
||||
} else if (signal <= 15) {
|
||||
} else {
|
||||
signalLv = 5;
|
||||
}
|
||||
return signalLv;
|
||||
|
@ -852,7 +926,7 @@ void WlanConnect::addActiveItem(ItemFrame *frame, QString devName, QStringList i
|
|||
} else {
|
||||
isLock = true;
|
||||
}
|
||||
addOneWlanFrame(frame, devName, infoList.at(0), infoList.at(1), infoList.at(3), isLock, true, WIRELESS_TYPE, infoList.at(4));
|
||||
addOneWlanFrame(frame, devName, infoList.at(0), infoList.at(1), infoList.at(3), isLock, true, WIRELESS_TYPE, infoList.at(4), infoList.at(5).toInt());
|
||||
}
|
||||
|
||||
//处理列表 未连接
|
||||
|
@ -867,7 +941,7 @@ void WlanConnect::addCustomItem(ItemFrame *frame, QString devName, QStringList i
|
|||
} else {
|
||||
isLock = true;
|
||||
}
|
||||
addOneWlanFrame(frame, devName, infoList.at(0), infoList.at(1), "", isLock, false, WIRELESS_TYPE, infoList.at(3));
|
||||
addOneWlanFrame(frame, devName, infoList.at(0), infoList.at(1), "", isLock, false, WIRELESS_TYPE, infoList.at(3), infoList.at(4).toInt());
|
||||
}
|
||||
|
||||
//增加设备
|
||||
|
@ -902,7 +976,7 @@ void WlanConnect::removeDeviceFrame(QString devName)
|
|||
}
|
||||
|
||||
//增加ap
|
||||
void WlanConnect::addOneWlanFrame(ItemFrame *frame, QString deviceName, QString name, QString signal, QString uuid, bool isLock, bool status, int type, QString isApConnection)
|
||||
void WlanConnect::addOneWlanFrame(ItemFrame *frame, QString deviceName, QString name, QString signal, QString uuid, bool isLock, bool status, int type, QString isApConnection, int category)
|
||||
{
|
||||
if (nullptr == frame) {
|
||||
return;
|
||||
|
@ -921,7 +995,7 @@ void WlanConnect::addOneWlanFrame(ItemFrame *frame, QString deviceName, QString
|
|||
if (bApConnection) {
|
||||
iconamePath = KApSymbolic;
|
||||
} else {
|
||||
iconamePath = wifiIcon(isLock, sign);
|
||||
iconamePath = wifiIcon(isLock, sign, category);
|
||||
}
|
||||
if (iconamePath != KLanSymbolic && iconamePath != NoNetSymbolic) {
|
||||
wlanItem->iconLabel->setProperty("useIconHighlightEffect", 0x10);
|
||||
|
|
|
@ -84,13 +84,13 @@ private:
|
|||
|
||||
|
||||
int sortWlanNet(QString deviceName, QString name, QString signal);
|
||||
void updateIcon(WlanItem *item, QString signalStrength, QString security, QString isApConnection);
|
||||
void updateIcon(WlanItem *item, QString signalStrength, QString security, QString isApConnection, int category);
|
||||
void resortWifiList(ItemFrame *frame, QVector<QStringList> list);
|
||||
|
||||
|
||||
//单wifi图标
|
||||
int setSignal(QString lv);
|
||||
QString wifiIcon(bool isLock, int strength);
|
||||
QString wifiIcon(bool isLock, int strength, int category);
|
||||
|
||||
|
||||
//开关相关
|
||||
|
@ -113,7 +113,7 @@ private:
|
|||
//减少设备
|
||||
void removeDeviceFrame(QString devName);
|
||||
//增加ap
|
||||
void addOneWlanFrame(ItemFrame *frame, QString deviceName, QString name, QString signal, QString uuid, bool isLock, bool status, int type, QString isApConnection);
|
||||
void addOneWlanFrame(ItemFrame *frame, QString deviceName, QString name, QString signal, QString uuid, bool isLock, bool status, int type, QString isApConnection, int category);
|
||||
//减少ap
|
||||
void removeOneWlanFrame(ItemFrame *frame, QString deviceName, QString ssid);
|
||||
|
||||
|
|
|
@ -186,6 +186,37 @@ void KyNetworkDeviceResourse::setDeviceRefreshRate(QString deviceName, int ms)
|
|||
return;
|
||||
}
|
||||
|
||||
bool KyNetworkDeviceResourse::getActiveConnectionInfo(const QString devName, int &signalStrength, QString &uni, QString &secuType)
|
||||
{
|
||||
signalStrength = 0;
|
||||
uni = "";
|
||||
NetworkManager::Device::Ptr connectDevice =
|
||||
m_networkResourceInstance->getNetworkDevice(devName);
|
||||
|
||||
if (nullptr == connectDevice || !connectDevice->isValid()) {
|
||||
qWarning()<< LOG_FLAG <<"getDeviceActiveAPInfo failed, the device" << devName << "is not existed";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (connectDevice->type() == NetworkManager::Device::Wifi) {
|
||||
NetworkManager::WirelessDevice *wirelessDevicePtr =
|
||||
qobject_cast<NetworkManager::WirelessDevice *>(connectDevice.data());
|
||||
NetworkManager::AccessPoint::Ptr apPtr = wirelessDevicePtr->activeAccessPoint();
|
||||
if (apPtr.isNull()) {
|
||||
return false;
|
||||
}
|
||||
signalStrength = apPtr->signalStrength();
|
||||
uni = apPtr->uni();
|
||||
NetworkManager::AccessPoint::Capabilities cap = apPtr->capabilities();
|
||||
NetworkManager::AccessPoint::WpaFlags wpaFlag = apPtr->wpaFlags();
|
||||
NetworkManager::AccessPoint::WpaFlags rsnFlag = apPtr->rsnFlags();
|
||||
secuType = enumToQstring(cap, wpaFlag, rsnFlag);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void KyNetworkDeviceResourse::getDeviceActiveAPInfo(const QString devName, QString &strMac, uint &iHz, uint &iChan, QString &secuType)
|
||||
{
|
||||
strMac.clear();
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
void getDeviceActiveAPInfo(const QString devName, QString &strMac, uint &iHz, uint &iChan, QString &secuType);
|
||||
int getWirelessDeviceCapability(const QString deviceName);
|
||||
NetworkManager::Device::State getDeviceState(QString deviceName);
|
||||
bool getActiveConnectionInfo(const QString devName, int &signalStrength, QString &uni, QString &secuType);
|
||||
|
||||
bool wiredDeviceIsCarriered(QString deviceName);
|
||||
bool wirelessDeviceIsExist(const QString devName);
|
||||
|
|
|
@ -79,6 +79,7 @@ void KyWirelessNetItem::init(NetworkManager::WirelessNetwork::Ptr net)
|
|||
}
|
||||
m_bssid = net->referenceAccessPoint()->hardwareAddress();
|
||||
m_device = net->device();
|
||||
m_uni = net->referenceAccessPoint()->uni();
|
||||
initInfoBySsid();
|
||||
}
|
||||
|
||||
|
@ -112,3 +113,22 @@ void KyWirelessNetItem::initInfoBySsid()
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
int KyWirelessNetItem::getCategory(QString uni)
|
||||
{
|
||||
|
||||
QDBusInterface interface( "org.freedesktop.NetworkManager", uni, "org.freedesktop.DBus.Properties", QDBusConnection::systemBus() );
|
||||
if (!interface.isValid()) {
|
||||
qDebug() << Q_FUNC_INFO << "dbus is invalid";
|
||||
return -1;
|
||||
}
|
||||
|
||||
QDBusReply<QVariant> reply = interface.call("Get", "org.freedesktop.NetworkManager.AccessPoint", "Category");
|
||||
if (!reply.isValid()) {
|
||||
//qDebug()<<"can not get the attribute 'Category' in func getCategory()";
|
||||
return 0;
|
||||
} else {
|
||||
return reply.value().toInt();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ public:
|
|||
uint m_frequency;
|
||||
QString m_secuType;
|
||||
KySecuType m_kySecuType;
|
||||
QString m_uni;
|
||||
|
||||
//only for m_isConfiged = true
|
||||
bool m_isConfigured;
|
||||
|
@ -34,7 +35,7 @@ public:
|
|||
QString m_connDbusPath;
|
||||
uint m_channel;
|
||||
|
||||
|
||||
int getCategory(QString uni);
|
||||
|
||||
private:
|
||||
KyNetworkResourceManager *m_networkResourceInstance = nullptr;
|
||||
|
|
|
@ -28,6 +28,7 @@ WlanListItem::WlanListItem(KyWirelessNetItem &wirelessNetItem, QString device, Q
|
|||
connect(m_menu, &QMenu::triggered, this, &WlanListItem::onMenuTriggered);
|
||||
|
||||
m_wirelessConnectOperation = new KyWirelessConnectOperation(this);
|
||||
m_deviceResource = new KyNetworkDeviceResourse(this);
|
||||
}
|
||||
|
||||
WlanListItem::WlanListItem(QWidget *parent) : ListItem(parent)
|
||||
|
@ -293,72 +294,107 @@ void WlanListItem::initWlanUI()
|
|||
m_autoConnectFrame->hide();
|
||||
}
|
||||
|
||||
QString getIcon(bool isEncrypted, int signalStrength, int category) {
|
||||
QString iconNameFirst,iconNameLast;
|
||||
if (category == 0){
|
||||
iconNameFirst = "network-wireless-signal-";
|
||||
} else if (category == 1) {
|
||||
iconNameFirst = "ukui-wifi6-";
|
||||
} else {
|
||||
iconNameFirst = "ukui-wifi6+-";
|
||||
}
|
||||
if (!isEncrypted) {
|
||||
//ZJP_TODO 无加密 注意信号格数计算方式,可能需要修改
|
||||
if (signalStrength > EXCELLENT_SIGNAL){
|
||||
if (category == 0) {
|
||||
iconNameLast = "excellent-symbolic";
|
||||
} else {
|
||||
iconNameLast = "full-symbolic";
|
||||
}
|
||||
} else if (signalStrength > GOOD_SIGNAL) {
|
||||
if (category == 0) {
|
||||
iconNameLast = "good-symbolic";
|
||||
} else {
|
||||
iconNameLast = "high-symbolic";
|
||||
}
|
||||
} else if (signalStrength > OK_SIGNAL) {
|
||||
if (category == 0) {
|
||||
iconNameLast = "ok-symbolic";
|
||||
} else {
|
||||
iconNameLast = "medium-symbolic";
|
||||
}
|
||||
} else if (signalStrength > LOW_SIGNAL) {
|
||||
if (category == 0) {
|
||||
iconNameLast = "weak-symbolic";
|
||||
} else {
|
||||
iconNameLast = "low-symbolic";
|
||||
}
|
||||
} else {
|
||||
iconNameLast = "none-symbolic";
|
||||
}
|
||||
} else {
|
||||
if (signalStrength > EXCELLENT_SIGNAL){
|
||||
if (category == 0) {
|
||||
iconNameLast = "excellent-secure-symbolic";
|
||||
} else {
|
||||
iconNameLast = "full-pwd-symbolic";
|
||||
}
|
||||
} else if (signalStrength > GOOD_SIGNAL) {
|
||||
if (category == 0) {
|
||||
iconNameLast = "good-secure-symbolic";
|
||||
} else {
|
||||
iconNameLast = "high-pwd-symbolic";
|
||||
}
|
||||
} else if (signalStrength > OK_SIGNAL) {
|
||||
if (category == 0) {
|
||||
iconNameLast = "ok-secure-symbolic";
|
||||
} else {
|
||||
iconNameLast = "medium-pwd-symbolic";
|
||||
}
|
||||
} else if (signalStrength > LOW_SIGNAL) {
|
||||
if (category == 0) {
|
||||
iconNameLast = "weak-secure-symbolic";
|
||||
} else {
|
||||
iconNameLast = "low-pwd-symbolic";
|
||||
}
|
||||
} else {
|
||||
if (category == 0) {
|
||||
iconNameLast = "none-secure-symbolic";
|
||||
} else {
|
||||
iconNameLast = "none-pwd-symbolic";
|
||||
}
|
||||
}
|
||||
}
|
||||
return iconNameFirst + iconNameLast;
|
||||
}
|
||||
|
||||
void WlanListItem::refreshIcon(bool isActivated)
|
||||
{
|
||||
#define FULL_SIGNAL 5
|
||||
#define EXCELLENT_SIGNAL 4
|
||||
#define GOOD_SIGNAL 3
|
||||
#define OK_SIGNAL 2
|
||||
#define LOW_SIGNAL 1
|
||||
#define STEP 25
|
||||
if (m_isApMode) {
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-hotspot-symbolic", QIcon(":/res/w/wifi-full.png")));
|
||||
m_netButton->setActive(isActivated);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_hasPwd) {
|
||||
//ZJP_TODO 无加密 注意信号格数计算方式,可能需要修改
|
||||
switch (m_wirelessNetItem.m_signalStrength / STEP + 1) {
|
||||
case FULL_SIGNAL:
|
||||
case EXCELLENT_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic",
|
||||
QIcon(":/res/w/wifi-full.png")));
|
||||
break;
|
||||
case GOOD_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-good-symbolic",
|
||||
QIcon(":/res/w/wifi-high.png")));
|
||||
break;
|
||||
case OK_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-ok",
|
||||
QIcon(":/res/w/wifi-medium.png")));
|
||||
break;
|
||||
case LOW_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-low",
|
||||
QIcon(":/res/w/wifi-low.png")));
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Set wlan(without passwd) icon failed, signal = "
|
||||
<< m_wirelessNetItem.m_signalStrength << Q_FUNC_INFO << __LINE__;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
//ZJP_TODO 有加密
|
||||
switch (m_wirelessNetItem.m_signalStrength / STEP + 1) {
|
||||
case FULL_SIGNAL:
|
||||
case EXCELLENT_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-excellent-secure-symbolic",
|
||||
QIcon(":/res/w/wifi-full-pwd.png")));
|
||||
break;
|
||||
case GOOD_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-good-secure-symbolic",
|
||||
QIcon(":/res/w/wifi-high-pwd.png")));
|
||||
break;
|
||||
case OK_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-ok-secure-symbolic",
|
||||
QIcon(":/res/w/wifi-medium-pwd.png")));
|
||||
break;
|
||||
case LOW_SIGNAL:
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-low-secure-symbolic",
|
||||
QIcon(":/res/w/wifi-low-pwd.png")));
|
||||
break;
|
||||
default:
|
||||
qDebug() << "Set wlan(with passwd) icon failed, signal = "
|
||||
<< m_wirelessNetItem.m_signalStrength << Q_FUNC_INFO << __LINE__;
|
||||
break;
|
||||
int category = 0;
|
||||
int signalStrength = 0;
|
||||
QString uni = "";
|
||||
QString secuType = "";
|
||||
category = m_wirelessNetItem.getCategory(m_wirelessNetItem.m_uni);
|
||||
signalStrength = m_wirelessNetItem.m_signalStrength;
|
||||
|
||||
if (isActivated) {
|
||||
if (m_deviceResource->getActiveConnectionInfo(m_wlanDevice, signalStrength, uni, secuType)) {
|
||||
category = m_wirelessNetItem.getCategory(uni);
|
||||
m_hasPwd = (secuType.isEmpty() || secuType == "") ? false : true;
|
||||
}
|
||||
}
|
||||
|
||||
QString iconPath = getIcon(m_hasPwd, signalStrength, category);
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme(iconPath));
|
||||
|
||||
m_netButton->setActive(isActivated);
|
||||
qDebug() << "refreshIcon" << m_wirelessNetItem.m_NetSsid << "isActivated" << isActivated << "path" << iconPath;
|
||||
}
|
||||
|
||||
void WlanListItem::onInfoButtonClicked()
|
||||
|
|
|
@ -18,6 +18,12 @@
|
|||
#define EXPANDED_HEIGHT 120
|
||||
#define PWD_LENGTH_LIMIT 8
|
||||
|
||||
#define EXCELLENT_SIGNAL 80
|
||||
#define GOOD_SIGNAL 55
|
||||
#define OK_SIGNAL 30
|
||||
#define LOW_SIGNAL 5
|
||||
#define NONE_SIGNAL 0
|
||||
|
||||
class WlanListItem : public ListItem
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -65,6 +71,7 @@ private:
|
|||
KyWirelessNetItem m_wirelessNetItem;
|
||||
KyWirelessConnectOperation *m_wirelessConnectOperation = nullptr;
|
||||
EnterpriseWlanDialog *enterpriseWlanDialog = nullptr;
|
||||
KyNetworkDeviceResourse *m_deviceResource = nullptr;
|
||||
|
||||
bool m_hasPwd = true;
|
||||
QString m_wlanDevice;
|
||||
|
|
|
@ -496,7 +496,8 @@ void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item)
|
|||
info << item.m_NetSsid
|
||||
<< QString::number(item.m_signalStrength)
|
||||
<< item.m_secuType
|
||||
<< (m_connectResource->isApConnection(item.m_connectUuid) ? IsApConnection : NotApConnection);
|
||||
<< (m_connectResource->isApConnection(item.m_connectUuid) ? IsApConnection : NotApConnection)
|
||||
<< QString::number(item.getCategory(item.m_uni));
|
||||
emit wlanAdd(interface, info);
|
||||
|
||||
if (interface != m_currentDevice) {
|
||||
|
@ -1180,11 +1181,19 @@ void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
|
|||
QString ssid ="";
|
||||
m_wirelessNetResource->getSsidByUuid(actMap[iter.key()].at(0), ssid);
|
||||
if (m_wirelessNetResource->getWifiNetwork(iter.key(), ssid, data)) {
|
||||
int category = 0;
|
||||
int signalStrength;
|
||||
QString uni,secuType;
|
||||
|
||||
if (m_netDeviceResource->getActiveConnectionInfo(iter.key(), signalStrength, uni, secuType)) {
|
||||
category = data.getCategory(uni);
|
||||
}
|
||||
vector.append(QStringList() << data.m_NetSsid
|
||||
<< QString::number(data.m_signalStrength)
|
||||
<< data.m_secuType
|
||||
<< QString::number(signalStrength)
|
||||
<< secuType
|
||||
<< data.m_connectUuid
|
||||
<< (m_connectResource->isApConnection(data.m_connectUuid) ? IsApConnection : NotApConnection));
|
||||
<< (m_connectResource->isApConnection(data.m_connectUuid) ? IsApConnection : NotApConnection)
|
||||
<< QString::number(category));
|
||||
activeSsid = data.m_NetSsid;
|
||||
} else {
|
||||
vector.append(QStringList("--"));
|
||||
|
@ -1200,7 +1209,8 @@ void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
|
|||
vector.append(QStringList()<<itemData.m_NetSsid
|
||||
<< QString::number(itemData.m_signalStrength)
|
||||
<< itemData.m_secuType
|
||||
<< (m_connectResource->isApConnection(itemData.m_connectUuid) ? IsApConnection : NotApConnection));
|
||||
<< (m_connectResource->isApConnection(itemData.m_connectUuid) ? IsApConnection : NotApConnection)
|
||||
<< QString::number(itemData.getCategory(itemData.m_uni)));
|
||||
}
|
||||
|
||||
map.insert(iter.key(), vector);
|
||||
|
|
Loading…
Reference in New Issue