/* * Copyright (c) 2011 Tobias Markmann * Licensed under the simplified BSD license. * See Documentation/Licenses/BSD-simplified.txt for more information. */ /* * Copyright (c) 2013 Remko Tronçon * Licensed under the GNU General Public License. * See the COPYING file for more information. */ #pragma once #include #include #include #include #include namespace Swift { class FileTransfer { public: struct State { enum Type { Initial, WaitingForStart, Negotiating, WaitingForAccept, Transferring, Canceled, Failed, Finished }; State(Type type, const std::string& message = "") : type(type), message(message) {} Type type; std::string message; }; typedef boost::shared_ptr ref; public: FileTransfer(); virtual ~FileTransfer(); virtual void cancel() = 0; const std::string& getFileName() const { return filename; } boost::uintmax_t getFileSizeInBytes() const { return fileSizeInBytes; } public: boost::signal onProcessedBytes; boost::signal onStateChanged; boost::signal)> onFinished; protected: void setFileInfo(const std::string& name, boost::uintmax_t size); private: boost::uintmax_t fileSizeInBytes; std::string filename; }; }