Reverted invalid commit 82
[qtrapids] / src / client / models / QDeclarativeDownloadListModel.h
diff --git a/src/client/models/QDeclarativeDownloadListModel.h b/src/client/models/QDeclarativeDownloadListModel.h
deleted file mode 100644 (file)
index ee9cadd..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2010 by Ixonos Plc   *
- *                                                                         *
- *   This program 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; version 2 of the License.               *
- *                                                                         *
- *   This program 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 this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
- ***************************************************************************/
-#ifndef QDECLARATIVEDOWNLOADLISTMODEL_H
-#define QDECLARATIVEDOWNLOADLISTMODEL_H
-
-
-#include <QDeclarativeParserStatus>
-#include <QAbstractListModel>
-#include <QtDeclarative>
-#include <QModelIndex>
-
-#include "qtrapids/dbus.hpp"
-#include "qtrapids/info.hpp"
-
-//#include "../DownloadView.h"
-
-QT_MODULE(Declarative);
-
-namespace qtrapids
-{
-
-typedef QHash<QString, TorrentState> DownloadItems_t;
-typedef QMap<int, QString> ItemIndex_t;
-
-class QDeclarativeContext;
-class QDeclarativeDownloadListModelPrivate;
-
-class QDeclarativeDownloadListModel :
-            public QAbstractListModel, public QDeclarativeParserStatus
-{
-    Q_OBJECT
-    Q_INTERFACES(QDeclarativeParserStatus);
-
-    /*
-    Q_PROPERTY(QString hash READ hash);
-    Q_PROPERTY(QString name READ name WRITE setName);
-    Q_PROPERTY(QString size READ size);
-    Q_PROPERTY(QString status READ status);
-    Q_PROPERTY(uint state READ state);
-    Q_PROPERTY(uint progress READ progress);
-    Q_PROPERTY(uint downRate READ downRate);
-    Q_PROPERTY(uint upRate READ upRate);
-    Q_PROPERTY(uint seeds READ seeds);
-    Q_PROPERTY(uint leeches READ leeches);
-    Q_PROPERTY(qulonglong ratio READ ratio);
-    Q_PROPERTY(qulonglong totaSize READ totalDone);
-    Q_PROPERTY(qulonglong totalDone READ totalDone);
-*/
-
-public:
-    QDeclarativeDownloadListModel(QObject *parent = 0);
-    virtual ~QDeclarativeDownloadListModel();
-
-    // TODO: Learn to use roles..
-    enum Roles {
-        DownloadRole = Qt::UserRole + 1, 
-        SeedRole,
-        HashRole,
-        NameRole,
-        SizeRole,
-        StatusRole,
-        StateRole,
-        ProgressRole,
-        DownRateRole,
-        UpRateRole,
-        SeedsRole,
-        LeechesRole,
-        RatioRole,
-        TotaSizeRole,
-        TotalDoneRole
-    };
-
-    // Updates the torrent status in the model.
-    void updateItem(TorrentState const& info, ParamsMap_t other_info);
-    // Returns the hash of the torrent be removed.
-    QString prepareRemoveSelected();
-
-    // -- QAbstractListModel
-    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
-    virtual QVariant data(const QModelIndex &index, int role) const;
-    virtual bool insertRow(int row, const QModelIndex &parent);
-    virtual bool setData (const QModelIndex & index, const QVariant &value, int role = Qt::EditRole);
-    // -- End QAbstractListModel
-
-    // -- Overrides from QDeclarativeParserStatus
-    virtual void classBegin();
-    virtual void componentComplete();
-    // -- End QDeclarativeParserStatus
-
-Q_SIGNALS:
-    void downloadItemChanged(QString hash);
-
-// Private functions.
-private:
-    Q_DISABLE_COPY(QDeclarativeDownloadListModel)
-    QDeclarativeDownloadListModelPrivate *d;
-
-    void addItem_(TorrentState const& info, ParamsMap_t other_info);
-    void updateItem_(TorrentState const& info, ParamsMap_t other_info);
-    void removeItem_(TorrentState const& info);
-    QString GetStatusString(TorrentStatus::Id status);
-private:
-
-};
-
-
-} // namespace qtrapids
-
-// We need to declare the type
-QML_DECLARE_TYPE(qtrapids::QDeclarativeDownloadListModel);
-
-
-
-#endif