More readable partition sizes

main
Aurélien Gâteau 11 years ago
parent 50c40e4272
commit 0446bb1079

@ -19,6 +19,7 @@ cmake_policy( SET CMP0043 OLD )
find_package( Qt5 5.3.0 CONFIG REQUIRED Core Gui Widgets LinguistTools )
find_package( YamlCpp 0.5.1 REQUIRED )
find_package( KF5 CONFIG REQUIRED CoreAddons )
###
### Calamares application info

@ -24,6 +24,7 @@ calamares_add_plugin( partition
calapm
${CALAMARES_LIBRARIES}
calamares_bin
KF5::CoreAddons
SHARED_LIB
)
@ -54,6 +55,7 @@ target_link_libraries( partview
Qt5::Widgets
Qt5::Gui
Qt5::Core
KF5::CoreAddons
)
set_target_properties( partview PROPERTIES AUTOMOC TRUE )

@ -25,6 +25,9 @@
#include <core/partitiontable.h>
#include <fs/filesystem.h>
// KF5
#include <KFormat>
PartitionModel::PartitionModel( QObject* parent )
: QAbstractListModel( parent )
{
@ -81,7 +84,7 @@ PartitionModel::data( const QModelIndex& index, int role ) const
text += partition->partitionPath() + " " + partition->fileSystem().name() + " " + partition->mountPoint();
}
qint64 size = ( partition->lastSector() - partition->firstSector() + 1 ) * m_device->logicalSectorSize();
text += tr( " (%1 MB)" ).arg( size / 1024 / 1024 );
text += tr( " (%1)" ).arg( KFormat().formatByteSize( size ) );
return text;
}
default:

Loading…
Cancel
Save