diff --git a/src/gui/dialogs/loadscreen.cpp b/src/gui/dialogs/loadscreen.cpp index 49f6793db3a..b3f38691edb 100644 --- a/src/gui/dialogs/loadscreen.cpp +++ b/src/gui/dialogs/loadscreen.cpp @@ -29,6 +29,7 @@ #include "cursor.hpp" #include "gettext.hpp" #include "log.hpp" +#include "preferences.hpp" #include "utils/functional.hpp" #include @@ -103,7 +104,9 @@ twindow* tloadscreen::build_window(CVideo& video) const void tloadscreen::pre_show(twindow& window) { - worker_.reset(new boost::thread(work_)); + if (work_) { + worker_.reset(new boost::thread(work_)); + } timer_id_ = add_timer(100, std::bind(&tloadscreen::timer_callback, this, std::ref(window)), true); cursor_setter_.reset(new cursor::setter(cursor::WAIT)); progress_stage_label_ = &find_widget(&window, "status", false); @@ -139,9 +142,12 @@ tloadscreen* tloadscreen::current_load = nullptr; void tloadscreen::timer_callback(twindow& window) { - if (!worker_ || worker_->timed_join(boost::posix_time::milliseconds(0))) { + if (!work_ || !worker_ || worker_->timed_join(boost::posix_time::milliseconds(0))) { window.close(); } + if (!work_) { + return; + } const char* stage = current_stage_ #if defined(_MSC_VER) && _MSC_VER < 1900 ; @@ -172,12 +178,17 @@ tloadscreen::~tloadscreen() void tloadscreen::display(CVideo& video, std::function f) { + const bool use_loadingscreen_animation = !preferences::disable_loadingscreen_animation(); if (current_load || video.faked()) { f(); } - else { + else if(use_loadingscreen_animation) { tloadscreen(f).show(video); } + else { + tloadscreen(std::function()).show(video); + f(); + } } } // namespace gui2 diff --git a/src/preferences.cpp b/src/preferences.cpp index 51e6f3b99b9..a87222f0317 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -1027,5 +1027,15 @@ void set_disable_auto_moves(bool value) preferences::set("disable_auto_moves", value); } +bool disable_loadingscreen_animation() +{ + return get("disable_loadingscreen_animation", false); +} + +void set_disable_loadingscreen_animation(bool value) +{ + set("disable_loadingscreen_animation", value); +} + } // end namespace preferences diff --git a/src/preferences.hpp b/src/preferences.hpp index c819b44ca91..8eee89713a7 100644 --- a/src/preferences.hpp +++ b/src/preferences.hpp @@ -260,6 +260,9 @@ namespace preferences { bool disable_auto_moves(); void set_disable_auto_moves(bool value); + bool disable_loadingscreen_animation(); + void set_disable_loadingscreen_animation(bool value); + } // end namespace preferences #endif