diff options
Diffstat (limited to 'Swift/Controllers/FileTransfer')
6 files changed, 269 insertions, 181 deletions
| diff --git a/Swift/Controllers/FileTransfer/FileTransferController.cpp b/Swift/Controllers/FileTransfer/FileTransferController.cpp index 0160a7a..5b86a7b 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferController.cpp @@ -4,150 +4,160 @@   * See Documentation/Licenses/BSD-simplified.txt for more information.   */ -#include "FileTransferController.h" -#include "Swiften/FileTransfer/OutgoingJingleFileTransfer.h" -#include "Swiften/FileTransfer/FileTransferManager.h" -#include <Swiften/FileTransfer/FileReadBytestream.h> -#include <Swiften/Base/boost_bsignals.h> +/* + * Copyright (c) 2015-2019 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 "Swift/Controllers/UIInterfaces/ChatWindow.h" +#include <boost/signals2.hpp> +  #include <Swiften/Base/Log.h> -#include <Swift/Controllers/Intl.h> +#include <Swiften/FileTransfer/FileReadBytestream.h> +#include <Swiften/FileTransfer/FileTransferManager.h> +#include <Swiften/FileTransfer/OutgoingJingleFileTransfer.h> -#include <boost/smart_ptr/make_shared.hpp> +#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(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) { -	 +    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(0), ftProgressInfo(0), chatWindow(0), currentState(FileTransfer::State::WaitingForStart) { - +    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; +    delete ftProgressInfo; +    transfer->onStateChanged.disconnect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1));  }  const JID &FileTransferController::getOtherParty() const { -	return otherParty; +    return otherParty;  } -std::string FileTransferController::setChatWindow(ChatWindow* wnd, std::string nickname) { -	chatWindow = wnd; -	if (sending) { -		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->getFileSizeInBytes()); -	} -	return uiID; +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"), avatarPath, true, filename, boost::filesystem::file_size(boost::filesystem::path(filename)), ""); +    } else { +        uiID = wnd->addFileTransfer(nickname, avatarPath, false, filename, transfer->getFileSizeInBytes(), transfer->getDescription()); +    } +    return uiID;  }  void FileTransferController::setReceipient(const JID& receipient) { -	this->otherParty = receipient; +    this->otherParty = receipient;  }  bool FileTransferController::isIncoming() const { -	return !sending; +    return !sending;  }  FileTransfer::State FileTransferController::getState() const { -	return currentState; +    return currentState;  }  int FileTransferController::getProgress() const { -	return ftProgressInfo ? ftProgressInfo->getPercentage() : 0; +    return ftProgressInfo ? ftProgressInfo->getPercentage() : 0;  }  boost::uintmax_t FileTransferController::getSize() const { -	if (transfer) { -		return transfer->getFileSizeInBytes(); -	} else { -		return 0; -	} +    if (transfer) { +        return transfer->getFileSizeInBytes(); +    } else { +        return 0; +    }  }  void FileTransferController::start(std::string& description) { -	SWIFT_LOG(debug) << "FileTransferController::start" << std::endl; -	fileReadStream = boost::make_shared<FileReadBytestream>(boost::filesystem::path(filename)); -	OutgoingFileTransfer::ref outgoingTransfer = ftManager->createOutgoingFileTransfer(otherParty, boost::filesystem::path(filename), description, fileReadStream); -	if (outgoingTransfer) { -		ftProgressInfo = new FileTransferProgressInfo(outgoingTransfer->getFileSizeInBytes()); -		ftProgressInfo->onProgressPercentage.connect(boost::bind(&FileTransferController::handleProgressPercentageChange, this, _1)); -		outgoingTransfer->onStateChanged.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); -		outgoingTransfer->onProcessedBytes.connect(boost::bind(&FileTransferProgressInfo::setBytesProcessed, ftProgressInfo, _1)); -		outgoingTransfer->start(); -		transfer = outgoingTransfer; -	} else { -		std::cerr << "File transfer not supported!" << std::endl; -	} +    SWIFT_LOG(debug) << "FileTransferController::start"; +    fileReadStream = std::make_shared<FileReadBytestream>(boost::filesystem::path(filename)); +    OutgoingFileTransfer::ref outgoingTransfer = ftManager->createOutgoingFileTransfer(otherParty, boost::filesystem::path(filename), description, fileReadStream); +    if (outgoingTransfer) { +        ftProgressInfo = new FileTransferProgressInfo(outgoingTransfer->getFileSizeInBytes()); +        ftProgressInfo->onProgressPercentage.connect(boost::bind(&FileTransferController::handleProgressPercentageChange, this, _1)); +        outgoingTransfer->onStateChanged.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); +        outgoingTransfer->onProcessedBytes.connect(boost::bind(&FileTransferProgressInfo::setBytesProcessed, ftProgressInfo, _1)); +        outgoingTransfer->start(); +        transfer = outgoingTransfer; +    } else { +        std::cerr << "File transfer not supported!" << std::endl; +    }  }  void FileTransferController::accept(std::string& file) { -	SWIFT_LOG(debug) << "FileTransferController::accept" << std::endl; -	IncomingFileTransfer::ref incomingTransfer = boost::dynamic_pointer_cast<IncomingFileTransfer>(transfer); -	if (incomingTransfer) { -		fileWriteStream = boost::make_shared<FileWriteBytestream>(boost::filesystem::path(file)); +    SWIFT_LOG(debug) << "FileTransferController::accept"; +    IncomingFileTransfer::ref incomingTransfer = std::dynamic_pointer_cast<IncomingFileTransfer>(transfer); +    if (incomingTransfer) { +        fileWriteStream = std::make_shared<FileWriteBytestream>(boost::filesystem::path(file)); -		ftProgressInfo = new FileTransferProgressInfo(transfer->getFileSizeInBytes()); -		ftProgressInfo->onProgressPercentage.connect(boost::bind(&FileTransferController::handleProgressPercentageChange, this, _1)); -		transfer->onStateChanged.connect(boost::bind(&FileTransferController::handleFileTransferStateChange, this, _1)); -		transfer->onProcessedBytes.connect(boost::bind(&FileTransferProgressInfo::setBytesProcessed, ftProgressInfo, _1)); -		incomingTransfer->accept(fileWriteStream); -	} else { -		std::cerr << "Expected an incoming transfer in this situation!" << std::endl; -	} +        ftProgressInfo = new FileTransferProgressInfo(transfer->getFileSizeInBytes()); +        ftProgressInfo->onProgressPercentage.connect(boost::bind(&FileTransferController::handleProgressPercentageChange, this, _1)); +        transfer->onProcessedBytes.connect(boost::bind(&FileTransferProgressInfo::setBytesProcessed, ftProgressInfo, _1)); +        incomingTransfer->accept(fileWriteStream); +    } else { +        std::cerr << "Expected an incoming transfer in this situation!" << std::endl; +    }  }  void FileTransferController::cancel() { -	if (transfer) { -		transfer->cancel(); -	} else { -		chatWindow->setFileTransferStatus(uiID, ChatWindow::Canceled); -	} +    if (transfer) { +        transfer->cancel(); +    } else { +        chatWindow->setFileTransferStatus(uiID, ChatWindow::Canceled); +    }  }  void FileTransferController::handleFileTransferStateChange(FileTransfer::State state) { -	currentState = state; -	onStateChage(); -	switch(state.type) { -		case FileTransfer::State::Initial: -			assert(false); -			return; -		case FileTransfer::State::Negotiating: -			chatWindow->setFileTransferStatus(uiID, ChatWindow::Negotiating); -			return; -		case FileTransfer::State::Transferring: -			chatWindow->setFileTransferStatus(uiID, ChatWindow::Transferring); -			return; -		case FileTransfer::State::Canceled: -			chatWindow->setFileTransferStatus(uiID, ChatWindow::Canceled); -			return; -		case FileTransfer::State::Finished: -			chatWindow->setFileTransferStatus(uiID, ChatWindow::Finished); -			if (fileWriteStream) { -				fileWriteStream->close(); -			} -			return; -		case FileTransfer::State::Failed: -			chatWindow->setFileTransferStatus(uiID, ChatWindow::FTFailed); -			return; -		case FileTransfer::State::WaitingForAccept: -			chatWindow->setFileTransferStatus(uiID, ChatWindow::WaitingForAccept); -			return; -		case FileTransfer::State::WaitingForStart: -			return; -	} -	assert(false); +    currentState = state; +    onStateChanged(); +    switch(state.type) { +        case FileTransfer::State::Initial: +            assert(false); +            return; +        case FileTransfer::State::Negotiating: +            chatWindow->setFileTransferStatus(uiID, ChatWindow::Negotiating); +            return; +        case FileTransfer::State::Transferring: +            chatWindow->setFileTransferStatus(uiID, ChatWindow::Transferring); +            return; +        case FileTransfer::State::Canceled: +            chatWindow->setFileTransferStatus(uiID, ChatWindow::Canceled); +            return; +        case FileTransfer::State::Finished: +            chatWindow->setFileTransferStatus(uiID, ChatWindow::Finished); +            if (fileWriteStream) { +                fileWriteStream->close(); +            } +            return; +        case FileTransfer::State::Failed: +            chatWindow->setFileTransferStatus(uiID, ChatWindow::FTFailed); +            return; +        case FileTransfer::State::WaitingForAccept: +            chatWindow->setFileTransferStatus(uiID, ChatWindow::WaitingForAccept); +            return; +        case FileTransfer::State::WaitingForStart: +            chatWindow->setFileTransferStatus(uiID, ChatWindow::Initialisation); +            return; +    } +    assert(false);  }  void FileTransferController::handleProgressPercentageChange(int percentage) { -	onProgressChange(); -	chatWindow->setFileTransferProgress(uiID, percentage); +    onProgressChange(); +    chatWindow->setFileTransferProgress(uiID, percentage);  }  } diff --git a/Swift/Controllers/FileTransfer/FileTransferController.h b/Swift/Controllers/FileTransfer/FileTransferController.h index 3d6f7d5..e36cac8 100644 --- a/Swift/Controllers/FileTransfer/FileTransferController.h +++ b/Swift/Controllers/FileTransfer/FileTransferController.h @@ -4,18 +4,25 @@   * See Documentation/Licenses/BSD-simplified.txt for more information.   */ +/* + * Copyright (c) 2015-2017 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ +  #pragma once +#include <memory>  #include <string> -#include <boost/shared_ptr.hpp>  #include <boost/cstdint.hpp> -#include <Swiften/JID/JID.h> -#include <Swiften/FileTransfer/FileTransfer.h> -#include <Swiften/FileTransfer/IncomingFileTransfer.h>  #include <Swiften/FileTransfer/FileReadBytestream.h> +#include <Swiften/FileTransfer/FileTransfer.h>  #include <Swiften/FileTransfer/FileWriteBytestream.h> +#include <Swiften/FileTransfer/IncomingFileTransfer.h> +#include <Swiften/JID/JID.h> +  #include <Swift/Controllers/FileTransfer/FileTransferProgressInfo.h>  namespace Swift { @@ -25,49 +32,49 @@ class ChatWindow;  class FileTransferController {  public: -	/** -	 * For outgoing file transfers. It'll create a file transfer via FileTransferManager as soon as the descriptive information is available. -	 */ -	FileTransferController(const JID&, const std::string&, FileTransferManager*); +    /** +     * For outgoing file transfers. It'll create a file transfer via FileTransferManager as soon as the descriptive information is available. +     */ +    FileTransferController(const JID&, const std::string&, FileTransferManager*); + +    /** +     * For incoming file transfers. +     */ +    FileTransferController(IncomingFileTransfer::ref transfer); +    ~FileTransferController(); -	/** -	 * For incoming file transfers. -	 */ -	FileTransferController(IncomingFileTransfer::ref transfer); -	~FileTransferController(); +    std::string setChatWindow(ChatWindow*, const std::string& nickname, const std::string& avatarPath); +    void setReceipient(const JID& otherParty); -	std::string setChatWindow(ChatWindow*, std::string nickname); -	void setReceipient(const JID& otherParty); +    void start(std::string& description); +    void accept(std::string& file); +    void cancel(); -	void start(std::string& description); -	void accept(std::string& file); -	void cancel(); +    const JID &getOtherParty() const; +    bool isIncoming() const; +    FileTransfer::State getState() const; +    int getProgress() const; +    boost::uintmax_t getSize() const; -	const JID &getOtherParty() const; -	bool isIncoming() const; -	FileTransfer::State getState() const; -	int getProgress() const; -	boost::uintmax_t getSize() const; +    boost::signals2::signal<void ()> onStateChanged; +    boost::signals2::signal<void ()> onProgressChange; -	boost::signal<void ()> onStateChage; -	boost::signal<void ()> onProgressChange; +private: +    void handleFileTransferStateChange(FileTransfer::State); +    void handleProgressPercentageChange(int percentage);  private: -	void handleFileTransferStateChange(FileTransfer::State); -	void handleProgressPercentageChange(int percentage); - -private:	 -	bool sending; -	JID otherParty; -	std::string filename; -	FileTransfer::ref transfer; -	boost::shared_ptr<FileReadBytestream> fileReadStream; -	boost::shared_ptr<FileWriteBytestream> fileWriteStream; -	FileTransferManager* ftManager; -	FileTransferProgressInfo* ftProgressInfo; -	ChatWindow* chatWindow; -	std::string uiID; -	FileTransfer::State currentState; +    bool sending; +    JID otherParty; +    std::string filename; +    FileTransfer::ref transfer; +    std::shared_ptr<FileReadBytestream> fileReadStream; +    std::shared_ptr<FileWriteBytestream> fileWriteStream; +    FileTransferManager* ftManager; +    FileTransferProgressInfo* ftProgressInfo; +    ChatWindow* chatWindow; +    std::string uiID; +    FileTransfer::State currentState;  };  } diff --git a/Swift/Controllers/FileTransfer/FileTransferOverview.cpp b/Swift/Controllers/FileTransfer/FileTransferOverview.cpp index 2a8c319..fcc35e4 100644 --- a/Swift/Controllers/FileTransfer/FileTransferOverview.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferOverview.cpp @@ -4,41 +4,88 @@   * See Documentation/Licenses/BSD-simplified.txt for more information.   */ -#include "FileTransferOverview.h" +/* + * Copyright (c) 2015-2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + +#include <Swift/Controllers/FileTransfer/FileTransferOverview.h>  #include <boost/bind.hpp>  #include <boost/filesystem.hpp> -#include <Swiften/Base/boost_bsignals.h> +#include <boost/signals2.hpp> +#include <Swiften/Base/Log.h>  #include <Swiften/FileTransfer/FileTransferManager.h>  namespace Swift {  FileTransferOverview::FileTransferOverview(FileTransferManager* ftm) : fileTransferManager(ftm) { -	fileTransferManager->onIncomingFileTransfer.connect(boost::bind(&FileTransferOverview::handleIncomingFileTransfer, 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)); +    for (auto 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); -		fileTransfers.push_back(controller); -		onNewFileTransferController(controller); -	} +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); +    }  }  void FileTransferOverview::handleIncomingFileTransfer(IncomingFileTransfer::ref transfer) { -	FileTransferController* controller = new FileTransferController(transfer); -	fileTransfers.push_back(controller); -	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)); +} + +void FileTransferOverview::handleFileTransferStateChanged() { +    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(); +} + +bool FileTransferOverview::isClearable() const { +    bool isClearable = false; +    for (auto 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;  }  } diff --git a/Swift/Controllers/FileTransfer/FileTransferOverview.h b/Swift/Controllers/FileTransfer/FileTransferOverview.h index 716666a..c311cb7 100644 --- a/Swift/Controllers/FileTransfer/FileTransferOverview.h +++ b/Swift/Controllers/FileTransfer/FileTransferOverview.h @@ -4,13 +4,19 @@   * See Documentation/Licenses/BSD-simplified.txt for more information.   */ +/* + * Copyright (c) 2015-2016 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ +  #pragma once  #include <vector> -#include "Swift/Controllers/FileTransfer/FileTransferController.h" +#include <boost/signals2.hpp> -#include <Swiften/Base/boost_bsignals.h> +#include <Swift/Controllers/FileTransfer/FileTransferController.h>  namespace Swift { @@ -19,20 +25,25 @@ class FileTransferManager;  class FileTransferOverview {  public: -	FileTransferOverview(FileTransferManager*); -	~FileTransferOverview(); -	 -	void sendFile(const JID&, const std::string&); -	const std::vector<FileTransferController*>& getFileTransfers() const; +    FileTransferOverview(FileTransferManager*); +    ~FileTransferOverview(); + +    void sendFile(const JID&, const std::string&); +    const std::vector<FileTransferController*>& getFileTransfers() const; +    void clearFinished(); +    bool isClearable() const; -	boost::signal<void (FileTransferController*)> onNewFileTransferController; +    boost::signals2::signal<void (FileTransferController*)> onNewFileTransferController; +    boost::signals2::signal<void ()> onFileTransferListChanged;  private: -	void handleIncomingFileTransfer(IncomingFileTransfer::ref transfer); +    void handleIncomingFileTransfer(IncomingFileTransfer::ref transfer); +    void handleNewFileTransferController(FileTransferController* controller); +    void handleFileTransferStateChanged();  private: -	std::vector<FileTransferController*> fileTransfers; -	FileTransferManager *fileTransferManager; +    std::vector<FileTransferController*> fileTransfers; +    FileTransferManager *fileTransferManager;  };  } diff --git a/Swift/Controllers/FileTransfer/FileTransferProgressInfo.cpp b/Swift/Controllers/FileTransfer/FileTransferProgressInfo.cpp index 3081f71..eddace9 100644 --- a/Swift/Controllers/FileTransfer/FileTransferProgressInfo.cpp +++ b/Swift/Controllers/FileTransfer/FileTransferProgressInfo.cpp @@ -4,7 +4,13 @@   * See Documentation/Licenses/BSD-simplified.txt for more information.   */ -#include "FileTransferProgressInfo.h" +/* + * Copyright (c) 2016-2018 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ + +#include <Swift/Controllers/FileTransfer/FileTransferProgressInfo.h>  #include <boost/numeric/conversion/cast.hpp> @@ -12,22 +18,22 @@  namespace Swift { -FileTransferProgressInfo::FileTransferProgressInfo(boost::uintmax_t completeBytes) : completeBytes(completeBytes), completedBytes(0), percentage(0) { -	onProgressPercentage(0); +FileTransferProgressInfo::FileTransferProgressInfo(size_t completeBytes) : completeBytes(completeBytes), completedBytes(0), percentage(0) { +    onProgressPercentage(0);  } -void FileTransferProgressInfo::setBytesProcessed(int processedBytes) { -	int oldPercentage = int(double(completedBytes) / double(completeBytes) * 100.0); -	completedBytes += boost::numeric_cast<boost::uintmax_t>(processedBytes); -	int newPercentage = int(double(completedBytes) / double(completeBytes) * 100.0); -	if (oldPercentage != newPercentage) { -		onProgressPercentage(newPercentage); -	} -	percentage = newPercentage; +void FileTransferProgressInfo::setBytesProcessed(size_t processedBytes) { +    int oldPercentage = int(double(completedBytes) / double(completeBytes) * 100.0); +    completedBytes += processedBytes; +    int newPercentage = int(double(completedBytes) / double(completeBytes) * 100.0); +    if (oldPercentage != newPercentage) { +        onProgressPercentage(newPercentage); +    } +    percentage = newPercentage;  }  int FileTransferProgressInfo::getPercentage() const { -	return percentage; +    return percentage;  }  } diff --git a/Swift/Controllers/FileTransfer/FileTransferProgressInfo.h b/Swift/Controllers/FileTransfer/FileTransferProgressInfo.h index e324e33..869ceba 100644 --- a/Swift/Controllers/FileTransfer/FileTransferProgressInfo.h +++ b/Swift/Controllers/FileTransfer/FileTransferProgressInfo.h @@ -4,27 +4,34 @@   * See Documentation/Licenses/BSD-simplified.txt for more information.   */ +/* + * Copyright (c) 2016-2018 Isode Limited. + * All rights reserved. + * See the COPYING file for more information. + */ +  #pragma once -#include <Swiften/Base/boost_bsignals.h> -#include <boost/cstdint.hpp> +#include <cstddef> + +#include <boost/signals2.hpp>  namespace Swift {  class FileTransferProgressInfo {  public: -	FileTransferProgressInfo(boost::uintmax_t completeBytes); +    FileTransferProgressInfo(size_t completeBytes);  public: -	void setBytesProcessed(int processedBytes); +    void setBytesProcessed(size_t processedBytes); -	int getPercentage() const; -	boost::signal<void (int)> onProgressPercentage; +    int getPercentage() const; +    boost::signals2::signal<void (int)> onProgressPercentage;  private: -	boost::uintmax_t completeBytes; -	boost::uintmax_t completedBytes; -	int percentage; +    size_t completeBytes; +    size_t completedBytes; +    int percentage;  };  } | 
 Swift
 Swift