Maintains a global file transfer processing list. More...
#include <filetransferlist.h>
Signals | |
void | onUpdateStatus (QString id) |
This signal is sent when there is updates in file processing. | |
void | onAddTransfer (QString id) |
This signal is sent when a file transfer is added to the list. | |
void | onRemoveTransfer (QString id) |
This signal is sent when a file transfer is removed from the list. | |
Public Member Functions | |
void | processTransfers () |
Drives the file transfer processing. | |
void | setProcessingThread (FileTransferProcessingThread *processingThread) |
Sets the file processing thread used. | |
void | addTransfer (FileTransfer *fileTransfer) |
Adds a FileTransfer object to the list. | |
void | removeTransfer (FileTransfer *fileTransfer) |
Remove a FileTransfer object from the list. | |
FileTransfer * | getTransfer (int i) |
Return a FileTransfer object from the list. | |
int | getTransferCount () |
Returns the size of the transfer list. | |
FileTransfer * | getTransfer (QString id) |
Return a transfer object with a given id. | |
void | cancelAllTransfers () |
Cancels all idle transfers. | |
void | updateStatus (QString id, unsigned long transferred, unsigned long totalSize) |
Updates the file transfer statistics of a FileTransfer object. | |
void | pauseProcessing () |
Pauses all file transfer processing. | |
void | resumeProcessing () |
Resumes file transfer processing. | |
Static Public Member Functions | |
static FileTransferList * | instance () |
Returns the global FileTransferList instance. | |
static void | drop () |
Shuts down the global FileTransferList instance. |
Maintains a global file transfer processing list.
void FileTransferList::cancelAllTransfers | ( | ) |
Cancels all idle transfers.
Due to limitiations in the current ARC API active transfers cannot be cancelled. Idle transfers are removed and destroyed from the list.
FileTransfer * FileTransferList::getTransfer | ( | QString | id | ) |
Return a transfer object with a given id.
id | string representing the FileTransfer object. |
FileTransfer * FileTransferList::getTransfer | ( | int | i | ) |
Return a FileTransfer object from the list.
i | is the position in the list. |
void FileTransferList::pauseProcessing | ( | ) |
Pauses all file transfer processing.
This method pauses transfer processing by pausing the FileTransferProcessingThread thread. Active file processing tasks can't be paused.
void FileTransferList::processTransfers | ( | ) |
Drives the file transfer processing.
This method checks for idle file transfer objects. If there are slots available, idle tasks are executed. The method is called by the FileTransferProcessingThread.
void FileTransferList::resumeProcessing | ( | ) |
Resumes file transfer processing.
Resumes file transfer processing by resuming the FileTransferProcessingThread thread.
void FileTransferList::updateStatus | ( | QString | id, | |
unsigned long | transferred, | |||
unsigned long | totalSize | |||
) |
Updates the file transfer statistics of a FileTransfer object.
This method is called from the ARC progress callbacks for updating file transfer status. The method is public to be able to be accessed from a static callback and should not be called directly.
id | of FileTransfer object. | |
transferred | currently transferred bytes. | |
totalSize | total size of transfer. |