From fd33eb71ba96fcf31e19dabb19700281ed8a67a4 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Wed, 16 Dec 2015 15:48:25 +0100 Subject: [PATCH] Add some more string guesswork to labels view, with FS pretty names. --- .../partition/gui/PartitionLabelsView.cpp | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/modules/partition/gui/PartitionLabelsView.cpp b/src/modules/partition/gui/PartitionLabelsView.cpp index 5e9eedced..572bc4df7 100644 --- a/src/modules/partition/gui/PartitionLabelsView.cpp +++ b/src/modules/partition/gui/PartitionLabelsView.cpp @@ -26,6 +26,7 @@ #include #include +#include #include @@ -155,13 +156,9 @@ PartitionLabelsView::buildTexts( const QModelIndex& index ) const else if ( mountPoint == "/boot" ) firstLine = tr( "Boot" ); else if ( mountPoint.contains( "/efi" ) && - index.sibling( index.row(), - PartitionModel::FileSystemColumn ) - .data().toString() == "fat32" ) + index.data( PartitionModel::FileSystemTypeRole ).toInt() == FileSystem::Fat32 ) firstLine = tr( "EFI system" ); - else if ( index.sibling( index.row(), - PartitionModel::FileSystemColumn ) - .data().toString() == "linuxswap" ) + else if ( index.data( PartitionModel::FileSystemTypeRole ).toInt() == FileSystem::LinuxSwap ) firstLine = tr( "Swap" ); else firstLine = tr( "New partition for %1" ).arg( mountPoint ); @@ -171,13 +168,19 @@ PartitionLabelsView::buildTexts( const QModelIndex& index ) const 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() ); + if ( index.data( PartitionModel::IsFreeSpaceRole ).toBool() || + index.data( PartitionModel::FileSystemTypeRole ).toInt() == FileSystem::Extended ) + secondLine = index.sibling( index.row(), + PartitionModel::SizeColumn ) + .data().toString(); + else + secondLine = tr( "%1 %2" ) + .arg( index.sibling( index.row(), + PartitionModel::SizeColumn ) + .data().toString() ) + .arg( index.sibling( index.row(), + PartitionModel::FileSystemColumn ) + .data().toString() ); return { firstLine, secondLine }; }