mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
mark current active accesspoint as hilight
Change-Id: Iba8ae4a1d7198979e0699d57b37488f073b29042
This commit is contained in:
parent
d4d6f58a58
commit
553c666770
@ -32,7 +32,7 @@ AccessPoint::AccessPoint()
|
||||
|
||||
bool AccessPoint::operator==(const AccessPoint &ap) const
|
||||
{
|
||||
return m_ssid == ap.m_ssid;
|
||||
return m_path == ap.m_path;
|
||||
}
|
||||
|
||||
bool AccessPoint::operator>(const AccessPoint &ap) const
|
||||
|
@ -6,6 +6,7 @@
|
||||
AccessPointWidget::AccessPointWidget(const AccessPoint &ap)
|
||||
: QWidget(nullptr),
|
||||
|
||||
m_ap(ap),
|
||||
m_ssid(new QLabel),
|
||||
m_securityIcon(new QLabel),
|
||||
m_strengthIcon(new QLabel)
|
||||
@ -34,6 +35,19 @@ AccessPointWidget::AccessPointWidget(const AccessPoint &ap)
|
||||
setLayout(centeralLayout);
|
||||
}
|
||||
|
||||
void AccessPointWidget::setActive(const bool active)
|
||||
{
|
||||
if (m_active == active)
|
||||
return;
|
||||
|
||||
m_active = active;
|
||||
|
||||
if (m_active)
|
||||
m_ssid->setStyleSheet("color:#2c8cde;");
|
||||
else
|
||||
m_ssid->setStyleSheet("color:white;");
|
||||
}
|
||||
|
||||
void AccessPointWidget::setStrengthIcon(const int strength)
|
||||
{
|
||||
if (strength == 100)
|
||||
|
@ -13,10 +13,15 @@ class AccessPointWidget : public QWidget
|
||||
public:
|
||||
explicit AccessPointWidget(const AccessPoint &ap);
|
||||
|
||||
void setActive(const bool active);
|
||||
|
||||
private:
|
||||
void setStrengthIcon(const int strength);
|
||||
|
||||
private:
|
||||
bool m_active;
|
||||
|
||||
AccessPoint m_ap;
|
||||
QLabel *m_ssid;
|
||||
QLabel *m_securityIcon;
|
||||
QLabel *m_strengthIcon;
|
||||
|
@ -130,14 +130,21 @@ void WirelessApplet::APPropertiesChanged(const QString &devPath, const QString &
|
||||
if (it == m_apList.end())
|
||||
return;
|
||||
|
||||
if (*it > ap)
|
||||
*it = ap;
|
||||
if (m_activeAP == ap)
|
||||
{
|
||||
*it = ap;
|
||||
m_activeAP = ap;
|
||||
m_updateAPTimer->start();
|
||||
|
||||
emit activeAPChanged();
|
||||
}
|
||||
|
||||
// if (*it > ap)
|
||||
// {
|
||||
// *it = ap;
|
||||
// m_activeAP = ap;
|
||||
// m_updateAPTimer->start();
|
||||
|
||||
// emit activeAPChanged();
|
||||
// }
|
||||
}
|
||||
|
||||
void WirelessApplet::updateAPList()
|
||||
@ -161,6 +168,8 @@ void WirelessApplet::updateAPList()
|
||||
for (auto ap : m_apList)
|
||||
{
|
||||
AccessPointWidget *apw = new AccessPointWidget(ap);
|
||||
if (ap == m_activeAP)
|
||||
apw->setActive(true);
|
||||
m_centeralLayout->addWidget(apw);
|
||||
|
||||
++avaliableAPCount;
|
||||
|
Loading…
x
Reference in New Issue
Block a user