mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 02:45:44 -05:00
Keep partition color if space is inserted/removed before it
This commit is contained in:
parent
06e30b8290
commit
cf4416a171
1 changed files with 14 additions and 2 deletions
|
@ -49,8 +49,20 @@ static QColor colorForPartition( Partition* partition, int row )
|
|||
return FREE_SPACE_COLOR;
|
||||
if ( partition->roles().has( PartitionRole::Extended ) )
|
||||
return EXTENDED_COLOR;
|
||||
// No partition-specific color needed, pick one from our list
|
||||
return COLORS[ row % 4 ];
|
||||
// No partition-specific color needed, pick one from our list, but skip
|
||||
// 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 --------------------------------------------
|
||||
|
|
Loading…
Add table
Reference in a new issue