Merge branch 'master' into usertracking

main
Adriaan de Groot 7 years ago
commit 28315db43b

@ -1,2 +1,24 @@
Teo Mrnjavac <teo@kde.org>
Adriaan de Groot <groot@kde.org>
# MAINTAINER
Teo Mrnjavac <teo@kde.org> (maintainer -2017)
Adriaan de Groot <groot@kde.org> (maintainer 2017-)
# CONTRIBUTORS
Alf Gaida
Allen Welkie
Andrius Štikonas
Bernhard Landauer
Bezzy1999
bill-auger
crispg72
demmm
Gabriel Craciunescu
Kai Dohmen
Kevin Kofler
Kyle Robertze
Lisa Vitolo
n3rdopolis
Philip Müller
Ramon Buldó
Rohan Garg

@ -9,6 +9,20 @@ if(NOT PYTHONLIBS_FOUND)
message(FATAL_ERROR "error: Python is required to build PythonQt")
endif()
# Cut X.Y[.Z] down to just X.Y
string(REGEX REPLACE
"^([0-9][0-9]*)\.([0-9][0-9]*)"
"\\1.\\2@"
_PYTHONLIBS_MAJMIN
${PYTHONLIBS_VERSION_STRING}
)
string(REGEX REPLACE
"@.*"
""
PYTHONLIBS_MAJMIN
${_PYTHONLIBS_MAJMIN}
)
if(NOT EXISTS "${PYTHONQT_INSTALL_DIR}")
find_path(PYTHONQT_INSTALL_DIR include/PythonQt/PythonQt.h DOC "Directory where PythonQt was installed.")
endif()
@ -22,17 +36,58 @@ find_path(PYTHONQT_INCLUDE_DIR PythonQt.h
"${PYTHONQT_INSTALL_DIR}/src"
DOC "Path to the PythonQt include directory")
# Minimum v3.1 is needed
find_library(PYTHONQT_LIBRARY_RELEASE PythonQt PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
find_library(PYTHONQT_LIBRARY_DEBUG NAMES PythonQt${CTK_CMAKE_DEBUG_POSTFIX} PythonQt${CMAKE_DEBUG_POSTFIX} PythonQt PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
find_library(PYTHONQT_QTALL_LIBRARY_RELEASE PythonQt_QtAll PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
find_library(PYTHONQT_QTALL_LIBRARY_DEBUG NAMES PythonQt_QtAll${CTK_CMAKE_DEBUG_POSTFIX} PythonQt_QtAll${CMAKE_DEBUG_POSTFIX} PythonQt_QtAll PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
if ( NOT PythonQt_FIND_QUIETLY )
message( STATUS "Searching for PythonQt (PythonLibs ${PYTHONLIBS_MAJMIN}) .." )
if ( PYTHONQT_INCLUDE_DIR )
message( STATUS " .. found include ${PYTHONQT_INCLUDE_DIR}" )
endif()
endif()
# Also check for v3.2+
find_library(PYTHONQT_LIBRARY_RELEASE PythonQt-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
find_library(PYTHONQT_LIBRARY_DEBUG NAMES PythonQt-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} PythonQt-Qt5-Python3${CMAKE_DEBUG_POSTFIX} PythonQt-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "The PythonQt library.")
find_library(PYTHONQT_QTALL_LIBRARY_RELEASE PythonQt_QtAll-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
find_library(PYTHONQT_QTALL_LIBRARY_DEBUG NAMES PythonQt_QtAll-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX} PythonQt_QtAll-Qt5-Python3${CMAKE_DEBUG_POSTFIX} PythonQt_QtAll-Qt5-Python3 PATHS "${PYTHONQT_INSTALL_DIR}/lib" DOC "Full Qt bindings for the PythonQt library.")
# Minimum v3.1 is needed
find_library(PYTHONQT_LIBRARY_RELEASE
NAMES
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}
PythonQt-Qt5-Python3
PythonQt
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
DOC "The PythonQt library."
)
find_library(PYTHONQT_LIBRARY_DEBUG
NAMES
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}JMIN${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}${CMAKE_DEBUG_POSTFIX}
PythonQt-Qt5-Python${PYTHONLIBS_MAJMIN}
PythonQt-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt-Qt5-Python3${CMAKE_DEBUG_POSTFIX}
PythonQt-Qt5-Python3
PythonQt${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt${CMAKE_DEBUG_POSTFIX}
PythonQt
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
DOC "The PythonQt library (debug build)."
)
find_library(PYTHONQT_QTALL_LIBRARY_RELEASE
NAMES
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}
PythonQt_QtAll-Qt5-Python3
PythonQt_QtAll
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
DOC "Full Qt bindings for the PythonQt library."
)
find_library(PYTHONQT_QTALL_LIBRARY_DEBUG
NAMES
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}${CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll-Qt5-Python${PYTHONLIBS_MAJMIN}
PythonQt_QtAll-Qt5-Python3${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll-Qt5-Python3${CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll-Qt5-Python3
PythonQt_QtAll${CTK_CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll${CMAKE_DEBUG_POSTFIX}
PythonQt_QtAll
PATHS "${PYTHONQT_INSTALL_DIR}/lib"
DOC "Full Qt bindings for the PythonQt library (debug build)."
)
set(PYTHONQT_LIBRARY)
if(PYTHONQT_LIBRARY_RELEASE)
@ -50,6 +105,16 @@ if(PYTHONQT_QTALL_LIBRARY_DEBUG)
list(APPEND PYTHONQT_QTALL_LIBRARY debug ${PYTHONQT_QTALL_LIBRARY_DEBUG})
endif()
if ( NOT PythonQt_FIND_QUIETLY )
if ( PYTHONQT_LIBRARY )
message( STATUS " .. found library ${PYTHONQT_LIBRARY}" )
endif()
if ( PYTHONQT_QTALL_LIBRARY )
message( STATUS " .. found qtall ${PYTHONQT_QTALL_LIBRARY}" )
endif()
endif()
mark_as_advanced(PYTHONQT_INSTALL_DIR)
mark_as_advanced(PYTHONQT_INCLUDE_DIR)
mark_as_advanced(PYTHONQT_LIBRARY_RELEASE)

@ -1,9 +1,15 @@
Hacking on Calamares
====================
These are the guidelines for hacking on Calamares. Except for the licensing,
which **must** be GPLv3+, these are guidelines and -- like PEP8 -- the most
important thing is to know when you can ignore them.
Licensing
---------
Calamares is released under the terms of the GNU GPL, version 3 or later. Every source file must have a license header, with a list of copyright holders and years.
Calamares is released under the terms of the GNU GPL, version 3 or later.
Every source file must have a license header, with a list of copyright holders and years.
Example:
```
@ -34,9 +40,9 @@ organization, etc.
Please add your name to files you touch when making any contribution (even if
it's just a typo-fix which might not be copyrightable in all jurisdictions).
Formatting
----------
Formatting C++
--------------
This formatting guide applies to C++ code only; for Python modules, we use
[pycodestyle][https://github.com/PyCQA/pycodestyle] to apply a check of
some PEP8 guidelines.
@ -48,10 +54,10 @@ some PEP8 guidelines.
* No space before brackets, except for keywords, for example `function( argument )` but
`if ( condition )`.
* For pointer and reference variable declarations, put a space before the variable name
and no space between the type and the `*` or `&`.
* `for`, `if`, `else`, `while` and similar statements put the brackets on the next line,
although brackets are not needed for single statements.
* Function and class definitions have their brackets on separate lines.
and no space between the type and the `*` or `&`, e.g. `int* p`.
* `for`, `if`, `else`, `while` and similar statements put the braces on the next line,
if the following block is more than one statement. Use no braces for single statements.
* Function and class definitions have their braces on separate lines.
* A function implementation's return type is on its own line.
* `CamelCase.{cpp,h}` style file names.
@ -63,8 +69,9 @@ MyClass::myMethod( QStringList list, const QString& name )
if ( list.isEmpty() )
return false;
cDebug() << "Items in list ..";
foreach ( const QString& string, list )
cDebug() << "Current string is " << string;
cDebug() << " .." << string;
switch ( m_enumValue )
{
@ -77,7 +84,7 @@ MyClass::myMethod( QStringList list, const QString& name )
}
```
You can use the `hacking/calamaresstyle` script to run
You can use the `ci/calamaresstyle` script to run
[astyle](http://astyle.sf.net) on your code and have it formatted the right
way.
@ -85,6 +92,7 @@ way.
order to take advantage of this functionality you will need to acquire the
[EditorConfig](http://editorconfig.org/#download) plug-in for your editor.
Naming
------
* Use CamelCase for everything.
@ -97,6 +105,7 @@ Naming
* If it's a getter for a boolean, prefix with 'is', so `isCondition()`.
* A setter is `setVariable( arg )`.
Includes
--------
Header includes should be listed in the following order:
@ -109,8 +118,9 @@ Header includes should be listed in the following order:
They should also be sorted alphabetically for ease of locating them.
Includes in a header file should be kept to the absolute minimum, as to keep compile times short. This can be achieved by using forward declarations instead of includes,
like `class QListView;`.
Includes in a header file should be kept to the absolute minimum, as to keep
compile times short. This can be achieved by using forward declarations
instead of includes, like `class QListView;`.
Example:
```
@ -129,6 +139,7 @@ Example:
Use include guards, not `#pragma once`.
C++ tips
--------
All C++11 features are acceptable, and the use of new C++11 features is encouraged when
@ -141,8 +152,8 @@ range-based `for` syntax introduced with C++11 is preferred ([see this blog post
When re-implementing a virtual method, always add the `override` keyword.
Try to keep your code const correct. Declare methods const if they don't mutate the
object, and use const variables. It improves safety, and also makes it easier to
Try to keep your code const correct. Declare methods const if they don't mutate the
object, and use const variables. It improves safety, and also makes it easier to
understand the code.
For the Qt signal-slot system, the new (Qt5) syntax is to be preferred because it allows
@ -160,10 +171,31 @@ connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, [this]
});
```
[1]: http://blog.qt.digia.com/blog/2011/05/26/cpp0x-in-qt/
[2]: http://qt-project.org/wiki/New_Signal_Slot_Syntax
Debugging
---------
Use `cDebug()` and `cLog()` from `utils/Logger.h`.
Use `cDebug()` and `cLog()` from `utils/Logger.h`. You can pass a debug-level to
either macro (1 is debugging, higher is less important). Use `cLog()` for warning
messages. It is recommended to add *WARNING* as the first part of a warning
message.
For log messages that are continued across multiple calls to `cDebug()`,
in particular listing things, conventional formatting is as follows:
* End the first debug message with ` ..`
* Indent following lines with ` ..`
[1]: http://blog.qt.digia.com/blog/2011/05/26/cpp0x-in-qt/
[2]: http://qt-project.org/wiki/New_Signal_Slot_Syntax
Commit Messages
---------------
Keep commit messages short(-ish) and try to describe what is being changed
*as well as why*. Use the commit keywords for GitHub, especially *FIXES:*
to auto-close issues when they are resolved.
For functional changes to Calamares modules or libraries, try to put
*[modulename]* in front of the first line of the commit message.
For non-functional changes to infrastructure, try to label the change
with the kind of change, e.g. *CMake* or *i18n* or *Documentation*.

@ -46,7 +46,7 @@ public:
#endif
}
void setJobs( const QList< job_ptr >& jobs )
void setJobs( const JobList& jobs )
{
m_jobs = jobs;
}
@ -73,7 +73,7 @@ public:
}
private:
QList< job_ptr > m_jobs;
JobList m_jobs;
JobQueue* m_queue;
int m_jobIndex;
@ -164,7 +164,7 @@ JobQueue::enqueue( const job_ptr& job )
void
JobQueue::enqueue( const QList< job_ptr >& jobs )
JobQueue::enqueue( const JobList& jobs )
{
Q_ASSERT( !m_thread->isRunning() );
m_jobs.append( jobs );

@ -42,11 +42,11 @@ public:
GlobalStorage* globalStorage() const;
void enqueue( const job_ptr& job );
void enqueue( const QList< job_ptr >& jobs );
void enqueue( const JobList& jobs );
void start();
signals:
void queueChanged( const QList< job_ptr >& jobs );
void queueChanged( const JobList& jobs );
void progress( qreal percent, const QString& prettyName );
void finished();
void failed( const QString& message, const QString& details );
@ -54,7 +54,7 @@ signals:
private:
static JobQueue* s_instance;
QList< job_ptr > m_jobs;
JobList m_jobs;
JobThread* m_thread;
GlobalStorage* m_storage;
};

@ -19,6 +19,7 @@
#ifndef TYPEDEFS_H
#define TYPEDEFS_H
#include <QList>
#include <QSharedPointer>
namespace Calamares
@ -26,6 +27,7 @@ namespace Calamares
class Job;
typedef QSharedPointer< Job > job_ptr;
using JobList = QList< job_ptr >;
enum ModuleAction : char
{

@ -326,5 +326,35 @@ crash()
*a = 1;
}
bool
getBool( const QVariantMap& map, const QString& key, bool d )
{
bool result = d;
if ( map.contains( key ) )
{
auto v = map.value( key );
if ( v.type() == QVariant::Bool )
result = v.toBool();
}
return result;
}
QVariantMap
getSubMap( const QVariantMap& map, const QString& key, bool& success )
{
success = false;
if ( map.contains( key ) )
{
auto v = map.value( key );
if ( v.type() == QVariant::Map )
{
success = true;
return v.toMap();
}
}
return QVariantMap();
}
}

@ -97,6 +97,22 @@ namespace CalamaresUtils
* @brief crash makes Calamares crash immediately.
*/
DLLEXPORT void crash();
/**
* Get a bool value from a mapping with a given key; returns the default
* if no value is stored in the map.
*/
DLLEXPORT bool getBool( const QVariantMap& map, const QString& key, bool d );
/**
* Returns a sub-map (i.e. a nested map) from the given mapping with the
* given key. @p success is set to true if the @p key exists
* in @p map and converts to a map, false otherwise.
*
* Returns an empty map if there is no such key or it is not a map-value.
* (e.g. if @p success is false).
*/
DLLEXPORT QVariantMap getSubMap( const QVariantMap& map, const QString& key, bool& success );
}
#endif // CALAMARESUTILS_H

@ -148,10 +148,10 @@ ExecutionViewStep::onActivate()
}
QList< Calamares::job_ptr >
JobList
ExecutionViewStep::jobs() const
{
return QList< Calamares::job_ptr >();
return JobList();
}

@ -52,7 +52,7 @@ public:
void onActivate() override;
QList< job_ptr > jobs() const override;
JobList jobs() const override;
void appendJobModuleInstanceKey( const QString& instanceKey );

@ -75,10 +75,10 @@ CppJobModule::loadSelf()
}
QList< job_ptr >
JobList
CppJobModule::jobs() const
{
return QList< job_ptr >() << m_job;
return JobList() << m_job;
}

@ -36,7 +36,7 @@ public:
Interface interface() const override;
void loadSelf() override;
QList< job_ptr > jobs() const override;
JobList jobs() const override;
protected:
void initFrom( const QVariantMap& moduleDescriptor ) override;

@ -70,7 +70,6 @@ public:
ProcessInterface,
PythonQtInterface
};
virtual ~Module();
/**
* @brief fromDescriptor creates a new Module object of the correct type.
@ -84,6 +83,7 @@ public:
const QString& instanceId,
const QString& configFileName,
const QString& moduleDirectory );
virtual ~Module();
/**
* @brief name returns the name of this module.
@ -159,7 +159,7 @@ public:
* @brief jobs returns any jobs exposed by this module.
* @return a list of jobs (can be empty).
*/
virtual QList< job_ptr > jobs() const = 0;
virtual JobList jobs() const = 0;
/**
* @brief configurationMap returns the contents of the configuration file for

@ -53,10 +53,10 @@ ProcessJobModule::loadSelf()
}
QList< job_ptr >
JobList
ProcessJobModule::jobs() const
{
return QList< job_ptr >() << m_job;
return JobList() << m_job;
}

@ -34,7 +34,7 @@ public:
Interface interface() const override;
void loadSelf() override;
QList< job_ptr > jobs() const override;
JobList jobs() const override;
protected:
void initFrom( const QVariantMap& moduleDescriptor ) override;

@ -53,10 +53,10 @@ PythonJobModule::loadSelf()
}
QList< job_ptr >
JobList
PythonJobModule::jobs() const
{
return QList< job_ptr >() << m_job;
return JobList() << m_job;
}

@ -32,7 +32,7 @@ public:
Interface interface() const override;
void loadSelf() override;
QList< job_ptr > jobs() const override;
JobList jobs() const override;
protected:
void initFrom( const QVariantMap& moduleDescriptor ) override;

@ -171,7 +171,7 @@ PythonQtViewModule::loadSelf()
}
QList< job_ptr >
JobList
PythonQtViewModule::jobs() const
{
return m_viewStep->jobs();

@ -33,7 +33,7 @@ public:
Interface interface() const override;
void loadSelf() override;
QList< job_ptr > jobs() const override;
JobList jobs() const override;
protected:
void initFrom( const QVariantMap& moduleDescriptor ) override;

@ -76,7 +76,7 @@ ViewModule::loadSelf()
}
QList< job_ptr >
JobList
ViewModule::jobs() const
{
return m_viewStep->jobs();

@ -37,7 +37,7 @@ public:
Interface interface() const override;
void loadSelf() override;
QList< job_ptr > jobs() const override;
JobList jobs() const override;
protected:
void initFrom( const QVariantMap& moduleDescriptor ) override;

@ -62,7 +62,7 @@ DebugWindow::DebugWindow()
// JobQueue page
jobQueueText->setReadOnly( true );
connect( JobQueue::instance(), &JobQueue::queueChanged,
this, [ this ]( const QList< Calamares::job_ptr >& jobs )
this, [ this ]( const JobList& jobs )
{
QStringList text;
for ( const auto &job : jobs )

@ -159,10 +159,10 @@ PythonQtViewStep::isAtEnd() const
}
QList< Calamares::job_ptr >
JobList
PythonQtViewStep::jobs() const
{
QList< Calamares::job_ptr > jobs;
JobList jobs;
PythonQtObjectPtr jobsCallable = PythonQt::self()->lookupCallable( m_obj, "jobs" );
if ( jobsCallable.isNull() )

@ -46,7 +46,7 @@ public:
bool isAtBeginning() const override;
bool isAtEnd() const override;
QList< Calamares::job_ptr > jobs() const override;
JobList jobs() const override;
void setConfigurationMap( const QVariantMap& configurationMap ) override;

@ -91,7 +91,7 @@ public:
*/
virtual void onLeave();
virtual QList< job_ptr > jobs() const = 0;
virtual JobList jobs() const = 0;
void setModuleInstanceKey( const QString& instanceKey );
QString moduleInstanceKey() const

@ -3,6 +3,7 @@ include( CMakeColors )
if( BUILD_TESTING )
add_executable( test_conf test_conf.cpp )
target_link_libraries( test_conf ${YAMLCPP_LIBRARY} )
target_include_directories( test_conf PUBLIC ${YAMLCPP_INCLUDE_DIR} )
endif()
file( GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*" )

@ -120,7 +120,7 @@ LocaleViewStep::fetchGeoIpTimezone()
try
{
YAML::Node doc = YAML::Load( reply->readAll() );
YAML::Node doc = YAML::Load( data );
QVariant var = CalamaresUtils::yamlToVariant( doc );
if ( !var.isNull() &&

@ -1,7 +1,27 @@
---
# This settings are used to set your default system time zone.
# Time zones are usually located under /usr/share/zoneinfo and
# provided by the 'tzdata' package of your Distribution.
#
# Distributions using systemd can list available
# time zones by using the timedatectl command.
# timedatectl list-timezones
region: "America"
zone: "New_York"
# GeoIP settings. Leave commented out to disable GeoIP.
#localeGenPath: "/etc/locale.gen"
# System locales are detected in the following order:
#
# /usr/share/i18n/SUPPORTED
# localeGenPath (defaults to /etc/locale.gen if not set)
# 'locale -a' output
# Enable only when your Distribution is using an
# custom path for locale.gen
#localeGenPath: "PATH_TO/locale.gen"
# GeoIP based Language settings:
# GeoIP need an working Internet connecion.
# This can be managed from welcome.conf by adding
# internet to the list of required conditions.
# Leave commented out to disable GeoIP.
#geoipUrl: "freegeoip.net"

@ -57,14 +57,6 @@ NetInstallPage::NetInstallPage( QWidget* parent )
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
NetInstallPage::readGroups( const QByteArray& yamlData )
{
@ -92,10 +84,13 @@ NetInstallPage::readGroups( const QByteArray& yamlData )
void
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 )
{
cDebug() << reply->errorString();
ui->netinst_status->setText( tr( "Network Installation. (Disabled: Unable to fetch package lists, check your network connection)" ) );
emit checkReady( !m_required );
return;
}
@ -104,6 +99,7 @@ NetInstallPage::dataIsHere( QNetworkReply* reply )
cDebug() << "Netinstall groups data was received, but invalid.";
ui->netinst_status->setText( tr( "Network Installation. (Disabled: Received invalid groups data)" ) );
reply->deleteLater();
emit checkReady( !m_required );
return;
}
@ -112,15 +108,23 @@ NetInstallPage::dataIsHere( QNetworkReply* reply )
ui->groupswidget->header()->setSectionResizeMode( 1, QHeaderView::Stretch );
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(
Calamares::JobQueue::instance()->globalStorage()->value(
@ -139,7 +143,15 @@ void NetInstallPage::loadGroupList()
m_networkManager.get( request );
}
void NetInstallPage::onActivate()
void
NetInstallPage::setRequired( bool b )
{
m_required = b;
}
void
NetInstallPage::onActivate()
{
ui->groupswidget->setFocus();
}

@ -46,17 +46,24 @@ public:
void onActivate();
bool isReady();
// Retrieves the groups, with name, description and packages, from
// the remote URL configured in the settings. Assumes the URL is already
// in the global storage. This should be called before displaying the page.
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
// selected in the view in this given moment. No data is cached here, so
// this function does not have constant time.
QList<PackageTreeItem::ItemData> selectedPackages() const;
PackageModel::PackageItemDataList selectedPackages() const;
public slots:
void dataIsHere( QNetworkReply* );
@ -76,6 +83,7 @@ private:
QNetworkAccessManager m_networkManager;
PackageModel* m_groups;
bool m_required;
};
#endif // NETINSTALLPAGE_H

@ -2,6 +2,7 @@
* Copyright 2016, Luca Giambonini <almack@chakraos.org>
* Copyright 2016, Lisa Vitolo <shainer@chakraos.org>
* 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
* 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 )
: Calamares::ViewStep( parent )
, m_widget( new NetInstallPage() )
, m_nextEnabled( true )
, m_nextEnabled( false )
{
emit nextStatusChanged( true );
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"
<< "to global storage";
QList<PackageTreeItem::ItemData> packages = m_widget->selectedPackages();
PackageModel::PackageItemDataList packages = m_widget->selectedPackages();
QVariantList installPackages;
QVariantList tryInstallPackages;
QVariantList packageOperations;
@ -138,7 +139,7 @@ NetInstallViewStep::onLeave()
QVariant details( package.packageName );
// If it's a package with a pre- or post-script, replace
// with the more complicated datastructure.
if (!package.preScript.isEmpty() || !package.postScript.isEmpty())
if ( !package.preScript.isEmpty() || !package.postScript.isEmpty() )
{
QMap<QString, QVariant> sdetails;
sdetails.insert( "pre-script", package.preScript );
@ -156,14 +157,14 @@ NetInstallViewStep::onLeave()
{
QMap<QString, QVariant> op;
op.insert( "install", QVariant( installPackages ) );
packageOperations.append(op);
packageOperations.append( op );
cDebug() << " .." << installPackages.length() << "critical packages.";
}
if ( !tryInstallPackages.empty() )
{
QMap<QString, QVariant> op;
op.insert( "try_install", QVariant( tryInstallPackages ) );
packageOperations.append(op);
packageOperations.append( op );
cDebug() << " .." << tryInstallPackages.length() << "non-critical packages.";
}
@ -178,6 +179,11 @@ NetInstallViewStep::onLeave()
void
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" ) &&
configurationMap.value( "groupsUrl" ).type() == QVariant::String )
{
@ -186,3 +192,10 @@ NetInstallViewStep::setConfigurationMap( const QVariantMap& configurationMap )
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;
public slots:
void nextIsReady( bool );
private:
NetInstallPage* m_widget;
bool m_nextEnabled;

@ -1,3 +1,4 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright (c) 2017, Kyle Robbertze <kyle@aims.ac.za>
@ -28,14 +29,13 @@
#include <yaml-cpp/yaml.h>
// Required forward declarations
class PackageTreeItem;
class PackageModel : public QAbstractItemModel
{
Q_OBJECT
public:
using PackageItemDataList = QList< PackageTreeItem::ItemData >;
explicit PackageModel( const YAML::Node& data, QObject* parent = nullptr );
~PackageModel() override;
@ -52,7 +52,7 @@ public:
QModelIndex parent( const QModelIndex& index ) const override;
int rowCount( 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;
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
# 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…
Cancel
Save