]> git.sur5r.net Git - minitube/blob - src/channelview.h
Imported Upstream version 2.3
[minitube] / src / channelview.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 CHANNELSVIEW_H
22 #define CHANNELSVIEW_H
23
24 #include <QtGui>
25 #if QT_VERSION >= 0x050000
26 #include <QtWidgets>
27 #endif
28 #include "view.h"
29
30 class VideoSource;
31 class ChannelModel;
32
33 class ChannelView : public QListView, public View {
34
35     Q_OBJECT
36
37 public:
38     ChannelView(QWidget *parent = 0);
39     
40 signals:
41     void activated(VideoSource *videoSource);
42
43 public slots:
44     void appear();
45     void disappear();
46
47 protected:
48     void mousePressEvent(QMouseEvent *event);
49     void mouseMoveEvent(QMouseEvent *event);
50     void leaveEvent(QEvent *event);
51     void paintEvent(QPaintEvent *event);
52
53 private:
54     enum SortBy {
55         SortByName = 0,
56         SortByAdded,
57         SortByUpdated,
58         SortByLastWatched,
59         SortByMostWatched
60     };
61
62 private slots:
63     void itemEntered(const QModelIndex &index);
64     void itemActivated(const QModelIndex &index);
65     void showContextMenu(const QPoint &point);
66     void toggleShowUpdated(bool enable);
67     void setSortBy(SortBy sortBy);
68     void setSortByName() { setSortBy(SortByName); }
69     void setSortByUpdated() { setSortBy(SortByUpdated); }
70     void setSortByAdded() { setSortBy(SortByAdded); }
71     void setSortByLastWatched() { setSortBy(SortByLastWatched); }
72     void setSortByMostWatched() { setSortBy(SortByMostWatched); }
73     void markAllAsWatched();
74     void unwatchedCountChanged(int count);
75     void updateQuery(bool transition = false);
76
77 private:
78     void setupActions();
79
80     ChannelModel *channelsModel;
81     QList<QAction*> statusActions;
82     bool showUpdated;
83     SortBy sortBy;
84     QString errorMessage;
85     QAction *markAsWatchedAction;
86
87 };
88
89 #endif // CHANNELSVIEW_H