$END_LICENSE */
-#ifndef __MEDIAVIEW_H__
-#define __MEDIAVIEW_H__
+#ifndef MEDIAVIEW_H
+#define MEDIAVIEW_H
-#include <QtWidgets>
#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;
#endif
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 QVector<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 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(const QVector<Video*> &videos);
- void gotStreamUrl(QUrl streamUrl);
+ 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);
- // phonon
-#ifdef APP_PHONON
- void stateChanged(Phonon::State newState, Phonon::State oldState);
-#endif
- void aboutToFinish();
- void startPlaying();
- void downloadStatusChanged();
- void playbackFinished();
- void playbackResume();
- void authorPushed(QModelIndex);
+ 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 QUrl &streamUrl);
+ void resumeWithNewStreamUrl(const QString &streamUrl, const QString &audioUrl);
private:
- MediaView(QWidget *parent = 0);
- SearchParams* getSearchParams();
+ MediaView(QWidget *parent = nullptr);
+ SearchParams *getSearchParams();
static QRegExp wordRE(const QString &s);
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;
- QVector<VideoSource*> history;
- QVector<QAction*> currentVideoActions;
+ QVector<VideoSource *> history;
+ QVector<QAction *> currentVideoActions;
+ QVector<QAction *> playingVideoActions;
qint64 currentVideoSize;
qint64 pauseTime;
};
-#endif // __MEDIAVIEW_H__
+#endif // MEDIAVIEW_H