]> git.sur5r.net Git - minitube/blob - src/MediaView.h
Imported Upstream version 1.9
[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 #include "ListModel.h"
11 #include "segmentedcontrol.h"
12 #include "searchparams.h"
13 #include "loadingwidget.h"
14 #include "videoareawidget.h"
15
16 class DownloadItem;
17 class PlaylistView;
18 class SidebarWidget;
19
20 namespace The {
21     QMap<QString, QAction*>* globalActions();
22 }
23
24 class MediaView : public QWidget, public View {
25     Q_OBJECT
26
27 public:
28     MediaView(QWidget *parent);
29     void initialize();
30
31     // View
32     void appear();
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(Phonon::SeekSlider *slider) { this->seekSlider = slider; }
45
46 public slots:
47     void search(SearchParams *searchParams);
48     void pause();
49     void stop();
50     void skip();
51     void skipBackward();
52     void skipVideo();
53     void openWebPage();
54     void copyWebPage();
55     void copyVideoLink();
56     void shareViaTwitter();
57     void shareViaFacebook();
58     void shareViaBuffer();
59     void shareViaEmail();
60     void removeSelected();
61     void moveUpSelected();
62     void moveDownSelected();
63     bool isPlaylistVisible();
64     void setPlaylistVisible(bool visible=true);
65     void saveSplitterState();
66     void downloadVideo();
67     void snapshot();
68     void fullscreen();
69     void findVideoParts();
70
71 private slots:
72     // list/model
73     void itemActivated(const QModelIndex &index);
74     void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
75     void activeRowChanged(int);
76     void selectVideos(QList<Video*> videos);
77     void gotStreamUrl(QUrl streamUrl);
78     void handleError(QString message);
79     // phonon
80     void stateChanged(Phonon::State newState, Phonon::State oldState);
81     void currentSourceChanged(const Phonon::MediaSource source);
82     void showVideoContextMenu(QPoint point);
83     void aboutToFinish();
84     // bar
85     void searchMostRelevant();
86     void searchMostRecent();
87     void searchMostViewed();
88     // timer
89     void timerPlay();
90 #ifdef APP_DEMO
91     void demoMessage();
92     void updateContinueButton(int);
93 #endif
94     void startPlaying();
95     void downloadStatusChanged();
96     void playbackFinished();
97     void playbackResume();
98     void authorPushed(QModelIndex);
99     void searchAgain();
100
101     /*
102     void downloadProgress(int percent);
103     void sliderMoved(int value);
104     void seekTo(int value);
105     */
106
107 private:
108     static QRegExp wordRE(QString s);
109
110     SearchParams *searchParams;
111
112     QSplitter *splitter;
113
114     SidebarWidget *sidebar;
115     PlaylistView *listView;
116     ListModel *listModel;
117
118     // sortBar
119     SegmentedControl *sortBar;
120     QAction *mostRelevantAction;
121     QAction *mostRecentAction;
122     QAction *mostViewedAction;
123
124     // phonon
125     Phonon::MediaObject *mediaObject;
126     Phonon::VideoWidget *videoWidget;
127     Phonon::SeekSlider *seekSlider;
128
129     // loadingWidget
130     VideoAreaWidget *videoAreaWidget;
131     LoadingWidget *loadingWidget;
132
133     bool timerPlayFlag;
134     bool reallyStopped;
135
136     QTimer *errorTimer;
137     QTimer *workaroundTimer;
138     Video *skippedVideo;
139
140 #ifdef APP_DEMO
141     QTimer *demoTimer;
142 #endif
143
144     DownloadItem *downloadItem;
145
146 };
147
148 #endif // __MEDIAVIEW_H__