From 0446bb1079c043931052c4cf985ec23c0da34608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20G=C3=A2teau?= Date: Wed, 2 Jul 2014 17:25:59 +0200 Subject: [PATCH] More readable partition sizes --- CMakeLists.txt | 1 + src/modules/partition/CMakeLists.txt | 2 ++ src/modules/partition/PartitionModel.cpp | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c64b8da9..471a91d55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/src/modules/partition/CMakeLists.txt b/src/modules/partition/CMakeLists.txt index f6ba92199..3715dcec4 100644 --- a/src/modules/partition/CMakeLists.txt +++ b/src/modules/partition/CMakeLists.txt @@ -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 ) diff --git a/src/modules/partition/PartitionModel.cpp b/src/modules/partition/PartitionModel.cpp index 9eb761395..248bdfc5c 100644 --- a/src/modules/partition/PartitionModel.cpp +++ b/src/modules/partition/PartitionModel.cpp @@ -25,6 +25,9 @@ #include #include +// KF5 +#include + 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: