diff --git a/CMakeLists.txt b/CMakeLists.txt index 297028858..785b42c02 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -174,6 +174,8 @@ if(WITH_QT6) set(KF_VERSION 5.240) # KDE Neon weirdness # API that was deprecated before Qt 5.15 causes a compile error add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x060400) + # Something to add to filenames for this specific Qt version + set(QT_VERSION_SUFFIX "-qt6") else() message(STATUS "Building Calamares with Qt5") set(qtname "Qt5") @@ -183,6 +185,8 @@ else() set(KF_VERSION 5.78) # API that was deprecated before Qt 5.15 causes a compile error add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050f00) + # Something to add to filenames for this specific Qt version + set(QT_VERSION_SUFFIX "") endif() set(BOOSTPYTHON_VERSION 1.72.0) diff --git a/src/modules/welcomeq/CMakeLists.txt b/src/modules/welcomeq/CMakeLists.txt index 2538dc14b..98b5a1673 100644 --- a/src/modules/welcomeq/CMakeLists.txt +++ b/src/modules/welcomeq/CMakeLists.txt @@ -39,7 +39,7 @@ calamares_add_plugin(welcomeq WelcomeQmlViewStep.cpp ${_welcome}/Config.cpp RESOURCES - welcomeq.qrc + welcomeq${QT_VERSION_SUFFIX}.qrc LINK_PRIVATE_LIBRARIES ${CHECKER_LINK_LIBRARIES} ${qtname}::DBus diff --git a/src/modules/welcomeq/welcomeq-qt6.qml b/src/modules/welcomeq/welcomeq-qt6.qml new file mode 100644 index 000000000..65e43fecf --- /dev/null +++ b/src/modules/welcomeq/welcomeq-qt6.qml @@ -0,0 +1,169 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2020 Adriaan de Groot + * SPDX-FileCopyrightText: 2020 Anke Boersma + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + */ +import io.calamares.core 1.0 +import io.calamares.ui 1.0 + +import QtQuick 2.10 +import QtQuick.Controls 2.10 +import QtQuick.Layouts 1.3 +import QtQuick.Window 2.3 + +// Qt6 requires unversioned imports and other names +import org.kde.kirigami as Kirigami +import Qt5Compat.GraphicalEffects + + +Page +{ + id: welcome + + header: Item { + width: parent.width + height: parent.height + + Text { + id: welcomeTopText + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + horizontalAlignment: Text.AlignHCenter + padding: 20 + // In QML, QString::arg() only takes one argument + text: qsTr("

Welcome to the %1 %2 installer

+

This program will ask you some questions and set up %1 on your computer.

").arg(Branding.string(Branding.ProductName)).arg(Branding.string(Branding.Version)) + } + Image { + id: welcomeImage + anchors.centerIn: parent + // imagePath() returns a full pathname, so make it refer to the filesystem + // .. otherwise the path is interpreted relative to the "call site", which + // .. might be the QRC file. + source: "file:/" + Branding.imagePath(Branding.ProductWelcome) + sourceSize.width: width + sourceSize.height: height + fillMode: Image.PreserveAspectFit + } + + Requirements { + visible: !config.requirementsModel.satisfiedRequirements + } + + RowLayout { + id: buttonBar + width: parent.width / 1.5 + height: 64 + + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + + spacing: Kirigami.Units.largeSpacing* 2 + + Button { + Layout.fillWidth: true + text: qsTr("Support") + icon.name: "system-help" + Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4) + Kirigami.Theme.textColor: Kirigami.Theme.textColor + + visible: config.supportUrl !== "" + onClicked: Qt.openUrlExternally(config.supportUrl) + } + + Button { + Layout.fillWidth: true + text: qsTr("Known issues") + icon.name: "tools-report-bug" + Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4) + Kirigami.Theme.textColor: Kirigami.Theme.textColor + + visible: config.knownIssuesUrl !== "" + onClicked: Qt.openUrlExternally(config.knownIssuesUrl) + } + + Button { + Layout.fillWidth: true + text: qsTr("Release notes") + icon.name: "folder-text" + Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4) + Kirigami.Theme.textColor: Kirigami.Theme.textColor + + visible: config.releaseNotesUrl !== "" + onClicked: load.source = "release_notes.qml" + //onClicked: load.source = "file:/usr/share/calamares/release_notes.qml" + } + + Button { + Layout.fillWidth: true + text: qsTr("Donate") + icon.name: "taxes-finances" + Kirigami.Theme.backgroundColor: Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.4) + Kirigami.Theme.textColor: Kirigami.Theme.textColor + + visible: config.donateUrl !== "" + onClicked: Qt.openUrlExternally(config.donateUrl) + } + } + + RowLayout { + id: languageBar + width: parent.width /1.2 + height: 48 + + anchors.bottom: parent.bottom + anchors.bottomMargin: parent.height /7 + anchors.horizontalCenter: parent.horizontalCenter + spacing: Kirigami.Units.largeSpacing* 4 + + Rectangle { + width: parent.width + Layout.fillWidth: true + focus: true + + Loader { + id: imLoader + + Component { + id: icon + Kirigami.Icon { + source: config.languageIcon + height: 48 + width: 48 + } + } + + Component { + id: image + Image { + height: 48 + fillMode: Image.PreserveAspectFit + source: "img/language-icon-48px.png" + } + } + + sourceComponent: (config.languageIcon != "") ? icon : image + } + + ComboBox { + id: languages + anchors.left: imLoader.right + width: languageBar.width /1.1 + textRole: "label" + currentIndex: config.localeIndex + model: config.languagesModel + onCurrentIndexChanged: config.localeIndex = currentIndex + } + } + } + + Loader { + id:load + anchors.fill: parent + } + } +} diff --git a/src/modules/welcomeq/welcomeq-qt6.qrc b/src/modules/welcomeq/welcomeq-qt6.qrc new file mode 100644 index 000000000..a6a211f03 --- /dev/null +++ b/src/modules/welcomeq/welcomeq-qt6.qrc @@ -0,0 +1,11 @@ + + + welcomeq-qt6.qml + release_notes.qml + Recommended.qml + Requirements.qml + img/squid.png + img/chevron-left-solid.svg + img/language-icon-48px.png + + diff --git a/src/modules/welcomeq/welcomeq.qml b/src/modules/welcomeq/welcomeq.qml index 7c1187c7d..736130bcf 100644 --- a/src/modules/welcomeq/welcomeq.qml +++ b/src/modules/welcomeq/welcomeq.qml @@ -13,9 +13,12 @@ import io.calamares.ui 1.0 import QtQuick 2.10 import QtQuick.Controls 2.10 import QtQuick.Layouts 1.3 +import QtQuick.Window 2.3 + +// Qt5 requires versioned imports +// import org.kde.kirigami 2.7 as Kirigami import QtGraphicalEffects 1.0 -import QtQuick.Window 2.3 Page {