diff options
author | Ken Moore <ken@pcbsd.org> | 2015-03-30 11:57:23 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-03-30 11:57:23 -0400 |
commit | b265a6cd3524f77a1378a959fe9982d57d72a9ad (patch) | |
tree | dac9bdf71f5fd1fe76f30d4b45b4d29b257f5cdb /lumina-desktop/LSession.cpp | |
parent | Bump the roadmap versions for 0.8.3/0.8.4 to 0.8.4/0.8.5. (diff) | |
download | lumina-b265a6cd3524f77a1378a959fe9982d57d72a9ad.tar.gz lumina-b265a6cd3524f77a1378a959fe9982d57d72a9ad.tar.bz2 lumina-b265a6cd3524f77a1378a959fe9982d57d72a9ad.zip |
Update the internal version number handling for backwards compatibility checks. This is just to future-proof the routine - now each version number piece can be anywhere from 0->999 (instead of the old limitation of 0->9).
Diffstat (limited to 'lumina-desktop/LSession.cpp')
-rw-r--r-- | lumina-desktop/LSession.cpp | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/lumina-desktop/LSession.cpp b/lumina-desktop/LSession.cpp index b472a60a..bce1d607 100644 --- a/lumina-desktop/LSession.cpp +++ b/lumina-desktop/LSession.cpp @@ -171,6 +171,20 @@ void LSession::CleanupSession(){ for(int i=0; i<20; i++){ LSession::processEvents(); usleep(25); } //1/2 second pause } +int LSession::VersionStringToNumber(QString version){ + version = version.section("-",0,0); //trim any extra labels off the end + int maj, mid, min; //major/middle/minor version numbers (<Major>.<Middle>.<Minor>) + maj = mid = min = 0; + bool ok = true; + maj = version.section(".",0,0).toInt(&ok); + if(ok){ mid = version.section(".",1,1).toInt(&ok); }else{ maj = 0; } + if(ok){ min = version.section(".",2,2).toInt(&ok); }else{ mid = 0; } + if(!ok){ min = 0; } + //Now assemble the number + //NOTE: This format allows numbers to be anywhere from 0->999 without conflict + return (maj*1000000 + mid*1000 + min); +} + void LSession::launchStartupApps(){ //First start any system-defined startups, then do user defined qDebug() << "Launching startup applications"; @@ -252,15 +266,16 @@ void LSession::watcherChange(QString changed){ } void LSession::checkUserFiles(){ - //version conversion examples: [1.0.0 -> 100], [1.2.0 -> 120], [0.6.0 -> 60] - int oldversion = sessionsettings->value("DesktopVersion","0").toString().section("-",0,0).remove(".").toInt(); - bool newversion = ( oldversion < this->applicationVersion().remove(".").toInt() ); + //internal version conversion examples: + // [1.0.0 -> 1000000], [1.2.3 -> 1002003], [0.6.1 -> 6001] + int oldversion = VersionStringToNumber(sessionsettings->value("DesktopVersion","0").toString()); + bool newversion = ( oldversion < VersionStringToNumber(this->applicationVersion()) ); //Check for the desktop settings file QString dset = QDir::homePath()+"/.lumina/LuminaDE/desktopsettings.conf"; bool firstrun = false; - if(!QFile::exists(dset) || oldversion < 50){ - if( oldversion < 50 ){ QFile::remove(dset); qDebug() << "Current desktop settings obsolete: Re-implementing defaults"; } + if(!QFile::exists(dset) || oldversion < 5000){ + if( oldversion < 5000 ){ QFile::remove(dset); qDebug() << "Current desktop settings obsolete: Re-implementing defaults"; } else{ firstrun = true; } /*if(QFile::exists(LOS::LuminaShare()+"desktopsettings.conf")){ if( QFile::copy(LOS::LuminaShare()+"desktopsettings.conf", dset) ){ @@ -269,10 +284,10 @@ void LSession::checkUserFiles(){ }*/ LUtils::LoadSystemDefaults(); } - if(oldversion <= 83){ - //Convert the old->new favorites framework + /*if(oldversion <= 8003){ + //Convert the old->new favorites framework (Not implemented yet) - } + }*/ //Check for the default applications file for lumina-open dset = QDir::homePath()+"/.lumina/LuminaDE/lumina-open.conf"; |