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/>.
40 class SnapshotSettings;
43 class MediaView : public View {
47 static MediaView *instance();
53 void setMedia(Media *media);
54 const QVector<VideoSource *> &getHistory() { return history; }
55 int getHistoryIndex();
56 PlaylistModel *getPlaylistModel() { return playlistModel; }
57 const QString &getCurrentVideoId();
58 void updateSubscriptionActionForVideo(Video *video, bool subscribed);
59 void updateSubscriptionActionForChannel(const QString & channelId);
60 VideoArea *getVideoArea() { return videoAreaWidget; }
61 void reloadCurrentVideo();
64 void search(SearchParams *searchParams);
65 void setVideoSource(VideoSource *videoSource, bool addToHistory = true, bool back = false);
75 void shareViaTwitter();
76 void shareViaFacebook();
78 void removeSelected();
79 void moveUpSelected();
80 void moveDownSelected();
81 bool isSidebarVisible();
82 void setSidebarVisibility(bool visible);
83 SidebarWidget *getSidebar() { return sidebar; }
85 void restoreSidebar();
86 void saveSplitterState();
92 void findVideoParts();
98 void toggleSubscription();
99 void adjustWindowSize();
100 void updateSubscriptionAction(bool subscribed);
103 void onItemActivated(const QModelIndex &index);
104 void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
105 void activeVideoChanged(Video *video, Video *previousVideo);
106 void selectVideos(const QVector<Video *> &videos);
107 void gotStreamUrl(const QString &streamUrl, const QString &audioUrl);
108 void handleError(const QString &message);
109 void mediaStateChanged(Media::State state);
110 void onAboutToFinish();
111 void onPlaybackFinished();
112 void resumePlayback();
113 void onAuthorPushed(QModelIndex);
115 void resumeWithNewStreamUrl(const QString &streamUrl, const QString &audioUrl);
118 MediaView(QWidget *parent = nullptr);
119 SearchParams *getSearchParams();
121 static QRegExp wordRE(const QString &s);
124 SidebarWidget *sidebar;
125 PlaylistView *playlistView;
126 PlaylistModel *playlistModel;
127 VideoArea *videoAreaWidget;
128 LoadingWidget *loadingWidget;
131 QWidget *videoWidget;
136 QString currentVideoId;
138 QString currentSubscriptionChannelId;
139 QString currentSubscriptionChannelTitle;
141 #ifdef APP_ACTIVATION
145 QVector<VideoSource *> history;
146 QVector<QAction *> currentVideoActions;
147 QVector<QAction *> playingVideoActions;
149 qint64 currentVideoSize;
152 SnapshotSettings *snapshotSettings;
155 QElapsedTimer pauseTimer;
159 #endif // MEDIAVIEW_H