diff --git a/src/modules/welcome/CMakeLists.txt b/src/modules/welcome/CMakeLists.txt index f73d8850d..a520aa080 100644 --- a/src/modules/welcome/CMakeLists.txt +++ b/src/modules/welcome/CMakeLists.txt @@ -1,20 +1,24 @@ include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) -find_package( LIBPARTED REQUIRED ) find_package( Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network ) +find_package( LIBPARTED ) +if ( LIBPARTED_FOUND ) + set( PARTMAN_SRC checker/partman_devices.c ) + set( CHECKER_LINK_LIBRARIES ${LIBPARTED_LIBRARY} ) +else() + set( PARTMAN_SRC ) + set( CHECKER_LINK_LIBRARIES ) + add_definitions( -DWITHOUT_LIBPARTED ) +endif() + include_directories( ${PROJECT_BINARY_DIR}/src/libcalamaresui ) set( CHECKER_SOURCES checker/CheckItemWidget.cpp checker/CheckerWidget.cpp checker/RequirementsChecker.cpp - checker/partman_devices.c -) -set( CHECKER_LINK_LIBRARIES - ${LIBPARTED_LIBS} - Qt5::DBus - Qt5::Network + ${PARTMAN_SRC} ) calamares_add_plugin( welcome @@ -29,5 +33,7 @@ calamares_add_plugin( welcome LINK_PRIVATE_LIBRARIES calamaresui ${CHECKER_LINK_LIBRARIES} + Qt5::DBus + Qt5::Network SHARED_LIB ) diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index 8b5c604b4..852a5bfb9 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -1,8 +1,8 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac * Copyright 2015, Anke Boersma - * Copyright 2017, Adriaan de Groot + * Copyright 2017-2018, 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 @@ -82,7 +82,7 @@ WelcomePage::WelcomePage( RequirementsChecker* requirementsChecker, QWidget* par " Philip Müller, Pier Luigi Fiorini, Rohan Garg and the Calamares " "translators team.

" - "Calamares " + "Calamares " "development is sponsored by
" "Blue Systems - " "Liberating Software." diff --git a/src/modules/welcome/WelcomePage.h b/src/modules/welcome/WelcomePage.h index 79546802a..cf187aecb 100644 --- a/src/modules/welcome/WelcomePage.h +++ b/src/modules/welcome/WelcomePage.h @@ -1,4 +1,4 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014, Teo Mrnjavac * diff --git a/src/modules/welcome/WelcomeViewStep.cpp b/src/modules/welcome/WelcomeViewStep.cpp index 3c9d29993..1a43d4ef4 100644 --- a/src/modules/welcome/WelcomeViewStep.cpp +++ b/src/modules/welcome/WelcomeViewStep.cpp @@ -1,4 +1,4 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac * diff --git a/src/modules/welcome/WelcomeViewStep.h b/src/modules/welcome/WelcomeViewStep.h index fbcbd8ded..34b84c29f 100644 --- a/src/modules/welcome/WelcomeViewStep.h +++ b/src/modules/welcome/WelcomeViewStep.h @@ -1,4 +1,4 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac * diff --git a/src/modules/welcome/checker/CheckItemWidget.cpp b/src/modules/welcome/checker/CheckItemWidget.cpp index 5c0d8ec95..ef0905100 100644 --- a/src/modules/welcome/checker/CheckItemWidget.cpp +++ b/src/modules/welcome/checker/CheckItemWidget.cpp @@ -1,6 +1,7 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, 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 @@ -23,7 +24,15 @@ #include +static inline void setCondition( QLabel* label, CalamaresUtils::ImageType t ) +{ + label->setPixmap( CalamaresUtils::defaultPixmap( t, + CalamaresUtils::Original, + QSize( label->height(), label->height() ) ) ); +} + CheckItemWidget::CheckItemWidget( bool checked, + bool required, QWidget* parent ) : QWidget( parent ) { @@ -38,15 +47,13 @@ CheckItemWidget::CheckItemWidget( bool checked, m_textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); if ( checked ) - m_iconLabel->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::Yes, - CalamaresUtils::Original, - QSize( m_iconLabel->height(), - m_iconLabel->height() ) ) ); + // Condition is satisfied + setCondition( m_iconLabel, CalamaresUtils::StatusOk ); else - m_iconLabel->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::No, - CalamaresUtils::Original, - QSize( m_iconLabel->height(), - m_iconLabel->height() ) ) ); + if ( required ) + setCondition( m_iconLabel, CalamaresUtils::StatusError ); + else + setCondition( m_iconLabel, CalamaresUtils::StatusWarning ); } diff --git a/src/modules/welcome/checker/CheckItemWidget.h b/src/modules/welcome/checker/CheckItemWidget.h index dea24712a..d2224c694 100644 --- a/src/modules/welcome/checker/CheckItemWidget.h +++ b/src/modules/welcome/checker/CheckItemWidget.h @@ -1,6 +1,7 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac + * Copyright 2017, 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 @@ -25,7 +26,7 @@ class CheckItemWidget : public QWidget { Q_OBJECT public: - explicit CheckItemWidget( bool checked, + explicit CheckItemWidget( bool checked, bool required, QWidget* parent = nullptr ); void setText( const QString& text ); diff --git a/src/modules/welcome/checker/CheckerWidget.cpp b/src/modules/welcome/checker/CheckerWidget.cpp index 500ab6f85..07a612a9f 100644 --- a/src/modules/welcome/checker/CheckerWidget.cpp +++ b/src/modules/welcome/checker/CheckerWidget.cpp @@ -1,4 +1,4 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac * Copyright 2017, Adriaan de Groot @@ -62,7 +62,7 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries ) { if ( !entry.checked ) { - CheckItemWidget* ciw = new CheckItemWidget( entry.checked ); + CheckItemWidget* ciw = new CheckItemWidget( entry.checked, entry.required ); CALAMARES_RETRANSLATE( ciw->setText( entry.negatedText() ); ) m_entriesLayout->addWidget( ciw ); ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); @@ -182,7 +182,7 @@ CheckerWidget::showDetailsDialog( const QList< PrepareEntry >& checkEntries ) if ( entry.enumerationText().isEmpty() ) continue; - CheckItemWidget* ciw = new CheckItemWidget( entry.checked ); + CheckItemWidget* ciw = new CheckItemWidget( entry.checked, entry.required ); CALAMARES_RETRANSLATE( ciw->setText( entry.enumerationText() ); ) entriesLayout->addWidget( ciw ); ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred ); diff --git a/src/modules/welcome/checker/CheckerWidget.h b/src/modules/welcome/checker/CheckerWidget.h index 9e4accf23..8081e4ee4 100644 --- a/src/modules/welcome/checker/CheckerWidget.h +++ b/src/modules/welcome/checker/CheckerWidget.h @@ -1,4 +1,4 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac * diff --git a/src/modules/welcome/checker/RequirementsChecker.cpp b/src/modules/welcome/checker/RequirementsChecker.cpp index e56e88a4c..4dbd977d1 100644 --- a/src/modules/welcome/checker/RequirementsChecker.cpp +++ b/src/modules/welcome/checker/RequirementsChecker.cpp @@ -1,7 +1,8 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014-2017, Teo Mrnjavac * Copyright 2017, Adriaan de Groot + * Copyright 2017, Gabriel Craciunescu * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -78,7 +79,7 @@ RequirementsChecker::RequirementsChecker( QObject* parent ) bool hasPower = false; bool hasInternet = false; bool isRoot = false; - bool enoughScreen = (availableSize.width() >= CalamaresUtils::windowPreferredWidth) && (availableSize.height() >= CalamaresUtils::windowPreferredHeight); + bool enoughScreen = (availableSize.width() >= CalamaresUtils::windowMinimumWidth) && (availableSize.height() >= CalamaresUtils::windowMinimumHeight); qint64 requiredStorageB = CalamaresUtils::GiBtoBytes(m_requiredStorageGB); cDebug() << "Need at least storage bytes:" << requiredStorageB; @@ -99,8 +100,12 @@ RequirementsChecker::RequirementsChecker( QObject* parent ) if ( m_entriesToCheck.contains( "root" ) ) isRoot = checkIsRoot(); - cDebug() << "enoughStorage, enoughRam, hasPower, hasInternet, isRoot: " - << enoughStorage << enoughRam << hasPower << hasInternet << isRoot; + cDebug() << "RequirementsChecker output:" + << " enoughStorage:" << enoughStorage + << " enoughRam:" << enoughRam + << " hasPower:" << hasPower + << " hasInternet:" << hasInternet + << " isRoot:" << isRoot; QList< PrepareEntry > checkEntries; foreach ( const QString& entry, m_entriesToCheck ) @@ -308,7 +313,12 @@ RequirementsChecker::verdict() const bool RequirementsChecker::checkEnoughStorage( qint64 requiredSpace ) { +#ifdef WITHOUT_LIBPARTED + cDebug() << "WARNING: RequirementsChecker is configured without libparted."; + return false; +#else return check_big_enough( requiredSpace ); +#endif } diff --git a/src/modules/welcome/checker/RequirementsChecker.h b/src/modules/welcome/checker/RequirementsChecker.h index 1e52d9fc5..ceb4eb209 100644 --- a/src/modules/welcome/checker/RequirementsChecker.h +++ b/src/modules/welcome/checker/RequirementsChecker.h @@ -1,6 +1,7 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014-2017, Teo Mrnjavac + * Copyright 2017, 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 @@ -27,6 +28,15 @@ class CheckerWidget; class QWidget; +/** + * An indication of a requirement, which is checked in preparation + * for system installation. An entry has a name and some explanation, + * as well as three meaningful states: + * - checked = true, the requirement is met (green) + * - checked = false, the requirement is not met + * - required = false, warn about it (yellow), no failure + * - required = true, prohibit installation (red) + */ struct PrepareEntry { QString name; diff --git a/src/modules/welcome/checker/partman_devices.c b/src/modules/welcome/checker/partman_devices.c index 2cc97557a..7a7463857 100644 --- a/src/modules/welcome/checker/partman_devices.c +++ b/src/modules/welcome/checker/partman_devices.c @@ -1,4 +1,4 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014-2015, Teo Mrnjavac * diff --git a/src/modules/welcome/checker/partman_devices.h b/src/modules/welcome/checker/partman_devices.h index 8bf620a48..9f7695ee9 100644 --- a/src/modules/welcome/checker/partman_devices.h +++ b/src/modules/welcome/checker/partman_devices.h @@ -1,4 +1,4 @@ -/* === This file is part of Calamares - === +/* === This file is part of Calamares - === * * Copyright 2014, Teo Mrnjavac *