Add a WPD lister. Doesn't do anything yet, other than compile
This commit is contained in:
parent
a3b29406e6
commit
ec22230f3c
|
@ -47,6 +47,9 @@ pkg_check_modules(LIBMTP libmtp)
|
|||
|
||||
if (WIN32)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_library(PORTABLEDEVICEAPI_LIBRARIES PortableDeviceApi)
|
||||
find_library(PORTABLEDEVICEGUIDS_LIBRARIES PortableDeviceGuids)
|
||||
find_library(PORTABLEDEVICETYPES_LIBRARIES PortableDeviceTypes)
|
||||
endif (WIN32)
|
||||
|
||||
find_library(LASTFM_LIBRARIES lastfm)
|
||||
|
|
|
@ -534,6 +534,12 @@ if(LIBMTP_FOUND)
|
|||
list(APPEND HEADERS devices/mtploader.h)
|
||||
endif(LIBMTP_FOUND)
|
||||
|
||||
# Windows portable device lister
|
||||
IF(WIN32)
|
||||
list(APPEND SOURCES devices/wpdlister.cpp)
|
||||
list(APPEND HEADERS devices/wpdlister.h)
|
||||
ENDIF(WIN32)
|
||||
|
||||
# Mac specific startup stuff
|
||||
if(APPLE)
|
||||
list(APPEND SOURCES core/mac_startup.mm)
|
||||
|
@ -561,10 +567,14 @@ list(APPEND OTHER_SOURCES
|
|||
devices/ilister.h
|
||||
devices/imobiledeviceconnection.cpp
|
||||
devices/imobiledeviceconnection.h
|
||||
devices/mtpconnection.cpp
|
||||
devices/mtpconnection.h
|
||||
devices/mtpdevice.cpp
|
||||
devices/mtpdevice.h
|
||||
devices/mtploader.cpp
|
||||
devices/mtploader.h
|
||||
devices/wpdlister.cpp
|
||||
devices/wpdlister.h
|
||||
ui/macsystemtrayicon.h
|
||||
ui/macsystemtrayicon.mm
|
||||
widgets/osd_mac.mm
|
||||
|
@ -661,9 +671,11 @@ if(HAVE_STATIC_SQLITE)
|
|||
target_link_libraries(clementine_lib qsqlite)
|
||||
endif(HAVE_STATIC_SQLITE)
|
||||
|
||||
# Link against zlib on windows
|
||||
if (WIN32)
|
||||
target_link_libraries(clementine_lib ${ZLIB_LIBRARIES})
|
||||
target_link_libraries(clementine_lib ${PORTABLEDEVICEAPI_LIBRARIES})
|
||||
target_link_libraries(clementine_lib ${PORTABLEDEVICEGUIDS_LIBRARIES})
|
||||
target_link_libraries(clementine_lib ${PORTABLEDEVICETYPES_LIBRARIES})
|
||||
endif (WIN32)
|
||||
|
||||
add_dependencies(clementine_lib qtsingleapplication)
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
#ifdef Q_OS_DARWIN
|
||||
# include "macdevicelister.h"
|
||||
#endif
|
||||
#ifdef Q_OS_WIN32
|
||||
# include "wpdlister.h"
|
||||
#endif
|
||||
#ifdef HAVE_LIBGPOD
|
||||
# include "gpoddevice.h"
|
||||
#endif
|
||||
|
@ -166,6 +169,9 @@ DeviceManager::DeviceManager(BackgroundThread<Database>* database,
|
|||
#ifdef Q_OS_DARWIN
|
||||
AddLister(new MacDeviceLister);
|
||||
#endif
|
||||
#ifdef Q_OS_WIN32
|
||||
AddLister(new WpdLister);
|
||||
#endif
|
||||
#ifdef HAVE_IMOBILEDEVICE
|
||||
AddLister(new iLister);
|
||||
AddDeviceClass<AfcDevice>();
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/* This file is part of Clementine.
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "wpdlister.h"
|
||||
|
||||
// Vista, for the property system
|
||||
#define WINVER 0x0501
|
||||
|
||||
#include <objbase.h>
|
||||
|
||||
// I have no idea where these are meant to be defined...
|
||||
typedef struct _tagpropertykey {
|
||||
GUID fmtid;
|
||||
DWORD pid;
|
||||
} PROPERTYKEY;
|
||||
typedef const PROPERTYKEY& REFPROPERTYKEY;
|
||||
|
||||
#include <PortableDeviceApi.h>
|
||||
|
||||
#include <QStringList>
|
||||
#include <QtDebug>
|
||||
|
||||
WpdLister::WpdLister() {
|
||||
}
|
||||
|
||||
void WpdLister::Init() {
|
||||
qDebug() << "Creating IPortableDeviceManager";
|
||||
|
||||
qDebug() << "CoInitialize says" << CoInitialize(0);
|
||||
|
||||
IPortableDeviceManager* manager = NULL;
|
||||
HRESULT ret = CoCreateInstance(
|
||||
CLSID_PortableDeviceManager, NULL, CLSCTX_INPROC_SERVER,
|
||||
IID_IPortableDeviceManager, (void**)&manager);
|
||||
qDebug() << "Created" << ret << manager;
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
||||
QStringList WpdLister::DeviceUniqueIDs() {
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QStringList WpdLister::DeviceIcons(const QString& id) {
|
||||
return QStringList();
|
||||
}
|
||||
|
||||
QString WpdLister::DeviceManufacturer(const QString& id) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString WpdLister::DeviceModel(const QString& id) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
quint64 WpdLister::DeviceCapacity(const QString& id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
quint64 WpdLister::DeviceFreeSpace(const QString& id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
QVariantMap WpdLister::DeviceHardwareInfo(const QString& id) {
|
||||
return QVariantMap();
|
||||
}
|
||||
|
||||
QString WpdLister::MakeFriendlyName(const QString& id) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
QList<QUrl> WpdLister::MakeDeviceUrls(const QString& id) {
|
||||
return QList<QUrl>();
|
||||
}
|
||||
|
||||
void WpdLister::UnmountDevice(const QString& id) {
|
||||
}
|
||||
|
||||
void WpdLister::UpdateDeviceFreeSpace(const QString& id) {
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/* This file is part of Clementine.
|
||||
|
||||
Clementine 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Clementine is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef WPDLISTER_H
|
||||
#define WPDLISTER_H
|
||||
|
||||
#include "devicelister.h"
|
||||
|
||||
class WpdLister : public DeviceLister {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
WpdLister();
|
||||
|
||||
virtual void Init();
|
||||
|
||||
virtual QStringList DeviceUniqueIDs();
|
||||
virtual QStringList DeviceIcons(const QString& id);
|
||||
virtual QString DeviceManufacturer(const QString& id);
|
||||
virtual QString DeviceModel(const QString& id);
|
||||
virtual quint64 DeviceCapacity(const QString& id);
|
||||
virtual quint64 DeviceFreeSpace(const QString& id);
|
||||
virtual QVariantMap DeviceHardwareInfo(const QString& id);
|
||||
virtual QString MakeFriendlyName(const QString& id);
|
||||
virtual QList<QUrl> MakeDeviceUrls(const QString& id);
|
||||
virtual void UnmountDevice(const QString& id);
|
||||
|
||||
public slots:
|
||||
virtual void UpdateDeviceFreeSpace(const QString& id);
|
||||
|
||||
};
|
||||
|
||||
#endif // WPDLISTER_H
|
Loading…
Reference in New Issue