]> git.sur5r.net Git - minitube/blobdiff - src/downloaditem.h
Refresh patches
[minitube] / src / downloaditem.h
index 1d6b1f19874899a89da272346574af81bd4019f3..bb9245f4ec615452d2f074ebd2499c17eb06eb7b 100644 (file)
@@ -20,21 +20,26 @@ class DownloadItem : public QObject {
 
 signals:
     void statusChanged();
+    void bufferProgress(int percent);
     void progress(int percent);
     void finished();
+    void error(QString);
 
 public:
     DownloadItem(Video *video, QUrl url, QString filename, QObject *parent = 0);
+    ~DownloadItem();
     qint64 bytesTotal() const;
     qint64 bytesReceived() const;
     double remainingTime() const;
+    double totalTime() { return m_totalTime; }
     double currentSpeed() const;
     int currentPercent() const { return percent; }
     Video* getVideo() const { return video; }
+    QString currentFilename() const { return m_file.fileName(); }
     DownloadItemStatus status() const { return m_status; }
     static QString formattedFilesize(qint64 size);
     static QString formattedSpeed(double speed);
-    static QString formattedTime(double time);
+    static QString formattedTime(double time, bool remaining = true);
     QString errorMessage() const;
 
 public slots:
@@ -50,9 +55,12 @@ private slots:
     void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
     void metaDataChanged();
     void requestFinished();
+    void gotStreamUrl(QUrl streamUrl);
+    void speedCheck();
 
 private:
     void init();
+    int initialBufferSize();
 
     qint64 m_bytesReceived;
     QTime m_downloadTime;
@@ -60,6 +68,7 @@ private:
     bool m_finishedDownloading;
     QTime m_lastProgressTime;
     int percent;
+    double m_totalTime;
 
     QUrl m_url;
 
@@ -70,6 +79,8 @@ private:
     DownloadItemStatus m_status;
     QString m_errorMessage;
 
+    QTimer *speedCheckTimer;
+
 };
 
 // This is required in order to use QPointer<DownloadItem> as a QVariant