#include "lib/compose.hpp"
#include "lib/cinema_kdms.h"
#include "lib/dcpomatic_socket.h"
+#include "lib/hints.h"
#include <dcp/exceptions.h>
+#include <dcp/raw_convert.h>
#include <wx/generic/aboutdlgg.h>
#include <wx/stdpaths.h>
#include <wx/cmdline.h>
#include <boost/noncopyable.hpp>
#include <iostream>
#include <fstream>
+/* This is OK as it's only used with DCPOMATIC_WINDOWS */
#include <sstream>
#ifdef check
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using boost::optional;
+using dcp::raw_convert;
class FilmChangedDialog : public boost::noncopyable
{
, _hints_dialog (0)
, _servers_list_dialog (0)
, _config_dialog (0)
+ , _kdm_dialog (0)
, _file_menu (0)
, _history_items (0)
, _history_position (0)
_film = film;
_film_viewer->set_film (_film);
_film_editor->set_film (_film);
+ delete _video_waveform_dialog;
+ _video_waveform_dialog = 0;
set_menu_sensitivity ();
Config::instance()->add_to_history (_film->directory ());
}
}
}
+ if (!get_hints(_film).empty() && Config::instance()->show_hints_before_make_dcp()) {
+ HintsDialog* hints = new HintsDialog (this, _film, false);
+ int const r = hints->ShowModal();
+ hints->Destroy ();
+ if (r == wxID_CANCEL) {
+ return;
+ }
+ }
+
try {
/* It seems to make sense to auto-save metadata here, since the make DCP may last
a long time, and crashes/power failures are moderately likely.
return;
}
- KDMDialog* d = new KDMDialog (this, _film);
- if (d->ShowModal () != wxID_OK) {
- d->Destroy ();
- return;
- }
-
- try {
- list<ScreenKDM> screen_kdms = _film->make_kdms (d->screens(), d->cpl(), d->from(), d->until(), d->formulation());
- if (d->write_to ()) {
- ScreenKDM::write_files (
- _film->name(),
- screen_kdms,
- d->directory()
- );
- } else {
- JobManager::instance()->add (
- shared_ptr<Job> (new SendKDMEmailJob (
- _film->name(),
- _film->dcp_name(),
- d->from(),
- d->until(),
- CinemaKDMs::collect (screen_kdms),
- _film->log()
- ))
- );
- }
- } catch (dcp::NotEncryptedError& e) {
- error_dialog (this, _("CPL's content is not encrypted."));
- } catch (exception& e) {
- error_dialog (this, e.what ());
- } catch (...) {
- error_dialog (this, _("An unknown exception occurred."));
+ if (_kdm_dialog) {
+ _kdm_dialog->Destroy ();
+ _kdm_dialog = 0;
}
- d->Destroy ();
+ _kdm_dialog = new KDMDialog (this, _film);
+ _kdm_dialog->Show (this);
}
void jobs_make_dcp_batch ()
return;
}
+ if (!get_hints(_film).empty() && Config::instance()->show_hints_before_make_dcp()) {
+ HintsDialog* hints = new HintsDialog (this, _film, false);
+ int const r = hints->ShowModal();
+ hints->Destroy ();
+ if (r == wxID_CANCEL) {
+ return;
+ }
+ }
+
_film->write_metadata ();
/* i = 0; try to connect via socket
void tools_video_waveform ()
{
if (!_video_waveform_dialog) {
- _video_waveform_dialog = new VideoWaveformDialog (this, _film_viewer);
+ _video_waveform_dialog = new VideoWaveformDialog (this, _film, _film_viewer);
}
_video_waveform_dialog->Show ();
void tools_hints ()
{
if (!_hints_dialog) {
- _hints_dialog = new HintsDialog (this, _film);
+ _hints_dialog = new HintsDialog (this, _film, true);
}
_hints_dialog->Show ();
}
for (size_t i = 0; i < history.size(); ++i) {
- SafeStringStream s;
+ string s;
if (i < 9) {
- s << "&" << (i + 1) << " ";
+ s = String::compose ("&%1 %2", i + 1, history[i].string());
+ } else {
+ s = history[i].string();
}
- s << history[i].string();
- _file_menu->Insert (pos++, ID_file_history + i, std_to_wx (s.str ()));
+ _file_menu->Insert (pos++, ID_file_history + i, std_to_wx (s));
}
_history_items = history.size ();
HintsDialog* _hints_dialog;
ServersListDialog* _servers_list_dialog;
wxPreferencesEditor* _config_dialog;
+ KDMDialog* _kdm_dialog;
wxMenu* _file_menu;
shared_ptr<Film> _film;
int _history_items;
{
wxInitAllImageHandlers ();
+ Config::FailedToLoad.connect (boost::bind (&App::config_failed_to_load, this));
+
wxSplashScreen* splash = 0;
try {
if (!Config::have_existing ("config.xml")) {
}
}
+ 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."));
+ }
+
DOMFrame* _frame;
shared_ptr<wxTimer> _timer;
string _film_to_load;