Removed Data Manage dialog
This dialog didn't do anything more than allow you to delete saves.
This commit is contained in:
parent
e7ea0a88c2
commit
cb992e88b0
8 changed files with 22 additions and 675 deletions
|
@ -1,373 +0,0 @@
|
|||
#textdomain wesnoth-lib
|
||||
###
|
||||
### Definition of the window to ask for the savegame filename
|
||||
###
|
||||
|
||||
[window]
|
||||
id = "data_manage"
|
||||
description = "Persistence data management dialog."
|
||||
|
||||
[resolution]
|
||||
definition = "default"
|
||||
|
||||
automatic_placement = "true"
|
||||
vertical_placement = "top"
|
||||
horizontal_placement = "center"
|
||||
|
||||
[linked_group]
|
||||
id = "filename"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[linked_group]
|
||||
id = "date"
|
||||
fixed_width = "true"
|
||||
[/linked_group]
|
||||
|
||||
[tooltip]
|
||||
id = "tooltip"
|
||||
[/tooltip]
|
||||
|
||||
[helptip]
|
||||
id = "tooltip"
|
||||
[/helptip]
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
[label]
|
||||
id = "lblTitle"
|
||||
definition = "title"
|
||||
|
||||
label = _ "Manage Data"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
|
||||
horizontal_grow = "true"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_grow = "true"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
|
||||
[label]
|
||||
id = "lblChoose"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Choose the game to load"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "right"
|
||||
border_size = 10
|
||||
vertical_alignment = "center"
|
||||
|
||||
[label]
|
||||
id = "lblFilter"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Filter"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
|
||||
[text_box]
|
||||
id = "txtFilter"
|
||||
definition = "default"
|
||||
[/text_box]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
|
||||
[listbox]
|
||||
id = "persist_list"
|
||||
definition = "default"
|
||||
[header]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
[label]
|
||||
id = "filename"
|
||||
definition = "default"
|
||||
linked_group = "filename"
|
||||
|
||||
label = _ "Name"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
[label]
|
||||
id = "date"
|
||||
definition = "default"
|
||||
linked_group = "date"
|
||||
|
||||
label = _ "Date"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/header]
|
||||
|
||||
[list_definition]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
|
||||
[toggle_panel]
|
||||
definition = "default"
|
||||
|
||||
return_value_id = "ok"
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
border = "bottom"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "filename"
|
||||
definition = "default"
|
||||
linked_group = "filename"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
border = "bottom"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "date"
|
||||
definition = "default"
|
||||
linked_group = "date"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/toggle_panel]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/list_definition]
|
||||
|
||||
[/listbox]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
|
||||
[button]
|
||||
id = "clear"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Clear"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
|
||||
[button]
|
||||
id = "restore"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Restore"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
border = "bottom"
|
||||
border_size = 10
|
||||
|
||||
[button]
|
||||
id = "backup"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Backup"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "right"
|
||||
|
||||
[button]
|
||||
id = "ok"
|
||||
definition = "default"
|
||||
|
||||
label = _ "OK"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[button]
|
||||
id = "cancel"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Cancel"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/resolution]
|
||||
|
||||
[/window]
|
|
@ -450,16 +450,8 @@
|
|||
<Unit filename="../../src/gettext.hpp" />
|
||||
<Unit filename="../../src/gettext_boost.cpp" />
|
||||
<Unit filename="../../src/global.hpp" />
|
||||
<Unit filename="../../src/gui/core/canvas.cpp" />
|
||||
<Unit filename="../../src/gui/core/canvas.hpp" />
|
||||
<Unit filename="../../src/gui/core/event/dispatcher.cpp" />
|
||||
<Unit filename="../../src/gui/core/event/dispatcher.hpp" />
|
||||
<Unit filename="../../src/gui/core/event/dispatcher_private.hpp" />
|
||||
<Unit filename="../../src/gui/core/event/distributor.cpp" />
|
||||
<Unit filename="../../src/gui/core/event/distributor.hpp" />
|
||||
<Unit filename="../../src/gui/core/event/handler.cpp" />
|
||||
<Unit filename="../../src/gui/core/event/handler.hpp" />
|
||||
<Unit filename="../../src/gui/core/event/message.hpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/field-fwd.hpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/field.hpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/filter.hpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/formula.hpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/iterator/exception.hpp" />
|
||||
|
@ -472,19 +464,31 @@
|
|||
<Unit filename="../../src/gui/auxiliary/iterator/walker_grid.hpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/iterator/walker_widget.cpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/iterator/walker_widget.hpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/old_markup.cpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/old_markup.hpp" />
|
||||
<Unit filename="../../src/gui/core/canvas.cpp" />
|
||||
<Unit filename="../../src/gui/core/canvas.hpp" />
|
||||
<Unit filename="../../src/gui/core/event/dispatcher.cpp" />
|
||||
<Unit filename="../../src/gui/core/event/dispatcher.hpp" />
|
||||
<Unit filename="../../src/gui/core/event/dispatcher_private.hpp" />
|
||||
<Unit filename="../../src/gui/core/event/distributor.cpp" />
|
||||
<Unit filename="../../src/gui/core/event/distributor.hpp" />
|
||||
<Unit filename="../../src/gui/core/event/handler.cpp" />
|
||||
<Unit filename="../../src/gui/core/event/handler.hpp" />
|
||||
<Unit filename="../../src/gui/core/event/message.hpp" />
|
||||
<Unit filename="../../src/gui/core/layout_exception.hpp" />
|
||||
<Unit filename="../../src/gui/core/log.cpp" />
|
||||
<Unit filename="../../src/gui/core/log.hpp" />
|
||||
<Unit filename="../../src/gui/core/notifiee.hpp" />
|
||||
<Unit filename="../../src/gui/core/notifier.hpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/old_markup.cpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/old_markup.hpp" />
|
||||
<Unit filename="../../src/gui/core/placer.cpp" />
|
||||
<Unit filename="../../src/gui/core/placer.hpp" />
|
||||
<Unit filename="../../src/gui/core/placer/horizontal_list.cpp" />
|
||||
<Unit filename="../../src/gui/core/placer/horizontal_list.hpp" />
|
||||
<Unit filename="../../src/gui/core/placer/vertical_list.cpp" />
|
||||
<Unit filename="../../src/gui/core/placer/vertical_list.hpp" />
|
||||
<Unit filename="../../src/gui/core/point.cpp" />
|
||||
<Unit filename="../../src/gui/core/point.hpp" />
|
||||
<Unit filename="../../src/gui/core/timer.cpp" />
|
||||
<Unit filename="../../src/gui/core/timer.hpp" />
|
||||
<Unit filename="../../src/gui/core/tips.cpp" />
|
||||
|
@ -497,16 +501,16 @@
|
|||
<Unit filename="../../src/gui/core/window_builder/helper.hpp" />
|
||||
<Unit filename="../../src/gui/core/window_builder/instance.cpp" />
|
||||
<Unit filename="../../src/gui/core/window_builder/instance.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/connect.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/connect.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/description.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/description.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/filter_options.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/filter_options.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/uninstall_list.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/uninstall_list.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/connect.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/connect.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/list.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/list.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/uninstall_list.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/addon/uninstall_list.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/advanced_graphics_options.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/advanced_graphics_options.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/campaign_difficulty.cpp" />
|
||||
|
@ -518,8 +522,6 @@
|
|||
<Unit filename="../../src/gui/dialogs/chat_log.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/chat_log.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/core_selection.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/data_manage.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/data_manage.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/debug_clock.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/debug_clock.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/depcheck_confirm_change.cpp" />
|
||||
|
@ -550,8 +552,6 @@
|
|||
<Unit filename="../../src/gui/dialogs/editor/resize_map.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/editor/set_starting_position.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/editor/set_starting_position.hpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/field-fwd.hpp" />
|
||||
<Unit filename="../../src/gui/auxiliary/field.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/folder_create.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/folder_create.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/formula_debugger.cpp" />
|
||||
|
@ -605,6 +605,8 @@
|
|||
<Unit filename="../../src/gui/dialogs/multiplayer/mp_login.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/multiplayer/mp_method_selection.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/multiplayer/mp_method_selection.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/multiplayer/synced_choice_wait.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/multiplayer/synced_choice_wait.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/network_transmission.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/network_transmission.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/popup.cpp" />
|
||||
|
@ -617,8 +619,6 @@
|
|||
<Unit filename="../../src/gui/dialogs/select_orb_colors.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/simple_item_selector.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/simple_item_selector.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/multiplayer/synced_choice_wait.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/multiplayer/synced_choice_wait.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/theme_list.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/theme_list.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/tip.cpp" />
|
||||
|
@ -637,8 +637,6 @@
|
|||
<Unit filename="../../src/gui/dialogs/wml_error.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/wml_message.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/wml_message.hpp" />
|
||||
<Unit filename="../../src/gui/core/point.cpp" />
|
||||
<Unit filename="../../src/gui/core/point.hpp" />
|
||||
<Unit filename="../../src/gui/widgets/button.cpp" />
|
||||
<Unit filename="../../src/gui/widgets/button.hpp" />
|
||||
<Unit filename="../../src/gui/widgets/clickable.hpp" />
|
||||
|
|
|
@ -820,7 +820,6 @@ set(wesnoth-main_SRC
|
|||
gui/dialogs/campaign_settings.cpp
|
||||
gui/dialogs/core_selection.cpp
|
||||
gui/dialogs/chat_log.cpp
|
||||
gui/dialogs/data_manage.cpp
|
||||
gui/dialogs/debug_clock.cpp
|
||||
gui/dialogs/depcheck_confirm_change.cpp
|
||||
gui/dialogs/depcheck_select_new.cpp
|
||||
|
|
|
@ -359,7 +359,6 @@ wesnoth_sources = Split("""
|
|||
gui/dialogs/campaign_settings.cpp
|
||||
gui/dialogs/core_selection.cpp
|
||||
gui/dialogs/chat_log.cpp
|
||||
gui/dialogs/data_manage.cpp
|
||||
gui/dialogs/debug_clock.cpp
|
||||
gui/dialogs/depcheck_confirm_change.cpp
|
||||
gui/dialogs/depcheck_select_new.cpp
|
||||
|
|
|
@ -1,192 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2010 - 2016 by Jody Northup
|
||||
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/data_manage.hpp"
|
||||
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "game_config.hpp"
|
||||
#include "game_preferences.hpp"
|
||||
#include "gettext.hpp"
|
||||
#include "gui/core/log.hpp"
|
||||
#include "gui/auxiliary/field.hpp"
|
||||
#include "gui/dialogs/game_delete.hpp"
|
||||
#include "gui/dialogs/helper.hpp"
|
||||
#include "gui/widgets/button.hpp"
|
||||
#include "gui/widgets/image.hpp"
|
||||
#include "gui/widgets/label.hpp"
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
#include "gui/widgets/list.hpp"
|
||||
#else
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
#endif
|
||||
#include "gui/widgets/minimap.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/text_box.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "language.hpp"
|
||||
#include "preferences_display.hpp"
|
||||
#include "savegame.hpp"
|
||||
#include "utils/foreach.hpp"
|
||||
|
||||
#include <cctype>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
|
||||
REGISTER_DIALOG(data_manage)
|
||||
|
||||
tdata_manage::tdata_manage()
|
||||
: txtFilter_(register_text("txtFilter", true))
|
||||
, filename_()
|
||||
, games_()
|
||||
, last_words_()
|
||||
{
|
||||
}
|
||||
|
||||
void tdata_manage::pre_show(twindow& window)
|
||||
{
|
||||
assert(txtFilter_);
|
||||
|
||||
ttext_box* filter
|
||||
= find_widget<ttext_box>(&window, "txtFilter", false, true);
|
||||
window.keyboard_capture(filter);
|
||||
filter->set_text_changed_callback(
|
||||
boost::bind(&tdata_manage::filter_text_changed, this, _1, _2));
|
||||
|
||||
tlistbox& list = find_widget<tlistbox>(&window, "persist_list", false);
|
||||
window.keyboard_capture(&list);
|
||||
|
||||
#ifdef GUI2_EXPERIMENTAL_LISTBOX
|
||||
connect_signal_notify_modified(list,
|
||||
boost::bind(&tdata_manage::list_item_clicked,
|
||||
this,
|
||||
boost::ref(window)));
|
||||
#else
|
||||
list.set_callback_value_change(
|
||||
dialog_callback<tdata_manage, &tdata_manage::list_item_clicked>);
|
||||
#endif
|
||||
|
||||
{
|
||||
cursor::setter cur(cursor::WAIT);
|
||||
games_ = savegame::get_saves_list();
|
||||
}
|
||||
fill_game_list(window, games_);
|
||||
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<tbutton>(&window, "clear", false),
|
||||
boost::bind(&tdata_manage::delete_button_callback,
|
||||
this,
|
||||
boost::ref(window)));
|
||||
}
|
||||
|
||||
void tdata_manage::fill_game_list(twindow& window,
|
||||
std::vector<savegame::save_info>& games)
|
||||
{
|
||||
tlistbox& list = find_widget<tlistbox>(&window, "persist_list", false);
|
||||
list.clear();
|
||||
|
||||
FOREACH(const AUTO & game, games)
|
||||
{
|
||||
std::map<std::string, string_map> data;
|
||||
string_map item;
|
||||
|
||||
item["label"] = game.name();
|
||||
data.insert(std::make_pair("filename", item));
|
||||
|
||||
item["label"] = game.format_time_summary();
|
||||
data.insert(std::make_pair("date", item));
|
||||
|
||||
list.add_row(data);
|
||||
}
|
||||
}
|
||||
|
||||
void tdata_manage::list_item_clicked(twindow& /*window*/)
|
||||
{
|
||||
}
|
||||
|
||||
bool tdata_manage::filter_text_changed(ttext_* textbox, const std::string& text)
|
||||
{
|
||||
twindow& window = *textbox->get_window();
|
||||
|
||||
tlistbox& list = find_widget<tlistbox>(&window, "persist_list", false);
|
||||
|
||||
const std::vector<std::string> words = utils::split(text, ' ');
|
||||
|
||||
if(words == last_words_)
|
||||
return false;
|
||||
last_words_ = words;
|
||||
|
||||
std::vector<bool> show_items(list.get_item_count(), true);
|
||||
|
||||
if(!text.empty()) {
|
||||
for(unsigned int i = 0; i < list.get_item_count(); i++) {
|
||||
tgrid* row = list.get_row_grid(i);
|
||||
|
||||
tgrid::iterator it = row->begin();
|
||||
tlabel& filename_label
|
||||
= find_widget<tlabel>(*it, "filename", false);
|
||||
|
||||
bool found = false;
|
||||
FOREACH(const AUTO & word, words)
|
||||
{
|
||||
found = std::search(filename_label.label().str().begin(),
|
||||
filename_label.label().str().end(),
|
||||
word.begin(),
|
||||
word.end(),
|
||||
chars_equal_insensitive)
|
||||
!= filename_label.label().str().end();
|
||||
|
||||
if(!found) {
|
||||
// one word doesn't match, we don't reach words.end()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
show_items[i] = found;
|
||||
}
|
||||
}
|
||||
|
||||
list.set_row_shown(show_items);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void tdata_manage::delete_button_callback(twindow& window)
|
||||
{
|
||||
tlistbox& list = find_widget<tlistbox>(&window, "persist_list", false);
|
||||
|
||||
const size_t index = size_t(list.get_selected_row());
|
||||
if(index < games_.size()) {
|
||||
|
||||
// See if we should ask the user for deletion confirmation
|
||||
if(preferences::ask_delete_saves()) {
|
||||
if(!gui2::tgame_delete::execute(window.video())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete the file
|
||||
savegame::delete_game(games_[index].name());
|
||||
|
||||
// Remove it from the list of saves
|
||||
games_.erase(games_.begin() + index);
|
||||
list.remove_row(index);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace gui2
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2010 - 2016 by Jody Northup
|
||||
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_MANAGE_DATA_HPP_INCLUDED
|
||||
#define GUI_DIALOGS_MANAGE_DATA_HPP_INCLUDED
|
||||
|
||||
#include "gui/dialogs/dialog.hpp"
|
||||
#include "save_index.hpp"
|
||||
#include "tstring.hpp"
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
class tlistbox;
|
||||
class ttext_;
|
||||
|
||||
class tdata_manage : public tdialog
|
||||
{
|
||||
public:
|
||||
tdata_manage();
|
||||
|
||||
const std::string& filename() const
|
||||
{
|
||||
return filename_;
|
||||
}
|
||||
|
||||
protected:
|
||||
/** Inherited from tdialog. */
|
||||
void pre_show(twindow& window);
|
||||
|
||||
private:
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
bool filter_text_changed(ttext_* textbox, const std::string& text);
|
||||
void list_item_clicked(twindow& window);
|
||||
void delete_button_callback(twindow& window);
|
||||
|
||||
void fill_game_list(twindow& window,
|
||||
std::vector<savegame::save_info>& games);
|
||||
|
||||
tfield_text* txtFilter_;
|
||||
|
||||
std::string filename_;
|
||||
|
||||
std::vector<savegame::save_info> games_;
|
||||
|
||||
std::vector<std::string> last_words_;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -48,7 +48,6 @@
|
|||
#include "gui/dialogs/transient_message.hpp"
|
||||
#include "gui/dialogs/gamestate_inspector.hpp"
|
||||
#include "gui/dialogs/multiplayer/mp_change_control.hpp"
|
||||
#include "gui/dialogs/data_manage.hpp"
|
||||
#include "gui/dialogs/simple_item_selector.hpp"
|
||||
#include "gui/dialogs/edit_text.hpp"
|
||||
#include "gui/dialogs/unit_create.hpp"
|
||||
|
@ -1860,7 +1859,6 @@ class console_handler : public map_command_handler<console_handler>, private cha
|
|||
void do_show_var();
|
||||
void do_inspect();
|
||||
void do_control_dialog();
|
||||
void do_manage();
|
||||
void do_unit();
|
||||
// void do_buff();
|
||||
// void do_unbuff();
|
||||
|
@ -1969,8 +1967,6 @@ class console_handler : public map_command_handler<console_handler>, private cha
|
|||
, "N");
|
||||
register_command("inspect", &console_handler::do_inspect,
|
||||
_("Launch the gamestate inspector"), "", "D");
|
||||
register_command("manage", &console_handler::do_manage,
|
||||
_("Manage persistence data"), "", "D");
|
||||
register_command("alias", &console_handler::do_set_alias,
|
||||
_("Set or show alias to a command"), _("<name>[=<command>]"));
|
||||
register_command("set_var", &console_handler::do_set_var,
|
||||
|
@ -2958,12 +2954,6 @@ void console_handler::do_control_dialog()
|
|||
mp_change_control.show(menu_handler_.gui_->video());
|
||||
}
|
||||
|
||||
void console_handler::do_manage() {
|
||||
config cfg;
|
||||
gui2::tdata_manage manager;
|
||||
manager.show(menu_handler_.gui_->video());
|
||||
}
|
||||
|
||||
void console_handler::do_unit() {
|
||||
// prevent SIGSEGV due to attempt to set HP during a fight
|
||||
if (events::commands_disabled > 0)
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "gui/dialogs/campaign_selection.hpp"
|
||||
#include "gui/dialogs/campaign_settings.hpp"
|
||||
#include "gui/dialogs/chat_log.hpp"
|
||||
#include "gui/dialogs/data_manage.hpp"
|
||||
#include "gui/dialogs/debug_clock.hpp"
|
||||
#include "gui/dialogs/edit_label.hpp"
|
||||
#include "gui/dialogs/edit_text.hpp"
|
||||
|
@ -380,7 +379,6 @@ BOOST_AUTO_TEST_CASE(test_gui2)
|
|||
test<gui2::tcampaign_selection>();
|
||||
test<gui2::tcampaign_settings>();
|
||||
// test<gui2::tchat_log>(); /** @todo ENABLE */
|
||||
test<gui2::tdata_manage>();
|
||||
test<gui2::tedit_label>();
|
||||
test<gui2::tedit_text>();
|
||||
test<gui2::teditor_generate_map>();
|
||||
|
@ -574,15 +572,6 @@ struct twrapper<gui2::tchat_log>
|
|||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct twrapper<gui2::tdata_manage>
|
||||
{
|
||||
static gui2::tdata_manage* create()
|
||||
{
|
||||
return new gui2::tdata_manage();
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct twrapper<gui2::tedit_label>
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue