mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-02-08 07:48:48 +01:00
Fix macos build
This commit is contained in:
parent
45c4be3ae9
commit
d398018633
@ -850,9 +850,9 @@ optional_source(APPLE
|
|||||||
if (APPLE)
|
if (APPLE)
|
||||||
optional_source(HAVE_LIBMTP
|
optional_source(HAVE_LIBMTP
|
||||||
SOURCES
|
SOURCES
|
||||||
device/macdevicelister.mm
|
device/macosdevicelister.mm
|
||||||
HEADERS
|
HEADERS
|
||||||
device/macdevicelister.h
|
device/macosdevicelister.h
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#import <AppKit/NSApplication.h>
|
#import <AppKit/NSApplication.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "globalshortcuts/macglobalshortcutbackend.h"
|
#include "globalshortcuts/globalshortcutbackend-macos.h"
|
||||||
|
|
||||||
class PlatformInterface;
|
class PlatformInterface;
|
||||||
@class SPMediaKeyTap;
|
@class SPMediaKeyTap;
|
||||||
@ -9,7 +9,7 @@ class PlatformInterface;
|
|||||||
@interface AppDelegate : NSObject<NSApplicationDelegate, NSUserNotificationCenterDelegate> {
|
@interface AppDelegate : NSObject<NSApplicationDelegate, NSUserNotificationCenterDelegate> {
|
||||||
PlatformInterface* application_handler_;
|
PlatformInterface* application_handler_;
|
||||||
NSMenu* dock_menu_;
|
NSMenu* dock_menu_;
|
||||||
MacGlobalShortcutBackend* shortcut_handler_;
|
GlobalShortcutBackendMacOS* shortcut_handler_;
|
||||||
SPMediaKeyTap* key_tap_;
|
SPMediaKeyTap* key_tap_;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ class PlatformInterface;
|
|||||||
shouldPresentNotification: (id)notification;
|
shouldPresentNotification: (id)notification;
|
||||||
|
|
||||||
- (void) setDockMenu: (NSMenu*)menu;
|
- (void) setDockMenu: (NSMenu*)menu;
|
||||||
- (MacGlobalShortcutBackend*) shortcut_handler;
|
- (GlobalShortcutBackendMacOS*) shortcut_handler;
|
||||||
- (void) setShortcutHandler: (MacGlobalShortcutBackend*)backend;
|
- (void) setShortcutHandler: (GlobalShortcutBackendMacOS*)backend;
|
||||||
- (void) mediaKeyTap: (SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
|
- (void) mediaKeyTap: (SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event;
|
||||||
@end
|
@end
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
class QObject;
|
class QObject;
|
||||||
class QWidget;
|
class QWidget;
|
||||||
|
|
||||||
class MacGlobalShortcutBackend;
|
class GlobalShortcutBackendMacOS;
|
||||||
|
|
||||||
class PlatformInterface {
|
class PlatformInterface {
|
||||||
public:
|
public:
|
||||||
@ -23,7 +23,7 @@ class PlatformInterface {
|
|||||||
namespace mac {
|
namespace mac {
|
||||||
|
|
||||||
void MacMain();
|
void MacMain();
|
||||||
void SetShortcutHandler(MacGlobalShortcutBackend *handler);
|
void SetShortcutHandler(GlobalShortcutBackendMacOS *handler);
|
||||||
void SetApplicationHandler(PlatformInterface *handler);
|
void SetApplicationHandler(PlatformInterface *handler);
|
||||||
void CheckForUpdates();
|
void CheckForUpdates();
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/scoped_nsautorelease_pool.h"
|
#include "core/scoped_nsautorelease_pool.h"
|
||||||
#include "globalshortcuts/globalshortcuts.h"
|
#include "globalshortcuts/globalshortcuts.h"
|
||||||
#include "globalshortcuts/macglobalshortcutbackend.h"
|
#include "globalshortcuts/globalshortcutbackend-macos.h"
|
||||||
|
|
||||||
#ifdef HAVE_SPARKLE
|
#ifdef HAVE_SPARKLE
|
||||||
# import <Sparkle/SUUpdater.h>
|
# import <Sparkle/SUUpdater.h>
|
||||||
@ -80,11 +80,11 @@ QDebug operator<<(QDebug dbg, NSObject* object) {
|
|||||||
PlatformInterface* application_handler_;
|
PlatformInterface* application_handler_;
|
||||||
AppDelegate* delegate_;
|
AppDelegate* delegate_;
|
||||||
// shortcut_handler_ only used to temporarily save it AppDelegate does all the heavy-shortcut-lifting
|
// shortcut_handler_ only used to temporarily save it AppDelegate does all the heavy-shortcut-lifting
|
||||||
MacGlobalShortcutBackend* shortcut_handler_;
|
GlobalShortcutBackendMacOS* shortcut_handler_;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (MacGlobalShortcutBackend*)shortcut_handler;
|
- (GlobalShortcutBackendMacOS*)shortcut_handler;
|
||||||
- (void)SetShortcutHandler:(MacGlobalShortcutBackend*)handler;
|
- (void)SetShortcutHandler:(GlobalShortcutBackendMacOS*)handler;
|
||||||
|
|
||||||
- (PlatformInterface*)application_handler;
|
- (PlatformInterface*)application_handler;
|
||||||
- (void)SetApplicationHandler:(PlatformInterface*)handler;
|
- (void)SetApplicationHandler:(PlatformInterface*)handler;
|
||||||
@ -147,11 +147,11 @@ static BreakpadRef InitBreakpad() {
|
|||||||
return dock_menu_;
|
return dock_menu_;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setShortcutHandler:(MacGlobalShortcutBackend*)backend {
|
- (void)setShortcutHandler:(GlobalShortcutBackendMacOS*)backend {
|
||||||
shortcut_handler_ = backend;
|
shortcut_handler_ = backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (MacGlobalShortcutBackend*)shortcut_handler {
|
- (GlobalShortcutBackendMacOS*)shortcut_handler {
|
||||||
return shortcut_handler_;
|
return shortcut_handler_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,12 +227,12 @@ static BreakpadRef InitBreakpad() {
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (MacGlobalShortcutBackend*)shortcut_handler {
|
- (GlobalShortcutBackendMacOS*)shortcut_handler {
|
||||||
// should be the same as delegate_'s shortcut handler
|
// should be the same as delegate_'s shortcut handler
|
||||||
return shortcut_handler_;
|
return shortcut_handler_;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)SetShortcutHandler:(MacGlobalShortcutBackend*)handler {
|
- (void)SetShortcutHandler:(GlobalShortcutBackendMacOS*)handler {
|
||||||
shortcut_handler_ = handler;
|
shortcut_handler_ = handler;
|
||||||
if (delegate_) [delegate_ setShortcutHandler:handler];
|
if (delegate_) [delegate_ setShortcutHandler:handler];
|
||||||
}
|
}
|
||||||
@ -277,7 +277,7 @@ void MacMain() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetShortcutHandler(MacGlobalShortcutBackend* handler) {
|
void SetShortcutHandler(GlobalShortcutBackendMacOS* handler) {
|
||||||
[NSApp SetShortcutHandler:handler];
|
[NSApp SetShortcutHandler:handler];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
# include "ilister.h"
|
# include "ilister.h"
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_MACOS) and defined(HAVE_LIBMTP)
|
#if defined(Q_OS_MACOS) and defined(HAVE_LIBMTP)
|
||||||
# include "macdevicelister.h"
|
# include "macosdevicelister.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_LIBGPOD
|
#ifdef HAVE_LIBGPOD
|
||||||
# include "gpoddevice.h"
|
# include "gpoddevice.h"
|
||||||
@ -129,7 +129,7 @@ DeviceManager::DeviceManager(Application *app, QObject *parent)
|
|||||||
AddLister(new GioLister);
|
AddLister(new GioLister);
|
||||||
#endif
|
#endif
|
||||||
#if defined(Q_OS_MACOS) and defined(HAVE_LIBMTP)
|
#if defined(Q_OS_MACOS) and defined(HAVE_LIBMTP)
|
||||||
AddLister(new MacDeviceLister);
|
AddLister(new MacOsDeviceLister);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AddDeviceClass<FilesystemDevice>();
|
AddDeviceClass<FilesystemDevice>();
|
||||||
|
@ -18,11 +18,11 @@
|
|||||||
|
|
||||||
#include "devicelister.h"
|
#include "devicelister.h"
|
||||||
|
|
||||||
class MacDeviceLister : public DeviceLister {
|
class MacOsDeviceLister : public DeviceLister {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MacDeviceLister();
|
MacOsDeviceLister();
|
||||||
~MacDeviceLister();
|
~MacOsDeviceLister();
|
||||||
|
|
||||||
virtual QStringList DeviceUniqueIDs();
|
virtual QStringList DeviceUniqueIDs();
|
||||||
virtual QVariantList DeviceIcons(const QString &id);
|
virtual QVariantList DeviceIcons(const QString &id);
|
||||||
@ -57,7 +57,7 @@ class MacDeviceLister : public DeviceLister {
|
|||||||
virtual void ShutDown();
|
virtual void ShutDown();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void Init();
|
virtual bool Init();
|
||||||
|
|
||||||
static void DiskAddedCallback(DADiskRef disk, void* context);
|
static void DiskAddedCallback(DADiskRef disk, void* context);
|
||||||
static void DiskRemovedCallback(DADiskRef disk, void* context);
|
static void DiskRemovedCallback(DADiskRef disk, void* context);
|
||||||
@ -86,8 +86,8 @@ class MacDeviceLister : public DeviceLister {
|
|||||||
static QSet<MTPDevice> sMTPDeviceList;
|
static QSet<MTPDevice> sMTPDeviceList;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint qHash(const MacDeviceLister::MTPDevice& device);
|
uint qHash(const MacOsDeviceLister::MTPDevice& device);
|
||||||
inline bool operator==(const MacDeviceLister::MTPDevice& a, const MacDeviceLister::MTPDevice& b) {
|
inline bool operator==(const MacOsDeviceLister::MTPDevice& a, const MacOsDeviceLister::MTPDevice& b) {
|
||||||
return (a.vendor_id == b.vendor_id) && (a.product_id == b.product_id);
|
return (a.vendor_id == b.vendor_id) && (a.product_id == b.product_id);
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +38,7 @@
|
|||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "macdevicelister.h"
|
#include "macosdevicelister.h"
|
||||||
#include "mtpconnection.h"
|
#include "mtpconnection.h"
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/scoped_cftyperef.h"
|
#include "core/scoped_cftyperef.h"
|
||||||
@ -98,17 +98,17 @@ class ScopedIOObject {
|
|||||||
// Libgphoto2 MTP detection code:
|
// Libgphoto2 MTP detection code:
|
||||||
// http://www.sfr-fresh.com/unix/privat/libgphoto2-2.4.10.1.tar.gz:a/libgphoto2-2.4.10.1/libgphoto2_port/usb/check-mtp-device.c
|
// http://www.sfr-fresh.com/unix/privat/libgphoto2-2.4.10.1.tar.gz:a/libgphoto2-2.4.10.1/libgphoto2_port/usb/check-mtp-device.c
|
||||||
|
|
||||||
QSet<MacDeviceLister::MTPDevice> MacDeviceLister::sMTPDeviceList;
|
QSet<MacOsDeviceLister::MTPDevice> MacOsDeviceLister::sMTPDeviceList;
|
||||||
|
|
||||||
uint qHash(const MacDeviceLister::MTPDevice& d) {
|
uint qHash(const MacOsDeviceLister::MTPDevice& d) {
|
||||||
return qHash(d.vendor_id) ^ qHash(d.product_id);
|
return qHash(d.vendor_id) ^ qHash(d.product_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
MacDeviceLister::MacDeviceLister() {}
|
MacOsDeviceLister::MacOsDeviceLister() {}
|
||||||
|
|
||||||
MacDeviceLister::~MacDeviceLister() { CFRelease(loop_session_); }
|
MacOsDeviceLister::~MacOsDeviceLister() { CFRelease(loop_session_); }
|
||||||
|
|
||||||
void MacDeviceLister::Init() {
|
bool MacOsDeviceLister::Init() {
|
||||||
ScopedNSAutoreleasePool pool;
|
ScopedNSAutoreleasePool pool;
|
||||||
|
|
||||||
// Populate MTP Device list.
|
// Populate MTP Device list.
|
||||||
@ -187,9 +187,10 @@ void MacDeviceLister::Init() {
|
|||||||
CFRunLoopAddSource(run_loop_, io_source, kCFRunLoopDefaultMode);
|
CFRunLoopAddSource(run_loop_, io_source, kCFRunLoopDefaultMode);
|
||||||
|
|
||||||
CFRunLoopRun();
|
CFRunLoopRun();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacDeviceLister::ShutDown() { CFRunLoopStop(run_loop_); }
|
void MacOsDeviceLister::ShutDown() { CFRunLoopStop(run_loop_); }
|
||||||
|
|
||||||
// IOKit helpers.
|
// IOKit helpers.
|
||||||
namespace {
|
namespace {
|
||||||
@ -311,7 +312,7 @@ QString FindDeviceProperty(const QString& bsd_name, CFStringRef property) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 MacDeviceLister::GetFreeSpace(const QUrl& url) {
|
quint64 MacOsDeviceLister::GetFreeSpace(const QUrl& url) {
|
||||||
QMutexLocker l(&libmtp_mutex_);
|
QMutexLocker l(&libmtp_mutex_);
|
||||||
MtpConnection connection(url);
|
MtpConnection connection(url);
|
||||||
if (!connection.is_valid()) {
|
if (!connection.is_valid()) {
|
||||||
@ -327,7 +328,7 @@ quint64 MacDeviceLister::GetFreeSpace(const QUrl& url) {
|
|||||||
return free_bytes;
|
return free_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 MacDeviceLister::GetCapacity(const QUrl& url) {
|
quint64 MacOsDeviceLister::GetCapacity(const QUrl& url) {
|
||||||
QMutexLocker l(&libmtp_mutex_);
|
QMutexLocker l(&libmtp_mutex_);
|
||||||
MtpConnection connection(url);
|
MtpConnection connection(url);
|
||||||
if (!connection.is_valid()) {
|
if (!connection.is_valid()) {
|
||||||
@ -343,8 +344,8 @@ quint64 MacDeviceLister::GetCapacity(const QUrl& url) {
|
|||||||
return capacity_bytes;
|
return capacity_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacDeviceLister::DiskAddedCallback(DADiskRef disk, void* context) {
|
void MacOsDeviceLister::DiskAddedCallback(DADiskRef disk, void* context) {
|
||||||
MacDeviceLister* me = reinterpret_cast<MacDeviceLister*>(context);
|
MacOsDeviceLister* me = reinterpret_cast<MacOsDeviceLister*>(context);
|
||||||
|
|
||||||
scoped_nsobject<NSDictionary> properties((NSDictionary*)DADiskCopyDescription(disk));
|
scoped_nsobject<NSDictionary> properties((NSDictionary*)DADiskCopyDescription(disk));
|
||||||
|
|
||||||
@ -386,8 +387,8 @@ void MacDeviceLister::DiskAddedCallback(DADiskRef disk, void* context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacDeviceLister::DiskRemovedCallback(DADiskRef disk, void* context) {
|
void MacOsDeviceLister::DiskRemovedCallback(DADiskRef disk, void* context) {
|
||||||
MacDeviceLister* me = reinterpret_cast<MacDeviceLister*>(context);
|
MacOsDeviceLister* me = reinterpret_cast<MacOsDeviceLister*>(context);
|
||||||
// We cannot access the USB tree when the disk is removed but we still get
|
// We cannot access the USB tree when the disk is removed but we still get
|
||||||
// the BSD disk name.
|
// the BSD disk name.
|
||||||
|
|
||||||
@ -448,8 +449,8 @@ int GetBusNumber(io_object_t o) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) {
|
void MacOsDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) {
|
||||||
MacDeviceLister* me = reinterpret_cast<MacDeviceLister*>(refcon);
|
MacOsDeviceLister* me = reinterpret_cast<MacOsDeviceLister*>(refcon);
|
||||||
|
|
||||||
io_object_t object;
|
io_object_t object;
|
||||||
while ((object = IOIteratorNext(it))) {
|
while ((object = IOIteratorNext(it))) {
|
||||||
@ -585,8 +586,8 @@ void MacDeviceLister::USBDeviceAddedCallback(void* refcon, io_iterator_t it) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacDeviceLister::USBDeviceRemovedCallback(void* refcon, io_iterator_t it) {
|
void MacOsDeviceLister::USBDeviceRemovedCallback(void* refcon, io_iterator_t it) {
|
||||||
MacDeviceLister* me = reinterpret_cast<MacDeviceLister*>(refcon);
|
MacOsDeviceLister* me = reinterpret_cast<MacOsDeviceLister*>(refcon);
|
||||||
io_object_t object;
|
io_object_t object;
|
||||||
while ((object = IOIteratorNext(it))) {
|
while ((object = IOIteratorNext(it))) {
|
||||||
ScopedCFTypeRef<CFStringRef> class_name(IOObjectCopyClass(object));
|
ScopedCFTypeRef<CFStringRef> class_name(IOObjectCopyClass(object));
|
||||||
@ -611,7 +612,7 @@ void MacDeviceLister::USBDeviceRemovedCallback(void* refcon, io_iterator_t it) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacDeviceLister::RemovedMTPDevice(const QString& serial) {
|
void MacOsDeviceLister::RemovedMTPDevice(const QString& serial) {
|
||||||
int count = mtp_devices_.remove(serial);
|
int count = mtp_devices_.remove(serial);
|
||||||
if (count) {
|
if (count) {
|
||||||
qLog(Debug) << "MTP device removed:" << serial;
|
qLog(Debug) << "MTP device removed:" << serial;
|
||||||
@ -619,7 +620,7 @@ void MacDeviceLister::RemovedMTPDevice(const QString& serial) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacDeviceLister::FoundMTPDevice(const MTPDevice& device, const QString& serial) {
|
void MacOsDeviceLister::FoundMTPDevice(const MTPDevice& device, const QString& serial) {
|
||||||
qLog(Debug) << "New MTP device detected!" << device.bus << device.address;
|
qLog(Debug) << "New MTP device detected!" << device.bus << device.address;
|
||||||
mtp_devices_[serial] = device;
|
mtp_devices_[serial] = device;
|
||||||
QList<QUrl> urls = MakeDeviceUrls(serial);
|
QList<QUrl> urls = MakeDeviceUrls(serial);
|
||||||
@ -631,11 +632,11 @@ void MacDeviceLister::FoundMTPDevice(const MTPDevice& device, const QString& ser
|
|||||||
|
|
||||||
bool IsMTPSerial(const QString& serial) { return serial.startsWith("MTP"); }
|
bool IsMTPSerial(const QString& serial) { return serial.startsWith("MTP"); }
|
||||||
|
|
||||||
bool MacDeviceLister::IsCDDevice(const QString& serial) const {
|
bool MacOsDeviceLister::IsCDDevice(const QString& serial) const {
|
||||||
return cd_devices_.contains(serial);
|
return cd_devices_.contains(serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MacDeviceLister::MakeFriendlyName(const QString& serial) {
|
QString MacOsDeviceLister::MakeFriendlyName(const QString& serial) {
|
||||||
if (IsMTPSerial(serial)) {
|
if (IsMTPSerial(serial)) {
|
||||||
const MTPDevice& device = mtp_devices_[serial];
|
const MTPDevice& device = mtp_devices_[serial];
|
||||||
if (device.vendor.isEmpty()) {
|
if (device.vendor.isEmpty()) {
|
||||||
@ -668,7 +669,7 @@ QString MacDeviceLister::MakeFriendlyName(const QString& serial) {
|
|||||||
return vendor + " " + product;
|
return vendor + " " + product;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QUrl> MacDeviceLister::MakeDeviceUrls(const QString& serial) {
|
QList<QUrl> MacOsDeviceLister::MakeDeviceUrls(const QString& serial) {
|
||||||
if (IsMTPSerial(serial)) {
|
if (IsMTPSerial(serial)) {
|
||||||
const MTPDevice& device = mtp_devices_[serial];
|
const MTPDevice& device = mtp_devices_[serial];
|
||||||
QString str;
|
QString str;
|
||||||
@ -701,11 +702,11 @@ QList<QUrl> MacDeviceLister::MakeDeviceUrls(const QString& serial) {
|
|||||||
return QList<QUrl>() << ret;
|
return QList<QUrl>() << ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList MacDeviceLister::DeviceUniqueIDs() {
|
QStringList MacOsDeviceLister::DeviceUniqueIDs() {
|
||||||
return current_devices_.keys() + mtp_devices_.keys();
|
return current_devices_.keys() + mtp_devices_.keys();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantList MacDeviceLister::DeviceIcons(const QString& serial) {
|
QVariantList MacOsDeviceLister::DeviceIcons(const QString& serial) {
|
||||||
if (IsMTPSerial(serial)) {
|
if (IsMTPSerial(serial)) {
|
||||||
return QVariantList();
|
return QVariantList();
|
||||||
}
|
}
|
||||||
@ -735,21 +736,21 @@ QVariantList MacDeviceLister::DeviceIcons(const QString& serial) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MacDeviceLister::DeviceManufacturer(const QString& serial) {
|
QString MacOsDeviceLister::DeviceManufacturer(const QString& serial) {
|
||||||
if (IsMTPSerial(serial)) {
|
if (IsMTPSerial(serial)) {
|
||||||
return mtp_devices_[serial].vendor;
|
return mtp_devices_[serial].vendor;
|
||||||
}
|
}
|
||||||
return FindDeviceProperty(current_devices_[serial], CFSTR(kUSBVendorString));
|
return FindDeviceProperty(current_devices_[serial], CFSTR(kUSBVendorString));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString MacDeviceLister::DeviceModel(const QString& serial) {
|
QString MacOsDeviceLister::DeviceModel(const QString& serial) {
|
||||||
if (IsMTPSerial(serial)) {
|
if (IsMTPSerial(serial)) {
|
||||||
return mtp_devices_[serial].product;
|
return mtp_devices_[serial].product;
|
||||||
}
|
}
|
||||||
return FindDeviceProperty(current_devices_[serial], CFSTR(kUSBProductString));
|
return FindDeviceProperty(current_devices_[serial], CFSTR(kUSBProductString));
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 MacDeviceLister::DeviceCapacity(const QString& serial) {
|
quint64 MacOsDeviceLister::DeviceCapacity(const QString& serial) {
|
||||||
if (IsMTPSerial(serial)) {
|
if (IsMTPSerial(serial)) {
|
||||||
QList<QUrl> urls = MakeDeviceUrls(serial);
|
QList<QUrl> urls = MakeDeviceUrls(serial);
|
||||||
return mtp_devices_[serial].capacity;
|
return mtp_devices_[serial].capacity;
|
||||||
@ -769,7 +770,7 @@ quint64 MacDeviceLister::DeviceCapacity(const QString& serial) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
quint64 MacDeviceLister::DeviceFreeSpace(const QString& serial) {
|
quint64 MacOsDeviceLister::DeviceFreeSpace(const QString& serial) {
|
||||||
if (IsMTPSerial(serial)) {
|
if (IsMTPSerial(serial)) {
|
||||||
QList<QUrl> urls = MakeDeviceUrls(serial);
|
QList<QUrl> urls = MakeDeviceUrls(serial);
|
||||||
return mtp_devices_[serial].free_space;
|
return mtp_devices_[serial].free_space;
|
||||||
@ -789,13 +790,13 @@ quint64 MacDeviceLister::DeviceFreeSpace(const QString& serial) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap MacDeviceLister::DeviceHardwareInfo(const QString& serial){return QVariantMap();}
|
QVariantMap MacOsDeviceLister::DeviceHardwareInfo(const QString& serial){return QVariantMap();}
|
||||||
|
|
||||||
bool MacDeviceLister::AskForScan(const QString& serial) const {
|
bool MacOsDeviceLister::AskForScan(const QString& serial) const {
|
||||||
return !IsCDDevice(serial);
|
return !IsCDDevice(serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacDeviceLister::UnmountDevice(const QString& serial) {
|
void MacOsDeviceLister::UnmountDevice(const QString& serial) {
|
||||||
if (IsMTPSerial(serial)) return;
|
if (IsMTPSerial(serial)) return;
|
||||||
|
|
||||||
QString bsd_name = current_devices_[serial];
|
QString bsd_name = current_devices_[serial];
|
||||||
@ -804,7 +805,7 @@ void MacDeviceLister::UnmountDevice(const QString& serial) {
|
|||||||
DADiskUnmount(disk, kDADiskUnmountOptionDefault, &DiskUnmountCallback, this);
|
DADiskUnmount(disk, kDADiskUnmountOptionDefault, &DiskUnmountCallback, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacDeviceLister::DiskUnmountCallback(DADiskRef disk, DADissenterRef dissenter, void* context) {
|
void MacOsDeviceLister::DiskUnmountCallback(DADiskRef disk, DADissenterRef dissenter, void* context) {
|
||||||
if (dissenter) {
|
if (dissenter) {
|
||||||
qLog(Warning) << "Another app blocked the unmount";
|
qLog(Warning) << "Another app blocked the unmount";
|
||||||
}
|
}
|
||||||
@ -813,7 +814,7 @@ void MacDeviceLister::DiskUnmountCallback(DADiskRef disk, DADissenterRef dissent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacDeviceLister::UpdateDeviceFreeSpace(const QString& serial) {
|
void MacOsDeviceLister::UpdateDeviceFreeSpace(const QString& serial) {
|
||||||
if (IsMTPSerial(serial)) {
|
if (IsMTPSerial(serial)) {
|
||||||
if (mtp_devices_.contains(serial)) {
|
if (mtp_devices_.contains(serial)) {
|
||||||
QList<QUrl> urls = MakeDeviceUrls(serial);
|
QList<QUrl> urls = MakeDeviceUrls(serial);
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
class GlobalShortcut;
|
class GlobalShortcut;
|
||||||
|
|
||||||
class GlobalShortcutBackendPrivateMacOS;
|
class GlobalShortcutBackendMacOSPrivate;
|
||||||
|
|
||||||
class GlobalShortcutBackendMacOS : public GlobalShortcutBackend {
|
class GlobalShortcutBackendMacOS : public GlobalShortcutBackend {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -59,8 +59,8 @@ class GlobalShortcutBackendMacOS : public GlobalShortcutBackend {
|
|||||||
|
|
||||||
QMap<QKeySequence, QAction*> shortcuts_;
|
QMap<QKeySequence, QAction*> shortcuts_;
|
||||||
|
|
||||||
friend class GlobalShortcutBackendPrivateMacOS;
|
friend class GlobalShortcutBackendMacOSPrivate;
|
||||||
std::unique_ptr<GlobalShortcutBackendPrivateMacOS> p_;
|
std::unique_ptr<GlobalShortcutBackendMacOSPrivate> p_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GLOBALSHORTCUTBACKEND_MACOS_H
|
#endif // GLOBALSHORTCUTBACKEND_MACOS_H
|
||||||
|
@ -44,9 +44,9 @@
|
|||||||
#import "core/mac_utilities.h"
|
#import "core/mac_utilities.h"
|
||||||
#import "core/SBSystemPreferences.h"
|
#import "core/SBSystemPreferences.h"
|
||||||
|
|
||||||
class GlobalShortcutBackendPrivate_MacOS : boost::noncopyable {
|
class GlobalShortcutBackendMacOSPrivate : boost::noncopyable {
|
||||||
public:
|
public:
|
||||||
explicit GlobalShortcutBackendPrivate_MacOS(GlobalShortcutBackendMacOS* backend)
|
explicit GlobalShortcutBackendMacOSPrivate(GlobalShortcutBackendMacOS* backend)
|
||||||
: global_monitor_(nil), local_monitor_(nil), backend_(backend) {}
|
: global_monitor_(nil), local_monitor_(nil), backend_(backend) {}
|
||||||
|
|
||||||
bool Register() {
|
bool Register() {
|
||||||
@ -80,7 +80,7 @@ class GlobalShortcutBackendPrivate_MacOS : boost::noncopyable {
|
|||||||
|
|
||||||
GlobalShortcutBackendMacOS::GlobalShortcutBackendMacOS(GlobalShortcuts* parent)
|
GlobalShortcutBackendMacOS::GlobalShortcutBackendMacOS(GlobalShortcuts* parent)
|
||||||
: GlobalShortcutBackend(parent),
|
: GlobalShortcutBackend(parent),
|
||||||
p_(new GlobalShortcutBackendPrivate_MacOS(this)) {}
|
p_(new GlobalShortcutBackendMacOSPrivate(this)) {}
|
||||||
|
|
||||||
GlobalShortcutBackendMacOS::~GlobalShortcutBackendMacOS() {}
|
GlobalShortcutBackendMacOS::~GlobalShortcutBackendMacOS() {}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user