Use correct palette in new partition dialog.

This commit is contained in:
Teo Mrnjavac 2015-04-28 15:37:39 +02:00
parent 9065882da4
commit ae1fa0e48b

View File

@ -105,21 +105,27 @@ colorForPartition( Partition* partition )
return PARTITION_COLORS[ colorIdx % NUM_PARTITION_COLORS ]; return PARTITION_COLORS[ colorIdx % NUM_PARTITION_COLORS ];
} }
QColor QColor
colorForPartitionInFreeSpace( Partition* partition ) colorForPartitionInFreeSpace( Partition* partition )
{ {
//FIXME PartitionNode* parent = _findRootForPartition( partition );
PartitionNode* parent = partition->parent(); PartitionTable* table = dynamic_cast< PartitionTable* >( parent );
Q_ASSERT( parent ); Q_ASSERT( table );
int colorIdx = 0; int newColorIdx = 0;
for ( auto child : parent->children() ) for ( PartitionIterator it = PartitionIterator::begin( table );
it != PartitionIterator::end( table );
++it )
{ {
Partition* child = *it;
if ( child == partition ) if ( child == partition )
break; break;
if ( !PMUtils::isPartitionFreeSpace( child ) ) if ( !PMUtils::isPartitionFreeSpace( child ) &&
++colorIdx; !child->hasChildren() &&
PMUtils::isPartitionNew( child ) )
++newColorIdx;
} }
return PARTITION_COLORS[ colorIdx % NUM_PARTITION_COLORS ]; return NEW_PARTITION_COLORS[ newColorIdx % NUM_NEW_PARTITION_COLORS ];
} }
} // namespace } // namespace