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

pull/2/head
Simon Quigley 5 months ago
parent 24a20939a6
commit 38bb3a785b

@ -13,7 +13,7 @@ find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core Widgets Network LinguistTools) 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(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 set(TS_FILES
src/translations/lubuntu-installer-prompt_en_US.ts src/translations/lubuntu-installer-prompt_en_US.ts
@ -44,7 +44,7 @@ add_executable(lubuntu-installer-prompt
add_dependencies(lubuntu-installer-prompt translations) 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 install(TARGETS lubuntu-installer-prompt
BUNDLE DESTINATION . BUNDLE DESTINATION .

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

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

Loading…
Cancel
Save