Merge branch '3.1.x-stable'
This commit is contained in:
commit
62c03d6857
@ -120,7 +120,7 @@ LocaleViewStep::fetchGeoIpTimezone()
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
YAML::Node doc = YAML::Load( reply->readAll() );
|
YAML::Node doc = YAML::Load( data );
|
||||||
|
|
||||||
QVariant var = CalamaresUtils::yamlToVariant( doc );
|
QVariant var = CalamaresUtils::yamlToVariant( doc );
|
||||||
if ( !var.isNull() &&
|
if ( !var.isNull() &&
|
||||||
|
@ -57,14 +57,6 @@ NetInstallPage::NetInstallPage( QWidget* parent )
|
|||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
NetInstallPage::isReady()
|
|
||||||
{
|
|
||||||
// nothing to wait for, the data are immediately ready
|
|
||||||
// if the user does not select any group nothing is installed
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
NetInstallPage::readGroups( const QByteArray& yamlData )
|
NetInstallPage::readGroups( const QByteArray& yamlData )
|
||||||
{
|
{
|
||||||
@ -92,10 +84,13 @@ NetInstallPage::readGroups( const QByteArray& yamlData )
|
|||||||
void
|
void
|
||||||
NetInstallPage::dataIsHere( QNetworkReply* reply )
|
NetInstallPage::dataIsHere( QNetworkReply* reply )
|
||||||
{
|
{
|
||||||
|
// If m_required is *false* then we still say we're ready
|
||||||
|
// even if the reply is corrupt or missing.
|
||||||
if ( reply->error() != QNetworkReply::NoError )
|
if ( reply->error() != QNetworkReply::NoError )
|
||||||
{
|
{
|
||||||
cDebug() << reply->errorString();
|
cDebug() << reply->errorString();
|
||||||
ui->netinst_status->setText( tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" ) );
|
ui->netinst_status->setText( tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" ) );
|
||||||
|
emit checkReady( !m_required );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,6 +99,7 @@ NetInstallPage::dataIsHere( QNetworkReply* reply )
|
|||||||
cDebug() << "Netinstall groups data was received, but invalid.";
|
cDebug() << "Netinstall groups data was received, but invalid.";
|
||||||
ui->netinst_status->setText( tr( "Network Installation. (Disabled: Received invalid groups data)" ) );
|
ui->netinst_status->setText( tr( "Network Installation. (Disabled: Received invalid groups data)" ) );
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
emit checkReady( !m_required );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,15 +108,23 @@ NetInstallPage::dataIsHere( QNetworkReply* reply )
|
|||||||
ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch );
|
ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch );
|
||||||
|
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
emit checkReady( isReady() );
|
emit checkReady( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<PackageTreeItem::ItemData> NetInstallPage::selectedPackages() const
|
PackageModel::PackageItemDataList
|
||||||
|
NetInstallPage::selectedPackages() const
|
||||||
{
|
{
|
||||||
return m_groups->getPackages();
|
if ( m_groups )
|
||||||
|
return m_groups->getPackages();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cDebug() << "WARNING: no netinstall groups are available.";
|
||||||
|
return PackageModel::PackageItemDataList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetInstallPage::loadGroupList()
|
void
|
||||||
|
NetInstallPage::loadGroupList()
|
||||||
{
|
{
|
||||||
QString confUrl(
|
QString confUrl(
|
||||||
Calamares::JobQueue::instance()->globalStorage()->value(
|
Calamares::JobQueue::instance()->globalStorage()->value(
|
||||||
@ -139,7 +143,15 @@ void NetInstallPage::loadGroupList()
|
|||||||
m_networkManager.get( request );
|
m_networkManager.get( request );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetInstallPage::onActivate()
|
void
|
||||||
|
NetInstallPage::setRequired( bool b )
|
||||||
|
{
|
||||||
|
m_required = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
NetInstallPage::onActivate()
|
||||||
{
|
{
|
||||||
ui->groupswidget->setFocus();
|
ui->groupswidget->setFocus();
|
||||||
}
|
}
|
||||||
|
@ -46,17 +46,24 @@ public:
|
|||||||
|
|
||||||
void onActivate();
|
void onActivate();
|
||||||
|
|
||||||
bool isReady();
|
|
||||||
|
|
||||||
// Retrieves the groups, with name, description and packages, from
|
// Retrieves the groups, with name, description and packages, from
|
||||||
// the remote URL configured in the settings. Assumes the URL is already
|
// the remote URL configured in the settings. Assumes the URL is already
|
||||||
// in the global storage. This should be called before displaying the page.
|
// in the global storage. This should be called before displaying the page.
|
||||||
void loadGroupList();
|
void loadGroupList();
|
||||||
|
|
||||||
|
// Sets the "required" state of netinstall data. Influences whether
|
||||||
|
// corrupt or unavailable data causes checkReady() to be emitted
|
||||||
|
// true (not-required) or false.
|
||||||
|
void setRequired( bool );
|
||||||
|
bool getRequired() const
|
||||||
|
{
|
||||||
|
return m_required;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns the list of packages belonging to groups that are
|
// Returns the list of packages belonging to groups that are
|
||||||
// selected in the view in this given moment. No data is cached here, so
|
// selected in the view in this given moment. No data is cached here, so
|
||||||
// this function does not have constant time.
|
// this function does not have constant time.
|
||||||
QList<PackageTreeItem::ItemData> selectedPackages() const;
|
PackageModel::PackageItemDataList selectedPackages() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void dataIsHere( QNetworkReply* );
|
void dataIsHere( QNetworkReply* );
|
||||||
@ -76,6 +83,7 @@ private:
|
|||||||
QNetworkAccessManager m_networkManager;
|
QNetworkAccessManager m_networkManager;
|
||||||
|
|
||||||
PackageModel* m_groups;
|
PackageModel* m_groups;
|
||||||
|
bool m_required;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // NETINSTALLPAGE_H
|
#endif // NETINSTALLPAGE_H
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* Copyright 2016, Luca Giambonini <almack@chakraos.org>
|
* Copyright 2016, Luca Giambonini <almack@chakraos.org>
|
||||||
* Copyright 2016, Lisa Vitolo <shainer@chakraos.org>
|
* Copyright 2016, Lisa Vitolo <shainer@chakraos.org>
|
||||||
* Copyright 2017, Kyle Robbertze <krobbertze@gmail.com>
|
* Copyright 2017, Kyle Robbertze <krobbertze@gmail.com>
|
||||||
|
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||||
*
|
*
|
||||||
* Calamares is free software: you can redistribute it and/or modify
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -30,11 +31,11 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( NetInstallViewStepFactory, registerPlugin<N
|
|||||||
NetInstallViewStep::NetInstallViewStep( QObject* parent )
|
NetInstallViewStep::NetInstallViewStep( QObject* parent )
|
||||||
: Calamares::ViewStep( parent )
|
: Calamares::ViewStep( parent )
|
||||||
, m_widget( new NetInstallPage() )
|
, m_widget( new NetInstallPage() )
|
||||||
, m_nextEnabled( true )
|
, m_nextEnabled( false )
|
||||||
{
|
{
|
||||||
emit nextStatusChanged( true );
|
emit nextStatusChanged( true );
|
||||||
connect( m_widget, &NetInstallPage::checkReady,
|
connect( m_widget, &NetInstallPage::checkReady,
|
||||||
this, &NetInstallViewStep::nextStatusChanged );
|
this, &NetInstallViewStep::nextIsReady );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -126,7 +127,7 @@ NetInstallViewStep::onLeave()
|
|||||||
cDebug() << "Leaving netinstall, adding packages to be installed"
|
cDebug() << "Leaving netinstall, adding packages to be installed"
|
||||||
<< "to global storage";
|
<< "to global storage";
|
||||||
|
|
||||||
QList<PackageTreeItem::ItemData> packages = m_widget->selectedPackages();
|
PackageModel::PackageItemDataList packages = m_widget->selectedPackages();
|
||||||
QVariantList installPackages;
|
QVariantList installPackages;
|
||||||
QVariantList tryInstallPackages;
|
QVariantList tryInstallPackages;
|
||||||
QVariantList packageOperations;
|
QVariantList packageOperations;
|
||||||
@ -138,7 +139,7 @@ NetInstallViewStep::onLeave()
|
|||||||
QVariant details( package.packageName );
|
QVariant details( package.packageName );
|
||||||
// If it's a package with a pre- or post-script, replace
|
// If it's a package with a pre- or post-script, replace
|
||||||
// with the more complicated datastructure.
|
// with the more complicated datastructure.
|
||||||
if (!package.preScript.isEmpty() || !package.postScript.isEmpty())
|
if ( !package.preScript.isEmpty() || !package.postScript.isEmpty() )
|
||||||
{
|
{
|
||||||
QMap<QString, QVariant> sdetails;
|
QMap<QString, QVariant> sdetails;
|
||||||
sdetails.insert( "pre-script", package.preScript );
|
sdetails.insert( "pre-script", package.preScript );
|
||||||
@ -156,14 +157,14 @@ NetInstallViewStep::onLeave()
|
|||||||
{
|
{
|
||||||
QMap<QString, QVariant> op;
|
QMap<QString, QVariant> op;
|
||||||
op.insert( "install", QVariant( installPackages ) );
|
op.insert( "install", QVariant( installPackages ) );
|
||||||
packageOperations.append(op);
|
packageOperations.append( op );
|
||||||
cDebug() << " .." << installPackages.length() << "critical packages.";
|
cDebug() << " .." << installPackages.length() << "critical packages.";
|
||||||
}
|
}
|
||||||
if ( !tryInstallPackages.empty() )
|
if ( !tryInstallPackages.empty() )
|
||||||
{
|
{
|
||||||
QMap<QString, QVariant> op;
|
QMap<QString, QVariant> op;
|
||||||
op.insert( "try_install", QVariant( tryInstallPackages ) );
|
op.insert( "try_install", QVariant( tryInstallPackages ) );
|
||||||
packageOperations.append(op);
|
packageOperations.append( op );
|
||||||
cDebug() << " .." << tryInstallPackages.length() << "non-critical packages.";
|
cDebug() << " .." << tryInstallPackages.length() << "non-critical packages.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,6 +179,11 @@ NetInstallViewStep::onLeave()
|
|||||||
void
|
void
|
||||||
NetInstallViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
NetInstallViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
|
m_widget->setRequired(
|
||||||
|
configurationMap.contains( "required" ) &&
|
||||||
|
configurationMap.value( "required" ).type() == QVariant::Bool &&
|
||||||
|
configurationMap.value( "required" ).toBool() );
|
||||||
|
|
||||||
if ( configurationMap.contains( "groupsUrl" ) &&
|
if ( configurationMap.contains( "groupsUrl" ) &&
|
||||||
configurationMap.value( "groupsUrl" ).type() == QVariant::String )
|
configurationMap.value( "groupsUrl" ).type() == QVariant::String )
|
||||||
{
|
{
|
||||||
@ -186,3 +192,10 @@ NetInstallViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|||||||
m_widget->loadGroupList();
|
m_widget->loadGroupList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
NetInstallViewStep::nextIsReady( bool b )
|
||||||
|
{
|
||||||
|
m_nextEnabled = b;
|
||||||
|
emit nextStatusChanged( b );
|
||||||
|
}
|
||||||
|
@ -60,6 +60,9 @@ public:
|
|||||||
|
|
||||||
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
void setConfigurationMap( const QVariantMap& configurationMap ) override;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void nextIsReady( bool );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NetInstallPage* m_widget;
|
NetInstallPage* m_widget;
|
||||||
bool m_nextEnabled;
|
bool m_nextEnabled;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017, Kyle Robbertze <kyle@aims.ac.za>
|
* Copyright (c) 2017, Kyle Robbertze <kyle@aims.ac.za>
|
||||||
@ -28,14 +29,13 @@
|
|||||||
|
|
||||||
#include <yaml-cpp/yaml.h>
|
#include <yaml-cpp/yaml.h>
|
||||||
|
|
||||||
// Required forward declarations
|
|
||||||
class PackageTreeItem;
|
|
||||||
|
|
||||||
class PackageModel : public QAbstractItemModel
|
class PackageModel : public QAbstractItemModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
using PackageItemDataList = QList< PackageTreeItem::ItemData >;
|
||||||
|
|
||||||
explicit PackageModel( const YAML::Node& data, QObject* parent = nullptr );
|
explicit PackageModel( const YAML::Node& data, QObject* parent = nullptr );
|
||||||
~PackageModel() override;
|
~PackageModel() override;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ public:
|
|||||||
QModelIndex parent( const QModelIndex& index ) const override;
|
QModelIndex parent( const QModelIndex& index ) const override;
|
||||||
int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
|
int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
|
||||||
int columnCount( const QModelIndex& parent = QModelIndex() ) const override;
|
int columnCount( const QModelIndex& parent = QModelIndex() ) const override;
|
||||||
QList<PackageTreeItem::ItemData> getPackages() const;
|
PackageItemDataList getPackages() const;
|
||||||
QList<PackageTreeItem*> getItemPackages( PackageTreeItem* item ) const;
|
QList<PackageTreeItem*> getItemPackages( PackageTreeItem* item ) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,2 +1,13 @@
|
|||||||
---
|
---
|
||||||
|
# This is the URL that is retrieved to get the netinstall groups-and-packages
|
||||||
|
# data (which should be in the format described in netinstall.yaml).
|
||||||
groupsUrl: http://chakraos.org/netinstall.php
|
groupsUrl: http://chakraos.org/netinstall.php
|
||||||
|
|
||||||
|
# If the installation can proceed without netinstall (e.g. the Live CD
|
||||||
|
# can create a working installed system, but netinstall is preferred
|
||||||
|
# to bring it up-to-date or extend functionality) leave this set to
|
||||||
|
# false (the default). If set to true, the netinstall data is required.
|
||||||
|
#
|
||||||
|
# This only has an effect if the netinstall data cannot be retrieved,
|
||||||
|
# or is corrupt: having "required" set, means the install cannot proceed.
|
||||||
|
required: false
|
||||||
|
Loading…
Reference in New Issue
Block a user