Draw nested partition enable/disable support in Splitter widget.

main
Teo Mrnjavac 9 years ago
parent aaeb28e45e
commit 65f5da5a8d

@ -54,8 +54,9 @@ PartitionSplitterWidget::PartitionSplitterWidget( QWidget* parent )
void
PartitionSplitterWidget::init( Device* dev )
PartitionSplitterWidget::init( Device* dev, bool drawNestedPartitions )
{
m_drawNestedPartitions = drawNestedPartitions;
QList< PartitionSplitterItem > allPartitionItems;
PartitionSplitterItem* extendedPartitionItem = nullptr;
for ( auto it = PartitionIterator::begin( dev );
@ -69,13 +70,21 @@ PartitionSplitterWidget::init( Device* dev )
{}
};
if ( ( *it )->roles().has( PartitionRole::Logical ) && extendedPartitionItem )
extendedPartitionItem->children.append( newItem );
if ( drawNestedPartitions )
{
if ( ( *it )->roles().has( PartitionRole::Logical ) && extendedPartitionItem )
extendedPartitionItem->children.append( newItem );
else
{
allPartitionItems.append( newItem );
if ( ( *it )->roles().has( PartitionRole::Extended ) )
extendedPartitionItem = &allPartitionItems.last();
}
}
else
{
allPartitionItems.append( newItem );
if ( ( *it )->roles().has( PartitionRole::Extended ) )
extendedPartitionItem = &allPartitionItems.last();
if ( !( *it )->roles().has( PartitionRole::Extended ) )
allPartitionItems.append( newItem );
}
}

@ -39,7 +39,7 @@ class PartitionSplitterWidget : public QWidget
public:
explicit PartitionSplitterWidget( QWidget* parent = nullptr );
void init( Device* dev );
void init( Device* dev, bool drawNestedPartitions );
void setSplitPartition( const QString& path,
qint64 minSize,
@ -90,6 +90,8 @@ private:
int m_resizeHandleX;
const int HANDLE_SNAP;
bool m_drawNestedPartitions;
};
#endif // PARTITIONSPLITTERWIDGET_H

Loading…
Cancel
Save