]> git.sur5r.net Git - minitube/blob - src/MediaView.h
Imported Upstream version 1.6
[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 "thlibrary/thblackbar.h"
11 #include "searchparams.h"
12 #include "playlistwidget.h"
13 #include "loadingwidget.h"
14 #include "videoareawidget.h"
15
16 class DownloadItem;
17
18 namespace The {
19     QMap<QString, QAction*>* globalActions();
20 }
21
22 class MediaView : public QWidget, public View {
23     Q_OBJECT
24
25 public:
26     MediaView(QWidget *parent);
27     void initialize();
28
29     // View
30     void appear() {
31         listView->setFocus();
32     }
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(QSlider *slider);
45
46 public slots:
47     void search(SearchParams *searchParams);
48     void pause();
49     void stop();
50     void skip();
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
94     /*
95     void downloadProgress(int percent);
96     void sliderMoved(int value);
97     void seekTo(int value);
98     */
99
100 private:
101     static QRegExp wordRE(QString s);
102
103     SearchParams *searchParams;
104
105     QSplitter *splitter;
106
107     PlaylistWidget *playlistWidget;
108     QListView *listView;
109     ListModel *listModel;
110
111     // sortBar
112     THBlackBar *sortBar;
113     QAction *mostRelevantAction;
114     QAction *mostRecentAction;
115     QAction *mostViewedAction;
116
117     // phonon
118     Phonon::MediaObject *mediaObject;
119     Phonon::VideoWidget *videoWidget;
120
121     // loadingWidget
122     VideoAreaWidget *videoAreaWidget;
123     LoadingWidget *loadingWidget;
124
125     bool timerPlayFlag;
126     bool reallyStopped;
127
128     QTimer *errorTimer;
129     QTimer *workaroundTimer;
130     Video *skippedVideo;
131
132 #ifdef APP_DEMO
133     QTimer *demoTimer;
134 #endif
135
136     DownloadItem *downloadItem;
137     // QSlider *slider;
138
139 };
140
141 #endif // __MEDIAVIEW_H__