$END_LICENSE */
-#ifndef __MEDIAVIEW_H__
-#define __MEDIAVIEW_H__
+#ifndef MEDIAVIEW_H
+#define MEDIAVIEW_H
-#include <QtGui>
-#if QT_VERSION >= 0x050000
-#include <QtWidgets>
-#endif
#include <QtNetwork>
-#ifdef APP_PHONON
-#include <phonon/mediaobject.h>
-#include <phonon/videowidget.h>
-#include <phonon/seekslider.h>
-#endif
+#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;
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();
-#ifdef APP_PHONON
- void setMediaObject(Phonon::MediaObject *mediaObject);
-#endif
- const QList<VideoSource*> & getHistory() { return history; }
+ void setMedia(Media *media);
+ const QVector<VideoSource *> &getHistory() { return history; }
int getHistoryIndex();
- PlaylistModel* getPlaylistModel() { return playlistModel; }
+ PlaylistModel *getPlaylistModel() { return playlistModel; }
const QString &getCurrentVideoId();
- void updateSubscriptionAction(Video *video, bool subscribed);
- VideoAreaWidget* getVideoArea() { return videoAreaWidget; }
+ void updateSubscriptionActionForVideo(Video *video, bool subscribed);
+ void updateSubscriptionActionForChannel(const QString & channelId);
+ VideoArea *getVideoArea() { return videoAreaWidget; }
+ void reloadCurrentVideo();
public slots:
void search(SearchParams *searchParams);
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
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
-#ifdef APP_PHONON
- void stateChanged(Phonon::State newState, Phonon::State oldState);
-#endif
- 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 sliderMoved(int value);
- qint64 offsetToTime(qint64 offset);
- void startDownloading();
+ void resumeWithNewStreamUrl(const QString &streamUrl, const QString &audioUrl);
private:
- MediaView(QWidget *parent = 0);
- SearchParams* getSearchParams();
+ MediaView(QWidget *parent = nullptr);
+ SearchParams *getSearchParams();
- static QRegExp wordRE(QString s);
+ static QRegExp wordRE(const QString &s);
QSplitter *splitter;
SidebarWidget *sidebar;
PlaylistView *playlistView;
PlaylistModel *playlistModel;
- VideoAreaWidget *videoAreaWidget;
+ VideoArea *videoAreaWidget;
LoadingWidget *loadingWidget;
-#ifdef APP_PHONON
- Phonon::MediaObject *mediaObject;
- Phonon::VideoWidget *videoWidget;
-#endif
+ Media *media;
+ QWidget *videoWidget;
bool stopped;
QTimer *errorTimer;
Video *skippedVideo;
QString currentVideoId;
+ QString currentSubscriptionChannelId;
+ QString currentSubscriptionChannelTitle;
+
#ifdef APP_ACTIVATION
QTimer *demoTimer;
#endif
- DownloadItem *downloadItem;
- QList<VideoSource*> history;
- QList<QAction*> currentVideoActions;
+ QVector<VideoSource *> history;
+ QVector<QAction *> currentVideoActions;
qint64 currentVideoSize;
#ifdef APP_SNAPSHOT
SnapshotSettings *snapshotSettings;
#endif
+
+ QElapsedTimer pauseTimer;
+ qint64 pauseTime;
};
-#endif // __MEDIAVIEW_H__
+#endif // MEDIAVIEW_H