mirror of
https://git.launchpad.net/~ubuntu-qt-code/+git/calamares-settings-ubuntu
synced 2025-07-03 04:31:29 +00:00
In another step forward on this ongoing project, connect the view step to a Job, which runs during the installation.
This commit is contained in:
parent
4b847dae69
commit
26e2cbac91
@ -18,6 +18,7 @@ calamares_add_plugin( pkgselect
|
|||||||
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
EXPORT_MACRO PLUGINDLLEXPORT_PRO
|
||||||
SOURCES
|
SOURCES
|
||||||
PackageSelectViewStep.cpp
|
PackageSelectViewStep.cpp
|
||||||
|
PackageSelectJob.cpp
|
||||||
RESOURCES
|
RESOURCES
|
||||||
pkgselect.qrc
|
pkgselect.qrc
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
|
15
common/modules/pkgselect/PackageSelectJob.cpp
Normal file
15
common/modules/pkgselect/PackageSelectJob.cpp
Normal file
@ -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();
|
||||||
|
}
|
9
common/modules/pkgselect/PackageSelectJob.h
Normal file
9
common/modules/pkgselect/PackageSelectJob.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#include <CppJob.h>
|
||||||
|
|
||||||
|
class PackageSelectJob : public Calamares::CppJob
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PackageSelectJob( QObject* parent = nullptr );
|
||||||
|
QString prettyName() const override;
|
||||||
|
Calamares::JobResult exec() override;
|
||||||
|
};
|
@ -1,9 +1,9 @@
|
|||||||
#include "PackageSelectViewStep.h"
|
#include "PackageSelectViewStep.h"
|
||||||
|
#include "PackageSelectJob.h"
|
||||||
|
|
||||||
PackageSelectViewStep::PackageSelectViewStep( QObject* parent )
|
PackageSelectViewStep::PackageSelectViewStep( QObject* parent )
|
||||||
: Calamares::QmlViewStep( parent )
|
: Calamares::QmlViewStep( parent ), m_packageSelections(QVariantMap())
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
PackageSelectViewStep::~PackageSelectViewStep() {}
|
PackageSelectViewStep::~PackageSelectViewStep() {}
|
||||||
|
|
||||||
@ -13,17 +13,36 @@ PackageSelectViewStep::prettyName() const
|
|||||||
return tr( "Package Selection" );
|
return tr( "Package Selection" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Calamares::JobList
|
||||||
|
PackageSelectViewStep::jobs() const
|
||||||
|
{
|
||||||
|
QList< Calamares::job_ptr > list;
|
||||||
|
list.append(Calamares::job_ptr(new PackageSelectJob()));
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PackageSelectViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
PackageSelectViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last
|
Calamares::QmlViewStep::setConfigurationMap( configurationMap );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PackageSelectViewStep::onLeave()
|
PackageSelectViewStep::onActivate()
|
||||||
{
|
{
|
||||||
|
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();
|
Calamares::GlobalStorage* globalStorage = Calamares::JobQueue::instance()->globalStorage();
|
||||||
globalStorage->insert( "item3", 3 );
|
globalStorage->insert("packageSelections", m_packageSelections);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CALAMARES_PLUGIN_FACTORY_DEFINITION( PackageSelectViewStepFactory, registerPlugin< PackageSelectViewStep >(); )
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( PackageSelectViewStepFactory, registerPlugin< PackageSelectViewStep >(); )
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#ifndef PACKAGESELECTVIEWSTEP_H
|
#ifndef PACKAGESELECTVIEWSTEP_H
|
||||||
#define PACKAGESELECTVIEWSTEP_H
|
#define PACKAGESELECTVIEWSTEP_H
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QTextStream>
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
#include "utils/PluginFactory.h"
|
#include "utils/PluginFactory.h"
|
||||||
#include "viewpages/QmlViewStep.h"
|
#include "viewpages/QmlViewStep.h"
|
||||||
@ -11,6 +14,7 @@
|
|||||||
class PLUGINDLLEXPORT PackageSelectViewStep : public Calamares::QmlViewStep
|
class PLUGINDLLEXPORT PackageSelectViewStep : public Calamares::QmlViewStep
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QVariantMap packageSelections READ packageSelections WRITE setPackageSelections NOTIFY packageSelectionsChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PackageSelectViewStep( QObject* parent = nullptr );
|
PackageSelectViewStep( QObject* parent = nullptr );
|
||||||
@ -18,9 +22,20 @@ public:
|
|||||||
|
|
||||||
QString prettyName() const override;
|
QString prettyName() const override;
|
||||||
|
|
||||||
|
Calamares::JobList jobs() const override;
|
||||||
|
|
||||||
void setConfigurationMap( const QVariantMap& configurationMap ) 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 )
|
CALAMARES_PLUGIN_FACTORY_DECLARATION( PackageSelectViewStepFactory )
|
||||||
|
@ -7,6 +7,12 @@ import QtQuick.Layouts 1.3
|
|||||||
import QtQuick.Controls.Material 2.1
|
import QtQuick.Controls.Material 2.1
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
function updatePackageSelections(objectName, checked) {
|
||||||
|
var newMap = JSON.parse(JSON.stringify(packageSelect.packageSelections));
|
||||||
|
newMap[objectName] = checked;
|
||||||
|
packageSelect.packageSelections = newMap;
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
scale: 0.9
|
scale: 0.9
|
||||||
|
|
||||||
@ -29,9 +35,13 @@ Item {
|
|||||||
}
|
}
|
||||||
RadioButton {
|
RadioButton {
|
||||||
text: qsTr("Minimal Installation")
|
text: qsTr("Minimal Installation")
|
||||||
|
objectName: "minimalInstall"
|
||||||
font.pointSize: 12
|
font.pointSize: 12
|
||||||
indicator.width: 20
|
indicator.width: 20
|
||||||
indicator.height: 20
|
indicator.height: 20
|
||||||
|
onClicked: {
|
||||||
|
updatePackageSelections(objectName, checked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Only the desktop environment.")
|
text: qsTr("Only the desktop environment.")
|
||||||
@ -51,10 +61,14 @@ Item {
|
|||||||
font.pointSize: 14
|
font.pointSize: 14
|
||||||
}
|
}
|
||||||
CheckBox {
|
CheckBox {
|
||||||
text: qsTr("Download updates following installation")
|
text: qsTr("Download and install updates following installation")
|
||||||
|
objectName: "updateNow"
|
||||||
font.pointSize: 12
|
font.pointSize: 12
|
||||||
indicator.width: 20
|
indicator.width: 20
|
||||||
indicator.height: 20
|
indicator.height: 20
|
||||||
|
onClicked: {
|
||||||
|
updatePackageSelections(objectName, checked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("This saves time after the installation, and keeps your system secure.")
|
text: qsTr("This saves time after the installation, and keeps your system secure.")
|
||||||
@ -63,9 +77,13 @@ Item {
|
|||||||
}
|
}
|
||||||
CheckBox {
|
CheckBox {
|
||||||
text: qsTr("Install third-party software for graphics, WiFi hardware, and additional media formats")
|
text: qsTr("Install third-party software for graphics, WiFi hardware, and additional media formats")
|
||||||
|
objectName: "restrictedExtras"
|
||||||
font.pointSize: 12
|
font.pointSize: 12
|
||||||
indicator.width: 20
|
indicator.width: 20
|
||||||
indicator.height: 20
|
indicator.height: 20
|
||||||
|
onClicked: {
|
||||||
|
updatePackageSelections(objectName, checked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("This software is subject to license terms included with its documentation, and some may be proprietary.")
|
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
|
font.pointSize: 11
|
||||||
indicator.width: 18
|
indicator.width: 18
|
||||||
indicator.height: 18
|
indicator.height: 18
|
||||||
|
onClicked: {
|
||||||
|
updatePackageSelections(objectName, checked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Matrix-based end-to-end encrypted messenger and secure collaboration app")
|
text: qsTr("Matrix-based end-to-end encrypted messenger and secure collaboration app")
|
||||||
@ -112,6 +133,9 @@ Item {
|
|||||||
font.pointSize: 11
|
font.pointSize: 11
|
||||||
indicator.width: 18
|
indicator.width: 18
|
||||||
indicator.height: 18
|
indicator.height: 18
|
||||||
|
onClicked: {
|
||||||
|
updatePackageSelections(objectName, checked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Email, newsfeed, chat, and calendaring client")
|
text: qsTr("Email, newsfeed, chat, and calendaring client")
|
||||||
@ -124,6 +148,9 @@ Item {
|
|||||||
font.pointSize: 11
|
font.pointSize: 11
|
||||||
indicator.width: 18
|
indicator.width: 18
|
||||||
indicator.height: 18
|
indicator.height: 18
|
||||||
|
onClicked: {
|
||||||
|
updatePackageSelections(objectName, checked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Code editor redefined and optimized for building and debugging modern web and cloud applications")
|
text: qsTr("Code editor redefined and optimized for building and debugging modern web and cloud applications")
|
||||||
@ -136,6 +163,9 @@ Item {
|
|||||||
font.pointSize: 11
|
font.pointSize: 11
|
||||||
indicator.width: 18
|
indicator.width: 18
|
||||||
indicator.height: 18
|
indicator.height: 18
|
||||||
|
onClicked: {
|
||||||
|
updatePackageSelections(objectName, checked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Desktop user interface for managing virtual machines through libvirt")
|
text: qsTr("Desktop user interface for managing virtual machines through libvirt")
|
||||||
@ -148,6 +178,9 @@ Item {
|
|||||||
font.pointSize: 11
|
font.pointSize: 11
|
||||||
indicator.width: 18
|
indicator.width: 18
|
||||||
indicator.height: 18
|
indicator.height: 18
|
||||||
|
onClicked: {
|
||||||
|
updatePackageSelections(objectName, checked);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: qsTr("Graphics editor designed primarily for digital art and 2D animation")
|
text: qsTr("Graphics editor designed primarily for digital art and 2D animation")
|
||||||
|
@ -54,6 +54,7 @@ sequence:
|
|||||||
- contextualprocess@after_bootloader
|
- contextualprocess@after_bootloader
|
||||||
- automirror
|
- automirror
|
||||||
- shellprocess@add386arch
|
- shellprocess@add386arch
|
||||||
|
- pkgselect
|
||||||
- packages
|
- packages
|
||||||
- shellprocess@logs
|
- shellprocess@logs
|
||||||
- umount
|
- umount
|
||||||
|
Loading…
x
Reference in New Issue
Block a user