2010-06-25 21:04:10 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-06-25 21:04:10 +02:00
|
|
|
|
|
|
|
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/>.
|
|
|
|
*/
|
|
|
|
|
2010-06-26 01:38:21 +02:00
|
|
|
#ifndef CONNECTEDDEVICE_H
|
|
|
|
#define CONNECTEDDEVICE_H
|
2010-06-25 21:04:10 +02:00
|
|
|
|
2010-07-25 11:52:29 +02:00
|
|
|
#include "core/musicstorage.h"
|
2010-08-29 02:08:39 +02:00
|
|
|
#include "core/song.h"
|
2010-07-25 11:52:29 +02:00
|
|
|
|
2010-06-25 21:04:10 +02:00
|
|
|
#include <QObject>
|
2010-07-17 16:22:07 +02:00
|
|
|
#include <QStringList>
|
|
|
|
#include <QUrl>
|
2010-06-25 21:04:10 +02:00
|
|
|
|
2010-08-09 23:32:25 +02:00
|
|
|
#include <boost/enable_shared_from_this.hpp>
|
|
|
|
|
2010-06-26 01:38:21 +02:00
|
|
|
class Database;
|
|
|
|
class DeviceLister;
|
2010-06-26 14:41:18 +02:00
|
|
|
class DeviceManager;
|
2010-06-26 01:38:21 +02:00
|
|
|
class LibraryBackend;
|
|
|
|
class LibraryModel;
|
|
|
|
|
2010-08-09 23:32:25 +02:00
|
|
|
class ConnectedDevice : public QObject, public virtual MusicStorage,
|
|
|
|
public boost::enable_shared_from_this<ConnectedDevice> {
|
2010-06-25 21:04:10 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2010-07-17 16:22:07 +02:00
|
|
|
ConnectedDevice(const QUrl& url, DeviceLister* lister,
|
|
|
|
const QString& unique_id, DeviceManager* manager,
|
|
|
|
int database_id, bool first_time);
|
2010-07-04 01:00:07 +02:00
|
|
|
~ConnectedDevice();
|
2010-06-26 01:38:21 +02:00
|
|
|
|
2010-08-08 19:41:06 +02:00
|
|
|
virtual void Init() = 0;
|
|
|
|
|
2010-08-29 21:22:21 +02:00
|
|
|
virtual TranscodeMode GetTranscodeMode() const;
|
|
|
|
virtual Song::FileType GetTranscodeFormat() const;
|
2010-08-29 02:08:39 +02:00
|
|
|
|
2010-06-26 01:38:21 +02:00
|
|
|
DeviceLister* lister() const { return lister_; }
|
|
|
|
QString unique_id() const { return unique_id_; }
|
|
|
|
LibraryModel* model() const { return model_; }
|
2010-07-25 01:20:34 +02:00
|
|
|
QUrl url() const { return url_; }
|
2010-08-30 16:45:27 +02:00
|
|
|
int song_count() const { return song_count_; }
|
2010-06-26 01:38:21 +02:00
|
|
|
|
2010-08-11 20:47:53 +02:00
|
|
|
virtual void FinishCopy(bool success);
|
|
|
|
virtual void FinishDelete(bool success);
|
|
|
|
|
2010-08-14 17:57:05 +02:00
|
|
|
virtual void Eject();
|
2010-07-19 21:56:29 +02:00
|
|
|
|
2010-07-04 17:56:08 +02:00
|
|
|
signals:
|
|
|
|
void TaskStarted(int id);
|
2010-07-04 22:52:45 +02:00
|
|
|
void Error(const QString& message);
|
2010-08-30 16:45:27 +02:00
|
|
|
void SongCountUpdated(int count);
|
2010-07-04 22:52:45 +02:00
|
|
|
|
|
|
|
protected:
|
2010-08-08 15:27:36 +02:00
|
|
|
void InitBackendDirectory(const QString& mount_point, bool first_time, bool rewrite_path = true);
|
2010-07-04 17:56:08 +02:00
|
|
|
|
2010-06-26 01:38:21 +02:00
|
|
|
protected:
|
2010-07-24 18:58:14 +02:00
|
|
|
QUrl url_;
|
2010-08-08 19:41:06 +02:00
|
|
|
bool first_time_;
|
2010-06-26 01:38:21 +02:00
|
|
|
DeviceLister* lister_;
|
|
|
|
QString unique_id_;
|
2010-07-04 01:00:07 +02:00
|
|
|
int database_id_;
|
2010-06-26 14:41:18 +02:00
|
|
|
DeviceManager* manager_;
|
2010-06-26 01:38:21 +02:00
|
|
|
|
|
|
|
LibraryBackend* backend_;
|
|
|
|
LibraryModel* model_;
|
2010-08-30 16:45:27 +02:00
|
|
|
|
|
|
|
int song_count_;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void BackendTotalSongCountUpdated(int count);
|
2010-06-25 21:04:10 +02:00
|
|
|
};
|
|
|
|
|
2010-06-26 01:38:21 +02:00
|
|
|
#endif // CONNECTEDDEVICE_H
|