2 #include <QtCore/QStringList>
4 #include <CoreServices/CoreServices.h>
5 #include <IOKit/storage/IOCDMedia.h>
6 #include <IOKit/storage/IODVDMedia.h>
12 QString disk_name = DADiskGetBSDName(disk);
23 QString disk_name = DADiskGetBSDName(disk);
47 DAUnregisterCallback(mSession, (
void*)
onDiskAppear,
this);
60 mSession = DASessionCreate(kCFAllocatorDefault);
62 qWarning(
"Failed to create Disk Arbitration session");
66 DARegisterDiskAppearedCallback(mSession,
nullptr,
onDiskAppear,
this);
67 DARegisterDiskDisappearedCallback(mSession,
nullptr,
onDiskDisappear,
this);
71 void QDeviceWatcherPrivate::run()
75 DASessionScheduleWithRunLoop(mSession, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
78 result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1,
true);
79 }
while (!mStop && result);
81 DASessionUnscheduleFromRunLoop(mSession, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
#define TTKStaticCast(x, y)
static void onDiskDisappear(DADiskRef disk, void *context)
void emitDeviceAdded(const QString &dev)
static QStringList sDevices
static void onDiskAppear(DADiskRef disk, void *context)
void emitDeviceRemoved(const QString &dev)
The class of the device watcher private.