[welcome] Add a filtered model for unsatisfied requirements
This commit is contained in:
parent
d1165bea56
commit
f68d0f0628
@ -32,6 +32,7 @@
|
|||||||
Config::Config( QObject* parent )
|
Config::Config( QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_languages( CalamaresUtils::Locale::availableTranslations() )
|
, m_languages( CalamaresUtils::Locale::availableTranslations() )
|
||||||
|
, m_filtermodel( std::make_unique< QSortFilterProxyModel >() )
|
||||||
{
|
{
|
||||||
initLanguages();
|
initLanguages();
|
||||||
|
|
||||||
@ -97,6 +98,18 @@ Config::requirementsModel() const
|
|||||||
return Calamares::ModuleManager::instance()->requirementsModel();
|
return Calamares::ModuleManager::instance()->requirementsModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAbstractItemModel*
|
||||||
|
Config::unsatisfiedRequirements() const
|
||||||
|
{
|
||||||
|
if ( !m_filtermodel->sourceModel() )
|
||||||
|
{
|
||||||
|
m_filtermodel->setFilterRole( Calamares::RequirementsModel::Roles::Satisfied );
|
||||||
|
m_filtermodel->setFilterFixedString( QStringLiteral( "false" ) );
|
||||||
|
m_filtermodel->setSourceModel( requirementsModel() );
|
||||||
|
}
|
||||||
|
return m_filtermodel.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
Config::languageIcon() const
|
Config::languageIcon() const
|
||||||
|
@ -23,8 +23,11 @@
|
|||||||
#include "modulesystem/RequirementsModel.h"
|
#include "modulesystem/RequirementsModel.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class Config : public QObject
|
class Config : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -43,6 +46,14 @@ class Config : public QObject
|
|||||||
* satisfied. See the model documentation for details.
|
* satisfied. See the model documentation for details.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY( Calamares::RequirementsModel* requirementsModel READ requirementsModel CONSTANT FINAL )
|
Q_PROPERTY( Calamares::RequirementsModel* requirementsModel READ requirementsModel CONSTANT FINAL )
|
||||||
|
/** @brief The requirements (from modules) that are **unsatisfied**
|
||||||
|
*
|
||||||
|
* This is the same as requirementsModel(), except filtered so
|
||||||
|
* that only those requirements that are not satisfied are exposed.
|
||||||
|
* Note that the type is different, so you should still use the
|
||||||
|
* requirementsModel() for overall status like *satisfiedMandatory*.
|
||||||
|
*/
|
||||||
|
Q_PROPERTY( QAbstractItemModel* unsatisfiedRequirements READ unsatisfiedRequirements CONSTANT FINAL )
|
||||||
|
|
||||||
Q_PROPERTY( QString languageIcon READ languageIcon CONSTANT FINAL )
|
Q_PROPERTY( QString languageIcon READ languageIcon CONSTANT FINAL )
|
||||||
|
|
||||||
@ -96,6 +107,8 @@ public slots:
|
|||||||
///@brief The **global** requirements model, from ModuleManager
|
///@brief The **global** requirements model, from ModuleManager
|
||||||
Calamares::RequirementsModel* requirementsModel() const;
|
Calamares::RequirementsModel* requirementsModel() const;
|
||||||
|
|
||||||
|
QAbstractItemModel* unsatisfiedRequirements() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void countryCodeChanged( QString countryCode );
|
void countryCodeChanged( QString countryCode );
|
||||||
void localeIndexChanged( int localeIndex );
|
void localeIndexChanged( int localeIndex );
|
||||||
@ -112,7 +125,8 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void initLanguages();
|
void initLanguages();
|
||||||
|
|
||||||
CalamaresUtils::Locale::LabelModel* m_languages;
|
CalamaresUtils::Locale::LabelModel* m_languages = nullptr;
|
||||||
|
std::unique_ptr< QSortFilterProxyModel > m_filtermodel;
|
||||||
|
|
||||||
QString m_languageIcon;
|
QString m_languageIcon;
|
||||||
QString m_countryCode;
|
QString m_countryCode;
|
||||||
|
Loading…
Reference in New Issue
Block a user