root/src/episodelist.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
#ifndef SEASON_H
#define SEASON_H

#include <QList>
#include <N0Slib.h>
#include <QDir>
#include "episode.h"

class EpisodeList : public QObject
{
    Q_OBJECT
public:
    EpisodeList(QObject *parent = NULL);
    virtual ~EpisodeList();

    void exportXbmcLinks(QDir);
    void writeDetailed(nw::JsonWriter &jw, const QStringList& releaseGroupPreference) const;
    void writeAsElement(nw::JsonWriter& jw) const;
    void readAsElement(nw::JsonReader &jr);

    void addMovieFile(const VideoFile *movieFile); ///< this takes ownage
    void addEpisode(Episode* episode); ///< this takes ownage

    Episode* getEpisodeForNumber(float number);

    int numberOfEpisodes() const;
    int numberOfWatchedEpisodes() const;
    float highestWatchedEpisodeNumber(int min = -1) const;

    Episode* getEpisodeForPath(const QString &path);
    QString mostDownloadedReleaseGroup() const;
    QString favouriteReleaseGroup() const;
    float highestDownloadedEpisodeNumber() const;
    QStringList releaseGroups() const;

    // TODO
    // move stuff that uses this into this class
    QList<Episode*> episodes;
    void setMinimalWatched(int number);
    void setWatched(int number);
    void setMaximalWatched(int number);
    QList<const VideoFile*> missingFiles() const;

    bool removeFileFromList(QString filepath);
    bool hasNoFiles();
signals:
    void beforeWatchCountChanged(int newCount, int oldCount);
    void watchCountChanged(int oldCount, int newCount); // TODO new, old

private slots:
    void beforeWatchedChanged(bool newValue, bool oldValue);
    void watchedChanged(bool oldValue, bool newValue); // TODO new, old

private:
};

#endif // SEASON_H