Includes, comments and bugfixes
- Fix includes - Use common regex (Song::kCoverRemoveDisc) for removing Disc/CD from album - Remove Disc/CD from album when creating hash - Make imobiledevice support compile - Fix setting device on windows
This commit is contained in:
@@ -20,16 +20,20 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QThread>
|
||||
#include <QFile>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/application.h"
|
||||
#include "core/utilities.h"
|
||||
#include "afcdevice.h"
|
||||
#include "afcfile.h"
|
||||
#include "afctransfer.h"
|
||||
#include "devicemanager.h"
|
||||
#include "gpodloader.h"
|
||||
#include "imobiledeviceconnection.h"
|
||||
#include "core/application.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#include <QThread>
|
||||
|
||||
AfcDevice::AfcDevice(const QUrl &url, DeviceLister* lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
|
||||
: GPodDevice(url, lister, unique_id, manager, app, database_id, first_time), transfer_(NULL)
|
||||
@@ -42,8 +46,7 @@ AfcDevice::~AfcDevice() {
|
||||
|
||||
void AfcDevice::Init() {
|
||||
|
||||
// Make a new temporary directory for the iTunesDB. We copy it off the iPod
|
||||
// so that libgpod can have a local directory to use.
|
||||
// Make a new temporary directory for the iTunesDB. We copy it off the iPod so that libgpod can have a local directory to use.
|
||||
local_path_ = Utilities::MakeTempDir();
|
||||
InitBackendDirectory(local_path_, first_time_, false);
|
||||
model_->Init();
|
||||
@@ -69,10 +72,9 @@ void AfcDevice::CopyFinished(bool success) {
|
||||
}
|
||||
|
||||
// Now load the songs from the local database
|
||||
loader_ = new GPodLoader(local_path_, app_->task_manager(), backend_,
|
||||
shared_from_this());
|
||||
loader_ = new GPodLoader(local_path_, app_->task_manager(), backend_, shared_from_this());
|
||||
loader_->set_music_path_prefix("afc://" + url_.host());
|
||||
loader_->set_song_type(Song::Type_Stream);
|
||||
//loader_->set_song_type(Song::Type_Stream);
|
||||
loader_->moveToThread(loader_thread_);
|
||||
|
||||
connect(loader_, SIGNAL(Error(QString)), SIGNAL(Error(QString)));
|
||||
|
||||
@@ -23,17 +23,18 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gpoddevice.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <gpod/itdb.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
|
||||
#include "gpoddevice.h"
|
||||
|
||||
class AfcTransfer;
|
||||
class GPodLoader;
|
||||
class iMobileDeviceConnection;
|
||||
|
||||
class AfcDevice : public GPodDevice {
|
||||
@@ -64,7 +65,7 @@ private:
|
||||
|
||||
private:
|
||||
AfcTransfer *transfer_;
|
||||
boost::scoped_ptr<iMobileDeviceConnection> connection_;
|
||||
std::shared_ptr<iMobileDeviceConnection> connection_;
|
||||
|
||||
QString local_path_;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <libimobiledevice/afc.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QIODevice>
|
||||
#include <QString>
|
||||
|
||||
#include "afcfile.h"
|
||||
#include "imobiledeviceconnection.h"
|
||||
|
||||
#include <libimobiledevice/afc.h>
|
||||
|
||||
AfcFile::AfcFile(iMobileDeviceConnection *connection, const QString &path, QObject *parent)
|
||||
: QIODevice(parent),
|
||||
connection_(connection),
|
||||
@@ -34,8 +39,7 @@ bool AfcFile::open(QIODevice::OpenMode mode) {
|
||||
default:
|
||||
afc_mode = AFC_FOPEN_RW;
|
||||
}
|
||||
afc_error_t err = afc_file_open(
|
||||
connection_->afc(), path_.toUtf8().constData(), afc_mode, &handle_);
|
||||
afc_error_t err = afc_file_open(connection_->afc(), path_.toUtf8().constData(), afc_mode, &handle_);
|
||||
if (err != AFC_E_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <QIODevice>
|
||||
|
||||
#include <libimobiledevice/afc.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QIODevice>
|
||||
#include <QString>
|
||||
|
||||
class iMobileDeviceConnection;
|
||||
|
||||
class AfcFile : public QIODevice {
|
||||
|
||||
@@ -20,26 +20,29 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QString>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "core/utilities.h"
|
||||
#include "core/taskmanager.h"
|
||||
#include "afcfile.h"
|
||||
#include "afctransfer.h"
|
||||
#include "imobiledeviceconnection.h"
|
||||
#include "core/taskmanager.h"
|
||||
#include "core/utilities.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QtDebug>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
AfcTransfer::AfcTransfer(const QString &uuid, const QString &local_destination, TaskManager *task_manager, boost::shared_ptr<ConnectedDevice> device)
|
||||
: QObject(NULL), device_(device), task_manager_(task_manager), uuid_(uuid), local_destination_(local_destination)
|
||||
{
|
||||
AfcTransfer::AfcTransfer(const QString &uuid, const QString &local_destination, TaskManager *task_manager, std::shared_ptr<ConnectedDevice> device)
|
||||
: QObject(nullptr), device_(device), task_manager_(task_manager), uuid_(uuid), local_destination_(local_destination) {
|
||||
|
||||
original_thread_ = thread();
|
||||
|
||||
important_directories_ << "/iTunes_Control/Artwork";
|
||||
important_directories_ << "/iTunes_Control/Device";
|
||||
important_directories_ << "/iTunes_Control/iTunes";
|
||||
|
||||
}
|
||||
|
||||
AfcTransfer::~AfcTransfer() {
|
||||
|
||||
@@ -23,22 +23,23 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QIODevice>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
|
||||
class TaskManager;
|
||||
class ConnectedDevice;
|
||||
class iMobileDeviceConnection;
|
||||
class TaskManager;
|
||||
|
||||
class QIODevice;
|
||||
|
||||
class AfcTransfer : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AfcTransfer(const QString &uuid, const QString &local_destination, TaskManager *task_manager, boost::shared_ptr<ConnectedDevice> device);
|
||||
AfcTransfer(const QString &uuid, const QString &local_destination, TaskManager *task_manager, std::shared_ptr<ConnectedDevice> device);
|
||||
~AfcTransfer();
|
||||
|
||||
bool CopyToDevice(iMobileDeviceConnection *connection);
|
||||
@@ -57,14 +58,14 @@ private:
|
||||
bool CopyFileToDevice(iMobileDeviceConnection *c, const QString &path);
|
||||
|
||||
private:
|
||||
boost::shared_ptr<ConnectedDevice> device_;
|
||||
QThread *original_thread_;
|
||||
|
||||
std::shared_ptr<ConnectedDevice> device_;
|
||||
TaskManager *task_manager_;
|
||||
QString uuid_;
|
||||
QString local_destination_;
|
||||
|
||||
QStringList important_directories_;
|
||||
|
||||
};
|
||||
|
||||
#endif // AFCTRANSFER_H
|
||||
|
||||
@@ -20,15 +20,18 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QMutexLocker>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/logging.h"
|
||||
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "collection/collectionmodel.h"
|
||||
|
||||
#include "cddasongloader.h"
|
||||
#include "connecteddevice.h"
|
||||
#include "cddadevice.h"
|
||||
|
||||
class Application;
|
||||
class DeviceLister;
|
||||
class DeviceManager;
|
||||
|
||||
CddaDevice::CddaDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
|
||||
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time), cdda_song_loader_(url) {
|
||||
|
||||
|
||||
@@ -23,16 +23,25 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
|
||||
// These must come after Qt includes
|
||||
#include <cdio/cdio.h>
|
||||
#include <gst/audio/gstaudiocdsrc.h>
|
||||
|
||||
#include "core/song.h"
|
||||
#include "core/musicstorage.h"
|
||||
#include "cddasongloader.h"
|
||||
#include "connecteddevice.h"
|
||||
#include "core/song.h"
|
||||
#include "musicbrainz/musicbrainzclient.h"
|
||||
|
||||
class Application;
|
||||
class DeviceLister;
|
||||
class DeviceManager;
|
||||
|
||||
class CddaDevice : public ConnectedDevice {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -18,19 +18,24 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QFileInfo>
|
||||
#include <QMutex>
|
||||
#include <QThread>
|
||||
#include <QWaitCondition>
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QStringList>
|
||||
#include <QRegExp>
|
||||
#include <QUrl>
|
||||
|
||||
// This must come after Qt includes
|
||||
#include <cdio/cdio.h>
|
||||
#include <cdio/device.h>
|
||||
|
||||
#include "cddalister.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/song.h"
|
||||
|
||||
QStringList CddaLister::DeviceUniqueIDs() { return devices_list_; }
|
||||
|
||||
|
||||
@@ -21,9 +21,17 @@
|
||||
#ifndef CDDALISTER_H
|
||||
#define CDDALISTER_H
|
||||
|
||||
#include "config.h"
|
||||
#include <config.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QMetaType>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
|
||||
#include "devicelister.h"
|
||||
|
||||
|
||||
@@ -20,11 +20,24 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <glib.h>
|
||||
#include <glib/gtypes.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
#include <cdio/cdio.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/tag/tag.h>
|
||||
|
||||
#include "cddasongloader.h"
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "core/timeconstants.h"
|
||||
|
||||
|
||||
@@ -23,19 +23,23 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
// These must come after Qt includes (issue 3247)
|
||||
// These must come after Qt includes
|
||||
#include <cdio/types.h>
|
||||
#include <cdio/cdio.h>
|
||||
#include <gst/gstelement.h>
|
||||
#include <gst/audio/gstaudiocdsrc.h>
|
||||
|
||||
#include "core/song.h"
|
||||
#include "musicbrainz/musicbrainzclient.h"
|
||||
|
||||
// This class provides a (hopefully) nice, high level interface to get CD
|
||||
// information and load tracks
|
||||
// This class provides a (hopefully) nice, high level interface to get CD information and load tracks
|
||||
class CddaSongLoader : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -46,8 +50,7 @@ class CddaSongLoader : public QObject {
|
||||
QObject *parent = nullptr);
|
||||
~CddaSongLoader();
|
||||
|
||||
// Load songs.
|
||||
// Signals declared below will be emitted anytime new information will be available.
|
||||
// Load songs. Signals declared below will be emitted anytime new information will be available.
|
||||
void LoadSongs();
|
||||
bool HasChanged();
|
||||
|
||||
|
||||
@@ -18,19 +18,22 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <QObject>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "core/application.h"
|
||||
#include "core/database.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "collection/collectionmodel.h"
|
||||
#include "collection/directory.h"
|
||||
#include "connecteddevice.h"
|
||||
#include "devicelister.h"
|
||||
#include "devicemanager.h"
|
||||
#include "core/application.h"
|
||||
#include "core/database.h"
|
||||
#include "core/logging.h"
|
||||
#include "collection/collection.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "collection/collectionmodel.h"
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
ConnectedDevice::ConnectedDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
|
||||
: QObject(manager),
|
||||
@@ -73,10 +76,10 @@ void ConnectedDevice::InitBackendDirectory(const QString &mount_point, bool firs
|
||||
}
|
||||
else {
|
||||
if (rewrite_path) {
|
||||
// This is a bit of a hack. The device might not be mounted at the same
|
||||
// path each time, so if it's different we have to munge all the paths in
|
||||
// the database to fix it. This can be done entirely in sqlite so it's
|
||||
// relatively fast...
|
||||
// This is a bit of a hack.
|
||||
// The device might not be mounted at the same path each time,
|
||||
// so if it's different we have to munge all the paths in the database to fix it.
|
||||
// This can be done entirely in sqlite so it's relatively fast...
|
||||
|
||||
// Get the directory it was mounted at last time. Devices only have one directory (the root).
|
||||
Directory dir = backend_->GetAllDirectories()[0];
|
||||
|
||||
@@ -24,20 +24,20 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/musicstorage.h"
|
||||
#include "core/song.h"
|
||||
|
||||
class Application;
|
||||
class Database;
|
||||
class DeviceLister;
|
||||
class DeviceManager;
|
||||
class CollectionBackend;
|
||||
class CollectionModel;
|
||||
class DeviceLister;
|
||||
class DeviceManager;
|
||||
|
||||
class ConnectedDevice : public QObject,
|
||||
public virtual MusicStorage,
|
||||
@@ -49,8 +49,8 @@ class ConnectedDevice : public QObject,
|
||||
~ConnectedDevice();
|
||||
|
||||
virtual void Init() = 0;
|
||||
// For some devices (e.g. CD devices) we don't have callbacks to be notified
|
||||
// when something change: we can call this method to refresh device's state
|
||||
// For some devices (e.g. CD devices) we don't have callbacks to be notified when something change:
|
||||
// we can call this method to refresh device's state
|
||||
virtual void Refresh() {}
|
||||
|
||||
virtual TranscodeMode GetTranscodeMode() const;
|
||||
|
||||
@@ -18,15 +18,21 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QIODevice>
|
||||
#include <QFile>
|
||||
#include <QByteArray>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QSqlDatabase>
|
||||
#include <QSqlQuery>
|
||||
|
||||
#include "devicedatabasebackend.h"
|
||||
#include "core/database.h"
|
||||
#include "core/scopedtransaction.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QSqlQuery>
|
||||
#include <QVariant>
|
||||
#include "devicedatabasebackend.h"
|
||||
|
||||
const int DeviceDatabaseBackend::kDeviceSchemaVersion = 0;
|
||||
|
||||
|
||||
@@ -23,10 +23,15 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
#include "core/musicstorage.h"
|
||||
#include "core/song.h"
|
||||
#include "core/musicstorage.h"
|
||||
|
||||
class Database;
|
||||
|
||||
|
||||
@@ -18,22 +18,27 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "devicekitlister.h"
|
||||
#include "filesystemdevice.h"
|
||||
#include <QMutex>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringBuilder>
|
||||
#include <QUrl>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusPendingReply>
|
||||
#include <QDBusObjectPath>
|
||||
#include <QDBusError>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
#include "dbus/udisks.h"
|
||||
#include "dbus/udisksdevice.h"
|
||||
|
||||
#ifdef HAVE_LIBGPOD
|
||||
#include "gpoddevice.h"
|
||||
#endif
|
||||
#include "devicekitlister.h"
|
||||
|
||||
DeviceKitLister::DeviceKitLister() {}
|
||||
DeviceKitLister::~DeviceKitLister() {}
|
||||
|
||||
@@ -24,14 +24,25 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#ifdef HAVE_DBUS
|
||||
# include <QDBusObjectPath>
|
||||
#endif
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "devicelister.h"
|
||||
|
||||
class OrgFreedesktopUDisksInterface;
|
||||
|
||||
class QDBusObjectPath;
|
||||
|
||||
class DeviceKitLister : public DeviceLister {
|
||||
|
||||
@@ -20,18 +20,21 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_LIBGPOD
|
||||
# include <gpod/itdb.h>
|
||||
#endif
|
||||
|
||||
#include <QThread>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QThread>
|
||||
#include <QtDebug>
|
||||
#include <QStringBuilder>
|
||||
#include <QUrl>
|
||||
|
||||
#include "devicelister.h"
|
||||
|
||||
#ifdef HAVE_LIBGPOD
|
||||
#include <gpod/itdb.h>
|
||||
#endif
|
||||
|
||||
DeviceLister::DeviceLister() : thread_(nullptr) {}
|
||||
|
||||
DeviceLister::~DeviceLister() {
|
||||
|
||||
@@ -23,11 +23,16 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QUrl>
|
||||
#include <stdbool.h>
|
||||
|
||||
class ConnectedDevice;
|
||||
class DeviceManager;
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QList>
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
|
||||
class DeviceLister : public QObject {
|
||||
Q_OBJECT
|
||||
@@ -36,12 +41,10 @@ class DeviceLister : public QObject {
|
||||
DeviceLister();
|
||||
virtual ~DeviceLister();
|
||||
|
||||
// Tries to start the thread and initialise the engine. This object will be
|
||||
// moved to the new thread.
|
||||
// Tries to start the thread and initialise the engine. This object will be moved to the new thread.
|
||||
void Start();
|
||||
|
||||
// If two listers know about the same device, then the metadata will get
|
||||
// taken from the one with the highest priority.
|
||||
// If two listers know about the same device, then the metadata will get taken from the one with the highest priority.
|
||||
virtual int priority() const { return 100; }
|
||||
|
||||
// Query information about the devices that are available. Must be thread-safe.
|
||||
@@ -87,7 +90,7 @@ signals:
|
||||
QStringList GuessIconForModel(const QString &vendor, const QString &model);
|
||||
|
||||
protected:
|
||||
QThread* thread_;
|
||||
QThread *thread_;
|
||||
int next_mount_request_id_;
|
||||
|
||||
private slots:
|
||||
|
||||
@@ -21,54 +21,71 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QObject>
|
||||
#include <QMetaObject>
|
||||
#include <QThread>
|
||||
#include <QAbstractListModel>
|
||||
#include <QPersistentModelIndex>
|
||||
#include <QModelIndex>
|
||||
#include <QDir>
|
||||
#include <QIcon>
|
||||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
#include <QPushButton>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QStringBuilder>
|
||||
#include <QUrl>
|
||||
#include <QPixmap>
|
||||
#include <QIcon>
|
||||
#include <QPainter>
|
||||
#include <QJsonArray>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "devicemanager.h"
|
||||
|
||||
#include "devicedatabasebackend.h"
|
||||
#include "devicekitlister.h"
|
||||
#include "devicestatefiltermodel.h"
|
||||
#include "filesystemdevice.h"
|
||||
#include "core/application.h"
|
||||
#include "core/concurrentrun.h"
|
||||
#include "core/database.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/musicstorage.h"
|
||||
#include "core/taskmanager.h"
|
||||
#include "core/utilities.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "filesystemdevice.h"
|
||||
#include "connecteddevice.h"
|
||||
#include "devicelister.h"
|
||||
#include "devicedatabasebackend.h"
|
||||
#include "devicekitlister.h"
|
||||
#include "devicestatefiltermodel.h"
|
||||
|
||||
#if defined(HAVE_AUDIOCD) && defined(HAVE_GSTREAMER)
|
||||
#include "cddalister.h"
|
||||
#include "cddadevice.h"
|
||||
# include "cddalister.h"
|
||||
# include "cddadevice.h"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_DARWIN) and defined(HAVE_LIBMTP)
|
||||
#include "macdevicelister.h"
|
||||
# include "macdevicelister.h"
|
||||
#endif
|
||||
#ifdef HAVE_LIBGPOD
|
||||
#include "gpoddevice.h"
|
||||
# include "gpoddevice.h"
|
||||
#endif
|
||||
#ifdef HAVE_GIO
|
||||
#include "giolister.h"
|
||||
# include "giolister.h"
|
||||
#endif
|
||||
#ifdef HAVE_IMOBILEDEVICE
|
||||
# include "afcdevice.h"
|
||||
# include "ilister.h"
|
||||
#endif
|
||||
#ifdef HAVE_LIBMTP
|
||||
#include "mtpdevice.h"
|
||||
# include "mtpdevice.h"
|
||||
#endif
|
||||
#ifdef HAVE_UDISKS2
|
||||
#include "udisks2lister.h"
|
||||
# include "udisks2lister.h"
|
||||
#endif
|
||||
|
||||
using std::bind;
|
||||
@@ -195,8 +212,7 @@ DeviceManager::DeviceManager(Application *app, QObject *parent)
|
||||
backend_->moveToThread(app_->database()->thread());
|
||||
backend_->Init(app_->database());
|
||||
|
||||
// This reads from the database and contends on the database mutex, which can
|
||||
// be very slow on startup.
|
||||
// This reads from the database and contends on the database mutex, which can be very slow on startup.
|
||||
ConcurrentRun::Run<void>(&thread_pool_, bind(&DeviceManager::LoadAllDevices, this));
|
||||
|
||||
// This proxy model only shows connected devices
|
||||
@@ -445,8 +461,7 @@ void DeviceManager::PhysicalDeviceAdded(const QString &id) {
|
||||
DeviceInfo &info = devices_[i];
|
||||
info.backends_ << DeviceInfo::Backend(lister, id);
|
||||
|
||||
// If the user hasn't saved the device in the DB yet then overwrite the
|
||||
// device's name and icon etc.
|
||||
// If the user hasn't saved the device in the DB yet then overwrite the device's name and icon etc.
|
||||
if (info.database_id_ == -1 && info.BestBackend()->lister_ == lister) {
|
||||
info.friendly_name_ = lister->MakeFriendlyName(id);
|
||||
info.size_ = lister->DeviceCapacity(id);
|
||||
@@ -578,9 +593,8 @@ std::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) {
|
||||
break;
|
||||
}
|
||||
|
||||
// If we get here it means that this URL scheme wasn't supported. If it
|
||||
// was "ipod" or "mtp" then the user compiled out support and the device
|
||||
// won't work properly.
|
||||
// If we get here it means that this URL scheme wasn't supported.
|
||||
// If it was "ipod" or "mtp" then the user compiled out support and the device won't work properly.
|
||||
if (url.scheme() == "mtp" || url.scheme() == "gphoto2") {
|
||||
if (QMessageBox::critical(nullptr, tr("This device will not work properly"),
|
||||
tr("This is an MTP device, but you compiled Strawberry without libmtp support.") + " " +
|
||||
@@ -636,8 +650,7 @@ std::shared_ptr<ConnectedDevice> DeviceManager::Connect(int row) {
|
||||
|
||||
}
|
||||
|
||||
std::shared_ptr<ConnectedDevice> DeviceManager::GetConnectedDevice(int row)
|
||||
const {
|
||||
std::shared_ptr<ConnectedDevice> DeviceManager::GetConnectedDevice(int row) const {
|
||||
return devices_[row].device_;
|
||||
}
|
||||
|
||||
@@ -686,8 +699,7 @@ void DeviceManager::Forget(int row) {
|
||||
endRemoveRows();
|
||||
}
|
||||
else {
|
||||
// It's still attached, set the name and icon back to what they were
|
||||
// originally
|
||||
// It's still attached, set the name and icon back to what they were originally
|
||||
const QString id = info.BestBackend()->unique_id_;
|
||||
|
||||
info.friendly_name_ = info.BestBackend()->lister_->MakeFriendlyName(id);
|
||||
|
||||
@@ -25,20 +25,31 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QIcon>
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QMetaObject>
|
||||
#include <QThreadPool>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QAbstractListModel>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMultiMap>
|
||||
#include <QMetaType>
|
||||
#include <QVariant>
|
||||
#include <QUrl>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QIcon>
|
||||
|
||||
#include "devicedatabasebackend.h"
|
||||
|
||||
#include "core/song.h"
|
||||
#include "core/musicstorage.h"
|
||||
#include "collection/collectionmodel.h"
|
||||
#include "devicedatabasebackend.h"
|
||||
|
||||
class Application;
|
||||
class ConnectedDevice;
|
||||
class Database;
|
||||
class DeviceLister;
|
||||
class DeviceStateFilterModel;
|
||||
class TaskManager;
|
||||
|
||||
class DeviceManager : public QAbstractListModel {
|
||||
Q_OBJECT
|
||||
@@ -124,8 +135,7 @@ signals:
|
||||
DeviceInfo();
|
||||
|
||||
// A device can be discovered in different ways (devicekit, gio, etc.)
|
||||
// Sometimes the same device is discovered more than once. In this case
|
||||
// the device will have multiple "backends".
|
||||
// Sometimes the same device is discovered more than once. In this case the device will have multiple "backends".
|
||||
struct Backend {
|
||||
Backend(DeviceLister *lister = nullptr, const QString &id = QString())
|
||||
: lister_(lister), unique_id_(id) {}
|
||||
|
||||
@@ -20,22 +20,45 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "deviceproperties.h"
|
||||
#include "ui_deviceproperties.h"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include <QFutureWatcher>
|
||||
#include <QScrollBar>
|
||||
#include <QtGlobal>
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QModelIndex>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QFuture>
|
||||
#include <QMetaType>
|
||||
#include <QMap>
|
||||
#include <QSize>
|
||||
#include <QByteArray>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QJsonObject>
|
||||
#include <QComboBox>
|
||||
#include <QGroupBox>
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
#include <QRadioButton>
|
||||
#include <QScrollBar>
|
||||
#include <QListWidget>
|
||||
#include <QListWidgetItem>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QStackedWidget>
|
||||
#include <QTableWidget>
|
||||
|
||||
#include "core/closure.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "core/musicstorage.h"
|
||||
#include "widgets/freespacebar.h"
|
||||
#include "connecteddevice.h"
|
||||
#include "devicelister.h"
|
||||
#include "devicemanager.h"
|
||||
#include "core/utilities.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "deviceproperties.h"
|
||||
#include "transcoder/transcoder.h"
|
||||
#include "ui_deviceproperties.h"
|
||||
|
||||
DeviceProperties::DeviceProperties(QWidget *parent)
|
||||
: QDialog(parent),
|
||||
@@ -182,12 +205,10 @@ void DeviceProperties::UpdateFormats() {
|
||||
|
||||
QString id = index_.data(DeviceManager::Role_UniqueId).toString();
|
||||
DeviceLister *lister = manager_->GetLister(index_.row());
|
||||
std::shared_ptr<ConnectedDevice> device =
|
||||
manager_->GetConnectedDevice(index_.row());
|
||||
std::shared_ptr<ConnectedDevice> device = manager_->GetConnectedDevice(index_.row());
|
||||
|
||||
// Transcode mode
|
||||
MusicStorage::TranscodeMode mode = MusicStorage::TranscodeMode(
|
||||
index_.data(DeviceManager::Role_TranscodeMode).toInt());
|
||||
MusicStorage::TranscodeMode mode = MusicStorage::TranscodeMode(index_.data(DeviceManager::Role_TranscodeMode).toInt());
|
||||
switch (mode) {
|
||||
case MusicStorage::Transcode_Always:
|
||||
ui_->transcode_all->setChecked(true);
|
||||
@@ -288,8 +309,8 @@ void DeviceProperties::UpdateFormatsFinished(QFuture<bool> future) {
|
||||
// Set the format combobox item
|
||||
TranscoderPreset preset = Transcoder::PresetForFileType(Song::FileType(index_.data(DeviceManager::Role_TranscodeFormat).toInt()));
|
||||
if (preset.type_ == Song::Type_Unknown) {
|
||||
// The user hasn't chosen a format for this device yet, so work our way down
|
||||
// a list of some preferred formats, picking the first one that is supported
|
||||
// The user hasn't chosen a format for this device yet,
|
||||
// so work our way down a list of some preferred formats, picking the first one that is supported
|
||||
preset = Transcoder::PresetForFileType(Transcoder::PickBestFormat(supported_formats_));
|
||||
}
|
||||
ui_->transcode_format->setCurrentIndex(ui_->transcode_format->findText(preset.name_));
|
||||
|
||||
@@ -23,9 +23,16 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QDialog>
|
||||
#include <QWidget>
|
||||
#include <QFuture>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QPersistentModelIndex>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
#include "core/song.h"
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QVariant>
|
||||
|
||||
#include "devicemanager.h"
|
||||
#include "devicestatefiltermodel.h"
|
||||
|
||||
DeviceStateFilterModel::DeviceStateFilterModel(QObject *parent, DeviceManager::State state)
|
||||
@@ -39,7 +45,7 @@ void DeviceStateFilterModel::ProxyRowCountChanged() {
|
||||
emit IsEmptyChanged(rowCount() == 0);
|
||||
}
|
||||
|
||||
void DeviceStateFilterModel::setSourceModel(QAbstractItemModel* sourceModel) {
|
||||
void DeviceStateFilterModel::setSourceModel(QAbstractItemModel *sourceModel) {
|
||||
QSortFilterProxyModel::setSourceModel(sourceModel);
|
||||
setDynamicSortFilter(true);
|
||||
setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
|
||||
@@ -23,7 +23,13 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "devicemanager.h"
|
||||
|
||||
|
||||
@@ -22,30 +22,50 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QApplication>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
#include <QPushButton>
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QAbstractItemView>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QMimeData>
|
||||
#include <QAction>
|
||||
#include <QVariant>
|
||||
#include <QUrl>
|
||||
#include <QFont>
|
||||
#include <QFontMetrics>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
#include <QPalette>
|
||||
#include <QRect>
|
||||
#include <QStyle>
|
||||
#include <QMenu>
|
||||
#include <QFlags>
|
||||
#include <QPushButton>
|
||||
#include <QMessageBox>
|
||||
#include <QtEvents>
|
||||
|
||||
#include "deviceview.h"
|
||||
|
||||
#include "connecteddevice.h"
|
||||
#include "devicelister.h"
|
||||
#include "devicemanager.h"
|
||||
#include "deviceproperties.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "core/application.h"
|
||||
#include "core/deletefiles.h"
|
||||
#include "core/mergedproxymodel.h"
|
||||
#include "core/mimedata.h"
|
||||
#include "core/iconloader.h"
|
||||
#include "core/musicstorage.h"
|
||||
#include "dialogs/organisedialog.h"
|
||||
#include "dialogs/organiseerrordialog.h"
|
||||
#include "collection/collectiondirectorymodel.h"
|
||||
#include "collection/collectionmodel.h"
|
||||
#include "collection/collectionview.h"
|
||||
#include "dialogs/organisedialog.h"
|
||||
#include "dialogs/organiseerrordialog.h"
|
||||
#include "connecteddevice.h"
|
||||
#include "devicelister.h"
|
||||
#include "devicemanager.h"
|
||||
#include "deviceproperties.h"
|
||||
#include "deviceview.h"
|
||||
|
||||
const int DeviceItemDelegate::kIconPadding = 6;
|
||||
|
||||
|
||||
@@ -24,20 +24,30 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QModelIndex>
|
||||
#include <QStyleOption>
|
||||
#include <QStyleOptionViewItem>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <QAbstractItemModel>
|
||||
#include <QPainter>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
#include <QMouseEvent>
|
||||
#include <QContextMenuEvent>
|
||||
|
||||
#include "core/song.h"
|
||||
#include "collection/collectionview.h"
|
||||
#include "widgets/autoexpandingtreeview.h"
|
||||
|
||||
class QAction;
|
||||
class QMenu;
|
||||
class QSortFilterProxyModel;
|
||||
|
||||
class Application;
|
||||
class DeviceManager;
|
||||
class DeviceProperties;
|
||||
class CollectionModel;
|
||||
class MergedProxyModel;
|
||||
class OrganiseDialog;
|
||||
|
||||
class DeviceItemDelegate : public CollectionItemDelegate {
|
||||
public:
|
||||
|
||||
@@ -20,11 +20,20 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "deviceviewcontainer.h"
|
||||
#include "ui_deviceviewcontainer.h"
|
||||
#include <QWidget>
|
||||
#include <QColor>
|
||||
#include <QFrame>
|
||||
#include <QIcon>
|
||||
#include <QLabel>
|
||||
#include <QPalette>
|
||||
#include <QToolButton>
|
||||
#include <QShowEvent>
|
||||
|
||||
#include "core/iconloader.h"
|
||||
|
||||
#include "deviceviewcontainer.h"
|
||||
#include "ui_deviceviewcontainer.h"
|
||||
|
||||
DeviceViewContainer::DeviceViewContainer(QWidget *parent) : QWidget(parent), ui_(new Ui::DeviceViewContainer), loaded_icons_(false) {
|
||||
|
||||
ui_->setupUi(this);
|
||||
|
||||
@@ -23,7 +23,12 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QString>
|
||||
#include <QShowEvent>
|
||||
|
||||
namespace Ui {
|
||||
class DeviceViewContainer;
|
||||
|
||||
@@ -20,16 +20,20 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "devicelister.h"
|
||||
#include "devicemanager.h"
|
||||
#include "filesystemdevice.h"
|
||||
#include <QThread>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/application.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "collection/collectionmodel.h"
|
||||
#include "collection/collectionwatcher.h"
|
||||
#include "connecteddevice.h"
|
||||
#include "devicemanager.h"
|
||||
#include "filesystemdevice.h"
|
||||
|
||||
#include <QThread>
|
||||
#include <QtDebug>
|
||||
class DeviceLister;
|
||||
|
||||
FilesystemDevice::FilesystemDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
|
||||
: FilesystemMusicStorage(url.toLocalFile()), ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time), watcher_(new CollectionWatcher), watcher_thread_(new QThread(this))
|
||||
|
||||
@@ -23,11 +23,21 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "connecteddevice.h"
|
||||
#include "core/filesystemmusicstorage.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
class DeviceManager;
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/filesystemmusicstorage.h"
|
||||
#include "connecteddevice.h"
|
||||
|
||||
class Application;
|
||||
class CollectionWatcher;
|
||||
class DeviceLister;
|
||||
class DeviceManager;
|
||||
|
||||
class FilesystemDevice : public ConnectedDevice, public virtual FilesystemMusicStorage {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -21,15 +21,21 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QMutex>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QtDebug>
|
||||
#include <QRegExp>
|
||||
#include <QUrl>
|
||||
|
||||
#include "giolister.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/signalchecker.h"
|
||||
#include "devicelister.h"
|
||||
#include "giolister.h"
|
||||
|
||||
using std::placeholders::_1;
|
||||
using std::placeholders::_2;
|
||||
@@ -291,7 +297,7 @@ void GioLister::MountAdded(GMount *mount) {
|
||||
QMutexLocker l(&mutex_);
|
||||
|
||||
// The volume might already exist - either mounted or unmounted.
|
||||
for (const QString& id : devices_.keys()) {
|
||||
for (const QString &id : devices_.keys()) {
|
||||
if (devices_[id].volume == info.volume) {
|
||||
old_id = id;
|
||||
break;
|
||||
@@ -333,9 +339,7 @@ void GioLister::MountChanged(GMount *mount) {
|
||||
new_info.ReadDriveInfo(g_mount_get_drive(mount));
|
||||
|
||||
// Ignore the change if the new info is useless
|
||||
if (new_info.invalid_enclosing_mount ||
|
||||
(devices_[id].filesystem_size != 0 && new_info.filesystem_size == 0) ||
|
||||
(!devices_[id].filesystem_type.isEmpty() && new_info.filesystem_type.isEmpty()))
|
||||
if (new_info.invalid_enclosing_mount || (devices_[id].filesystem_size != 0 && new_info.filesystem_size == 0) || (!devices_[id].filesystem_type.isEmpty() && new_info.filesystem_type.isEmpty()))
|
||||
return;
|
||||
|
||||
devices_[id] = new_info;
|
||||
@@ -391,8 +395,8 @@ void GioLister::DeviceInfo::ReadMountInfo(GMount *mount) {
|
||||
mount_path = ConvertAndFree(g_file_get_path(root));
|
||||
mount_uri = ConvertAndFree(g_file_get_uri(root));
|
||||
|
||||
// Do a sanity check to make sure the root is actually this mount - when a
|
||||
// device is unmounted GIO sends a changed signal before the removed signal,
|
||||
// Do a sanity check to make sure the root is actually this mount
|
||||
// when a device is unmounted GIO sends a changed signal before the removed signal,
|
||||
// and we end up reading information about the / filesystem by mistake.
|
||||
GError *error = nullptr;
|
||||
GMount *actual_mount = g_file_find_enclosing_mount(root, nullptr, &error);
|
||||
|
||||
@@ -23,18 +23,28 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "devicelister.h"
|
||||
#include "core/scopedgobject.h"
|
||||
|
||||
// Work around compile issue with glib >= 2.25
|
||||
#ifdef signals
|
||||
#undef signals
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/scopedgobject.h"
|
||||
#include "devicelister.h"
|
||||
|
||||
class GioLister : public DeviceLister {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -20,20 +20,30 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <gpod/itdb.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <QByteArray>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QThread>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "devicemanager.h"
|
||||
#include "gpoddevice.h"
|
||||
#include "gpodloader.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/application.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "collection/collectionmodel.h"
|
||||
#include "connecteddevice.h"
|
||||
#include "gpoddevice.h"
|
||||
#include "gpodloader.h"
|
||||
|
||||
class DeviceLister;
|
||||
class DeviceManager;
|
||||
|
||||
GPodDevice::GPodDevice(const QUrl &url, DeviceLister *lister, const QString &unique_id, DeviceManager *manager, Application *app, int database_id, bool first_time)
|
||||
: ConnectedDevice(url, lister, unique_id, manager, app, database_id, first_time),
|
||||
|
||||
@@ -23,14 +23,25 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "connecteddevice.h"
|
||||
#include "core/musicstorage.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <gpod/itdb.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QThread>
|
||||
#include <QWaitCondition>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/song.h"
|
||||
#include "core/musicstorage.h"
|
||||
#include "connecteddevice.h"
|
||||
|
||||
class Application;
|
||||
class DeviceLister;
|
||||
class DeviceManager;
|
||||
class GPodLoader;
|
||||
|
||||
class GPodDevice : public ConnectedDevice, public virtual MusicStorage {
|
||||
|
||||
@@ -20,17 +20,20 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <gpod/itdb.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QDir>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "connecteddevice.h"
|
||||
#include "gpodloader.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/song.h"
|
||||
#include "core/taskmanager.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "gpodloader.h"
|
||||
|
||||
GPodLoader::GPodLoader(const QString &mount_point, TaskManager *task_manager, CollectionBackend *backend, std::shared_ptr<ConnectedDevice> device)
|
||||
: QObject(nullptr),
|
||||
|
||||
@@ -24,16 +24,17 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <gpod/itdb.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QString>
|
||||
|
||||
#include "core/song.h"
|
||||
|
||||
class ConnectedDevice;
|
||||
class CollectionBackend;
|
||||
class TaskManager;
|
||||
class CollectionBackend;
|
||||
class ConnectedDevice;
|
||||
|
||||
class GPodLoader : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -20,10 +20,14 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QMutex>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "config.h"
|
||||
#include "ilister.h"
|
||||
#include "imobiledeviceconnection.h"
|
||||
|
||||
|
||||
@@ -25,7 +25,13 @@
|
||||
|
||||
#include <libimobiledevice/libimobiledevice.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QMap>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include "devicelister.h"
|
||||
|
||||
|
||||
@@ -23,13 +23,17 @@
|
||||
#include <plist/plist.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "imobiledeviceconnection.h"
|
||||
#include "core/logging.h"
|
||||
#include "imobiledeviceconnection.h"
|
||||
|
||||
iMobileDeviceConnection::iMobileDeviceConnection(const QString &uuid) : device_(NULL), afc_(NULL), afc_port_(0) {
|
||||
iMobileDeviceConnection::iMobileDeviceConnection(const QString &uuid) : device_(nullptr), afc_(nullptr), afc_port_(0) {
|
||||
|
||||
idevice_error_t err = idevice_new(&device_, uuid.toUtf8().constData());
|
||||
if (err != IDEVICE_E_SUCCESS) {
|
||||
@@ -38,6 +42,7 @@ iMobileDeviceConnection::iMobileDeviceConnection(const QString &uuid) : device_(
|
||||
}
|
||||
|
||||
lockdownd_client_t lockdown;
|
||||
lockdownd_service_descriptor_t lockdown_service_desc;
|
||||
|
||||
QByteArray label_ascii = QCoreApplication::applicationName().toLatin1();
|
||||
const char *label = label_ascii.constData();
|
||||
@@ -47,14 +52,14 @@ iMobileDeviceConnection::iMobileDeviceConnection(const QString &uuid) : device_(
|
||||
return;
|
||||
}
|
||||
|
||||
lockdown_err = lockdownd_start_service(lockdown, "com.apple.afc", &afc_port_);
|
||||
lockdown_err = lockdownd_start_service(lockdown, "com.apple.afc", &lockdown_service_desc);
|
||||
if (lockdown_err != LOCKDOWN_E_SUCCESS) {
|
||||
qLog(Warning) << "lockdown error:" << lockdown_err;
|
||||
lockdownd_client_free(lockdown);
|
||||
return;
|
||||
}
|
||||
|
||||
afc_error_t afc_err = afc_client_new(device_, afc_port_, &afc_);
|
||||
afc_error_t afc_err = afc_client_new(device_, lockdown_service_desc, &afc_);
|
||||
if (afc_err != 0) {
|
||||
qLog(Warning) << "afc error:" << afc_err;
|
||||
lockdownd_client_free(lockdown);
|
||||
@@ -197,8 +202,7 @@ bool iMobileDeviceConnection::Exists(const QString &path) {
|
||||
|
||||
QString iMobileDeviceConnection::GetUnusedFilename(Itdb_iTunesDB *itdb, const Song &metadata) {
|
||||
|
||||
// This function does the same as itdb_cp_get_dest_filename, except it
|
||||
// accesses the device's filesystem through imobiledevice.
|
||||
// This function does the same as itdb_cp_get_dest_filename, except it accesses the device's filesystem through imobiledevice.
|
||||
|
||||
// Get the total number of F.. directories
|
||||
int total_musicdirs = 0;
|
||||
@@ -231,8 +235,7 @@ QString iMobileDeviceConnection::GetUnusedFilename(Itdb_iTunesDB *itdb, const So
|
||||
extension = "mp3";
|
||||
|
||||
// Loop until we find an unused filename.
|
||||
// Use the same naming convention as libgpod, which is
|
||||
// "libgpod" + 6-digit random number
|
||||
// Use the same naming convention as libgpod, which is "libgpod" + 6-digit random number
|
||||
static const int kRandMax = 999999;
|
||||
QString filename;
|
||||
forever {
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
#include <gpod/itdb.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
#include "core/song.h"
|
||||
|
||||
@@ -56,7 +57,6 @@ private:
|
||||
|
||||
idevice_t device_;
|
||||
afc_client_t afc_;
|
||||
|
||||
uint16_t afc_port_;
|
||||
};
|
||||
|
||||
|
||||
@@ -3,14 +3,19 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QSet>
|
||||
#include <QThread>
|
||||
|
||||
#include <DiskArbitration/DADisk.h>
|
||||
#include <DiskArbitration/DADissenter.h>
|
||||
#include <IOKit/IOKitLib.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QMutex>
|
||||
#include <QThread>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
#include "devicelister.h"
|
||||
|
||||
class MacDeviceLister : public DeviceLister {
|
||||
|
||||
@@ -20,12 +20,17 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QtDebug>
|
||||
#include <QUrlQuery>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
#include <QRegExp>
|
||||
#include <QUrl>
|
||||
#include <QUrlQuery>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "mtpconnection.h"
|
||||
#include "core/logging.h"
|
||||
#include "mtpconnection.h"
|
||||
|
||||
MtpConnection::MtpConnection(const QUrl &url) : device_(nullptr) {
|
||||
|
||||
|
||||
@@ -23,8 +23,10 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <libmtp.h>
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QUrl>
|
||||
|
||||
class MtpConnection {
|
||||
|
||||
@@ -21,18 +21,31 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <libmtp.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <QFile>
|
||||
#include <QtGlobal>
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <QFile>
|
||||
#include <QByteArray>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "devicemanager.h"
|
||||
#include "collection/collectionmodel.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/application.h"
|
||||
#include "core/musicstorage.h"
|
||||
#include "connecteddevice.h"
|
||||
#include "mtpconnection.h"
|
||||
#include "mtpdevice.h"
|
||||
#include "mtploader.h"
|
||||
#include "core/application.h"
|
||||
#include "core/logging.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "collection/collectionmodel.h"
|
||||
|
||||
class DeviceLister;
|
||||
class DeviceManager;
|
||||
|
||||
bool MtpDevice::sInitialisedLibMTP = false;
|
||||
|
||||
@@ -95,10 +108,12 @@ bool MtpDevice::StartCopy(QList<Song::FileType> *supported_types) {
|
||||
}
|
||||
|
||||
static int ProgressCallback(uint64_t const sent, uint64_t const total, void const *const data) {
|
||||
|
||||
const MusicStorage::CopyJob *job = reinterpret_cast<const MusicStorage::CopyJob*>(data);
|
||||
job->progress_(float(sent) / total);
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
bool MtpDevice::CopyToStorage(const CopyJob &job) {
|
||||
|
||||
@@ -24,16 +24,25 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/song.h"
|
||||
#include "connecteddevice.h"
|
||||
|
||||
struct LIBMTP_mtpdevice_struct;
|
||||
|
||||
class Application;
|
||||
class DeviceLister;
|
||||
class DeviceManager;
|
||||
class MtpConnection;
|
||||
class MtpLoader;
|
||||
struct LIBMTP_mtpdevice_struct;
|
||||
|
||||
class MtpDevice : public ConnectedDevice {
|
||||
Q_OBJECT
|
||||
|
||||
@@ -20,17 +20,16 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "mtploader.h"
|
||||
|
||||
#include <libmtp.h>
|
||||
|
||||
#include "connecteddevice.h"
|
||||
#include "mtpconnection.h"
|
||||
#include "core/song.h"
|
||||
#include "core/taskmanager.h"
|
||||
#include "core/logging.h"
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
|
||||
#include "core/taskmanager.h"
|
||||
#include "core/song.h"
|
||||
#include "collection/collectionbackend.h"
|
||||
#include "mtpconnection.h"
|
||||
#include "mtploader.h"
|
||||
|
||||
MtpLoader::MtpLoader(const QUrl &url, TaskManager *task_manager, CollectionBackend *backend, std::shared_ptr<ConnectedDevice> device)
|
||||
: QObject(nullptr),
|
||||
|
||||
@@ -24,13 +24,16 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
|
||||
class ConnectedDevice;
|
||||
class CollectionBackend;
|
||||
class TaskManager;
|
||||
class CollectionBackend;
|
||||
class ConnectedDevice;
|
||||
|
||||
class MtpLoader : public QObject {
|
||||
Q_OBJECT
|
||||
@@ -52,7 +55,7 @@ signals:
|
||||
|
||||
private:
|
||||
std::shared_ptr<ConnectedDevice> device_;
|
||||
QThread* original_thread_;
|
||||
QThread *original_thread_;
|
||||
|
||||
QUrl url_;
|
||||
TaskManager *task_manager_;
|
||||
|
||||
@@ -17,9 +17,23 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "udisks2lister.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QMutex>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#include <QReadLocker>
|
||||
#include <QWriteLocker>
|
||||
#include <QDBusObjectPath>
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusError>
|
||||
#include <QDBusPendingReply>
|
||||
#include <QDBusArgument>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "core/logging.h"
|
||||
#include "core/utilities.h"
|
||||
@@ -29,6 +43,8 @@
|
||||
#include "dbus/udisks2filesystem.h"
|
||||
#include "dbus/udisks2job.h"
|
||||
|
||||
#include "udisks2lister.h"
|
||||
|
||||
constexpr char Udisks2Lister::udisks2_service_[];
|
||||
|
||||
Udisks2Lister::Udisks2Lister() {}
|
||||
@@ -141,9 +157,7 @@ void Udisks2Lister::UnmountDevice(const QString &id) {
|
||||
|
||||
void Udisks2Lister::UpdateDeviceFreeSpace(const QString &id) {
|
||||
QWriteLocker locker(&device_data_lock_);
|
||||
device_data_[id].free_space =
|
||||
Utilities::FileSystemFreeSpace(device_data_[id].mount_paths.at(0));
|
||||
|
||||
device_data_[id].free_space = Utilities::FileSystemFreeSpace(device_data_[id].mount_paths.at(0));
|
||||
emit DeviceChanged(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,11 +21,22 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <memory>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <QDBusArgument>
|
||||
#include <QtGlobal>
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QMetaType>
|
||||
#include <QReadWriteLock>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QUrl>
|
||||
#include <QDBusObjectPath>
|
||||
#include <QDBusArgument>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include "dbus/metatypes.h"
|
||||
#include "devicelister.h"
|
||||
|
||||
Reference in New Issue
Block a user