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