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 usbids; - QMap 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 usbids = settings->usbIdMap(); + QMap 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 +#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 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 RbSettings::usbIdMap() +{ + QMap 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 RbSettings::usbIdErrorMap() +{ + + QMap 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 usbIdMap(); + QMap usbIdErrorMap(); + + bool curNeedsBootloader(); QString curBrand(); QString curName();