diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-09-17 23:39:05 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-09-17 23:39:05 +0100 |
| commit | 373f010a7f04add1f49169cbaa60cb7ae5f508d4 (patch) | |
| tree | a61fe014cbefc775dcf3a5c9a45d06e391e65b31 /src/tools | |
| parent | 048f9b6b5569f03d1342a04f75c83a2bad340996 (diff) | |
| parent | e888e92f354b9868337b0b022ff9be38b9c36c0f (diff) | |
Merge 1.0 in.
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic.cc | 624 | ||||
| -rw-r--r-- | src/tools/dcpomatic_batch.cc | 240 | ||||
| -rw-r--r-- | src/tools/dcpomatic_cli.cc (renamed from src/tools/makedcp.cc) | 86 | ||||
| -rw-r--r-- | src/tools/dcpomatic_server.cc (renamed from src/tools/servomatic_gui.cc) | 62 | ||||
| -rw-r--r-- | src/tools/dcpomatic_server_cli.cc (renamed from src/tools/servomatic_cli.cc) | 33 | ||||
| -rw-r--r-- | src/tools/dvdomatic.cc | 466 | ||||
| -rw-r--r-- | src/tools/po/es_ES.po | 145 | ||||
| -rw-r--r-- | src/tools/po/fr_FR.po | 138 | ||||
| -rw-r--r-- | src/tools/po/it_IT.po | 142 | ||||
| -rw-r--r-- | src/tools/po/sv_SE.po | 145 | ||||
| -rw-r--r-- | src/tools/server_test.cc (renamed from src/tools/servomatictest.cc) | 73 | ||||
| -rw-r--r-- | src/tools/test.cc | 34 | ||||
| -rw-r--r-- | src/tools/wscript | 29 |
13 files changed, 1596 insertions, 621 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc new file mode 100644 index 000000000..f61ef19e2 --- /dev/null +++ b/src/tools/dcpomatic.cc @@ -0,0 +1,624 @@ +/* + Copyright (C) 2012 Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <iostream> +#include <fstream> +#include <boost/filesystem.hpp> +#ifdef __WXMSW__ +#include <shellapi.h> +#endif +#ifdef __WXOSX__ +#include <ApplicationServices/ApplicationServices.h> +#endif +#include <wx/generic/aboutdlgg.h> +#include <wx/stdpaths.h> +#include <wx/cmdline.h> +#include "wx/film_viewer.h" +#include "wx/film_editor.h" +#include "wx/job_manager_view.h" +#include "wx/config_dialog.h" +#include "wx/job_wrapper.h" +#include "wx/wx_util.h" +#include "wx/new_film_dialog.h" +#include "wx/properties_dialog.h" +#include "wx/wx_ui_signaller.h" +#include "wx/about_dialog.h" +#include "wx/kdm_dialog.h" +#include "lib/film.h" +#include "lib/config.h" +#include "lib/util.h" +#include "lib/version.h" +#include "lib/ui_signaller.h" +#include "lib/log.h" +#include "lib/job_manager.h" +#include "lib/transcode_job.h" +#include "lib/exceptions.h" + +using std::cout; +using std::string; +using std::wstring; +using std::stringstream; +using std::map; +using std::make_pair; +using std::list; +using std::exception; +using std::ofstream; +using boost::shared_ptr; +using boost::dynamic_pointer_cast; + +static FilmEditor* film_editor = 0; +static FilmViewer* film_viewer = 0; +static shared_ptr<Film> film; +static std::string log_level; +static std::string film_to_load; +static std::string film_to_create; +static wxMenu* jobs_menu = 0; + +static void set_menu_sensitivity (); + +class FilmChangedDialog +{ +public: + FilmChangedDialog () + { + _dialog = new wxMessageDialog ( + 0, + wxString::Format (_("Save changes to film \"%s\" before closing?"), std_to_wx (film->name ()).data()), + _("Film changed"), + wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION + ); + } + + ~FilmChangedDialog () + { + _dialog->Destroy (); + } + + int run () + { + return _dialog->ShowModal (); + } + +private: + /* Not defined */ + FilmChangedDialog (FilmChangedDialog const &); + + wxMessageDialog* _dialog; +}; + + +void +maybe_save_then_delete_film () +{ + if (!film) { + return; + } + + if (film->dirty ()) { + FilmChangedDialog d; + switch (d.run ()) { + case wxID_NO: + break; + case wxID_YES: + film->write_metadata (); + break; + } + } + + film.reset (); +} + +#define ALWAYS 0x0 +#define NEEDS_FILM 0x1 +#define NOT_DURING_DCP_CREATION 0x2 + +map<wxMenuItem*, int> menu_items; + +void +add_item (wxMenu* menu, wxString text, int id, int sens) +{ + wxMenuItem* item = menu->Append (id, text); + menu_items.insert (make_pair (item, sens)); +} + +void +set_menu_sensitivity () +{ + list<shared_ptr<Job> > jobs = JobManager::instance()->get (); + list<shared_ptr<Job> >::iterator i = jobs.begin(); + while (i != jobs.end() && dynamic_pointer_cast<TranscodeJob> (*i) == 0) { + ++i; + } + bool const dcp_creation = (i != jobs.end ()); + + for (map<wxMenuItem*, int>::iterator j = menu_items.begin(); j != menu_items.end(); ++j) { + + bool enabled = true; + + if ((j->second & NEEDS_FILM) && film == 0) { + enabled = false; + } + + if ((j->second & NOT_DURING_DCP_CREATION) && dcp_creation) { + enabled = false; + } + + j->first->Enable (enabled); + } +} + +enum { + ID_file_new = 1, + ID_file_open, + ID_file_save, + ID_file_properties, + ID_jobs_make_dcp, + ID_jobs_make_kdms, + ID_jobs_send_dcp_to_tms, + ID_jobs_show_dcp, +}; + +void +setup_menu (wxMenuBar* m) +{ + wxMenu* file = new wxMenu; + add_item (file, _("New..."), ID_file_new, ALWAYS); + add_item (file, _("&Open..."), ID_file_open, ALWAYS); + file->AppendSeparator (); + add_item (file, _("&Save"), ID_file_save, NEEDS_FILM); + file->AppendSeparator (); + add_item (file, _("&Properties..."), ID_file_properties, NEEDS_FILM); +#ifndef __WXOSX__ + file->AppendSeparator (); +#endif + +#ifdef __WXOSX__ + add_item (file, _("&Exit"), wxID_EXIT, ALWAYS); +#else + add_item (file, _("&Quit"), wxID_EXIT, ALWAYS); +#endif + + +#ifdef __WXOSX__ + add_item (file, _("&Preferences..."), wxID_PREFERENCES, ALWAYS); +#else + wxMenu* edit = new wxMenu; + add_item (edit, _("&Preferences..."), wxID_PREFERENCES, ALWAYS); +#endif + + jobs_menu = new wxMenu; + add_item (jobs_menu, _("&Make DCP"), ID_jobs_make_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION); + add_item (jobs_menu, _("Make &KDMs..."), ID_jobs_make_kdms, NEEDS_FILM); + add_item (jobs_menu, _("&Send DCP to TMS"), ID_jobs_send_dcp_to_tms, NEEDS_FILM | NOT_DURING_DCP_CREATION); + add_item (jobs_menu, _("S&how DCP"), ID_jobs_show_dcp, NEEDS_FILM | NOT_DURING_DCP_CREATION); + + wxMenu* help = new wxMenu; +#ifdef __WXOSX__ + add_item (help, _("About DCP-o-matic"), wxID_ABOUT, ALWAYS); +#else + add_item (help, _("About"), wxID_ABOUT, ALWAYS); +#endif + + m->Append (file, _("&File")); +#ifndef __WXOSX__ + m->Append (edit, _("&Edit")); +#endif + m->Append (jobs_menu, _("&Jobs")); + m->Append (help, _("&Help")); +} + +class Frame : public wxFrame +{ +public: + Frame (wxString const & title) + : wxFrame (NULL, -1, title) + { + wxMenuBar* bar = new wxMenuBar; + setup_menu (bar); + SetMenuBar (bar); + + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_new, this), ID_file_new); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_open, this), ID_file_open); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_save, this), ID_file_save); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_properties, this), ID_file_properties); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_exit, this), wxID_EXIT); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::edit_preferences, this), wxID_PREFERENCES); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_make_dcp, this), ID_jobs_make_dcp); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_make_kdms, this), ID_jobs_make_kdms); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_send_dcp_to_tms, this), ID_jobs_send_dcp_to_tms); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::jobs_show_dcp, this), ID_jobs_show_dcp); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::help_about, this), wxID_ABOUT); + + Bind (wxEVT_MENU_OPEN, boost::bind (&Frame::menu_opened, this, _1)); + Bind (wxEVT_CLOSE_WINDOW, boost::bind (&Frame::close, this, _1)); + + /* Use a panel as the only child of the Frame so that we avoid + the dark-grey background on Windows. + */ + wxPanel* overall_panel = new wxPanel (this, wxID_ANY); + + film_editor = new FilmEditor (film, overall_panel); + film_viewer = new FilmViewer (film, overall_panel); + JobManagerView* job_manager_view = new JobManagerView (overall_panel, static_cast<JobManagerView::Buttons> (0)); + + wxBoxSizer* right_sizer = new wxBoxSizer (wxVERTICAL); + right_sizer->Add (film_viewer, 2, wxEXPAND | wxALL, 6); + right_sizer->Add (job_manager_view, 1, wxEXPAND | wxALL, 6); + + wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL); + main_sizer->Add (film_editor, 1, wxEXPAND | wxALL, 6); + main_sizer->Add (right_sizer, 2, wxEXPAND | wxALL, 6); + + set_menu_sensitivity (); + + film_editor->FileChanged.connect (bind (&Frame::file_changed, this, _1)); + if (film) { + file_changed (film->directory ()); + } else { + file_changed (""); + } + + JobManager::instance()->ActiveJobsChanged.connect (boost::bind (set_menu_sensitivity)); + + set_film (); + overall_panel->SetSizer (main_sizer); + } + +private: + + void menu_opened (wxMenuEvent& ev) + { + if (ev.GetMenu() != jobs_menu) { + return; + } + + bool const have_dcp = false;//film && film->have_dcp(); + jobs_menu->Enable (ID_jobs_send_dcp_to_tms, have_dcp); + jobs_menu->Enable (ID_jobs_show_dcp, have_dcp); + } + + void set_film () + { + film_viewer->set_film (film); + film_editor->set_film (film); + set_menu_sensitivity (); + } + + void file_changed (string f) + { + stringstream s; + s << wx_to_std (_("DCP-o-matic")); + if (!f.empty ()) { + s << " - " << f; + } + + SetTitle (std_to_wx (s.str())); + } + + void file_new () + { + NewFilmDialog* d = new NewFilmDialog (this); + int const r = d->ShowModal (); + + if (r == wxID_OK) { + + if (boost::filesystem::is_directory (d->get_path()) && !boost::filesystem::is_empty(d->get_path())) { + if (!confirm_dialog ( + this, + 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()) + ) + )) { + return; + } + } else if (boost::filesystem::is_regular_file (d->get_path())) { + error_dialog ( + this, + String::compose (wx_to_std (_("%1 already exists as a file, so you cannot use it for a new film.")), d->get_path().c_str()) + ); + return; + } + + maybe_save_then_delete_film (); + film.reset (new Film (d->get_path ())); + film->write_metadata (); + film->log()->set_level (log_level); + film->set_name (boost::filesystem::path (d->get_path()).filename().generic_string()); + set_film (); + } + + d->Destroy (); + } + + void file_open () + { + wxDirDialog* c = new wxDirDialog (this, _("Select film to open"), wxStandardPaths::Get().GetDocumentsDir(), wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST); + int r; + while (1) { + r = c->ShowModal (); + if (r == wxID_OK && c->GetPath() == wxStandardPaths::Get().GetDocumentsDir()) { + error_dialog (this, _("You did not select a folder. Make sure that you select a folder before clicking Open.")); + } else { + break; + } + } + + if (r == wxID_OK) { + maybe_save_then_delete_film (); + try { + film.reset (new Film (wx_to_std (c->GetPath ()))); + film->read_metadata (); + film->log()->set_level (log_level); + set_film (); + } catch (std::exception& e) { + wxString p = c->GetPath (); + wxCharBuffer b = p.ToUTF8 (); + error_dialog (this, wxString::Format (_("Could not open film at %s (%s)"), p.data(), std_to_wx (e.what()).data())); + } + } + + c->Destroy (); + } + + void file_save () + { + film->write_metadata (); + } + + void file_properties () + { + PropertiesDialog* d = new PropertiesDialog (this, film); + d->ShowModal (); + d->Destroy (); + } + + void file_exit () + { + if (!should_close ()) { + return; + } + + maybe_save_then_delete_film (); + Close (true); + } + + void edit_preferences () + { + ConfigDialog* d = new ConfigDialog (this); + d->ShowModal (); + d->Destroy (); + Config::instance()->write (); + } + + void jobs_make_dcp () + { + JobWrapper::make_dcp (this, film); + } + + void jobs_make_kdms () + { + if (!film) { + return; + } + + KDMDialog* d = new KDMDialog (this); + if (d->ShowModal () == wxID_OK) { + try { + film->make_kdms ( + d->screens (), + d->from (), + d->until (), + d->directory () + ); + } catch (KDMError& e) { + error_dialog (this, e.what ()); + } + } + + d->Destroy (); + } + + void jobs_send_dcp_to_tms () + { + film->send_dcp_to_tms (); + } + + void jobs_show_dcp () + { +#ifdef __WXMSW__ + string d = film->directory(); + wstring w; + w.assign (d.begin(), d.end()); + ShellExecute (0, L"open", w.c_str(), 0, 0, SW_SHOWDEFAULT); +#else + int r = system ("which nautilus"); + if (WEXITSTATUS (r) == 0) { + r = system (string ("nautilus " + film->directory()).c_str ()); + if (WEXITSTATUS (r)) { + error_dialog (this, _("Could not show DCP (could not run nautilus)")); + } + } else { + int r = system ("which konqueror"); + if (WEXITSTATUS (r) == 0) { + r = system (string ("konqueror " + film->directory()).c_str ()); + if (WEXITSTATUS (r)) { + error_dialog (this, _("Could not show DCP (could not run konqueror)")); + } + } + } +#endif + } + + void help_about () + { + AboutDialog* d = new AboutDialog (this); + d->ShowModal (); + d->Destroy (); + } + + bool should_close () + { + if (!JobManager::instance()->work_to_do ()) { + return true; + } + + wxMessageDialog* d = new wxMessageDialog ( + 0, + _("There are unfinished jobs; are you sure you want to quit?"), + _("Unfinished jobs"), + wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION + ); + + bool const r = d->ShowModal() == wxID_YES; + d->Destroy (); + return r; + } + + void close (wxCloseEvent& ev) + { + if (!should_close ()) { + ev.Veto (); + return; + } + + ev.Skip (); + } +}; + +#if wxMINOR_VERSION == 9 +static const wxCmdLineEntryDesc command_line_description[] = { + { wxCMD_LINE_OPTION, "l", "log", "set log level (silent, verbose or timing)", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_SWITCH, "n", "new", "create new film", wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_PARAM, 0, 0, "film to load or create", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 } +}; +#else +static const wxCmdLineEntryDesc command_line_description[] = { + { wxCMD_LINE_OPTION, wxT("l"), wxT("log"), wxT("set log level (silent, verbose or timing)"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_SWITCH, wxT("n"), wxT("new"), wxT("create new film"), wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_PARAM, 0, 0, wxT("film to load or create"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL }, + { wxCMD_LINE_NONE, wxT(""), wxT(""), wxT(""), wxCmdLineParamType (0), 0 } +}; +#endif + +class App : public wxApp +{ + bool OnInit () + try + { + if (!wxApp::OnInit()) { + return false; + } + +#ifdef DCPOMATIC_LINUX + unsetenv ("UBUNTU_MENUPROXY"); +#endif + +#ifdef __WXOSX__ + ProcessSerialNumber serial; + GetCurrentProcess (&serial); + TransformProcessType (&serial, kProcessTransformToForegroundApplication); +#endif + + wxInitAllImageHandlers (); + + /* Enable i18n; this will create a Config object + to look for a force-configured language. This Config + object will be wrong, however, because dcpomatic_setup + hasn't yet been called and there aren't any scalers, filters etc. + set up yet. + */ + dcpomatic_setup_i18n (); + + /* Set things up, including scalers / filters etc. + which will now be internationalised correctly. + */ + dcpomatic_setup (); + + /* Force the configuration to be re-loaded correctly next + time it is needed. + */ + Config::drop (); + + if (!film_to_load.empty() && boost::filesystem::is_directory (film_to_load)) { + try { + film.reset (new Film (film_to_load)); + film->read_metadata (); + film->log()->set_level (log_level); + } catch (exception& e) { + error_dialog (0, std_to_wx (String::compose (wx_to_std (_("Could not load film %1 (%2)")), film_to_load, e.what()))); + } + } + + if (!film_to_create.empty ()) { + film.reset (new Film (film_to_create)); + film->write_metadata (); + film->log()->set_level (log_level); + film->set_name (boost::filesystem::path (film_to_create).filename().generic_string ()); + } + + Frame* f = new Frame (_("DCP-o-matic")); + SetTopWindow (f); + f->Maximize (); + f->Show (); + + ui_signaller = new wxUISignaller (this); + this->Bind (wxEVT_IDLE, boost::bind (&App::idle, this)); + + return true; + } + catch (exception& e) + { + error_dialog (0, wxString::Format ("DCP-o-matic could not start: %s", e.what ())); + return true; + } + + void OnInitCmdLine (wxCmdLineParser& parser) + { + parser.SetDesc (command_line_description); + parser.SetSwitchChars (wxT ("-")); + } + + bool OnCmdLineParsed (wxCmdLineParser& parser) + { + if (parser.GetParamCount() > 0) { + if (parser.Found (wxT ("new"))) { + film_to_create = wx_to_std (parser.GetParam (0)); + } else { + film_to_load = wx_to_std (parser.GetParam(0)); + } + } + + wxString log; + if (parser.Found (wxT ("log"), &log)) { + log_level = wx_to_std (log); + } + + return true; + } + + void idle () + { + ui_signaller->ui_idle (); + } +}; + +IMPLEMENT_APP (App) diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc new file mode 100644 index 000000000..23d5a4819 --- /dev/null +++ b/src/tools/dcpomatic_batch.cc @@ -0,0 +1,240 @@ +/* + Copyright (C) 2013 Carl Hetherington <cth@carlh.net> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + +#include <wx/aboutdlg.h> +#include <wx/stdpaths.h> +#include <wx/wx.h> +#include "lib/version.h" +#include "lib/compose.hpp" +#include "lib/config.h" +#include "lib/util.h" +#include "lib/film.h" +#include "lib/job_manager.h" +#include "wx/wx_util.h" +#include "wx/wx_ui_signaller.h" +#include "wx/job_manager_view.h" + +using boost::shared_ptr; + +enum { + ID_file_add_film = 1, + ID_file_quit, + ID_help_about +}; + +void +setup_menu (wxMenuBar* m) +{ + wxMenu* file = new wxMenu; + file->Append (ID_file_add_film, _("&Add Film...")); + file->Append (ID_file_quit, _("&Quit")); + + wxMenu* help = new wxMenu; + help->Append (ID_help_about, _("About")); + + m->Append (file, _("&File")); + m->Append (help, _("&Help")); +} + +class Frame : public wxFrame +{ +public: + Frame (wxString const & title) + : wxFrame (NULL, -1, title) + { + wxMenuBar* bar = new wxMenuBar; + setup_menu (bar); + SetMenuBar (bar); + + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_add_film, this), ID_file_add_film); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::file_quit, this), ID_file_quit); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&Frame::help_about, this), ID_help_about); + + wxPanel* panel = new wxPanel (this); + wxSizer* s = new wxBoxSizer (wxHORIZONTAL); + s->Add (panel, 1, wxEXPAND); + SetSizer (s); + + wxSizer* sizer = new wxBoxSizer (wxVERTICAL); + + JobManagerView* job_manager_view = new JobManagerView (panel, JobManagerView::PAUSE); + sizer->Add (job_manager_view, 1, wxALL | wxEXPAND, 6); + + wxSizer* buttons = new wxBoxSizer (wxHORIZONTAL); + wxButton* add = new wxButton (panel, wxID_ANY, _("Add Film...")); + add->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&Frame::add_film, this)); + buttons->Add (add, 1, wxALL, 6); + + sizer->Add (buttons, 0, wxALL, 6); + + panel->SetSizer (sizer); + + Bind (wxEVT_CLOSE_WINDOW, boost::bind (&Frame::close, this, _1)); + } + +private: + bool should_close () + { + if (!JobManager::instance()->work_to_do ()) { + return true; + } + + wxMessageDialog* d = new wxMessageDialog ( + 0, + _("There are unfinished jobs; are you sure you want to quit?"), + _("Unfinished jobs"), + wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION + ); + + bool const r = d->ShowModal() == wxID_YES; + d->Destroy (); + return r; + } + + void close (wxCloseEvent& ev) + { + if (!should_close ()) { + ev.Veto (); + return; + } + + ev.Skip (); + } + + void file_add_film () + { + add_film (); + } + + void file_quit () + { + if (should_close ()) { + Close (true); + } + } + + void help_about () + { + wxAboutDialogInfo info; + info.SetName (_("DCP-o-matic Batch Converter")); + if (strcmp (dcpomatic_git_commit, "release") == 0) { + info.SetVersion (std_to_wx (String::compose ("version %1", dcpomatic_version))); + } else { + info.SetVersion (std_to_wx (String::compose ("version %1 git %2", dcpomatic_version, dcpomatic_git_commit))); + } + info.SetDescription (_("Free, open-source DCP generation from almost anything.")); + info.SetCopyright (_("(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole Laursen")); + + wxArrayString authors; + authors.Add (wxT ("Carl Hetherington")); + authors.Add (wxT ("Terrence Meiczinger")); + authors.Add (wxT ("Paul Davis")); + authors.Add (wxT ("Ole Laursen")); + info.SetDevelopers (authors); + + wxArrayString translators; + translators.Add (wxT ("Olivier Perriere")); + translators.Add (wxT ("Lilian Lefranc")); + translators.Add (wxT ("Thierry Journet")); + translators.Add (wxT ("Massimiliano Broggi")); + translators.Add (wxT ("Manuel AC")); + translators.Add (wxT ("Adam Klotblixt")); + info.SetTranslators (translators); + + info.SetWebSite (wxT ("http://carlh.net/software/dcpomatic")); + wxAboutBox (info); + } + + void add_film () + { + wxDirDialog* c = new wxDirDialog (this, _("Select film to open"), wxStandardPaths::Get().GetDocumentsDir(), wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST); + int r; + while (1) { + r = c->ShowModal (); + if (r == wxID_OK && c->GetPath() == wxStandardPaths::Get().GetDocumentsDir()) { + error_dialog (this, _("You did not select a folder. Make sure that you select a folder before clicking Open.")); + } else { + break; + } + } + + if (r == wxID_OK) { + try { + shared_ptr<Film> film (new Film (wx_to_std (c->GetPath ()))); + film->read_metadata (); + film->make_dcp (); + } catch (std::exception& e) { + wxString p = c->GetPath (); + wxCharBuffer b = p.ToUTF8 (); + error_dialog (this, wxString::Format (_("Could not open film at %s (%s)"), p.data(), std_to_wx (e.what()).data())); + } + } + + c->Destroy (); + } +}; + +class App : public wxApp +{ + bool OnInit () + { + if (!wxApp::OnInit()) { + return false; + } + +#ifdef DCPOMATIC_LINUX + unsetenv ("UBUNTU_MENUPROXY"); +#endif + + /* Enable i18n; this will create a Config object + to look for a force-configured language. This Config + object will be wrong, however, because dcpomatic_setup + hasn't yet been called and there aren't any scalers, filters etc. + set up yet. + */ + dcpomatic_setup_i18n (); + + /* Set things up, including scalers / filters etc. + which will now be internationalised correctly. + */ + dcpomatic_setup (); + + /* Force the configuration to be re-loaded correctly next + time it is needed. + */ + Config::drop (); + + Frame* f = new Frame (_("DCP-o-matic Batch Converter")); + SetTopWindow (f); + f->Maximize (); + f->Show (); + + ui_signaller = new wxUISignaller (this); + this->Bind (wxEVT_IDLE, boost::bind (&App::idle, this)); + + return true; + } + + void idle () + { + ui_signaller->ui_idle (); + } +}; + +IMPLEMENT_APP (App) diff --git a/src/tools/makedcp.cc b/src/tools/dcpomatic_cli.cc index 900c31bfc..7695e1e94 100644 --- a/src/tools/makedcp.cc +++ b/src/tools/dcpomatic_cli.cc @@ -20,21 +20,17 @@ #include <iostream> #include <iomanip> #include <getopt.h> -#include <libdcp/test_mode.h> #include <libdcp/version.h> -#include "format.h" -#include "film.h" -#include "filter.h" -#include "transcode_job.h" -#include "make_dcp_job.h" -#include "job_manager.h" -#include "ab_transcode_job.h" -#include "util.h" -#include "scaler.h" -#include "version.h" -#include "cross.h" -#include "config.h" -#include "log.h" +#include "lib/film.h" +#include "lib/filter.h" +#include "lib/transcode_job.h" +#include "lib/job_manager.h" +#include "lib/util.h" +#include "lib/scaler.h" +#include "lib/version.h" +#include "lib/cross.h" +#include "lib/config.h" +#include "lib/log.h" using std::string; using std::cerr; @@ -48,10 +44,10 @@ static void help (string n) { cerr << "Syntax: " << n << " [OPTION] <FILM>\n" - << " -v, --version show DVD-o-matic version\n" - << " -h, --help show this help\n" - << " -d, --deps list DVD-o-matic dependency details and quit\n" - << " -t, --test run in test mode (repeatable UUID generation, timestamps etc.)\n" + << " -v, --version show DCP-o-matic version\n" + << " -h, --help show this help\n" + << " -d, --deps list DCP-o-matic dependency details and quit\n" + << " -f, --flags show flags passed to C++ compiler on build\n" << " -n, --no-progress do not print progress to stdout\n" << " -r, --no-remote do not use any remote servers\n" << "\n" @@ -62,10 +58,9 @@ int main (int argc, char* argv[]) { string film_dir; - bool test_mode = false; bool progress = true; bool no_remote = false; - int log_level = 1; + int log_level = 0; int option_index = 0; while (1) { @@ -73,14 +68,14 @@ main (int argc, char* argv[]) { "version", no_argument, 0, 'v'}, { "help", no_argument, 0, 'h'}, { "deps", no_argument, 0, 'd'}, - { "test", no_argument, 0, 't'}, + { "flags", no_argument, 0, 'f'}, { "no-progress", no_argument, 0, 'n'}, { "no-remote", no_argument, 0, 'r'}, { "log-level", required_argument, 0, 'l' }, { 0, 0, 0, 0 } }; - int c = getopt_long (argc, argv, "vhdtnrl:", long_options, &option_index); + int c = getopt_long (argc, argv, "vhdfnrl:", long_options, &option_index); if (c == -1) { break; @@ -88,7 +83,7 @@ main (int argc, char* argv[]) switch (c) { case 'v': - cout << "dvdomatic version " << dvdomatic_version << " " << dvdomatic_git_commit << "\n"; + cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n"; exit (EXIT_SUCCESS); case 'h': help (argv[0]); @@ -96,9 +91,9 @@ main (int argc, char* argv[]) case 'd': cout << dependency_version_summary () << "\n"; exit (EXIT_SUCCESS); - case 't': - test_mode = true; - break; + case 'f': + cout << dcpomatic_cxx_flags << "\n"; + exit (EXIT_SUCCESS); case 'n': progress = false; break; @@ -118,27 +113,23 @@ main (int argc, char* argv[]) film_dir = argv[optind]; - dvdomatic_setup (); + dcpomatic_setup (); if (no_remote) { - Config::instance()->set_servers (vector<ServerDescription*> ()); + Config::instance()->set_servers (vector<ServerDescription> ()); } - cout << "DVD-o-matic " << dvdomatic_version << " git " << dvdomatic_git_commit; + cout << "DCP-o-matic " << dcpomatic_version << " git " << dcpomatic_git_commit; char buf[256]; if (gethostname (buf, 256) == 0) { cout << " on " << buf; } cout << "\n"; - if (test_mode) { - libdcp::enable_test_mode (); - cout << dependency_version_summary() << "\n"; - } - shared_ptr<Film> film; try { - film.reset (new Film (film_dir, true)); + film.reset (new Film (film_dir)); + film->read_metadata (); } catch (std::exception& e) { cerr << argv[0] << ": error reading film `" << film_dir << "' (" << e.what() << ")\n"; exit (EXIT_FAILURE); @@ -146,23 +137,19 @@ main (int argc, char* argv[]) film->log()->set_level ((Log::Level) log_level); - cout << "\nMaking "; - if (film->dcp_ab()) { - cout << "A/B "; - } - cout << "DCP for " << film->name() << "\n"; - cout << "Test mode: " << (test_mode ? "yes" : "no") << "\n"; - cout << "Content: " << film->content() << "\n"; - pair<string, string> const f = Filter::ffmpeg_strings (film->filters ()); - cout << "Filters: " << f.first << " " << f.second << "\n"; + cout << "\nMaking DCP for " << film->name() << "\n"; +// cout << "Content: " << film->content() << "\n"; +// pair<string, string> const f = Filter::ffmpeg_strings (film->filters ()); +// cout << "Filters: " << f.first << " " << f.second << "\n"; - film->make_dcp (true); + film->make_dcp (); bool should_stop = false; bool first = true; + bool error = false; while (!should_stop) { - dvdomatic_sleep (5); + dcpomatic_sleep (5); list<shared_ptr<Job> > jobs = JobManager::instance()->get (); @@ -183,9 +170,9 @@ main (int argc, char* argv[]) float const p = (*i)->overall_progress (); if (p >= 0) { - cout << (*i)->status() << " \n"; + cout << (*i)->status() << " \n"; } else { - cout << ": Running \n"; + cout << ": Running \n"; } } @@ -195,6 +182,7 @@ main (int argc, char* argv[]) if ((*i)->finished_in_error ()) { ++finished_in_error; + error = true; } if (!progress && (*i)->finished_in_error ()) { @@ -210,7 +198,7 @@ main (int argc, char* argv[]) } } - return 0; + return error ? EXIT_FAILURE : EXIT_SUCCESS; } diff --git a/src/tools/servomatic_gui.cc b/src/tools/dcpomatic_server.cc index 610ba8005..78354c468 100644 --- a/src/tools/servomatic_gui.cc +++ b/src/tools/dcpomatic_server.cc @@ -20,13 +20,16 @@ #include <boost/thread.hpp> #include <wx/taskbar.h> #include <wx/icon.h> -#include "wx_util.h" +#include "wx/wx_util.h" #include "lib/util.h" #include "lib/server.h" #include "lib/config.h" -using namespace std; -using namespace boost; +using std::cout; +using std::string; +using boost::shared_ptr; +using boost::thread; +using boost::bind; enum { ID_status = 1, @@ -52,13 +55,13 @@ private: string _log; }; -static MemoryLog memory_log; +static shared_ptr<MemoryLog> memory_log (new MemoryLog); class StatusDialog : public wxDialog { public: StatusDialog () - : wxDialog (0, wxID_ANY, _("DVD-o-matic encode server"), wxDefaultPosition, wxSize (600, 80), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) + : wxDialog (0, wxID_ANY, _("DCP-o-matic encode server"), wxDefaultPosition, wxSize (600, 80), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) , _timer (this, ID_timer) { _sizer = new wxFlexGridSizer (1, 6, 6); @@ -70,14 +73,14 @@ public: SetSizer (_sizer); _sizer->Layout (); - Connect (ID_timer, wxEVT_TIMER, wxTimerEventHandler (StatusDialog::update)); + Bind (wxEVT_TIMER, boost::bind (&StatusDialog::update, this), ID_timer); _timer.Start (1000); } private: - void update (wxTimerEvent &) + void update () { - _text->ChangeValue (std_to_wx (memory_log.get ())); + _text->ChangeValue (std_to_wx (memory_log->get ())); _sizer->Layout (); } @@ -91,11 +94,22 @@ class TaskBarIcon : public wxTaskBarIcon public: TaskBarIcon () { +#ifdef __WXMSW__ wxIcon icon (std_to_wx ("taskbar_icon")); - SetIcon (icon, std_to_wx ("DVD-o-matic encode server")); - - Connect (ID_status, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (TaskBarIcon::status)); - Connect (ID_quit, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (TaskBarIcon::quit)); +#endif +#ifdef __WXGTK__ + wxInitAllImageHandlers(); + wxBitmap bitmap (wxString::Format (wxT ("%s/taskbar_icon.png"), POSIX_ICON_PREFIX), wxBITMAP_TYPE_PNG); + wxIcon icon; + icon.CopyFromBitmap (bitmap); +#endif +#ifndef __WXOSX__ + /* XXX: fix this for OS X */ + SetIcon (icon, std_to_wx ("DCP-o-matic encode server")); +#endif + + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&TaskBarIcon::status, this), ID_status); + Bind (wxEVT_COMMAND_MENU_SELECTED, boost::bind (&TaskBarIcon::quit, this), ID_quit); } wxMenu* CreatePopupMenu () @@ -107,13 +121,13 @@ public: } private: - void status (wxCommandEvent &) + void status () { StatusDialog* d = new StatusDialog; d->Show (); } - void quit (wxCommandEvent &) + void quit () { wxTheApp->ExitMainLoop (); } @@ -125,27 +139,39 @@ public: App () : wxApp () , _thread (0) + , _icon (0) {} private: bool OnInit () { - dvdomatic_setup (); - - new TaskBarIcon; + if (!wxApp::OnInit ()) { + return false; + } + + dcpomatic_setup (); + _icon = new TaskBarIcon; _thread = new thread (bind (&App::main_thread, this)); + return true; } + int OnExit () + { + delete _icon; + return wxApp::OnExit (); + } + void main_thread () { - Server server (&memory_log); + Server server (memory_log); server.run (Config::instance()->num_local_encoding_threads ()); } boost::thread* _thread; + TaskBarIcon* _icon; }; IMPLEMENT_APP (App) diff --git a/src/tools/servomatic_cli.cc b/src/tools/dcpomatic_server_cli.cc index f8e713193..eff10a897 100644 --- a/src/tools/servomatic_cli.cc +++ b/src/tools/dcpomatic_server_cli.cc @@ -32,24 +32,27 @@ #include <boost/thread.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/condition.hpp> -#include "config.h" -#include "dcp_video_frame.h" -#include "exceptions.h" -#include "util.h" -#include "config.h" -#include "scaler.h" -#include "image.h" -#include "log.h" -#include "version.h" +#include "lib/config.h" +#include "lib/dcp_video_frame.h" +#include "lib/exceptions.h" +#include "lib/util.h" +#include "lib/config.h" +#include "lib/scaler.h" +#include "lib/image.h" +#include "lib/log.h" +#include "lib/version.h" -using namespace std; +using std::cerr; +using std::string; +using std::cout; +using boost::shared_ptr; static void help (string n) { cerr << "Syntax: " << n << " [OPTION]\n" - << " -v, --version show DVD-o-matic version\n" - << " -h, --help show this help\n" + << " -v, --version show DCP-o-matic version\n" + << " -h, --help show this help\n" << " -t, --threads number of parallel encoding threads to use\n"; } @@ -75,7 +78,7 @@ main (int argc, char* argv[]) switch (c) { case 'v': - cout << "dvdomatic version " << dvdomatic_version << " " << dvdomatic_git_commit << "\n"; + cout << "dcpomatic version " << dcpomatic_version << " " << dcpomatic_git_commit << "\n"; exit (EXIT_SUCCESS); case 'h': help (argv[0]); @@ -87,8 +90,8 @@ main (int argc, char* argv[]) } Scaler::setup_scalers (); - FileLog log ("servomatic.log"); - Server server (&log); + shared_ptr<FileLog> log (new FileLog ("servomatic.log")); + Server server (log); server.run (num_threads); return 0; } diff --git a/src/tools/dvdomatic.cc b/src/tools/dvdomatic.cc deleted file mode 100644 index b6662f281..000000000 --- a/src/tools/dvdomatic.cc +++ /dev/null @@ -1,466 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <iostream> -#include <boost/filesystem.hpp> -#include <wx/aboutdlg.h> -#include <wx/stdpaths.h> -#include <wx/cmdline.h> -#include "wx/film_viewer.h" -#include "wx/film_editor.h" -#include "wx/job_manager_view.h" -#include "wx/config_dialog.h" -#include "wx/job_wrapper.h" -#include "wx/wx_util.h" -#include "wx/new_film_dialog.h" -#include "wx/properties_dialog.h" -#include "wx/wx_ui_signaller.h" -#include "wx/kdm_dialog.h" -#include "lib/film.h" -#include "lib/format.h" -#include "lib/config.h" -#include "lib/filter.h" -#include "lib/util.h" -#include "lib/scaler.h" -#include "lib/exceptions.h" -#include "lib/version.h" -#include "lib/ui_signaller.h" -#include "lib/log.h" - -using std::cout; -using std::string; -using std::stringstream; -using std::map; -using std::make_pair; -using boost::shared_ptr; - -static FilmEditor* film_editor = 0; -static FilmViewer* film_viewer = 0; -static shared_ptr<Film> film; -static std::string log_level; -static std::string film_to_load; - -static void set_menu_sensitivity (); - -class FilmChangedDialog -{ -public: - FilmChangedDialog () - { - stringstream s; - s << "Save changes to film \"" << film->name() << "\" before closing?"; - _dialog = new wxMessageDialog (0, std_to_wx (s.str()), wxT ("Film changed"), wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION); - } - - ~FilmChangedDialog () - { - _dialog->Destroy (); - } - - int run () - { - return _dialog->ShowModal (); - } - -private: - wxMessageDialog* _dialog; -}; - - -void -maybe_save_then_delete_film () -{ - if (!film) { - return; - } - - if (film->dirty ()) { - FilmChangedDialog d; - switch (d.run ()) { - case wxID_NO: - break; - case wxID_YES: - film->write_metadata (); - break; - } - } - - film.reset (); -} - -enum Sensitivity { - ALWAYS, - NEEDS_FILM -}; - -map<wxMenuItem*, Sensitivity> menu_items; - -void -add_item (wxMenu* menu, std::string text, int id, Sensitivity sens) -{ - wxMenuItem* item = menu->Append (id, std_to_wx (text)); - menu_items.insert (make_pair (item, sens)); -} - -void -set_menu_sensitivity () -{ - for (map<wxMenuItem*, Sensitivity>::iterator i = menu_items.begin(); i != menu_items.end(); ++i) { - if (i->second == NEEDS_FILM) { - i->first->Enable (film != 0); - } else { - i->first->Enable (true); - } - } -} - -enum { - ID_file_new = 1, - ID_file_open, - ID_file_save, - ID_file_properties, - ID_file_quit, - ID_edit_preferences, - ID_jobs_make_dcp, - ID_jobs_make_kdms, - ID_jobs_send_dcp_to_tms, - ID_jobs_examine_content, - ID_jobs_make_dcp_from_existing_transcode, - ID_help_about -}; - -void -setup_menu (wxMenuBar* m) -{ - wxMenu* file = new wxMenu; - add_item (file, "New...", ID_file_new, ALWAYS); - add_item (file, "&Open...", ID_file_open, ALWAYS); - file->AppendSeparator (); - add_item (file, "&Save", ID_file_save, NEEDS_FILM); - file->AppendSeparator (); - add_item (file, "&Properties...", ID_file_properties, NEEDS_FILM); - file->AppendSeparator (); - add_item (file, "&Quit", ID_file_quit, ALWAYS); - - wxMenu* edit = new wxMenu; - add_item (edit, "&Preferences...", ID_edit_preferences, ALWAYS); - - wxMenu* jobs = new wxMenu; - add_item (jobs, "&Make DCP", ID_jobs_make_dcp, NEEDS_FILM); - add_item (jobs, "Make &KDMs...", ID_jobs_make_kdms, NEEDS_FILM); - add_item (jobs, "&Send DCP to TMS", ID_jobs_send_dcp_to_tms, NEEDS_FILM); - jobs->AppendSeparator (); - add_item (jobs, "&Examine content", ID_jobs_examine_content, NEEDS_FILM); - add_item (jobs, "Make DCP from existing &transcode", ID_jobs_make_dcp_from_existing_transcode, NEEDS_FILM); - - wxMenu* help = new wxMenu; - add_item (help, "About", ID_help_about, ALWAYS); - - m->Append (file, _("&File")); - m->Append (edit, _("&Edit")); - m->Append (jobs, _("&Jobs")); - m->Append (help, _("&Help")); -} - -bool -window_closed (wxCommandEvent &) -{ - maybe_save_then_delete_film (); - return false; -} - -class Frame : public wxFrame -{ -public: - Frame (wxString const & title) - : wxFrame (NULL, -1, title) - { - wxMenuBar* bar = new wxMenuBar; - setup_menu (bar); - SetMenuBar (bar); - - Connect (ID_file_new, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::file_new)); - Connect (ID_file_open, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::file_open)); - Connect (ID_file_save, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::file_save)); - Connect (ID_file_properties, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::file_properties)); - Connect (ID_file_quit, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::file_quit)); - Connect (ID_edit_preferences, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::edit_preferences)); - Connect (ID_jobs_make_dcp, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_make_dcp)); - Connect (ID_jobs_make_kdms, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_make_kdms)); - Connect (ID_jobs_send_dcp_to_tms, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_send_dcp_to_tms)); - Connect (ID_jobs_examine_content, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_examine_content)); - Connect (ID_jobs_make_dcp_from_existing_transcode, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::jobs_make_dcp_from_existing_transcode)); - Connect (ID_help_about, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler (Frame::help_about)); - - wxPanel* panel = new wxPanel (this); - wxSizer* s = new wxBoxSizer (wxHORIZONTAL); - s->Add (panel, 1, wxEXPAND); - SetSizer (s); - - film_editor = new FilmEditor (film, panel); - film_viewer = new FilmViewer (film, panel); - JobManagerView* job_manager_view = new JobManagerView (panel); - - wxSizer* rhs_sizer = new wxBoxSizer (wxVERTICAL); - rhs_sizer->Add (film_viewer, 3, wxEXPAND | wxALL); - rhs_sizer->Add (job_manager_view, 1, wxEXPAND | wxALL); - - wxBoxSizer* main_sizer = new wxBoxSizer (wxHORIZONTAL); - main_sizer->Add (film_editor, 0, wxALL, 6); - main_sizer->Add (rhs_sizer, 1, wxEXPAND | wxALL, 6); - panel->SetSizer (main_sizer); - - set_menu_sensitivity (); - - /* XXX: calling these here is a bit of a hack */ - film_editor->setup_visibility (); - - film_editor->FileChanged.connect (bind (&Frame::file_changed, this, _1)); - if (film) { - file_changed (film->directory ()); - } else { - file_changed (""); - } - - set_film (); - } - - void set_film () - { - film_viewer->set_film (film); - film_editor->set_film (film); - set_menu_sensitivity (); - } - - void file_changed (string f) - { - stringstream s; - s << "DVD-o-matic"; - if (!f.empty ()) { - s << " - " << f; - } - - SetTitle (std_to_wx (s.str())); - } - - void file_new (wxCommandEvent &) - { - NewFilmDialog* d = new NewFilmDialog (this); - int const r = d->ShowModal (); - - if (r == wxID_OK) { - - if (boost::filesystem::exists (d->get_path())) { - error_dialog (this, String::compose ("The directory %1 already exists.", d->get_path())); - return; - } - - maybe_save_then_delete_film (); - film.reset (new Film (d->get_path (), false)); - film->log()->set_level (log_level); -#if BOOST_FILESYSTEM_VERSION == 3 - film->set_name (boost::filesystem::path (d->get_path()).filename().generic_string()); -#else - film->set_name (boost::filesystem::path (d->get_path()).filename()); -#endif - set_film (); - } - - d->Destroy (); - } - - void file_open (wxCommandEvent &) - { - wxDirDialog* c = new wxDirDialog (this, wxT ("Select film to open"), wxStandardPaths::Get().GetDocumentsDir(), wxDEFAULT_DIALOG_STYLE | wxDD_DIR_MUST_EXIST); - int const r = c->ShowModal (); - - if (r == wxID_OK) { - maybe_save_then_delete_film (); - try { - film.reset (new Film (wx_to_std (c->GetPath ()))); - film->log()->set_level (log_level); - set_film (); - } catch (std::exception& e) { - error_dialog (this, String::compose ("Could not open film at %1 (%2)", wx_to_std (c->GetPath()), e.what())); - } - } - - c->Destroy (); - } - - void file_save (wxCommandEvent &) - { - film->write_metadata (); - } - - void file_properties (wxCommandEvent &) - { - PropertiesDialog* d = new PropertiesDialog (this, film); - d->ShowModal (); - d->Destroy (); - } - - void file_quit (wxCommandEvent &) - { - maybe_save_then_delete_film (); - Close (true); - } - - void edit_preferences (wxCommandEvent &) - { - ConfigDialog* d = new ConfigDialog (this); - d->ShowModal (); - d->Destroy (); - Config::instance()->write (); - } - - void jobs_make_dcp (wxCommandEvent &) - { - JobWrapper::make_dcp (this, film, true); - } - - void jobs_make_kdms (wxCommandEvent &) - { - if (!film) { - return; - } - - KDMDialog* d = new KDMDialog (this); - if (d->ShowModal () == wxID_OK) { - film->make_kdms ( - d->screens (), - d->from (), - d->until (), - d->directory () - ); - } - - d->Destroy (); - } - - void jobs_make_dcp_from_existing_transcode (wxCommandEvent &) - { - JobWrapper::make_dcp (this, film, false); - } - - void jobs_send_dcp_to_tms (wxCommandEvent &) - { - film->send_dcp_to_tms (); - } - - void jobs_examine_content (wxCommandEvent &) - { - film->examine_content (); - } - - void help_about (wxCommandEvent &) - { - wxAboutDialogInfo info; - info.SetName (_("DVD-o-matic")); - if (strcmp (dvdomatic_git_commit, "release") == 0) { - info.SetVersion (std_to_wx (String::compose ("version %1", dvdomatic_version))); - } else { - info.SetVersion (std_to_wx (String::compose ("version %1 git %2", dvdomatic_version, dvdomatic_git_commit))); - } - info.SetDescription (_("Free, open-source DCP generation from almost anything.")); - info.SetCopyright (_("(C) Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole Laursen")); - wxArrayString authors; - authors.Add (wxT ("Carl Hetherington")); - authors.Add (wxT ("Terrence Meiczinger")); - authors.Add (wxT ("Paul Davis")); - authors.Add (wxT ("Ole Laursen")); - info.SetDevelopers (authors); - info.SetWebSite (wxT ("http://carlh.net/software/dvdomatic")); - wxAboutBox (info); - } -}; - -#if wxMINOR_VERSION == 9 -static const wxCmdLineEntryDesc command_line_description[] = { - { wxCMD_LINE_OPTION, "l", "log", "set log level (silent, verbose or timing)", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, - { wxCMD_LINE_PARAM, 0, 0, "film to load", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL }, - { wxCMD_LINE_NONE, "", "", "", wxCmdLineParamType (0), 0 } -}; -#else -static const wxCmdLineEntryDesc command_line_description[] = { - { wxCMD_LINE_OPTION, wxT("l"), wxT("log"), wxT("set log level (silent, verbose or timing)"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL }, - { wxCMD_LINE_PARAM, 0, 0, wxT("film to load"), wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE | wxCMD_LINE_PARAM_OPTIONAL }, - { wxCMD_LINE_NONE, wxT(""), wxT(""), wxT(""), wxCmdLineParamType (0), 0 } -}; -#endif - -class App : public wxApp -{ - bool OnInit () - { - if (!wxApp::OnInit()) { - return false; - } - -#ifdef DVDOMATIC_POSIX - unsetenv ("UBUNTU_MENUPROXY"); -#endif - - wxInitAllImageHandlers (); - - dvdomatic_setup (); - - if (!film_to_load.empty() && boost::filesystem::is_directory (film_to_load)) { - film.reset (new Film (film_to_load)); - film->log()->set_level (log_level); - } - - Frame* f = new Frame (_("DVD-o-matic")); - SetTopWindow (f); - f->Maximize (); - f->Show (); - - ui_signaller = new wxUISignaller (this); - this->Connect (-1, wxEVT_IDLE, wxIdleEventHandler (App::idle)); - - return true; - } - - void OnInitCmdLine (wxCmdLineParser& parser) - { - parser.SetDesc (command_line_description); - parser.SetSwitchChars (wxT ("-")); - } - - bool OnCmdLineParsed (wxCmdLineParser& parser) - { - if (parser.GetParamCount() > 0) { - film_to_load = wx_to_std (parser.GetParam(0)); - } - - wxString log; - if (parser.Found(wxT("log"), &log)) { - log_level = wx_to_std (log); - } - - return true; - } - - void idle (wxIdleEvent &) - { - ui_signaller->ui_idle (); - } -}; - -IMPLEMENT_APP (App) diff --git a/src/tools/po/es_ES.po b/src/tools/po/es_ES.po new file mode 100644 index 000000000..fb379ab33 --- /dev/null +++ b/src/tools/po/es_ES.po @@ -0,0 +1,145 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: DCPOMATIC\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-07-15 22:07+0100\n" +"PO-Revision-Date: 2013-03-23 21:08-0500\n" +"Last-Translator: Manuel AC <manuel.acevedo@civantos.>\n" +"Language-Team: Manuel AC <manuel.acevedo@civantos.com>\n" +"Language: es-ES\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.5\n" + +#: src/tools/dcpomatic.cc:309 +msgid "%1 already exists as a file, so you cannot use it for a new film." +msgstr "" + +#: src/tools/dcpomatic.cc:196 +msgid "&Edit" +msgstr "&Editar" + +#: src/tools/dcpomatic.cc:169 +msgid "&Exit" +msgstr "" + +#: src/tools/dcpomatic.cc:194 +msgid "&File" +msgstr "&Archivo" + +#: src/tools/dcpomatic.cc:199 +msgid "&Help" +msgstr "&Ayuda" + +#: src/tools/dcpomatic.cc:198 +msgid "&Jobs" +msgstr "&Tareas" + +#: src/tools/dcpomatic.cc:183 +msgid "&Make DCP" +msgstr "&Crear DCP" + +#: src/tools/dcpomatic.cc:159 +msgid "&Open..." +msgstr "&Abrir..." + +#: src/tools/dcpomatic.cc:176 src/tools/dcpomatic.cc:179 +msgid "&Preferences..." +msgstr "&Preferencias..." + +#: src/tools/dcpomatic.cc:163 +msgid "&Properties..." +msgstr "&Propiedades..." + +#: src/tools/dcpomatic.cc:171 +msgid "&Quit" +msgstr "&Salir" + +#: src/tools/dcpomatic.cc:161 +msgid "&Save" +msgstr "&Guardar" + +#: src/tools/dcpomatic.cc:184 +msgid "&Send DCP to TMS" +msgstr "&Enviar DCP al TMS" + +#: src/tools/dcpomatic.cc:191 +msgid "About" +msgstr "Acerca de" + +#: src/tools/dcpomatic.cc:189 +#, fuzzy +msgid "About DCP-o-matic" +msgstr "DVD-o-matic" + +#: src/tools/dcpomatic.cc:479 +#, fuzzy +msgid "Could not load film %1 (%2)" +msgstr "No se pudo cargar la película %s (%s)" + +#: src/tools/dcpomatic.cc:348 +#, c-format +msgid "Could not open film at %s (%s)" +msgstr "No se pudo cargar la película en %s (%s)" + +#: src/tools/dcpomatic.cc:280 src/tools/dcpomatic.cc:490 +msgid "DCP-o-matic" +msgstr "DCP-o-matic" + +#: src/tools/dcpomatic.cc:77 +msgid "Film changed" +msgstr "Película cambiada" + +#: src/tools/dcpomatic.cc:158 +msgid "New..." +msgstr "Nuevo..." + +#: src/tools/dcpomatic.cc:185 +msgid "S&how DCP" +msgstr "&Mostrar DCP" + +#: src/tools/dcpomatic.cc:76 +#, c-format +msgid "Save changes to film \"%s\" before closing?" +msgstr "" + +#: src/tools/dcpomatic.cc:327 +msgid "Select film to open" +msgstr "Selecciona la película a abrir" + +#: src/tools/dcpomatic.cc:299 +msgid "" +"The directory %1 already exists and is not empty. Are you sure you want to " +"use it?" +msgstr "" + +#: src/tools/dcpomatic.cc:332 +msgid "" +"You did not select a folder. Make sure that you select a folder before " +"clicking Open." +msgstr "" + +#~ msgid "&Analyse audio" +#~ msgstr "&Analizar audio" + +#~ msgid "" +#~ "(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole " +#~ "Laursen" +#~ msgstr "" +#~ "(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole " +#~ "Laursen" + +#~ msgid "Free, open-source DCP generation from almost anything." +#~ msgstr "" +#~ "Generación de DCP a partir de casi cualquier fuente, libre y de código " +#~ "abierto." + +#, fuzzy +#~ msgid "The directory %1 already exists." +#~ msgstr "La carpeta %s ya existe." diff --git a/src/tools/po/fr_FR.po b/src/tools/po/fr_FR.po new file mode 100644 index 000000000..71bd1550e --- /dev/null +++ b/src/tools/po/fr_FR.po @@ -0,0 +1,138 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: DCP-o-matic FRENCH\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-07-15 22:07+0100\n" +"PO-Revision-Date: 2013-07-16 23:13+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/tools/dcpomatic.cc:309 +msgid "%1 already exists as a file, so you cannot use it for a new film." +msgstr "Le fichier %1 existe déjà, vous ne pouvez l'utiliser pour un nouveau projet." + +#: src/tools/dcpomatic.cc:196 +msgid "&Edit" +msgstr "&Edition" + +#: src/tools/dcpomatic.cc:169 +msgid "&Exit" +msgstr "&Quitter" + +#: src/tools/dcpomatic.cc:194 +msgid "&File" +msgstr "&Fichier" + +#: src/tools/dcpomatic.cc:199 +msgid "&Help" +msgstr "&Aide" + +#: src/tools/dcpomatic.cc:198 +msgid "&Jobs" +msgstr "&Travaux" + +#: src/tools/dcpomatic.cc:183 +msgid "&Make DCP" +msgstr "&Créer le DCP" + +#: src/tools/dcpomatic.cc:159 +msgid "&Open..." +msgstr "&Ouvrir..." + +#: src/tools/dcpomatic.cc:176 +#: src/tools/dcpomatic.cc:179 +msgid "&Preferences..." +msgstr "&Préférences..." + +#: src/tools/dcpomatic.cc:163 +msgid "&Properties..." +msgstr "&Propriétés..." + +#: src/tools/dcpomatic.cc:171 +msgid "&Quit" +msgstr "&Quitter" + +#: src/tools/dcpomatic.cc:161 +msgid "&Save" +msgstr "&Enregistrer" + +#: src/tools/dcpomatic.cc:184 +msgid "&Send DCP to TMS" +msgstr "&Envoyer le DCP dans le TMS" + +#: src/tools/dcpomatic.cc:191 +msgid "About" +msgstr "A Propos" + +#: src/tools/dcpomatic.cc:189 +msgid "About DCP-o-matic" +msgstr "À propos de DCP-o-matic" + +#: src/tools/dcpomatic.cc:479 +msgid "Could not load film %1 (%2)" +msgstr "Impossible de charger le film %1 (%2)" + +#: src/tools/dcpomatic.cc:348 +#, c-format +msgid "Could not open film at %s (%s)" +msgstr "Impossible d'ouvrir le film à %s (%s)" + +#: src/tools/dcpomatic.cc:280 +#: src/tools/dcpomatic.cc:490 +msgid "DCP-o-matic" +msgstr "DCP-o-matic" + +#: src/tools/dcpomatic.cc:77 +msgid "Film changed" +msgstr "Film changé" + +#: src/tools/dcpomatic.cc:158 +msgid "New..." +msgstr "Nouveau..." + +#: src/tools/dcpomatic.cc:185 +msgid "S&how DCP" +msgstr "Voir le DCP" + +#: src/tools/dcpomatic.cc:76 +#, c-format +msgid "Save changes to film \"%s\" before closing?" +msgstr "Enregistrer les changements du film \"%s\" avant de fermer ?" + +#: src/tools/dcpomatic.cc:327 +msgid "Select film to open" +msgstr "Sélectionner le film à ouvrir" + +#: src/tools/dcpomatic.cc:299 +msgid "The directory %1 already exists and is not empty. Are you sure you want to use it?" +msgstr "Le dossier %1 existe et n'est pas vide. Etes-vous sûr de vouloir l'utiliser ?" + +#: src/tools/dcpomatic.cc:332 +msgid "You did not select a folder. Make sure that you select a folder before clicking Open." +msgstr "Aucun dossier sélectionné. Selectionnez un dossier avant de cliquer sur Ouvrir" + +#~ msgid "&Analyse audio" +#~ msgstr "&Analyser le son" + +#~ msgid "" +#~ "(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole " +#~ "Laursen" +#~ msgstr "" +#~ "(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole " +#~ "Laursen" + +#~ msgid "Free, open-source DCP generation from almost anything." +#~ msgstr "Création de DCP libre et open-source à partir de presque tout." + +#, fuzzy +#~ msgid "The directory %1 already exists." +#~ msgstr "Le dossier %s existe déjà." diff --git a/src/tools/po/it_IT.po b/src/tools/po/it_IT.po new file mode 100644 index 000000000..f32ce97db --- /dev/null +++ b/src/tools/po/it_IT.po @@ -0,0 +1,142 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: IT VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-07-15 22:07+0100\n" +"PO-Revision-Date: 2013-04-28 10:31+0100\n" +"Last-Translator: Maci <macibro@gmail.com>\n" +"Language-Team: \n" +"Language: Italiano\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.5\n" + +#: src/tools/dcpomatic.cc:309 +msgid "%1 already exists as a file, so you cannot use it for a new film." +msgstr "" + +#: src/tools/dcpomatic.cc:196 +msgid "&Edit" +msgstr "&Modifica" + +#: src/tools/dcpomatic.cc:169 +msgid "&Exit" +msgstr "" + +#: src/tools/dcpomatic.cc:194 +msgid "&File" +msgstr "&File" + +#: src/tools/dcpomatic.cc:199 +msgid "&Help" +msgstr "&Aiuto" + +#: src/tools/dcpomatic.cc:198 +msgid "&Jobs" +msgstr "&Lavori" + +#: src/tools/dcpomatic.cc:183 +msgid "&Make DCP" +msgstr "&Crea DCP" + +#: src/tools/dcpomatic.cc:159 +msgid "&Open..." +msgstr "&Apri..." + +#: src/tools/dcpomatic.cc:176 src/tools/dcpomatic.cc:179 +msgid "&Preferences..." +msgstr "&Preferenze..." + +#: src/tools/dcpomatic.cc:163 +msgid "&Properties..." +msgstr "&Proprieta'..." + +#: src/tools/dcpomatic.cc:171 +msgid "&Quit" +msgstr "&Esci" + +#: src/tools/dcpomatic.cc:161 +msgid "&Save" +msgstr "&Salva" + +#: src/tools/dcpomatic.cc:184 +msgid "&Send DCP to TMS" +msgstr "&Invia DCP a TMS" + +#: src/tools/dcpomatic.cc:191 +msgid "About" +msgstr "Informazioni" + +#: src/tools/dcpomatic.cc:189 +#, fuzzy +msgid "About DCP-o-matic" +msgstr "DVD-o-matic" + +#: src/tools/dcpomatic.cc:479 +msgid "Could not load film %1 (%2)" +msgstr "Non posso caricare il film %s (%s)" + +#: src/tools/dcpomatic.cc:348 +#, c-format +msgid "Could not open film at %s (%s)" +msgstr "Non posso aprire il film in %s (%s)" + +#: src/tools/dcpomatic.cc:280 src/tools/dcpomatic.cc:490 +#, fuzzy +msgid "DCP-o-matic" +msgstr "DVD-o-matic" + +#: src/tools/dcpomatic.cc:77 +msgid "Film changed" +msgstr "Film modificato" + +#: src/tools/dcpomatic.cc:158 +msgid "New..." +msgstr "Nuovo" + +#: src/tools/dcpomatic.cc:185 +msgid "S&how DCP" +msgstr "&Mostra DCP" + +#: src/tools/dcpomatic.cc:76 +#, c-format +msgid "Save changes to film \"%s\" before closing?" +msgstr "Salvare i cambiamenti del film \"%s\" prima di chiudere?" + +#: src/tools/dcpomatic.cc:327 +msgid "Select film to open" +msgstr "Seleziona il film da aprire" + +#: src/tools/dcpomatic.cc:299 +msgid "" +"The directory %1 already exists and is not empty. Are you sure you want to " +"use it?" +msgstr "" + +#: src/tools/dcpomatic.cc:332 +msgid "" +"You did not select a folder. Make sure that you select a folder before " +"clicking Open." +msgstr "" + +#~ msgid "&Analyse audio" +#~ msgstr "&Analizza audio" + +#~ msgid "" +#~ "(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole " +#~ "Laursen" +#~ msgstr "" +#~ "(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole " +#~ "Laursen" + +#~ msgid "Free, open-source DCP generation from almost anything." +#~ msgstr "Genera DCP da quasi tutto, free e open-source." + +#~ msgid "The directory %1 already exists." +#~ msgstr "La directory %s esiste gia'." diff --git a/src/tools/po/sv_SE.po b/src/tools/po/sv_SE.po new file mode 100644 index 000000000..a7a5f82e5 --- /dev/null +++ b/src/tools/po/sv_SE.po @@ -0,0 +1,145 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: DCP-o-matic\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-07-15 22:07+0100\n" +"PO-Revision-Date: 2013-04-09 10:12+0100\n" +"Last-Translator: Adam Klotblixt <adam.klotblixt@gmail.com>\n" +"Language-Team: \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 1.5.5\n" + +#: src/tools/dcpomatic.cc:309 +msgid "%1 already exists as a file, so you cannot use it for a new film." +msgstr "" + +#: src/tools/dcpomatic.cc:196 +msgid "&Edit" +msgstr "&Redigera" + +#: src/tools/dcpomatic.cc:169 +msgid "&Exit" +msgstr "" + +#: src/tools/dcpomatic.cc:194 +msgid "&File" +msgstr "&Fil" + +#: src/tools/dcpomatic.cc:199 +msgid "&Help" +msgstr "&Hjälp" + +#: src/tools/dcpomatic.cc:198 +msgid "&Jobs" +msgstr "&Jobb" + +#: src/tools/dcpomatic.cc:183 +msgid "&Make DCP" +msgstr "&Skapa DCP" + +#: src/tools/dcpomatic.cc:159 +msgid "&Open..." +msgstr "&Öppna" + +#: src/tools/dcpomatic.cc:176 src/tools/dcpomatic.cc:179 +msgid "&Preferences..." +msgstr "&Inställningar" + +#: src/tools/dcpomatic.cc:163 +msgid "&Properties..." +msgstr "&Egenskaper" + +#: src/tools/dcpomatic.cc:171 +msgid "&Quit" +msgstr "&Avsluta" + +#: src/tools/dcpomatic.cc:161 +msgid "&Save" +msgstr "&Spara" + +#: src/tools/dcpomatic.cc:184 +msgid "&Send DCP to TMS" +msgstr "&Skicka DCP till TMS" + +#: src/tools/dcpomatic.cc:191 +msgid "About" +msgstr "Om" + +#: src/tools/dcpomatic.cc:189 +#, fuzzy +msgid "About DCP-o-matic" +msgstr "DVD-o-matic" + +#: src/tools/dcpomatic.cc:479 +msgid "Could not load film %1 (%2)" +msgstr "Kunde inte öppna filmen %1 (%2)" + +#: src/tools/dcpomatic.cc:348 +#, c-format +msgid "Could not open film at %s (%s)" +msgstr "Kunde inte öppna filmen vid %s (%s)" + +#: src/tools/dcpomatic.cc:280 src/tools/dcpomatic.cc:490 +msgid "DCP-o-matic" +msgstr "DCP-o-matic" + +#: src/tools/dcpomatic.cc:77 +msgid "Film changed" +msgstr "Film ändrad" + +#: src/tools/dcpomatic.cc:158 +msgid "New..." +msgstr "Ny..." + +#: src/tools/dcpomatic.cc:185 +msgid "S&how DCP" +msgstr "&Visa DCP" + +#: src/tools/dcpomatic.cc:76 +#, fuzzy, c-format +msgid "Save changes to film \"%s\" before closing?" +msgstr "Spara ändringarna till filmen \"%s\" före avslut?" + +#: src/tools/dcpomatic.cc:327 +msgid "Select film to open" +msgstr "Välj film att öppna" + +#: src/tools/dcpomatic.cc:299 +msgid "" +"The directory %1 already exists and is not empty. Are you sure you want to " +"use it?" +msgstr "" + +#: src/tools/dcpomatic.cc:332 +msgid "" +"You did not select a folder. Make sure that you select a folder before " +"clicking Open." +msgstr "" +"Du har inte valt en folder. Se till att välja en folder innan du klickar på " +"Öppna." + +#~ msgid "&Analyse audio" +#~ msgstr "&Analysera audio" + +#~ msgid "" +#~ "(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole " +#~ "Laursen" +#~ msgstr "" +#~ "(C) 2012-2013 Carl Hetherington, Terrence Meiczinger, Paul Davis, Ole " +#~ "Laursen" + +#~ msgid "Free, open-source DCP generation from almost anything." +#~ msgstr "" +#~ "Fri, öppen-källkodsprogramvara för DCP-generering från nästan vad som " +#~ "helst." + +#~ msgid "The directory %1 already exists." +#~ msgstr "Katalogen %1 finns redan." diff --git a/src/tools/servomatictest.cc b/src/tools/server_test.cc index 88c2a833e..029e62614 100644 --- a/src/tools/servomatictest.cc +++ b/src/tools/server_test.cc @@ -21,41 +21,48 @@ #include <iomanip> #include <exception> #include <getopt.h> -#include "format.h" -#include "film.h" -#include "filter.h" -#include "util.h" -#include "scaler.h" -#include "server.h" -#include "dcp_video_frame.h" -#include "options.h" -#include "decoder.h" -#include "exceptions.h" -#include "scaler.h" -#include "log.h" -#include "decoder_factory.h" - -using namespace std; -using namespace boost; - -static Server* server; -static Log log_ ("servomatictest.log"); +#include "lib/ratio.h" +#include "lib/film.h" +#include "lib/filter.h" +#include "lib/util.h" +#include "lib/scaler.h" +#include "lib/server.h" +#include "lib/dcp_video_frame.h" +#include "lib/decoder.h" +#include "lib/exceptions.h" +#include "lib/scaler.h" +#include "lib/log.h" +#include "lib/video_decoder.h" +#include "lib/player.h" + +using std::cout; +using std::cerr; +using std::string; +using std::pair; +using boost::shared_ptr; + +static shared_ptr<Film> film; +static ServerDescription* server; +static shared_ptr<FileLog> log_ (new FileLog ("servomatictest.log")); +static int frame = 0; void -process_video (shared_ptr<Image> image, bool, int frame) +process_video (shared_ptr<const Image> image, Eyes eyes, ColourConversion conversion, Time) { - shared_ptr<DCPVideoFrame> local (new DCPVideoFrame (image, Size (1024, 1024), 0, Scaler::from_id ("bicubic"), frame, 24, "", 0, 250000000, &log_)); - shared_ptr<DCPVideoFrame> remote (new DCPVideoFrame (image, Size (1024, 1024), 0, Scaler::from_id ("bicubic"), frame, 24, "", 0, 250000000, &log_)); + shared_ptr<DCPVideoFrame> local (new DCPVideoFrame (image, frame, eyes, conversion, film->video_frame_rate(), 250000000, log_)); + shared_ptr<DCPVideoFrame> remote (new DCPVideoFrame (image, frame, eyes, conversion, film->video_frame_rate(), 250000000, log_)); cout << "Frame " << frame << ": "; cout.flush (); + ++frame; + shared_ptr<EncodedData> local_encoded = local->encode_locally (); shared_ptr<EncodedData> remote_encoded; string remote_error; try { - remote_encoded = remote->encode_remotely (server); + remote_encoded = remote->encode_remotely (*server); } catch (NetworkError& e) { remote_error = e.what (); } @@ -128,19 +135,21 @@ main (int argc, char* argv[]) exit (EXIT_FAILURE); } - dvdomatic_setup (); + dcpomatic_setup (); - server = new Server (server_host, 1); - Film film (film_dir, true); + server = new ServerDescription (server_host, 1); + film.reset (new Film (film_dir)); + film->read_metadata (); - shared_ptr<Options> opt (new Options ("fred", "jim", "sheila")); - opt->out_size = Size (1024, 1024); - opt->decode_audio = false; + shared_ptr<Player> player = film->make_player (); + player->disable_audio (); - shared_ptr<Decoder> decoder = decoder_factory (film.state_copy(), opt, 0, &log_); try { - decoder->Video.connect (sigc::ptr_fun (process_video)); - decoder->go (); + player->Video.connect (boost::bind (process_video, _1, _2, _3, _5)); + bool done = false; + while (!done) { + done = player->pass (); + } } catch (std::exception& e) { cerr << "Error: " << e.what() << "\n"; } diff --git a/src/tools/test.cc b/src/tools/test.cc deleted file mode 100644 index 4baaeb73f..000000000 --- a/src/tools/test.cc +++ /dev/null @@ -1,34 +0,0 @@ -/* - Copyright (C) 2012 Carl Hetherington <cth@carlh.net> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#include <stdint.h> -#include <boost/shared_ptr.hpp> -#include "image.h" -#include "server.h" - -using namespace boost; - -int main () -{ - uint8_t* rgb = new uint8_t[256]; - shared_ptr<Image> image (new Image (rgb, 0, 32, 32, 24)); - Server* s = new Server ("localhost", 2); - image->encode_remotely (s); - return 0; -} diff --git a/src/tools/wscript b/src/tools/wscript index 5a837f845..42fc90adb 100644 --- a/src/tools/wscript +++ b/src/tools/wscript @@ -1,19 +1,34 @@ +import os +import glob +from waflib import Logs +import i18n + def build(bld): - for t in ['makedcp', 'servomatic_cli']: + for t in ['dcpomatic_cli', 'dcpomatic_server_cli', 'server_test']: obj = bld(features = 'cxx cxxprogram') - obj.uselib = 'BOOST_THREAD OPENJPEG DCP AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC' + obj.uselib = 'BOOST_THREAD OPENJPEG DCP CXML AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC WXWIDGETS' obj.includes = ['..'] - obj.use = ['libdvdomatic'] + obj.use = ['libdcpomatic'] obj.source = '%s.cc' % t obj.target = t if not bld.env.DISABLE_GUI: - for t in ['dvdomatic', 'servomatic_gui']: + for t in ['dcpomatic', 'dcpomatic_batch', 'dcpomatic_server']: obj = bld(features = 'cxx cxxprogram') - obj.uselib = 'DCP OPENJPEG AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC' + obj.uselib = 'DCP OPENJPEG AVFORMAT AVFILTER AVCODEC AVUTIL SWSCALE POSTPROC CXML WXWIDGETS' + if bld.env.STATIC: + obj.uselib += ' GTK' obj.includes = ['..'] - obj.use = ['libdvdomatic', 'libdvdomatic-wx'] + obj.use = ['libdcpomatic', 'libdcpomatic-wx'] obj.source = '%s.cc' % t if bld.env.TARGET_WINDOWS: - obj.source += ' ../../windows/dvdomatic.rc' + obj.source += ' ../../platform/windows/dcpomatic.rc' obj.target = t + + i18n.po_to_mo(os.path.join('src', 'tools'), 'dcpomatic', bld) + +def pot(bld): + i18n.pot(os.path.join('src', 'tools'), 'dcpomatic.cc', 'dcpomatic') + +def pot_merge(bld): + i18n.pot_merge(os.path.join('src', 'tools'), 'dcpomatic') |
