More splash screens / config warnings.
authorCarl Hetherington <cth@carlh.net>
Fri, 5 Jan 2018 19:24:06 +0000 (19:24 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 5 Jan 2018 19:24:06 +0000 (19:24 +0000)
src/tools/dcpomatic_batch.cc
src/tools/dcpomatic_server.cc

index 36370ea3f8aaca848afd11ba22fb84a93ae8f6f8..7a4f506224716a28219b67c30307a70c0c519e04 100644 (file)
@@ -34,6 +34,7 @@
 #include <wx/aboutdlg.h>
 #include <wx/stdpaths.h>
 #include <wx/cmdline.h>
+#include <wx/splash.h>
 #include <wx/preferences.h>
 #include <wx/wx.h>
 #include <boost/foreach.hpp>
@@ -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)
index 9214d8385336dc1a6b9a0cf415495c096fc73437..ad990740eb792718ad6e78388693e86b44c42bac 100644 (file)
@@ -28,6 +28,7 @@
 #include "lib/signaller.h"
 #include "lib/cross.h"
 #include <wx/taskbar.h>
+#include <wx/splash.h>
 #include <wx/icon.h>
 #include <boost/thread.hpp>
 #include <boost/foreach.hpp>
@@ -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<wxTimer> _timer;