Merge branch 'requirements-checking-segv'
This commit is contained in:
commit
d289b1bed4
13
CHANGES
13
CHANGES
@ -6,16 +6,29 @@ website will have to do for older versions.
|
||||
# 3.2.5 (unreleased) #
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
- Arnaud Ferraris
|
||||
- Dan Simmons
|
||||
|
||||
## Core ##
|
||||
|
||||
* View modules (in C++) can now perform their own requirements-checking
|
||||
to see if installation makes sense. This expands upon the existing
|
||||
requirements checks in the welcome module (RAM, disk space, ..).
|
||||
The checks have been made asynchronous, so that responsiveness during
|
||||
requirements-checking is improved and the user has better feedback.
|
||||
|
||||
## Modules ##
|
||||
|
||||
* *Partition* module: it is now possible to build without libparted. Since
|
||||
KPMCore may not need this library anymore, it is a dependency that will
|
||||
be dropped as soon as it is feasible. Add `-DCMAKE_DISABLE_FIND_PACKAGE_LIBPARTED=ON`
|
||||
to the CMake flags to do so.
|
||||
* Python modules: several modules have had translations added. This is
|
||||
usually only visible when the module runs as part of the *exec* step,
|
||||
when the module's *pretty name* is displayed. In addition, error
|
||||
messages are now translated.
|
||||
|
||||
|
||||
# 3.2.4 (2019-02-12) #
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
|
@ -45,14 +45,17 @@ struct RequirementEntry
|
||||
/// @brief name of this requirement; not shown to user and used as ID
|
||||
QString name;
|
||||
|
||||
/// @brief Description of this requirement, for use in user-visible lists
|
||||
/// @brief Detailed description of this requirement, for use in user-visible lists
|
||||
TextFunction enumerationText;
|
||||
|
||||
/// @brief User-visible string to show that the requirement is not met
|
||||
/// @brief User-visible string to show that the requirement is not met, short form
|
||||
TextFunction negatedText;
|
||||
|
||||
bool satisfied;
|
||||
bool mandatory;
|
||||
|
||||
/// @brief Convenience to check if this entry should be shown in details dialog
|
||||
bool hasDetails() const { return !enumerationText().isEmpty(); }
|
||||
};
|
||||
|
||||
using RequirementsList = QList< RequirementEntry >;
|
||||
|
@ -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}
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2017, 2019, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2017, Gabriel Craciunescu <crazy@frugalware.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
@ -22,17 +22,17 @@
|
||||
|
||||
#include "CheckerContainer.h"
|
||||
|
||||
#include "CheckerWidget.h"
|
||||
#include "ResultsListWidget.h"
|
||||
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Retranslator.h"
|
||||
#include "widgets/WaitingWidget.h"
|
||||
|
||||
CheckerContainer::CheckerContainer(QWidget* parent)
|
||||
CheckerContainer::CheckerContainer( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, m_waitingWidget( new WaitingWidget( QString() ) )
|
||||
, m_checkerWidget( new CheckerWidget() )
|
||||
, m_waitingWidget( new WaitingWidget( QString(), this ) )
|
||||
, m_checkerWidget( nullptr )
|
||||
, m_verdict( false )
|
||||
{
|
||||
QBoxLayout* mainLayout = new QHBoxLayout;
|
||||
@ -40,7 +40,10 @@ CheckerContainer::CheckerContainer(QWidget* parent)
|
||||
CalamaresUtils::unmarginLayout( mainLayout );
|
||||
|
||||
mainLayout->addWidget( m_waitingWidget );
|
||||
CALAMARES_RETRANSLATE( m_waitingWidget->setText( tr( "Gathering system information..." ) ); )
|
||||
CALAMARES_RETRANSLATE(
|
||||
if ( m_waitingWidget )
|
||||
m_waitingWidget->setText( tr( "Gathering system information..." ) );
|
||||
)
|
||||
}
|
||||
|
||||
CheckerContainer::~CheckerContainer()
|
||||
@ -51,11 +54,13 @@ CheckerContainer::~CheckerContainer()
|
||||
|
||||
void CheckerContainer::requirementsComplete( bool ok )
|
||||
{
|
||||
m_checkerWidget->init( m_requirements );
|
||||
|
||||
layout()->removeWidget( m_waitingWidget );
|
||||
m_waitingWidget->deleteLater();
|
||||
m_waitingWidget = nullptr; // Don't delete in destructor
|
||||
m_checkerWidget->setParent( this );
|
||||
|
||||
m_checkerWidget = new ResultsListWidget( this );
|
||||
m_checkerWidget->init( m_requirements );
|
||||
layout()->addWidget( m_checkerWidget );
|
||||
|
||||
m_verdict = ok;
|
||||
|
@ -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;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* === 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>
|
||||
* Copyright 2017, 2019, 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
|
||||
@ -17,7 +17,7 @@
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CheckItemWidget.h"
|
||||
#include "ResultWidget.h"
|
||||
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "utils/Logger.h"
|
||||
@ -26,12 +26,13 @@
|
||||
|
||||
static inline void setCondition( QLabel* label, CalamaresUtils::ImageType t )
|
||||
{
|
||||
label->setPixmap( CalamaresUtils::defaultPixmap( t,
|
||||
label->setPixmap(
|
||||
CalamaresUtils::defaultPixmap( t,
|
||||
CalamaresUtils::Original,
|
||||
QSize( label->height(), label->height() ) ) );
|
||||
}
|
||||
|
||||
CheckItemWidget::CheckItemWidget( bool checked,
|
||||
ResultWidget::ResultWidget( bool satisfied,
|
||||
bool required,
|
||||
QWidget* parent )
|
||||
: QWidget( parent )
|
||||
@ -46,11 +47,9 @@ 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 )
|
||||
else if ( required )
|
||||
setCondition( m_iconLabel, CalamaresUtils::StatusError );
|
||||
else
|
||||
setCondition( m_iconLabel, CalamaresUtils::StatusWarning );
|
||||
@ -58,7 +57,7 @@ CheckItemWidget::CheckItemWidget( bool checked,
|
||||
|
||||
|
||||
void
|
||||
CheckItemWidget::setText( const QString& text )
|
||||
ResultWidget::setText( const QString& text )
|
||||
{
|
||||
m_textLabel->setText( text );
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/* === 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>
|
||||
* Copyright 2017, 2019, 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
|
||||
@ -17,22 +17,35 @@
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CHECKITEMWIDGET_H
|
||||
#define CHECKITEMWIDGET_H
|
||||
#ifndef CHECKER_RESULTWIDGET_H
|
||||
#define CHECKER_RESULTWIDGET_H
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
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,
|
||||
/**
|
||||
* @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
|
@ -1,7 +1,7 @@
|
||||
/* === 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>
|
||||
* Copyright 2017, 2019, 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
|
||||
@ -17,9 +17,9 @@
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "CheckerWidget.h"
|
||||
#include "ResultsListWidget.h"
|
||||
|
||||
#include "CheckItemWidget.h"
|
||||
#include "ResultWidget.h"
|
||||
|
||||
#include "Branding.h"
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
@ -33,7 +33,7 @@
|
||||
#include <QLabel>
|
||||
|
||||
|
||||
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,16 +62,14 @@ 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 );
|
||||
|
||||
allChecked = false;
|
||||
if ( entry.mandatory )
|
||||
{
|
||||
requirementsSatisfied = false;
|
||||
}
|
||||
ciw->setAutoFillBackground( true );
|
||||
QPalette pal( ciw->palette() );
|
||||
pal.setColor( QPalette::Background, Qt::white );
|
||||
@ -131,7 +129,7 @@ CheckerWidget::init( const Calamares::RequirementsList& checkEntries )
|
||||
QLabel* imageLabel;
|
||||
if ( Calamares::Branding::instance()->welcomeExpandingLogo() )
|
||||
{
|
||||
FixedAspectRatioLabel *p = new FixedAspectRatioLabel;
|
||||
FixedAspectRatioLabel* p = new FixedAspectRatioLabel;
|
||||
p->setPixmap( theImage );
|
||||
imageLabel = p;
|
||||
}
|
||||
@ -155,14 +153,12 @@ CheckerWidget::init( const Calamares::RequirementsList& checkEntries )
|
||||
)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mainLayout->addStretch();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CheckerWidget::showDetailsDialog( const Calamares::RequirementsList& checkEntries )
|
||||
ResultsListWidget::showDetailsDialog( const Calamares::RequirementsList& checkEntries )
|
||||
{
|
||||
QDialog* detailsDialog = new QDialog( this );
|
||||
QBoxLayout* mainLayout = new QVBoxLayout;
|
||||
@ -179,10 +175,10 @@ CheckerWidget::showDetailsDialog( const Calamares::RequirementsList& checkEntrie
|
||||
|
||||
for ( const auto& entry : checkEntries )
|
||||
{
|
||||
if ( entry.enumerationText().isEmpty() )
|
||||
if ( !entry.hasDetails() )
|
||||
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 );
|
@ -1,6 +1,7 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2019, 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
|
||||
@ -16,19 +17,19 @@
|
||||
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CHECKERWIDGET_H
|
||||
#define CHECKERWIDGET_H
|
||||
#ifndef CHECKER_RESULTSLISTWIDGET_H
|
||||
#define CHECKER_RESULTSLISTWIDGET_H
|
||||
|
||||
#include "modulesystem/Requirement.h"
|
||||
|
||||
#include <QBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
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 +41,4 @@ private:
|
||||
int m_paddingSize;
|
||||
};
|
||||
|
||||
#endif // CHECKERWIDGET_H
|
||||
#endif // CHECKER_RESULTSLISTWIDGET_H
|
Loading…
Reference in New Issue
Block a user