X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fdownloaditem.h;h=2c074f0c1d7a4076dd26df647ee40e6e114f2b65;hb=fe9d17324e88a65d4f28afccf21857c5a5e60649;hp=58bb49353e87d5dbbb5c567df9c461d2820d079d;hpb=d1f0fac328bdf71b840ac6ac9f6fed8f324d02bb;p=minitube diff --git a/src/downloaditem.h b/src/downloaditem.h index 58bb493..2c074f0 100644 --- a/src/downloaditem.h +++ b/src/downloaditem.h @@ -1,3 +1,23 @@ +/* $BEGIN_LICENSE + +This file is part of Minitube. +Copyright 2009, Flavio Tordini + +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 . + +$END_LICENSE */ + #ifndef DOWNLOADITEM_H #define DOWNLOADITEM_H @@ -31,6 +51,7 @@ public: 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; } @@ -38,8 +59,13 @@ public: 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; + qint64 offset() const { return m_offset; } + bool needsDownload(qint64 offset); + bool isBuffered(qint64 offset); + qint64 blankAtOffset(qint64 offset); + void seekTo(qint64 offset, bool sendStatusChanges = true); public slots: void start(); @@ -67,9 +93,13 @@ private: bool m_finishedDownloading; QTime m_lastProgressTime; int percent; + double m_totalTime; QUrl m_url; + qint64 m_offset; + bool sendStatusChanges; + QFile m_file; QNetworkReply *m_reply; Video *video; @@ -79,6 +109,7 @@ private: QTimer *speedCheckTimer; + QMap buffers; }; // This is required in order to use QPointer as a QVariant