Use osProber output in ReplacePage.
CAL-155 #close
This commit is contained in:
parent
f8f005f53c
commit
7cd382b39c
@ -127,6 +127,10 @@ ReplacePage::onPartitionSelected()
|
||||
PartitionModel* model = qobject_cast< PartitionModel* >( m_ui->partitionTreeView->model() );
|
||||
if ( model && ok )
|
||||
{
|
||||
QStringList osproberLines = Calamares::JobQueue::instance()
|
||||
->globalStorage()
|
||||
->value( "osproberLines" ).toStringList();
|
||||
|
||||
Partition* partition = model->partitionForIndex( m_ui->partitionTreeView->currentIndex() );
|
||||
if ( !partition ||
|
||||
partition->state() != Partition::StateNone )
|
||||
@ -169,27 +173,61 @@ ReplacePage::onPartitionSelected()
|
||||
return;
|
||||
}
|
||||
|
||||
QString prettyName = tr( "Data partition (%1)" )
|
||||
.arg( partition->fileSystem().name() );
|
||||
foreach ( const QString& line, osproberLines )
|
||||
{
|
||||
QStringList lineColumns = line.split( ':' );
|
||||
|
||||
QString path = lineColumns.value( 0 ).simplified();
|
||||
if ( path == partition->partitionPath() )
|
||||
{
|
||||
QString osName;
|
||||
if ( !lineColumns.value( 1 ).simplified().isEmpty() )
|
||||
osName = lineColumns.value( 1 ).simplified();
|
||||
else if ( !lineColumns.value( 2 ).simplified().isEmpty() )
|
||||
osName = lineColumns.value( 2 ).simplified();
|
||||
|
||||
if ( osName.isEmpty() )
|
||||
{
|
||||
prettyName = tr( "Unknown system partition (%1)" )
|
||||
.arg( partition->fileSystem().name() );
|
||||
}
|
||||
else
|
||||
{
|
||||
prettyName = tr ( "%1 system partition (%2)" )
|
||||
.arg( osName.replace( 0, 1, osName.at( 0 ).toUpper() ) )
|
||||
.arg( partition->fileSystem().name() );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( partition->capacity() < requiredSpaceB )
|
||||
{
|
||||
updateStatus( CalamaresUtils::Fail,
|
||||
tr( "The partition %1 is too small for %2. Please select a partition "
|
||||
tr( "<b>%4</b><br/><br/>"
|
||||
"The partition %1 is too small for %2. Please select a partition "
|
||||
"with capacity at least %3 GiB." )
|
||||
.arg( partition->partitionPath() )
|
||||
.arg( Calamares::Branding::instance()->
|
||||
string( Calamares::Branding::VersionedName ) )
|
||||
.arg( requiredSpaceB / ( 1024. * 1024. * 1024. ),
|
||||
0, 'f', 1 ) );
|
||||
0, 'f', 1 )
|
||||
.arg( prettyName ) );
|
||||
setNextEnabled( false );
|
||||
return;
|
||||
}
|
||||
|
||||
updateStatus( CalamaresUtils::Partitions,
|
||||
tr( "%1 will be installed on %2.<br/>"
|
||||
tr( "<b>%3</b><br/><br/>"
|
||||
"%1 will be installed on %2.<br/>"
|
||||
"<font color=\"red\">Warning: </font>all data on partition"
|
||||
"%2 will be lost.")
|
||||
.arg( Calamares::Branding::instance()->
|
||||
string( Calamares::Branding::VersionedName ) )
|
||||
.arg( partition->partitionPath() ) );
|
||||
.arg( partition->partitionPath() )
|
||||
.arg( prettyName ) );
|
||||
setNextEnabled( true );
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user