增加热点图标显示
This commit is contained in:
parent
4f2776fb4f
commit
ea753d25f5
|
@ -52,6 +52,8 @@ const QString KWifiLockNone = "network-wireless-secure-signal-none";
|
|||
const QString KLanSymbolic = ":/img/plugins/netconnect/eth.svg";
|
||||
const QString NoNetSymbolic = ":/img/plugins/netconnect/nonet.svg";
|
||||
|
||||
const QString KApSymbolic = "network-wireless-hotspot-symbolic";
|
||||
|
||||
|
||||
#define ACTIVATING 1
|
||||
#define ACTIVATED 2
|
||||
|
@ -324,7 +326,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));
|
||||
updateIcon(frame->itemMap[list.at(0).at(0)], list.at(0).at(1), list.at(0).at(2), list.at(0).at(4));
|
||||
frameIndex ++;
|
||||
}
|
||||
} else {
|
||||
|
@ -358,7 +360,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));
|
||||
updateIcon(frame->itemMap[list.at(listIndex).at(0)], list.at(listIndex).at(1), list.at(listIndex).at(2), list.at(listIndex).at(3));
|
||||
frameIndex++;
|
||||
} else {
|
||||
qDebug() << "not find " << list.at(listIndex).at(0) << " in current list, ignore";
|
||||
|
@ -367,9 +369,10 @@ void WlanConnect::resortWifiList(ItemFrame *frame, QVector<QStringList> list)
|
|||
qDebug() << "resort finish";
|
||||
}
|
||||
|
||||
void WlanConnect::updateIcon(WlanItem *item, QString signalStrength, QString security)
|
||||
void WlanConnect::updateIcon(WlanItem *item, QString signalStrength, QString security, QString isApConnection)
|
||||
{
|
||||
qDebug() << "updateIcon" << item->titileLabel->text();
|
||||
|
||||
int sign = setSignal(signalStrength);
|
||||
bool isLock = true;
|
||||
if (security.isEmpty()) {
|
||||
|
@ -378,7 +381,12 @@ void WlanConnect::updateIcon(WlanItem *item, QString signalStrength, QString sec
|
|||
isLock = true;
|
||||
}
|
||||
|
||||
QString iconamePath = wifiIcon(isLock, sign);
|
||||
QString iconamePath;
|
||||
if (isApConnection == "1") {
|
||||
iconamePath = KApSymbolic;
|
||||
} else {
|
||||
iconamePath = wifiIcon(isLock, sign);
|
||||
}
|
||||
QIcon searchIcon = QIcon::fromTheme(iconamePath);
|
||||
if (iconamePath != KLanSymbolic && iconamePath != NoNetSymbolic) {
|
||||
item->iconLabel->setProperty("useIconHighlightEffect", 0x10);
|
||||
|
@ -587,7 +595,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);
|
||||
addOneWlanFrame(iter.value(), deviceName, wlanInfo.at(0), wlanInfo.at(1), "", isLock, false, WIRELESS_TYPE, wlanInfo.at(3));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -842,7 +850,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);
|
||||
addOneWlanFrame(frame, devName, infoList.at(0), infoList.at(1), infoList.at(3), isLock, true, WIRELESS_TYPE, infoList.at(4));
|
||||
}
|
||||
|
||||
//处理列表 未连接
|
||||
|
@ -857,7 +865,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);
|
||||
addOneWlanFrame(frame, devName, infoList.at(0), infoList.at(1), "", isLock, false, WIRELESS_TYPE, infoList.at(3));
|
||||
}
|
||||
|
||||
//增加设备
|
||||
|
@ -892,24 +900,31 @@ 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)
|
||||
void WlanConnect::addOneWlanFrame(ItemFrame *frame, QString deviceName, QString name, QString signal, QString uuid, bool isLock, bool status, int type, QString isApConnection)
|
||||
{
|
||||
if (nullptr == frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool bApConnection = (isApConnection == "1");
|
||||
|
||||
if (frame->itemMap.contains(name)) {
|
||||
qDebug() << "[WlanConnect]Already exist a wifi " << name << " in " << deviceName;
|
||||
return;
|
||||
}
|
||||
//设置单项的信息
|
||||
int sign = setSignal(signal);
|
||||
QString iconamePath = wifiIcon(isLock, sign);
|
||||
WlanItem * wlanItem = new WlanItem(status, isLock, pluginWidget);
|
||||
QIcon searchIcon = QIcon::fromTheme(iconamePath);
|
||||
WlanItem * wlanItem = new WlanItem(status, isLock, pluginWidget);
|
||||
QString iconamePath;
|
||||
if (bApConnection) {
|
||||
iconamePath = KApSymbolic;
|
||||
} else {
|
||||
iconamePath = wifiIcon(isLock, sign);
|
||||
}
|
||||
if (iconamePath != KLanSymbolic && iconamePath != NoNetSymbolic) {
|
||||
wlanItem->iconLabel->setProperty("useIconHighlightEffect", 0x10);
|
||||
}
|
||||
QIcon searchIcon = QIcon::fromTheme(iconamePath);
|
||||
wlanItem->iconLabel->setPixmap(searchIcon.pixmap(searchIcon.actualSize(QSize(24, 24))));
|
||||
wlanItem->titileLabel->setText(name);
|
||||
if (status) {
|
||||
|
|
|
@ -84,7 +84,7 @@ private:
|
|||
|
||||
|
||||
int sortWlanNet(QString deviceName, QString name, QString signal);
|
||||
void updateIcon(WlanItem *item, QString signalStrength, QString security);
|
||||
void updateIcon(WlanItem *item, QString signalStrength, QString security, QString isApConnection);
|
||||
void resortWifiList(ItemFrame *frame, QVector<QStringList> list);
|
||||
|
||||
|
||||
|
@ -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);
|
||||
void addOneWlanFrame(ItemFrame *frame, QString deviceName, QString name, QString signal, QString uuid, bool isLock, bool status, int type, QString isApConnection);
|
||||
//减少ap
|
||||
void removeOneWlanFrame(ItemFrame *frame, QString deviceName, QString ssid);
|
||||
|
||||
|
|
|
@ -472,7 +472,10 @@ void WlanPage::onWlanAdded(QString interface, KyWirelessNetItem &item)
|
|||
{
|
||||
//for dbus
|
||||
QStringList info;
|
||||
info <<item.m_NetSsid<<QString::number(item.m_signalStrength)<<item.m_secuType;
|
||||
info << item.m_NetSsid
|
||||
<< QString::number(item.m_signalStrength)
|
||||
<< item.m_secuType
|
||||
<< (m_connectResource->isApConnection(item.m_connectUuid) ? "1" : "0");
|
||||
emit wlanAdd(interface, info);
|
||||
|
||||
if (interface != m_currentDevice) {
|
||||
|
@ -1148,8 +1151,11 @@ 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)) {
|
||||
vector.append(QStringList()<<data.m_NetSsid
|
||||
<<QString::number(data.m_signalStrength)<<data.m_secuType<<data.m_connectUuid);
|
||||
vector.append(QStringList() << data.m_NetSsid
|
||||
<< QString::number(data.m_signalStrength)
|
||||
<< data.m_secuType
|
||||
<< data.m_connectUuid
|
||||
<< (m_connectResource->isApConnection(data.m_connectUuid) ? "1" : "0"));
|
||||
activeSsid = data.m_NetSsid;
|
||||
} else {
|
||||
vector.append(QStringList("--"));
|
||||
|
@ -1162,7 +1168,10 @@ void WlanPage::getWirelessList(QMap<QString, QVector<QStringList> > &map)
|
|||
if (itemData.m_NetSsid == activeSsid) {
|
||||
continue;
|
||||
}
|
||||
vector.append(QStringList()<<itemData.m_NetSsid<<QString::number(itemData.m_signalStrength)<<itemData.m_secuType);
|
||||
vector.append(QStringList()<<itemData.m_NetSsid
|
||||
<< QString::number(itemData.m_signalStrength)
|
||||
<< itemData.m_secuType
|
||||
<< (m_connectResource->isApConnection(itemData.m_connectUuid) ? "1" : "0"));
|
||||
}
|
||||
|
||||
map.insert(iter.key(), vector);
|
||||
|
|
Loading…
Reference in New Issue