]> git.sur5r.net Git - minitube/blob - src/mediaview.h
Imported Upstream version 2.0
[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 <phonon/seekslider.h>
9 #include "view.h"
10
11 class Video;
12 class PlaylistModel;
13 class SearchParams;
14 class LoadingWidget;
15 class VideoAreaWidget;
16 class DownloadItem;
17 class PlaylistView;
18 class SidebarWidget;
19 class VideoSource;
20
21 namespace The {
22     QHash<QString, QAction*>* globalActions();
23 }
24
25 class MediaView : public QWidget, public View {
26
27     Q_OBJECT
28
29 public:
30     static MediaView* instance();
31     void initialize();
32
33     void appear();
34     void disappear();
35
36     void setMediaObject(Phonon::MediaObject *mediaObject);
37     const QList<VideoSource*> & getHistory() { return history; }
38     int getHistoryIndex();
39     PlaylistModel* getPlaylistModel() { return playlistModel; }
40     Video* getCurrentVideo();
41
42 public slots:
43     void search(SearchParams *searchParams);
44     void setVideoSource(VideoSource *videoSource, bool addToHistory = true);
45     void pause();
46     void stop();
47     void skip();
48     void skipBackward();
49     void skipVideo();
50     void openWebPage();
51     void copyWebPage();
52     void copyVideoLink();
53     void shareViaTwitter();
54     void shareViaFacebook();
55     void shareViaBuffer();
56     void shareViaEmail();
57     void removeSelected();
58     void moveUpSelected();
59     void moveDownSelected();
60     bool isPlaylistVisible();
61     void setPlaylistVisible(bool visible=true);
62     void saveSplitterState();
63     void downloadVideo();
64     void snapshot();
65     void fullscreen();
66     void findVideoParts();
67     void relatedVideos();
68     bool canGoBack();
69     void goBack();
70     bool canGoForward();
71     void goForward();
72
73 private slots:
74     // list/model
75     void itemActivated(const QModelIndex &index);
76     void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
77     void activeRowChanged(int);
78     void selectVideos(QList<Video*> videos);
79     void gotStreamUrl(QUrl streamUrl);
80     void handleError(QString message);
81     // phonon
82     void stateChanged(Phonon::State newState, Phonon::State oldState);
83     void currentSourceChanged(const Phonon::MediaSource source);
84     void aboutToFinish();
85 #ifdef APP_ACTIVATION
86     void demoMessage();
87     void updateContinueButton(int);
88 #endif
89     void startPlaying();
90     void downloadStatusChanged();
91     void playbackFinished();
92     void playbackResume();
93     void authorPushed(QModelIndex);
94     void searchAgain();
95
96     /*
97     void downloadProgress(int percent);
98     void sliderMoved(int value);
99     void seekTo(int value);
100     */
101
102 private:
103     MediaView(QWidget *parent = 0);
104     SearchParams* getSearchParams();
105     static QRegExp wordRE(QString s);
106
107     QSplitter *splitter;
108     SidebarWidget *sidebar;
109     PlaylistView *playlistView;
110     PlaylistModel *playlistModel;
111     VideoAreaWidget *videoAreaWidget;
112     LoadingWidget *loadingWidget;
113
114     // phonon
115     Phonon::MediaObject *mediaObject;
116     Phonon::VideoWidget *videoWidget;
117
118     bool reallyStopped;
119     QTimer *errorTimer;
120     Video *skippedVideo;
121
122 #ifdef APP_ACTIVATION
123     QTimer *demoTimer;
124 #endif
125
126     DownloadItem *downloadItem;
127     QList<VideoSource*> history;
128 };
129
130 #endif // __MEDIAVIEW_H__