summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/FileTransfer/FileTransferController.cpp')
-rw-r--r--Swift/Controllers/FileTransfer/FileTransferController.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp
index 65c2892..27e9dbf 100644
--- a/Swift/Controllers/FileTransfer/FileTransferController.cpp
+++ b/Swift/Controllers/FileTransfer/FileTransferController.cpp
@@ -1,85 +1,85 @@
/*
* Copyright (c) 2011 Tobias Markmann
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
/*
- * Copyright (c) 2015-2016 Isode Limited.
+ * Copyright (c) 2015-2017 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swift/Controllers/FileTransfer/FileTransferController.h>
#include <memory>
#include <boost/bind.hpp>
#include <boost/filesystem.hpp>
#include <boost/signals2.hpp>
#include <Swiften/Base/Log.h>
#include <Swiften/FileTransfer/FileReadBytestream.h>
#include <Swiften/FileTransfer/FileTransferManager.h>
#include <Swiften/FileTransfer/OutgoingJingleFileTransfer.h>
#include <Swift/Controllers/Intl.h>
#include <Swift/Controllers/UIInterfaces/ChatWindow.h>
namespace Swift {
FileTransferController::FileTransferController(const JID& receipient, const std::string& filename, FileTransferManager* fileTransferManager) :
sending(true), otherParty(receipient), filename(filename), ftManager(fileTransferManager), ftProgressInfo(nullptr), chatWindow(nullptr), currentState(FileTransfer::State::WaitingForStart) {
}
FileTransferController::FileTransferController(IncomingFileTransfer::ref transfer) :
sending(false), otherParty(transfer->getSender()), filename(transfer->getFileName()), transfer(transfer), ftManager(nullptr), ftProgressInfo(nullptr), chatWindow(nullptr), currentState(FileTransfer::State::WaitingForStart) {
transfer->onStateChanged.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1));
}
FileTransferController::~FileTransferController() {
delete ftProgressInfo;
transfer->onStateChanged.disconnect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1));
}
const JID &FileTransferController::getOtherParty() const {
return otherParty;
}
-std::string FileTransferController::setChatWindow(ChatWindow* wnd, std::string nickname) {
+std::string FileTransferController::setChatWindow(ChatWindow* wnd, const std::string& nickname, const std::string& avatarPath) {
chatWindow = wnd;
if (sending) {
- uiID = wnd->addFileTransfer(QT_TRANSLATE_NOOP("", "me"), true, filename, boost::filesystem::file_size(boost::filesystem::path(filename)), "");
+ uiID = wnd->addFileTransfer(QT_TRANSLATE_NOOP("", "me"), avatarPath, true, filename, boost::filesystem::file_size(boost::filesystem::path(filename)), "");
} else {
- uiID = wnd->addFileTransfer(nickname, false, filename, transfer->getFileSizeInBytes(), transfer->getDescription());
+ uiID = wnd->addFileTransfer(nickname, avatarPath, false, filename, transfer->getFileSizeInBytes(), transfer->getDescription());
}
return uiID;
}
void FileTransferController::setReceipient(const JID& receipient) {
this->otherParty = receipient;
}
bool FileTransferController::isIncoming() const {
return !sending;
}
FileTransfer::State FileTransferController::getState() const {
return currentState;
}
int FileTransferController::getProgress() const {
return ftProgressInfo ? ftProgressInfo->getPercentage() : 0;
}
boost::uintmax_t FileTransferController::getSize() const {
if (transfer) {
return transfer->getFileSizeInBytes();
} else {
return 0;
}
}
void FileTransferController::start(std::string& description) {
SWIFT_LOG(debug) << "FileTransferController::start" << std::endl;