Fix quirks table and add my device manually :-)

Also fixes error dialog for organise files.
This commit is contained in:
John Maguire 2010-09-04 20:11:14 +00:00
parent cb8a65cd4d
commit be6e887375
4 changed files with 19 additions and 8 deletions

View File

@ -77,9 +77,7 @@ class MacDeviceLister : public DeviceLister {
uint qHash(const MacDeviceLister::MTPDevice& device);
inline bool operator==(const MacDeviceLister::MTPDevice& a, const MacDeviceLister::MTPDevice& b) {
return (a.vendor == b.vendor) &&
(a.vendor_id == b.vendor_id) &&
(a.product == b.product) &&
return (a.vendor_id == b.vendor_id) &&
(a.product_id == b.product_id);
}

View File

@ -57,7 +57,7 @@
QSet<MacDeviceLister::MTPDevice> MacDeviceLister::sMTPDeviceList;
uint qHash(const MacDeviceLister::MTPDevice& d) {
return qHash(d.vendor) ^ qHash(d.vendor_id) ^ qHash(d.product) ^ qHash(d.product_id);
return qHash(d.vendor_id) ^ qHash(d.product_id);
}
MacDeviceLister::MacDeviceLister() {
@ -85,8 +85,18 @@ void MacDeviceLister::Init() {
d.product = QString::fromAscii(device.product);
d.product_id = device.product_id;
d.quirks = device.device_flags;
sMTPDeviceList << d;
}
}
MTPDevice d;
d.vendor = "SanDisk";
d.vendor_id = 0x781;
d.product = "Sansa Clip+";
d.product_id = 0x74d0;
d.quirks = 0x2 | 0x4 | 0x40 | 0x4000;
sMTPDeviceList << d;
}
run_loop_ = CFRunLoopGetCurrent();
@ -423,6 +433,7 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) {
// First check the libmtp device list.
QSet<MTPDevice>::const_iterator it = sMTPDeviceList.find(device);
if (it != sMTPDeviceList.end()) {
qDebug() << "Found in table";
// Fill in quirks flags from libmtp.
device.quirks = it->quirks;
me->FoundMTPDevice(device, GetSerialForMTPDevice(object));

View File

@ -303,7 +303,6 @@ void OrganiseDialog::OrganiseFinished(const QStringList& files_with_errors) {
if (files_with_errors.isEmpty())
return;
OrganiseErrorDialog* dialog = new OrganiseErrorDialog(this);
dialog->Show(OrganiseErrorDialog::Type_Copy, files_with_errors);
// It deletes itself when the user closes it
error_dialog_.reset(new OrganiseErrorDialog);
error_dialog_->Show(OrganiseErrorDialog::Type_Copy, files_with_errors);
}

View File

@ -24,9 +24,10 @@
#include "core/organiseformat.h"
#include "core/song.h"
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
class LibraryWatcher;
class OrganiseErrorDialog;
class TaskManager;
class Ui_OrganiseDialog;
@ -76,6 +77,8 @@ private:
QStringList filenames_;
SongList preview_songs_;
quint64 total_size_;
boost::scoped_ptr<OrganiseErrorDialog> error_dialog_;
};
#endif // ORGANISEDIALOG_H