]> git.sur5r.net Git - minitube/blob - src/searchparams.h
Imported Upstream version 2.4
[minitube] / src / searchparams.h
1 /* $BEGIN_LICENSE
2
3 This file is part of Minitube.
4 Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
5
6 Minitube is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 Minitube is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with Minitube.  If not, see <http://www.gnu.org/licenses/>.
18
19 $END_LICENSE */
20
21 #ifndef SEARCHPARAMS_H
22 #define SEARCHPARAMS_H
23
24 #include <QtCore>
25
26 class SearchParams : public QObject {
27
28     Q_OBJECT
29     Q_PROPERTY(int sortBy READ sortBy WRITE setSortBy)
30     Q_PROPERTY(int duration READ duration WRITE setDuration)
31     Q_PROPERTY(int quality READ quality WRITE setQuality)
32     Q_PROPERTY(int time READ time WRITE setTime)
33
34 public:
35
36     enum SortBy {
37         SortByRelevance = 0,
38         SortByNewest,
39         SortByViewCount,
40         SortByRating
41     };
42
43     enum Duration {
44         DurationAny = 0,
45         DurationShort,
46         DurationMedium,
47         DurationLong
48     };
49
50     enum Quality {
51         QualityAny = 0,
52         QualityHD
53     };
54
55     enum Time {
56         TimeAny = 0,
57         TimeToday,
58         TimeWeek,
59         TimeMonth
60     };
61
62     SearchParams(QObject *parent = 0);
63
64     const QString keywords() const { return m_keywords; }
65     void setKeywords(const QString &keywords) { m_keywords = keywords; }
66
67     const QString channelId() const { return m_channelId; }
68     void setChannelId(const QString &value) { m_channelId = value; }
69
70     int sortBy() const { return m_sortBy; }
71     void setSortBy( int sortBy ) { m_sortBy = sortBy; }
72
73     int isTransient() const { return m_transient; }
74     void setTransient( int transient ) { m_transient = transient; }
75
76     int duration() const { return m_duration; }
77     void setDuration( int duration ) { m_duration = duration; }
78
79     int quality() const { return m_quality; }
80     void setQuality( int quality ) { m_quality = quality; }
81
82     int time() const { return m_time; }
83     void setTime( int time ) { m_time = time; }
84
85     uint publishedAfter() const { return m_publishedAfter; }
86     void setPublishedAfter(uint value) { m_publishedAfter = value; }
87
88     bool operator==(const SearchParams &other) const {
89         return m_keywords == other.keywords() &&
90                 m_channelId == other.channelId();
91     }
92
93 public slots:
94     void setParam(QString name, QVariant value);
95
96 private:
97     QString m_keywords;
98     QString m_channelId;
99     bool m_transient;
100     int m_sortBy;
101     int m_duration;
102     int m_quality;
103     int m_time;
104     uint m_publishedAfter;
105
106 };
107
108 #endif // SEARCHPARAMS_H