2010-07-19 21:56:29 +02:00
|
|
|
/* This file is part of Clementine.
|
2014-11-02 19:36:21 +01:00
|
|
|
Copyright 2010, David Sansome <davidsansome@gmail.com>
|
|
|
|
Copyright 2014, Krzysztof Sobiecki <sobkas@gmail.com>
|
|
|
|
Copyright 2014, John Maguire <john.maguire@gmail.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/>.
|
|
|
|
*/
|
|
|
|
|
2014-11-01 19:26:05 +01:00
|
|
|
#ifndef CORE_MUSICSTORAGE_H_
|
|
|
|
#define CORE_MUSICSTORAGE_H_
|
2010-07-19 21:56:29 +02:00
|
|
|
|
2020-09-18 16:15:19 +02:00
|
|
|
#include <QMetaType>
|
2014-02-06 14:48:00 +01:00
|
|
|
#include <functional>
|
|
|
|
#include <memory>
|
2010-07-19 21:56:29 +02:00
|
|
|
|
2020-09-18 16:15:19 +02:00
|
|
|
#include "song.h"
|
2010-08-09 23:50:46 +02:00
|
|
|
|
2010-07-19 21:56:29 +02:00
|
|
|
class MusicStorage {
|
2014-02-07 16:34:20 +01:00
|
|
|
public:
|
2010-07-19 21:56:29 +02:00
|
|
|
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,
|
|
|
|
};
|
|
|
|
|
2014-02-07 16:34:20 +01:00
|
|
|
typedef std::function<void(float progress)> ProgressFunction;
|
2010-08-28 23:55:30 +02:00
|
|
|
|
|
|
|
struct CopyJob {
|
|
|
|
QString source_;
|
|
|
|
QString destination_;
|
|
|
|
Song metadata_;
|
|
|
|
bool overwrite_;
|
2014-10-30 03:41:15 +01:00
|
|
|
bool mark_as_listened_;
|
2010-08-28 23:55:30 +02:00
|
|
|
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; }
|
2014-02-07 16:34:20 +01:00
|
|
|
virtual Song::FileType GetTranscodeFormat() const {
|
|
|
|
return Song::Type_Unknown;
|
|
|
|
}
|
|
|
|
virtual bool GetSupportedFiletypes(QList<Song::FileType>* ret) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
2019-11-10 00:30:18 +01:00
|
|
|
Q_DECLARE_METATYPE(MusicStorage*)
|
|
|
|
Q_DECLARE_METATYPE(std::shared_ptr<MusicStorage>)
|
2010-07-19 21:56:29 +02:00
|
|
|
|
2014-11-01 19:26:05 +01:00
|
|
|
#endif // CORE_MUSICSTORAGE_H_
|