[welcome] Rename GB variable to GiB

- User visible string with GiB
 - Update documentation in welcome.conf to match code
 - Rename variable because it was always GiB just named wrong
This commit is contained in:
Adriaan de Groot 2019-05-06 16:31:23 +02:00
parent 30a306f1b4
commit 599b34c70e
3 changed files with 19 additions and 19 deletions

View File

@ -56,8 +56,8 @@
GeneralRequirements::GeneralRequirements( QObject* parent ) GeneralRequirements::GeneralRequirements( QObject* parent )
: QObject( parent ) : QObject( parent )
, m_requiredStorageGB( -1 ) , m_requiredStorageGiB( -1 )
, m_requiredRamGB( -1 ) , m_requiredRamGiB( -1 )
{ {
} }
@ -72,12 +72,12 @@ Calamares::RequirementsList GeneralRequirements::checkRequirements()
bool isRoot = false; bool isRoot = false;
bool enoughScreen = (availableSize.width() >= CalamaresUtils::windowMinimumWidth) && (availableSize.height() >= CalamaresUtils::windowMinimumHeight); bool enoughScreen = (availableSize.width() >= CalamaresUtils::windowMinimumWidth) && (availableSize.height() >= CalamaresUtils::windowMinimumHeight);
qint64 requiredStorageB = CalamaresUtils::GiBtoBytes(m_requiredStorageGB); qint64 requiredStorageB = CalamaresUtils::GiBtoBytes(m_requiredStorageGiB);
cDebug() << "Need at least storage bytes:" << requiredStorageB; cDebug() << "Need at least storage bytes:" << requiredStorageB;
if ( m_entriesToCheck.contains( "storage" ) ) if ( m_entriesToCheck.contains( "storage" ) )
enoughStorage = checkEnoughStorage( requiredStorageB ); enoughStorage = checkEnoughStorage( requiredStorageB );
qint64 requiredRamB = CalamaresUtils::GiBtoBytes(m_requiredRamGB); qint64 requiredRamB = CalamaresUtils::GiBtoBytes(m_requiredRamGiB);
cDebug() << "Need at least ram bytes:" << requiredRamB; cDebug() << "Need at least ram bytes:" << requiredRamB;
if ( m_entriesToCheck.contains( "ram" ) ) if ( m_entriesToCheck.contains( "ram" ) )
enoughRam = checkEnoughRam( requiredRamB ); enoughRam = checkEnoughRam( requiredRamB );
@ -105,16 +105,16 @@ Calamares::RequirementsList GeneralRequirements::checkRequirements()
if ( entry == "storage" ) if ( entry == "storage" )
checkEntries.append( { checkEntries.append( {
entry, entry,
[req=m_requiredStorageGB]{ return tr( "has at least %1 GB available drive space" ).arg( req ); }, [req=m_requiredStorageGiB]{ return tr( "has at least %1 GiB available drive space" ).arg( req ); },
[req=m_requiredStorageGB]{ return tr( "There is not enough drive space. At least %1 GB is required." ).arg( req ); }, [req=m_requiredStorageGiB]{ return tr( "There is not enough drive space. At least %1 GiB is required." ).arg( req ); },
enoughStorage, enoughStorage,
m_entriesToRequire.contains( entry ) m_entriesToRequire.contains( entry )
} ); } );
else if ( entry == "ram" ) else if ( entry == "ram" )
checkEntries.append( { checkEntries.append( {
entry, entry,
[req=m_requiredRamGB]{ return tr( "has at least %1 GB working memory" ).arg( req ); }, [req=m_requiredRamGiB]{ return tr( "has at least %1 GiB working memory" ).arg( req ); },
[req=m_requiredRamGB]{ return tr( "The system does not have enough working memory. At least %1 GB is required." ).arg( req ); }, [req=m_requiredRamGiB]{ return tr( "The system does not have enough working memory. At least %1 GiB is required." ).arg( req ); },
enoughRam, enoughRam,
m_entriesToRequire.contains( entry ) m_entriesToRequire.contains( entry )
} ); } );
@ -209,19 +209,19 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
configurationMap.value( "requiredStorage" ).type() == QVariant::Int ) ) configurationMap.value( "requiredStorage" ).type() == QVariant::Int ) )
{ {
bool ok = false; bool ok = false;
m_requiredStorageGB = configurationMap.value( "requiredStorage" ).toDouble( &ok ); m_requiredStorageGiB = configurationMap.value( "requiredStorage" ).toDouble( &ok );
if ( !ok ) if ( !ok )
{ {
cWarning() << "GeneralRequirements entry 'requiredStorage' is invalid."; cWarning() << "GeneralRequirements entry 'requiredStorage' is invalid.";
m_requiredStorageGB = 3.; m_requiredStorageGiB = 3.;
} }
Calamares::JobQueue::instance()->globalStorage()->insert( "requiredStorageGB", m_requiredStorageGB ); Calamares::JobQueue::instance()->globalStorage()->insert( "requiredStorageGB", m_requiredStorageGiB );
} }
else else
{ {
cWarning() << "GeneralRequirements entry 'requiredStorage' is missing."; cWarning() << "GeneralRequirements entry 'requiredStorage' is missing.";
m_requiredStorageGB = 3.; m_requiredStorageGiB = 3.;
incompleteConfiguration = true; incompleteConfiguration = true;
} }
@ -230,18 +230,18 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
configurationMap.value( "requiredRam" ).type() == QVariant::Int ) ) configurationMap.value( "requiredRam" ).type() == QVariant::Int ) )
{ {
bool ok = false; bool ok = false;
m_requiredRamGB = configurationMap.value( "requiredRam" ).toDouble( &ok ); m_requiredRamGiB = configurationMap.value( "requiredRam" ).toDouble( &ok );
if ( !ok ) if ( !ok )
{ {
cWarning() << "GeneralRequirements entry 'requiredRam' is invalid."; cWarning() << "GeneralRequirements entry 'requiredRam' is invalid.";
m_requiredRamGB = 1.; m_requiredRamGiB = 1.;
incompleteConfiguration = true; incompleteConfiguration = true;
} }
} }
else else
{ {
cWarning() << "GeneralRequirements entry 'requiredRam' is missing."; cWarning() << "GeneralRequirements entry 'requiredRam' is missing.";
m_requiredRamGB = 1.; m_requiredRamGiB = 1.;
incompleteConfiguration = true; incompleteConfiguration = true;
} }

