2007-11-15 03:18:48 +00: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 22:06:20 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
2007-11-15 03:18:48 +00:00
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#ifndef _TRANSFERSDIALOG_H
|
|
|
|
#define _TRANSFERSDIALOG_H
|
|
|
|
|
2010-01-22 23:23:37 +00:00
|
|
|
#include <set>
|
|
|
|
|
2010-08-06 09:40:23 +00:00
|
|
|
#include <retroshare/rstypes.h>
|
2009-11-17 12:45:06 +00:00
|
|
|
#include "RsAutoUpdatePage.h"
|
2015-06-29 16:08:17 +00:00
|
|
|
|
|
|
|
#include "ui_TransfersDialog.h"
|
|
|
|
|
2017-09-02 17:57:04 +02:00
|
|
|
#include <QItemSelectionModel>
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
|
2015-06-29 16:08:17 +00:00
|
|
|
#define IMAGE_TRANSFERS ":/icons/ktorrent_128.png"
|
|
|
|
|
2016-04-22 18:49:42 -04:00
|
|
|
class QShortcut;
|
2015-06-29 16:08:17 +00:00
|
|
|
class DLListDelegate;
|
|
|
|
class ULListDelegate;
|
2007-11-15 03:18:48 +00:00
|
|
|
class QStandardItemModel;
|
2010-07-23 18:52:58 +00:00
|
|
|
class QStandardItem;
|
2010-05-03 22:44:53 +00:00
|
|
|
class DetailsDialog;
|
2010-07-23 18:52:58 +00:00
|
|
|
class FileProgressInfo;
|
2013-02-22 21:42:27 +00:00
|
|
|
class SearchDialog;
|
|
|
|
class LocalSharedFilesDialog;
|
|
|
|
class RemoteSharedFilesDialog;
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2009-11-17 12:45:06 +00:00
|
|
|
class TransfersDialog : public RsAutoUpdatePage
|
2007-11-15 03:18:48 +00:00
|
|
|
{
|
2010-02-17 02:10:25 +00:00
|
|
|
Q_OBJECT
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
public:
|
2013-02-23 14:29:36 +00:00
|
|
|
enum Page {
|
|
|
|
/* Fixed numbers for load and save the last page */
|
|
|
|
SearchTab = 0, /** Network page. */
|
|
|
|
LocalSharedFilesTab = 1, /** Network new graph. */
|
|
|
|
RemoteSharedFilesTab = 2 /** Old group chat page. */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
/** Default Constructor */
|
2015-06-29 16:08:17 +00:00
|
|
|
TransfersDialog(QWidget *parent = 0);
|
|
|
|
~TransfersDialog();
|
|
|
|
|
|
|
|
virtual QIcon iconPixmap() const { return QIcon(IMAGE_TRANSFERS) ; } //MainPage
|
2017-01-17 16:34:37 +01:00
|
|
|
virtual QString pageName() const { return tr("Files") ; } //MainPage
|
2015-06-29 16:08:17 +00:00
|
|
|
virtual QString helpText() const { return ""; } //MainPage
|
|
|
|
|
|
|
|
virtual UserNotify *getUserNotify(QObject *parent);
|
|
|
|
|
|
|
|
void activatePage(TransfersDialog::Page page) ;
|
2013-02-23 14:29:36 +00:00
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
virtual void updateDisplay() ; // derived from RsAutoUpdateWidget
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2013-02-22 21:42:27 +00:00
|
|
|
static DetailsDialog *detailsDialog() ;
|
|
|
|
|
|
|
|
SearchDialog *searchDialog ;
|
|
|
|
LocalSharedFilesDialog *localSharedFiles ;
|
|
|
|
RemoteSharedFilesDialog *remoteSharedFiles ;
|
2010-05-03 22:44:53 +00:00
|
|
|
|
|
|
|
public slots:
|
2010-02-17 02:10:25 +00:00
|
|
|
void insertTransfers();
|
2009-05-20 22:06:20 +00:00
|
|
|
|
2010-03-10 21:38:26 +00:00
|
|
|
// void handleDownloadRequest(const QString& url);
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
private slots:
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
/** Create the context popup menu and it's submenus */
|
2013-02-27 16:59:16 +00:00
|
|
|
void downloadListCustomPopupMenu( QPoint point );
|
2013-07-06 19:34:34 +00:00
|
|
|
void downloadListHeaderCustomPopupMenu( QPoint point );
|
2013-08-23 20:46:11 +00:00
|
|
|
void uploadsListCustomPopupMenu( QPoint point );
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
void cancel();
|
2010-07-21 23:14:10 +00:00
|
|
|
void forceCheck();
|
2010-02-17 02:10:25 +00:00
|
|
|
/** removes finished Downloads**/
|
|
|
|
void clearcompleted();
|
2009-05-20 22:06:20 +00:00
|
|
|
|
2017-09-06 19:57:33 +02:00
|
|
|
void dlCopyLink();
|
2009-05-18 14:23:55 +00:00
|
|
|
void pasteLink();
|
2013-02-27 16:59:16 +00:00
|
|
|
void renameFile();
|
|
|
|
void setDestinationDirectory();
|
|
|
|
void chooseDestinationDirectory();
|
2009-07-02 18:40:31 +00:00
|
|
|
|
2013-07-06 15:48:40 +00:00
|
|
|
void expandAll();
|
|
|
|
void collapseAll();
|
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
// void rootdecorated();
|
|
|
|
// void rootisnotdecorated();
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2009-07-02 18:40:31 +00:00
|
|
|
void pauseFileTransfer();
|
|
|
|
void resumeFileTransfer();
|
2017-09-06 19:57:33 +02:00
|
|
|
void dlOpenFolder();
|
|
|
|
void dlOpenFile();
|
|
|
|
void dlPreviewFile();
|
2009-07-02 18:40:31 +00:00
|
|
|
|
2013-08-23 20:46:11 +00:00
|
|
|
void ulOpenFolder();
|
|
|
|
void ulCopyLink();
|
2009-07-27 17:22:56 +00:00
|
|
|
/** clear download or all queue - for pending dwls */
|
2010-03-06 23:29:47 +00:00
|
|
|
// void clearQueue();
|
2009-07-27 17:22:56 +00:00
|
|
|
|
|
|
|
/** modify download priority actions */
|
2010-03-06 23:29:47 +00:00
|
|
|
void priorityQueueUp();
|
|
|
|
void priorityQueueDown();
|
|
|
|
void priorityQueueTop();
|
|
|
|
void priorityQueueBottom();
|
2010-01-26 23:25:00 +00:00
|
|
|
|
|
|
|
void speedSlow();
|
|
|
|
void speedAverage();
|
|
|
|
void speedFast();
|
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
void changeSpeed(int) ;
|
2010-03-06 23:29:47 +00:00
|
|
|
void changeQueuePosition(QueueMove) ;
|
2009-07-27 17:22:56 +00:00
|
|
|
|
2010-01-06 00:10:15 +00:00
|
|
|
void chunkRandom();
|
2013-02-28 20:42:01 +00:00
|
|
|
void chunkProgressive();
|
2010-01-06 00:10:15 +00:00
|
|
|
void chunkStreaming();
|
2009-12-08 22:29:52 +00:00
|
|
|
|
2015-06-29 16:08:17 +00:00
|
|
|
void showDetailsDialog();
|
|
|
|
void updateDetailsDialog();
|
|
|
|
|
|
|
|
void collCreate();
|
|
|
|
void collModif();
|
|
|
|
void collView();
|
|
|
|
void collOpen();
|
|
|
|
|
|
|
|
void setShowDLSizeColumn(bool show);
|
|
|
|
void setShowDLCompleteColumn(bool show);
|
2013-07-06 19:34:34 +00:00
|
|
|
void setShowDLDLSpeedColumn(bool show);
|
|
|
|
void setShowDLProgressColumn(bool show);
|
|
|
|
void setShowDLSourcesColumn(bool show);
|
|
|
|
void setShowDLStatusColumn(bool show);
|
|
|
|
void setShowDLPriorityColumn(bool show);
|
|
|
|
void setShowDLRemainingColumn(bool show);
|
|
|
|
void setShowDLDownloadTimeColumn(bool show);
|
|
|
|
void setShowDLIDColumn(bool show);
|
|
|
|
void setShowDLLastDLColumn(bool show);
|
2013-08-25 20:35:29 +00:00
|
|
|
void setShowDLPath(bool show);
|
2013-07-06 19:34:34 +00:00
|
|
|
|
2017-09-02 17:57:04 +02:00
|
|
|
void filterChanged(const QString &text);
|
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
signals:
|
|
|
|
void playFiles(QStringList files);
|
|
|
|
|
|
|
|
private:
|
2014-03-17 20:56:06 +00:00
|
|
|
QString getPeerName(const RsPeerId &peer_id) const ;
|
2010-02-17 02:10:25 +00:00
|
|
|
|
|
|
|
QStandardItemModel *DLListModel;
|
2017-09-02 17:57:04 +02:00
|
|
|
QSortFilterProxyModel *DLLFilterModel;
|
2010-02-17 02:10:25 +00:00
|
|
|
QStandardItemModel *ULListModel;
|
|
|
|
QItemSelectionModel *selection;
|
2013-08-23 20:46:11 +00:00
|
|
|
QItemSelectionModel *selectionUp;
|
2010-02-17 02:10:25 +00:00
|
|
|
|
|
|
|
DLListDelegate *DLDelegate;
|
|
|
|
ULListDelegate *ULDelegate;
|
|
|
|
|
|
|
|
/** Create the actions on the tray menu or menubar */
|
2015-06-29 16:08:17 +00:00
|
|
|
void createActions();
|
|
|
|
|
|
|
|
/** Defines the actions for the context menu */
|
|
|
|
QAction *showdownInfoAct;
|
|
|
|
QAction *playAct;
|
|
|
|
QAction *cancelAct;
|
|
|
|
QAction *forceCheckAct;
|
|
|
|
QAction *clearCompletedAct;
|
|
|
|
QAction *copyLinkAct;
|
|
|
|
QAction *pasteLinkAct;
|
|
|
|
QAction *rootIsNotDecoratedAct;
|
|
|
|
QAction *rootIsDecoratedAct;
|
|
|
|
QAction *pauseAct;
|
|
|
|
QAction *resumeAct;
|
|
|
|
QAction *openFolderAct;
|
2013-08-23 20:46:11 +00:00
|
|
|
QAction *openFileAct;
|
|
|
|
QAction *previewFileAct;
|
2010-03-06 23:29:47 +00:00
|
|
|
// QAction *clearQueuedDwlAct;
|
|
|
|
// QAction *clearQueueAct;
|
2010-02-17 02:10:25 +00:00
|
|
|
QAction *changePriorityAct;
|
|
|
|
QAction *prioritySlowAct;
|
|
|
|
QAction *priorityMediumAct;
|
|
|
|
QAction *priorityFastAct;
|
2010-03-08 21:07:53 +00:00
|
|
|
QAction *queueDownAct;
|
|
|
|
QAction *queueUpAct;
|
|
|
|
QAction *queueTopAct;
|
|
|
|
QAction *queueBottomAct;
|
2010-02-17 02:10:25 +00:00
|
|
|
QAction *chunkRandomAct;
|
2013-02-28 20:42:01 +00:00
|
|
|
QAction *chunkProgressiveAct;
|
2015-06-29 16:08:17 +00:00
|
|
|
QAction *chunkStreamingAct;
|
|
|
|
QAction *detailsFileAct;
|
|
|
|
QAction *renameFileAct;
|
|
|
|
QAction *specifyDestinationDirectoryAct;
|
|
|
|
QAction *expandAllAct;
|
|
|
|
QAction *collapseAllAct;
|
|
|
|
QAction *collCreateAct;
|
|
|
|
QAction *collModifAct;
|
|
|
|
QAction *collViewAct;
|
|
|
|
QAction *collOpenAct;
|
|
|
|
|
|
|
|
/** Defines the actions for the header context menu */
|
|
|
|
QAction* showDLSizeAct;
|
2013-07-06 19:34:34 +00:00
|
|
|
QAction* showDLCompleteAct;
|
|
|
|
QAction* showDLDLSpeedAct;
|
|
|
|
QAction* showDLProgressAct;
|
|
|
|
QAction* showDLSourcesAct;
|
|
|
|
QAction* showDLStatusAct;
|
|
|
|
QAction* showDLPriorityAct;
|
|
|
|
QAction* showDLRemainingAct;
|
|
|
|
QAction* showDLDownloadTimeAct;
|
|
|
|
QAction* showDLIDAct;
|
|
|
|
QAction* showDLLastDLAct;
|
2013-08-25 20:35:29 +00:00
|
|
|
QAction* showDLPath;
|
2013-07-06 19:34:34 +00:00
|
|
|
|
2013-08-23 20:46:11 +00:00
|
|
|
/** Defines the actions for the upload context menu */
|
|
|
|
QAction* ulOpenFolderAct;
|
|
|
|
QAction* ulCopyLinkAct;
|
2010-02-17 02:10:25 +00:00
|
|
|
|
2010-09-14 23:51:55 +00:00
|
|
|
bool m_bProcessSettings;
|
|
|
|
void processSettings(bool bLoad);
|
|
|
|
|
2017-09-06 19:57:33 +02:00
|
|
|
void getDLSelectedItems(std::set<RsFileHash> *ids, std::set<int> *rows);
|
2014-03-17 20:56:06 +00:00
|
|
|
void getULSelectedItems(std::set<RsFileHash> *ids, std::set<int> *rows);
|
2009-07-02 18:40:31 +00:00
|
|
|
bool controlTransferFile(uint32_t flags);
|
2009-07-27 17:22:56 +00:00
|
|
|
void changePriority(int priority);
|
2010-02-17 02:10:25 +00:00
|
|
|
void setChunkStrategy(FileChunksInfo::ChunkStrategy s) ;
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
QTreeView *downloadList;
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
/** Adds a new action to the toolbar. */
|
|
|
|
void addAction(QAction *action, const char *slot = 0);
|
2015-11-24 19:41:13 +01:00
|
|
|
|
|
|
|
QString downloads;
|
|
|
|
QString uploads;
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2016-04-22 20:38:07 -04:00
|
|
|
QShortcut *mShortcut ;
|
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::TransfersDialog ui;
|
2007-11-15 03:18:48 +00:00
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
public slots:
|
2017-09-06 19:57:33 +02:00
|
|
|
// these four functions add entries to the transfers dialog, and return the row id of the entry modified/added
|
|
|
|
int addDLItem(int row, const FileInfo &fileInfo);
|
|
|
|
int addPeerToDLItem(QStandardItem *dlItem, const QString& name, const QString& coreID, double dlspeed, uint32_t status, const FileProgressInfo& peerInfo);
|
|
|
|
int addULItem(int row, const FileInfo &fileInfo);
|
|
|
|
int addPeerToULItem(QStandardItem *ulItem, const RsPeerId& peer_ID, const QString &coreID, qlonglong completed, double ulspeed, const FileProgressInfo& peerInfo);
|
2008-02-11 16:32:02 +00:00
|
|
|
|
2010-02-17 02:10:25 +00:00
|
|
|
void showFileDetails() ;
|
2009-02-22 17:36:39 +00:00
|
|
|
|
2010-02-17 02:10:25 +00: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);
|
2017-09-02 17:57:04 +02:00
|
|
|
QString getID(int row, QSortFilterProxyModel *filter);
|
2010-02-17 02:10:25 +00:00
|
|
|
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-08 00:41:13 +00:00
|
|
|
qlonglong getDownloadTime(int row, QStandardItemModel *model);
|
2013-07-01 21:03:20 +00:00
|
|
|
qlonglong getLastDL(int row, QStandardItemModel *model);
|
2013-08-25 20:35:29 +00:00
|
|
|
qlonglong getPath(int row, QStandardItemModel *model);
|
2011-02-08 00:41:13 +00:00
|
|
|
QString getSources(int row, QStandardItemModel *model);
|
2007-11-15 03:18:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|