Compare commits

...

1 Commits

Author SHA1 Message Date
Aaron Rainbolt a1755c8c0a Update to use Qt 6
2 months ago

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(lubuntu-installer-prompt VERSION 1.1.2 LANGUAGES CXX) project(lubuntu-installer-prompt VERSION 2.0.0 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
@ -12,9 +12,8 @@ set(CMAKE_INSTALL_PREFIX "/")
find_package(ECM REQUIRED NO_MODULE) 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(Qt6 REQUIRED COMPONENTS Core Widgets Network LinguistTools)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets Network LinguistTools) find_package(KF6 REQUIRED COMPONENTS NetworkManagerQt)
find_package(KF5 REQUIRED COMPONENTS NetworkManagerQt WidgetsAddons)
file(GLOB TS_FILES "src/translations/lubuntu-installer-prompt_*.ts") file(GLOB TS_FILES "src/translations/lubuntu-installer-prompt_*.ts")
@ -43,8 +42,8 @@ set(PROJECT_SOURCES
set(TRANSLATION_RESOURCES "src/translations.qrc") set(TRANSLATION_RESOURCES "src/translations.qrc")
configure_file(${TRANSLATION_RESOURCES} translations.qrc COPYONLY) configure_file(${TRANSLATION_RESOURCES} translations.qrc COPYONLY)
qt5_add_translation(QM_FILES ${TS_FILES}) qt_add_translation(QM_FILES ${TS_FILES})
qt5_add_resources(QM_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc) qt_add_resources(QM_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
add_custom_target(translations ALL DEPENDS ${QM_FILES}) add_custom_target(translations ALL DEPENDS ${QM_FILES})
@ -55,7 +54,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::WidgetsAddons) target_link_libraries(lubuntu-installer-prompt PRIVATE Qt6::Widgets Qt6::Network KF6::NetworkManagerQt)
install(TARGETS lubuntu-installer-prompt install(TARGETS lubuntu-installer-prompt
BUNDLE DESTINATION . BUNDLE DESTINATION .

9
debian/changelog vendored

@ -1,3 +1,12 @@
lubuntu-installer-prompt (24.10.1) oracular; urgency=medium
* Update to use Qt 6.
* Fix the weird horizontal line at the bottom of the screen. (LP: #2081229)
* Update background image. (LP: #2081230)
* Use Kvantum theme by default to match the OS default. (LP: #2081233)
-- Aaron Rainbolt <arraybolt3@ubuntu.com> Tue, 01 Oct 2024 09:30:57 -0500
lubuntu-installer-prompt (24.04.6) noble; urgency=medium lubuntu-installer-prompt (24.04.6) noble; urgency=medium
* Launch Calamares in OEM mode when "oem-config/enable=true" is passed as a * Launch Calamares in OEM mode when "oem-config/enable=true" is passed as a

7
debian/control vendored

@ -7,10 +7,9 @@ Priority: optional
Build-Depends: cmake, Build-Depends: cmake,
debhelper-compat (= 13), debhelper-compat (= 13),
extra-cmake-modules, extra-cmake-modules,
libkf5networkmanagerqt-dev, libkf6networkmanagerqt-dev,
libkf5widgetsaddons-dev, qt6-base-dev,
qtbase5-dev, qt6-tools-dev
qttools5-dev
Standards-Version: 4.6.2 Standards-Version: 4.6.2
Vcs-Browser: https://git.lubuntu.me/Lubuntu/installer-prompt-packaging Vcs-Browser: https://git.lubuntu.me/Lubuntu/installer-prompt-packaging
Vcs-Git: https://git.lubuntu.me/Lubuntu/installer-prompt-packaging.git Vcs-Git: https://git.lubuntu.me/Lubuntu/installer-prompt-packaging.git

@ -7,7 +7,7 @@ export XDG_DATA_DIRS="/usr/share/Lubuntu:"$XDG_DATA_DIRS
export XDG_SESSION_CLASS="user" export XDG_SESSION_CLASS="user"
export XDG_SESSION_DESKTOP="Lubuntu" export XDG_SESSION_DESKTOP="Lubuntu"
export DESKTOP_SESSION="Lubuntu" export DESKTOP_SESSION="Lubuntu"
export QT_STYLE_OVERRIDE="Breeze" export QT_STYLE_OVERRIDE="kvantum"
export QT_QPA_PLATFORMTHEME="lxqt" export QT_QPA_PLATFORMTHEME="lxqt"
openbox & openbox &

@ -3,6 +3,7 @@
#include <QMessageBox> #include <QMessageBox>
#include <QGuiApplication> #include <QGuiApplication>
#include <QScreen> #include <QScreen>
#include <QPainter>
BackgroundScreen::BackgroundScreen(QWidget *parent) BackgroundScreen::BackgroundScreen(QWidget *parent)
: QWidget(parent) { : QWidget(parent) {
@ -16,25 +17,27 @@ BackgroundScreen::~BackgroundScreen()
void BackgroundScreen::activateBackground() void BackgroundScreen::activateBackground()
{ {
// Set the background image and scale it // Set the background image and scale it
QImage image(":/background"); QImage rawImage(":/background");
if (image.isNull()) { if (rawImage.isNull()) {
return; return;
} }
qreal imgRatio = static_cast<qreal>(image.width()) / image.height(); qreal imgRatio = static_cast<qreal>(rawImage.width()) / rawImage.height();
qreal screenRatio = static_cast<qreal>(this->width()) / this->height(); qreal screenRatio = static_cast<qreal>(this->width()) / this->height();
QImage scaled; QImage scaled;
if (imgRatio < screenRatio) { if (imgRatio < screenRatio) {
scaled = image.scaledToWidth(this->width(), Qt::SmoothTransformation); scaled = rawImage.scaledToWidth(this->width(), Qt::SmoothTransformation);
int yGap = (scaled.height() - this->height()) / 2; int yGap = (scaled.height() - this->height()) / 2;
scaled = scaled.copy(0, yGap, scaled.width(), this->height()); scaled = scaled.copy(0, yGap, scaled.width(), this->height());
} else { } else {
scaled = image.scaledToHeight(this->height(), Qt::SmoothTransformation); scaled = rawImage.scaledToHeight(this->height(), Qt::SmoothTransformation);
int xGap = (scaled.width() - this->width()) / 2; int xGap = (scaled.width() - this->width()) / 2;
scaled = scaled.copy(xGap, 0, this->width(), scaled.height()); scaled = scaled.copy(xGap, 0, this->width(), scaled.height());
} }
QPixmap bg = QPixmap::fromImage(scaled); background = scaled;
QPalette palette; }
palette.setBrush(QPalette::Window, bg);
this->setPalette(palette); void BackgroundScreen::paintEvent(QPaintEvent *event) {
QPainter painter(this);
painter.drawImage(0, 0, background);
} }

@ -10,6 +10,10 @@ public:
explicit BackgroundScreen(QWidget *parent = nullptr); explicit BackgroundScreen(QWidget *parent = nullptr);
virtual ~BackgroundScreen(); virtual ~BackgroundScreen();
void activateBackground(); void activateBackground();
private:
void paintEvent(QPaintEvent *event) override;
QImage background;
}; };
#endif // BACKGROUNDSCREEN_H #endif // BACKGROUNDSCREEN_H

@ -29,6 +29,7 @@
#include <QTimer> #include <QTimer>
#include <QFile> #include <QFile>
#include <QUuid> #include <QUuid>
#include <QPainter>
#include <QDBusPendingReply> #include <QDBusPendingReply>
#include "installerprompt.h" #include "installerprompt.h"
#include "wifipassworddialog.h" #include "wifipassworddialog.h"
@ -75,28 +76,25 @@ InstallerPrompt::~InstallerPrompt()
void InstallerPrompt::activateBackground() void InstallerPrompt::activateBackground()
{ {
// Set the background image and scale it // Set the background image and scale it
QImage image(":/background"); QImage rawImage(":/background");
if (image.isNull()) { if (rawImage.isNull()) {
WarningDialog::showWarning(tr("Background image cannot be loaded.")); WarningDialog::showWarning(tr("Background image cannot be loaded."));
return; return;
} }
qreal imgRatio = static_cast<qreal>(image.width()) / image.height(); qreal imgRatio = static_cast<qreal>(rawImage.width()) / rawImage.height();
qreal screenRatio = static_cast<qreal>(this->width()) / this->height(); qreal screenRatio = static_cast<qreal>(this->width()) / this->height();
QImage scaled; QImage scaled;
if (imgRatio < screenRatio) { if (imgRatio < screenRatio) {
scaled = image.scaledToWidth(this->width(), Qt::SmoothTransformation); scaled = rawImage.scaledToWidth(this->width(), Qt::SmoothTransformation);
int yGap = (scaled.height() - this->height()) / 2; int yGap = (scaled.height() - this->height()) / 2;
scaled = scaled.copy(0, yGap, scaled.width(), this->height()); scaled = scaled.copy(0, yGap, scaled.width(), this->height());
} else { } else {
scaled = image.scaledToHeight(this->height(), Qt::SmoothTransformation); scaled = rawImage.scaledToHeight(this->height(), Qt::SmoothTransformation);
int xGap = (scaled.width() - this->width()) / 2; int xGap = (scaled.width() - this->width()) / 2;
scaled = scaled.copy(xGap, 0, this->width(), scaled.height()); scaled = scaled.copy(xGap, 0, this->width(), scaled.height());
} }
QPixmap bg = QPixmap::fromImage(scaled); background = scaled;
QPalette palette;
palette.setBrush(QPalette::Window, bg);
this->setPalette(palette);
} }
void InstallerPrompt::onTryClicked() void InstallerPrompt::onTryClicked()
@ -175,7 +173,7 @@ void InstallerPrompt::onNetworkSelected(int index)
QString networkId = ui->networkComboBox->itemData(index).toString(); QString networkId = ui->networkComboBox->itemData(index).toString();
if (!networkId.isNull()) { if (!networkId.isNull()) {
if (networkId.left(4) == "UNI_") { // this is an Ethernet device if (networkId.left(4) == "UNI_") { // this is an Ethernet device
QString deviceUni = networkId.right(networkId.count() - 4); QString deviceUni = networkId.right(networkId.length() - 4);
NetworkManager::WiredDevice wiredDevice(deviceUni); NetworkManager::WiredDevice wiredDevice(deviceUni);
QDBusPendingReply reply = wiredDevice.disconnectInterface(); QDBusPendingReply reply = wiredDevice.disconnectInterface();
reply.waitForFinished(); reply.waitForFinished();
@ -430,9 +428,9 @@ QString InstallerPrompt::getDisplayNameForLocale(const QLocale &locale) {
QLocale currentAppLocale = QLocale::system(); QLocale currentAppLocale = QLocale::system();
QString nativeName = locale.nativeLanguageName(); QString nativeName = locale.nativeLanguageName();
QString nativeCountryName = sanitize(locale.nativeCountryName()); QString nativeCountryName = sanitize(locale.nativeTerritoryName());
QString englishLanguageName = currentAppLocale.languageToString(locale.language()); QString englishLanguageName = currentAppLocale.languageToString(locale.language());
QString englishCountryName = sanitize(currentAppLocale.countryToString(locale.country())); QString englishCountryName = sanitize(currentAppLocale.territoryToString(locale.territory()));
if (nativeName.isEmpty() || nativeCountryName.isEmpty()) { if (nativeName.isEmpty() || nativeCountryName.isEmpty()) {
return QString(); return QString();
@ -452,3 +450,8 @@ QString InstallerPrompt::getDisplayNameForLocale(const QLocale &locale) {
return displayName; return displayName;
} }
void InstallerPrompt::paintEvent(QPaintEvent *event) {
QPainter painter(this);
painter.drawImage(0, 0, background);
}

@ -10,6 +10,7 @@
#include <QMutex> #include <QMutex>
#include <QLineEdit> #include <QLineEdit>
#include <QProcess> #include <QProcess>
#include <QImage>
#include <NetworkManagerQt/Device> #include <NetworkManagerQt/Device>
#include <NetworkManagerQt/WirelessDevice> #include <NetworkManagerQt/WirelessDevice>
#include <NetworkManagerQt/WiredDevice> #include <NetworkManagerQt/WiredDevice>
@ -45,10 +46,12 @@ private:
bool wifiWrongHandling = false; bool wifiWrongHandling = false;
QMap<QString, QString> languageLocaleMap; QMap<QString, QString> languageLocaleMap;
bool firstUpdateConnectionInfoCall = true; bool firstUpdateConnectionInfoCall = true;
void paintEvent(QPaintEvent *event) override;
void initLanguageComboBox(); void initLanguageComboBox();
QStringList getAvailableLanguages(); QStringList getAvailableLanguages();
QString getDisplayNameForLocale(const QLocale &locale); QString getDisplayNameForLocale(const QLocale &locale);
QImage background;
}; };
#endif // INSTALLERPROMPT_H #endif // INSTALLERPROMPT_H

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1450</width> <width>1450</width>
<height>710</height> <height>604</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@ -19,6 +19,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Try or Install Lubuntu</string> <string>Try or Install Lubuntu</string>
</property> </property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QWidget { <string notr="true">QWidget {
color: #000000; color: #000000;
@ -515,7 +518,6 @@ QToolTip {
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QStatusBar" name="statusbar"/>
</widget> </widget>
<resources> <resources>
<include location="resource.qrc"/> <include location="resource.qrc"/>

@ -43,12 +43,14 @@ int main(int argc, char *argv[])
w->setGeometry(screen->geometry()); w->setGeometry(screen->geometry());
w->activateBackground(); w->activateBackground();
w->showFullScreen(); w->showFullScreen();
w->repaint();
continue; continue;
} }
BackgroundScreen *backscreen = new BackgroundScreen(); BackgroundScreen *backscreen = new BackgroundScreen();
backscreen->setGeometry(screen->geometry()); backscreen->setGeometry(screen->geometry());
backscreen->activateBackground(); backscreen->activateBackground();
backscreen->showFullScreen(); backscreen->showFullScreen();
backscreen->repaint();
bss.append(backscreen); bss.append(backscreen);
} }

Loading…
Cancel
Save