fixed broken version comparing which indicated 0.x.y to be less than 0.x.y-patch - fixes messed up projects when loading files created with LMMS 0.4.0
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1958 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -42,7 +42,7 @@ int projectVersion::compare( const projectVersion & _v1,
|
||||
n2 = _v2.section( '.', 0, 0 ).toInt();
|
||||
if( n1 != n2 )
|
||||
{
|
||||
return( n1 - n2 );
|
||||
return n1 - n2;
|
||||
}
|
||||
|
||||
// Minor
|
||||
@@ -50,7 +50,7 @@ int projectVersion::compare( const projectVersion & _v1,
|
||||
n2 = _v2.section( '.', 1, 1 ).toInt();
|
||||
if( n1 != n2 )
|
||||
{
|
||||
return( n1 - n2 );
|
||||
return n1 - n2;
|
||||
}
|
||||
|
||||
// Release
|
||||
@@ -58,12 +58,24 @@ int projectVersion::compare( const projectVersion & _v1,
|
||||
n2 = _v2.section( '.', 2 ).section( '-', 0, 0 ).toInt();
|
||||
if( n1 != n2 )
|
||||
{
|
||||
return( n1 - n2 );
|
||||
return n1 - n2;
|
||||
}
|
||||
|
||||
// Build
|
||||
return( QString::compare( _v1.section( '.', 2 ).section( '-', 1 ),
|
||||
_v2.section( '.', 2 ).section( '-', 1 ) ) );
|
||||
const QString b1 = _v1.section( '.', 2 ).section( '-', 1 );
|
||||
const QString b2 = _v2.section( '.', 2 ).section( '-', 1 );
|
||||
|
||||
// make sure 0.x.y > 0.x.y-patch
|
||||
if( b1.isEmpty() )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if( b2.isEmpty() )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
return QString::compare( b1, b2 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user