Started implementing the gui2 network transmission dialog.

This commit is contained in:
Sergey Popov 2011-06-17 00:17:41 +00:00
parent 98e3c08f53
commit 2e0b1f7853
6 changed files with 219 additions and 0 deletions

View file

@ -0,0 +1,108 @@
#textdomain wesnoth-lib
###
### Dialog that tracks progress of a network transmission
###
[window]
id = "network_transmission"
description = "Dialog that tracks progress of a network transmission"
[resolution]
definition = "default"
maximum_width = 800
[tooltip]
id = "tooltip_large"
[/tooltip]
[helptip]
id = "tooltip_large"
[/helptip]
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
id = "title"
definition = "title"
[/label]
[/column]
[/row]
[row]
[column]
grow_factor = 1
horizontal_grow = "true"
border = "all"
border_size = 5
[progress_bar]
id = "progress"
definition = "default"
[/progress_bar]
[/column]
[/row]
[row]
[column]
grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
[column]
grow_factor = 1
[spacer]
definition = "default"
[/spacer]
[/column]
[column]
border = "all"
border_size = 5
horizontal_alignment = "right"
[button]
id = "cancel"
definition = "default"
label = "Cancel"
[/button]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]
[/resolution]
[/window]

View file

@ -463,6 +463,7 @@ set(wesnoth-main_SRC
gui/dialogs/mp_create_game_set_password.cpp
gui/dialogs/mp_login.cpp
gui/dialogs/mp_method_selection.cpp
gui/dialogs/network_transmission.cpp
gui/dialogs/popup.cpp
gui/dialogs/simple_item_selector.cpp
gui/dialogs/tip.cpp

View file

@ -322,6 +322,7 @@ wesnoth_sources = Split("""
gui/dialogs/mp_create_game_set_password.cpp
gui/dialogs/mp_login.cpp
gui/dialogs/mp_method_selection.cpp
gui/dialogs/network_transmission.cpp
gui/dialogs/popup.cpp
gui/dialogs/simple_item_selector.cpp
gui/dialogs/tip.cpp

View file

@ -28,6 +28,7 @@
#include "gui/dialogs/addon_list.hpp"
#include "gui/dialogs/addon/description.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/dialogs/network_transmission.hpp"
#include "gui/dialogs/simple_item_selector.hpp"
#include "gui/dialogs/transient_message.hpp"
#include "gui/widgets/settings.hpp"
@ -1123,6 +1124,10 @@ namespace {
preferences::set_campaign_server(remote_address);
try {
if(gui2::new_widgets) {
gui2::tnetwork_transmission network_receive("WIP network transmission dialog");
network_receive.show(disp.video());
}
const network::manager net_manager;
const network::connection sock =
dialogs::network_connect_dialog(disp, _("Connecting to add-ons server..."),

View file

@ -0,0 +1,47 @@
/* $Id$ */
/*
Copyright (C) 2011 Sergey Popov <loonycyborg@gmail.com>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#define GETTEXT_DOMAIN "wesnoth-lib"
#include "gui/dialogs/network_transmission.hpp"
#include "foreach.hpp"
#include "gettext.hpp"
#include "gui/widgets/button.hpp"
#include "gui/widgets/progress_bar.hpp"
#include "gui/widgets/label.hpp"
#include "gui/widgets/settings.hpp"
#include "gui/widgets/window.hpp"
#include "log.hpp"
namespace gui2 {
REGISTER_DIALOG(network_transmission)
void tnetwork_transmission::pre_show(CVideo& /*video*/, twindow& window)
{
// ***** ***** ***** ***** Set up the widgets ***** ***** ***** *****
if(!title_.empty()) {
find_widget<tlabel>(&window, "title", false).set_label(title_);
}
}
void tnetwork_transmission::post_show(twindow& /*window*/)
{
}
} // namespace gui2

View file

@ -0,0 +1,57 @@
/* $Id$ */
/*
Copyright (C) 2011 by Sergey Popov <loonycyborg@gmail.com>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#ifndef GUI_DIALOGS_NETWORK_RECEIVE_HPP_INCLUDED
#define GUI_DIALOGS_NETWORK_RECEIVE_HPP_INCLUDED
#include "gui/dialogs/dialog.hpp"
#include "gui/widgets/control.hpp"
namespace gui2 {
class tnetwork_transmission;
/**
* Dialog that tracks network transmissions
*
* It shows upload/download progress and allows the user
* to cancel the transmission.
*/
class tnetwork_transmission : public tdialog
{
public:
tnetwork_transmission(const std::string& title)
: title_(title)
{}
protected:
/** Inherited from tdialog. */
void pre_show(CVideo& video, twindow& window);
/** Inherited from tdialog. */
void post_show(twindow& window);
private:
/** The title for the dialog. */
std::string title_;
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
virtual const std::string& window_id() const;
};
} // namespace gui2
#endif