2010-08-01 16:13:27 +02:00
|
|
|
/* 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 AFCDEVICE_H
|
|
|
|
#define AFCDEVICE_H
|
|
|
|
|
2010-08-08 19:41:06 +02:00
|
|
|
#include "gpoddevice.h"
|
2010-08-01 16:13:27 +02:00
|
|
|
|
|
|
|
#include <QMutex>
|
|
|
|
#include <QWaitCondition>
|
|
|
|
|
2010-08-14 13:16:11 +02:00
|
|
|
#include <boost/scoped_ptr.hpp>
|
|
|
|
|
2010-08-01 16:13:27 +02:00
|
|
|
#include <gpod/itdb.h>
|
|
|
|
|
|
|
|
class AfcTransfer;
|
|
|
|
class GPodLoader;
|
2010-08-14 13:16:11 +02:00
|
|
|
class iMobileDeviceConnection;
|
2010-08-01 16:13:27 +02:00
|
|
|
|
2010-08-08 19:41:06 +02:00
|
|
|
class AfcDevice : public GPodDevice {
|
2010-08-01 16:13:27 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Q_INVOKABLE AfcDevice(const QUrl& url, DeviceLister* lister,
|
|
|
|
const QString& unique_id, DeviceManager* manager,
|
|
|
|
int database_id, bool first_time);
|
|
|
|
~AfcDevice();
|
|
|
|
|
2010-08-08 19:41:06 +02:00
|
|
|
void Init();
|
|
|
|
|
2010-08-01 16:13:27 +02:00
|
|
|
static QStringList url_schemes() { return QStringList() << "afc"; }
|
|
|
|
|
2010-08-14 13:16:11 +02:00
|
|
|
void StartCopy();
|
2010-08-28 23:55:30 +02:00
|
|
|
bool CopyToStorage(const CopyJob& job);
|
2010-08-10 21:42:43 +02:00
|
|
|
void FinishCopy(bool success);
|
2010-08-08 19:41:06 +02:00
|
|
|
|
2010-08-28 23:55:30 +02:00
|
|
|
bool DeleteFromStorage(const DeleteJob& job);
|
2010-08-01 16:13:27 +02:00
|
|
|
|
2010-08-08 19:41:06 +02:00
|
|
|
protected:
|
|
|
|
void FinaliseDatabase();
|
|
|
|
|
2010-08-01 16:13:27 +02:00
|
|
|
private slots:
|
2010-08-09 21:24:17 +02:00
|
|
|
void CopyFinished(bool success);
|
2010-08-01 16:13:27 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
void RemoveRecursive(const QString& path);
|
|
|
|
|
|
|
|
private:
|
|
|
|
AfcTransfer* transfer_;
|
2010-08-14 13:16:11 +02:00
|
|
|
boost::scoped_ptr<iMobileDeviceConnection> connection_;
|
2010-08-01 16:13:27 +02:00
|
|
|
|
|
|
|
QString local_path_;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // AFCDEVICE_H
|