Move to using KLed instead of manually specifying a unicode button.

pull/2/head
Simon Quigley 1 year ago
parent 24a20939a6
commit 38bb3a785b

@ -13,7 +13,7 @@ find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core Widgets Network LinguistTools)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Network LinguistTools)
find_package(KF5 REQUIRED COMPONENTS NetworkManagerQt Notifications)
find_package(KF5 REQUIRED COMPONENTS NetworkManagerQt WidgetsAddons)
set(TS_FILES
src/translations/lubuntu-installer-prompt_en_US.ts
@ -44,7 +44,7 @@ add_executable(lubuntu-installer-prompt
add_dependencies(lubuntu-installer-prompt translations)
target_link_libraries(lubuntu-installer-prompt PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt5::Network KF5::NetworkManagerQt KF5::Notifications)
target_link_libraries(lubuntu-installer-prompt PRIVATE Qt${QT_VERSION_MAJOR}::Widgets Qt5::Network KF5::NetworkManagerQt KF5::WidgetsAddons)
install(TARGETS lubuntu-installer-prompt
BUNDLE DESTINATION .

@ -13,6 +13,7 @@
#include <QMessageBox>
#include <QUuid>
#include <QDBusPendingReply>
#include <KLed>
#include "installerprompt.h"
#include "./ui_installerprompt.h"
@ -79,34 +80,41 @@ InstallerPrompt::InstallerPrompt(QWidget *parent)
void InstallerPrompt::updateConnectionStatus() {
auto status = NetworkManager::status();
bool online = false;
QString statusText, statusIndicator;
QString statusText;
switch (status) {
case NetworkManager::Status::Disconnected:
case NetworkManager::ConnectedLinkLocal:
case NetworkManager::Asleep:
statusText = tr("Not Connected");
statusIndicator = "<span style=\"color: red;\">❌</span> " + statusText;
ui->connectionLED->setColor(Qt::red);
ui->connectionLED->setState(KLed::Off);
break;
case NetworkManager::Status::Connected:
online = true;
statusText = tr("Connected");
statusIndicator = "<span style=\"color: green;\">🟢</span> " + statusText;
ui->connectionLED->setColor(Qt::green);
ui->connectionLED->setState(KLed::On);
break;
case NetworkManager::Status::Connecting:
statusText = tr("Connecting...");
statusIndicator = "<span style=\"color: yellow;\">🟡</span> " + statusText;
ui->connectionLED->setColor(Qt::yellow);
ui->connectionLED->setState(KLed::On);
break;
case NetworkManager::Status::Disconnecting:
statusText = tr("Disconnecting...");
statusIndicator = "<span style=\"color: yellow;\">🟡</span> " + statusText;
ui->connectionLED->setColor(Qt::yellow);
ui->connectionLED->setState(KLed::On);
break;
default:
qDebug() << "Unknown status:" << status;
statusText = tr("Unknown Status");
statusIndicator = "<span style=\"color: grey;\">⚪</span> " + statusText;
ui->connectionLED->setColor(Qt::gray);
ui->connectionLED->setState(KLed::Off);
break;
}
ui->connectionStatusLabel->setText(statusIndicator);
ui->connectionStatusLabel->setText(statusText);
const auto devices = NetworkManager::networkInterfaces();
bool wifiEnabled = false;

@ -172,7 +172,7 @@ QLabel#incorrectPassword {
</layout>
</item>
<item>
<spacer name="verticalSpacer_7">
<spacer name="WiFiSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -185,35 +185,34 @@ QLabel#incorrectPassword {
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="comboBoxLayout">
<item>
<spacer name="comboSpacer1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<layout class="QGridLayout" name="WiFiLayout">
<item row="0" column="3">
<widget class="QPushButton" name="pushButton">
<property name="minimumSize">
<size>
<width>175</width>
<height>65</height>
</size>
</property>
<property name="sizeHint" stdset="0">
<property name="maximumSize">
<size>
<width>40</width>
<height>20</height>
<width>175</width>
<height>65</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>18</pointsize>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Select Your Language:</string>
<string>✅ Confirm</string>
</property>
</widget>
</item>
<item>
<item row="0" column="2">
<widget class="QComboBox" name="languageComboBox">
<property name="minimumSize">
<size>
@ -223,7 +222,7 @@ QLabel#incorrectPassword {
</property>
<property name="maximumSize">
<size>
<width>400</width>
<width>550</width>
<height>50</height>
</size>
</property>
@ -234,76 +233,91 @@ QLabel#incorrectPassword {
</property>
</widget>
</item>
<item>
<spacer name="comboSpacer2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="3" column="2">
<widget class="QLabel" name="incorrectPassword">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="font">
<font>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
</spacer>
<property name="text">
<string>You entered an incorrect password. Please try again.</string>
</property>
</widget>
</item>
</layout>
<item row="4" column="1">
<widget class="QLabel" name="WiFiLabel">
<property name="font">
<font>
<pointsize>18</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Select a Wi-Fi Network:</string>
</property>
</widget>
</item>
<item>
<spacer name="WiFiSpacer">
<item row="5" column="1">
<spacer name="advancedSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="WiFiLayout">
<item row="1" column="3">
<item row="4" column="3">
<widget class="QPushButton" name="connectWiFiButton">
<property name="minimumSize">
<size>
<width>150</width>
<width>175</width>
<height>65</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<width>175</width>
<height>65</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Connect</string>
<string>Connect</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="WiFiInfoLabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<item row="4" column="0">
<spacer name="networkSpacer1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="text">
<string>(For advanced network configuration, select &quot;Try Lubuntu&quot;)</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="1" column="1">
<widget class="QLabel" name="WiFiLabel">
<item row="0" column="1">
<widget class="QLabel" name="translationsLabel">
<property name="font">
<font>
<pointsize>18</pointsize>
@ -312,11 +326,11 @@ QLabel#incorrectPassword {
</font>
</property>
<property name="text">
<string>Select a Wi-Fi Network:</string>
<string>Select Your Language:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<item row="5" column="3">
<spacer name="advancedSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -329,46 +343,20 @@ QLabel#incorrectPassword {
</property>
</spacer>
</item>
<item row="1" column="4">
<spacer name="networkSpacer2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<spacer name="networkSpacer1">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<spacer name="advancedSpacer">
<item row="1" column="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<item row="4" column="2">
<widget class="QComboBox" name="networkComboBox">
<property name="minimumSize">
<size>
@ -389,23 +377,32 @@ QLabel#incorrectPassword {
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="incorrectPassword">
<property name="enabled">
<bool>true</bool>
</property>
<item row="5" column="2">
<widget class="QLabel" name="WiFiInfoLabel">
<property name="font">
<font>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>You entered an incorrect password. Please try again.</string>
<string>(For advanced network configuration, select &quot;Try Lubuntu&quot;)</string>
</property>
</widget>
</item>
<item row="4" column="4">
<spacer name="networkSpacer2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@ -449,19 +446,6 @@ QLabel#incorrectPassword {
</property>
</spacer>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="tryLubuntu">
<property name="minimumSize">
@ -479,7 +463,7 @@ QLabel#incorrectPassword {
<property name="font">
<font>
<family>Ubuntu</family>
<pointsize>24</pointsize>
<pointsize>26</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
@ -526,19 +510,6 @@ QToolTip {
</property>
</spacer>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="installLubuntu">
<property name="minimumSize">
@ -556,7 +527,7 @@ QToolTip {
<property name="font">
<font>
<family>Ubuntu</family>
<pointsize>24</pointsize>
<pointsize>26</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
@ -600,19 +571,6 @@ QToolTip {
</property>
</spacer>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
@ -629,7 +587,7 @@ QToolTip {
</spacer>
</item>
<item>
<spacer name="verticalSpacer_8">
<spacer name="verticalSpacer_9">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -642,7 +600,7 @@ QToolTip {
</spacer>
</item>
<item>
<spacer name="verticalSpacer_9">
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -655,57 +613,65 @@ QToolTip {
</spacer>
</item>
<item>
<spacer name="verticalSpacer_3">
<layout class="QHBoxLayout" name="connectionStatusLayout">
<item>
<spacer name="networkSpacer1_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<spacer name="verticalSpacer_5">
<property name="orientation">
<enum>Qt::Vertical</enum>
<widget class="KLed" name="connectionLED">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeHint" stdset="0">
<property name="minimumSize">
<size>
<width>20</width>
<width>40</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="connectionStatusLayout">
<item>
<spacer name="networkSpacer1_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="state">
<enum>KLed::On</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="shape">
<enum>KLed::Circular</enum>
</property>
</spacer>
<property name="look">
<enum>KLed::Flat</enum>
</property>
<property name="darkFactor">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="connectionStatusLabel">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>24</pointsize>
<pointsize>26</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Connection Status: </string>
<string>Connected</string>
</property>
</widget>
</item>
@ -743,6 +709,13 @@ QToolTip {
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<customwidgets>
<customwidget>
<class>KLed</class>
<extends>QWidget</extends>
<header>kled.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="resource.qrc"/>
</resources>

Loading…
Cancel
Save