]> git.sur5r.net Git - minitube/blob - src/MediaView.h
f61799a7806ac4072fd4dc95ecf827337e1fdb2a
[minitube] / src / MediaView.h
1 #ifndef __MEDIAVIEW_H__
2 #define __MEDIAVIEW_H__
3
4 #include <QtGui>
5 #include <QtNetwork>
6 #include <phonon/mediaobject.h>
7 #include <phonon/videowidget.h>
8 #include "View.h"
9 #include "ListModel.h"
10 #include "thlibrary/thblackbar.h"
11 #include "searchparams.h"
12 #include "playlistwidget.h"
13 #include "loadingwidget.h"
14 #include "videoareawidget.h"
15
16 class DownloadItem;
17
18 namespace The {
19     QMap<QString, QAction*>* globalActions();
20 }
21
22 class MediaView : public QWidget, public View {
23     Q_OBJECT
24
25 public:
26     MediaView(QWidget *parent);
27     void initialize();
28
29     // View
30     void appear() {
31         listView->setFocus();
32     }
33     void disappear();
34     QMap<QString, QVariant> metadata() {
35         QMap<QString, QVariant> metadata;
36         if (searchParams) {
37             metadata.insert("title", "");
38             metadata.insert("description", "");
39         }
40         return metadata;
41     }
42
43     void setMediaObject(Phonon::MediaObject *mediaObject);
44     void setSlider(QSlider *slider);
45
46 public slots:
47     void search(SearchParams *searchParams);
48     void pause();
49     void stop();
50     void skip();
51     void skipVideo();
52     void openWebPage();
53     void copyWebPage();
54     void copyVideoLink();
55     void removeSelected();
56     void moveUpSelected();
57     void moveDownSelected();
58     void setPlaylistVisible(bool visible=true);
59     void saveSplitterState();
60     void downloadVideo();
61     void fullscreen();
62
63 private slots:
64     // list/model
65     void itemActivated(const QModelIndex &index);
66     void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
67     void activeRowChanged(int);
68     void selectVideos(QList<Video*> videos);
69     void gotStreamUrl(QUrl streamUrl);
70     void handleError(QString message);
71     // phonon
72     void stateChanged(Phonon::State newState, Phonon::State oldState);
73     void currentSourceChanged(const Phonon::MediaSource source);
74     void showVideoContextMenu(QPoint point);
75     // bar
76     void searchMostRelevant();
77     void searchMostRecent();
78     void searchMostViewed();
79     // timer
80     void timerPlay();
81 #ifdef APP_DEMO
82     void demoMessage();
83 #endif
84     void startPlaying();
85     void downloadStatusChanged();
86
87     /*
88     void downloadProgress(int percent);
89     void sliderMoved(int value);
90     void seekTo(int value);
91     */
92
93 private:
94
95     SearchParams *searchParams;
96
97     QSplitter *splitter;
98
99     PlaylistWidget *playlistWidget;
100     QListView *listView;
101     ListModel *listModel;
102
103     // sortBar
104     THBlackBar *sortBar;
105     QAction *mostRelevantAction;
106     QAction *mostRecentAction;
107     QAction *mostViewedAction;
108
109     // phonon
110     Phonon::MediaObject *mediaObject;
111     Phonon::VideoWidget *videoWidget;
112
113     // loadingWidget
114     VideoAreaWidget *videoAreaWidget;
115     LoadingWidget *loadingWidget;
116
117     bool timerPlayFlag;
118     bool reallyStopped;
119
120     QTimer *errorTimer;
121     QTimer *workaroundTimer;
122     Video *skippedVideo;
123
124 #ifdef APP_DEMO
125     QTimer *demoTimer;
126 #endif
127
128     DownloadItem *downloadItem;
129     // QSlider *slider;
130
131 };
132
133 #endif // __MEDIAVIEW_H__