From 66469adf1bd6e5c288542dda601a66b22d955794 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 5 Jan 2018 19:24:06 +0000 Subject: [PATCH] More splash screens / config warnings. --- src/tools/dcpomatic_batch.cc | 31 ++++++++++++++++++++++++++----- src/tools/dcpomatic_server.cc | 20 ++++++++++++++++++++ 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index 36370ea3f..7a4f50622 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -280,6 +281,11 @@ class App : public wxApp { SetAppName (_("DCP-o-matic Batch Converter")); + Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this)); + Config::Warning.connect (boost::bind (&App::config_warning, this, _1)); + + wxSplashScreen* splash = maybe_show_splash (); + if (!wxApp::OnInit()) { return false; } @@ -308,12 +314,15 @@ class App : public wxApp */ Config::drop (); - DOMFrame* f = new DOMFrame (_("DCP-o-matic Batch Converter")); - SetTopWindow (f); - f->Maximize (); - f->Show (); + _frame = new DOMFrame (_("DCP-o-matic Batch Converter")); + SetTopWindow (_frame); + _frame->Maximize (); + if (splash) { + splash->Destroy (); + } + _frame->Show (); - JobServer* server = new JobServer (f); + JobServer* server = new JobServer (_frame); new thread (boost::bind (&JobServer::run, server)); signal_manager = new wxSignalManager (this); @@ -361,6 +370,18 @@ class App : public wxApp return true; } + + void config_failed_to_load () + { + message_dialog (_frame, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create.")); + } + + void config_warning (string m) + { + message_dialog (_frame, std_to_wx (m)); + } + + DOMFrame* _frame; }; IMPLEMENT_APP (App) diff --git a/src/tools/dcpomatic_server.cc b/src/tools/dcpomatic_server.cc index 9214d8385..ad990740e 100644 --- a/src/tools/dcpomatic_server.cc +++ b/src/tools/dcpomatic_server.cc @@ -28,6 +28,7 @@ #include "lib/signaller.h" #include "lib/cross.h" #include +#include #include #include #include @@ -268,6 +269,11 @@ private: server_log.reset (new ServerLog); + Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this)); + Config::Warning.connect (boost::bind (&App::config_warning, this, _1)); + + wxSplashScreen* splash = maybe_show_splash (); + dcpomatic_setup_path_encoding (); dcpomatic_setup_i18n (); dcpomatic_setup (); @@ -283,6 +289,10 @@ private: _timer.reset (new wxTimer (this)); _timer->Start (1000); + if (splash) { + splash->Destroy (); + } + return true; } @@ -318,6 +328,16 @@ private: signal_manager->ui_idle (); } + void config_failed_to_load () + { + message_dialog (0, _("The existing configuration failed to load. Default values will be used instead. These may take a short time to create.")); + } + + void config_warning (string m) + { + message_dialog (0, std_to_wx (m)); + } + boost::thread* _thread; TaskBarIcon* _icon; shared_ptr _timer; -- 2.30.2