Update to use Qt 6

ubuntu/oracular ubuntu/24.10.1
Aaron Rainbolt 2 months ago committed by Simon Quigley
parent d8654e743a
commit a1755c8c0a

@ -1,6 +1,6 @@
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_AUTOMOC ON)
@ -12,9 +12,8 @@ set(CMAKE_INSTALL_PREFIX "/")
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 WidgetsAddons)
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Network LinguistTools)
find_package(KF6 REQUIRED COMPONENTS NetworkManagerQt)
file(GLOB TS_FILES "src/translations/lubuntu-installer-prompt_*.ts")
@ -43,8 +42,8 @@ set(PROJECT_SOURCES
set(TRANSLATION_RESOURCES "src/translations.qrc")
configure_file(${TRANSLATION_RESOURCES} translations.qrc COPYONLY)
qt5_add_translation(QM_FILES ${TS_FILES})
qt5_add_resources(QM_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
qt_add_translation(QM_FILES ${TS_FILES})
qt_add_resources(QM_RESOURCES ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
add_custom_target(translations ALL DEPENDS ${QM_FILES})
@ -55,7 +54,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::WidgetsAddons)
target_link_libraries(lubuntu-installer-prompt PRIVATE Qt6::Widgets Qt6::Network KF6::NetworkManagerQt)
install(TARGETS lubuntu-installer-prompt
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
* 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,
debhelper-compat (= 13),
extra-cmake-modules,
libkf5networkmanagerqt-dev,
libkf5widgetsaddons-dev,
qtbase5-dev,
qttools5-dev
libkf6networkmanagerqt-dev,
qt6-base-dev,
qt6-tools-dev
Standards-Version: 4.6.2
Vcs-Browser: https://git.lubuntu.me/Lubuntu/installer-prompt-packaging
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_DESKTOP="Lubuntu"
export DESKTOP_SESSION="Lubuntu"
export QT_STYLE_OVERRIDE="Breeze"
export QT_STYLE_OVERRIDE="kvantum"
export QT_QPA_PLATFORMTHEME="lxqt"
openbox &

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

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

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

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

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

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

Loading…
Cancel
Save