mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
More readable partition sizes
This commit is contained in:
parent
50c40e4272
commit
0446bb1079
3 changed files with 7 additions and 1 deletions
|
@ -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…
Add table
Reference in a new issue