00001 /* $Id: network_transmission.hpp 54116 2012-05-07 00:15:14Z loonycyborg $ */ 00002 /* 00003 Copyright (C) 2011 - 2012 by Sergey Popov <loonycyborg@gmail.com> 00004 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY. 00012 00013 See the COPYING file for more details. 00014 */ 00015 00016 #ifndef GUI_DIALOGS_NETWORK_RECEIVE_HPP_INCLUDED 00017 #define GUI_DIALOGS_NETWORK_RECEIVE_HPP_INCLUDED 00018 00019 #include "gui/dialogs/dialog.hpp" 00020 #include "gui/widgets/control.hpp" 00021 #include "network_asio.hpp" 00022 #include <boost/optional.hpp> 00023 00024 namespace gui2 { 00025 00026 class tnetwork_transmission; 00027 00028 /** 00029 * Dialog that tracks network transmissions 00030 * 00031 * It shows upload/download progress and allows the user 00032 * to cancel the transmission. 00033 */ 00034 class tnetwork_transmission : public tdialog 00035 { 00036 network_asio::connection& connection_; 00037 00038 class pump_monitor : public events::pump_monitor 00039 { 00040 network_asio::connection& connection_; 00041 bool& track_upload_; 00042 virtual void process(events::pump_info&); 00043 public: 00044 pump_monitor(network_asio::connection& connection, bool& track_upload) 00045 : connection_(connection) 00046 , track_upload_(track_upload) 00047 , window_() 00048 { 00049 } 00050 00051 boost::optional<twindow&> window_; 00052 } pump_monitor; 00053 public: 00054 00055 tnetwork_transmission( 00056 network_asio::connection& connection 00057 , const std::string& title 00058 , const std::string& subtitle); 00059 00060 void set_subtitle(const std::string&); 00061 void set_track_upload(bool track_upload) { track_upload_ = track_upload; } 00062 00063 protected: 00064 /** Inherited from tdialog. */ 00065 void pre_show(CVideo& video, twindow& window); 00066 00067 /** Inherited from tdialog. */ 00068 void post_show(twindow& window); 00069 00070 private: 00071 bool track_upload_; 00072 /** 00073 * The subtitle for the dialog. 00074 * 00075 * This field commenly shows the action in progress eg connecting, 00076 * uploading, downloading etc.. 00077 */ 00078 std::string subtitle_; 00079 00080 /** Inherited from tdialog, implemented by REGISTER_DIALOG. */ 00081 virtual const std::string& window_id() const; 00082 }; 00083 00084 } // namespace gui2 00085 00086 #endif 00087
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:58 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |