Add the still missing features to the gui2 game-load dialog.
This dialog now should have the same functionality as the old load dialog. To activate, wesnoth needs to be started with --new-widgets.
This commit is contained in:
parent
9525888d46
commit
61cd8870f6
4 changed files with 61 additions and 11 deletions
|
@ -372,6 +372,40 @@
|
|||
[/column]
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
|
||||
[spacer]
|
||||
definition = "default"
|
||||
[/spacer]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
|
||||
[toggle_button]
|
||||
id = "show_replay"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Show replay"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
horizontal_alignment = "right"
|
||||
|
||||
[toggle_button]
|
||||
id = "cancel_orders"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Cancel orders"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
|
|
|
@ -52,10 +52,12 @@ namespace gui2 {
|
|||
* @end_table
|
||||
*/
|
||||
|
||||
tgame_load::tgame_load(const config& cache_config)
|
||||
: txtFilter_(register_text("txtFilter", false)),
|
||||
filename_(),
|
||||
cache_config_(cache_config)
|
||||
tgame_load::tgame_load(const config& cache_config)
|
||||
: txtFilter_(register_text("txtFilter", false)),
|
||||
chk_show_replay_(register_bool("show_replay")),
|
||||
chk_cancel_orders_(register_bool("cancel_orders")),
|
||||
filename_(),
|
||||
cache_config_(cache_config)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -165,13 +167,15 @@ bool tgame_load::filter_text_changed(ttext_* textbox, const std::string text){
|
|||
|
||||
void tgame_load::post_show(twindow& window)
|
||||
{
|
||||
//filename_ = txtFilename_->get_widget_value(window);
|
||||
show_replay_ = chk_show_replay_->get_widget_value(window);
|
||||
cancel_orders_ = chk_cancel_orders_->get_widget_value(window);
|
||||
}
|
||||
|
||||
void tgame_load::display_savegame(twindow& window){
|
||||
tlistbox* list = dynamic_cast<tlistbox*>(window.find_widget("savegame_list", false));
|
||||
VALIDATE(list, missing_widget("savegame_list"));
|
||||
save_info& game = games_[list->get_selected_row()];
|
||||
filename_ = game.name;
|
||||
|
||||
config cfg_summary;
|
||||
std::string dummy;
|
||||
|
|
|
@ -29,6 +29,8 @@ public:
|
|||
tgame_load(const config& cache_config);
|
||||
|
||||
const std::string& filename() const { return filename_; }
|
||||
bool show_replay() const { return show_replay_; }
|
||||
bool cancel_orders() const { return cancel_orders_; }
|
||||
|
||||
protected:
|
||||
/** Inherited from tdialog. */
|
||||
|
@ -50,8 +52,12 @@ private:
|
|||
void fill_game_list(twindow& window, std::vector<save_info>& games);
|
||||
|
||||
tfield_text* txtFilter_;
|
||||
tfield_bool* chk_show_replay_;
|
||||
tfield_bool* chk_cancel_orders_;
|
||||
|
||||
std::string filename_;
|
||||
bool show_replay_;
|
||||
bool cancel_orders_;
|
||||
|
||||
std::vector<save_info> games_;
|
||||
const config& cache_config_;
|
||||
|
|
|
@ -389,20 +389,26 @@ loadgame::loadgame(display& gui, const config& game_config, game_state& gamestat
|
|||
|
||||
void loadgame::show_dialog(bool show_replay, bool cancel_orders)
|
||||
{
|
||||
bool show_replay_dialog = show_replay;
|
||||
bool cancel_orders_dialog = cancel_orders;
|
||||
|
||||
//FIXME: Integrate the load_game dialog into this class
|
||||
//something to watch for the curious, but not yet ready to go
|
||||
if (gui2::new_widgets){
|
||||
gui2::tgame_load load_dialog(game_config_);
|
||||
load_dialog.show(gui_.video());
|
||||
|
||||
if (load_dialog.get_retval() == gui2::twindow::OK){
|
||||
filename_ = load_dialog.filename();
|
||||
show_replay_ = load_dialog.show_replay();
|
||||
cancel_orders_ = load_dialog.cancel_orders();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bool show_replay_dialog = show_replay;
|
||||
bool cancel_orders_dialog = cancel_orders;
|
||||
filename_ = dialogs::load_game_dialog(gui_, game_config_, &show_replay_dialog, &cancel_orders_dialog);
|
||||
|
||||
show_replay_ = show_replay_dialog;
|
||||
cancel_orders_ = cancel_orders_dialog;
|
||||
show_replay_ = show_replay_dialog;
|
||||
cancel_orders_ = cancel_orders_dialog;
|
||||
}
|
||||
}
|
||||
|
||||
void loadgame::load_game()
|
||||
|
|
Loading…
Add table
Reference in a new issue