]> git.sur5r.net Git - minitube/blob - src/searchparams.h
New upstream version 3.1
[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     Q_OBJECT
28     Q_PROPERTY(int sortBy READ sortBy WRITE setSortBy)
29     Q_PROPERTY(int duration READ duration WRITE setDuration)
30     Q_PROPERTY(int quality READ quality WRITE setQuality)
31     Q_PROPERTY(int time READ time WRITE setTime)
32
33 public:
34     enum SortBy { SortByRelevance = 0, SortByNewest, SortByViewCount, SortByRating };
35
36     enum Duration { DurationAny = 0, DurationShort, DurationMedium, DurationLong };
37
38     enum Quality { QualityAny = 0, QualityHD };
39
40     enum Time { TimeAny = 0, TimeToday, TimeWeek, TimeMonth };
41
42     enum SafeSearch { None = 0, Moderate, Strict };
43
44     SearchParams(QObject *parent = nullptr);
45
46     const QString &keywords() const { return m_keywords; }
47     void setKeywords(const QString &keywords) { m_keywords = keywords; }
48
49     const QString &channelId() const { return m_channelId; }
50     void setChannelId(const QString &value) { m_channelId = value; }
51
52     int sortBy() const { return m_sortBy; }
53     void setSortBy(int sortBy) { m_sortBy = sortBy; }
54
55     int isTransient() const { return m_transient; }
56     void setTransient(int transient) { m_transient = transient; }
57
58     int duration() const { return m_duration; }
59     void setDuration(int duration) { m_duration = duration; }
60
61     int quality() const { return m_quality; }
62     void setQuality(int quality) { m_quality = quality; }
63
64     int time() const { return m_time; }
65     void setTime(int time) { m_time = time; }
66
67     uint publishedAfter() const { return m_publishedAfter; }
68     void setPublishedAfter(uint value) { m_publishedAfter = value; }
69
70     int safeSearch() const { return m_safeSearch; }
71     void setSafeSearch(int safeSearch) { m_safeSearch = safeSearch; }
72
73     bool operator==(const SearchParams &other) const {
74         return m_keywords == other.keywords() && m_channelId == other.channelId();
75     }
76
77 public slots:
78     void setParam(const QString &name, const QVariant &value);
79
80 private:
81     QString m_keywords;
82     QString m_channelId;
83     bool m_transient;
84     int m_sortBy;
85     int m_duration;
86     int m_quality;
87     int m_time;
88     uint m_publishedAfter;
89     int m_safeSearch;
90 };
91
92 #endif // SEARCHPARAMS_H