Use a separate palette for newly created partitions.

This commit is contained in:
Teo Mrnjavac 2015-04-24 18:09:11 +02:00
parent c7563af1c9
commit d3f4ced8c0

View file

@ -29,6 +29,7 @@
#include <QColor> #include <QColor>
static const int NUM_PARTITION_COLORS = 5; static const int NUM_PARTITION_COLORS = 5;
static const int NUM_NEW_PARTITION_COLORS = 4;
//Let's try to use the Breeze palette //Let's try to use the Breeze palette
static QColor PARTITION_COLORS[ NUM_PARTITION_COLORS ] = static QColor PARTITION_COLORS[ NUM_PARTITION_COLORS ] =
{ {
@ -38,6 +39,13 @@ static QColor PARTITION_COLORS[ NUM_PARTITION_COLORS ] =
"#3daee9", //Plasma Blue "#3daee9", //Plasma Blue
"#9b59b6", //Purple "#9b59b6", //Purple
}; };
static QColor NEW_PARTITION_COLORS[ NUM_NEW_PARTITION_COLORS ] =
{
"#c0392b", //Dark Icon Red
"#f39c1f", //Dark Icon Yellow
"#f1b7bc", //Light Salmon
"#fed999", //Light Orange
};
static QColor FREE_SPACE_COLOR = "#777777"; static QColor FREE_SPACE_COLOR = "#777777";
static QColor EXTENDED_COLOR = "#aaaaaa"; static QColor EXTENDED_COLOR = "#aaaaaa";
@ -74,6 +82,7 @@ colorForPartition( Partition* partition )
PartitionTable* table = dynamic_cast< PartitionTable* >( parent ); PartitionTable* table = dynamic_cast< PartitionTable* >( parent );
Q_ASSERT( table ); Q_ASSERT( table );
int colorIdx = 0; int colorIdx = 0;
int newColorIdx = 0;
for ( PartitionIterator it = PartitionIterator::begin( table ); for ( PartitionIterator it = PartitionIterator::begin( table );
it != PartitionIterator::end( table ); it != PartitionIterator::end( table );
++it ) ++it )
@ -84,13 +93,19 @@ colorForPartition( Partition* partition )
if ( !PMUtils::isPartitionFreeSpace( child ) && if ( !PMUtils::isPartitionFreeSpace( child ) &&
!child->hasChildren() ) !child->hasChildren() )
++colorIdx; ++colorIdx;
if ( PMUtils::isPartitionNew( child ) )
++newColorIdx;
} }
if ( PMUtils::isPartitionNew( partition ) )
return NEW_PARTITION_COLORS[ newColorIdx % NUM_NEW_PARTITION_COLORS ];
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 = partition->parent(); PartitionNode* parent = partition->parent();
Q_ASSERT( parent ); Q_ASSERT( parent );
int colorIdx = 0; int colorIdx = 0;