Improve information in labels view.
This commit is contained in:
parent
a75c69805f
commit
0be736acf7
@ -151,10 +151,46 @@ PartitionLabelsView::drawLabels( QPainter* painter,
|
||||
int label_y = rect.y();
|
||||
foreach ( const QModelIndex& index, indexesToDraw )
|
||||
{
|
||||
QStringList texts = { index.data().toString(),
|
||||
index.sibling( index.row(),
|
||||
PartitionModel::SizeColumn )
|
||||
.data().toString() };
|
||||
QString firstLine, secondLine;
|
||||
|
||||
if ( index.data( PartitionModel::IsPartitionNewRole ).toBool() )
|
||||
{
|
||||
QString mountPoint = index.sibling( index.row(),
|
||||
PartitionModel::MountPointColumn )
|
||||
.data().toString();
|
||||
if ( mountPoint == "/" )
|
||||
firstLine = tr( "New root partition" );
|
||||
else if ( mountPoint == "/home" )
|
||||
firstLine = tr( "New home partition" );
|
||||
else if ( mountPoint == "/boot" )
|
||||
firstLine = tr( "New boot partition" );
|
||||
else if ( mountPoint.contains( "/efi" ) &&
|
||||
index.sibling( index.row(),
|
||||
PartitionModel::FileSystemColumn )
|
||||
.data().toString() == "fat32" )
|
||||
firstLine = tr( "New EFI system partition" );
|
||||
else if ( index.sibling( index.row(),
|
||||
PartitionModel::FileSystemColumn )
|
||||
.data().toString() == "linuxswap" )
|
||||
firstLine = tr( "New swap partition" );
|
||||
else
|
||||
firstLine = tr( "New partition for %1" ).arg( mountPoint );
|
||||
}
|
||||
else if ( index.data( PartitionModel::OsproberNameRole ).toString().isEmpty() )
|
||||
firstLine = index.data().toString();
|
||||
else
|
||||
firstLine = index.data( PartitionModel::OsproberNameRole ).toString();
|
||||
|
||||
secondLine = tr( "%1 %2" )
|
||||
.arg( index.sibling( index.row(),
|
||||
PartitionModel::SizeColumn )
|
||||
.data().toString() )
|
||||
.arg( index.sibling( index.row(),
|
||||
PartitionModel::FileSystemColumn )
|
||||
.data().toString() );
|
||||
|
||||
QStringList texts = { firstLine,
|
||||
secondLine };
|
||||
|
||||
QSize labelSize = sizeForLabel( texts );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user