Statistics
| Revision:

root / trunk / client / gui_qt / DownloadQueueModel.h @ 1777

History | View | Annotate | Download (2.6 KB)

1
#ifndef DOWNLOADQUEUEMODEL_H
2
#define DOWNLOADQUEUEMODEL_H
3

                
4
#include 
5
#include "QNNTPGrabGlue.h"
6
#include "DownloadQueueItem.h"
7

                
8
class DownloadQueueModel : public QAbstractItemModel
9
{
10
    Q_OBJECT
11
public:
12
    DownloadQueueModel(QNNTPGrabGlue *glue, QObject *parent = 0);
13
    ~DownloadQueueModel();
14

                
15
    QVariant data(const QModelIndex &index, int role) const;
16
    Qt::ItemFlags flags(const QModelIndex &index) const;
17
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
18
    QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
19
    QModelIndex parent(const QModelIndex &index) const;
20
    int rowCount(const QModelIndex &parent = QModelIndex()) const;
21
    int columnCount(const QModelIndex &parent = QModelIndex()) const;
22

                
23
private:
24
    void loadDownloadQueue(QNNTPGrabGlue *glue);
25
    int calculateProgress(quint64 size, quint64 sizeRemaining);
26
    DownloadQueueItem *lookupCollectionItem(QString collection_name);
27
    DownloadQueueItem *lookupSubjectItem(DownloadQueueItem *collection_item, QString subject);
28

                
29
    DownloadQueueItem *rootItem;
30

                
31
private slots:
32
    void onFileDownloadStateUpdate(QString collection_name, QString subject, int num_parts_total, int num_parts_done, int num_parts_failed, quint64 file_size, quint64 file_size_remaining, quint64 total_size, quint64 total_size_remaining);
33
    void onFileStateChanged(QString collection_name, QString subject, QString real_filename, QNNTPGrabGlue::TaskState old_state, QNNTPGrabGlue::TaskState new_state);
34

                
35
    void onFileAdded(QString collection_name, QString subject, QString poster, QDateTime stamp, quint64 file_size, quint64 total_size, quint64 total_size_remaining, QNNTPGrabGlue::TaskState state, int num_parts, QList groups);
36
    void onFileRemoved(QString collection_name, QString subject, quint64 total_size, quint64 total_size_remaining);
37
    void onFileMoved(QString orig_collection_name, QString subject, QString new_collection_name, int old_position, int new_position);
38

                
39
    void onCollectionAdded(QString collection_name, QString poster);
40
    void onCollectionRemoved(QString collection_name);
41
    void onCollectionModified(QString collection_name, QString poster);
42
    void onCollectionMoved(QString collection_name, int old_position, int new_position);
43

                
44
    void onTrafficMonitorUpdate(int bytes_received1, int bytes_received2, int bytes_received3, int bytes_received4, int bytes_received5, int bytes_received6, int bytes_received7, int bytes_received8, int bytes_received9, int bytes_received10, QDateTime stamp, double average);
45

                
46
signals:
47

                
48
public slots:
49

                
50
};
51

                
52
#endif // DOWNLOADQUEUEMODEL_H