diff options
Diffstat (limited to 'Swift/Controllers/FileTransfer/FileTransferOverview.cpp')
-rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferOverview.cpp | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/Swift/Controllers/FileTransfer/FileTransferOverview.cpp b/Swift/Controllers/FileTransfer/FileTransferOverview.cpp index 8616c1e..a53b000 100644 --- a/Swift/Controllers/FileTransfer/FileTransferOverview.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferOverview.cpp @@ -23,70 +23,70 @@ namespace Swift { FileTransferOverview::FileTransferOverview(FileTransferManager* ftm) : fileTransferManager(ftm) { - fileTransferManager->onIncomingFileTransfer.connect(boost::bind(&FileTransferOverview::handleIncomingFileTransfer, this, _1)); - onNewFileTransferController.connect(boost::bind(&FileTransferOverview::handleNewFileTransferController, this, _1)); + fileTransferManager->onIncomingFileTransfer.connect(boost::bind(&FileTransferOverview::handleIncomingFileTransfer, this, _1)); + onNewFileTransferController.connect(boost::bind(&FileTransferOverview::handleNewFileTransferController, this, _1)); } FileTransferOverview::~FileTransferOverview() { - onNewFileTransferController.disconnect(boost::bind(&FileTransferOverview::handleNewFileTransferController, this, _1)); - fileTransferManager->onIncomingFileTransfer.disconnect(boost::bind(&FileTransferOverview::handleIncomingFileTransfer, this, _1)); - foreach(FileTransferController* controller, fileTransfers) { - controller->onStateChanged.disconnect(boost::bind(&FileTransferOverview::handleFileTransferStateChanged, this)); - } + onNewFileTransferController.disconnect(boost::bind(&FileTransferOverview::handleNewFileTransferController, this, _1)); + fileTransferManager->onIncomingFileTransfer.disconnect(boost::bind(&FileTransferOverview::handleIncomingFileTransfer, this, _1)); + foreach(FileTransferController* controller, fileTransfers) { + controller->onStateChanged.disconnect(boost::bind(&FileTransferOverview::handleFileTransferStateChanged, this)); + } } - + void FileTransferOverview::sendFile(const JID& jid, const std::string& filename) { - if (boost::filesystem::exists(filename) && boost::filesystem::file_size(filename) > 0) { - FileTransferController* controller = new FileTransferController(jid, filename, fileTransferManager); - onNewFileTransferController(controller); - } + if (boost::filesystem::exists(filename) && boost::filesystem::file_size(filename) > 0) { + FileTransferController* controller = new FileTransferController(jid, filename, fileTransferManager); + onNewFileTransferController(controller); + } } void FileTransferOverview::handleIncomingFileTransfer(IncomingFileTransfer::ref transfer) { - FileTransferController* controller = new FileTransferController(transfer); - onNewFileTransferController(controller); + FileTransferController* controller = new FileTransferController(transfer); + onNewFileTransferController(controller); } void FileTransferOverview::handleNewFileTransferController(FileTransferController* controller) { - fileTransfers.push_back(controller); - controller->onStateChanged.connect(boost::bind(&FileTransferOverview::handleFileTransferStateChanged, this)); + fileTransfers.push_back(controller); + controller->onStateChanged.connect(boost::bind(&FileTransferOverview::handleFileTransferStateChanged, this)); } void FileTransferOverview::handleFileTransferStateChanged() { - onFileTransferListChanged(); + onFileTransferListChanged(); } const std::vector<FileTransferController*>& FileTransferOverview::getFileTransfers() const { - return fileTransfers; + return fileTransfers; } void FileTransferOverview::clearFinished() { - for (std::vector<FileTransferController*>::iterator it = fileTransfers.begin(); it != fileTransfers.end(); ) { - if((*it)->getState().type == FileTransfer::State::Finished - || (*it)->getState().type == FileTransfer::State::Failed - || (*it)->getState().type == FileTransfer::State::Canceled) { - FileTransferController* controller = *it; - it = fileTransfers.erase(it); - controller->onStateChanged.disconnect(boost::bind(&FileTransferOverview::handleFileTransferStateChanged, this)); - delete controller; - } else { - ++it; - } - } - onFileTransferListChanged(); + for (std::vector<FileTransferController*>::iterator it = fileTransfers.begin(); it != fileTransfers.end(); ) { + if((*it)->getState().type == FileTransfer::State::Finished + || (*it)->getState().type == FileTransfer::State::Failed + || (*it)->getState().type == FileTransfer::State::Canceled) { + FileTransferController* controller = *it; + it = fileTransfers.erase(it); + controller->onStateChanged.disconnect(boost::bind(&FileTransferOverview::handleFileTransferStateChanged, this)); + delete controller; + } else { + ++it; + } + } + onFileTransferListChanged(); } bool FileTransferOverview::isClearable() const { - bool isClearable = false; - foreach (FileTransferController* controller, fileTransfers) { - if(controller->getState().type == FileTransfer::State::Finished - || controller->getState().type == FileTransfer::State::Failed - || controller->getState().type == FileTransfer::State::Canceled) { - isClearable = true; - break; - } - } - return isClearable; + bool isClearable = false; + foreach (FileTransferController* controller, fileTransfers) { + if(controller->getState().type == FileTransfer::State::Finished + || controller->getState().type == FileTransfer::State::Failed + || controller->getState().type == FileTransfer::State::Canceled) { + isClearable = true; + break; + } + } + return isClearable; } } |