[partition] Refactor getting the globalStorage value
This commit is contained in:
parent
3548792d1b
commit
acf3dbcdcb
@ -62,6 +62,13 @@ convenienceName( const Partition* const candidate )
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @brief Get the globalStorage setting for required space. */
|
||||||
|
static double
|
||||||
|
getRequiredStorageGiB( bool& ok )
|
||||||
|
{
|
||||||
|
return Calamares::JobQueue::instance()->globalStorage()->value( "requiredStorageGiB" ).toDouble( &ok );
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
canBeReplaced( Partition* candidate )
|
canBeReplaced( Partition* candidate )
|
||||||
{
|
{
|
||||||
@ -72,10 +79,7 @@ canBeReplaced( Partition* candidate )
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
double requiredStorageGB = Calamares::JobQueue::instance()
|
double requiredStorageGB = getRequiredStorageGiB( ok );
|
||||||
->globalStorage()
|
|
||||||
->value( "requiredStorageGiB" )
|
|
||||||
.toDouble( &ok );
|
|
||||||
|
|
||||||
qint64 availableStorageB = candidate->capacity();
|
qint64 availableStorageB = candidate->capacity();
|
||||||
qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024;
|
qint64 requiredStorageB = ( requiredStorageGB + 0.5 ) * 1024 * 1024 * 1024;
|
||||||
@ -144,10 +148,7 @@ canBeResized( Partition* candidate )
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
double requiredStorageGB = Calamares::JobQueue::instance()
|
double requiredStorageGB = getRequiredStorageGiB( ok );
|
||||||
->globalStorage()
|
|
||||||
->value( "requiredStorageGiB" )
|
|
||||||
.toDouble( &ok );
|
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
{
|
{
|
||||||
cDebug() << Logger::SubEntry << "NO, requiredStorageGiB is not set correctly.";
|
cDebug() << Logger::SubEntry << "NO, requiredStorageGiB is not set correctly.";
|
||||||
|
Loading…
Reference in New Issue
Block a user