]> git.sur5r.net Git - minitube/blob - src/MediaView.h
8bf2c8d075dac249cacf71fe27126942fd0b277e
[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 "playlistwidget.h"
14 #include "loadingwidget.h"
15 #include "videoareawidget.h"
16
17 class DownloadItem;
18 class PlaylistView;
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 shareViaEmail();
59     void removeSelected();
60     void moveUpSelected();
61     void moveDownSelected();
62     void setPlaylistVisible(bool visible=true);
63     void saveSplitterState();
64     void downloadVideo();
65     void fullscreen();
66     void findVideoParts();
67
68 private slots:
69     // list/model
70     void itemActivated(const QModelIndex &index);
71     void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
72     void activeRowChanged(int);
73     void selectVideos(QList<Video*> videos);
74     void gotStreamUrl(QUrl streamUrl);
75     void handleError(QString message);
76     // phonon
77     void stateChanged(Phonon::State newState, Phonon::State oldState);
78     void currentSourceChanged(const Phonon::MediaSource source);
79     void showVideoContextMenu(QPoint point);
80     void aboutToFinish();
81     // bar
82     void searchMostRelevant();
83     void searchMostRecent();
84     void searchMostViewed();
85     // timer
86     void timerPlay();
87 #ifdef APP_DEMO
88     void demoMessage();
89     void updateContinueButton(int);
90 #endif
91     void startPlaying();
92     void downloadStatusChanged();
93     void playbackFinished();
94     void playbackResume();
95     void authorPushed(QModelIndex);
96
97     /*
98     void downloadProgress(int percent);
99     void sliderMoved(int value);
100     void seekTo(int value);
101     */
102
103 private:
104     static QRegExp wordRE(QString s);
105
106     SearchParams *searchParams;
107
108     QSplitter *splitter;
109
110     PlaylistWidget *playlistWidget;
111     PlaylistView *listView;
112     ListModel *listModel;
113
114     // sortBar
115     SegmentedControl *sortBar;
116     QAction *mostRelevantAction;
117     QAction *mostRecentAction;
118     QAction *mostViewedAction;
119
120     // phonon
121     Phonon::MediaObject *mediaObject;
122     Phonon::VideoWidget *videoWidget;
123     Phonon::SeekSlider *seekSlider;
124
125     // loadingWidget
126     VideoAreaWidget *videoAreaWidget;
127     LoadingWidget *loadingWidget;
128
129     bool timerPlayFlag;
130     bool reallyStopped;
131
132     QTimer *errorTimer;
133     QTimer *workaroundTimer;
134     Video *skippedVideo;
135
136 #ifdef APP_DEMO
137     QTimer *demoTimer;
138 #endif
139
140     DownloadItem *downloadItem;
141
142 };
143
144 #endif // __MEDIAVIEW_H__