]> git.sur5r.net Git - minitube/blobdiff - src/mediaview.h
Imported Upstream version 2.3
[minitube] / src / mediaview.h
index 8277707e4a4be3f26df1fc86c045c2e0cb9323fd..84146d7d2e105918b4ec832682fcdd79eb7111ea 100644 (file)
@@ -1,11 +1,36 @@
+/* $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>
+#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 "view.h"
 
 class Video;
@@ -17,9 +42,12 @@ class DownloadItem;
 class PlaylistView;
 class SidebarWidget;
 class VideoSource;
+#ifdef APP_SNAPSHOT
+class SnapshotSettings;
+#endif
 
 namespace The {
-    QHash<QString, QAction*>* globalActions();
+QHash<QString, QAction*>* globalActions();
 }
 
 class MediaView : public QWidget, public View {
@@ -33,15 +61,19 @@ public:
     void appear();
     void disappear();
 
+#ifdef APP_PHONON
     void setMediaObject(Phonon::MediaObject *mediaObject);
+#endif
     const QList<VideoSource*> & getHistory() { return history; }
     int getHistoryIndex();
     PlaylistModel* getPlaylistModel() { return playlistModel; }
-    Video* getCurrentVideo();
+    const QString &getCurrentVideoId();
+    void updateSubscriptionAction(Video *video, bool subscribed);
+    VideoAreaWidget* getVideoArea() { return videoAreaWidget; }
 
 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();
@@ -50,6 +82,7 @@ public slots:
     void openWebPage();
     void copyWebPage();
     void copyVideoLink();
+    void openInBrowser();
     void shareViaTwitter();
     void shareViaFacebook();
     void shareViaBuffer();
@@ -61,7 +94,9 @@ public slots:
     void setPlaylistVisible(bool visible=true);
     void saveSplitterState();
     void downloadVideo();
+#ifdef APP_SNAPSHOT
     void snapshot();
+#endif
     void fullscreen();
     void findVideoParts();
     void relatedVideos();
@@ -69,6 +104,7 @@ public slots:
     void goBack();
     bool canGoForward();
     void goForward();
+    void toggleSubscription();
 
 private slots:
     // list/model
@@ -79,8 +115,9 @@ private slots:
     void gotStreamUrl(QUrl streamUrl);
     void handleError(QString message);
     // phonon
+#ifdef APP_PHONON
     void stateChanged(Phonon::State newState, Phonon::State oldState);
-    void currentSourceChanged(const Phonon::MediaSource source);
+#endif
     void aboutToFinish();
 #ifdef APP_ACTIVATION
     void demoMessage();
@@ -92,16 +129,14 @@ private slots:
     void playbackResume();
     void authorPushed(QModelIndex);
     void searchAgain();
-
-    /*
-    void downloadProgress(int percent);
     void sliderMoved(int value);
-    void seekTo(int value);
-    */
+    qint64 offsetToTime(qint64 offset);
+    void startDownloading();
 
 private:
     MediaView(QWidget *parent = 0);
     SearchParams* getSearchParams();
+
     static QRegExp wordRE(QString s);
 
     QSplitter *splitter;
@@ -111,13 +146,15 @@ private:
     VideoAreaWidget *videoAreaWidget;
     LoadingWidget *loadingWidget;
 
-    // phonon
+#ifdef APP_PHONON
     Phonon::MediaObject *mediaObject;
     Phonon::VideoWidget *videoWidget;
+#endif
 
-    bool reallyStopped;
+    bool stopped;
     QTimer *errorTimer;
     Video *skippedVideo;
+    QString currentVideoId;
 
 #ifdef APP_ACTIVATION
     QTimer *demoTimer;
@@ -125,6 +162,13 @@ private:
 
     DownloadItem *downloadItem;
     QList<VideoSource*> history;
+    QList<QAction*> currentVideoActions;
+
+    qint64 currentVideoSize;
+
+#ifdef APP_SNAPSHOT
+    SnapshotSettings *snapshotSettings;
+#endif
 };
 
 #endif // __MEDIAVIEW_H__