Merge pull request #382 from grejppi/stable-0.4-bbcolour

Automatically change old B&B default colour to the new one
This commit is contained in:
Tobias Doerffel
2014-02-25 08:22:08 +01:00
3 changed files with 20 additions and 2 deletions

View File

@@ -53,10 +53,13 @@ public:
{
return( m_color );
}
inline static unsigned int defaultColor()
{
return qRgb( 128, 182, 175 );
}
virtual trackContentObjectView * createView( trackView * _tv );
private:
unsigned int m_color;

View File

@@ -41,6 +41,9 @@
#include "Effect.h"
#include "lmmsversion.h"
// bbTCO::defaultColor()
#include "bb_track.h"
DataFile::typeDescStruct
@@ -680,6 +683,18 @@ void DataFile::upgrade()
}
// new default colour for B&B tracks
QDomNodeList list = elementsByTagName( "bbtco" );
for( int i = 0; !list.item( i ).isNull(); ++i )
{
QDomElement el = list.item( i ).toElement();
unsigned int rgb = el.attribute( "color" ).toUInt();
if( rgb == qRgb( 64, 128, 255 ) )
{
el.setAttribute( "color", bbTCO::defaultColor() );
}
}
// Time-signature
if ( !m_head.hasAttribute( "timesig_numerator" ) )
{

View File

@@ -48,7 +48,7 @@ bbTrack::infoMap bbTrack::s_infoMap;
bbTCO::bbTCO( track * _track, unsigned int _color ) :
trackContentObject( _track ),
m_color( _color > 0 ? _color : qRgb( 128, 182, 175 ) )
m_color( _color > 0 ? _color : defaultColor() )
{
tact_t t = engine::getBBTrackContainer()->lengthOfBB(
bbTrack::numOfBBTrack( getTrack() ) );