Index: rbutil/rbutilqt/detecteddevicesfrm.ui
===================================================================
--- rbutil/rbutilqt/detecteddevicesfrm.ui (revision 0)
+++ rbutil/rbutilqt/detecteddevicesfrm.ui (revision 0)
@@ -0,0 +1,97 @@
+
+ DetectedDevicesFrm
+
+
+
+ 0
+ 0
+ 386
+ 284
+
+
+
+ Detected Devices
+
+
+ -
+
+
+ Detected Device:
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+ -
+
+
+ true
+
+
+ false
+
+
+ 2
+
+
+
+ Device Name
+
+
+
+
+ Mountpoints
+
+
+
+
+
+ buttonBox
+ devicesView
+ label
+ deviceView
+
+
+
+
+ buttonBox
+ accepted()
+ DetectedDevicesFrm
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ DetectedDevicesFrm
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
Index: rbutil/rbutilqt/autodetection.h
===================================================================
--- rbutil/rbutilqt/autodetection.h (revision 18734)
+++ rbutil/rbutilqt/autodetection.h (working copy)
@@ -29,6 +29,15 @@
#include "../ipodpatcher/ipodpatcher.h"
#include "../sansapatcher/sansapatcher.h"
+struct SDevice
+{
+ QString device;
+ QStringList mountpoints;
+ bool valid;
+ QString errorstring;
+};
+
+
class Autodetection :public QObject
{
Q_OBJECT
@@ -40,21 +49,27 @@
bool detect();
- QString getDevice() {return m_device;}
- QString getMountPoint() {return m_mountpoint;}
- QString errdev(void) { return m_errdev; }
- QString incompatdev(void) { return m_incompat; }
-
-private:
+ QList getDevices() {return m_deviceList; }
+
+private:
+ // helper functions
QStringList getMountpoints(void);
QString resolveMountPoint(QString);
- bool detectUsb(void);
- bool detectAjbrec(QString);
+ QString detectAjbrec(QString);
- QString m_device;
- QString m_mountpoint;
- QString m_errdev;
- QString m_incompat;
+ void simplifyList();
+
+ // new detect functions
+ QList detectUsb();
+ QList detectLogFile(QString mountpoint);
+ QList detectInfoFile(QString mountpoint);
+ QList detectFiles(QString mountpoint);
+ QList detectFolders(QString mountpoint);
+ QList detectSansa();
+ QList detectIpod();
+
+ // list of detected devices
+ QList m_deviceList;
QList m_usbconid;
RbSettings* settings;
};
Index: rbutil/rbutilqt/configure.cpp
===================================================================
--- rbutil/rbutilqt/configure.cpp (revision 18734)
+++ rbutil/rbutilqt/configure.cpp (working copy)
@@ -27,6 +27,7 @@
#include "encoders.h"
#include "tts.h"
#include "detect.h"
+#include "detecteddevices.h"
#include
#if defined(Q_OS_WIN32)
@@ -511,7 +512,29 @@
if(detector.detect()) //let it detect
{
- QString devicename = detector.getDevice();
+ QList detectedDevices = detector.getDevices();
+
+ DetectedDevices deviceDialog(this);
+ deviceDialog.setSettings(settings);
+ deviceDialog.setDevices(detectedDevices);
+ deviceDialog.exec();
+
+ QString devicename = deviceDialog.getDevice();
// deexpand all items
for(int a = 0; a < ui.treeDevices->topLevelItemCount(); a++)
ui.treeDevices->topLevelItem(a)->setExpanded(false);
@@ -539,35 +562,9 @@
}
}
- if(!detector.errdev().isEmpty()) {
- QString text;
- if(detector.errdev() == "sansae200")
- text = tr("Sansa e200 in MTP mode found!\n"
- "You need to change your player to MSC mode for installation. ");
- if(detector.errdev() == "h10")
- text = tr("H10 20GB in MTP mode found!\n"
- "You need to change your player to UMS mode for installation. ");
- text += tr("Unless you changed this installation will fail!");
-
- QMessageBox::critical(this, tr("Fatal error"), text, QMessageBox::Ok);
- return;
- }
- if(!detector.incompatdev().isEmpty()) {
- QString text;
- // we need to set the platform here to get the brand from the
- // settings object
- settings->setCurPlatform(detector.incompatdev());
- text = tr("Detected an unsupported %1 player variant. Sorry, "
- "Rockbox doesn't run on your player.").arg(settings->curBrand());
-
- QMessageBox::critical(this, tr("Fatal error: incompatible player found"),
- text, QMessageBox::Ok);
- return;
- }
-
- if(detector.getMountPoint() != "" )
+ if(deviceDialog.getMountpoint() != "" )
{
- ui.mountPoint->setText(QDir::toNativeSeparators(detector.getMountPoint()));
+ ui.mountPoint->setText(QDir::toNativeSeparators(deviceDialog.getMountpoint()));
}
else
{
Index: rbutil/rbutilqt/detecteddevices.cpp
===================================================================
--- rbutil/rbutilqt/detecteddevices.cpp (revision 0)
+++ rbutil/rbutilqt/detecteddevices.cpp (revision 0)
@@ -0,0 +1,111 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2007 by Dominik Riebeling
+ * $Id: browsedirtree.cpp 17462 2008-05-11 17:21:14Z nicolasp $
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include
+
+#include "detecteddevices.h"
+
+DetectedDevices::DetectedDevices(QWidget *parent) : QDialog(parent)
+{
+ ui.setupUi(this);
+ this->setModal(true);
+
+ ui.deviceView->setAlternatingRowColors(true);
+}
+
+void DetectedDevices::insertDevice(QString device,QString mountpoint)
+{
+ QString brand = settings->brand(device);
+
+ QTreeWidgetItem* newItem = new QTreeWidgetItem();
+ newItem->setText(0,settings->name(device));
+ newItem->setText(1,mountpoint);
+ newItem->setData(0,Qt::UserRole,device);
+ newItem->setSelected(true);
+ QTreeWidgetItem* brandItem;
+
+ // search for existing brand entry
+ QList list = ui.deviceView->findItems(brand,Qt::MatchExactly);
+ if(list.size() == 0)
+ {
+ brandItem = new QTreeWidgetItem();
+ brandItem->setText(0,brand);
+ brandItem->setExpanded(true);
+ brandItem->setFlags(Qt::ItemIsEnabled);
+ ui.deviceView->addTopLevelItem(brandItem);
+ }
+ else
+ {
+ brandItem = list.at(0);
+ }
+
+ brandItem->addChild(newItem);
+}
+
+void DetectedDevices::setDevices(QList deviceList)
+{
+ for(int i=0; i < deviceList.size(); i++)
+ {
+ SDevice curDevice = deviceList.at(i);
+ if(curDevice.valid)
+ {
+ if(curDevice.mountpoints.size() == 0) // no mountpoints
+ {
+ insertDevice(curDevice.device,"");
+ }
+ else
+ {
+ for(int j=0;jtopLevelItemCount(); a++)
+ ui.deviceView->topLevelItem(a)->setExpanded(true);
+
+ ui.deviceView->resizeColumnToContents(0);
+ ui.deviceView->resizeColumnToContents(1);
+}
+
+void DetectedDevices::accept()
+{
+ QList list = ui.deviceView->selectedItems();
+
+ if(list.size() == 0) //nothing selected
+ {
+ m_device = "";
+ m_mountpoint = "";
+ }
+ else
+ {
+ m_device = list.at(0)->data(0,Qt::UserRole).toString();
+ m_mountpoint = list.at(0)->text(1);
+ }
+ this->close();
+}
+
+
Index: rbutil/rbutilqt/autodetection.cpp
===================================================================
--- rbutil/rbutilqt/autodetection.cpp (revision 18734)
+++ rbutil/rbutilqt/autodetection.cpp (working copy)
@@ -44,6 +44,8 @@
#include "detect.h"
#include "utils.h"
+
+
Autodetection::Autodetection(QObject* parent): QObject(parent)
{
@@ -51,15 +53,13 @@
bool Autodetection::detect()
{
- m_device = "";
- m_mountpoint = "";
- m_errdev = "";
+ m_deviceList.clear();
+
+ // general detection methods
+ m_deviceList = detectUsb();
- detectUsb();
-
- // Try detection via rockbox.info / rbutil.log
+ // detection methods based on mointpoints
QStringList mountpoints = getMountpoints();
-
for(int i=0; i< mountpoints.size();i++)
{
// do the file checking
@@ -68,132 +68,86 @@
if(dir.exists())
{
// check logfile first.
- if(QFile(mountpoints.at(i) + "/.rockbox/rbutil.log").exists()) {
- QSettings log(mountpoints.at(i) + "/.rockbox/rbutil.log",
- QSettings::IniFormat, this);
- if(!log.value("platform").toString().isEmpty()) {
- if(m_device.isEmpty())
- m_device = log.value("platform").toString();
- m_mountpoint = mountpoints.at(i);
- qDebug() << "rbutil.log detected:" << m_device << m_mountpoint;
- return true;
- }
- }
+ m_deviceList += detectLogFile(mountpoints.at(i));
// check rockbox-info.txt afterwards.
- QFile file(mountpoints.at(i) + "/.rockbox/rockbox-info.txt");
- if(file.exists())
- {
- file.open(QIODevice::ReadOnly | QIODevice::Text);
- QString line = file.readLine();
- if(line.startsWith("Target: "))
- {
- line.remove("Target: ");
- if(m_device.isEmpty())
- m_device = line.trimmed(); // trim whitespaces
- m_mountpoint = mountpoints.at(i);
- qDebug() << "rockbox-info.txt detected:" << m_device << m_mountpoint;
- return true;
- }
- }
+ m_deviceList += detectInfoFile(mountpoints.at(i));
+
// check for some specific files in root folder
- QDir root(mountpoints.at(i));
- QStringList rootentries = root.entryList(QDir::Files);
- if(rootentries.contains("archos.mod", Qt::CaseInsensitive))
- {
- // archos.mod in root folder -> Archos Player
- m_device = "player";
- m_mountpoint = mountpoints.at(i);
- return true;
- }
- if(rootentries.contains("ONDIOST.BIN", Qt::CaseInsensitive))
- {
- // ONDIOST.BIN in root -> Ondio FM
- m_device = "ondiofm";
- m_mountpoint = mountpoints.at(i);
- return true;
- }
- if(rootentries.contains("ONDIOSP.BIN", Qt::CaseInsensitive))
- {
- // ONDIOSP.BIN in root -> Ondio SP
- m_device = "ondiosp";
- m_mountpoint = mountpoints.at(i);
- return true;
- }
- if(rootentries.contains("ajbrec.ajz", Qt::CaseInsensitive))
- {
- qDebug() << "ajbrec.ajz found. Trying detectAjbrec()";
- if(detectAjbrec(mountpoints.at(i))) {
- m_mountpoint = mountpoints.at(i);
- qDebug() << m_device;
- return true;
- }
- }
+ m_deviceList += detectFiles(mountpoints.at(i));
+
// detection based on player specific folders
- QStringList rootfolders = root.entryList(QDir::Dirs
- | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
- if(rootfolders.contains("GBSYSTEM", Qt::CaseInsensitive))
- {
- // GBSYSTEM folder -> Gigabeat
- m_device = "gigabeatf";
- m_mountpoint = mountpoints.at(i);
- return true;
- }
-#if defined(Q_OS_WIN32)
- // on windows, try to detect the drive letter of an Ipod
- if(rootfolders.contains("iPod_Control", Qt::CaseInsensitive))
- {
- // iPod_Control folder -> Ipod found
- // detecting of the Ipod type is done below using ipodpatcher
- m_mountpoint = mountpoints.at(i);
- }
-#endif
+ m_deviceList += detectFolders(mountpoints.at(i));
}
-
}
- int n;
+
// try ipodpatcher
- // initialize sector buffer. Needed.
- ipod_sectorbuf = NULL;
- ipod_alloc_buffer(&ipod_sectorbuf, BUFFER_SIZE);
- struct ipod_t ipod;
- n = ipod_scan(&ipod);
- if(n == 1) {
- qDebug() << "Ipod found:" << ipod.modelstr << "at" << ipod.diskname;
- m_device = ipod.targetname;
- m_mountpoint = resolveMountPoint(ipod.diskname);
- return true;
- }
- else {
- qDebug() << "ipodpatcher: no Ipod found." << n;
- }
- free(ipod_sectorbuf);
- ipod_sectorbuf = NULL;
+ m_deviceList +=detectIpod();
+
// try sansapatcher
- // initialize sector buffer. Needed.
- sansa_sectorbuf = NULL;
- sansa_alloc_buffer(&sansa_sectorbuf, BUFFER_SIZE);
- struct sansa_t sansa;
- n = sansa_scan(&sansa);
- if(n == 1) {
- qDebug() << "Sansa found:" << sansa.targetname << "at" << sansa.diskname;
- m_device = QString("sansa%1").arg(sansa.targetname);
- m_mountpoint = resolveMountPoint(sansa.diskname);
- return true;
- }
- else {
- qDebug() << "sansapatcher: no Sansa found." << n;
- }
- free(sansa_sectorbuf);
- sansa_sectorbuf = NULL;
+ m_deviceList +=detectSansa();
- if(m_mountpoint.isEmpty() && m_device.isEmpty() && m_errdev.isEmpty() && m_incompat.isEmpty())
+ // merge dublicates and simplify list
+ simplifyList();
+
+ if(m_deviceList.isEmpty())
return false;
+
return true;
}
+void Autodetection::simplifyList()
+{
+ QList newList;
+
+ // check for special "ipod" device (only has a possible mountpoints)
+ QStringList ipodMountpoints;
+ for(int i= 0; i < m_deviceList.size(); i++)
+ {
+ SDevice curDevice = m_deviceList.at(i);
+ if(curDevice.device == "ipod")
+ ipodMountpoints += curDevice.mountpoints;
+ }
+
+ // transfer and merge into new list
+ for(int i= 0; i < m_deviceList.size(); i++)
+ {
+ SDevice curDevice = m_deviceList.at(i);
+ // now we skip the "ipod" item
+ if(curDevice.device == "ipod")
+ continue;
+ // if it is a ipod we add the mountpoints
+ if(curDevice.device.contains("ipod"))
+ {
+ curDevice.mountpoints += ipodMountpoints;
+ }
+
+ // check if we already have the item in the new list
+ bool found = false;
+ for(int j=0; j < newList.size(); j++)
+ {
+ if(curDevice.device == newList.at(j).device)
+ {
+ // merge mountpoints
+ for(int k=0; k < curDevice.mountpoints.size() ; k++)
+ {
+ if(!newList[j].mountpoints.contains(curDevice.mountpoints.at(k)))
+ newList[j].mountpoints.append(curDevice.mountpoints.at(k));
+ }
+ found = true;
+ }
+ }
+ // its not in the list. insert it.
+ if(found == false)
+ {
+ newList.append(curDevice);
+ }
+ }
+ // replace list
+ m_deviceList = newList;
+}
QStringList Autodetection::getMountpoints()
{
@@ -231,6 +185,192 @@
return tempList;
}
+
+QList Autodetection::detectLogFile(QString mountpoint)
+{
+ QList detectedDevices;
+
+ if(QFile(mountpoint + "/.rockbox/rbutil.log").exists())
+ {
+ QSettings log(mountpoint + "/.rockbox/rbutil.log",
+ QSettings::IniFormat, this);
+ if(!log.value("platform").toString().isEmpty())
+ {
+ SDevice device;
+ device.device = log.value("platform").toString();
+ device.mountpoints.append(mountpoint);
+ device.valid = true;
+ detectedDevices.append(device);
+ qDebug() << "rbutil.log detected:" << device.device << mountpoint;
+ }
+ }
+ return detectedDevices;
+}
+
+QList Autodetection::detectInfoFile(QString mountpoint)
+{
+ QList detectedDevices;
+
+ QFile file(mountpoint + "/.rockbox/rockbox-info.txt");
+ if(file.exists())
+ {
+ file.open(QIODevice::ReadOnly | QIODevice::Text);
+ QString line = file.readLine();
+ if(line.startsWith("Target: "))
+ {
+ line.remove("Target: ");
+ SDevice device;
+ device.device = line.trimmed(); // trim whitespaces
+ device.mountpoints.append(mountpoint);
+ device.valid = true;
+ detectedDevices.append(device);
+ }
+ }
+ return detectedDevices;
+}
+
+QList Autodetection::detectFiles(QString mountpoint)
+{
+ QList detectedDevices;
+
+ QDir root(mountpoint);
+ QStringList rootentries = root.entryList(QDir::Files);
+ if(rootentries.contains("archos.mod", Qt::CaseInsensitive))
+ {
+ // archos.mod in root folder -> Archos Player
+ SDevice device;
+ device.device = "player";
+ device.mountpoints.append(mountpoint);
+ device.valid = true;
+ detectedDevices.append(device);
+ }
+ if(rootentries.contains("ONDIOST.BIN", Qt::CaseInsensitive))
+ {
+ // ONDIOST.BIN in root -> Ondio FM
+ SDevice device;
+ device.device = "ondiofm";
+ device.mountpoints.append(mountpoint);
+ device.valid = true;
+ detectedDevices.append(device);
+ }
+ if(rootentries.contains("ONDIOSP.BIN", Qt::CaseInsensitive))
+ {
+ // ONDIOSP.BIN in root -> Ondio SP
+ SDevice device;
+ device.device = "ondiosp";
+ device.mountpoints.append(mountpoint);
+ device.valid = true;
+ detectedDevices.append(device);
+ }
+ if(rootentries.contains("ajbrec.ajz", Qt::CaseInsensitive))
+ {
+ qDebug() << "ajbrec.ajz found. Trying detectAjbrec()";
+
+ QString dev = detectAjbrec(mountpoint);
+ if(!dev.isEmpty())
+ {
+ // ONDIOST.BIN in root -> Ondio FM
+ SDevice device;
+ device.device = dev;
+ device.mountpoints.append(mountpoint);
+ device.valid = true;
+ detectedDevices.append(device);
+ }
+ }
+ return detectedDevices;
+}
+
+QList Autodetection::detectFolders(QString mountpoint)
+{
+ QList detectedDevices;
+
+ QDir root(mountpoint);
+ QStringList rootfolders = root.entryList(QDir::Dirs
+ | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System);
+ if(rootfolders.contains("GBSYSTEM", Qt::CaseInsensitive))
+ {
+ // GBSYSTEM folder -> Gigabeat
+ SDevice device;
+ device.device = "gigabeatf";
+ device.mountpoints.append(mountpoint);
+ device.valid = true;
+ detectedDevices.append(device);
+ }
+
+ // try to detect the drive letter of an Ipod
+ if(rootfolders.contains("iPod_Control", Qt::CaseInsensitive))
+ {
+ // iPod_Control folder -> Ipod found
+ // detecting of the Ipod type is done later
+ SDevice device;
+ device.device = "ipod";
+ device.mountpoints.append(mountpoint);
+ device.valid = true;
+ detectedDevices.append(device);
+ }
+
+ return detectedDevices;
+}
+
+QList Autodetection::detectIpod()
+{
+ QList detectedDevices;
+
+ // initialize sector buffer. Needed.
+ int n;
+ ipod_sectorbuf = NULL;
+ ipod_alloc_buffer(&ipod_sectorbuf, BUFFER_SIZE);
+ struct ipod_t ipod;
+ n = ipod_scan(&ipod);
+ if(n == 1)
+ {
+ qDebug() << "Ipod found:" << ipod.modelstr << "at" << ipod.diskname;
+ SDevice device;
+ device.device = ipod.targetname;
+ device.mountpoints.append(resolveMountPoint(ipod.diskname));
+ device.valid = true;
+ detectedDevices.append(device);
+ }
+ else
+ {
+ qDebug() << "ipodpatcher: no Ipod found." << n;
+ }
+ free(ipod_sectorbuf);
+ ipod_sectorbuf = NULL;
+
+ return detectedDevices;
+}
+
+QList Autodetection::detectSansa()
+{
+ QList detectedDevices;
+
+ // initialize sector buffer. Needed.
+ int n;
+ sansa_sectorbuf = NULL;
+ sansa_alloc_buffer(&sansa_sectorbuf, BUFFER_SIZE);
+ struct sansa_t sansa;
+ n = sansa_scan(&sansa);
+ if(n == 1)
+ {
+ qDebug() << "Sansa found:" << sansa.targetname << "at" << sansa.diskname;
+ SDevice device;
+ device.device = QString("sansa%1").arg(sansa.targetname);
+ device.mountpoints.append(resolveMountPoint(sansa.diskname));
+ device.valid = true;
+ detectedDevices.append(device);
+ }
+ else
+ {
+ qDebug() << "sansapatcher: no Sansa found." << n;
+ }
+ free(sansa_sectorbuf);
+ sansa_sectorbuf = NULL;
+
+ return detectedDevices;
+}
+
+
QString Autodetection::resolveMountPoint(QString device)
{
qDebug() << "Autodetection::resolveMountPoint(QString)" << device;
@@ -308,8 +448,10 @@
/** @brief detect devices based on usb pid / vid.
* @return true upon success, false otherwise.
*/
-bool Autodetection::detectUsb()
+QList Autodetection::detectUsb()
{
+ QList detectedDevices;
+
// usbids holds the mapping in the form
// ((VID<<16)|(PID)), targetname
// the ini file needs to hold the IDs as hex values.
@@ -323,32 +465,61 @@
int i = attached.size();
while(i--) {
- if(usbids.contains(attached.at(i))) {
- m_device = usbids.value(attached.at(i));
- qDebug() << "[USB] detected supported player" << m_device;
- return true;
+ if(usbids.contains(attached.at(i)))
+ {
+ SDevice device;
+ device.device = usbids.value(attached.at(i));
+ device.valid = true;
+ detectedDevices.append(device);
+ qDebug() << "[USB] detected supported player" << device.device;
}
- if(usberror.contains(attached.at(i))) {
- m_errdev = usberror.value(attached.at(i));
- qDebug() << "[USB] detected problem with player" << m_errdev;
- return true;
+ if(usberror.contains(attached.at(i)))
+ {
+ SDevice device;
+ device.device = usbids.value(attached.at(i));
+ device.valid = false;
+ if(device.device == "sansae200")
+ {
+ device.errorstring = tr("Sansa e200 in MTP mode found!\n"
+ "You need to change your player to MSC mode for installation. ");
+ }
+ else if(device.device == "h10")
+ {
+ device.errorstring = tr("H10 20GB in MTP mode found!\n"
+ "You need to change your player to UMS mode for installation. ");
+ }
+ else
+ {
+ device.errorstring = tr("Problems found!\n"
+ "Your player seems to be in the wrong configuration. ");
+ }
+ detectedDevices.append(device);
+
+ qDebug() << "[USB] detected problem with player" << device.device;
}
- if(usbincompat.contains(attached.at(i))) {
- m_incompat = usbincompat.value(attached.at(i));
- qDebug() << "[USB] detected incompatible player" << m_incompat;
- return true;
+ if(usbincompat.contains(attached.at(i)))
+ {
+ SDevice device;
+ device.device = usbids.value(attached.at(i));
+ device.valid = false;
+ device.errorstring = tr("Detected an unsupported player variant.\n"
+ "Sorry, Rockbox doesn't run on your player." );
+ detectedDevices.append(device);
+
+ qDebug() << "[USB] detected incompatible player" << device.device;
}
}
- return false;
+ return detectedDevices;
}
-bool Autodetection::detectAjbrec(QString root)
+QString Autodetection::detectAjbrec(QString root)
{
+ QString device;
QFile f(root + "/ajbrec.ajz");
char header[24];
f.open(QIODevice::ReadOnly);
- if(!f.read(header, 24)) return false;
+ if(!f.read(header, 24)) return "";
// check the header of the file.
// recorder v1 had a 6 bytes sized header
@@ -360,24 +531,24 @@
qDebug() << "possible bin length:" << len;
qDebug() << "file len:" << f.size();
if((f.size() - 6) == len)
- m_device = "recorder";
+ device = "recorder";
// size didn't match, now we need to assume we have a headerlength of 24.
switch(header[11]) {
case 2:
- m_device = "recorderv2";
+ device = "recorderv2";
break;
case 4:
- m_device = "fmrecorder";
+ device = "fmrecorder";
break;
case 8:
- m_device = "ondiofm";
+ device = "ondiofm";
break;
case 16:
- m_device = "ondiosp";
+ device = "ondiosp";
break;
default:
@@ -385,6 +556,5 @@
}
f.close();
- if(m_device.isEmpty()) return false;
- return true;
+ return device;
}
Index: rbutil/rbutilqt/rbutilqt.pro
===================================================================
--- rbutil/rbutilqt/rbutilqt.pro (revision 18734)
+++ rbutil/rbutilqt/rbutilqt.pro (working copy)
@@ -83,7 +83,8 @@
bootloaderinstallsansa.cpp \
bootloaderinstallfile.cpp \
../../tools/mkboot.c \
- ../../tools/iriver.c
+ ../../tools/iriver.c \
+ detecteddevices.cpp
HEADERS += rbutilqt.h \
install.h \
@@ -135,7 +136,8 @@
bootloaderinstallsansa.h \
bootloaderinstallfile.h \
../../tools/mkboot.h \
- ../../tools/iriver.h
+ ../../tools/iriver.h \
+ detecteddevices.h
# Needed by QT on Win
INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools
@@ -171,7 +173,8 @@
ttsexescfgfrm.ui \
sapicfgfrm.ui \
createvoicefrm.ui \
- sysinfofrm.ui
+ sysinfofrm.ui \
+ detecteddevicesfrm.ui
RESOURCES += rbutilqt.qrc
win32 {
Index: rbutil/rbutilqt/detecteddevices.h
===================================================================
--- rbutil/rbutilqt/detecteddevices.h (revision 0)
+++ rbutil/rbutilqt/detecteddevices.h (revision 0)
@@ -0,0 +1,54 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2007 by Dominik Wenger
+ * $Id: browsedirtree.h 17847 2008-06-28 18:10:04Z bagder $
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef DETECTEDDEVICES_H
+#define DETECTEDDEVICES_H
+
+#include
+
+#include "ui_detecteddevicesfrm.h"
+#include "autodetection.h"
+
+class DetectedDevices : public QDialog
+{
+ Q_OBJECT
+
+public:
+ DetectedDevices(QWidget *parent = 0);
+
+ void setDevices(QList deviceList);
+ void setSettings(RbSettings* sett) {settings = sett;}
+
+ QString getDevice() {return m_device;}
+ QString getMountpoint() {return m_mountpoint;}
+
+private slots:
+ virtual void accept();
+
+private:
+ void insertDevice(QString device,QString mountpoint);
+ Ui::DetectedDevicesFrm ui;
+ RbSettings* settings;
+ QString m_device;
+ QString m_mountpoint;
+};
+#endif
+