[libcalamares] Move progress signal to RequirementsModel
- It is the requirements model (checking) that reports progress, and now the model is accessible (ask for it with requirementsModel(), make the messages come from there.
This commit is contained in:
parent
90f8e748ef
commit
f856c07b04
@ -41,6 +41,7 @@ RequirementsChecker::RequirementsChecker( QVector< Module* > modules, Requiremen
|
||||
, m_progressTimeouts( 0 )
|
||||
{
|
||||
m_watchers.reserve( m_modules.count() );
|
||||
connect( this, &RequirementsChecker::requirementsProgress, model, &RequirementsModel::setProgressMessage );
|
||||
}
|
||||
|
||||
RequirementsChecker::~RequirementsChecker() {}
|
||||
@ -97,8 +98,7 @@ RequirementsChecker::addCheckedRequirements( Module* m )
|
||||
m_model->addRequirementsList( l );
|
||||
}
|
||||
|
||||
requirementsProgress(
|
||||
tr( "Requirements checking for module <i>%1</i> is complete." ).arg( m->name() ) );
|
||||
requirementsProgress( tr( "Requirements checking for module <i>%1</i> is complete." ).arg( m->name() ) );
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -105,4 +105,11 @@ RequirementsModel::describe() const
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RequirementsModel::setProgressMessage( const QString& m )
|
||||
{
|
||||
m_progressMessage = m;
|
||||
emit progressMessageChanged( m_progressMessage );
|
||||
}
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -46,6 +46,7 @@ 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 )
|
||||
Q_PROPERTY( QString progressMessage READ progressMessage NOTIFY progressMessageChanged FINAL )
|
||||
|
||||
public:
|
||||
using QAbstractListModel::QAbstractListModel;
|
||||
@ -65,6 +66,9 @@ public:
|
||||
bool satisfiedRequirements() const { return m_satisfiedRequirements; }
|
||||
///@brief Are all the **mandatory** requirements satisfied?
|
||||
bool satisfiedMandatory() const { return m_satisfiedMandatory; }
|
||||
///@brief Message (from an ongoing check) about progress
|
||||
QString progressMessage() const { return m_progressMessage; }
|
||||
|
||||
|
||||
QVariant data( const QModelIndex& index, int role ) const override;
|
||||
int rowCount( const QModelIndex& ) const override;
|
||||
@ -76,6 +80,7 @@ public:
|
||||
signals:
|
||||
void satisfiedRequirementsChanged( bool value );
|
||||
void satisfiedMandatoryChanged( bool value );
|
||||
void progressMessageChanged( QString message );
|
||||
|
||||
protected:
|
||||
QHash< int, QByteArray > roleNames() const override;
|
||||
@ -83,10 +88,14 @@ protected:
|
||||
///@brief Append some requirements; resets the model
|
||||
void addRequirementsList( const Calamares::RequirementsList& requirements );
|
||||
|
||||
///@brief Update progress message (called by the checker)
|
||||
void setProgressMessage( const QString& m );
|
||||
|
||||
private:
|
||||
///@brief Implementation for {set,add}RequirementsList
|
||||
void changeRequirementsList();
|
||||
|
||||
QString m_progressMessage;
|
||||
QMutex m_addLock;
|
||||
RequirementsList m_requirements;
|
||||
bool m_satisfiedRequirements = false;
|
||||
|
@ -358,7 +358,6 @@ ModuleManager::checkRequirements()
|
||||
}
|
||||
|
||||
RequirementsChecker* rq = new RequirementsChecker( modules, m_requirementsModel, this );
|
||||
connect( rq, &RequirementsChecker::requirementsProgress, this, &ModuleManager::requirementsProgress );
|
||||
connect( rq, &RequirementsChecker::done, rq, &RequirementsChecker::deleteLater );
|
||||
connect( rq, &RequirementsChecker::done, this, [=](){ this->requirementsComplete( m_requirementsModel->satisfiedMandatory() ); } );
|
||||
|
||||
|
@ -100,7 +100,6 @@ signals:
|
||||
void modulesFailed( QStringList ); /// .. or not
|
||||
// Below, see RequirementsChecker documentation
|
||||
void requirementsComplete( bool );
|
||||
void requirementsProgress( const QString& );
|
||||
|
||||
private slots:
|
||||
void doInit();
|
||||
|
Loading…
Reference in New Issue
Block a user