diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 98c1024f60..328fb5d8c7 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 {