-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmedialist.h
67 lines (58 loc) · 1.64 KB
/
medialist.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef MEDIALIST
#define MEDIALIST
#include <QList>
#include <QObject>
#include "nextstrategy.h"
class MediaList;
class CurrentMediaList;
struct MediaInfo{
QString name;
QString url;
bool isVideo;
int pos;
MediaList *parentList;
};
class MediaList : public QObject{
Q_OBJECT
public:
MediaList(QString name){this->name = name;urls = new QList<QString>();names = new QList<QString>();}
~MediaList(){urls->clear();names->clear();}
QString getMediaUrl(int pos);
void addMedia(QString url, QString name, int pos=-1);
void removeMedia(int pos);
void getPosInfo(int pos,MediaInfo &info);
bool isVideo(int pos);
void setListName(QString name);
void swapMedia(int pos1,int pos2);
QString getListName();
void copyToCrtList(CurrentMediaList *crtList);
void removeAll();
void getInfoByName(QString name,MediaInfo &info);
int size();
protected:
virtual bool isCurrentList(){return false;}
private:
QString name;
QList<QString> *urls;
QList<QString> *names;
};
class CurrentMediaList : public MediaList{
Q_OBJECT
public:
CurrentMediaList(QString name);
enum WHO{Auto,User};
enum MODE{RAND,DEFAULT,LOOP};
void prev(CurrentMediaList::WHO who);
void next(CurrentMediaList::WHO who);
void setNextStrategy(CurrentMediaList::MODE mode);
int getCurrentMediaPos();
void onSelected(int pos);
protected:
bool isCurrentList(){return true;}
signals:
void currentPlayChanged(QString url,int pos,QString name);
private:
int currentPos;
NextStrategy *nextstr;
};
#endif // MEDIALIST