RetroShare/retroshare-gui/src/gui/TransfersDialog.h
csoler 506f14eb2f - Added a parent page widget (class RsAutoUpdatePage) to handle auto-update. The page updates using a timer, only wh
en visible, and each time it gets showed. I already made some RS pages derive from this page.
- Modified and renamed the taskGraphPainterWidget to display info about currently selected file transfers. For know, it only shows file chunks info, but we should use it to display additional info about the transfer. Warning: in its
 current state, only fake chunk info is displayed.
 - Suppressed p3files.h, because it is not used.

 Remains to do (in order):
 - Implement a chunk map class in ft/ to properly manage which chunks should be downloaded 
 - Display correct chunk info by requesting the transfer's chunk map
 - Add check-sum verification of chunks
 - allow RS to import a partially downloaded file by force re-checking chunks
 - Add chunk map exchange from file source peer id to file destination peer id.
 - Manage chunks from different peers.
 - Allow search (turtle search) for partially downloaded files 



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1832 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2009-11-17 12:45:06 +00:00

183 lines
5.7 KiB
C++

/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2006,2007 crypton
*
* 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; either version 2
* of the License, or (at your option) any later version.
*
* 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., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _TRANSFERSDIALOG_H
#define _TRANSFERSDIALOG_H
#include <QFileDialog>
#include <QProgressBar>
#include <QtGui>
#include <QObject>
#include <QModelIndex>
#include <QVariant>
#include <stdint.h>
#include "mainpage.h"
#include "RsAutoUpdatePage.h"
#include "ui_TransfersDialog.h"
class DLListDelegate;
class ULListDelegate;
class QStandardItemModel;
class TransfersDialog : public RsAutoUpdatePage
{
Q_OBJECT
public:
/** Default Constructor */
TransfersDialog(QWidget *parent = 0);
/** Default Destructor */
~TransfersDialog();
virtual void keyPressEvent(QKeyEvent *) ;
virtual void updateDisplay() ; // derived from RsAutoUpdateWidget
public slots:
void insertTransfers();
void handleDownloadRequest(const QString& url);
private slots:
/** Create the context popup menu and it's submenus */
void downloadListCostumPopupMenu( QPoint point );
void cancel();
/** removes finished Downloads**/
void clearcompleted();
void playSelectedTransfer();
void copyLink();
void pasteLink();
void rootdecorated();
void rootisnotdecorated();
void pauseFileTransfer();
void resumeFileTransfer();
void openFolderTransfer();
void openTransfer();
void previewTransfer();
/** clear download or all queue - for pending dwls */
void clearQueuedDwl();
void clearQueue();
/** modify download priority actions */
void priorityLow();
void priorityNormal();
void priorityHigh();
void priorityAuto();
/** save sort indicators for next transfers display */
void saveSortIndicatorDwl(int logicalIndex, Qt::SortOrder order);
void saveSortIndicatorUpl(int logicalIndex, Qt::SortOrder order);
//void setTaskGraphPainterWidget (const QModelIndex& index);
signals:
void playFiles(QStringList files);
private:
QString getPeerName(const std::string& peer_id) const ;
QStandardItemModel *DLListModel;
QStandardItemModel *ULListModel;
QItemSelectionModel *selection;
QItemSelectionModel *selectionup;
DLListDelegate *DLDelegate;
ULListDelegate *ULDelegate;
qlonglong fileSize;
double progress;
double dlspeed;
QString status, icon, name;
qlonglong completed, remaining;
int _sortColDwl, _sortColUpl;
Qt::SortOrder _sortOrderDwl, _sortOrderUpl;
/** Create the actions on the tray menu or menubar */
void createActions();
/** Define the popup menus for the Context menu */
QMenu* contextMnu;
/** Defines the actions for the context menu */
QAction* showdowninfoAct;
QAction* cancelAct;
QAction* clearcompletedAct;
QAction* copylinkAct;
QAction* pastelinkAct;
QAction* rootisnotdecoratedAct;
QAction* rootisdecoratedAct;
QAction *pauseAct;
QAction *resumeAct;
QAction *openfolderAct;
QAction *openfileAct;
QAction *previewfileAct;
QAction *clearQueuedDwlAct;
QAction *clearQueueAct;
QAction *changePriorityAct;
QAction *priorityLowAct;
QAction *priorityNormalAct;
QAction *priorityHighAct;
QAction *priorityAutoAct;
void getIdOfSelectedItems(QList<QStandardItem *>& items);
bool controlTransferFile(uint32_t flags);
void changePriority(int priority);
QTreeView *downloadList;
/** Adds a new action to the toolbar. */
void addAction(QAction *action, const char *slot = 0);
/** Qt Designer generated object */
Ui::TransfersDialog ui;
public slots:
int addItem(QString symbol, QString name, QString coreID, qlonglong size, double progress, double dlspeed, QString sources, QString status, QString priority, qlonglong completed, qlonglong remaining);
bool addPeerToItem(int row, QString symbol, QString name, QString coreID, qlonglong fileSize, double progress, double dlspeed, QString sources, QString status, qlonglong completed, qlonglong remaining);
void delItem(int row);
int addUploadItem(QString symbol, QString name, QString coreID, qlonglong size, double progress, double dlspeed, QString sources, QString status, qlonglong completed, qlonglong remaining);
void delUploadItem(int row);
void editItem(int row, int column, QVariant data);
void updateProgress(int value);
void showFileDetails() ;
double getProgress(int row, QStandardItemModel *model);
double getSpeed(int row, QStandardItemModel *model);
QString getFileName(int row, QStandardItemModel *model);
QString getStatus(int row, QStandardItemModel *model);
QString getID(int row, QStandardItemModel *model);
QString getPriority(int row, QStandardItemModel *model);
qlonglong getFileSize(int row, QStandardItemModel *model);
qlonglong getTransfered(int row, QStandardItemModel *model);
qlonglong getRemainingTime(int row, QStandardItemModel *model);
};
#endif