Fix compile on Leopard & support correct icons on Mac.
This commit is contained in:
parent
6358198b06
commit
41d1facd9f
|
@ -18,6 +18,18 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
#ifndef kUSBSerialNumberString
|
||||||
|
#define kUSBSerialNumberString "USB Serial Number"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef kUSBVendorString
|
||||||
|
#define kUSBVendorString "USB Vendor Name"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef kUSBProductString
|
||||||
|
#define kUSBProductString "USB Product Name"
|
||||||
|
#endif
|
||||||
|
|
||||||
MacDeviceLister::MacDeviceLister() {
|
MacDeviceLister::MacDeviceLister() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,11 +269,19 @@ QStringList MacDeviceLister::DeviceIcons(const QString& serial) {
|
||||||
io_object_t device = DADiskCopyIOMedia(disk);
|
io_object_t device = DADiskCopyIOMedia(disk);
|
||||||
QString icon = GetIconForDevice(device);
|
QString icon = GetIconForDevice(device);
|
||||||
|
|
||||||
|
NSDictionary* properties = (NSDictionary*)DADiskCopyDescription(disk);
|
||||||
|
NSURL* volume_path =
|
||||||
|
[[properties objectForKey:(NSString*)kDADiskDescriptionVolumePathKey] copy];
|
||||||
|
|
||||||
|
QString path = QString::fromUtf8([[volume_path path] UTF8String]);
|
||||||
|
|
||||||
IOObjectRelease(device);
|
IOObjectRelease(device);
|
||||||
CFRelease(disk);
|
CFRelease(disk);
|
||||||
CFRelease(session);
|
CFRelease(session);
|
||||||
|
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
|
ret << GuessIconForPath(path);
|
||||||
|
ret << GuessIconForModel(DeviceManufacturer(serial), DeviceModel(serial));
|
||||||
if (!icon.isEmpty()) {
|
if (!icon.isEmpty()) {
|
||||||
ret << icon;
|
ret << icon;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue