diff --git a/common/modules/pkgselect/CMakeLists.txt b/common/modules/pkgselect/CMakeLists.txt index 4ca8a25..57f592a 100644 --- a/common/modules/pkgselect/CMakeLists.txt +++ b/common/modules/pkgselect/CMakeLists.txt @@ -18,6 +18,7 @@ calamares_add_plugin( pkgselect EXPORT_MACRO PLUGINDLLEXPORT_PRO SOURCES PackageSelectViewStep.cpp + PackageSelectJob.cpp RESOURCES pkgselect.qrc SHARED_LIB diff --git a/common/modules/pkgselect/PackageSelectJob.cpp b/common/modules/pkgselect/PackageSelectJob.cpp new file mode 100644 index 0000000..9bec37b --- /dev/null +++ b/common/modules/pkgselect/PackageSelectJob.cpp @@ -0,0 +1,15 @@ +#include "PackageSelectJob.h" + +PackageSelectJob::PackageSelectJob( QObject* parent ) + : CppJob( parent ) +{} + +QString PackageSelectJob::prettyName() const +{ + return tr( "Package Selection Job" ); +} + +Calamares::JobResult PackageSelectJob::exec() +{ + return Calamares::JobResult::ok(); +} diff --git a/common/modules/pkgselect/PackageSelectJob.h b/common/modules/pkgselect/PackageSelectJob.h new file mode 100644 index 0000000..0a0ffc5 --- /dev/null +++ b/common/modules/pkgselect/PackageSelectJob.h @@ -0,0 +1,9 @@ +#include + +class PackageSelectJob : public Calamares::CppJob +{ +public: + PackageSelectJob( QObject* parent = nullptr ); + QString prettyName() const override; + Calamares::JobResult exec() override; +}; diff --git a/common/modules/pkgselect/PackageSelectViewStep.cpp b/common/modules/pkgselect/PackageSelectViewStep.cpp index 8cab8b0..918d9d8 100644 --- a/common/modules/pkgselect/PackageSelectViewStep.cpp +++ b/common/modules/pkgselect/PackageSelectViewStep.cpp @@ -1,9 +1,9 @@ #include "PackageSelectViewStep.h" +#include "PackageSelectJob.h" PackageSelectViewStep::PackageSelectViewStep( QObject* parent ) - : Calamares::QmlViewStep( parent ) -{ -} + : Calamares::QmlViewStep( parent ), m_packageSelections(QVariantMap()) +{} PackageSelectViewStep::~PackageSelectViewStep() {} @@ -13,17 +13,36 @@ PackageSelectViewStep::prettyName() const return tr( "Package Selection" ); } +Calamares::JobList +PackageSelectViewStep::jobs() const +{ + QList< Calamares::job_ptr > list; + list.append(Calamares::job_ptr(new PackageSelectJob())); + + return list; +} + void PackageSelectViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { - Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last + Calamares::QmlViewStep::setConfigurationMap( configurationMap ); } void -PackageSelectViewStep::onLeave() +PackageSelectViewStep::onActivate() { - Calamares::GlobalStorage* globalStorage = Calamares::JobQueue::instance()->globalStorage(); - globalStorage->insert( "item3", 3 ); + setContextProperty("packageSelect", this); +} + +void PackageSelectViewStep::setPackageSelections(const QVariantMap &value) +{ + if (m_packageSelections != value) { + m_packageSelections = value; + emit packageSelectionsChanged(); + + Calamares::GlobalStorage* globalStorage = Calamares::JobQueue::instance()->globalStorage(); + globalStorage->insert("packageSelections", m_packageSelections); + } } CALAMARES_PLUGIN_FACTORY_DEFINITION( PackageSelectViewStepFactory, registerPlugin< PackageSelectViewStep >(); ) diff --git a/common/modules/pkgselect/PackageSelectViewStep.h b/common/modules/pkgselect/PackageSelectViewStep.h index e6ca32c..fa0dbdd 100644 --- a/common/modules/pkgselect/PackageSelectViewStep.h +++ b/common/modules/pkgselect/PackageSelectViewStep.h @@ -1,6 +1,9 @@ #ifndef PACKAGESELECTVIEWSTEP_H #define PACKAGESELECTVIEWSTEP_H +#include +#include + #include "DllMacro.h" #include "utils/PluginFactory.h" #include "viewpages/QmlViewStep.h" @@ -11,6 +14,7 @@ class PLUGINDLLEXPORT PackageSelectViewStep : public Calamares::QmlViewStep { Q_OBJECT + Q_PROPERTY(QVariantMap packageSelections READ packageSelections WRITE setPackageSelections NOTIFY packageSelectionsChanged) public: PackageSelectViewStep( QObject* parent = nullptr ); @@ -18,9 +22,20 @@ public: QString prettyName() const override; + Calamares::JobList jobs() const override; + void setConfigurationMap( const QVariantMap& configurationMap ) override; - void onLeave() override; + void onActivate() override; + + QVariantMap packageSelections() const { return m_packageSelections; } + void setPackageSelections(const QVariantMap &value); + +signals: + void packageSelectionsChanged(); + +private: + QVariantMap m_packageSelections; }; CALAMARES_PLUGIN_FACTORY_DECLARATION( PackageSelectViewStepFactory ) diff --git a/common/modules/pkgselect/pkgselect.qml b/common/modules/pkgselect/pkgselect.qml index 0e721ff..3cdc920 100644 --- a/common/modules/pkgselect/pkgselect.qml +++ b/common/modules/pkgselect/pkgselect.qml @@ -7,6 +7,12 @@ import QtQuick.Layouts 1.3 import QtQuick.Controls.Material 2.1 Item { + function updatePackageSelections(objectName, checked) { + var newMap = JSON.parse(JSON.stringify(packageSelect.packageSelections)); + newMap[objectName] = checked; + packageSelect.packageSelections = newMap; + } + ColumnLayout { scale: 0.9 @@ -29,9 +35,13 @@ Item { } RadioButton { text: qsTr("Minimal Installation") + objectName: "minimalInstall" font.pointSize: 12 indicator.width: 20 indicator.height: 20 + onClicked: { + updatePackageSelections(objectName, checked); + } } Text { text: qsTr("Only the desktop environment.") @@ -51,10 +61,14 @@ Item { font.pointSize: 14 } CheckBox { - text: qsTr("Download updates following installation") + text: qsTr("Download and install updates following installation") + objectName: "updateNow" font.pointSize: 12 indicator.width: 20 indicator.height: 20 + onClicked: { + updatePackageSelections(objectName, checked); + } } Text { text: qsTr("This saves time after the installation, and keeps your system secure.") @@ -63,9 +77,13 @@ Item { } CheckBox { text: qsTr("Install third-party software for graphics, WiFi hardware, and additional media formats") + objectName: "restrictedExtras" font.pointSize: 12 indicator.width: 20 indicator.height: 20 + onClicked: { + updatePackageSelections(objectName, checked); + } } Text { text: qsTr("This software is subject to license terms included with its documentation, and some may be proprietary.") @@ -100,6 +118,9 @@ Item { font.pointSize: 11 indicator.width: 18 indicator.height: 18 + onClicked: { + updatePackageSelections(objectName, checked); + } } Text { text: qsTr("Matrix-based end-to-end encrypted messenger and secure collaboration app") @@ -112,6 +133,9 @@ Item { font.pointSize: 11 indicator.width: 18 indicator.height: 18 + onClicked: { + updatePackageSelections(objectName, checked); + } } Text { text: qsTr("Email, newsfeed, chat, and calendaring client") @@ -124,6 +148,9 @@ Item { font.pointSize: 11 indicator.width: 18 indicator.height: 18 + onClicked: { + updatePackageSelections(objectName, checked); + } } Text { text: qsTr("Code editor redefined and optimized for building and debugging modern web and cloud applications") @@ -136,6 +163,9 @@ Item { font.pointSize: 11 indicator.width: 18 indicator.height: 18 + onClicked: { + updatePackageSelections(objectName, checked); + } } Text { text: qsTr("Desktop user interface for managing virtual machines through libvirt") @@ -148,6 +178,9 @@ Item { font.pointSize: 11 indicator.width: 18 indicator.height: 18 + onClicked: { + updatePackageSelections(objectName, checked); + } } Text { text: qsTr("Graphics editor designed primarily for digital art and 2D animation") diff --git a/lubuntu/settings.conf b/lubuntu/settings.conf index dbfb9f2..b58554b 100644 --- a/lubuntu/settings.conf +++ b/lubuntu/settings.conf @@ -54,6 +54,7 @@ sequence: - contextualprocess@after_bootloader - automirror - shellprocess@add386arch + - pkgselect - packages - shellprocess@logs - umount