-#ifndef __MEDIAVIEW_H__
-#define __MEDIAVIEW_H__
+/* $BEGIN_LICENSE
+
+This file is part of Minitube.
+Copyright 2009, Flavio Tordini <flavio.tordini@gmail.com>
+
+Minitube is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Minitube is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Minitube. If not, see <http://www.gnu.org/licenses/>.
+
+$END_LICENSE */
+
+#ifndef MEDIAVIEW_H
+#define MEDIAVIEW_H
-#include <QtGui>
#include <QtNetwork>
-#include <phonon/mediaobject.h>
-#include <phonon/videowidget.h>
-#include <phonon/seekslider.h>
+#include <QtWidgets>
+
+#include "media.h"
+
#include "view.h"
class Video;
class PlaylistModel;
class SearchParams;
class LoadingWidget;
-class VideoAreaWidget;
-class DownloadItem;
+class VideoArea;
class PlaylistView;
class SidebarWidget;
class VideoSource;
+#ifdef APP_SNAPSHOT
+class SnapshotSettings;
+#endif
-namespace The {
- QHash<QString, QAction*>* globalActions();
-}
-
-class MediaView : public QWidget, public View {
-
+class MediaView : public View {
Q_OBJECT
public:
- static MediaView* instance();
+ static MediaView *instance();
void initialize();
void appear();
void disappear();
- void setMediaObject(Phonon::MediaObject *mediaObject);
- const QList<VideoSource*> & getHistory() { return history; }
+ void setMedia(Media *media);
+ const QVector<VideoSource *> &getHistory() { return history; }
int getHistoryIndex();
- PlaylistModel* getPlaylistModel() { return playlistModel; }
- Video* getCurrentVideo();
+ PlaylistModel *getPlaylistModel() { return playlistModel; }
+ const QString &getCurrentVideoId();
+ void updateSubscriptionActionForVideo(Video *video, bool subscribed);
+ void updateSubscriptionActionForChannel(const QString & channelId);
+ VideoArea *getVideoArea() { return videoAreaWidget; }
+ void reloadCurrentVideo();
public slots:
void search(SearchParams *searchParams);
- void setVideoSource(VideoSource *videoSource, bool addToHistory = true);
+ void setVideoSource(VideoSource *videoSource, bool addToHistory = true, bool back = false);
void pause();
void stop();
void skip();
void openWebPage();
void copyWebPage();
void copyVideoLink();
+ void openInBrowser();
void shareViaTwitter();
void shareViaFacebook();
- void shareViaBuffer();
void shareViaEmail();
void removeSelected();
void moveUpSelected();
void moveDownSelected();
- bool isPlaylistVisible();
- void setPlaylistVisible(bool visible=true);
+ bool isSidebarVisible();
+ void setSidebarVisibility(bool visible);
+ SidebarWidget *getSidebar() { return sidebar; }
+ void removeSidebar();
+ void restoreSidebar();
void saveSplitterState();
void downloadVideo();
+#ifdef APP_SNAPSHOT
void snapshot();
+#endif
void fullscreen();
void findVideoParts();
void relatedVideos();
void goBack();
bool canGoForward();
void goForward();
+ void toggleSubscription();
+ void adjustWindowSize();
+ void updateSubscriptionAction(bool subscribed);
private slots:
- // list/model
- void itemActivated(const QModelIndex &index);
- void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
- void activeRowChanged(int);
- void selectVideos(QList<Video*> videos);
- void gotStreamUrl(QUrl streamUrl);
- void handleError(QString message);
- // phonon
- void stateChanged(Phonon::State newState, Phonon::State oldState);
- void currentSourceChanged(const Phonon::MediaSource source);
- void aboutToFinish();
-#ifdef APP_ACTIVATION
- void demoMessage();
- void updateContinueButton(int);
-#endif
- void startPlaying();
- void downloadStatusChanged();
- void playbackFinished();
- void playbackResume();
- void authorPushed(QModelIndex);
+ void onItemActivated(const QModelIndex &index);
+ void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
+ void activeVideoChanged(Video *video, Video *previousVideo);
+ void selectVideos(const QVector<Video *> &videos);
+ void gotStreamUrl(const QString &streamUrl, const QString &audioUrl);
+ void handleError(const QString &message);
+ void mediaStateChanged(Media::State state);
+ void onAboutToFinish();
+ void onPlaybackFinished();
+ void resumePlayback();
+ void onAuthorPushed(QModelIndex);
void searchAgain();
-
- /*
- void downloadProgress(int percent);
- void sliderMoved(int value);
- void seekTo(int value);
- */
+ void resumeWithNewStreamUrl(const QString &streamUrl, const QString &audioUrl);
private:
- MediaView(QWidget *parent = 0);
- SearchParams* getSearchParams();
- static QRegExp wordRE(QString s);
+ MediaView(QWidget *parent = nullptr);
+ SearchParams *getSearchParams();
+
+ static QRegExp wordRE(const QString &s);
QSplitter *splitter;
SidebarWidget *sidebar;
PlaylistView *playlistView;
PlaylistModel *playlistModel;
- VideoAreaWidget *videoAreaWidget;
+ VideoArea *videoAreaWidget;
LoadingWidget *loadingWidget;
- // phonon
- Phonon::MediaObject *mediaObject;
- Phonon::VideoWidget *videoWidget;
+ Media *media;
+ QWidget *videoWidget;
- bool reallyStopped;
+ bool stopped;
QTimer *errorTimer;
Video *skippedVideo;
+ QString currentVideoId;
+
+ QString currentSubscriptionChannelId;
+ QString currentSubscriptionChannelTitle;
#ifdef APP_ACTIVATION
QTimer *demoTimer;
#endif
- DownloadItem *downloadItem;
- QList<VideoSource*> history;
+ QVector<VideoSource *> history;
+ QVector<QAction *> currentVideoActions;
+ QVector<QAction *> playingVideoActions;
+
+ qint64 currentVideoSize;
+
+#ifdef APP_SNAPSHOT
+ SnapshotSettings *snapshotSettings;
+#endif
+
+ QElapsedTimer pauseTimer;
+ qint64 pauseTime;
};
-#endif // __MEDIAVIEW_H__
+#endif // MEDIAVIEW_H