Allow GUI2 dialogs to disable the default dialog plugins context
This commit is contained in:
parent
e32b88568e
commit
da437f74ca
4 changed files with 17 additions and 1 deletions
|
@ -35,7 +35,7 @@ tdialog::~tdialog()
|
|||
|
||||
bool tdialog::show(CVideo& video, const unsigned auto_close_time)
|
||||
{
|
||||
if(video.faked()) {
|
||||
if(allow_plugin_skip_ && video.faked()) {
|
||||
plugins_manager* pm = plugins_manager::get();
|
||||
if (pm && pm->any_running())
|
||||
{
|
||||
|
|
|
@ -135,6 +135,7 @@ public:
|
|||
, fields_()
|
||||
, focus_()
|
||||
, restore_(false)
|
||||
, allow_plugin_skip_(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -173,6 +174,11 @@ public:
|
|||
restore_ = restore;
|
||||
}
|
||||
|
||||
void set_allow_plugin_skip(const bool allow_plugin_skip)
|
||||
{
|
||||
allow_plugin_skip_ = allow_plugin_skip;
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Creates a new boolean field.
|
||||
|
@ -331,6 +337,14 @@ private:
|
|||
*/
|
||||
bool restore_;
|
||||
|
||||
/**
|
||||
* Allow plugins to skip through the dialog?
|
||||
* Most dialogs install a plugins context to allow plugins to accept whatever the dialog is offering
|
||||
* and continue. Some dialogs, especially those that install their own plugins context, may want to
|
||||
* disable this.
|
||||
*/
|
||||
bool allow_plugin_skip_;
|
||||
|
||||
/** The id of the window to build. */
|
||||
virtual const std::string& window_id() const = 0;
|
||||
|
||||
|
|
|
@ -1014,6 +1014,7 @@ void tlobby_main::pre_show(twindow& window)
|
|||
game_config::lobby_network_timer, std::bind(&tlobby_main::network_handler, this), true);
|
||||
|
||||
// Set up Lua plugin context
|
||||
set_allow_plugin_skip(false);
|
||||
plugins_context_.reset(new plugins_context("Multiplayer Lobby"));
|
||||
|
||||
auto get_game_index_from_id = [this](const int game_id)->int {
|
||||
|
|
|
@ -311,6 +311,7 @@ void tmp_create_game::pre_show(twindow& window)
|
|||
//
|
||||
// Set up the Lua plugin context
|
||||
//
|
||||
set_allow_plugin_skip(false);
|
||||
plugins_context_.reset(new plugins_context("Multiplayer Create"));
|
||||
|
||||
plugins_context_->set_callback("create", [&window](const config&) { window.set_retval(twindow::OK); }, false);
|
||||
|
|
Loading…
Add table
Reference in a new issue