Merge branch 'coding'

Conflicts:
	include/Note.h
	include/ProjectVersion.h
	include/TimeLineWidget.h
	include/Track.h
	src/core/Plugin.cpp
	src/core/ProjectVersion.cpp
	src/core/Song.cpp
	src/core/Track.cpp
	src/gui/TimeLineWidget.cpp
This commit is contained in:
Alexandre
2015-03-01 12:55:58 -03:00
172 changed files with 37400 additions and 20375 deletions

View File

@@ -3,7 +3,8 @@
*
* Copyright (c) 2007 Javier Serrano Polo <jasp00/at/users.sourceforge.net>
* Copyright (c) 2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* Copyright (c) 2015 Tres Finocchiaro <tres.finocchiaro/at/gmail.com>
*
* This file is part of LMMS - http://lmms.io
*
* This program is free software; you can redistribute it and/or
@@ -24,57 +25,122 @@
*/
#include "ProjectVersion.h"
int parseMajor(QString & version) {
return version.section( '.', 0, 0 ).toInt();
}
int parseMinor(QString & version) {
return version.section( '.', 1, 1 ).toInt();
}
int parseRelease(QString & version) {
return version.section( '.', 2 ).section( '-', 0, 0 ).toInt();
}
QString parseBuild(QString & version) {
return version.section( '.', 2 ).section( '-', 1 );
}
ProjectVersion::ProjectVersion(QString version, CompareType c) :
m_version(version),
m_major(parseMajor(m_version)),
m_minor(parseMinor(m_version)),
m_release(parseRelease(m_version)) ,
m_build(parseBuild(m_version)),
m_compareType(c)
{
}
<<<<<<< HEAD
int ProjectVersion::compare( const ProjectVersion & v1,
const ProjectVersion & v2 )
=======
ProjectVersion::ProjectVersion( const char* version, CompareType c ) :
m_version( QString( version ) ),
m_major(parseMajor( m_version ) ),
m_minor(parseMinor( m_version ) ),
m_release(parseRelease( m_version ) ),
m_build(parseBuild( m_version ) ),
m_compareType( c )
>>>>>>> coding
{
int n1, n2;
}
<<<<<<< HEAD
// Major
n1 = v1.section( '.', 0, 0 ).toInt();
n2 = v2.section( '.', 0, 0 ).toInt();
if( n1 != n2 )
=======
int ProjectVersion::compare( const ProjectVersion & a, const ProjectVersion & b, CompareType c )
{
if( a.getMajor() != b.getMajor() )
>>>>>>> coding
{
return n1 - n2;
return a.getMajor() - b.getMajor();
}
<<<<<<< HEAD
// Minor
n1 = v1.section( '.', 1, 1 ).toInt();
n2 = v2.section( '.', 1, 1 ).toInt();
if( n1 != n2 )
=======
else if( c == CompareType::Major )
>>>>>>> coding
{
return n1 - n2;
return 0;
}
<<<<<<< HEAD
// Release
n1 = v1.section( '.', 2 ).section( '-', 0, 0 ).toInt();
n2 = v2.section( '.', 2 ).section( '-', 0, 0 ).toInt();
if( n1 != n2 )
=======
if( a.getMinor() != b.getMinor() )
{
return n1 - n2;
return a.getMinor() - b.getMinor();
}
else if( c == CompareType::Minor )
>>>>>>> coding
{
return 0;
}
<<<<<<< HEAD
// Build
const QString b1 = v1.section( '.', 2 ).section( '-', 1 );
const QString b2 = v2.section( '.', 2 ).section( '-', 1 );
=======
if( a.getRelease() != b.getRelease() )
{
return a.getRelease() - b.getRelease();
}
else if( c == CompareType::Release )
{
return 0;
}
>>>>>>> coding
// make sure 0.x.y > 0.x.y-patch
if( b1.isEmpty() )
if( a.getBuild().isEmpty() )
{
return 1;
}
if( b2.isEmpty() )
if( b.getBuild().isEmpty() )
{
return -1;
}
return QString::compare( b1, b2 );
return QString::compare( a.getBuild(), b.getBuild() );
}
int ProjectVersion::compare( ProjectVersion v1, ProjectVersion v2 )
{
return compare( v1, v2, std::min( v1.getCompareType(), v2.getCompareType() ) );
}