Clang: warnings-reduction
This commit is contained in:
parent
463615a1c0
commit
9116718448
@ -56,5 +56,10 @@ constexpr qint64 GiBtoBytes( double m )
|
||||
return qint64(m * 1024 * 1024 * 1024);
|
||||
}
|
||||
|
||||
constexpr int BytesToMiB( qint64 b )
|
||||
{
|
||||
return int( b / 1024 / 1024 );
|
||||
}
|
||||
|
||||
} // namespace
|
||||
#endif
|
||||
|
@ -43,7 +43,7 @@ static const int LABELS_MARGIN = LABEL_PARTITION_SQUARE_MARGIN;
|
||||
static const int CORNER_RADIUS = 2;
|
||||
|
||||
|
||||
QStringList
|
||||
static QStringList
|
||||
buildUnknownDisklabelTexts( Device* dev )
|
||||
{
|
||||
QStringList texts = { QObject::tr( "Unpartitioned space or unknown partition table" ),
|
||||
@ -54,7 +54,7 @@ buildUnknownDisklabelTexts( Device* dev )
|
||||
|
||||
PartitionLabelsView::PartitionLabelsView( QWidget* parent )
|
||||
: QAbstractItemView( parent )
|
||||
, canBeSelected( []( const QModelIndex& ) { return true; } )
|
||||
, m_canBeSelected( []( const QModelIndex& ) { return true; } )
|
||||
, m_extendedPartitionHidden( false )
|
||||
{
|
||||
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
|
||||
@ -100,6 +100,8 @@ PartitionLabelsView::sizeHint() const
|
||||
void
|
||||
PartitionLabelsView::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
Q_UNUSED( event );
|
||||
|
||||
QPainter painter( viewport() );
|
||||
painter.fillRect( rect(), palette().window() );
|
||||
painter.setRenderHint( QPainter::Antialiasing );
|
||||
@ -292,7 +294,6 @@ PartitionLabelsView::drawLabels( QPainter* painter,
|
||||
!modl->device()->partitionTable() ) // No disklabel or unknown
|
||||
{
|
||||
QStringList texts = buildUnknownDisklabelTexts( modl->device() );
|
||||
QSize labelSize = sizeForLabel( texts );
|
||||
QColor labelColor = ColorUtils::unknownDisklabelColor();
|
||||
drawLabel( painter, texts, labelColor, QPoint( rect.x(), rect.y() ), false /*can't be selected*/ );
|
||||
}
|
||||
@ -467,6 +468,8 @@ PartitionLabelsView::visualRect( const QModelIndex& idx ) const
|
||||
QRegion
|
||||
PartitionLabelsView::visualRegionForSelection( const QItemSelection& selection ) const
|
||||
{
|
||||
Q_UNUSED( selection );
|
||||
|
||||
return QRegion();
|
||||
}
|
||||
|
||||
@ -516,7 +519,7 @@ PartitionLabelsView::setSelectionModel( QItemSelectionModel* selectionModel )
|
||||
void
|
||||
PartitionLabelsView::setSelectionFilter( SelectionFilter canBeSelected )
|
||||
{
|
||||
this->canBeSelected = canBeSelected;
|
||||
m_canBeSelected = canBeSelected;
|
||||
}
|
||||
|
||||
|
||||
@ -530,6 +533,9 @@ PartitionLabelsView::setExtendedPartitionHidden( bool hidden )
|
||||
QModelIndex
|
||||
PartitionLabelsView::moveCursor( CursorAction cursorAction, Qt::KeyboardModifiers modifiers )
|
||||
{
|
||||
Q_UNUSED( cursorAction );
|
||||
Q_UNUSED( modifiers );
|
||||
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
@ -537,6 +543,8 @@ PartitionLabelsView::moveCursor( CursorAction cursorAction, Qt::KeyboardModifier
|
||||
bool
|
||||
PartitionLabelsView::isIndexHidden( const QModelIndex& index ) const
|
||||
{
|
||||
Q_UNUSED( index );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -545,7 +553,7 @@ void
|
||||
PartitionLabelsView::setSelection( const QRect& rect, QItemSelectionModel::SelectionFlags flags )
|
||||
{
|
||||
QModelIndex eventIndex = indexAt( rect.topLeft() );
|
||||
if ( canBeSelected( eventIndex ) )
|
||||
if ( m_canBeSelected( eventIndex ) )
|
||||
selectionModel()->select( eventIndex, flags );
|
||||
}
|
||||
|
||||
@ -567,7 +575,7 @@ PartitionLabelsView::mouseMoveEvent( QMouseEvent* event )
|
||||
|
||||
if ( oldHoveredIndex != m_hoveredIndex )
|
||||
{
|
||||
if ( m_hoveredIndex.isValid() && !canBeSelected( m_hoveredIndex ) )
|
||||
if ( m_hoveredIndex.isValid() && !m_canBeSelected( m_hoveredIndex ) )
|
||||
QGuiApplication::setOverrideCursor( Qt::ForbiddenCursor );
|
||||
else
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
@ -580,6 +588,8 @@ PartitionLabelsView::mouseMoveEvent( QMouseEvent* event )
|
||||
void
|
||||
PartitionLabelsView::leaveEvent( QEvent* event )
|
||||
{
|
||||
Q_UNUSED( event );
|
||||
|
||||
QGuiApplication::restoreOverrideCursor();
|
||||
if ( m_hoveredIndex.isValid() )
|
||||
{
|
||||
@ -593,7 +603,7 @@ void
|
||||
PartitionLabelsView::mousePressEvent( QMouseEvent* event )
|
||||
{
|
||||
QModelIndex candidateIndex = indexAt( event->pos() );
|
||||
if ( canBeSelected( candidateIndex ) )
|
||||
if ( m_canBeSelected( candidateIndex ) )
|
||||
QAbstractItemView::mousePressEvent( event );
|
||||
else
|
||||
event->accept();
|
||||
|
@ -83,7 +83,7 @@ private:
|
||||
QModelIndexList getIndexesToDraw( const QModelIndex& parent ) const;
|
||||
QStringList buildTexts( const QModelIndex& index ) const;
|
||||
|
||||
SelectionFilter canBeSelected;
|
||||
SelectionFilter m_canBeSelected;
|
||||
bool m_extendedPartitionHidden;
|
||||
|
||||
QString m_customNewRootLabel;
|
||||
|
@ -56,8 +56,8 @@
|
||||
PartitionPage::PartitionPage( PartitionCoreModule* core, QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, m_ui( new Ui_PartitionPage )
|
||||
, m_lastSelectedBootLoaderIndex(-1)
|
||||
, m_core( core )
|
||||
, m_lastSelectedBootLoaderIndex(-1)
|
||||
, m_isEfi( false )
|
||||
{
|
||||
m_isEfi = PartUtils::isEfiSystem();
|
||||
@ -373,7 +373,7 @@ PartitionPage::updateFromCurrentDevice()
|
||||
// Establish connection here because selection model is destroyed when
|
||||
// model changes
|
||||
connect( m_ui->partitionTreeView->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||
[ this ]( const QModelIndex& index, const QModelIndex& oldIndex )
|
||||
[ this ]( const QModelIndex&, const QModelIndex& )
|
||||
{
|
||||
updateButtons();
|
||||
} );
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "core/ColorUtils.h"
|
||||
#include "core/KPMHelpers.h"
|
||||
|
||||
#include "utils/Units.h"
|
||||
|
||||
// Qt
|
||||
#include <QSpinBox>
|
||||
|
||||
@ -185,7 +187,7 @@ PartitionSizeController::doUpdateSpinBox()
|
||||
{
|
||||
if ( !m_spinBox )
|
||||
return;
|
||||
qint64 mbSize = m_partition->length() * m_device->logicalSize() / 1024 / 1024;
|
||||
int mbSize = CalamaresUtils::BytesToMiB( m_partition->length() * m_device->logicalSize() );
|
||||
m_spinBox->setValue( mbSize );
|
||||
if ( m_currentSpinBoxValue != -1 && //if it's not the first time we're setting it
|
||||
m_currentSpinBoxValue != mbSize ) //and the operation changes the SB value
|
||||
|
@ -41,8 +41,6 @@
|
||||
|
||||
typedef QHash<QString, QString> UuidForPartitionHash;
|
||||
|
||||
static const char* UUID_DIR = "/dev/disk/by-uuid";
|
||||
|
||||
static UuidForPartitionHash
|
||||
findPartitionUuids( QList < Device* > devices )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user