diff options
Diffstat (limited to 'Swift/Controllers/FileTransfer/FileTransferController.cpp')
-rw-r--r-- | Swift/Controllers/FileTransfer/FileTransferController.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp index 3feaf49..0160a7a 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferController.cpp @@ -11,4 +11,5 @@ #include <Swiften/Base/boost_bsignals.h> #include <boost/bind.hpp> +#include <boost/filesystem.hpp> #include "Swift/Controllers/UIInterfaces/ChatWindow.h" #include <Swiften/Base/Log.h> @@ -25,5 +26,5 @@ FileTransferController::FileTransferController(const JID& receipient, const std: FileTransferController::FileTransferController(IncomingFileTransfer::ref transfer) : - sending(false), otherParty(transfer->getSender()), filename(transfer->filename), transfer(transfer), ftManager(0), ftProgressInfo(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) { + sending(false), otherParty(transfer->getSender()), filename(transfer->getFileName()), transfer(transfer), ftManager(0), ftProgressInfo(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) { } @@ -42,5 +43,5 @@ std::string FileTransferController::setChatWindow(ChatWindow* wnd, std::string n uiID = wnd->addFileTransfer(QT_TRANSLATE_NOOP("", "me"), true, filename, boost::filesystem::file_size(boost::filesystem::path(filename))); } else { - uiID = wnd->addFileTransfer(nickname, false, filename, transfer->fileSizeInBytes); + uiID = wnd->addFileTransfer(nickname, false, filename, transfer->getFileSizeInBytes()); } return uiID; @@ -65,5 +66,5 @@ int FileTransferController::getProgress() const { boost::uintmax_t FileTransferController::getSize() const { if (transfer) { - return transfer->fileSizeInBytes; + return transfer->getFileSizeInBytes(); } else { return 0; @@ -76,7 +77,7 @@ void FileTransferController::start(std::string& description) { OutgoingFileTransfer::ref outgoingTransfer = ftManager->createOutgoingFileTransfer(otherParty, boost::filesystem::path(filename), description, fileReadStream); if (outgoingTransfer) { - ftProgressInfo = new FileTransferProgressInfo(outgoingTransfer->fileSizeInBytes); + ftProgressInfo = new FileTransferProgressInfo(outgoingTransfer->getFileSizeInBytes()); ftProgressInfo->onProgressPercentage.connect(boost::bind(&FileTransferController::handleProgressPercentageChange, this, _1)); - outgoingTransfer->onStateChange.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); + outgoingTransfer->onStateChanged.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); outgoingTransfer->onProcessedBytes.connect(boost::bind(&FileTransferProgressInfo::setBytesProcessed, ftProgressInfo, _1)); outgoingTransfer->start(); @@ -93,7 +94,7 @@ void FileTransferController::accept(std::string& file) { fileWriteStream = boost::make_shared<FileWriteBytestream>(boost::filesystem::path(file)); - ftProgressInfo = new FileTransferProgressInfo(transfer->fileSizeInBytes); + ftProgressInfo = new FileTransferProgressInfo(transfer->getFileSizeInBytes()); ftProgressInfo->onProgressPercentage.connect(boost::bind(&FileTransferController::handleProgressPercentageChange, this, _1)); - transfer->onStateChange.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); + transfer->onStateChanged.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); transfer->onProcessedBytes.connect(boost::bind(&FileTransferProgressInfo::setBytesProcessed, ftProgressInfo, _1)); incomingTransfer->accept(fileWriteStream); @@ -114,5 +115,8 @@ void FileTransferController::handleFileTransferStateChange(FileTransfer::State s currentState = state; onStateChage(); - switch(state.state) { + switch(state.type) { + case FileTransfer::State::Initial: + assert(false); + return; case FileTransfer::State::Negotiating: chatWindow->setFileTransferStatus(uiID, ChatWindow::Negotiating); @@ -139,5 +143,5 @@ void FileTransferController::handleFileTransferStateChange(FileTransfer::State s return; } - std::cerr << "Unhandled FileTransfer::State!" << std::endl; + assert(false); } |