summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rbutil/rbutilqt/base/detect.cpp29
-rw-r--r--rbutil/rbutilqt/base/detect.h4
-rw-r--r--rbutil/rbutilqt/install.cpp2
-rw-r--r--rbutil/rbutilqt/rbsettings.cpp24
-rw-r--r--rbutil/rbutilqt/rbsettings.h7
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp2
6 files changed, 21 insertions, 47 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)
}
-/** @brief detects installed rockbox target id
- * @return TargetId of installed rockbox, or -1 if not available
+/** @brief detects installed rockbox target string
+ * @return target name (platform) of installed Rockbox, empty string on error.
*/
-int Detect::installedTargetId(QString mountpoint)
+QString Detect::installedTarget(QString mountpoint)
{
// read rockbox-info.txt
QFile info(mountpoint +"/.rockbox/rockbox-info.txt");
if(!info.open(QIODevice::ReadOnly))
{
- return -1;
+ return "";
}
while (!info.atEnd())
{
QString line = info.readLine();
- if(line.contains("Target id:"))
+ if(line.contains("Target:"))
{
qDebug() << line;
- return line.remove("Target id:").trimmed().toInt();
+ return line.remove("Target:").trimmed();
}
}
info.close();
- return -1;
+ return "";
}
@@ -404,7 +404,7 @@ int Detect::installedTargetId(QString mountpoint)
* @param targetId the targetID to check for. if it is -1 no check is done.
* @return string with error messages if problems occurred, empty strings if none.
*/
-QString Detect::check(RbSettings* settings, bool permission, int targetId)
+QString Detect::check(RbSettings* settings, bool permission)
{
QString text = "";
@@ -421,15 +421,12 @@ QString Detect::check(RbSettings* settings, bool permission, int targetId)
}
// Check TargetId
- if(targetId > 0)
+ QString installed = installedTarget(settings->mountpoint());
+ if(!installed.isEmpty() && installed != settings->curPlatform())
{
- int installedID = Detect::installedTargetId(settings->mountpoint());
- if( installedID != -1 && installedID != targetId)
- {
- text += QObject::tr("<li>Target mismatch detected.\n"
- "Installed target: %1, selected target: %2.</li>")
- .arg(settings->nameOfTargetId(installedID),settings->curName());
- }
+ text += QObject::tr("<li>Target mismatch detected.\n"
+ "Installed target: %1, selected target: %2.</li>")
+ .arg(settings->name(installed), settings->curName());
}
if(!text.isEmpty())
diff --git a/rbutil/rbutilqt/base/detect.h b/rbutil/rbutilqt/base/detect.h
index 00a8daaef7..42de677eac 100644
--- a/rbutil/rbutilqt/base/detect.h
+++ b/rbutil/rbutilqt/base/detect.h
@@ -45,9 +45,9 @@ public:
static QUrl systemProxy(void);
static QString installedVersion(QString mountpoint);
- static int installedTargetId(QString mountpoint);
+ static QString installedTarget(QString mountpoint);
- static QString check(RbSettings* settings, bool permission, int targetId);
+ static QString check(RbSettings* settings, bool permission);
};
#endif
diff --git a/rbutil/rbutilqt/install.cpp b/rbutil/rbutilqt/install.cpp
index 457ea0d59f..efdc6d0513 100644
--- a/rbutil/rbutilqt/install.cpp
+++ b/rbutil/rbutilqt/install.cpp
@@ -133,7 +133,7 @@ void Install::accept()
}
settings->sync();
- QString warning = Detect::check(settings, false, settings->curTargetId());
+ QString warning = Detect::check(settings, false);
if(!warning.isEmpty())
{
if(QMessageBox::warning(this, tr("Really continue?"), warning,
diff --git a/rbutil/rbutilqt/rbsettings.cpp b/rbutil/rbutilqt/rbsettings.cpp
index b26f86b921..5f8664e7ea 100644
--- a/rbutil/rbutilqt/rbsettings.cpp
+++ b/rbutil/rbutilqt/rbsettings.cpp
@@ -388,30 +388,6 @@ QString RbSettings::brand(QString plattform)
return brand;
}
-QString RbSettings::nameOfTargetId(int id)
-{
- QString result ="";
- // get a list of ID -> target name
- QStringList platforms;
- devices->beginGroup("platforms");
- platforms = devices->childKeys();
- devices->endGroup();
- for(int i = 0; i < platforms.size(); i++)
- {
- devices->beginGroup("platforms");
- QString target = devices->value(platforms.at(i)).toString();
- devices->endGroup();
- devices->beginGroup(target);
- if(devices->value("targetid").toInt() == id)
- {
- result = devices->value("name").toString();
- }
- devices->endGroup();
- }
-
- return result;
-}
-
QMap<int, QString> RbSettings::usbIdMap()
{
QMap<int, QString> map;
diff --git a/rbutil/rbutilqt/rbsettings.h b/rbutil/rbutilqt/rbsettings.h
index afa1900e7b..5ee4852065 100644
--- a/rbutil/rbutilqt/rbsettings.h
+++ b/rbutil/rbutilqt/rbsettings.h
@@ -80,11 +80,12 @@ class RbSettings : public QObject
double encoderVolume(QString enc);
bool encoderNarrowband(QString enc);
- QStringList allPlatforms();
+ QStringList allPlatforms(void);
+ QStringList allLanguages(void);
+
QString name(QString plattform);
QString brand(QString plattform);
- QStringList allLanguages();
- QString nameOfTargetId(int id);
+
QMap<int, QString> usbIdMap();
QMap<int, QString> usbIdErrorMap();
QMap<int, QString> usbIdIncompatMap();
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index 77500798b1..9ce8cb58f4 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -518,7 +518,7 @@ bool RbUtilQt::installAuto()
// check installed Version and Target
QString rbVersion = Detect::installedVersion(settings->mountpoint());
- QString warning = Detect::check(settings, false, settings->curTargetId());
+ QString warning = Detect::check(settings, false);
if(!warning.isEmpty())
{