diff --git a/src/modules/welcome/CMakeLists.txt b/src/modules/welcome/CMakeLists.txt index 38fa33ca8..915f5fd2c 100644 --- a/src/modules/welcome/CMakeLists.txt +++ b/src/modules/welcome/CMakeLists.txt @@ -18,7 +18,7 @@ set( CHECKER_SOURCES checker/CheckerContainer.cpp checker/CheckerWidget.cpp checker/CheckItemWidget.cpp - checker/RequirementsChecker.cpp + checker/GeneralRequirements.cpp ${PARTMAN_SRC} ) diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index 7af42687d..fe24b7c34 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -23,7 +23,6 @@ #include "ui_WelcomePage.h" #include "CalamaresVersion.h" #include "checker/CheckerContainer.h" -#include "checker/RequirementsChecker.h" #include "utils/Logger.h" #include "utils/CalamaresUtilsGui.h" #include "utils/Retranslator.h" diff --git a/src/modules/welcome/WelcomeViewStep.cpp b/src/modules/welcome/WelcomeViewStep.cpp index 003de802f..6a36dd0a1 100644 --- a/src/modules/welcome/WelcomeViewStep.cpp +++ b/src/modules/welcome/WelcomeViewStep.cpp @@ -20,7 +20,7 @@ #include "WelcomeViewStep.h" #include "WelcomePage.h" -#include "checker/RequirementsChecker.h" +#include "checker/GeneralRequirements.h" #include "utils/Logger.h" @@ -30,7 +30,7 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeViewStepFactory, registerPlugin class WelcomePage; -class RequirementsChecker; +class GeneralRequirements; class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep { @@ -61,7 +61,7 @@ public: private: WelcomePage* m_widget; - RequirementsChecker* m_requirementsChecker; + GeneralRequirements* m_requirementsChecker; }; CALAMARES_PLUGIN_FACTORY_DECLARATION( WelcomeViewStepFactory ) diff --git a/src/modules/welcome/checker/CheckerWidget.h b/src/modules/welcome/checker/CheckerWidget.h index 6f5864b1b..81eb6fef0 100644 --- a/src/modules/welcome/checker/CheckerWidget.h +++ b/src/modules/welcome/checker/CheckerWidget.h @@ -20,7 +20,6 @@ #define CHECKERWIDGET_H #include "modulesystem/Requirement.h" -#include "RequirementsChecker.h" #include #include diff --git a/src/modules/welcome/checker/GeneralRequirements.cpp b/src/modules/welcome/checker/GeneralRequirements.cpp index 5225d1dbe..6aba2a2e9 100644 --- a/src/modules/welcome/checker/GeneralRequirements.cpp +++ b/src/modules/welcome/checker/GeneralRequirements.cpp @@ -18,7 +18,7 @@ * along with Calamares. If not, see . */ -#include "RequirementsChecker.h" +#include "GeneralRequirements.h" #include "CheckerContainer.h" #include "partman_devices.h" @@ -53,14 +53,14 @@ #include //geteuid -RequirementsChecker::RequirementsChecker( QObject* parent ) +GeneralRequirements::GeneralRequirements( QObject* parent ) : QObject( parent ) , m_requiredStorageGB( -1 ) , m_requiredRamGB( -1 ) { } -Calamares::RequirementsList RequirementsChecker::checkRequirements() +Calamares::RequirementsList GeneralRequirements::checkRequirements() { QSize availableSize = qApp->desktop()->availableGeometry().size(); @@ -91,7 +91,7 @@ Calamares::RequirementsList RequirementsChecker::checkRequirements() isRoot = checkIsRoot(); using TR = Logger::DebugRow; - cDebug() << "RequirementsChecker output:" + cDebug() << "GeneralRequirements output:" << TR("enoughStorage", enoughStorage) << TR("enoughRam", enoughRam) << TR("hasPower", hasPower) @@ -159,7 +159,7 @@ Calamares::RequirementsList RequirementsChecker::checkRequirements() void -RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) +GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap ) { bool incompleteConfiguration = false; @@ -171,7 +171,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) } else { - cWarning() << "RequirementsChecker entry 'check' is incomplete."; + cWarning() << "GeneralRequirements entry 'check' is incomplete."; incompleteConfiguration = true; } @@ -183,14 +183,14 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) } else { - cWarning() << "RequirementsChecker entry 'required' is incomplete."; + cWarning() << "GeneralRequirements entry 'required' is incomplete."; incompleteConfiguration = true; } // Help out with consistency, but don't fix for ( const auto& r : m_entriesToRequire ) if ( !m_entriesToCheck.contains( r ) ) - cWarning() << "RequirementsChecker requires" << r << "but does not check it."; + cWarning() << "GeneralRequirements requires" << r << "but does not check it."; if ( configurationMap.contains( "requiredStorage" ) && ( configurationMap.value( "requiredStorage" ).type() == QVariant::Double || @@ -200,7 +200,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) m_requiredStorageGB = configurationMap.value( "requiredStorage" ).toDouble( &ok ); if ( !ok ) { - cWarning() << "RequirementsChecker entry 'requiredStorage' is invalid."; + cWarning() << "GeneralRequirements entry 'requiredStorage' is invalid."; m_requiredStorageGB = 3.; } @@ -208,7 +208,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) } else { - cWarning() << "RequirementsChecker entry 'requiredStorage' is missing."; + cWarning() << "GeneralRequirements entry 'requiredStorage' is missing."; m_requiredStorageGB = 3.; incompleteConfiguration = true; } @@ -221,14 +221,14 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) m_requiredRamGB = configurationMap.value( "requiredRam" ).toDouble( &ok ); if ( !ok ) { - cWarning() << "RequirementsChecker entry 'requiredRam' is invalid."; + cWarning() << "GeneralRequirements entry 'requiredRam' is invalid."; m_requiredRamGB = 1.; incompleteConfiguration = true; } } else { - cWarning() << "RequirementsChecker entry 'requiredRam' is missing."; + cWarning() << "GeneralRequirements entry 'requiredRam' is missing."; m_requiredRamGB = 1.; incompleteConfiguration = true; } @@ -240,7 +240,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) if ( m_checkHasInternetUrl.isEmpty() || !QUrl( m_checkHasInternetUrl ).isValid() ) { - cWarning() << "RequirementsChecker entry 'internetCheckUrl' is invalid in welcome.conf" << m_checkHasInternetUrl + cWarning() << "GeneralRequirements entry 'internetCheckUrl' is invalid in welcome.conf" << m_checkHasInternetUrl << "reverting to default (http://example.com)."; m_checkHasInternetUrl = "http://example.com"; incompleteConfiguration = true; @@ -248,7 +248,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) } else { - cWarning() << "RequirementsChecker entry 'internetCheckUrl' is undefined in welcome.conf," + cWarning() << "GeneralRequirements entry 'internetCheckUrl' is undefined in welcome.conf," "reverting to default (http://example.com)."; m_checkHasInternetUrl = "http://example.com"; @@ -257,17 +257,17 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) if ( incompleteConfiguration ) { - cWarning() << "RequirementsChecker configuration map:" << Logger::DebugMap( configurationMap ); + cWarning() << "GeneralRequirements configuration map:" << Logger::DebugMap( configurationMap ); } } bool -RequirementsChecker::checkEnoughStorage( qint64 requiredSpace ) +GeneralRequirements::checkEnoughStorage( qint64 requiredSpace ) { #ifdef WITHOUT_LIBPARTED Q_UNUSED( requiredSpace ); - cWarning() << "RequirementsChecker is configured without libparted."; + cWarning() << "GeneralRequirements is configured without libparted."; return false; #else return check_big_enough( requiredSpace ); @@ -276,7 +276,7 @@ RequirementsChecker::checkEnoughStorage( qint64 requiredSpace ) bool -RequirementsChecker::checkEnoughRam( qint64 requiredRam ) +GeneralRequirements::checkEnoughRam( qint64 requiredRam ) { // Ignore the guesstimate-factor; we get an under-estimate // which is probably the usable RAM for programs. @@ -286,7 +286,7 @@ RequirementsChecker::checkEnoughRam( qint64 requiredRam ) bool -RequirementsChecker::checkBatteryExists() +GeneralRequirements::checkBatteryExists() { const QFileInfo basePath( "/sys/class/power_supply" ); @@ -312,7 +312,7 @@ RequirementsChecker::checkBatteryExists() bool -RequirementsChecker::checkHasPower() +GeneralRequirements::checkHasPower() { const QString UPOWER_SVC_NAME( "org.freedesktop.UPower" ); const QString UPOWER_INTF_NAME( "org.freedesktop.UPower" ); @@ -343,7 +343,7 @@ RequirementsChecker::checkHasPower() bool -RequirementsChecker::checkHasInternet() +GeneralRequirements::checkHasInternet() { // default to true in the QNetworkAccessManager::UnknownAccessibility case QNetworkAccessManager qnam( this ); @@ -367,14 +367,14 @@ RequirementsChecker::checkHasInternet() bool -RequirementsChecker::checkIsRoot() +GeneralRequirements::checkIsRoot() { return !geteuid(); } void -RequirementsChecker::detectFirmwareType() +GeneralRequirements::detectFirmwareType() { QString fwType = QFile::exists( "/sys/firmware/efi/efivars" ) ? "efi" : "bios"; Calamares::JobQueue::instance()->globalStorage()->insert( "firmwareType", fwType ); diff --git a/src/modules/welcome/checker/GeneralRequirements.h b/src/modules/welcome/checker/GeneralRequirements.h index 40f984c05..0e3e341b0 100644 --- a/src/modules/welcome/checker/GeneralRequirements.h +++ b/src/modules/welcome/checker/GeneralRequirements.h @@ -17,19 +17,19 @@ * along with Calamares. If not, see . */ -#ifndef REQUIREMENTSCHECKER_H -#define REQUIREMENTSCHECKER_H +#ifndef GENERALREQUIREMENTS_H +#define GENERALREQUIREMENTS_H #include #include #include "modulesystem/Requirement.h" -class RequirementsChecker : public QObject +class GeneralRequirements : public QObject { Q_OBJECT public: - explicit RequirementsChecker( QObject* parent = nullptr ); + explicit GeneralRequirements( QObject* parent = nullptr ); void setConfigurationMap( const QVariantMap& configurationMap );