summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2009-08-10 19:20:53 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2009-08-10 19:20:53 +0000
commit84ced00bbd1b86585de508176fa63f09a2faf79b (patch)
tree4f000e70d6b487b102186be58bb2b0414280adb1 /rbutil/rbutilqt/base
parentad7dab615f668274bc35fca5375d1d2facf4f1b8 (diff)
Simplify and cleanup rockbox-info.txt handling.
Simplify RockboxInfo file handling. Remove Detect::installedVersion() and Detect::installedTarget(), as those became wrappers around RockboxInfo without functionality. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22237 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp2
-rw-r--r--rbutil/rbutilqt/base/detect.cpp33
-rw-r--r--rbutil/rbutilqt/base/detect.h2
-rw-r--r--rbutil/rbutilqt/base/utils.cpp19
-rw-r--r--rbutil/rbutilqt/base/utils.h4
-rw-r--r--rbutil/rbutilqt/base/voicefile.cpp2
6 files changed, 15 insertions, 47 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 386b39057a..5bab1d62d3 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -92,7 +92,7 @@ bool Autodetection::detect()
// check rockbox-info.txt afterwards.
RockboxInfo info(mounts.at(i));
- if(info.open())
+ if(info.success())
{
if(m_device.isEmpty())
{
diff --git a/rbutil/rbutilqt/base/detect.cpp b/rbutil/rbutilqt/base/detect.cpp
index 9eaa1c9bb7..3b8547bdaf 100644
--- a/rbutil/rbutilqt/base/detect.cpp
+++ b/rbutil/rbutilqt/base/detect.cpp
@@ -396,36 +396,6 @@ QUrl Detect::systemProxy(void)
}
-/** @brief detects the installed Rockbox version
- * @return QString with version. Empty if not aviable
- */
-QString Detect::installedVersion(QString mountpoint)
-{
- RockboxInfo info(mountpoint);
- if(!info.open())
- {
- return "";
- }
-
- return info.version();
-}
-
-
-/** @brief detects installed rockbox target string
- * @return target name (platform) of installed Rockbox, empty string on error.
- */
-QString Detect::installedTarget(QString mountpoint)
-{
- RockboxInfo info(mountpoint);
- if(!info.open())
- {
- return "";
- }
-
- return info.target();
-}
-
-
/** @brief checks different Enviroment things. Ask if user wants to continue.
* @param settings A pointer to rbutils settings class
* @param permission if it should check for permission
@@ -449,7 +419,8 @@ QString Detect::check(bool permission)
}
// Check TargetId
- QString installed = installedTarget(RbSettings::value(RbSettings::Mountpoint).toString());
+ RockboxInfo rbinfo(RbSettings::value(RbSettings::Mountpoint).toString());
+ QString installed = rbinfo.target();
if(!installed.isEmpty() && installed != RbSettings::value(RbSettings::CurConfigureModel).toString())
{
text += QObject::tr("<li>Target mismatch detected.\n"
diff --git a/rbutil/rbutilqt/base/detect.h b/rbutil/rbutilqt/base/detect.h
index 96c0696467..fe4b01f1a1 100644
--- a/rbutil/rbutilqt/base/detect.h
+++ b/rbutil/rbutilqt/base/detect.h
@@ -45,8 +45,6 @@ public:
static QMap<uint32_t, QString> listUsbDevices(void);
static QUrl systemProxy(void);
- static QString installedVersion(QString mountpoint);
- static QString installedTarget(QString mountpoint);
static QString check(bool permission);
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp
index 966ce335ea..a1b6e2bd0e 100644
--- a/rbutil/rbutilqt/base/utils.cpp
+++ b/rbutil/rbutilqt/base/utils.cpp
@@ -161,17 +161,14 @@ QString findExecutable(QString name)
RockboxInfo::RockboxInfo(QString mountpoint)
{
- m_path = mountpoint +"/.rockbox/rockbox-info.txt";
-}
-
-bool RockboxInfo::open()
-{
- QFile file(m_path);
+ qDebug() << "[RockboxInfo] trying to find rockbox-info at" << mountpoint;
+ QFile file(mountpoint + "/.rockbox/rockbox-info.txt");
+ m_success = false;
if(!file.exists())
- return false;
+ return;
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
- return false;
+ return;
// read file contents
while (!file.atEnd())
@@ -195,7 +192,9 @@ bool RockboxInfo::open()
m_targetid = line.remove("Target id:").trimmed();
}
}
-
+
file.close();
- return true;
+ m_success = true;
+ return;
}
+
diff --git a/rbutil/rbutilqt/base/utils.h b/rbutil/rbutilqt/base/utils.h
index 49fca85df6..9113eba7df 100644
--- a/rbutil/rbutilqt/base/utils.h
+++ b/rbutil/rbutilqt/base/utils.h
@@ -35,18 +35,18 @@ class RockboxInfo
{
public:
RockboxInfo(QString mountpoint);
- bool open();
QString version() {return m_version;}
QString features(){return m_features;}
QString targetID() {return m_targetid;}
QString target() {return m_target;}
+ bool success() { return m_success; }
private:
- QString m_path;
QString m_version;
QString m_features;
QString m_targetid;
QString m_target;
+ bool m_success;
};
#endif
diff --git a/rbutil/rbutilqt/base/voicefile.cpp b/rbutil/rbutilqt/base/voicefile.cpp
index cacd0c437a..6eff308cd1 100644
--- a/rbutil/rbutilqt/base/voicefile.cpp
+++ b/rbutil/rbutilqt/base/voicefile.cpp
@@ -47,7 +47,7 @@ bool VoiceFileCreator::createVoiceFile()
// read rockbox-info.txt
RockboxInfo info(m_mountpoint);
- if(!info.open())
+ if(!info.success())
{
emit logItem(tr("could not find rockbox-info.txt"),LOGERROR);
emit done(true);