#include <QStyleOption>
static const int VIEW_HEIGHT = qMax( CalamaresUtils::defaultFontHeight() + 8, // wins out with big fonts
- (int)( CalamaresUtils::defaultFontHeight() * 0.6 ) + 22 ); // wins out with small fonts
+ int( CalamaresUtils::defaultFontHeight() * 0.6 ) + 22 ); // wins out with small fonts
static const int CORNER_RADIUS = 3;
static const int EXTENDED_PARTITION_MARGIN = qMax( 4, VIEW_HEIGHT / 6 );
PartitionSplitterWidget::PartitionSplitterWidget( QWidget* parent )
: QWidget( parent )
- , m_resizing( false )
, m_itemToResize( PartitionSplitterItem::null() )
, m_itemToResizeNext( PartitionSplitterItem::null() )
, m_itemMinSize( 0 )
, m_itemMaxSize( 0 )
, m_itemPrefSize( 0 )
+ , m_resizing( false )
, m_resizeHandleX( 0 )
, HANDLE_SNAP( QApplication::startDragDistance() )
, m_drawNestedPartitions( false )
PartitionSplitterWidget::setSplitPartition( const QString& path,
qint64 minSize,
qint64 maxSize,
- qint64 preferredSize,
- const QString& newLabel )
+ qint64 preferredSize )
{
cDebug() << Q_FUNC_INFO << "path:" << path
<< "\nminSize:" << minSize
void
PartitionSplitterWidget::paintEvent( QPaintEvent* event )
{
+ Q_UNUSED( event );
+
QPainter painter( this );
painter.fillRect( rect(), palette().window() );
painter.setRenderHint( QPainter::Antialiasing );
void
PartitionSplitterWidget::mouseReleaseEvent( QMouseEvent* event )
{
+ Q_UNUSED( event );
+
m_resizing = false;
}
painter->setRenderHint( QPainter::Antialiasing, false );
painter->setPen( Qt::black );
- painter->drawLine( x, 0, x, h - 1 );
+ painter->drawLine( x, 0, x, int(h) - 1 );
}
for ( int row = 0; row < count; ++row )
{
const PartitionSplitterItem& item = items[ row ];
- int width;
+ qreal width;
if ( row < count - 1 )
width = totalWidth * ( item.size / total );
else
// Make sure we fill the last pixel column
width = rect.right() - x + 1;
- drawSection( painter, rect, x, width, item );
+ drawSection( painter, rect, x, int(width), item );
if ( !item.children.isEmpty() )
{
QRect subRect(
x + EXTENDED_PARTITION_MARGIN,
rect.y() + EXTENDED_PARTITION_MARGIN,
- width - 2 * EXTENDED_PARTITION_MARGIN,
+ int(width) - 2 * EXTENDED_PARTITION_MARGIN,
rect.height() - 2 * EXTENDED_PARTITION_MARGIN
);
drawPartitions( painter, subRect, item.children );
PartitionSplitterItem thisItem = originalItems[ row ];
QPair< QVector< PartitionSplitterItem >, qreal > pair = computeItemsVector( thisItem.children );
thisItem.children = pair.first;
- thisItem.size = pair.second;
+ thisItem.size = qint64(pair.second);
items += thisItem;
total += thisItem.size;
}
if ( items[ row ].size < 0.01 * total ) // If this item is smaller than 1% of everything,
{ // force its width to 1%.
adjustedTotal -= items[ row ].size;
- items[ row ].size = 0.01 * total;
+ items[ row ].size = qint64(0.01 * total);
adjustedTotal += items[ row ].size;
}
}
qint64 size;
Status status;
- QVector< PartitionSplitterItem > children;
+ using ChildVector = QVector< PartitionSplitterItem >;
+ ChildVector children;
- static PartitionSplitterItem null() { return { QString(), QColor(), false, 0, Normal }; }
+ static PartitionSplitterItem null() { return { QString(), QColor(), false, 0, Normal, ChildVector() }; }
bool isNull() const { return itemPath.isEmpty() && size == 0 && status == Normal; }
operator bool() const { return !isNull(); }
void setSplitPartition( const QString& path,
qint64 minSize,
qint64 maxSize,
- qint64 preferredSize,
- const QString& newLabel );
+ qint64 preferredSize );
qint64 splitPartitionSize() const;
qint64 newPartitionSize() const;