[partition] Tidy labels view
- Use MiB terminology and support code - Remove debugging chattiness - Fix up include style
This commit is contained in:
parent
50857dcfec
commit
707ec98553
@ -19,11 +19,12 @@
|
|||||||
|
|
||||||
#include "PartitionLabelsView.h"
|
#include "PartitionLabelsView.h"
|
||||||
|
|
||||||
#include <core/PartitionModel.h>
|
#include "core/PartitionModel.h"
|
||||||
#include <core/ColorUtils.h>
|
#include "core/ColorUtils.h"
|
||||||
|
|
||||||
#include <utils/CalamaresUtilsGui.h>
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include <utils/Logger.h>
|
#include "utils/Logger.h"
|
||||||
|
#include "utils/Units.h"
|
||||||
|
|
||||||
#include <kpmcore/core/device.h>
|
#include <kpmcore/core/device.h>
|
||||||
#include <kpmcore/fs/filesystem.h>
|
#include <kpmcore/fs/filesystem.h>
|
||||||
@ -35,6 +36,7 @@
|
|||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
|
using CalamaresUtils::operator""_MiB;
|
||||||
|
|
||||||
static const int LAYOUT_MARGIN = 4;
|
static const int LAYOUT_MARGIN = 4;
|
||||||
static const int LABEL_PARTITION_SQUARE_MARGIN =
|
static const int LABEL_PARTITION_SQUARE_MARGIN =
|
||||||
@ -62,12 +64,6 @@ PartitionLabelsView::PartitionLabelsView( QWidget* parent )
|
|||||||
setSelectionBehavior( QAbstractItemView::SelectRows );
|
setSelectionBehavior( QAbstractItemView::SelectRows );
|
||||||
setSelectionMode( QAbstractItemView::SingleSelection );
|
setSelectionMode( QAbstractItemView::SingleSelection );
|
||||||
this->setObjectName("partitionLabel");
|
this->setObjectName("partitionLabel");
|
||||||
// Debug
|
|
||||||
connect( this, &PartitionLabelsView::clicked,
|
|
||||||
this, [=]( const QModelIndex& index )
|
|
||||||
{
|
|
||||||
cDebug() << "Clicked row" << index.row();
|
|
||||||
} );
|
|
||||||
setMouseTracking( true );
|
setMouseTracking( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,8 +158,8 @@ PartitionLabelsView::getIndexesToDraw( const QModelIndex& parent ) const
|
|||||||
|
|
||||||
//HACK: horrible special casing follows.
|
//HACK: horrible special casing follows.
|
||||||
// To save vertical space, we choose to hide short instances of free space.
|
// To save vertical space, we choose to hide short instances of free space.
|
||||||
// Arbitrary limit: 10MB.
|
// Arbitrary limit: 10MiB.
|
||||||
const qint64 maxHiddenB = 10000000;
|
const qint64 maxHiddenB = 10_MiB;
|
||||||
if ( index.data( PartitionModel::IsFreeSpaceRole ).toBool() &&
|
if ( index.data( PartitionModel::IsFreeSpaceRole ).toBool() &&
|
||||||
index.data( PartitionModel::SizeRole ).toLongLong() < maxHiddenB )
|
index.data( PartitionModel::SizeRole ).toLongLong() < maxHiddenB )
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user