summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/detect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/base/detect.cpp')
-rw-r--r--rbutil/rbutilqt/base/detect.cpp29
1 files changed, 13 insertions, 16 deletions
diff --git a/rbutil/rbutilqt/base/detect.cpp b/rbutil/rbutilqt/base/detect.cpp
index d2a65ee72f..1792febc0f 100644
--- a/rbutil/rbutilqt/base/detect.cpp
+++ b/rbutil/rbutilqt/base/detect.cpp
@@ -372,29 +372,29 @@ QString Detect::installedVersion(QString mountpoint)
372} 372}
373 373
374 374
375/** @brief detects installed rockbox target id 375/** @brief detects installed rockbox target string
376 * @return TargetId of installed rockbox, or -1 if not available 376 * @return target name (platform) of installed Rockbox, empty string on error.
377 */ 377 */
378int Detect::installedTargetId(QString mountpoint) 378QString Detect::installedTarget(QString mountpoint)
379{ 379{
380 // read rockbox-info.txt 380 // read rockbox-info.txt
381 QFile info(mountpoint +"/.rockbox/rockbox-info.txt"); 381 QFile info(mountpoint +"/.rockbox/rockbox-info.txt");
382 if(!info.open(QIODevice::ReadOnly)) 382 if(!info.open(QIODevice::ReadOnly))
383 { 383 {
384 return -1; 384 return "";
385 } 385 }
386 386
387 while (!info.atEnd()) 387 while (!info.atEnd())
388 { 388 {
389 QString line = info.readLine(); 389 QString line = info.readLine();
390 if(line.contains("Target id:")) 390 if(line.contains("Target:"))
391 { 391 {
392 qDebug() << line; 392 qDebug() << line;
393 return line.remove("Target id:").trimmed().toInt(); 393 return line.remove("Target:").trimmed();
394 } 394 }
395 } 395 }
396 info.close(); 396 info.close();
397 return -1; 397 return "";
398} 398}
399 399
400 400
@@ -404,7 +404,7 @@ int Detect::installedTargetId(QString mountpoint)
404 * @param targetId the targetID to check for. if it is -1 no check is done. 404 * @param targetId the targetID to check for. if it is -1 no check is done.
405 * @return string with error messages if problems occurred, empty strings if none. 405 * @return string with error messages if problems occurred, empty strings if none.
406 */ 406 */
407QString Detect::check(RbSettings* settings, bool permission, int targetId) 407QString Detect::check(RbSettings* settings, bool permission)
408{ 408{
409 QString text = ""; 409 QString text = "";
410 410
@@ -421,15 +421,12 @@ QString Detect::check(RbSettings* settings, bool permission, int targetId)
421 } 421 }
422 422
423 // Check TargetId 423 // Check TargetId
424 if(targetId > 0) 424 QString installed = installedTarget(settings->mountpoint());
425 if(!installed.isEmpty() && installed != settings->curPlatform())
425 { 426 {
426 int installedID = Detect::installedTargetId(settings->mountpoint()); 427 text += QObject::tr("<li>Target mismatch detected.\n"
427 if( installedID != -1 && installedID != targetId) 428 "Installed target: %1, selected target: %2.</li>")
428 { 429 .arg(settings->name(installed), settings->curName());
429 text += QObject::tr("<li>Target mismatch detected.\n"
430 "Installed target: %1, selected target: %2.</li>")
431 .arg(settings->nameOfTargetId(installedID),settings->curName());
432 }
433 } 430 }
434 431
435 if(!text.isEmpty()) 432 if(!text.isEmpty())