diff options
author | Dominik Wenger <domonoky@googlemail.com> | 2008-04-03 20:05:13 +0000 |
---|---|---|
committer | Dominik Wenger <domonoky@googlemail.com> | 2008-04-03 20:05:13 +0000 |
commit | 136388114846f55ffc3724e6bc482e746df0dfe5 (patch) | |
tree | d88e4e11d8ccd86f7fa183c759fbee8c2ee61c7a /rbutil/rbutilqt | |
parent | 8143f4987652525b35cc8fa592fda3c85960085e (diff) |
rbutil:let autodetection::detectUsb also use the rbsettings object.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16952 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r-- | rbutil/rbutilqt/autodetection.cpp | 25 | ||||
-rw-r--r-- | rbutil/rbutilqt/autodetection.h | 6 | ||||
-rw-r--r-- | rbutil/rbutilqt/configure.cpp | 1 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbsettings.cpp | 49 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbsettings.h | 5 |
5 files changed, 61 insertions, 25 deletions
diff --git a/rbutil/rbutilqt/autodetection.cpp b/rbutil/rbutilqt/autodetection.cpp index d9b77514a8..34a0db4df3 100644 --- a/rbutil/rbutilqt/autodetection.cpp +++ b/rbutil/rbutilqt/autodetection.cpp @@ -256,32 +256,11 @@ QString Autodetection::resolveMountPoint(QString device) */ bool Autodetection::detectUsb() { - // autodetection uses the buildin device settings only - QSettings dev(":/ini/rbutil.ini", QSettings::IniFormat, this); - - // get a list of ID -> target name - QStringList platforms; - dev.beginGroup("platforms"); - platforms = dev.childKeys(); - dev.endGroup(); - // usbids holds the mapping in the form // ((VID<<16)|(PID)), targetname // the ini file needs to hold the IDs as hex values. - QMap<int, QString> usbids; - QMap<int, QString> usberror; - - for(int i = 0; i < platforms.size(); i++) { - dev.beginGroup("platforms"); - QString target = dev.value(platforms.at(i)).toString(); - dev.endGroup(); - dev.beginGroup(target); - if(!dev.value("usbid").toString().isEmpty()) - usbids.insert(dev.value("usbid").toString().toInt(0, 16), target); - if(!dev.value("usberror").toString().isEmpty()) - usberror.insert(dev.value("usberror").toString().toInt(0, 16), target); - dev.endGroup(); - } + QMap<int, QString> usbids = settings->usbIdMap(); + QMap<int, QString> usberror = settings->usbIdErrorMap(); // usb pid detection #if defined(Q_OS_LINUX) | defined(Q_OS_MACX) diff --git a/rbutil/rbutilqt/autodetection.h b/rbutil/rbutilqt/autodetection.h index ec89dbf6cd..ed70233c52 100644 --- a/rbutil/rbutilqt/autodetection.h +++ b/rbutil/rbutilqt/autodetection.h @@ -22,6 +22,7 @@ #define AUTODETECTION_H_ #include <QtCore> +#include "rbsettings.h" extern "C" { // Ipodpatcher @@ -35,7 +36,9 @@ class Autodetection :public QObject public: Autodetection(QObject* parent=0); - + + void setSettings(RbSettings* sett) {settings = sett;} + bool detect(); QString getDevice() {return m_device;} @@ -52,6 +55,7 @@ private: QString m_mountpoint; QString m_errdev; QList<int> m_usbconid; + RbSettings* settings; }; diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index aad6f32029..61d3d7e457 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp @@ -489,6 +489,7 @@ void Config::setCache(QString c) void Config::autodetect() { Autodetection detector(this); + detector.setSettings(settings); if(detector.detect()) //let it detect { diff --git a/rbutil/rbutilqt/rbsettings.cpp b/rbutil/rbutilqt/rbsettings.cpp index 7f4864f515..8782e53a26 100644 --- a/rbutil/rbutilqt/rbsettings.cpp +++ b/rbutil/rbutilqt/rbsettings.cpp @@ -410,6 +410,55 @@ QString RbSettings::brand(QString plattform) return brand; } +QMap<int, QString> RbSettings::usbIdMap() +{ + QMap<int, QString> map; + // 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("usbid").toString().isEmpty()) + map.insert(devices->value("usbid").toString().toInt(0, 16), target); + devices->endGroup(); + } + + return map; +} + +QMap<int, QString> RbSettings::usbIdErrorMap() +{ + + QMap<int, QString> map; + // 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("usberror").toString().isEmpty()) + map.insert(devices->value("usberror").toString().toInt(0, 16), target); + devices->endGroup(); + } + + return map; +} + + + QString RbSettings::curResolution() { QString platform = userSettings->value("platform").toString(); diff --git a/rbutil/rbutilqt/rbsettings.h b/rbutil/rbutilqt/rbsettings.h index 3218f30b0e..d7c0ab2d97 100644 --- a/rbutil/rbutilqt/rbsettings.h +++ b/rbutil/rbutilqt/rbsettings.h @@ -81,7 +81,10 @@ class RbSettings : public QObject QString name(QString plattform); QString brand(QString plattform); QStringList allLanguages(); - + QMap<int, QString> usbIdMap(); + QMap<int, QString> usbIdErrorMap(); + + bool curNeedsBootloader(); QString curBrand(); QString curName(); |