mirror of
https://git.launchpad.net/~ubuntu-qt-code/+git/calamares-settings-ubuntu
synced 2025-03-03 23:31:08 +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
|
||||
SOURCES
|
||||
PackageSelectViewStep.cpp
|
||||
PackageSelectJob.cpp
|
||||
RESOURCES
|
||||
pkgselect.qrc
|
||||
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 "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 >(); )
|
||||
|
@ -1,6 +1,9 @@
|
||||
#ifndef PACKAGESELECTVIEWSTEP_H
|
||||
#define PACKAGESELECTVIEWSTEP_H
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
#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 )
|
||||
|
@ -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")
|
||||
|
@ -54,6 +54,7 @@ sequence:
|
||||
- contextualprocess@after_bootloader
|
||||
- automirror
|
||||
- shellprocess@add386arch
|
||||
- pkgselect
|
||||
- packages
|
||||
- shellprocess@logs
|
||||
- umount
|
||||
|
Loading…
x
Reference in New Issue
Block a user