[welcome] Refactor ResultsListWidget
- no point in having init() called immediately after the constructor, if it only makes sense to have one call to init() ever to create the widget. - while here, give it the same kind of structure as the dialog, holding on to a reference to the list.
This commit is contained in:
parent
320dcac946
commit
bede280f91
@ -40,10 +40,7 @@ CheckerContainer::CheckerContainer( QWidget* parent )
|
||||
CalamaresUtils::unmarginLayout( mainLayout );
|
||||
|
||||
mainLayout->addWidget( m_waitingWidget );
|
||||
CALAMARES_RETRANSLATE(
|
||||
if ( m_waitingWidget )
|
||||
m_waitingWidget->setText( tr( "Gathering system information..." ) );
|
||||
)
|
||||
CALAMARES_RETRANSLATE( if ( m_waitingWidget ) m_waitingWidget->setText( tr( "Gathering system information..." ) ); )
|
||||
}
|
||||
|
||||
CheckerContainer::~CheckerContainer()
|
||||
@ -52,32 +49,37 @@ CheckerContainer::~CheckerContainer()
|
||||
delete m_checkerWidget;
|
||||
}
|
||||
|
||||
void CheckerContainer::requirementsComplete( bool ok )
|
||||
void
|
||||
CheckerContainer::requirementsComplete( bool ok )
|
||||
{
|
||||
|
||||
layout()->removeWidget( m_waitingWidget );
|
||||
m_waitingWidget->deleteLater();
|
||||
m_waitingWidget = nullptr; // Don't delete in destructor
|
||||
|
||||
m_checkerWidget = new ResultsListWidget( this );
|
||||
m_checkerWidget->init( m_requirements );
|
||||
m_checkerWidget = new ResultsListWidget( this, m_requirements );
|
||||
layout()->addWidget( m_checkerWidget );
|
||||
|
||||
m_verdict = ok;
|
||||
}
|
||||
|
||||
void CheckerContainer::requirementsChecked(const Calamares::RequirementsList& l)
|
||||
void
|
||||
CheckerContainer::requirementsChecked( const Calamares::RequirementsList& l )
|
||||
{
|
||||
m_requirements.append( l );
|
||||
}
|
||||
|
||||
void CheckerContainer::requirementsProgress(const QString& message)
|
||||
void
|
||||
CheckerContainer::requirementsProgress( const QString& message )
|
||||
{
|
||||
if ( m_waitingWidget )
|
||||
{
|
||||
m_waitingWidget->setText( message );
|
||||
}
|
||||
}
|
||||
|
||||
bool CheckerContainer::verdict() const
|
||||
bool
|
||||
CheckerContainer::verdict() const
|
||||
{
|
||||
return m_verdict;
|
||||
}
|
||||
|
@ -126,8 +126,9 @@ ResultsListDialog::retranslate()
|
||||
}
|
||||
|
||||
|
||||
ResultsListWidget::ResultsListWidget( QWidget* parent )
|
||||
ResultsListWidget::ResultsListWidget( QWidget* parent, const Calamares::RequirementsList& checkEntries )
|
||||
: QWidget( parent )
|
||||
, m_entries( checkEntries )
|
||||
{
|
||||
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
|
||||
|
||||
@ -143,12 +144,7 @@ ResultsListWidget::ResultsListWidget( QWidget* parent )
|
||||
spacerLayout->addLayout( m_entriesLayout );
|
||||
spacerLayout->addSpacing( paddingSize );
|
||||
CalamaresUtils::unmarginLayout( spacerLayout );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ResultsListWidget::init( const Calamares::RequirementsList& checkEntries )
|
||||
{
|
||||
bool allChecked = true;
|
||||
bool requirementsSatisfied = true;
|
||||
|
||||
|
@ -29,15 +29,14 @@ class ResultsListWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ResultsListWidget( QWidget* parent = nullptr );
|
||||
|
||||
void init( const Calamares::RequirementsList& checkEntries );
|
||||
explicit ResultsListWidget( QWidget* parent, const Calamares::RequirementsList& checkEntries );
|
||||
|
||||
private:
|
||||
void showDetailsDialog( const Calamares::RequirementsList& checkEntries );
|
||||
|
||||
QBoxLayout* m_mainLayout;
|
||||
QBoxLayout* m_entriesLayout;
|
||||
const Calamares::RequirementsList& m_entries;
|
||||
};
|
||||
|
||||
#endif // CHECKER_RESULTSLISTWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user