[welcome] Chase renaming of files

- Rename the classes to match
 - Drop some unused includes
main
Adriaan de Groot 6 years ago
parent c1cd88d5fa
commit a19d81e38c

@ -18,7 +18,7 @@ set( CHECKER_SOURCES
checker/CheckerContainer.cpp checker/CheckerContainer.cpp
checker/CheckerWidget.cpp checker/CheckerWidget.cpp
checker/CheckItemWidget.cpp checker/CheckItemWidget.cpp
checker/RequirementsChecker.cpp checker/GeneralRequirements.cpp
${PARTMAN_SRC} ${PARTMAN_SRC}
) )

@ -23,7 +23,6 @@
#include "ui_WelcomePage.h" #include "ui_WelcomePage.h"
#include "CalamaresVersion.h" #include "CalamaresVersion.h"
#include "checker/CheckerContainer.h" #include "checker/CheckerContainer.h"
#include "checker/RequirementsChecker.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/CalamaresUtilsGui.h" #include "utils/CalamaresUtilsGui.h"
#include "utils/Retranslator.h" #include "utils/Retranslator.h"

@ -20,7 +20,7 @@
#include "WelcomeViewStep.h" #include "WelcomeViewStep.h"
#include "WelcomePage.h" #include "WelcomePage.h"
#include "checker/RequirementsChecker.h" #include "checker/GeneralRequirements.h"
#include "utils/Logger.h" #include "utils/Logger.h"
@ -30,7 +30,7 @@ CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeViewStepFactory, registerPlugin<Welc
WelcomeViewStep::WelcomeViewStep( QObject* parent ) WelcomeViewStep::WelcomeViewStep( QObject* parent )
: Calamares::ViewStep( parent ) : Calamares::ViewStep( parent )
, m_requirementsChecker( new RequirementsChecker( this ) ) , m_requirementsChecker( new GeneralRequirements( this ) )
{ {
emit nextStatusChanged( true ); emit nextStatusChanged( true );
m_widget = new WelcomePage(); m_widget = new WelcomePage();

@ -30,7 +30,7 @@
#include <QVariantMap> #include <QVariantMap>
class WelcomePage; class WelcomePage;
class RequirementsChecker; class GeneralRequirements;
class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep
{ {
@ -61,7 +61,7 @@ public:
private: private:
WelcomePage* m_widget; WelcomePage* m_widget;
RequirementsChecker* m_requirementsChecker; GeneralRequirements* m_requirementsChecker;
}; };
CALAMARES_PLUGIN_FACTORY_DECLARATION( WelcomeViewStepFactory ) CALAMARES_PLUGIN_FACTORY_DECLARATION( WelcomeViewStepFactory )

@ -20,7 +20,6 @@
#define CHECKERWIDGET_H #define CHECKERWIDGET_H
#include "modulesystem/Requirement.h" #include "modulesystem/Requirement.h"
#include "RequirementsChecker.h"
#include <QBoxLayout> #include <QBoxLayout>
#include <QWidget> #include <QWidget>

@ -18,7 +18,7 @@
* along with Calamares. If not, see <http://www.gnu.org/licenses/>. * along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "RequirementsChecker.h" #include "GeneralRequirements.h"
#include "CheckerContainer.h" #include "CheckerContainer.h"
#include "partman_devices.h" #include "partman_devices.h"
@ -53,14 +53,14 @@
#include <unistd.h> //geteuid #include <unistd.h> //geteuid
RequirementsChecker::RequirementsChecker( QObject* parent ) GeneralRequirements::GeneralRequirements( QObject* parent )
: QObject( parent ) : QObject( parent )
, m_requiredStorageGB( -1 ) , m_requiredStorageGB( -1 )
, m_requiredRamGB( -1 ) , m_requiredRamGB( -1 )
{ {
} }
Calamares::RequirementsList RequirementsChecker::checkRequirements() Calamares::RequirementsList GeneralRequirements::checkRequirements()
{ {
QSize availableSize = qApp->desktop()->availableGeometry().size(); QSize availableSize = qApp->desktop()->availableGeometry().size();
@ -91,7 +91,7 @@ Calamares::RequirementsList RequirementsChecker::checkRequirements()
isRoot = checkIsRoot(); isRoot = checkIsRoot();
using TR = Logger::DebugRow<const char *, bool>; using TR = Logger::DebugRow<const char *, bool>;
cDebug() << "RequirementsChecker output:" cDebug() << "GeneralRequirements output:"
<< TR("enoughStorage", enoughStorage) << TR("enoughStorage", enoughStorage)
<< TR("enoughRam", enoughRam) << TR("enoughRam", enoughRam)
<< TR("hasPower", hasPower) << TR("hasPower", hasPower)
@ -159,7 +159,7 @@ Calamares::RequirementsList RequirementsChecker::checkRequirements()
void void
RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap ) GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
{ {
bool incompleteConfiguration = false; bool incompleteConfiguration = false;
@ -171,7 +171,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
} }
else else
{ {
cWarning() << "RequirementsChecker entry 'check' is incomplete."; cWarning() << "GeneralRequirements entry 'check' is incomplete.";
incompleteConfiguration = true; incompleteConfiguration = true;
} }
@ -183,14 +183,14 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
} }
else else
{ {
cWarning() << "RequirementsChecker entry 'required' is incomplete."; cWarning() << "GeneralRequirements entry 'required' is incomplete.";
incompleteConfiguration = true; incompleteConfiguration = true;
} }
// Help out with consistency, but don't fix // Help out with consistency, but don't fix
for ( const auto& r : m_entriesToRequire ) for ( const auto& r : m_entriesToRequire )
if ( !m_entriesToCheck.contains( r ) ) 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" ) && if ( configurationMap.contains( "requiredStorage" ) &&
( configurationMap.value( "requiredStorage" ).type() == QVariant::Double || ( configurationMap.value( "requiredStorage" ).type() == QVariant::Double ||
@ -200,7 +200,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
m_requiredStorageGB = configurationMap.value( "requiredStorage" ).toDouble( &ok ); m_requiredStorageGB = configurationMap.value( "requiredStorage" ).toDouble( &ok );
if ( !ok ) if ( !ok )
{ {
cWarning() << "RequirementsChecker entry 'requiredStorage' is invalid."; cWarning() << "GeneralRequirements entry 'requiredStorage' is invalid.";
m_requiredStorageGB = 3.; m_requiredStorageGB = 3.;
} }
@ -208,7 +208,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
} }
else else
{ {
cWarning() << "RequirementsChecker entry 'requiredStorage' is missing."; cWarning() << "GeneralRequirements entry 'requiredStorage' is missing.";
m_requiredStorageGB = 3.; m_requiredStorageGB = 3.;
incompleteConfiguration = true; incompleteConfiguration = true;
} }
@ -221,14 +221,14 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
m_requiredRamGB = configurationMap.value( "requiredRam" ).toDouble( &ok ); m_requiredRamGB = configurationMap.value( "requiredRam" ).toDouble( &ok );
if ( !ok ) if ( !ok )
{ {
cWarning() << "RequirementsChecker entry 'requiredRam' is invalid."; cWarning() << "GeneralRequirements entry 'requiredRam' is invalid.";
m_requiredRamGB = 1.; m_requiredRamGB = 1.;
incompleteConfiguration = true; incompleteConfiguration = true;
} }
} }
else else
{ {
cWarning() << "RequirementsChecker entry 'requiredRam' is missing."; cWarning() << "GeneralRequirements entry 'requiredRam' is missing.";
m_requiredRamGB = 1.; m_requiredRamGB = 1.;
incompleteConfiguration = true; incompleteConfiguration = true;
} }
@ -240,7 +240,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
if ( m_checkHasInternetUrl.isEmpty() || if ( m_checkHasInternetUrl.isEmpty() ||
!QUrl( m_checkHasInternetUrl ).isValid() ) !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)."; << "reverting to default (http://example.com).";
m_checkHasInternetUrl = "http://example.com"; m_checkHasInternetUrl = "http://example.com";
incompleteConfiguration = true; incompleteConfiguration = true;
@ -248,7 +248,7 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
} }
else 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)."; "reverting to default (http://example.com).";
m_checkHasInternetUrl = "http://example.com"; m_checkHasInternetUrl = "http://example.com";
@ -257,17 +257,17 @@ RequirementsChecker::setConfigurationMap( const QVariantMap& configurationMap )
if ( incompleteConfiguration ) if ( incompleteConfiguration )
{ {
cWarning() << "RequirementsChecker configuration map:" << Logger::DebugMap( configurationMap ); cWarning() << "GeneralRequirements configuration map:" << Logger::DebugMap( configurationMap );
} }
} }
bool bool
RequirementsChecker::checkEnoughStorage( qint64 requiredSpace ) GeneralRequirements::checkEnoughStorage( qint64 requiredSpace )
{ {
#ifdef WITHOUT_LIBPARTED #ifdef WITHOUT_LIBPARTED
Q_UNUSED( requiredSpace ); Q_UNUSED( requiredSpace );
cWarning() << "RequirementsChecker is configured without libparted."; cWarning() << "GeneralRequirements is configured without libparted.";
return false; return false;
#else #else
return check_big_enough( requiredSpace ); return check_big_enough( requiredSpace );
@ -276,7 +276,7 @@ RequirementsChecker::checkEnoughStorage( qint64 requiredSpace )
bool bool
RequirementsChecker::checkEnoughRam( qint64 requiredRam ) GeneralRequirements::checkEnoughRam( qint64 requiredRam )
{ {
// Ignore the guesstimate-factor; we get an under-estimate // Ignore the guesstimate-factor; we get an under-estimate
// which is probably the usable RAM for programs. // which is probably the usable RAM for programs.
@ -286,7 +286,7 @@ RequirementsChecker::checkEnoughRam( qint64 requiredRam )
bool bool
RequirementsChecker::checkBatteryExists() GeneralRequirements::checkBatteryExists()
{ {
const QFileInfo basePath( "/sys/class/power_supply" ); const QFileInfo basePath( "/sys/class/power_supply" );
@ -312,7 +312,7 @@ RequirementsChecker::checkBatteryExists()
bool bool
RequirementsChecker::checkHasPower() GeneralRequirements::checkHasPower()
{ {
const QString UPOWER_SVC_NAME( "org.freedesktop.UPower" ); const QString UPOWER_SVC_NAME( "org.freedesktop.UPower" );
const QString UPOWER_INTF_NAME( "org.freedesktop.UPower" ); const QString UPOWER_INTF_NAME( "org.freedesktop.UPower" );
@ -343,7 +343,7 @@ RequirementsChecker::checkHasPower()
bool bool
RequirementsChecker::checkHasInternet() GeneralRequirements::checkHasInternet()
{ {
// default to true in the QNetworkAccessManager::UnknownAccessibility case // default to true in the QNetworkAccessManager::UnknownAccessibility case
QNetworkAccessManager qnam( this ); QNetworkAccessManager qnam( this );
@ -367,14 +367,14 @@ RequirementsChecker::checkHasInternet()
bool bool
RequirementsChecker::checkIsRoot() GeneralRequirements::checkIsRoot()
{ {
return !geteuid(); return !geteuid();
} }
void void
RequirementsChecker::detectFirmwareType() GeneralRequirements::detectFirmwareType()
{ {
QString fwType = QFile::exists( "/sys/firmware/efi/efivars" ) ? "efi" : "bios"; QString fwType = QFile::exists( "/sys/firmware/efi/efivars" ) ? "efi" : "bios";
Calamares::JobQueue::instance()->globalStorage()->insert( "firmwareType", fwType ); Calamares::JobQueue::instance()->globalStorage()->insert( "firmwareType", fwType );

@ -17,19 +17,19 @@
* along with Calamares. If not, see <http://www.gnu.org/licenses/>. * along with Calamares. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef REQUIREMENTSCHECKER_H #ifndef GENERALREQUIREMENTS_H
#define REQUIREMENTSCHECKER_H #define GENERALREQUIREMENTS_H
#include <QObject> #include <QObject>
#include <QStringList> #include <QStringList>
#include "modulesystem/Requirement.h" #include "modulesystem/Requirement.h"
class RequirementsChecker : public QObject class GeneralRequirements : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit RequirementsChecker( QObject* parent = nullptr ); explicit GeneralRequirements( QObject* parent = nullptr );
void setConfigurationMap( const QVariantMap& configurationMap ); void setConfigurationMap( const QVariantMap& configurationMap );

Loading…
Cancel
Save