diff --git a/src/modules/welcome/CMakeLists.txt b/src/modules/welcome/CMakeLists.txt index 915f5fd2c..f627db032 100644 --- a/src/modules/welcome/CMakeLists.txt +++ b/src/modules/welcome/CMakeLists.txt @@ -16,8 +16,8 @@ include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) set( CHECKER_SOURCES checker/CheckerContainer.cpp - checker/CheckerWidget.cpp - checker/CheckItemWidget.cpp + checker/ResultWidget.cpp + checker/ResultsListWidget.cpp checker/GeneralRequirements.cpp ${PARTMAN_SRC} ) diff --git a/src/modules/welcome/checker/CheckerContainer.cpp b/src/modules/welcome/checker/CheckerContainer.cpp index 569d2e9cc..0524bddb0 100644 --- a/src/modules/welcome/checker/CheckerContainer.cpp +++ b/src/modules/welcome/checker/CheckerContainer.cpp @@ -22,7 +22,7 @@ #include "CheckerContainer.h" -#include "CheckerWidget.h" +#include "ResultsListWidget.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" @@ -59,7 +59,7 @@ void CheckerContainer::requirementsComplete( bool ok ) m_waitingWidget->deleteLater(); m_waitingWidget = nullptr; // Don't delete in destructor - m_checkerWidget = new CheckerWidget( this ); + m_checkerWidget = new ResultsListWidget( this ); m_checkerWidget->init( m_requirements ); layout()->addWidget( m_checkerWidget ); diff --git a/src/modules/welcome/checker/CheckerContainer.h b/src/modules/welcome/checker/CheckerContainer.h index 5a8a1865e..e50b362a2 100644 --- a/src/modules/welcome/checker/CheckerContainer.h +++ b/src/modules/welcome/checker/CheckerContainer.h @@ -27,7 +27,7 @@ #include "modulesystem/Requirement.h" -class CheckerWidget; +class ResultsListWidget; class WaitingWidget; /** @@ -55,7 +55,7 @@ public slots: protected: WaitingWidget *m_waitingWidget; - CheckerWidget *m_checkerWidget; + ResultsListWidget *m_checkerWidget; Calamares::RequirementsList m_requirements; bool m_verdict; diff --git a/src/modules/welcome/checker/ResultWidget.cpp b/src/modules/welcome/checker/ResultWidget.cpp index ef0905100..0a0b438e1 100644 --- a/src/modules/welcome/checker/ResultWidget.cpp +++ b/src/modules/welcome/checker/ResultWidget.cpp @@ -17,7 +17,7 @@ * along with Calamares. If not, see . */ -#include "CheckItemWidget.h" +#include "ResultWidget.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" @@ -31,7 +31,7 @@ static inline void setCondition( QLabel* label, CalamaresUtils::ImageType t ) QSize( label->height(), label->height() ) ) ); } -CheckItemWidget::CheckItemWidget( bool checked, +ResultWidget::ResultWidget( bool satisfied, bool required, QWidget* parent ) : QWidget( parent ) @@ -46,8 +46,7 @@ CheckItemWidget::CheckItemWidget( bool checked, mainLayout->addWidget( m_textLabel ); m_textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); - if ( checked ) - // Condition is satisfied + if ( satisfied ) setCondition( m_iconLabel, CalamaresUtils::StatusOk ); else if ( required ) @@ -58,7 +57,7 @@ CheckItemWidget::CheckItemWidget( bool checked, void -CheckItemWidget::setText( const QString& text ) +ResultWidget::setText( const QString& text ) { m_textLabel->setText( text ); } diff --git a/src/modules/welcome/checker/ResultWidget.h b/src/modules/welcome/checker/ResultWidget.h index d2224c694..d842339ef 100644 --- a/src/modules/welcome/checker/ResultWidget.h +++ b/src/modules/welcome/checker/ResultWidget.h @@ -1,7 +1,7 @@ /* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac - * Copyright 2017, Adriaan de Groot + * Copyright 2017, 2019, Adriaan de Groot * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,22 +17,35 @@ * along with Calamares. If not, see . */ -#ifndef CHECKITEMWIDGET_H -#define CHECKITEMWIDGET_H +#ifndef CHECKER_RESULTWIDGET_H +#define CHECKER_RESULTWIDGET_H #include -class CheckItemWidget : public QWidget +/** + * @brief Displays the results of a single check. + * + * Widget to insert into a ResultListWidget to display an iconic status + * (warning or failure when the check is not satisfied) along with + * descriptive test. + */ +class ResultWidget : public QWidget { Q_OBJECT public: - explicit CheckItemWidget( bool checked, bool required, - QWidget* parent = nullptr ); + /** + * @brief Create widget with results of a check. + * + * Use setText() to set up the text of the widget. + */ + explicit ResultWidget( bool satisfied, bool required, + QWidget* parent = nullptr ); + /// @brief Set the displayed description of the check. void setText( const QString& text ); private: QLabel* m_textLabel; QLabel* m_iconLabel; }; -#endif // CHECKITEMWIDGET_H +#endif // CHECKER_RESULTWIDGET_H diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index 2ad79abfd..1c566026f 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -17,9 +17,9 @@ * along with Calamares. If not, see . */ -#include "CheckerWidget.h" +#include "ResultsListWidget.h" -#include "CheckItemWidget.h" +#include "ResultWidget.h" #include "Branding.h" #include "utils/CalamaresUtilsGui.h" @@ -33,7 +33,7 @@ #include -CheckerWidget::CheckerWidget( QWidget* parent ) +ResultsListWidget::ResultsListWidget( QWidget* parent ) : QWidget( parent ) { setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); @@ -53,7 +53,7 @@ CheckerWidget::CheckerWidget( QWidget* parent ) void -CheckerWidget::init( const Calamares::RequirementsList& checkEntries ) +ResultsListWidget::init( const Calamares::RequirementsList& checkEntries ) { bool allChecked = true; bool requirementsSatisfied = true; @@ -62,7 +62,7 @@ CheckerWidget::init( const Calamares::RequirementsList& checkEntries ) { if ( !entry.satisfied ) { - CheckItemWidget* ciw = new CheckItemWidget( entry.satisfied, entry.mandatory ); + ResultWidget* ciw = new ResultWidget( entry.satisfied, entry.mandatory ); CALAMARES_RETRANSLATE( ciw->setText( entry.negatedText() ); ) m_entriesLayout->addWidget( ciw ); ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); @@ -162,7 +162,7 @@ CheckerWidget::init( const Calamares::RequirementsList& checkEntries ) void -CheckerWidget::showDetailsDialog( const Calamares::RequirementsList& checkEntries ) +ResultsListWidget::showDetailsDialog( const Calamares::RequirementsList& checkEntries ) { QDialog* detailsDialog = new QDialog( this ); QBoxLayout* mainLayout = new QVBoxLayout; @@ -182,7 +182,7 @@ CheckerWidget::showDetailsDialog( const Calamares::RequirementsList& checkEntrie if ( entry.enumerationText().isEmpty() ) continue; - CheckItemWidget* ciw = new CheckItemWidget( entry.satisfied, entry.mandatory ); + ResultWidget* ciw = new ResultWidget( entry.satisfied, entry.mandatory ); CALAMARES_RETRANSLATE( ciw->setText( entry.enumerationText() ); ) entriesLayout->addWidget( ciw ); ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); diff --git a/src/modules/welcome/checker/ResultsListWidget.h b/src/modules/welcome/checker/ResultsListWidget.h index 81eb6fef0..58bac0602 100644 --- a/src/modules/welcome/checker/ResultsListWidget.h +++ b/src/modules/welcome/checker/ResultsListWidget.h @@ -16,19 +16,19 @@ * along with Calamares. If not, see . */ -#ifndef CHECKERWIDGET_H -#define CHECKERWIDGET_H +#ifndef CHECKER_RESULTSLISTWIDGET_H +#define CHECKER_RESULTSLISTWIDGET_H #include "modulesystem/Requirement.h" #include #include -class CheckerWidget : public QWidget +class ResultsListWidget : public QWidget { Q_OBJECT public: - explicit CheckerWidget( QWidget* parent = nullptr ); + explicit ResultsListWidget( QWidget* parent = nullptr ); void init( const Calamares::RequirementsList& checkEntries ); @@ -40,4 +40,4 @@ private: int m_paddingSize; }; -#endif // CHECKERWIDGET_H +#endif // CHECKER_RESULTSLISTWIDGET_H