mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
sort ap list by signal
Change-Id: I6c4ba4fe24c166d0fa70d906fd111b77c4a9ded1
This commit is contained in:
parent
69ed8cf322
commit
d6861fdfb2
@ -23,9 +23,9 @@ bool AccessPoint::operator==(const AccessPoint &ap) const
|
||||
return m_ssid == ap.m_ssid;
|
||||
}
|
||||
|
||||
bool AccessPoint::operator<(const AccessPoint &ap) const
|
||||
bool AccessPoint::operator>(const AccessPoint &ap) const
|
||||
{
|
||||
return m_strength < ap.m_strength;
|
||||
return m_strength > ap.m_strength;
|
||||
}
|
||||
|
||||
AccessPoint &AccessPoint::operator=(const AccessPoint &ap)
|
||||
|
@ -12,7 +12,7 @@ public:
|
||||
explicit AccessPoint(const QJsonObject &apInfo);
|
||||
AccessPoint(const AccessPoint &ap);
|
||||
bool operator==(const AccessPoint &ap) const;
|
||||
bool operator<(const AccessPoint &ap) const;
|
||||
bool operator>(const AccessPoint &ap) const;
|
||||
AccessPoint &operator=(const AccessPoint &ap);
|
||||
|
||||
const QString ssid() const;
|
||||
|
@ -112,10 +112,11 @@ void WirelessApplet::APPropertiesChanged(const QString &devPath, const QString &
|
||||
if (it == m_apList.end())
|
||||
return;
|
||||
|
||||
if (*it < ap)
|
||||
return;
|
||||
*it = ap;
|
||||
m_updateAPTimer->start();
|
||||
if (*it > ap)
|
||||
{
|
||||
*it = ap;
|
||||
m_updateAPTimer->start();
|
||||
}
|
||||
}
|
||||
|
||||
void WirelessApplet::updateAPList()
|
||||
@ -129,6 +130,9 @@ void WirelessApplet::updateAPList()
|
||||
delete item;
|
||||
}
|
||||
|
||||
// sort ap list by strength
|
||||
std::sort(m_apList.begin(), m_apList.end(), std::greater<AccessPoint>());
|
||||
|
||||
for (auto ap : m_apList)
|
||||
{
|
||||
AccessPointWidget *apw = new AccessPointWidget(ap);
|
||||
|
@ -69,6 +69,4 @@ void WirelessItem::init()
|
||||
|
||||
m_applet = new WirelessApplet(devPath, this);
|
||||
m_applet->setVisible(false);
|
||||
|
||||
// connect(m_networkManager, &NetworkManager::APPropertiesChanged, this, &WirelessItem::APPropertiesChanegd);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user