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__
27 #include <phonon/mediaobject.h>
28 #include <phonon/videowidget.h>
29 #include <phonon/seekslider.h>
37 class VideoAreaWidget;
43 class SnapshotSettings;
46 class MediaView : public View {
51 static MediaView* instance();
58 void setMediaObject(Phonon::MediaObject *mediaObject);
60 const QVector<VideoSource*> & getHistory() { return history; }
61 int getHistoryIndex();
62 PlaylistModel* getPlaylistModel() { return playlistModel; }
63 const QString &getCurrentVideoId();
64 void updateSubscriptionAction(Video *video, bool subscribed);
65 VideoAreaWidget* getVideoArea() { return videoAreaWidget; }
68 void search(SearchParams *searchParams);
69 void setVideoSource(VideoSource *videoSource, bool addToHistory = true, bool back = false);
79 void shareViaTwitter();
80 void shareViaFacebook();
82 void removeSelected();
83 void moveUpSelected();
84 void moveDownSelected();
85 bool isSidebarVisible();
86 void setSidebarVisibility(bool visible);
87 SidebarWidget *getSidebar() { return sidebar; }
89 void restoreSidebar();
90 void saveSplitterState();
96 void findVideoParts();
102 void toggleSubscription();
103 void adjustWindowSize();
107 void itemActivated(const QModelIndex &index);
108 void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
109 void activeRowChanged(int);
110 void selectVideos(const QVector<Video*> &videos);
111 void gotStreamUrl(QUrl streamUrl);
112 void handleError(const QString &message);
115 void stateChanged(Phonon::State newState, Phonon::State oldState);
117 void aboutToFinish();
119 void downloadStatusChanged();
120 void playbackFinished();
121 void playbackResume();
122 void authorPushed(QModelIndex);
124 void sliderMoved(int value);
125 qint64 offsetToTime(qint64 offset);
126 void startDownloading();
127 void resumeWithNewStreamUrl(const QUrl &streamUrl);
130 MediaView(QWidget *parent = 0);
131 SearchParams* getSearchParams();
133 static QRegExp wordRE(const QString &s);
136 SidebarWidget *sidebar;
137 PlaylistView *playlistView;
138 PlaylistModel *playlistModel;
139 VideoAreaWidget *videoAreaWidget;
140 LoadingWidget *loadingWidget;
143 Phonon::MediaObject *mediaObject;
144 Phonon::VideoWidget *videoWidget;
150 QString currentVideoId;
152 #ifdef APP_ACTIVATION
156 DownloadItem *downloadItem;
157 QVector<VideoSource*> history;
158 QVector<QAction*> currentVideoActions;
160 qint64 currentVideoSize;
163 SnapshotSettings *snapshotSettings;
166 QElapsedTimer pauseTimer;
170 #endif // __MEDIAVIEW_H__