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 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();
108 void adjustWindowSize();
109 void maybeAdjustWindowSize();
113 void itemActivated(const QModelIndex &index);
114 void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
115 void activeRowChanged(int);
116 void selectVideos(QList<Video*> videos);
117 void gotStreamUrl(QUrl streamUrl);
118 void handleError(const QString &message);
121 void stateChanged(Phonon::State newState, Phonon::State oldState);
123 void aboutToFinish();
124 #ifdef APP_ACTIVATION
126 void updateContinueButton(int);
129 void downloadStatusChanged();
130 void playbackFinished();
131 void playbackResume();
132 void authorPushed(QModelIndex);
134 void sliderMoved(int value);
135 qint64 offsetToTime(qint64 offset);
136 void startDownloading();
137 void resumeWithNewStreamUrl(const QUrl &streamUrl);
140 MediaView(QWidget *parent = 0);
141 SearchParams* getSearchParams();
143 static QRegExp wordRE(const QString &s);
146 SidebarWidget *sidebar;
147 PlaylistView *playlistView;
148 PlaylistModel *playlistModel;
149 VideoAreaWidget *videoAreaWidget;
150 LoadingWidget *loadingWidget;
153 Phonon::MediaObject *mediaObject;
154 Phonon::VideoWidget *videoWidget;
160 QString currentVideoId;
162 #ifdef APP_ACTIVATION
166 DownloadItem *downloadItem;
167 QList<VideoSource*> history;
168 QList<QAction*> currentVideoActions;
170 qint64 currentVideoSize;
173 SnapshotSettings *snapshotSettings;
176 QElapsedTimer pauseTimer;
180 #endif // __MEDIAVIEW_H__