]> git.sur5r.net Git - minitube/blob - src/MediaView.h
Imported Upstream version 1.4.1
[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     void playbackFinished();
87     void playbackResume();
88
89     /*
90     void downloadProgress(int percent);
91     void sliderMoved(int value);
92     void seekTo(int value);
93     */
94
95 private:
96
97     SearchParams *searchParams;
98
99     QSplitter *splitter;
100
101     PlaylistWidget *playlistWidget;
102     QListView *listView;
103     ListModel *listModel;
104
105     // sortBar
106     THBlackBar *sortBar;
107     QAction *mostRelevantAction;
108     QAction *mostRecentAction;
109     QAction *mostViewedAction;
110
111     // phonon
112     Phonon::MediaObject *mediaObject;
113     Phonon::VideoWidget *videoWidget;
114
115     // loadingWidget
116     VideoAreaWidget *videoAreaWidget;
117     LoadingWidget *loadingWidget;
118
119     bool timerPlayFlag;
120     bool reallyStopped;
121
122     QTimer *errorTimer;
123     QTimer *workaroundTimer;
124     Video *skippedVideo;
125
126 #ifdef APP_DEMO
127     QTimer *demoTimer;
128 #endif
129
130     DownloadItem *downloadItem;
131     // QSlider *slider;
132
133 };
134
135 #endif // __MEDIAVIEW_H__