From ca33c24096c7bd780880c1fd507392e67b43e958 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Fri, 1 Dec 2023 18:50:20 -0600 Subject: [PATCH] Port back to Qt 5. To be consistent in app launching, port back to Qt 5. Also, bump the C++ standard to 23, well, just because, and make the installer prompt display on both monitors, instead of just one. --- CMakeLists.txt | 15 +++++---------- src/installerprompt.cpp | 6 ++++-- src/main.cpp | 28 +++++++++++++++++++++++----- 3 files changed, 32 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43395d6..6b00be3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.22) -project(lubuntu-installer-prompt VERSION 0.3.0 LANGUAGES CXX) +project(lubuntu-installer-prompt VERSION 1.0.0 LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -8,10 +8,10 @@ set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) -set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(Qt6 REQUIRED COMPONENTS Core Widgets) +find_package(Qt5 REQUIRED COMPONENTS Core Widgets) include_directories(${PROJECT_SOURCE_DIR}/src) @@ -21,14 +21,9 @@ file(GLOB PROJECT_SOURCES "${PROJECT_SOURCE_DIR}/src/*.ui" ) -qt_add_executable(lubuntu-installer-prompt - MANUAL_FINALIZATION - ${PROJECT_SOURCES} -) - -target_link_libraries(lubuntu-installer-prompt PRIVATE Qt6::Widgets) +add_executable(lubuntu-installer-prompt ${PROJECT_SOURCES}) -qt_finalize_executable(lubuntu-installer-prompt) +target_link_libraries(lubuntu-installer-prompt Qt5::Widgets) install(TARGETS lubuntu-installer-prompt DESTINATION bin) install(PROGRAMS "scripts/lubuntu-installer" DESTINATION libexec) diff --git a/src/installerprompt.cpp b/src/installerprompt.cpp index 5228c28..dcf1324 100644 --- a/src/installerprompt.cpp +++ b/src/installerprompt.cpp @@ -44,10 +44,12 @@ void InstallerPrompt::installLubuntu() ui->tryLubuntu->setVisible(false); ui->installLubuntu->setVisible(false); QProcess *calamares = new QProcess(this); - calamares->start("/usr/libexec/lubuntu-installer"); + QStringList args; + calamares->start("/usr/libexec/lubuntu-installer", args); // If Calamares exits, it either crashed or the user cancelled the installation. Exit the installer prompt (and start LXQt). - connect(calamares, &QProcess::finished, this, &InstallerPrompt::tryLubuntu); + connect(calamares, static_cast(&QProcess::finished), + this, [this](int, QProcess::ExitStatus){ this->tryLubuntu(); }); } InstallerPrompt::~InstallerPrompt() diff --git a/src/main.cpp b/src/main.cpp index 5caf446..3694e7c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,11 +1,29 @@ #include "installerprompt.h" - #include +#include int main(int argc, char *argv[]) { - QApplication a(argc, argv); - InstallerPrompt w; - w.showFullScreen(); - return a.exec(); + QApplication app(argc, argv); + QList windows; + + // Iterate through all available screens + for (QScreen *screen : QApplication::screens()) { + InstallerPrompt *window = new InstallerPrompt(); + window->setGeometry(screen->geometry()); + window->show(); + windows.append(window); + } + + // Connect signals and slots to synchronize state across windows + for (InstallerPrompt *window : windows) { + for (InstallerPrompt *otherWindow : windows) { + if (window != otherWindow) { + // Connect signals and slots for synchronization + // Example: connect(window, &InstallerPrompt::someSignal, otherWindow, &InstallerPrompt::someSlot); + } + } + } + + return app.exec(); }