ui: grey out unsupported networks (#21753)

* grey out unsupported networks

* show slash icon

* add to qrc
pull/21772/head
sshane 2021-07-28 20:23:48 -07:00 committed by GitHub
parent 38499219f2
commit a34a779ba2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 3 deletions

View File

@ -2,6 +2,7 @@
<qresource>
<file>img_continue_triangle.svg</file>
<file>img_circled_check.svg</file>
<file>img_circled_slash.svg</file>
<file>img_eye_open.svg</file>
<file>img_eye_closed.svg</file>
<file>offroad/icon_lock_closed.svg</file>

View File

@ -0,0 +1,4 @@
<svg width="104" height="104" viewBox="0 0 104 104" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M52 98C77.4051 98 98 77.4051 98 52C98 26.5949 77.4051 6 52 6C26.5949 6 6 26.5949 6 52C6 77.4051 26.5949 98 52 98Z" stroke="#696969" stroke-width="12"/>
<path d="M19 85L85 19" stroke="#696969" stroke-width="12"/>
</svg>

After

Width:  |  Height:  |  Size: 328 B

View File

@ -176,6 +176,7 @@ WifiUI::WifiUI(QWidget *parent, WifiManager* wifi) : QWidget(parent), wifi(wifi)
}
lock = QPixmap(ASSET_PATH + "offroad/icon_lock_closed.svg").scaledToWidth(49, Qt::SmoothTransformation);
checkmark = QPixmap(ASSET_PATH + "offroad/icon_checkmark.svg").scaledToWidth(49, Qt::SmoothTransformation);
circled_slash = QPixmap(ASSET_PATH + "img_circled_slash.svg").scaledToWidth(49, Qt::SmoothTransformation);
QLabel *scanning = new QLabel("Scanning for networks...");
scanning->setStyleSheet("font-size: 65px;");
@ -219,6 +220,9 @@ WifiUI::WifiUI(QWidget *parent, WifiManager* wifi) : QWidget(parent), wifi(wifi)
#ssidLabel[disconnected=false] {
font-weight: 500;
}
#ssidLabel:disabled {
color: #696969;
}
)");
}
@ -245,10 +249,11 @@ void WifiUI::refresh() {
// Clickable SSID label
QPushButton *ssidLabel = new QPushButton(network.ssid);
ssidLabel->setObjectName("ssidLabel");
ssidLabel->setEnabled(network.connected == ConnectedType::DISCONNECTED &&
network.security_type != SecurityType::UNSUPPORTED);
ssidLabel->setEnabled(network.security_type != SecurityType::UNSUPPORTED);
ssidLabel->setProperty("disconnected", network.connected == ConnectedType::DISCONNECTED);
QObject::connect(ssidLabel, &QPushButton::clicked, this, [=]() { emit connectToNetwork(network); });
if (network.connected == ConnectedType::DISCONNECTED) {
QObject::connect(ssidLabel, &QPushButton::clicked, this, [=]() { emit connectToNetwork(network); });
}
hlayout->addWidget(ssidLabel, network.connected == ConnectedType::CONNECTING ? 0 : 1);
if (network.connected == ConnectedType::CONNECTING) {
@ -274,6 +279,10 @@ void WifiUI::refresh() {
QLabel *connectIcon = new QLabel();
connectIcon->setPixmap(checkmark);
hlayout->addWidget(connectIcon, 0, Qt::AlignRight);
} else if (network.security_type == SecurityType::UNSUPPORTED) {
QLabel *unsupportedIcon = new QLabel();
unsupportedIcon->setPixmap(circled_slash);
hlayout->addWidget(unsupportedIcon, 0, Qt::AlignRight);
} else if (network.security_type == SecurityType::WPA) {
QLabel *lockIcon = new QLabel();
lockIcon->setPixmap(lock);

View File

@ -21,6 +21,7 @@ private:
QVBoxLayout* main_layout;
QPixmap lock;
QPixmap checkmark;
QPixmap circled_slash;
QVector<QPixmap> strengths;
signals: