#include "wx/export_dialog.h"
#include "wx/paste_dialog.h"
#include "wx/focus_manager.h"
+#include "wx/html_dialog.h"
#include "wx/initial_setup_dialog.h"
#include "wx/send_i18n_dialog.h"
#include "wx/i18n_hook.h"
#include "lib/film.h"
+#include "lib/analytics.h"
#include "lib/emailer.h"
#include "lib/config.h"
#include "lib/util.h"
#include <wx/cmdline.h>
#include <wx/preferences.h>
#include <wx/splash.h>
+#include <wx/wxhtml.h>
#ifdef __WXMSW__
#include <shellapi.h>
#endif
_config_changed_connection = Config::instance()->Changed.connect (boost::bind (&DOMFrame::config_changed, this, _1));
config_changed (Config::OTHER);
+ _analytics_message_connection = Analytics::instance()->Message.connect(boost::bind(&DOMFrame::analytics_message, this, _1, _2));
+
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_new, this), ID_file_new);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_open, this), ID_file_open);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::file_save, this), ID_file_save);
film->set_name (path.filename().generic_string());
film->write_metadata ();
set_film (film);
- dcpomatic_log = film->log ();
}
void load_film (boost::filesystem::path file)
);
}
- for (list<string>::const_iterator i = notes.begin(); i != notes.end(); ++i) {
- error_dialog (0, std_to_wx (*i));
+ BOOST_FOREACH (string i, notes) {
+ error_dialog (0, std_to_wx(i));
}
set_film (film);
if (_film) {
_film->Change.connect (boost::bind (&DOMFrame::film_change, this, _1));
_film->Message.connect (boost::bind(&DOMFrame::film_message, this, _1));
+ dcpomatic_log = _film->log ();
}
}
*/
_config_changed_connection.disconnect ();
+ /* Also stop hearing about analytics-related stuff */
+ _analytics_message_connection.disconnect ();
+
ev.Skip ();
}
_film_viewer->seek_by (_film_viewer->one_video_frame(), true);
}
+ void analytics_message (string title, string html)
+ {
+ HTMLDialog* d = new HTMLDialog(this, std_to_wx(title), std_to_wx(html));
+ d->ShowModal();
+ d->Destroy();
+ }
+
FilmEditor* _film_editor;
boost::shared_ptr<FilmViewer> _film_viewer;
StandardControls* _controls;
int _history_position;
wxMenuItem* _history_separator;
boost::signals2::scoped_connection _config_changed_connection;
+ boost::signals2::scoped_connection _analytics_message_connection;
bool _update_news_requested;
shared_ptr<Content> _clipboard;
};
App ()
: wxApp ()
, _frame (0)
+ , _splash (0)
{}
private:
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"));
_frame = new DOMFrame (_("DCP-o-matic"));
SetTopWindow (_frame);
_frame->Maximize ();
- if (splash) {
- splash->Destroy ();
- splash = 0;
+ if (_splash) {
+ _splash->Destroy ();
+ _splash = 0;
}
if (!Config::instance()->nagged(Config::NAG_INITIAL_SETUP)) {
}
signal_manager = new wxSignalManager (this);
- Bind (wxEVT_IDLE, boost::bind (&App::idle, this));
+ Bind (wxEVT_IDLE, boost::bind (&App::idle, this, _1));
Bind (wxEVT_TIMER, boost::bind (&App::check, this));
_timer.reset (new wxTimer (this));
}
catch (exception& e)
{
- if (splash) {
- splash->Destroy ();
+ if (_splash) {
+ _splash->Destroy ();
}
error_dialog (0, wxString::Format ("DCP-o-matic could not start."), std_to_wx(e.what()));
}
void report_exception ()
{
+ if (_splash) {
+ _splash->Destroy ();
+ _splash = 0;
+ }
+
try {
throw;
} catch (FileError& e) {
report_exception ();
}
- void idle ()
+ void idle (wxIdleEvent& ev)
{
signal_manager->ui_idle ();
+ ev.Skip ();
}
void check ()
return false;
}
+ if (_splash) {
+ _splash->Destroy ();
+ _splash = 0;
+ }
+
RecreateChainDialog* d = new RecreateChainDialog (_frame);
int const r = d->ShowModal ();
d->Destroy ();
}
DOMFrame* _frame;
+ wxSplashScreen* _splash;
shared_ptr<wxTimer> _timer;
string _film_to_load;
string _film_to_create;