|
|
|
@ -206,12 +206,37 @@ void WifiUI::refresh() { |
|
|
|
|
int i = 0; |
|
|
|
|
for (Network &network : wifi->seen_networks) { |
|
|
|
|
QHBoxLayout *hlayout = new QHBoxLayout; |
|
|
|
|
hlayout->addSpacing(50); |
|
|
|
|
|
|
|
|
|
QLabel *ssid_label = new QLabel(QString::fromUtf8(network.ssid)); |
|
|
|
|
ssid_label->setStyleSheet("font-size: 55px;"); |
|
|
|
|
hlayout->addWidget(ssid_label, 1, Qt::AlignLeft); |
|
|
|
|
|
|
|
|
|
if (wifi->isKnownNetwork(network.ssid)) { |
|
|
|
|
QPushButton *forgetBtn = new QPushButton(); |
|
|
|
|
QPixmap pix("../assets/offroad/icon_close.svg"); |
|
|
|
|
|
|
|
|
|
forgetBtn->setIcon(QIcon(pix)); |
|
|
|
|
forgetBtn->setIconSize(QSize(35, 35)); |
|
|
|
|
forgetBtn->setStyleSheet("QPushButton { background-color: #E22C2C; }"); |
|
|
|
|
forgetBtn->setFixedSize(100, 90); |
|
|
|
|
|
|
|
|
|
QObject::connect(forgetBtn, &QPushButton::released, [=]() { |
|
|
|
|
if (ConfirmationDialog::confirm("Are you sure you want to forget " + QString::fromUtf8(network.ssid) + "?", this)) { |
|
|
|
|
wifi->forgetConnection(network.ssid); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
hlayout->addWidget(forgetBtn, 0, Qt::AlignRight); |
|
|
|
|
} else if (network.security_type == SecurityType::WPA) { |
|
|
|
|
QLabel *lockIcon = new QLabel(); |
|
|
|
|
QPixmap pix("../assets/offroad/icon_lock_closed.svg"); |
|
|
|
|
lockIcon->setPixmap(pix.scaledToWidth(35, Qt::SmoothTransformation)); |
|
|
|
|
lockIcon->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); |
|
|
|
|
lockIcon->setStyleSheet("QLabel { margin: 0px; padding-left: 15px; padding-right: 15px; }"); |
|
|
|
|
|
|
|
|
|
hlayout->addWidget(lockIcon, 0, Qt::AlignRight); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// strength indicator
|
|
|
|
|
unsigned int strength_scale = network.strength / 17; |
|
|
|
|
hlayout->addWidget(new NetworkStrengthWidget(strength_scale), 0, Qt::AlignRight); |
|
|
|
|