]> git.sur5r.net Git - minitube/blob - src/mediaview.h
fallback to english categories
[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     QMap<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
41 public slots:
42     void search(SearchParams *searchParams);
43     void setVideoSource(VideoSource *videoSource, bool addToHistory = true);
44     void pause();
45     void stop();
46     void skip();
47     void skipBackward();
48     void skipVideo();
49     void openWebPage();
50     void copyWebPage();
51     void copyVideoLink();
52     void shareViaTwitter();
53     void shareViaFacebook();
54     void shareViaBuffer();
55     void shareViaEmail();
56     void removeSelected();
57     void moveUpSelected();
58     void moveDownSelected();
59     bool isPlaylistVisible();
60     void setPlaylistVisible(bool visible=true);
61     void saveSplitterState();
62     void downloadVideo();
63     void snapshot();
64     void fullscreen();
65     void findVideoParts();
66     void relatedVideos();
67     bool canGoBack();
68     void goBack();
69     bool canGoForward();
70     void goForward();
71
72 private slots:
73     // list/model
74     void itemActivated(const QModelIndex &index);
75     void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
76     void activeRowChanged(int);
77     void selectVideos(QList<Video*> videos);
78     void gotStreamUrl(QUrl streamUrl);
79     void handleError(QString message);
80     // phonon
81     void stateChanged(Phonon::State newState, Phonon::State oldState);
82     void currentSourceChanged(const Phonon::MediaSource source);
83     void aboutToFinish();
84 #ifdef APP_ACTIVATION
85     void demoMessage();
86     void updateContinueButton(int);
87 #endif
88     void startPlaying();
89     void downloadStatusChanged();
90     void playbackFinished();
91     void playbackResume();
92     void authorPushed(QModelIndex);
93     void searchAgain();
94
95     /*
96     void downloadProgress(int percent);
97     void sliderMoved(int value);
98     void seekTo(int value);
99     */
100
101 private:
102     MediaView(QWidget *parent = 0);
103     SearchParams* getSearchParams();
104     static QRegExp wordRE(QString s);
105
106     QSplitter *splitter;
107     SidebarWidget *sidebar;
108     PlaylistView *playlistView;
109     PlaylistModel *playlistModel;
110     VideoAreaWidget *videoAreaWidget;
111     LoadingWidget *loadingWidget;
112
113     // phonon
114     Phonon::MediaObject *mediaObject;
115     Phonon::VideoWidget *videoWidget;
116
117     bool reallyStopped;
118     QTimer *errorTimer;
119     Video *skippedVideo;
120
121 #ifdef APP_ACTIVATION
122     QTimer *demoTimer;
123 #endif
124
125     DownloadItem *downloadItem;
126     QList<VideoSource*> history;
127 };
128
129 #endif // __MEDIAVIEW_H__