2007-11-14 22:18:48 -05:00
|
|
|
/****************************************************************
|
|
|
|
* 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
|
2009-05-20 18:06:20 -04:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
2007-11-14 22:18:48 -05:00
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#ifndef _TRANSFERSDIALOG_H
|
|
|
|
#define _TRANSFERSDIALOG_H
|
|
|
|
|
2010-01-22 18:23:37 -05:00
|
|
|
#include <set>
|
|
|
|
|
2010-08-06 05:40:23 -04:00
|
|
|
#include <retroshare/rstypes.h>
|
2009-11-17 07:45:06 -05:00
|
|
|
#include "RsAutoUpdatePage.h"
|
2009-11-15 14:26:34 -05:00
|
|
|
|
2007-11-14 22:18:48 -05:00
|
|
|
#include "ui_TransfersDialog.h"
|
|
|
|
|
|
|
|
|
|
|
|
class DLListDelegate;
|
|
|
|
class ULListDelegate;
|
|
|
|
class QStandardItemModel;
|
2010-07-23 14:52:58 -04:00
|
|
|
class QStandardItem;
|
2010-05-03 18:44:53 -04:00
|
|
|
class DetailsDialog;
|
2010-07-23 14:52:58 -04:00
|
|
|
class FileProgressInfo;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2009-11-17 07:45:06 -05:00
|
|
|
class TransfersDialog : public RsAutoUpdatePage
|
2007-11-14 22:18:48 -05:00
|
|
|
{
|
2010-02-16 21:10:25 -05:00
|
|
|
Q_OBJECT
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
public:
|
|
|
|
/** Default Constructor */
|
|
|
|
TransfersDialog(QWidget *parent = 0);
|
2010-09-14 19:51:55 -04:00
|
|
|
~TransfersDialog();
|
2009-05-20 18:06:20 -04:00
|
|
|
|
2012-08-05 16:12:55 -04:00
|
|
|
virtual UserNotify *getUserNotify(QObject *parent);
|
|
|
|
|
2010-05-06 10:39:50 -04:00
|
|
|
// replaced by shortcut
|
|
|
|
// virtual void keyPressEvent(QKeyEvent *) ;
|
2010-02-16 21:10:25 -05:00
|
|
|
virtual void updateDisplay() ; // derived from RsAutoUpdateWidget
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-05-03 18:44:53 -04:00
|
|
|
static DetailsDialog *detailsdlg;
|
|
|
|
|
|
|
|
public slots:
|
2010-02-16 21:10:25 -05:00
|
|
|
void insertTransfers();
|
2009-05-20 18:06:20 -04:00
|
|
|
|
2010-03-10 16:38:26 -05:00
|
|
|
// void handleDownloadRequest(const QString& url);
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
private slots:
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
/** Create the context popup menu and it's submenus */
|
|
|
|
void downloadListCostumPopupMenu( QPoint point );
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
void cancel();
|
2010-07-21 19:14:10 -04:00
|
|
|
void forceCheck();
|
2010-02-16 21:10:25 -05:00
|
|
|
/** removes finished Downloads**/
|
|
|
|
void clearcompleted();
|
2009-05-20 18:06:20 -04:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
void copyLink();
|
2009-05-18 10:23:55 -04:00
|
|
|
void pasteLink();
|
2009-07-02 14:40:31 -04:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
// void rootdecorated();
|
|
|
|
// void rootisnotdecorated();
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2009-07-02 14:40:31 -04:00
|
|
|
void pauseFileTransfer();
|
|
|
|
void resumeFileTransfer();
|
|
|
|
void openFolderTransfer();
|
2009-07-05 12:27:58 -04:00
|
|
|
void openTransfer();
|
|
|
|
void previewTransfer();
|
2009-07-02 14:40:31 -04:00
|
|
|
|
2009-07-27 13:22:56 -04:00
|
|
|
/** clear download or all queue - for pending dwls */
|
2010-03-06 18:29:47 -05:00
|
|
|
// void clearQueue();
|
2009-07-27 13:22:56 -04:00
|
|
|
|
|
|
|
/** modify download priority actions */
|
2010-03-06 18:29:47 -05:00
|
|
|
void priorityQueueUp();
|
|
|
|
void priorityQueueDown();
|
|
|
|
void priorityQueueTop();
|
|
|
|
void priorityQueueBottom();
|
2010-01-26 18:25:00 -05:00
|
|
|
|
|
|
|
void speedSlow();
|
|
|
|
void speedAverage();
|
|
|
|
void speedFast();
|
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
void changeSpeed(int) ;
|
2010-03-06 18:29:47 -05:00
|
|
|
void changeQueuePosition(QueueMove) ;
|
2009-07-27 13:22:56 -04:00
|
|
|
|
2010-01-05 19:10:15 -05:00
|
|
|
void chunkRandom();
|
|
|
|
void chunkStreaming();
|
2009-12-08 17:29:52 -05:00
|
|
|
|
2010-01-05 19:10:15 -05:00
|
|
|
void showDetailsDialog();
|
2010-05-03 18:44:53 -04:00
|
|
|
void updateDetailsDialog();
|
2009-09-14 16:29:46 -04:00
|
|
|
|
2011-11-25 18:46:41 -05:00
|
|
|
void openCollection();
|
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
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;
|
|
|
|
|
|
|
|
/** Create the actions on the tray menu or menubar */
|
|
|
|
void createActions();
|
|
|
|
|
|
|
|
/** Defines the actions for the context menu */
|
|
|
|
QAction* showdowninfoAct;
|
2010-03-28 16:46:45 -04:00
|
|
|
QAction* playAct;
|
2010-02-16 21:10:25 -05:00
|
|
|
QAction* cancelAct;
|
2010-07-21 19:14:10 -04:00
|
|
|
QAction* forceCheckAct;
|
2010-02-16 21:10:25 -05:00
|
|
|
QAction* clearcompletedAct;
|
|
|
|
QAction* copylinkAct;
|
2009-05-18 10:23:55 -04:00
|
|
|
QAction* pastelinkAct;
|
2009-05-27 14:20:08 -04:00
|
|
|
QAction* rootisnotdecoratedAct;
|
|
|
|
QAction* rootisdecoratedAct;
|
2010-02-16 21:10:25 -05:00
|
|
|
QAction *pauseAct;
|
|
|
|
QAction *resumeAct;
|
|
|
|
QAction *openfolderAct;
|
|
|
|
QAction *openfileAct;
|
|
|
|
QAction *previewfileAct;
|
2010-03-06 18:29:47 -05:00
|
|
|
// QAction *clearQueuedDwlAct;
|
|
|
|
// QAction *clearQueueAct;
|
2010-02-16 21:10:25 -05:00
|
|
|
QAction *changePriorityAct;
|
|
|
|
QAction *prioritySlowAct;
|
|
|
|
QAction *priorityMediumAct;
|
|
|
|
QAction *priorityFastAct;
|
2010-03-08 16:07:53 -05:00
|
|
|
QAction *queueDownAct;
|
|
|
|
QAction *queueUpAct;
|
|
|
|
QAction *queueTopAct;
|
|
|
|
QAction *queueBottomAct;
|
2010-02-16 21:10:25 -05:00
|
|
|
QAction *chunkRandomAct;
|
|
|
|
QAction *chunkStreamingAct;
|
|
|
|
QAction *detailsfileAct;
|
|
|
|
|
2010-09-14 19:51:55 -04:00
|
|
|
bool m_bProcessSettings;
|
|
|
|
void processSettings(bool bLoad);
|
|
|
|
|
2011-02-07 19:41:13 -05:00
|
|
|
void getSelectedItems(std::set<std::string> *ids, std::set<int> *rows);
|
2009-07-02 14:40:31 -04:00
|
|
|
bool controlTransferFile(uint32_t flags);
|
2009-07-27 13:22:56 -04:00
|
|
|
void changePriority(int priority);
|
2010-02-16 21:10:25 -05:00
|
|
|
void setChunkStrategy(FileChunksInfo::ChunkStrategy s) ;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
QTreeView *downloadList;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
/** Adds a new action to the toolbar. */
|
|
|
|
void addAction(QAction *action, const char *slot = 0);
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::TransfersDialog ui;
|
2007-11-14 22:18:48 -05:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
public slots:
|
2010-03-07 09:10:51 -05:00
|
|
|
// these two functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
|
|
|
//
|
2012-06-01 16:51:14 -04:00
|
|
|
int addItem(int row, const FileInfo &fileInfo, const std::map<std::string, std::string> &versions);
|
|
|
|
int addPeerToItem(QStandardItem *dlItem, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo);
|
2008-02-11 11:32:02 -05:00
|
|
|
|
2010-07-27 12:05:21 -04:00
|
|
|
int addUploadItem(const QString& symbol, const QString& name, const QString& coreID, qlonglong size, const FileProgressInfo& pinfo, double dlspeed, const QString& sources,const QString& source_id, const QString& status, qlonglong completed, qlonglong remaining);
|
2008-02-11 11:32:02 -05:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
void showFileDetails() ;
|
2009-02-22 12:36:39 -05:00
|
|
|
|
2010-02-16 21:10:25 -05:00
|
|
|
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);
|
2011-02-07 19:41:13 -05:00
|
|
|
qlonglong getDownloadTime(int row, QStandardItemModel *model);
|
|
|
|
QString getSources(int row, QStandardItemModel *model);
|
2007-11-14 22:18:48 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|