diff options
Diffstat (limited to 'rbutil')
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 40 |
1 files changed, 23 insertions, 17 deletions
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) | |||
1280 | } | 1280 | } |
1281 | else { | 1281 | else { |
1282 | QString toParse(update->readAll()); | 1282 | QString toParse(update->readAll()); |
1283 | 1283 | ||
1284 | QRegExp searchString("<a[^>]*>([a-zA-Z]+[^<]*)</a>"); | 1284 | QRegExp searchString("<a[^>]*>([a-zA-Z]+[^<]*)</a>"); |
1285 | QStringList rbutilList; | 1285 | QStringList rbutilList; |
1286 | int pos = 0; | 1286 | int pos = 0; |
1287 | while ((pos = searchString.indexIn(toParse, pos)) != -1) | 1287 | while ((pos = searchString.indexIn(toParse, pos)) != -1) |
1288 | { | 1288 | { |
1289 | rbutilList << searchString.cap(1); | 1289 | rbutilList << searchString.cap(1); |
1290 | pos += searchString.matchedLength(); | 1290 | pos += searchString.matchedLength(); |
1291 | } | 1291 | } |
1292 | qDebug() << "[Checkupdate] " << rbutilList; | 1292 | qDebug() << "[Checkupdate] " << rbutilList; |
1293 | 1293 | ||
1294 | QString newVersion = ""; | 1294 | QString newVersion = ""; |
1295 | //check if there is a binary with higher version in this list | 1295 | QString foundVersion = ""; |
1296 | // check if there is a binary with higher version in this list | ||
1296 | for(int i=0; i < rbutilList.size(); i++) | 1297 | for(int i=0; i < rbutilList.size(); i++) |
1297 | { | 1298 | { |
1299 | QString item = rbutilList.at(i); | ||
1298 | #if defined(Q_OS_LINUX) | 1300 | #if defined(Q_OS_LINUX) |
1299 | #if defined(__amd64__) | 1301 | #if defined(__amd64__) |
1300 | //skip if it isnt a 64bit build | 1302 | // skip if it isn't a 64 bit build |
1301 | if( !rbutilList.at(i).contains("64bit")) | 1303 | if( !item.contains("64bit")) |
1302 | continue; | 1304 | continue; |
1305 | // strip the "64bit" suffix for comparison | ||
1306 | item = item.remove("64bit"); | ||
1303 | #else | 1307 | #else |
1304 | //skip if it is a 64bit build | 1308 | //skip if it is a 64bit build |
1305 | if(rbutilList.at(i).contains("64bit")) | 1309 | if(item.contains("64bit")) |
1306 | continue; | 1310 | continue; |
1307 | #endif | 1311 | #endif |
1308 | #endif | 1312 | #endif |
1309 | //check if it is newer, and remember newest | 1313 | // check if it is newer, and remember newest |
1310 | if(Utils::compareVersionStrings(VERSION, rbutilList.at(i)) == 1) | 1314 | if(Utils::compareVersionStrings(VERSION, item) == 1) |
1311 | { | 1315 | { |
1312 | if(Utils::compareVersionStrings(newVersion, rbutilList.at(i)) == 1) | 1316 | if(Utils::compareVersionStrings(newVersion, item) == 1) |
1313 | { | 1317 | { |
1314 | newVersion = rbutilList.at(i); | 1318 | newVersion = item; |
1319 | foundVersion = rbutilList.at(i); | ||
1315 | } | 1320 | } |
1316 | } | 1321 | } |
1317 | } | 1322 | } |
1318 | 1323 | ||
1319 | // if we found something newer, display info | 1324 | // if we found something newer, display info |
1320 | if(newVersion != "") | 1325 | if(foundVersion != "") |
1321 | { | 1326 | { |
1322 | QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString(); | 1327 | QString url = SystemInfo::value(SystemInfo::RbutilUrl).toString(); |
1323 | #if defined(Q_OS_WIN32) | 1328 | #if defined(Q_OS_WIN32) |
@@ -1327,11 +1332,12 @@ void RbUtilQt::downloadUpdateDone(bool error) | |||
1327 | #elif defined(Q_OS_MACX) | 1332 | #elif defined(Q_OS_MACX) |
1328 | url += "macosx/"; | 1333 | url += "macosx/"; |
1329 | #endif | 1334 | #endif |
1330 | url += newVersion; | 1335 | url += foundVersion; |
1331 | 1336 | ||
1332 | QMessageBox::information(this,tr("RockboxUtility Update available"), | 1337 | QMessageBox::information(this,tr("RockboxUtility Update available"), |
1333 | tr("<b>New RockboxUtility Version available.</b> <br><br>" | 1338 | tr("<b>New RockboxUtility Version available.</b> <br><br>" |
1334 | "Download it from here: <a href='%1'>%2</a>").arg(url).arg(newVersion) ); | 1339 | "Download it from here: <a href='%1'>%2</a>") |
1340 | .arg(url).arg(foundVersion)); | ||
1335 | ui.statusbar->showMessage(tr("New version of Rockbox Utility available.")); | 1341 | ui.statusbar->showMessage(tr("New version of Rockbox Utility available.")); |
1336 | } | 1342 | } |
1337 | else { | 1343 | else { |