2010-07-19 21:56:29 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-07-19 21:56:29 +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/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MUSICSTORAGE_H
|
|
|
|
#define MUSICSTORAGE_H
|
|
|
|
|
|
|
|
#include "song.h"
|
|
|
|
|
|
|
|
#include <QMetaType>
|
|
|
|
|
2010-08-28 23:55:30 +02:00
|
|
|
#include <boost/function.hpp>
|
2010-08-09 23:50:46 +02:00
|
|
|
#include <boost/shared_ptr.hpp>
|
|
|
|
|
2010-07-19 21:56:29 +02:00
|
|
|
class MusicStorage {
|
|
|
|
public:
|
|
|
|
MusicStorage();
|
|
|
|
virtual ~MusicStorage() {}
|
|
|
|
|
2010-07-30 00:16:12 +02:00
|
|
|
enum Role {
|
|
|
|
Role_Storage = Qt::UserRole + 100,
|
2010-08-14 14:30:51 +02:00
|
|
|
Role_StorageForceConnect,
|
2010-07-30 00:16:12 +02:00
|
|
|
Role_Capacity,
|
|
|
|
Role_FreeSpace,
|
|
|
|
};
|
2010-07-19 21:56:29 +02:00
|
|
|
|
2010-08-29 21:22:21 +02:00
|
|
|
// Values are saved in the database - don't change
|
|
|
|
enum TranscodeMode {
|
|
|
|
Transcode_Always = 1,
|
|
|
|
Transcode_Never = 2,
|
|
|
|
Transcode_Unsupported = 3,
|
|
|
|
};
|
|
|
|
|
2010-08-28 23:55:30 +02:00
|
|
|
typedef boost::function<void (float progress)> ProgressFunction;
|
|
|
|
|
|
|
|
struct CopyJob {
|
|
|
|
QString source_;
|
|
|
|
QString destination_;
|
|
|
|
Song metadata_;
|
|
|
|
bool overwrite_;
|
|
|
|
bool remove_original_;
|
|
|
|
ProgressFunction progress_;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DeleteJob {
|
|
|
|
Song metadata_;
|
|
|
|
};
|
|
|
|
|
2010-07-19 21:56:29 +02:00
|
|
|
virtual QString LocalPath() const { return QString(); }
|
|
|
|
|
2010-08-29 21:22:21 +02:00
|
|
|
virtual TranscodeMode GetTranscodeMode() const { return Transcode_Never; }
|
|
|
|
virtual Song::FileType GetTranscodeFormat() const { return Song::Type_Unknown; }
|
2010-08-30 14:22:15 +02:00
|
|
|
virtual bool GetSupportedFiletypes(QList<Song::FileType>* ret) { return true; }
|
2010-08-29 21:22:21 +02:00
|
|
|
|
2010-08-30 14:22:15 +02:00
|
|
|
virtual bool StartCopy(QList<Song::FileType>* supported_types) { return true;}
|
2010-08-28 23:55:30 +02:00
|
|
|
virtual bool CopyToStorage(const CopyJob& job) = 0;
|
2010-08-10 21:42:43 +02:00
|
|
|
virtual void FinishCopy(bool success) {}
|
2010-07-31 18:12:16 +02:00
|
|
|
|
|
|
|
virtual void StartDelete() {}
|
2010-08-28 23:55:30 +02:00
|
|
|
virtual bool DeleteFromStorage(const DeleteJob& job) = 0;
|
2010-08-10 21:42:43 +02:00
|
|
|
virtual void FinishDelete(bool success) {}
|
2010-07-31 18:12:16 +02:00
|
|
|
|
2010-07-25 11:52:29 +02:00
|
|
|
virtual void Eject() {}
|
2010-07-19 21:56:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(MusicStorage*);
|
2010-08-09 23:50:46 +02:00
|
|
|
Q_DECLARE_METATYPE(boost::shared_ptr<MusicStorage>);
|
2010-07-19 21:56:29 +02:00
|
|
|
|
|
|
|
#endif // MUSICSTORAGE_H
|