Set proper colors in PartResizeWidget
This commit is contained in:
parent
055904b20a
commit
310fdc56d9
@ -18,8 +18,9 @@
|
||||
|
||||
#include <CreatePartitionDialog.h>
|
||||
|
||||
#include <PartitionSizeController.h>
|
||||
#include <ColorUtils.h>
|
||||
#include <PartitionInfo.h>
|
||||
#include <PartitionSizeController.h>
|
||||
#include <PMUtils.h>
|
||||
#include <ui_CreatePartitionDialog.h>
|
||||
#include <utils/Logger.h>
|
||||
@ -157,7 +158,10 @@ CreatePartitionDialog::initPartResizerWidget( Partition* partition )
|
||||
qint64 maxLastSector = partition->lastSector() + m_device->partitionTable()->freeSectorsAfter( *partition );
|
||||
m_ui->partResizerWidget->init( *m_device, *m_partResizerWidgetPartition, minFirstSector, maxLastSector );
|
||||
|
||||
controller->init( m_device, m_partResizerWidgetPartition.data() );
|
||||
QColor color = PMUtils::isPartitionFreeSpace( partition )
|
||||
? ColorUtils::colorForPartitionInFreeSpace( partition )
|
||||
: ColorUtils::colorForPartition( partition );
|
||||
controller->init( m_device, m_partResizerWidgetPartition.data(), color );
|
||||
controller->setPartResizerWidget( m_ui->partResizerWidget );
|
||||
controller->setSpinBox( m_ui->sizeSpinBox );
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include <EditExistingPartitionDialog.h>
|
||||
|
||||
#include <ColorUtils.h>
|
||||
#include <PartitionCoreModule.h>
|
||||
#include <PartitionInfo.h>
|
||||
#include <PartitionSizeController.h>
|
||||
@ -46,7 +47,8 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
||||
// last sectors when used
|
||||
m_partResizerWidgetPartition.reset( PMUtils::clonePartition( m_device, m_partition ) );
|
||||
|
||||
m_partitionSizeController->init( m_device, m_partResizerWidgetPartition.data() );
|
||||
QColor color = ColorUtils::colorForPartition( m_partition );
|
||||
m_partitionSizeController->init( m_device, m_partResizerWidgetPartition.data(), color );
|
||||
m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox );
|
||||
|
||||
m_ui->mountPointComboBox->setCurrentText( PartitionInfo::mountPoint( partition ) );
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
#include <PartitionSizeController.h>
|
||||
|
||||
#include <ColorUtils.h>
|
||||
|
||||
// Qt
|
||||
#include <QSpinBox>
|
||||
|
||||
@ -41,6 +43,11 @@ PartitionSizeController::setPartResizerWidget( PartResizerWidget* widget )
|
||||
m_partResizerWidget = widget;
|
||||
// FIXME: Should be set by PartResizerWidget itself
|
||||
m_partResizerWidget->setFixedHeight( PartResizerWidget::handleHeight() );
|
||||
|
||||
QPalette pal = widget->palette();
|
||||
pal.setColor( QPalette::Base, ColorUtils::freeSpaceColor() );
|
||||
pal.setColor( QPalette::Button, m_partitionColor );
|
||||
m_partResizerWidget->setPalette( pal );
|
||||
updateConnections();
|
||||
}
|
||||
|
||||
@ -55,10 +62,11 @@ PartitionSizeController::setSpinBox( QSpinBox* spinBox )
|
||||
}
|
||||
|
||||
void
|
||||
PartitionSizeController::init( Device* device, Partition* partition )
|
||||
PartitionSizeController::init( Device* device, Partition* partition, const QColor& color )
|
||||
{
|
||||
m_device = device;
|
||||
m_partition = partition;
|
||||
m_partitionColor = color;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -19,6 +19,7 @@
|
||||
#ifndef PARTITIONSIZECONTROLLER_H
|
||||
#define PARTITIONSIZECONTROLLER_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QObject>
|
||||
#include <QPointer>
|
||||
|
||||
@ -38,13 +39,14 @@ public:
|
||||
explicit PartitionSizeController( QObject* parent = nullptr );
|
||||
void setPartResizerWidget( PartResizerWidget* widget );
|
||||
void setSpinBox( QSpinBox* spinBox );
|
||||
void init( Device* device, Partition* partition );
|
||||
void init( Device* device, Partition* partition, const QColor& color );
|
||||
|
||||
private:
|
||||
QPointer< PartResizerWidget > m_partResizerWidget;
|
||||
QPointer< QSpinBox > m_spinBox;
|
||||
Device* m_device = nullptr;
|
||||
Partition* m_partition = nullptr;
|
||||
QColor m_partitionColor;
|
||||
bool m_updating = false;
|
||||
|
||||
void updateConnections();
|
||||
|
Loading…
Reference in New Issue
Block a user