3 This file is part of Minitube.
4 Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
6 Minitube is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 Minitube is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with Minitube. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef __MEDIAVIEW_H__
22 #define __MEDIAVIEW_H__
25 #if QT_VERSION >= 0x050000
30 #include <phonon/mediaobject.h>
31 #include <phonon/videowidget.h>
32 #include <phonon/seekslider.h>
40 class VideoAreaWidget;
46 class SnapshotSettings;
50 QHash<QString, QAction*>* globalActions();
53 class MediaView : public QWidget, public View {
58 static MediaView* instance();
65 void setMediaObject(Phonon::MediaObject *mediaObject);
67 const QList<VideoSource*> & getHistory() { return history; }
68 int getHistoryIndex();
69 PlaylistModel* getPlaylistModel() { return playlistModel; }
70 const QString &getCurrentVideoId();
71 void updateSubscriptionAction(Video *video, bool subscribed);
72 VideoAreaWidget* getVideoArea() { return videoAreaWidget; }
75 void search(SearchParams *searchParams);
76 void setVideoSource(VideoSource *videoSource, bool addToHistory = true, bool back = false);
86 void shareViaTwitter();
87 void shareViaFacebook();
88 void shareViaBuffer();
90 void removeSelected();
91 void moveUpSelected();
92 void moveDownSelected();
93 bool isPlaylistVisible();
94 void setPlaylistVisible(bool visible=true);
95 void saveSplitterState();
101 void findVideoParts();
102 void relatedVideos();
107 void toggleSubscription();
111 void itemActivated(const QModelIndex &index);
112 void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
113 void activeRowChanged(int);
114 void selectVideos(QList<Video*> videos);
115 void gotStreamUrl(QUrl streamUrl);
116 void handleError(const QString &message);
119 void stateChanged(Phonon::State newState, Phonon::State oldState);
121 void aboutToFinish();
122 #ifdef APP_ACTIVATION
124 void updateContinueButton(int);
127 void downloadStatusChanged();
128 void playbackFinished();
129 void playbackResume();
130 void authorPushed(QModelIndex);
132 void sliderMoved(int value);
133 qint64 offsetToTime(qint64 offset);
134 void startDownloading();
137 MediaView(QWidget *parent = 0);
138 SearchParams* getSearchParams();
140 static QRegExp wordRE(const QString &s);
143 SidebarWidget *sidebar;
144 PlaylistView *playlistView;
145 PlaylistModel *playlistModel;
146 VideoAreaWidget *videoAreaWidget;
147 LoadingWidget *loadingWidget;
150 Phonon::MediaObject *mediaObject;
151 Phonon::VideoWidget *videoWidget;
157 QString currentVideoId;
159 #ifdef APP_ACTIVATION
163 DownloadItem *downloadItem;
164 QList<VideoSource*> history;
165 QList<QAction*> currentVideoActions;
167 qint64 currentVideoSize;
170 SnapshotSettings *snapshotSettings;
174 #endif // __MEDIAVIEW_H__