Trying to prevent error dialogues appearing behind it.
public:
App ()
: wxApp ()
- , _frame (0)
- , _splash (0)
{
#ifdef DCPOMATIC_LINUX
XInitThreads ();
}
catch (exception& e)
{
- if (_splash) {
- _splash->Destroy ();
- _splash = nullptr;
- }
+ close_splash ();
error_dialog (nullptr, wxString::Format ("DCP-o-matic could not start."), std_to_wx(e.what()));
}
{
if (_splash) {
_splash->Destroy ();
- _splash = 0;
+ _splash = nullptr;
}
}
/* Destroy the splash screen here, as otherwise bad things seem to happen (for reasons unknown)
when we open our recreate dialog, close it, *then* try to Destroy the splash (the Destroy fails).
*/
- _splash->Destroy ();
- _splash = nullptr;
+ close_splash ();
auto config = Config::instance();
switch (reason) {
}
}
- DOMFrame* _frame;
- wxSplashScreen* _splash;
+ DOMFrame* _frame = nullptr;
+ wxSplashScreen* _splash = nullptr;
shared_ptr<wxTimer> _timer;
string _film_to_load;
string _film_to_create;
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 ();
+ _splash = maybe_show_splash ();
if (!wxApp::OnInit()) {
return false;
_frame = new DOMFrame (_("DCP-o-matic Batch Converter"));
SetTopWindow (_frame);
_frame->Maximize ();
- if (splash) {
- splash->Destroy ();
- }
+ close_splash ();
_frame->Show ();
JobServer* server = new JobServer (_frame);
return true;
}
+ void close_splash ()
+ {
+ if (_splash) {
+ _splash->Destroy ();
+ _splash = 0;
+ }
+ }
+
void config_failed_to_load ()
{
+ close_splash ();
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)
{
+ close_splash ();
message_dialog (_frame, std_to_wx (m));
}
- DOMFrame* _frame;
+ DOMFrame* _frame = nullptr;
+ wxSplashScreen* _splash = nullptr;
};
IMPLEMENT_APP (App)
*/
class App : public wxApp
{
-public:
- App ()
- : wxApp ()
- , _frame (0)
- {}
-
private:
bool OnInit ()
{
- wxSplashScreen* splash = nullptr;
-
try {
wxInitAllImageHandlers ();
Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
- splash = maybe_show_splash ();
+ _splash = maybe_show_splash ();
SetAppName (_("DCP-o-matic KDM Creator"));
_frame = new DOMFrame (_("DCP-o-matic KDM Creator"));
SetTopWindow (_frame);
_frame->Maximize ();
- if (splash) {
- splash->Destroy ();
- splash = 0;
- }
+ close_splash ();
_frame->Show ();
signal_manager = new wxSignalManager (this);
}
catch (exception& e)
{
- if (splash) {
- splash->Destroy ();
- }
+ close_splash ();
error_dialog (0, _("DCP-o-matic could not start"), std_to_wx(e.what()));
}
signal_manager->ui_idle ();
}
+ void close_splash ()
+ {
+ if (_splash) {
+ _splash->Destroy ();
+ _splash = 0;
+ }
+ }
+
void config_failed_to_load ()
{
+ close_splash ();
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)
{
+ close_splash ();
message_dialog (_frame, std_to_wx (m));
}
- DOMFrame* _frame;
+ DOMFrame* _frame = nullptr;
+ wxSplashScreen* _splash = nullptr;
};
IMPLEMENT_APP (App)
public:
App ()
: wxApp ()
- , _frame (0)
{
#ifdef DCPOMATIC_LINUX
XInitThreads ();
bool OnInit ()
{
- wxSplashScreen* splash = 0;
try {
wxInitAllImageHandlers ();
Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
Config::Warning.connect (boost::bind (&App::config_warning, this, _1));
- splash = maybe_show_splash ();
+ _splash = maybe_show_splash ();
SetAppName (_("DCP-o-matic Player"));
_frame = new DOMFrame ();
SetTopWindow (_frame);
_frame->Maximize ();
- if (splash) {
- splash->Destroy ();
- splash = 0;
- }
+ close_splash ();
_frame->Show ();
PlayServer* server = new PlayServer (_frame);
}
catch (exception& e)
{
- if (splash) {
- splash->Destroy ();
- }
+ close_splash ();
error_dialog (0, _("DCP-o-matic Player could not start."), std_to_wx(e.what()));
}
signal_manager->ui_idle ();
}
+ void close_splash ()
+ {
+ if (_splash) {
+ _splash->Destroy ();
+ _splash = nullptr;
+ }
+ }
+
void config_failed_to_load ()
{
+ close_splash ();
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)
{
+ close_splash ();
message_dialog (_frame, std_to_wx (m));
}
- DOMFrame* _frame;
+ DOMFrame* _frame = nullptr;
+ wxSplashScreen* _splash = nullptr;
string _dcp_to_load;
boost::optional<string> _stress;
};
class App : public wxApp, public ExceptionStore
{
-public:
- App ()
- : wxApp ()
- , _icon (0)
- {}
-
private:
bool OnInit ()
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 ();
+ _splash = maybe_show_splash ();
dcpomatic_setup_path_encoding ();
dcpomatic_setup_i18n ();
_timer.reset (new wxTimer (this));
_timer->Start (1000);
- if (splash) {
- splash->Destroy ();
- }
+ close_splash ();
SetExitOnFrameDelete (false);
signal_manager->ui_idle ();
}
+ void close_splash ()
+ {
+ if (_splash) {
+ _splash->Destroy ();
+ _splash = 0;
+ }
+ }
+
void config_failed_to_load ()
{
+ close_splash ();
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)
{
+ close_splash ();
message_dialog (0, std_to_wx (m));
}
boost::thread _thread;
- TaskBarIcon* _icon;
+ TaskBarIcon* _icon = nullptr;
shared_ptr<wxTimer> _timer;
+ wxSplashScreen* _splash = nullptr;
};
IMPLEMENT_APP (App)