Keep partition color if space is inserted/removed before it
This commit is contained in:
parent
06e30b8290
commit
cf4416a171
@ -49,8 +49,20 @@ static QColor colorForPartition( Partition* partition, int row )
|
|||||||
return FREE_SPACE_COLOR;
|
return FREE_SPACE_COLOR;
|
||||||
if ( partition->roles().has( PartitionRole::Extended ) )
|
if ( partition->roles().has( PartitionRole::Extended ) )
|
||||||
return EXTENDED_COLOR;
|
return EXTENDED_COLOR;
|
||||||
// No partition-specific color needed, pick one from our list
|
// No partition-specific color needed, pick one from our list, but skip
|
||||||
return COLORS[ row % 4 ];
|
// free space: we don't want a partition to change colors if space before
|
||||||
|
// it is inserted or removed
|
||||||
|
PartitionNode* parent = partition->parent();
|
||||||
|
Q_ASSERT( parent );
|
||||||
|
int colorIdx = 0;
|
||||||
|
for ( auto child : parent->children() )
|
||||||
|
{
|
||||||
|
if ( child == partition )
|
||||||
|
break;
|
||||||
|
if ( !PMUtils::isPartitionFreeSpace( child ) )
|
||||||
|
++colorIdx;
|
||||||
|
}
|
||||||
|
return COLORS[ colorIdx % 4 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
//- ResetHelper --------------------------------------------
|
//- ResetHelper --------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user