void ConfigManager::upgrade() { // Skip the upgrade if versions match if ( m_version == LMMS_VERSION ) { return; } ProjectVersion createdWith = m_version; // Remove trailing " (bad latency!)" string which was once saved with PulseAudio if ( createdWith.setCompareType(Build) < "1.1.90" ) { if( value( "mixer", "audiodev" ).startsWith( "PulseAudio (" ) ) { setValue("mixer", "audiodev", "PulseAudio"); } } // Don't use old themes as they break the UI (i.e. 0.4 != 1.0, etc) if ( createdWith.setCompareType(Minor) != LMMS_VERSION ) { m_artworkDir = defaultArtworkDir(); } // Bump the version, now that we are upgraded m_version = LMMS_VERSION; }
//zwraca: // 1 jeśli this jest > od pV, // -1 jeśli this jest < od pV, // 0 jeśli równe int ProjectVersion::compare(const ProjectVersion& pV) const { if (getStatus() != Status::Filled && pV.getStatus() == Status::Filled) return -1; if (getStatus() == Status::Filled && pV.getStatus() != Status::Filled) return 1; if (getStatus() != Status::Filled && pV.getStatus() != Status::Filled) return 0; if (majorN < pV.majorN) return -1; if (majorN > pV.majorN) return 1; if (minorN < pV.minorN) return -1; if (minorN > pV.minorN) return 1; if (release < pV.release) return -1; if (release > pV.release) return 1; if ( build < pV.build) return -1; if ( build > pV.build) return 1; return extCompare(pV); }
void DataFile::loadData( const QByteArray & _data, const QString & _sourceFile ) { QString errorMsg; int line = -1, col = -1; if( !setContent( _data, &errorMsg, &line, &col ) ) { // parsing failed? then try to uncompress data QByteArray uncompressed = qUncompress( _data ); if( !uncompressed.isEmpty() ) { if( setContent( uncompressed, &errorMsg, &line, &col ) ) { line = col = -1; } } if( line >= 0 && col >= 0 ) { qWarning() << "at line" << line << "column" << errorMsg; if( Engine::hasGUI() ) { QMessageBox::critical( NULL, SongEditor::tr( "Error in file" ), SongEditor::tr( "The file %1 seems to contain " "errors and therefore can't be " "loaded." ). arg( _sourceFile ) ); } return; } } QDomElement root = documentElement(); m_type = type( root.attribute( "type" ) ); m_head = root.elementsByTagName( "head" ).item( 0 ).toElement(); if( root.hasAttribute( "creatorversion" ) ) { // compareType defaults to Build,so it doesn't have to be set here ProjectVersion createdWith = root.attribute( "creatorversion" ); ProjectVersion openedWith = LMMS_VERSION;; if ( createdWith != openedWith ) { // only one compareType needs to be set, and we can compare on one line because setCompareType returns ProjectVersion if ( createdWith.setCompareType(Minor) != openedWith) { if( Engine::hasGUI() && root.attribute( "type" ) == "song" ) //documentElement() { QMessageBox::information( NULL, SongEditor::tr( "Project Version Mismatch" ), SongEditor::tr( "This project was created with " "LMMS version %1, but version %2 " "is installed") .arg( root.attribute( "creatorversion" ) ) .arg( LMMS_VERSION ) ); } } // the upgrade needs to happen after the warning as it updates the project version. if( createdWith.setCompareType(Build) < openedWith ) { upgrade(); } } } m_content = root.elementsByTagName( typeName( m_type ) ). item( 0 ).toElement(); }