View File

@ -46,8 +46,8 @@ private:
bool checkHasInternet(); bool checkHasInternet();
bool checkIsRoot(); bool checkIsRoot();
qreal m_requiredStorageGB; qreal m_requiredStorageGiB;
qreal m_requiredRamGB; qreal m_requiredRamGiB;
QString m_checkHasInternetUrl; QString m_checkHasInternetUrl;
}; };

View File

@ -15,12 +15,12 @@ showReleaseNotesUrl: true
# that are checked. They may not match with the actual requirements # that are checked. They may not match with the actual requirements
# imposed by other modules in the system. # imposed by other modules in the system.
requirements: requirements:
# Amount of available disk, in GB. Floating-point is allowed here. # Amount of available disk, in GiB. Floating-point is allowed here.
# Note that this does not account for *usable* disk, so it is possible # Note that this does not account for *usable* disk, so it is possible
# to pass this requirement, yet have no space to install to. # to pass this requirement, yet have no space to install to.
requiredStorage: 5.5 requiredStorage: 5.5
# Amount of available RAM, in GB. Floating-point is allowed here. # Amount of available RAM, in GiB. Floating-point is allowed here.
requiredRam: 1.0 requiredRam: 1.0
# To check for internet connectivity, Calamares does a HTTP GET # To check for internet connectivity, Calamares does a HTTP GET