commit
a3c966cc6c
@ -183,7 +183,7 @@ load_module( const ModuleConfig& moduleConfig )
|
|||||||
|
|
||||||
cDebug() << "Module" << moduleName << "job-configuration:" << configFile;
|
cDebug() << "Module" << moduleName << "job-configuration:" << configFile;
|
||||||
|
|
||||||
Calamares::Module* module = Calamares::Module::fromDescriptor( descriptor, name, configFile, moduleDirectory );
|
Calamares::Module* module = Calamares::moduleFromDescriptor( descriptor, name, configFile, moduleDirectory );
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,10 @@ set( libSources
|
|||||||
|
|
||||||
# Modules
|
# Modules
|
||||||
modulesystem/InstanceKey.cpp
|
modulesystem/InstanceKey.cpp
|
||||||
|
modulesystem/Module.cpp
|
||||||
|
modulesystem/Requirement.cpp
|
||||||
|
modulesystem/RequirementsChecker.cpp
|
||||||
|
modulesystem/RequirementsModel.cpp
|
||||||
|
|
||||||
# Network service
|
# Network service
|
||||||
network/Manager.cpp
|
network/Manager.cpp
|
||||||
|
@ -94,8 +94,7 @@ private:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
QDebug&
|
QDebug& operator<<( QDebug& s, const Calamares::ModuleSystem::InstanceKey& i );
|
||||||
operator <<( QDebug& s, const Calamares::ModuleSystem::InstanceKey& i );
|
|
||||||
|
|
||||||
} // namespace ModuleSystem
|
} // namespace ModuleSystem
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
||||||
|
@ -20,30 +20,18 @@
|
|||||||
#include "Module.h"
|
#include "Module.h"
|
||||||
|
|
||||||
#include "CalamaresConfig.h"
|
#include "CalamaresConfig.h"
|
||||||
#include "CppJobModule.h"
|
|
||||||
#include "ProcessJobModule.h"
|
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "ViewModule.h"
|
|
||||||
|
|
||||||
#include "utils/Dirs.h"
|
#include "utils/Dirs.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/NamedEnum.h"
|
#include "utils/NamedEnum.h"
|
||||||
#include "utils/Yaml.h"
|
#include "utils/Yaml.h"
|
||||||
|
|
||||||
#ifdef WITH_PYTHON
|
|
||||||
#include "PythonJobModule.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_PYTHONQT
|
|
||||||
#include "PythonQtViewModule.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
static const char EMERGENCY[] = "emergency";
|
static const char EMERGENCY[] = "emergency";
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
@ -66,111 +54,6 @@ Module::initFrom( const Calamares::ModuleSystem::Descriptor& moduleDescriptor, c
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Module*
|
|
||||||
Module::fromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescriptor,
|
|
||||||
const QString& instanceId,
|
|
||||||
const QString& configFileName,
|
|
||||||
const QString& moduleDirectory )
|
|
||||||
{
|
|
||||||
std::unique_ptr< Module > m;
|
|
||||||
|
|
||||||
QString typeString = moduleDescriptor.value( "type" ).toString();
|
|
||||||
QString intfString = moduleDescriptor.value( "interface" ).toString();
|
|
||||||
|
|
||||||
if ( typeString.isEmpty() || intfString.isEmpty() )
|
|
||||||
{
|
|
||||||
cError() << "Bad module descriptor format" << instanceId;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
if ( ( typeString == "view" ) || ( typeString == "viewmodule" ) )
|
|
||||||
{
|
|
||||||
if ( intfString == "qtplugin" )
|
|
||||||
{
|
|
||||||
m.reset( new ViewModule() );
|
|
||||||
}
|
|
||||||
else if ( intfString == "pythonqt" )
|
|
||||||
{
|
|
||||||
#ifdef WITH_PYTHONQT
|
|
||||||
m.reset( new PythonQtViewModule() );
|
|
||||||
#else
|
|
||||||
cError() << "PythonQt view modules are not supported in this version of Calamares.";
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cError() << "Bad interface" << intfString << "for module type" << typeString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( typeString == "job" )
|
|
||||||
{
|
|
||||||
if ( intfString == "qtplugin" )
|
|
||||||
{
|
|
||||||
m.reset( new CppJobModule() );
|
|
||||||
}
|
|
||||||
else if ( intfString == "process" )
|
|
||||||
{
|
|
||||||
m.reset( new ProcessJobModule() );
|
|
||||||
}
|
|
||||||
else if ( intfString == "python" )
|
|
||||||
{
|
|
||||||
#ifdef WITH_PYTHON
|
|
||||||
m.reset( new PythonJobModule() );
|
|
||||||
#else
|
|
||||||
cError() << "Python modules are not supported in this version of Calamares.";
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cError() << "Bad interface" << intfString << "for module type" << typeString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cError() << "Bad module type" << typeString;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !m )
|
|
||||||
{
|
|
||||||
cError() << "Bad module type (" << typeString << ") or interface string (" << intfString << ") for module "
|
|
||||||
<< instanceId;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDir moduleDir( moduleDirectory );
|
|
||||||
if ( moduleDir.exists() && moduleDir.isReadable() )
|
|
||||||
{
|
|
||||||
m->m_directory = moduleDir.absolutePath();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cError() << "Bad module directory" << moduleDirectory << "for" << instanceId;
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
m->initFrom( moduleDescriptor, instanceId );
|
|
||||||
if ( !m->m_key.isValid() )
|
|
||||||
{
|
|
||||||
cError() << "Module" << instanceId << "invalid ID";
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
m->initFrom( moduleDescriptor );
|
|
||||||
if ( !configFileName.isEmpty() )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
m->loadConfigurationFile( configFileName );
|
|
||||||
}
|
|
||||||
catch ( YAML::Exception& e )
|
|
||||||
{
|
|
||||||
cError() << "YAML parser error " << e.what();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return m.release();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static QStringList
|
static QStringList
|
||||||
moduleConfigurationCandidates( bool assumeBuildDir, const QString& moduleName, const QString& configFileName )
|
moduleConfigurationCandidates( bool assumeBuildDir, const QString& moduleName, const QString& configFileName )
|
||||||
{
|
{
|
||||||
@ -211,7 +94,8 @@ moduleConfigurationCandidates( bool assumeBuildDir, const QString& moduleName, c
|
|||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::Exception
|
void
|
||||||
|
Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::Exception
|
||||||
{
|
{
|
||||||
QStringList configCandidates
|
QStringList configCandidates
|
||||||
= moduleConfigurationCandidates( Settings::instance()->debugMode(), name(), configFileName );
|
= moduleConfigurationCandidates( Settings::instance()->debugMode(), name(), configFileName );
|
@ -20,12 +20,12 @@
|
|||||||
#ifndef CALAMARES_MODULE_H
|
#ifndef CALAMARES_MODULE_H
|
||||||
#define CALAMARES_MODULE_H
|
#define CALAMARES_MODULE_H
|
||||||
|
|
||||||
#include "Job.h"
|
|
||||||
#include "Requirement.h"
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
#include "Job.h"
|
||||||
|
|
||||||
#include "modulesystem/Descriptor.h"
|
#include "modulesystem/Descriptor.h"
|
||||||
#include "modulesystem/InstanceKey.h"
|
#include "modulesystem/InstanceKey.h"
|
||||||
|
#include "modulesystem/Requirement.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
@ -33,6 +33,12 @@
|
|||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
class Module;
|
||||||
|
Module* moduleFromDescriptor( const ModuleSystem::Descriptor& moduleDescriptor,
|
||||||
|
const QString& instanceId,
|
||||||
|
const QString& configFileName,
|
||||||
|
const QString& moduleDirectory );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The Module class is a common supertype for Calamares modules.
|
* @brief The Module class is a common supertype for Calamares modules.
|
||||||
@ -40,7 +46,7 @@ namespace Calamares
|
|||||||
* takes care of creating an object of the correct type starting from a module
|
* takes care of creating an object of the correct type starting from a module
|
||||||
* descriptor structure.
|
* descriptor structure.
|
||||||
*/
|
*/
|
||||||
class UIDLLEXPORT Module
|
class DLLEXPORT Module
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
@ -68,18 +74,6 @@ public:
|
|||||||
PythonQt // Views only, available as enum even if PythonQt isn't used
|
PythonQt // Views only, available as enum even if PythonQt isn't used
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief fromDescriptor creates a new Module object of the correct type.
|
|
||||||
* @param moduleDescriptor a module descriptor, already parsed into a variant map.
|
|
||||||
* @param instanceId the instance id of the new module instance.
|
|
||||||
* @param configFileName the name of the configuration file to read.
|
|
||||||
* @param moduleDirectory the path to the directory with this module's files.
|
|
||||||
* @return a pointer to an object of a subtype of Module.
|
|
||||||
*/
|
|
||||||
static Module* fromDescriptor( const ModuleSystem::Descriptor& moduleDescriptor,
|
|
||||||
const QString& instanceId,
|
|
||||||
const QString& configFileName,
|
|
||||||
const QString& moduleDirectory );
|
|
||||||
virtual ~Module();
|
virtual ~Module();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -193,6 +187,11 @@ private:
|
|||||||
|
|
||||||
QString m_directory;
|
QString m_directory;
|
||||||
ModuleSystem::InstanceKey m_key;
|
ModuleSystem::InstanceKey m_key;
|
||||||
|
|
||||||
|
friend Module* Calamares::moduleFromDescriptor( const ModuleSystem::Descriptor& moduleDescriptor,
|
||||||
|
const QString& instanceId,
|
||||||
|
const QString& configFileName,
|
||||||
|
const QString& moduleDirectory );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
@ -18,6 +18,8 @@
|
|||||||
#ifndef CALAMARES_REQUIREMENT_H
|
#ifndef CALAMARES_REQUIREMENT_H
|
||||||
#define CALAMARES_REQUIREMENT_H
|
#define CALAMARES_REQUIREMENT_H
|
||||||
|
|
||||||
|
#include "DllMacro.h"
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QString>
|
#include <QString>
|
@ -18,18 +18,16 @@
|
|||||||
|
|
||||||
#include "RequirementsChecker.h"
|
#include "RequirementsChecker.h"
|
||||||
|
|
||||||
#include "Module.h"
|
#include "modulesystem/Module.h"
|
||||||
#include "Requirement.h"
|
#include "modulesystem/Requirement.h"
|
||||||
|
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
@ -18,14 +18,13 @@
|
|||||||
#ifndef CALAMARES_REQUIREMENTSCHECKER_H
|
#ifndef CALAMARES_REQUIREMENTSCHECKER_H
|
||||||
#define CALAMARES_REQUIREMENTSCHECKER_H
|
#define CALAMARES_REQUIREMENTSCHECKER_H
|
||||||
|
|
||||||
#include "Requirement.h"
|
#include "modulesystem/Requirement.h"
|
||||||
|
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -44,7 +43,7 @@ public:
|
|||||||
RequirementsChecker( QVector< Module* > modules, QObject* parent = nullptr );
|
RequirementsChecker( QVector< Module* > modules, QObject* parent = nullptr );
|
||||||
virtual ~RequirementsChecker() override;
|
virtual ~RequirementsChecker() override;
|
||||||
|
|
||||||
public slots:
|
public Q_SLOTS:
|
||||||
/// @brief Start checking all the requirements
|
/// @brief Start checking all the requirements
|
||||||
void run();
|
void run();
|
||||||
|
|
81
src/libcalamares/modulesystem/RequirementsModel.cpp
Normal file
81
src/libcalamares/modulesystem/RequirementsModel.cpp
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2019-2020, 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Calamares is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "RequirementsModel.h"
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
|
||||||
|
void
|
||||||
|
RequirementsModel::setRequirementsList( const Calamares::RequirementsList& requirements )
|
||||||
|
{
|
||||||
|
emit beginResetModel();
|
||||||
|
m_requirements = requirements;
|
||||||
|
|
||||||
|
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
|
||||||
|
auto isMandatoryAndUnSatisfied = []( const Calamares::RequirementEntry& e ) { return e.mandatory && !e.satisfied; };
|
||||||
|
|
||||||
|
m_satisfiedRequirements = std::none_of( m_requirements.begin(), m_requirements.end(), isUnSatisfied );
|
||||||
|
m_satisfiedMandatory = std::none_of( m_requirements.begin(), m_requirements.end(), isMandatoryAndUnSatisfied );
|
||||||
|
|
||||||
|
emit satisfiedRequirementsChanged( m_satisfiedRequirements );
|
||||||
|
emit satisfiedMandatoryChanged( m_satisfiedMandatory );
|
||||||
|
emit endResetModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
RequirementsModel::rowCount( const QModelIndex& ) const
|
||||||
|
{
|
||||||
|
return m_requirements.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant
|
||||||
|
RequirementsModel::data( const QModelIndex& index, int role ) const
|
||||||
|
{
|
||||||
|
const auto requirement = m_requirements.at( index.row() );
|
||||||
|
|
||||||
|
switch ( role )
|
||||||
|
{
|
||||||
|
case Roles::Name:
|
||||||
|
return requirement.name;
|
||||||
|
case Roles::Details:
|
||||||
|
return requirement.enumerationText();
|
||||||
|
case Roles::NegatedText:
|
||||||
|
return requirement.negatedText();
|
||||||
|
case Roles::Satisfied:
|
||||||
|
return requirement.satisfied;
|
||||||
|
case Roles::Mandatory:
|
||||||
|
return requirement.mandatory;
|
||||||
|
default:
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QHash< int, QByteArray >
|
||||||
|
RequirementsModel::roleNames() const
|
||||||
|
{
|
||||||
|
static QHash< int, QByteArray > roles;
|
||||||
|
roles[ Roles::Name ] = "name";
|
||||||
|
roles[ Roles::Details ] = "details";
|
||||||
|
roles[ Roles::NegatedText ] = "negatedText";
|
||||||
|
roles[ Roles::Satisfied ] = "satisfied";
|
||||||
|
roles[ Roles::Mandatory ] = "mandatory";
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Calamares
|
81
src/libcalamares/modulesystem/RequirementsModel.h
Normal file
81
src/libcalamares/modulesystem/RequirementsModel.h
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2019-2020, 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Calamares is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CALAMARES_REQUIREMENTSMODEL_H
|
||||||
|
#define CALAMARES_REQUIREMENTSMODEL_H
|
||||||
|
|
||||||
|
#include "Requirement.h"
|
||||||
|
|
||||||
|
#include "DllMacro.h"
|
||||||
|
|
||||||
|
#include <QAbstractListModel>
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
|
||||||
|
class DLLEXPORT RequirementsModel : public QAbstractListModel
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY( bool satisfiedRequirements READ satisfiedRequirements NOTIFY satisfiedRequirementsChanged FINAL )
|
||||||
|
Q_PROPERTY( bool satisfiedMandatory READ satisfiedMandatory NOTIFY satisfiedMandatoryChanged FINAL )
|
||||||
|
|
||||||
|
public:
|
||||||
|
using QAbstractListModel::QAbstractListModel;
|
||||||
|
|
||||||
|
enum Roles : short
|
||||||
|
{
|
||||||
|
Name,
|
||||||
|
Satisfied,
|
||||||
|
Mandatory,
|
||||||
|
Details,
|
||||||
|
NegatedText,
|
||||||
|
HasDetails
|
||||||
|
};
|
||||||
|
// No Q_ENUM because these are exposed through roleNames()
|
||||||
|
|
||||||
|
bool satisfiedRequirements() const { return m_satisfiedRequirements; }
|
||||||
|
bool satisfiedMandatory() const { return m_satisfiedMandatory; }
|
||||||
|
|
||||||
|
const Calamares::RequirementEntry& getEntry( int index ) const
|
||||||
|
{
|
||||||
|
return m_requirements.at( index );
|
||||||
|
}
|
||||||
|
|
||||||
|
void setRequirementsList( const Calamares::RequirementsList& requirements );
|
||||||
|
|
||||||
|
QVariant data( const QModelIndex& index, int role ) const override;
|
||||||
|
int rowCount( const QModelIndex& ) const override;
|
||||||
|
int count() const { return m_requirements.count(); }
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void satisfiedRequirementsChanged( bool value );
|
||||||
|
void satisfiedMandatoryChanged( bool value );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QHash< int, QByteArray > roleNames() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
Calamares::RequirementsList m_requirements;
|
||||||
|
bool m_satisfiedRequirements = false;
|
||||||
|
bool m_satisfiedMandatory = false;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Calamares
|
||||||
|
|
||||||
|
#endif
|
@ -138,4 +138,5 @@ ModuleSystemTests::testBadFromStringCases()
|
|||||||
QTEST_GUILESS_MAIN( ModuleSystemTests )
|
QTEST_GUILESS_MAIN( ModuleSystemTests )
|
||||||
|
|
||||||
#include "utils/moc-warnings.h"
|
#include "utils/moc-warnings.h"
|
||||||
|
|
||||||
#include "Tests.moc"
|
#include "Tests.moc"
|
||||||
|
@ -286,4 +286,5 @@ Manager::asynchronousGet( const QUrl& url, const CalamaresUtils::Network::Reques
|
|||||||
} // namespace CalamaresUtils
|
} // namespace CalamaresUtils
|
||||||
|
|
||||||
#include "utils/moc-warnings.h"
|
#include "utils/moc-warnings.h"
|
||||||
|
|
||||||
#include "Manager.moc"
|
#include "Manager.moc"
|
||||||
|
@ -47,6 +47,7 @@ NetworkTests::testPing()
|
|||||||
using namespace CalamaresUtils::Network;
|
using namespace CalamaresUtils::Network;
|
||||||
Logger::setupLogLevel( Logger::LOGVERBOSE );
|
Logger::setupLogLevel( Logger::LOGVERBOSE );
|
||||||
auto& nam = Manager::instance();
|
auto& nam = Manager::instance();
|
||||||
auto canPing_www_kde_org = nam.synchronousPing( QUrl( "https://www.kde.org" ), RequestOptions( RequestOptions::FollowRedirect ) );
|
auto canPing_www_kde_org
|
||||||
|
= nam.synchronousPing( QUrl( "https://www.kde.org" ), RequestOptions( RequestOptions::FollowRedirect ) );
|
||||||
QVERIFY( canPing_www_kde_org );
|
QVERIFY( canPing_www_kde_org );
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,9 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/libcalamares ${CMAKE_BINARY_DIR}/sr
|
|||||||
|
|
||||||
set( calamaresui_SOURCES
|
set( calamaresui_SOURCES
|
||||||
modulesystem/CppJobModule.cpp
|
modulesystem/CppJobModule.cpp
|
||||||
modulesystem/Module.cpp
|
modulesystem/ModuleFactory.cpp
|
||||||
modulesystem/ModuleManager.cpp
|
modulesystem/ModuleManager.cpp
|
||||||
modulesystem/ProcessJobModule.cpp
|
modulesystem/ProcessJobModule.cpp
|
||||||
modulesystem/Requirement.cpp
|
|
||||||
modulesystem/RequirementsChecker.cpp
|
|
||||||
modulesystem/ViewModule.cpp
|
modulesystem/ViewModule.cpp
|
||||||
|
|
||||||
utils/CalamaresUtilsGui.cpp
|
utils/CalamaresUtilsGui.cpp
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
#ifndef CALAMARES_CPPJOBMODULE_H
|
#ifndef CALAMARES_CPPJOBMODULE_H
|
||||||
#define CALAMARES_CPPJOBMODULE_H
|
#define CALAMARES_CPPJOBMODULE_H
|
||||||
|
|
||||||
#include "Module.h"
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
#include "modulesystem/Module.h"
|
||||||
|
|
||||||
class QPluginLoader;
|
class QPluginLoader;
|
||||||
|
|
||||||
@ -42,12 +42,16 @@ protected:
|
|||||||
void initFrom( const QVariantMap& moduleDescriptor ) override;
|
void initFrom( const QVariantMap& moduleDescriptor ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Module; //so only the superclass can instantiate
|
|
||||||
explicit CppJobModule();
|
explicit CppJobModule();
|
||||||
virtual ~CppJobModule() override;
|
virtual ~CppJobModule() override;
|
||||||
|
|
||||||
QPluginLoader* m_loader;
|
QPluginLoader* m_loader;
|
||||||
job_ptr m_job;
|
job_ptr m_job;
|
||||||
|
|
||||||
|
friend Module* Calamares::moduleFromDescriptor( const ModuleSystem::Descriptor& moduleDescriptor,
|
||||||
|
const QString& instanceId,
|
||||||
|
const QString& configFileName,
|
||||||
|
const QString& moduleDirectory );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
||||||
|
154
src/libcalamaresui/modulesystem/ModuleFactory.cpp
Normal file
154
src/libcalamaresui/modulesystem/ModuleFactory.cpp
Normal file
@ -0,0 +1,154 @@
|
|||||||
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||||
|
* Copyright 2017-2018, 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Calamares is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ModuleFactory.h"
|
||||||
|
|
||||||
|
#include "CalamaresConfig.h"
|
||||||
|
#include "CppJobModule.h"
|
||||||
|
#include "ProcessJobModule.h"
|
||||||
|
#include "ViewModule.h"
|
||||||
|
|
||||||
|
#include "utils/Dirs.h"
|
||||||
|
#include "utils/Logger.h"
|
||||||
|
#include "utils/NamedEnum.h"
|
||||||
|
#include "utils/Yaml.h"
|
||||||
|
|
||||||
|
#ifdef WITH_PYTHON
|
||||||
|
#include "PythonJobModule.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITH_PYTHONQT
|
||||||
|
#include "PythonQtViewModule.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
|
||||||
|
Module*
|
||||||
|
moduleFromDescriptor( const Calamares::ModuleSystem::Descriptor& moduleDescriptor,
|
||||||
|
const QString& instanceId,
|
||||||
|
const QString& configFileName,
|
||||||
|
const QString& moduleDirectory )
|
||||||
|
{
|
||||||
|
std::unique_ptr< Module > m;
|
||||||
|
|
||||||
|
QString typeString = moduleDescriptor.value( "type" ).toString();
|
||||||
|
QString intfString = moduleDescriptor.value( "interface" ).toString();
|
||||||
|
|
||||||
|
if ( typeString.isEmpty() || intfString.isEmpty() )
|
||||||
|
{
|
||||||
|
cError() << "Bad module descriptor format" << instanceId;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
if ( ( typeString == "view" ) || ( typeString == "viewmodule" ) )
|
||||||
|
{
|
||||||
|
if ( intfString == "qtplugin" )
|
||||||
|
{
|
||||||
|
m.reset( new ViewModule() );
|
||||||
|
}
|
||||||
|
else if ( intfString == "pythonqt" )
|
||||||
|
{
|
||||||
|
#ifdef WITH_PYTHONQT
|
||||||
|
m.reset( new PythonQtViewModule() );
|
||||||
|
#else
|
||||||
|
cError() << "PythonQt view modules are not supported in this version of Calamares.";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cError() << "Bad interface" << intfString << "for module type" << typeString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( typeString == "job" )
|
||||||
|
{
|
||||||
|
if ( intfString == "qtplugin" )
|
||||||
|
{
|
||||||
|
m.reset( new CppJobModule() );
|
||||||
|
}
|
||||||
|
else if ( intfString == "process" )
|
||||||
|
{
|
||||||
|
m.reset( new ProcessJobModule() );
|
||||||
|
}
|
||||||
|
else if ( intfString == "python" )
|
||||||
|
{
|
||||||
|
#ifdef WITH_PYTHON
|
||||||
|
m.reset( new PythonJobModule() );
|
||||||
|
#else
|
||||||
|
cError() << "Python modules are not supported in this version of Calamares.";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cError() << "Bad interface" << intfString << "for module type" << typeString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cError() << "Bad module type" << typeString;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !m )
|
||||||
|
{
|
||||||
|
cError() << "Bad module type (" << typeString << ") or interface string (" << intfString << ") for module "
|
||||||
|
<< instanceId;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDir moduleDir( moduleDirectory );
|
||||||
|
if ( moduleDir.exists() && moduleDir.isReadable() )
|
||||||
|
{
|
||||||
|
m->m_directory = moduleDir.absolutePath();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cError() << "Bad module directory" << moduleDirectory << "for" << instanceId;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
m->initFrom( moduleDescriptor, instanceId );
|
||||||
|
if ( !m->m_key.isValid() )
|
||||||
|
{
|
||||||
|
cError() << "Module" << instanceId << "invalid ID";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
m->initFrom( moduleDescriptor );
|
||||||
|
if ( !configFileName.isEmpty() )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m->loadConfigurationFile( configFileName );
|
||||||
|
}
|
||||||
|
catch ( YAML::Exception& e )
|
||||||
|
{
|
||||||
|
cError() << "YAML parser error " << e.what();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return m.release();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} // namespace Calamares
|
47
src/libcalamaresui/modulesystem/ModuleFactory.h
Normal file
47
src/libcalamaresui/modulesystem/ModuleFactory.h
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||||
|
*
|
||||||
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||||
|
* 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
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Calamares is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CALAMARES_MODULEFACTORY_H
|
||||||
|
#define CALAMARES_MODULEFACTORY_H
|
||||||
|
|
||||||
|
#include "DllMacro.h"
|
||||||
|
|
||||||
|
#include "modulesystem/Descriptor.h"
|
||||||
|
#include "modulesystem/Module.h"
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
namespace Calamares
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief fromDescriptor creates a new Module object of the correct type.
|
||||||
|
* @param moduleDescriptor a module descriptor, already parsed into a variant map.
|
||||||
|
* @param instanceId the instance id of the new module instance.
|
||||||
|
* @param configFileName the name of the configuration file to read.
|
||||||
|
* @param moduleDirectory the path to the directory with this module's files.
|
||||||
|
* @return a pointer to an object of a subtype of Module.
|
||||||
|
*/
|
||||||
|
UIDLLEXPORT Module* moduleFromDescriptor( const ModuleSystem::Descriptor& moduleDescriptor,
|
||||||
|
const QString& instanceId,
|
||||||
|
const QString& configFileName,
|
||||||
|
const QString& moduleDirectory );
|
||||||
|
} // namespace Calamares
|
||||||
|
|
||||||
|
#endif // CALAMARES_MODULEFACTORY_H
|
@ -19,11 +19,11 @@
|
|||||||
|
|
||||||
#include "ModuleManager.h"
|
#include "ModuleManager.h"
|
||||||
|
|
||||||
#include "Module.h"
|
|
||||||
#include "RequirementsChecker.h"
|
|
||||||
#include "Settings.h"
|
|
||||||
#include "ViewManager.h"
|
#include "ViewManager.h"
|
||||||
|
|
||||||
|
#include "Settings.h"
|
||||||
|
#include "modulesystem/Module.h"
|
||||||
|
#include "modulesystem/RequirementsChecker.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Yaml.h"
|
#include "utils/Yaml.h"
|
||||||
#include "viewpages/ExecutionViewStep.h"
|
#include "viewpages/ExecutionViewStep.h"
|
||||||
@ -285,7 +285,8 @@ ModuleManager::loadModules()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
thisModule = Module::fromDescriptor( descriptor,
|
thisModule
|
||||||
|
= Calamares::moduleFromDescriptor( descriptor,
|
||||||
instanceKey.id(),
|
instanceKey.id(),
|
||||||
configFileName,
|
configFileName,
|
||||||
m_moduleDirectoriesByModuleName.value( instanceKey.module() ) );
|
m_moduleDirectoriesByModuleName.value( instanceKey.module() ) );
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
|
|
||||||
#include "modulesystem/Descriptor.h"
|
#include "modulesystem/Descriptor.h"
|
||||||
#include "modulesystem/InstanceKey.h"
|
#include "modulesystem/InstanceKey.h"
|
||||||
|
#include "modulesystem/Requirement.h"
|
||||||
#include "Requirement.h"
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
@ -20,9 +20,8 @@
|
|||||||
#ifndef CALAMARES_PROCESSJOBMODULE_H
|
#ifndef CALAMARES_PROCESSJOBMODULE_H
|
||||||
#define CALAMARES_PROCESSJOBMODULE_H
|
#define CALAMARES_PROCESSJOBMODULE_H
|
||||||
|
|
||||||
#include "Module.h"
|
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
#include "modulesystem/Module.h"
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
@ -42,7 +41,6 @@ protected:
|
|||||||
void initFrom( const QVariantMap& moduleDescriptor ) override;
|
void initFrom( const QVariantMap& moduleDescriptor ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Module;
|
|
||||||
explicit ProcessJobModule();
|
explicit ProcessJobModule();
|
||||||
virtual ~ProcessJobModule() override;
|
virtual ~ProcessJobModule() override;
|
||||||
|
|
||||||
@ -51,6 +49,11 @@ private:
|
|||||||
std::chrono::seconds m_secondsTimeout;
|
std::chrono::seconds m_secondsTimeout;
|
||||||
bool m_runInChroot;
|
bool m_runInChroot;
|
||||||
job_ptr m_job;
|
job_ptr m_job;
|
||||||
|
|
||||||
|
friend Module* Calamares::moduleFromDescriptor( const ModuleSystem::Descriptor& moduleDescriptor,
|
||||||
|
const QString& instanceId,
|
||||||
|
const QString& configFileName,
|
||||||
|
const QString& moduleDirectory );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
||||||
|
@ -19,9 +19,8 @@
|
|||||||
#ifndef CALAMARES_PYTHONJOBMODULE_H
|
#ifndef CALAMARES_PYTHONJOBMODULE_H
|
||||||
#define CALAMARES_PYTHONJOBMODULE_H
|
#define CALAMARES_PYTHONJOBMODULE_H
|
||||||
|
|
||||||
#include "Module.h"
|
|
||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
#include "modulesystem/Module.h"
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
@ -39,13 +38,17 @@ protected:
|
|||||||
void initFrom( const QVariantMap& moduleDescriptor ) override;
|
void initFrom( const QVariantMap& moduleDescriptor ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Module;
|
|
||||||
explicit PythonJobModule();
|
explicit PythonJobModule();
|
||||||
virtual ~PythonJobModule() override;
|
virtual ~PythonJobModule() override;
|
||||||
|
|
||||||
QString m_scriptFileName;
|
QString m_scriptFileName;
|
||||||
QString m_workingPath;
|
QString m_workingPath;
|
||||||
job_ptr m_job;
|
job_ptr m_job;
|
||||||
|
|
||||||
|
friend Module* Calamares::moduleFromDescriptor( const ModuleSystem::Descriptor& moduleDescriptor,
|
||||||
|
const QString& instanceId,
|
||||||
|
const QString& configFileName,
|
||||||
|
const QString& moduleDirectory );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#ifndef CALAMARES_PYTHONQTVIEWMODULE_H
|
#ifndef CALAMARES_PYTHONQTVIEWMODULE_H
|
||||||
#define CALAMARES_PYTHONQTVIEWMODULE_H
|
#define CALAMARES_PYTHONQTVIEWMODULE_H
|
||||||
|
|
||||||
#include "Module.h"
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
#include "Module.h"
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
@ -40,7 +40,6 @@ protected:
|
|||||||
void initFrom( const QVariantMap& moduleDescriptor ) override;
|
void initFrom( const QVariantMap& moduleDescriptor ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Module; //so only the superclass can instantiate
|
|
||||||
explicit PythonQtViewModule();
|
explicit PythonQtViewModule();
|
||||||
virtual ~PythonQtViewModule();
|
virtual ~PythonQtViewModule();
|
||||||
|
|
||||||
@ -48,6 +47,11 @@ private:
|
|||||||
|
|
||||||
QString m_scriptFileName;
|
QString m_scriptFileName;
|
||||||
QString m_workingPath;
|
QString m_workingPath;
|
||||||
|
|
||||||
|
friend Module* Calamares::moduleFromDescriptor( const ModuleSystem::Descriptor& moduleDescriptor,
|
||||||
|
const QString& instanceId,
|
||||||
|
const QString& configFileName,
|
||||||
|
const QString& moduleDirectory );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
#ifndef CALAMARES_VIEWMODULE_H
|
#ifndef CALAMARES_VIEWMODULE_H
|
||||||
#define CALAMARES_VIEWMODULE_H
|
#define CALAMARES_VIEWMODULE_H
|
||||||
|
|
||||||
#include "Module.h"
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
|
#include "modulesystem/Module.h"
|
||||||
|
|
||||||
class QPluginLoader;
|
class QPluginLoader;
|
||||||
|
|
||||||
@ -45,12 +45,16 @@ protected:
|
|||||||
void initFrom( const QVariantMap& moduleDescriptor ) override;
|
void initFrom( const QVariantMap& moduleDescriptor ) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Module; //so only the superclass can instantiate
|
|
||||||
explicit ViewModule();
|
explicit ViewModule();
|
||||||
virtual ~ViewModule() override;
|
virtual ~ViewModule() override;
|
||||||
|
|
||||||
QPluginLoader* m_loader;
|
QPluginLoader* m_loader;
|
||||||
ViewStep* m_viewStep = nullptr;
|
ViewStep* m_viewStep = nullptr;
|
||||||
|
|
||||||
|
friend Module* Calamares::moduleFromDescriptor( const ModuleSystem::Descriptor& moduleDescriptor,
|
||||||
|
const QString& instanceId,
|
||||||
|
const QString& configFileName,
|
||||||
|
const QString& moduleDirectory );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
||||||
|
@ -23,71 +23,15 @@
|
|||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
|
|
||||||
void
|
|
||||||
RequirementsModel::setRequirementsList( const Calamares::RequirementsList& requirements )
|
|
||||||
{
|
|
||||||
CALAMARES_RETRANSLATE_SLOT( &RequirementsModel::retranslate )
|
|
||||||
|
|
||||||
emit beginResetModel();
|
|
||||||
m_requirements = requirements;
|
|
||||||
|
|
||||||
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
|
|
||||||
auto isMandatoryAndUnSatisfied = []( const Calamares::RequirementEntry& e ) { return e.mandatory && !e.satisfied; };
|
|
||||||
|
|
||||||
m_satisfiedRequirements = std::none_of( m_requirements.begin(), m_requirements.end(), isUnSatisfied );
|
|
||||||
m_satisfiedMandatory = std::none_of( m_requirements.begin(), m_requirements.end(), isMandatoryAndUnSatisfied );
|
|
||||||
|
|
||||||
emit satisfiedRequirementsChanged( m_satisfiedRequirements );
|
|
||||||
emit satisfiedMandatoryChanged();
|
|
||||||
emit endResetModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
RequirementsModel::rowCount( const QModelIndex& ) const
|
|
||||||
{
|
|
||||||
return m_requirements.count();
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant
|
|
||||||
RequirementsModel::data( const QModelIndex& index, int role ) const
|
|
||||||
{
|
|
||||||
const auto requirement = m_requirements.at( index.row() );
|
|
||||||
|
|
||||||
switch ( role )
|
|
||||||
{
|
|
||||||
case Roles::Name:
|
|
||||||
return requirement.name;
|
|
||||||
case Roles::Details:
|
|
||||||
return requirement.enumerationText();
|
|
||||||
case Roles::NegatedText:
|
|
||||||
return requirement.negatedText();
|
|
||||||
case Roles::Satisfied:
|
|
||||||
return requirement.satisfied;
|
|
||||||
case Roles::Mandatory:
|
|
||||||
return requirement.mandatory;
|
|
||||||
default:
|
|
||||||
return QVariant();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QHash< int, QByteArray >
|
|
||||||
RequirementsModel::roleNames() const
|
|
||||||
{
|
|
||||||
static QHash< int, QByteArray > roles;
|
|
||||||
roles[ Roles::Name ] = "name";
|
|
||||||
roles[ Roles::Details ] = "details";
|
|
||||||
roles[ Roles::NegatedText ] = "negatedText";
|
|
||||||
roles[ Roles::Satisfied ] = "satisfied";
|
|
||||||
roles[ Roles::Mandatory ] = "mandatory";
|
|
||||||
return roles;
|
|
||||||
}
|
|
||||||
|
|
||||||
Config::Config( QObject* parent )
|
Config::Config( QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_requirementsModel( new RequirementsModel( this ) )
|
, m_requirementsModel( new Calamares::RequirementsModel( this ) )
|
||||||
, m_languages( CalamaresUtils::Locale::availableTranslations() )
|
, m_languages( CalamaresUtils::Locale::availableTranslations() )
|
||||||
{
|
{
|
||||||
connect( m_requirementsModel, &RequirementsModel::satisfiedRequirementsChanged, this, &Config::setIsNextEnabled );
|
connect( m_requirementsModel,
|
||||||
|
&Calamares::RequirementsModel::satisfiedRequirementsChanged,
|
||||||
|
this,
|
||||||
|
&Config::setIsNextEnabled );
|
||||||
|
|
||||||
initLanguages();
|
initLanguages();
|
||||||
|
|
||||||
@ -98,9 +42,46 @@ void
|
|||||||
Config::retranslate()
|
Config::retranslate()
|
||||||
{
|
{
|
||||||
m_genericWelcomeMessage = genericWelcomeMessage().arg( *Calamares::Branding::VersionedName );
|
m_genericWelcomeMessage = genericWelcomeMessage().arg( *Calamares::Branding::VersionedName );
|
||||||
emit genericWelcomeMessageChanged();
|
emit genericWelcomeMessageChanged( m_genericWelcomeMessage );
|
||||||
|
|
||||||
m_requirementsModel->retranslate();
|
if ( !m_requirementsModel->satisfiedRequirements() )
|
||||||
|
{
|
||||||
|
QString message;
|
||||||
|
const bool setup = Calamares::Settings::instance()->isSetupMode();
|
||||||
|
|
||||||
|
if ( !m_requirementsModel->satisfiedMandatory() )
|
||||||
|
{
|
||||||
|
message = setup ? tr( "This computer does not satisfy the minimum "
|
||||||
|
"requirements for setting up %1.<br/>"
|
||||||
|
"Setup cannot continue. "
|
||||||
|
"<a href=\"#details\">Details...</a>" )
|
||||||
|
: tr( "This computer does not satisfy the minimum "
|
||||||
|
"requirements for installing %1.<br/>"
|
||||||
|
"Installation cannot continue. "
|
||||||
|
"<a href=\"#details\">Details...</a>" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
message = setup ? tr( "This computer does not satisfy some of the "
|
||||||
|
"recommended requirements for setting up %1.<br/>"
|
||||||
|
"Setup can continue, but some features "
|
||||||
|
"might be disabled." )
|
||||||
|
: tr( "This computer does not satisfy some of the "
|
||||||
|
"recommended requirements for installing %1.<br/>"
|
||||||
|
"Installation can continue, but some features "
|
||||||
|
"might be disabled." );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_warningMessage = message.arg( *Calamares::Branding::ShortVersionedName );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_warningMessage = tr( "This program will ask you some questions and "
|
||||||
|
"set up %2 on your computer." )
|
||||||
|
.arg( *Calamares::Branding::ProductName );
|
||||||
|
}
|
||||||
|
|
||||||
|
emit warningMessageChanged( m_warningMessage );
|
||||||
}
|
}
|
||||||
|
|
||||||
CalamaresUtils::Locale::LabelModel*
|
CalamaresUtils::Locale::LabelModel*
|
||||||
@ -178,7 +159,7 @@ Config::setLanguageIcon( const QString& languageIcon )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Config::setLocaleIndex( const int& index )
|
Config::setLocaleIndex( int index )
|
||||||
{
|
{
|
||||||
if ( index == m_localeIndex || index > CalamaresUtils::Locale::availableTranslations()->rowCount( QModelIndex() )
|
if ( index == m_localeIndex || index > CalamaresUtils::Locale::availableTranslations()->rowCount( QModelIndex() )
|
||||||
|| index < 0 )
|
|| index < 0 )
|
||||||
@ -189,7 +170,7 @@ Config::setLocaleIndex( const int& index )
|
|||||||
m_localeIndex = index;
|
m_localeIndex = index;
|
||||||
|
|
||||||
const auto& selectedLocale = m_languages->locale( m_localeIndex ).locale();
|
const auto& selectedLocale = m_languages->locale( m_localeIndex ).locale();
|
||||||
cDebug() << "Selected locale" << selectedLocale;
|
cDebug() << "Index" << index << "Selected locale" << selectedLocale;
|
||||||
|
|
||||||
QLocale::setDefault( selectedLocale );
|
QLocale::setDefault( selectedLocale );
|
||||||
CalamaresUtils::installTranslator( selectedLocale, Calamares::Branding::instance()->translationsDirectory() );
|
CalamaresUtils::installTranslator( selectedLocale, Calamares::Branding::instance()->translationsDirectory() );
|
||||||
@ -197,14 +178,14 @@ Config::setLocaleIndex( const int& index )
|
|||||||
emit localeIndexChanged( m_localeIndex );
|
emit localeIndexChanged( m_localeIndex );
|
||||||
}
|
}
|
||||||
|
|
||||||
RequirementsModel&
|
Calamares::RequirementsModel&
|
||||||
Config::requirementsModel() const
|
Config::requirementsModel() const
|
||||||
{
|
{
|
||||||
return *m_requirementsModel;
|
return *m_requirementsModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Config::setIsNextEnabled( const bool& isNextEnabled )
|
Config::setIsNextEnabled( bool isNextEnabled )
|
||||||
{
|
{
|
||||||
m_isNextEnabled = isNextEnabled;
|
m_isNextEnabled = isNextEnabled;
|
||||||
emit isNextEnabledChanged( m_isNextEnabled );
|
emit isNextEnabledChanged( m_isNextEnabled );
|
||||||
@ -262,51 +243,8 @@ Config::setSupportUrl( const QString& url )
|
|||||||
emit supportUrlChanged();
|
emit supportUrlChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
RequirementsModel::retranslate()
|
|
||||||
{
|
|
||||||
if ( !m_satisfiedRequirements )
|
|
||||||
{
|
|
||||||
QString message;
|
|
||||||
const bool setup = Calamares::Settings::instance()->isSetupMode();
|
|
||||||
|
|
||||||
if ( !m_satisfiedMandatory )
|
|
||||||
{
|
|
||||||
message = setup ? tr( "This computer does not satisfy the minimum "
|
|
||||||
"requirements for setting up %1.<br/>"
|
|
||||||
"Setup cannot continue. "
|
|
||||||
"<a href=\"#details\">Details...</a>" )
|
|
||||||
: tr( "This computer does not satisfy the minimum "
|
|
||||||
"requirements for installing %1.<br/>"
|
|
||||||
"Installation cannot continue. "
|
|
||||||
"<a href=\"#details\">Details...</a>" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
message = setup ? tr( "This computer does not satisfy some of the "
|
|
||||||
"recommended requirements for setting up %1.<br/>"
|
|
||||||
"Setup can continue, but some features "
|
|
||||||
"might be disabled." )
|
|
||||||
: tr( "This computer does not satisfy some of the "
|
|
||||||
"recommended requirements for installing %1.<br/>"
|
|
||||||
"Installation can continue, but some features "
|
|
||||||
"might be disabled." );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_warningMessage = message.arg( *Calamares::Branding::ShortVersionedName );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_warningMessage = tr( "This program will ask you some questions and "
|
|
||||||
"set up %2 on your computer." )
|
|
||||||
.arg( *Calamares::Branding::ProductName );
|
|
||||||
}
|
|
||||||
|
|
||||||
emit warningMessageChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
Config::genericWelcomeMessage()
|
Config::genericWelcomeMessage() const
|
||||||
{
|
{
|
||||||
QString message;
|
QString message;
|
||||||
|
|
||||||
@ -325,3 +263,9 @@ Config::genericWelcomeMessage()
|
|||||||
|
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString
|
||||||
|
Config::warningMessage() const
|
||||||
|
{
|
||||||
|
return m_warningMessage;
|
||||||
|
}
|
||||||
|
@ -19,79 +19,18 @@
|
|||||||
#ifndef WELCOME_CONFIG_H
|
#ifndef WELCOME_CONFIG_H
|
||||||
#define WELCOME_CONFIG_H
|
#define WELCOME_CONFIG_H
|
||||||
|
|
||||||
#include "modulesystem/Requirement.h"
|
|
||||||
#include "locale/LabelModel.h"
|
#include "locale/LabelModel.h"
|
||||||
|
#include "modulesystem/Requirement.h"
|
||||||
|
#include "modulesystem/RequirementsModel.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
// TODO: move this (and modulesystem/Requirement) to libcalamares
|
|
||||||
class RequirementsModel : public QAbstractListModel
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
Q_PROPERTY( bool satisfiedRequirements READ satisfiedRequirements NOTIFY satisfiedRequirementsChanged FINAL )
|
|
||||||
Q_PROPERTY( bool satisfiedMandatory READ satisfiedMandatory NOTIFY satisfiedMandatoryChanged FINAL )
|
|
||||||
Q_PROPERTY( QString warningMessage READ warningMessage NOTIFY warningMessageChanged FINAL )
|
|
||||||
|
|
||||||
public:
|
|
||||||
using QAbstractListModel::QAbstractListModel;
|
|
||||||
|
|
||||||
enum Roles : short
|
|
||||||
{
|
|
||||||
Name,
|
|
||||||
Satisfied,
|
|
||||||
Mandatory,
|
|
||||||
Details,
|
|
||||||
NegatedText,
|
|
||||||
HasDetails
|
|
||||||
};
|
|
||||||
|
|
||||||
bool satisfiedRequirements() const { return m_satisfiedRequirements; }
|
|
||||||
|
|
||||||
bool satisfiedMandatory() const { return m_satisfiedMandatory; }
|
|
||||||
|
|
||||||
const Calamares::RequirementEntry& getEntry( const int& index ) const
|
|
||||||
{
|
|
||||||
if ( index > count() || index < 0 )
|
|
||||||
{
|
|
||||||
return *( new Calamares::RequirementEntry() );
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_requirements.at( index );
|
|
||||||
}
|
|
||||||
|
|
||||||
void setRequirementsList( const Calamares::RequirementsList& requirements );
|
|
||||||
int rowCount( const QModelIndex& ) const override;
|
|
||||||
int count() const { return m_requirements.count(); }
|
|
||||||
|
|
||||||
QString warningMessage() const { return m_warningMessage; }
|
|
||||||
|
|
||||||
void retranslate();
|
|
||||||
|
|
||||||
QVariant data( const QModelIndex& index, int role ) const override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QHash< int, QByteArray > roleNames() const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Calamares::RequirementsList m_requirements;
|
|
||||||
bool m_satisfiedRequirements = false;
|
|
||||||
bool m_satisfiedMandatory = false;
|
|
||||||
|
|
||||||
QString m_warningMessage;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void satisfiedRequirementsChanged( bool value );
|
|
||||||
void satisfiedMandatoryChanged();
|
|
||||||
void warningMessageChanged();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class Config : public QObject
|
class Config : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY( CalamaresUtils::Locale::LabelModel* languagesModel READ languagesModel CONSTANT FINAL )
|
Q_PROPERTY( CalamaresUtils::Locale::LabelModel* languagesModel READ languagesModel CONSTANT FINAL )
|
||||||
Q_PROPERTY( RequirementsModel* requirementsModel MEMBER m_requirementsModel CONSTANT FINAL )
|
Q_PROPERTY( Calamares::RequirementsModel* requirementsModel MEMBER m_requirementsModel CONSTANT FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( QString languageIcon READ languageIcon CONSTANT FINAL )
|
Q_PROPERTY( QString languageIcon READ languageIcon CONSTANT FINAL )
|
||||||
|
|
||||||
@ -99,6 +38,7 @@ class Config : public QObject
|
|||||||
Q_PROPERTY( int localeIndex READ localeIndex WRITE setLocaleIndex NOTIFY localeIndexChanged )
|
Q_PROPERTY( int localeIndex READ localeIndex WRITE setLocaleIndex NOTIFY localeIndexChanged )
|
||||||
|
|
||||||
Q_PROPERTY( QString genericWelcomeMessage MEMBER m_genericWelcomeMessage NOTIFY genericWelcomeMessageChanged FINAL )
|
Q_PROPERTY( QString genericWelcomeMessage MEMBER m_genericWelcomeMessage NOTIFY genericWelcomeMessageChanged FINAL )
|
||||||
|
Q_PROPERTY( QString warningMessage READ warningMessage NOTIFY warningMessageChanged FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( QString supportUrl MEMBER m_supportUrl NOTIFY supportUrlChanged FINAL )
|
Q_PROPERTY( QString supportUrl MEMBER m_supportUrl NOTIFY supportUrlChanged FINAL )
|
||||||
Q_PROPERTY( QString knownIssuesUrl MEMBER m_knownIssuesUrl NOTIFY knownIssuesUrlChanged FINAL )
|
Q_PROPERTY( QString knownIssuesUrl MEMBER m_knownIssuesUrl NOTIFY knownIssuesUrlChanged FINAL )
|
||||||
@ -109,13 +49,17 @@ class Config : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Config( QObject* parent = nullptr );
|
Config( QObject* parent = nullptr );
|
||||||
|
|
||||||
|
Calamares::RequirementsModel& requirementsModel() const;
|
||||||
|
|
||||||
void setCountryCode( const QString& countryCode );
|
void setCountryCode( const QString& countryCode );
|
||||||
|
|
||||||
|
QString languageIcon() const;
|
||||||
void setLanguageIcon( const QString& languageIcon );
|
void setLanguageIcon( const QString& languageIcon );
|
||||||
RequirementsModel& requirementsModel() const;
|
|
||||||
|
|
||||||
void setIsNextEnabled( const bool& isNextEnabled );
|
void setIsNextEnabled( bool isNextEnabled );
|
||||||
|
|
||||||
void setLocaleIndex( const int& index );
|
void setLocaleIndex( int index );
|
||||||
int localeIndex() const { return m_localeIndex; }
|
int localeIndex() const { return m_localeIndex; }
|
||||||
|
|
||||||
QString supportUrl() const;
|
QString supportUrl() const;
|
||||||
@ -130,40 +74,44 @@ public:
|
|||||||
QString donateUrl() const;
|
QString donateUrl() const;
|
||||||
void setDonateUrl( const QString& url );
|
void setDonateUrl( const QString& url );
|
||||||
|
|
||||||
QString genericWelcomeMessage();
|
QString genericWelcomeMessage() const;
|
||||||
|
QString warningMessage() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
CalamaresUtils::Locale::LabelModel* languagesModel() const;
|
CalamaresUtils::Locale::LabelModel* languagesModel() const;
|
||||||
void retranslate();
|
void retranslate();
|
||||||
QString languageIcon() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void initLanguages();
|
|
||||||
QVariantMap m_configurationMap;
|
|
||||||
RequirementsModel* m_requirementsModel;
|
|
||||||
QString m_languageIcon;
|
|
||||||
QString m_countryCode;
|
|
||||||
int m_localeIndex = 0;
|
|
||||||
bool m_isNextEnabled = false;
|
|
||||||
CalamaresUtils::Locale::LabelModel* m_languages;
|
|
||||||
|
|
||||||
QString m_genericWelcomeMessage;
|
|
||||||
|
|
||||||
QString m_supportUrl;
|
|
||||||
QString m_knownIssuesUrl;
|
|
||||||
QString m_releaseNotesUrl;
|
|
||||||
QString m_donateUrl;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void countryCodeChanged( QString countryCode );
|
void countryCodeChanged( QString countryCode );
|
||||||
void localeIndexChanged( int localeIndex );
|
void localeIndexChanged( int localeIndex );
|
||||||
void isNextEnabledChanged( bool isNextEnabled );
|
void isNextEnabledChanged( bool isNextEnabled );
|
||||||
void genericWelcomeMessageChanged();
|
|
||||||
|
void genericWelcomeMessageChanged( QString message );
|
||||||
|
void warningMessageChanged( QString message );
|
||||||
|
|
||||||
void supportUrlChanged();
|
void supportUrlChanged();
|
||||||
void knownIssuesUrlChanged();
|
void knownIssuesUrlChanged();
|
||||||
void releaseNotesUrlChanged();
|
void releaseNotesUrlChanged();
|
||||||
void donateUrlChanged();
|
void donateUrlChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initLanguages();
|
||||||
|
|
||||||
|
Calamares::RequirementsModel* m_requirementsModel;
|
||||||
|
CalamaresUtils::Locale::LabelModel* m_languages;
|
||||||
|
|
||||||
|
QString m_languageIcon;
|
||||||
|
QString m_countryCode;
|
||||||
|
int m_localeIndex = 0;
|
||||||
|
bool m_isNextEnabled = false;
|
||||||
|
|
||||||
|
QString m_genericWelcomeMessage;
|
||||||
|
QString m_warningMessage;
|
||||||
|
|
||||||
|
QString m_supportUrl;
|
||||||
|
QString m_knownIssuesUrl;
|
||||||
|
QString m_releaseNotesUrl;
|
||||||
|
QString m_donateUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,6 +47,7 @@ WelcomeViewStep::WelcomeViewStep( QObject* parent )
|
|||||||
|
|
||||||
// the instance of the qqc2 or qwidgets page
|
// the instance of the qqc2 or qwidgets page
|
||||||
m_widget = new WelcomePage( m_conf );
|
m_widget = new WelcomePage( m_conf );
|
||||||
|
connect( m_conf, &Config::localeIndexChanged, m_widget, &WelcomePage::externallySelectedLanguage );
|
||||||
}
|
}
|
||||||
|
|
||||||
WelcomeViewStep::~WelcomeViewStep()
|
WelcomeViewStep::~WelcomeViewStep()
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
|
|
||||||
CheckerContainer::CheckerContainer( const RequirementsModel &model, QWidget* parent )
|
CheckerContainer::CheckerContainer( const Calamares::RequirementsModel &model, QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, m_waitingWidget( new WaitingWidget( QString(), this ) )
|
, m_waitingWidget( new WaitingWidget( QString(), this ) )
|
||||||
, m_checkerWidget( nullptr )
|
, m_checkerWidget( nullptr )
|
||||||
|
@ -40,7 +40,7 @@ class CheckerContainer : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit CheckerContainer(const RequirementsModel &model, QWidget* parent = nullptr );
|
explicit CheckerContainer(const Calamares::RequirementsModel &model, QWidget* parent = nullptr );
|
||||||
virtual ~CheckerContainer();
|
virtual ~CheckerContainer();
|
||||||
|
|
||||||
bool verdict() const;
|
bool verdict() const;
|
||||||
@ -58,7 +58,7 @@ protected:
|
|||||||
bool m_verdict;
|
bool m_verdict;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const RequirementsModel &m_model;
|
const Calamares::RequirementsModel &m_model;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
static void
|
static void
|
||||||
createResultWidgets( QLayout* layout,
|
createResultWidgets( QLayout* layout,
|
||||||
QList< ResultWidget* >& resultWidgets,
|
QList< ResultWidget* >& resultWidgets,
|
||||||
const RequirementsModel &model,
|
const Calamares::RequirementsModel &model,
|
||||||
std::function< bool( const Calamares::RequirementEntry& ) > predicate
|
std::function< bool( const Calamares::RequirementEntry& ) > predicate
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -94,18 +94,18 @@ public:
|
|||||||
* The list must continue to exist for the lifetime of the dialog,
|
* The list must continue to exist for the lifetime of the dialog,
|
||||||
* or UB happens.
|
* or UB happens.
|
||||||
*/
|
*/
|
||||||
ResultsListDialog( const RequirementsModel& model, QWidget* parent );
|
ResultsListDialog( const Calamares::RequirementsModel& model, QWidget* parent );
|
||||||
virtual ~ResultsListDialog();
|
virtual ~ResultsListDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel* m_title;
|
QLabel* m_title;
|
||||||
QList< ResultWidget* > m_resultWidgets; ///< One widget for each entry with details available
|
QList< ResultWidget* > m_resultWidgets; ///< One widget for each entry with details available
|
||||||
const RequirementsModel& m_model;
|
const Calamares::RequirementsModel& m_model;
|
||||||
|
|
||||||
void retranslate();
|
void retranslate();
|
||||||
};
|
};
|
||||||
|
|
||||||
ResultsListDialog::ResultsListDialog( const RequirementsModel& model, QWidget* parent)
|
ResultsListDialog::ResultsListDialog( const Calamares::RequirementsModel& model, QWidget* parent)
|
||||||
: QDialog( parent )
|
: QDialog( parent )
|
||||||
, m_model( model )
|
, m_model( model )
|
||||||
{
|
{
|
||||||
@ -151,7 +151,7 @@ ResultsListDialog::retranslate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ResultsListWidget::ResultsListWidget( const RequirementsModel &model, QWidget* parent )
|
ResultsListWidget::ResultsListWidget( const Calamares::RequirementsModel &model, QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
, m_model( model )
|
, m_model( model )
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ class ResultsListWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ResultsListWidget(const RequirementsModel &model, QWidget* parent);
|
explicit ResultsListWidget(const Calamares::RequirementsModel &model, QWidget* parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// @brief A link in the explanatory text has been clicked
|
/// @brief A link in the explanatory text has been clicked
|
||||||
@ -38,7 +38,7 @@ private:
|
|||||||
void retranslate();
|
void retranslate();
|
||||||
|
|
||||||
QLabel* m_explanation = nullptr; ///< Explanatory text above the list, with link
|
QLabel* m_explanation = nullptr; ///< Explanatory text above the list, with link
|
||||||
const RequirementsModel &m_model;
|
const Calamares::RequirementsModel &m_model;
|
||||||
QList< ResultWidget* > m_resultWidgets; ///< One widget for each unsatisfied entry
|
QList< ResultWidget* > m_resultWidgets; ///< One widget for each unsatisfied entry
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user