2017-10-29 14:47:36 +03:00
|
|
|
#ifndef SONG_H
|
|
|
|
#define SONG_H
|
2017-11-12 13:26:37 +03:00
|
|
|
#include <QString>
|
|
|
|
#include <QByteArray>
|
|
|
|
#include <QDataStream>
|
2017-12-17 01:23:38 +03:00
|
|
|
#include "chronotime.h"
|
2018-03-18 14:30:48 +03:00
|
|
|
#include <QMediaContent>
|
2017-11-12 13:26:37 +03:00
|
|
|
|
2017-10-29 14:47:36 +03:00
|
|
|
namespace syncLib {
|
|
|
|
|
2017-11-11 14:03:14 +03:00
|
|
|
/**
|
|
|
|
* @brief The Syncer struct
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct Syncer
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @brief seek - wher is play media file
|
|
|
|
*/
|
2017-11-20 00:37:12 +03:00
|
|
|
milliseconds seek;
|
2017-11-11 14:03:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief The SongHeader class sound header with media information
|
|
|
|
* (id,size and name)
|
|
|
|
*/
|
2017-11-27 02:01:47 +03:00
|
|
|
class SongHeader{
|
2018-03-25 23:01:44 +03:00
|
|
|
protected:
|
|
|
|
bool getName(QString &name, const QUrl& url)const;
|
2017-10-29 14:47:36 +03:00
|
|
|
public:
|
2018-03-06 13:28:42 +03:00
|
|
|
bool isSelected;
|
2017-10-29 14:47:36 +03:00
|
|
|
int id;
|
|
|
|
QString name;
|
|
|
|
int size;
|
|
|
|
SongHeader();
|
|
|
|
SongHeader& operator = (const SongHeader& right);
|
2018-03-25 23:01:44 +03:00
|
|
|
SongHeader& operator = (const QMediaContent& right);
|
|
|
|
|
2017-10-29 14:47:36 +03:00
|
|
|
bool operator == (const SongHeader& right);
|
2018-03-25 23:01:44 +03:00
|
|
|
bool operator == (const QMediaContent& right);
|
2017-12-26 12:54:33 +03:00
|
|
|
bool isNameValid() const;
|
2017-12-02 14:35:39 +03:00
|
|
|
virtual bool isValid() const;
|
2017-10-29 14:47:36 +03:00
|
|
|
virtual ~SongHeader();
|
2018-03-06 13:28:42 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* serialize data:
|
|
|
|
* id,
|
|
|
|
* size,
|
|
|
|
* and,
|
|
|
|
* name
|
|
|
|
*/
|
2017-11-06 13:20:52 +03:00
|
|
|
friend QDataStream& operator << (QDataStream& stream, const SongHeader& song);
|
|
|
|
friend QDataStream& operator >> (QDataStream& stream, SongHeader& song);
|
2017-10-29 14:47:36 +03:00
|
|
|
};
|
2017-11-27 02:01:47 +03:00
|
|
|
|
2018-03-18 14:30:48 +03:00
|
|
|
/**
|
|
|
|
* @brief The SongStorage class
|
|
|
|
* header with url to song source
|
|
|
|
*/
|
|
|
|
class SongStorage : public SongHeader {
|
|
|
|
private:
|
|
|
|
QUrl url;
|
|
|
|
public:
|
|
|
|
SongStorage();
|
|
|
|
SongStorage(const SongHeader& from);
|
|
|
|
const QUrl& getSource()const;
|
|
|
|
QMediaContent toMedia()const;
|
|
|
|
bool isValid() const;
|
|
|
|
~SongStorage();
|
|
|
|
friend QDataStream& operator << (QDataStream& stream, const SongStorage& song);
|
|
|
|
friend QDataStream& operator >> (QDataStream& stream, SongStorage& song);
|
|
|
|
friend class MySql;
|
|
|
|
};
|
|
|
|
|
2017-11-11 14:03:14 +03:00
|
|
|
/**
|
|
|
|
* @brief The Song class
|
|
|
|
* into this calss added mediadata of playable media file.
|
|
|
|
*/
|
2018-03-18 14:30:48 +03:00
|
|
|
class Song : public SongHeader {
|
2017-10-29 14:47:36 +03:00
|
|
|
private:
|
|
|
|
QByteArray source;
|
|
|
|
public:
|
|
|
|
Song();
|
|
|
|
Song(const SongHeader& from);
|
2017-11-06 01:33:16 +03:00
|
|
|
void clear();
|
2017-12-24 22:04:40 +03:00
|
|
|
const QByteArray& getSource()const;
|
2017-12-02 14:35:39 +03:00
|
|
|
bool isValid() const;
|
2017-10-29 14:47:36 +03:00
|
|
|
~Song();
|
2017-11-06 13:20:52 +03:00
|
|
|
friend QDataStream& operator << (QDataStream& stream, const Song& song);
|
|
|
|
friend QDataStream& operator >> (QDataStream& stream, Song& song);
|
2017-12-24 22:04:40 +03:00
|
|
|
friend class MySql;
|
2017-11-06 01:33:16 +03:00
|
|
|
};
|
2017-10-29 14:47:36 +03:00
|
|
|
}
|
|
|
|
#endif // SONG_H
|