#include "lib/exceptions.h"
#include "lib/cinema.h"
#include "lib/kdm.h"
+#include "lib/send_kdm_email_job.h"
+#include "lib/server_finder.h"
using std::cout;
using std::string;
public:
Frame (wxString const & title)
: wxFrame (NULL, -1, title)
+ , _hints_dialog (0)
, _servers_list_dialog (0)
{
+#ifdef DCPOMATIC_WINDOWS_CONSOLE
+ AllocConsole();
+
+ HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
+ int hCrt = _open_osfhandle((intptr_t) handle_out, _O_TEXT);
+ FILE* hf_out = _fdopen(hCrt, "w");
+ setvbuf(hf_out, NULL, _IONBF, 1);
+ *stdout = *hf_out;
+
+ HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE);
+ hCrt = _open_osfhandle((intptr_t) handle_in, _O_TEXT);
+ FILE* hf_in = _fdopen(hCrt, "r");
+ setvbuf(hf_in, NULL, _IONBF, 128);
+ *stdin = *hf_in;
+#endif
+
wxMenuBar* bar = new wxMenuBar;
setup_menu (bar);
SetMenuBar (bar);
std_to_wx (
String::compose (wx_to_std (_("The directory %1 already exists and is not empty. "
"Are you sure you want to use it?")),
- d->get_path().c_str())
+ d->get_path().string().c_str())
)
)) {
return;
if (d->write_to ()) {
write_kdm_files (film, d->screens (), d->dcp (), d->from (), d->until (), d->directory ());
} else {
- email_kdms (film, d->screens (), d->dcp (), d->from (), d->until ());
+ JobManager::instance()->add (
+ shared_ptr<Job> (new SendKDMEmailJob (film, d->screens (), d->dcp (), d->from (), d->until ()))
+ );
}
} catch (KDMError& e) {
error_dialog (this, e.what ());
return;
}
+ maybe_save_then_delete_film ();
+
ev.Skip ();
}
f->Show ();
ui_signaller = new wxUISignaller (this);
- this->Bind (wxEVT_IDLE, boost::bind (&App::idle, this));
+ Bind (wxEVT_IDLE, boost::bind (&App::idle, this));
+ Bind (wxEVT_TIMER, boost::bind (&App::check, this));
+ _timer.reset (new wxTimer (this));
+ _timer->Start (1000);
+
return true;
}
catch (exception& e)
{
ui_signaller->ui_idle ();
}
+
+ void check ()
+ {
+ try {
+ ServerFinder::instance()->rethrow ();
+ } catch (exception& e) {
+ error_dialog (0, std_to_wx (e.what ()));
+ }
+ }
+
+ shared_ptr<wxTimer> _timer;
};
IMPLEMENT_APP (App)