From eaf70beb9a1850f4d5be956acc7b6318ef36e72d Mon Sep 17 00:00:00 2001 From: bluebrother Date: Sat, 19 Mar 2011 11:47:10 +0000 Subject: [PATCH] Fix Rockbox Utility update detection on Linux 64bit. Remove the "64bit" part of the filename before comparing. We're checking for that in the filename explicitly but the version number doesn't contain it, so the comparison will otherwise misinterpret it as additional version information. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29617 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/rbutilqt/rbutilqt.cpp | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 98c1024f6..328fb5d8c 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp @@ -1280,44 +1280,49 @@ void RbUtilQt::downloadUpdateDone(bool error) } else { QString toParse(update->readAll()); - + QRegExp searchString("]*>([a-zA-Z]+[^<]*)"); QStringList rbutilList; int pos = 0; - while ((pos = searchString.indexIn(toParse, pos)) != -1) + while ((pos = searchString.indexIn(toParse, pos)) != -1) { rbutilList << searchString.cap(1); pos += searchString.matchedLength(); } qDebug() << "[Checkupdate] " << rbutilList; - + QString newVersion = ""; - //check if there is a binary with higher version in this list + QString foundVersion = ""; + // check if there is a binary with higher version in this list for(int i=0; i < rbutilList.size(); i++) { + QString item = rbutilList.at(i); #if defined(Q_OS_LINUX) #if defined(__amd64__) - //skip if it isnt a 64bit build - if( !rbutilList.at(i).contains("64bit")) + // skip if it isn't a 64 bit build + if( !item.contains("64bit")) continue; + // strip the "64bit" suffix for comparison + item = item.remove("64bit"); #else //skip if it is a 64bit build - if(rbutilList.at(i).contains("64bit")) + if(item.contains("64bit")) continue; -#endif -#endif - //check if it is newer, and remember newest - if(Utils::compareVersionStrings(VERSION, rbutilList.at(i)) == 1) +#endif +#endif + // check if it is newer, and remember newest + if(Utils::compareVersionStrings(VERSION, item) == 1) { - if(Utils::compareVersionStrings(newVersion, rbutilList.at(i)) == 1) + if(Utils::compareVersionStrings(newVersion, item) == 1) { - newVersion = rbutilList.at(i); + newVersion = item; + foundVersion = rbutilList.at(i); } } } // if we found something newer, display info - if(newVersion != "") + if(foundVersion != "") { QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString(); #if defined(Q_OS_WIN32) @@ -1327,11 +1332,12 @@ void RbUtilQt::downloadUpdateDone(bool error) #elif defined(Q_OS_MACX) url += "macosx/"; #endif - url += newVersion; - + url += foundVersion; + QMessageBox::information(this,tr("RockboxUtility Update available"), tr("New RockboxUtility Version available.

" - "Download it from here: %2").arg(url).arg(newVersion) ); + "Download it from here: %2") + .arg(url).arg(foundVersion)); ui.statusbar->showMessage(tr("New version of Rockbox Utility available.")); } else { -- 2.11.4.GIT