Remove an unused dialog.

This commit is contained in:
Boldizsár Lipka 2013-12-22 01:38:22 +01:00
parent 113ab5599b
commit 871aadca1a
6 changed files with 0 additions and 182 deletions

View file

@ -747,7 +747,6 @@ set(wesnoth-main_SRC
gui/dialogs/mp_cmd_wrapper.cpp
gui/dialogs/mp_connect.cpp
gui/dialogs/mp_create_game.cpp
gui/dialogs/mp_create_game_choose_mods.cpp
gui/dialogs/mp_create_game_set_password.cpp
gui/dialogs/mp_depcheck_confirm_change.cpp
gui/dialogs/mp_depcheck_select_new.cpp

View file

@ -380,7 +380,6 @@ wesnoth_sources = Split("""
gui/dialogs/mp_change_control.cpp
gui/dialogs/mp_connect.cpp
gui/dialogs/mp_create_game.cpp
gui/dialogs/mp_create_game_choose_mods.cpp
gui/dialogs/mp_create_game_set_password.cpp
gui/dialogs/mp_depcheck_confirm_change.cpp
gui/dialogs/mp_depcheck_select_new.cpp

View file

@ -1,113 +0,0 @@
/*
Copyright (C) 2012 - 2013 by Boldizsár Lipka <lipkab@zoho.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/mp_create_game_choose_mods.hpp"
#include "game_preferences.hpp"
#include "gui/auxiliary/find_widget.tpp"
#include "gui/widgets/settings.hpp"
#include "gui/widgets/toggle_button.hpp"
#include "gui/widgets/window.hpp"
#include "gettext.hpp"
namespace gui2 {
/*WIKI
* @page = GUIWindowDefinitionWML
* @order = 2_mp_create_game_choose_mods
*
* == Create Game: Choose Modifications ==
*
* The dialog for selecting modifications.
*
* @begin{table}{dialog_widgets}
*
* mod_list & & listbox & m &
* displays the list of the available modifications $
*
* -checkbox & & toggle_button & o &
* enable/disable a modification $
*
* -name & & label & o &
* displays the modification's name $
*
* -description & & label & o &
* displays the modification's description $
*
* ok & & button & m &
* closes the dialog, applies changes $
*
* cancel & & button & m &
* closes the dialog, discards changes $
*
* @end{table}
*/
REGISTER_DIALOG(mp_create_game_choose_mods)
tmp_create_game_choose_mods::tmp_create_game_choose_mods
(const config& game_cfg,
std::vector<std::string>& result)
: result_(result)
, game_cfg_(game_cfg)
, mod_list_(NULL)
{
}
void tmp_create_game_choose_mods::pre_show(CVideo &/*video*/, twindow &window)
{
mod_list_ = find_widget<tlistbox>(&window, "mod_list", false, true);
FOREACH(const AUTO& mod, game_cfg_.child_range("modification")) {
string_map column;
std::map<std::string, string_map> item;
column["label"] = mod["name"];
item.insert(std::make_pair("name", column));
column["label"] = mod["description"];
item.insert(std::make_pair("description", column));
mod_list_->add_row(item);
tgrid *grid = mod_list_->get_row_grid(mod_list_->get_item_count()-1);
ttoggle_button &checkbox =
find_widget<ttoggle_button>(grid, "checkbox", false);
checkbox.set_value(std::find( result_.begin(), result_.end(),
mod["id"].str()) != result_.end());
}
}
void tmp_create_game_choose_mods::post_show(twindow& /*window*/)
{
if (get_retval() == twindow::OK) {
result_.clear();
for(unsigned int i = 0; i < mod_list_->get_item_count(); i++) {
const tgrid *grid = mod_list_->get_row_grid(i);
const ttoggle_button &checkbox =
find_widget<const ttoggle_button>(grid, "checkbox", false);
if (checkbox.get_value()) {
result_.push_back(game_cfg_.child("modification", i)["id"]);
}
}
}
}
} // namespace gui2

View file

@ -1,65 +0,0 @@
/*
Copyright (C) 2012 - 2013 by Boldizsár Lipka <lipkab@zoho.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_MP_CREATE_GAME_CHOOSE_MODS_HPP_INCLUDED
#define GUI_DIALOGS_MP_CREATE_GAME_CHOOSE_MODS_HPP_INCLUDED
#include "gui/dialogs/dialog.hpp"
#include "gui/widgets/listbox.hpp"
#include <vector>
#include <string>
class config;
namespace gui2 {
class tmp_create_game_choose_mods : public tdialog
{
public:
/**
* Constructor.
*
* @param game_cfg the config which contains the information for the
* modifications
* @param result [in] the list of the currently activated modifications
* @param result [out] the list of all activated modifications
*/
tmp_create_game_choose_mods(const config& game_cfg,
std::vector<std::string>& result);
private:
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
virtual const std::string& window_id() const;
/** Inherited from tdialog */
void pre_show(CVideo &video, twindow &window);
/** Inherited from tdialog */
void post_show(twindow &window);
/** a reference to the variable the result should be written into */
std::vector<std::string>& result_;
/** a reference to the config which contains the info about modifications*/
const config& game_cfg_;
/** a pointer to the listbox which displays the items */
gui2::tlistbox *mod_list_;
};
} // namespace gui2
#endif

View file

@ -23,7 +23,6 @@
#include "map_exception.hpp"
#include "generators/map_create.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/dialogs/mp_create_game_choose_mods.hpp"
#include "gui/dialogs/mp_create_game_set_password.hpp"
#include "gui/dialogs/transient_message.hpp"
#include "minimap.hpp"

View file

@ -30,7 +30,6 @@
#include "generators/map_create.hpp"
#include "gui/dialogs/message.hpp"
#include "gui/dialogs/campaign_difficulty.hpp"
#include "gui/dialogs/mp_create_game_choose_mods.hpp"
#include "gui/dialogs/mp_create_game_set_password.hpp"
#include "gui/dialogs/transient_message.hpp"
#include "gui/widgets/window.hpp"