From 3190fb98298ebdd29c41b2cf6019a381e71a6248 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 8 Mar 2014 19:09:46 +0000 Subject: Name audio analyses with stream ID so that you can see analyses for different streams correctly. Reported-by: Markus Raab --- src/lib/audio_content.cc | 4 +++- src/lib/audio_content.h | 2 +- src/lib/ffmpeg_content.cc | 20 ++++++++++++++++++++ src/lib/ffmpeg_content.h | 1 + src/lib/film.cc | 6 ++---- src/lib/film.h | 2 +- 6 files changed, 28 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index b4c4f34b6..b96300e15 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -141,7 +141,9 @@ AudioContent::audio_analysis_path () const return boost::filesystem::path (); } - return film->audio_analysis_path (dynamic_pointer_cast (shared_from_this ())); + boost::filesystem::path p = film->audio_analysis_dir (); + p /= digest (); + return p; } string diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index ca4a1f234..d30db02d7 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -57,9 +57,9 @@ public: virtual int output_audio_frame_rate () const = 0; virtual AudioMapping audio_mapping () const = 0; virtual void set_audio_mapping (AudioMapping) = 0; + virtual boost::filesystem::path audio_analysis_path () const; boost::signals2::connection analyse_audio (boost::function); - boost::filesystem::path audio_analysis_path () const; void set_audio_gain (float); void set_audio_delay (int); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 4ae5546c2..47fe4f807 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -477,3 +477,23 @@ FFmpegContent::identifier () const return s.str (); } +boost::filesystem::path +FFmpegContent::audio_analysis_path () const +{ + shared_ptr film = _film.lock (); + if (!film) { + return boost::filesystem::path (); + } + + /* We need to include the stream ID in this path so that we get different + analyses for each stream. + */ + + boost::filesystem::path p = film->audio_analysis_dir (); + string name = digest (); + if (audio_stream ()) { + name += "_" + audio_stream()->identifier (); + } + p /= name; + return p; +} diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 6dbff41d1..9600666b3 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -150,6 +150,7 @@ public: int output_audio_frame_rate () const; AudioMapping audio_mapping () const; void set_audio_mapping (AudioMapping); + boost::filesystem::path audio_analysis_path () const; void set_filters (std::vector const &); diff --git a/src/lib/film.cc b/src/lib/film.cc index 1b724b27e..da48bc9b2 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -232,11 +232,9 @@ Film::filename_safe_name () const } boost::filesystem::path -Film::audio_analysis_path (shared_ptr c) const +Film::audio_analysis_dir () const { - boost::filesystem::path p = dir ("analysis"); - p /= c->digest(); - return p; + return dir ("analysis"); } /** Add suitable Jobs to the JobManager to create a DCP for this Film */ diff --git a/src/lib/film.h b/src/lib/film.h index 7e65ecb16..e5840621a 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -63,7 +63,7 @@ public: boost::filesystem::path info_path (int, Eyes) const; boost::filesystem::path internal_video_mxf_dir () const; boost::filesystem::path internal_video_mxf_filename () const; - boost::filesystem::path audio_analysis_path (boost::shared_ptr) const; + boost::filesystem::path audio_analysis_dir () const; boost::filesystem::path video_mxf_filename () const; boost::filesystem::path audio_mxf_filename () const; -- cgit v1.2.3 From 3a9bea8c3727af6ebbce860b8223371cd7f87b3f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 9 Mar 2014 22:03:13 +0000 Subject: Fix display of no-scale mode in the player; the image still has to be scaled for the film viewer as its image must represent a (scaled down) version of the film's frame. --- ChangeLog | 4 ++++ src/lib/film.cc | 8 ++++++++ src/lib/film.h | 1 + src/lib/player.cc | 4 ++-- src/lib/video_content.cc | 21 +++++++++++++++------ src/lib/video_content.h | 4 +++- src/lib/writer.cc | 2 +- src/wx/film_viewer.cc | 4 ++-- src/wx/video_panel.cc | 4 ++-- 9 files changed, 38 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/ChangeLog b/ChangeLog index 674e08e0b..be3b611e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2014-03-09 Carl Hetherington + + * Fix display of no-scale display mode in the player. + 2014-03-08 Carl Hetherington * Fix incorrect audio analyses on multiple-stream content. diff --git a/src/lib/film.cc b/src/lib/film.cc index da48bc9b2..8aa0deed0 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -939,6 +939,7 @@ Film::set_sequence_video (bool s) signal_changed (SEQUENCE_VIDEO); } +/** @return Size of the largest possible image in whatever resolution we are using */ libdcp::Size Film::full_frame () const { @@ -953,6 +954,13 @@ Film::full_frame () const return libdcp::Size (); } +/** @return Size of the frame */ +libdcp::Size +Film::frame_size () const +{ + return fit_ratio_within (container()->ratio(), full_frame ()); +} + libdcp::KDM Film::make_kdm ( shared_ptr target, diff --git a/src/lib/film.h b/src/lib/film.h index e5840621a..de9891c9f 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -96,6 +96,7 @@ public: } libdcp::Size full_frame () const; + libdcp::Size frame_size () const; std::list dcps () const; diff --git a/src/lib/player.cc b/src/lib/player.cc index 99aece8d6..d05597dd5 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -126,7 +126,7 @@ Player::Player (shared_ptr f, shared_ptr p) _playlist_changed_connection = _playlist->Changed.connect (bind (&Player::playlist_changed, this)); _playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Player::content_changed, this, _1, _2, _3)); _film_changed_connection = _film->Changed.connect (bind (&Player::film_changed, this, _1)); - set_video_container_size (fit_ratio_within (_film->container()->ratio (), _film->full_frame ())); + set_video_container_size (_film->frame_size ()); } void @@ -273,7 +273,7 @@ Player::process_video (weak_ptr weak_piece, shared_ptr image } Time const time = content->position() + relative_time + extra - content->trim_start (); - libdcp::Size const image_size = content->scale().size (content, _video_container_size); + libdcp::Size const image_size = content->scale().size (content, _video_container_size, _film->frame_size ()); shared_ptr pi ( new PlayerImage ( diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 7bf2a6b62..82f817654 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -443,19 +443,28 @@ VideoContentScale::name () const return _("No scale"); } +/** @param display_container Size of the container that we are displaying this content in. + * @param film_container The size of the film's image. + */ libdcp::Size -VideoContentScale::size (shared_ptr c, libdcp::Size container) const +VideoContentScale::size (shared_ptr c, libdcp::Size display_container, libdcp::Size film_container) const { if (_ratio) { - return fit_ratio_within (_ratio->ratio (), container); + return fit_ratio_within (_ratio->ratio (), display_container); } - /* Force scale if the container is smaller than the content's image */ - if (_scale || container.width < c->video_size().width || container.height < c->video_size().height) { - return fit_ratio_within (c->video_size().ratio (), container); + /* Force scale if the film_container is smaller than the content's image */ + if (_scale || film_container.width < c->video_size().width || film_container.height < c->video_size().height) { + return fit_ratio_within (c->video_size().ratio (), display_container); } - return c->video_size (); + /* Scale the image so that it will be in the right place in film_container, even if display_container is a + different size. + */ + return libdcp::Size ( + c->video_size().width * float(display_container.width) / film_container.width, + c->video_size().height * float(display_container.height) / film_container.height + ); } void diff --git a/src/lib/video_content.h b/src/lib/video_content.h index c98a52d3a..ea4676cec 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -45,7 +45,7 @@ public: VideoContentScale (bool); VideoContentScale (boost::shared_ptr); - libdcp::Size size (boost::shared_ptr, libdcp::Size) const; + libdcp::Size size (boost::shared_ptr, libdcp::Size, libdcp::Size) const; std::string id () const; std::string name () const; void as_xml (xmlpp::Node *) const; @@ -64,7 +64,9 @@ public: } private: + /** a ratio to stretch the content to, or 0 for no stretch */ Ratio const * _ratio; + /** true if we want to scale the content */ bool _scale; static std::vector _scales; diff --git a/src/lib/writer.cc b/src/lib/writer.cc index 42187dc6e..f689ace7c 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -86,7 +86,7 @@ Writer::Writer (shared_ptr f, weak_ptr j) } _picture_asset->set_edit_rate (_film->video_frame_rate ()); - _picture_asset->set_size (fit_ratio_within (_film->container()->ratio(), _film->full_frame ())); + _picture_asset->set_size (_film->frame_size ()); _picture_asset->set_interop (_film->interop ()); if (_film->encrypted ()) { diff --git a/src/wx/film_viewer.cc b/src/wx/film_viewer.cc index e24583d6c..45372d811 100644 --- a/src/wx/film_viewer.cc +++ b/src/wx/film_viewer.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington 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 @@ -404,7 +404,7 @@ FilmViewer::player_changed (bool frequent) if (frequent) { return; } - + calculate_sizes (); fetch_current_frame_again (); } diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index 492968f1b..aa0f7d019 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -305,8 +305,8 @@ VideoPanel::setup_description () ++lines; } - libdcp::Size const container_size = fit_ratio_within (_editor->film()->container()->ratio (), _editor->film()->full_frame ()); - libdcp::Size const scaled = vcs->scale().size (vcs, container_size); + libdcp::Size const container_size = _editor->film()->frame_size (); + libdcp::Size const scaled = vcs->scale().size (vcs, container_size, container_size); if (scaled != vcs->video_size_after_crop ()) { d << wxString::Format ( -- cgit v1.2.3 From 6bc33bf8bbf13ab9aee0d3e455f62d98f9e527f4 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 9 Mar 2014 22:10:25 +0000 Subject: Restore old behaviour of "no-stretch" mode with crop. Reported-by: Markus Raab --- ChangeLog | 2 ++ src/lib/video_content.cc | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/ChangeLog b/ChangeLog index 4bb6b732b..5ce1b0eb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-03-09 Carl Hetherington + * Restore old behaviour of "no-stretch" mode with crop. + * Fix display of no-scale display mode in the player. 2014-03-08 Carl Hetherington diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 82f817654..966b8e8b3 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -453,9 +453,11 @@ VideoContentScale::size (shared_ptr c, libdcp::Size display_ return fit_ratio_within (_ratio->ratio (), display_container); } + libdcp::Size const ac = c->video_size_after_crop (); + /* Force scale if the film_container is smaller than the content's image */ - if (_scale || film_container.width < c->video_size().width || film_container.height < c->video_size().height) { - return fit_ratio_within (c->video_size().ratio (), display_container); + if (_scale || film_container.width < ac.width || film_container.height < ac.height) { + return fit_ratio_within (ac.ratio (), display_container); } /* Scale the image so that it will be in the right place in film_container, even if display_container is a -- cgit v1.2.3 From 3f17f4cae769aff8910afb2bcd21d69ba970de1c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 9 Mar 2014 22:29:26 +0000 Subject: Rearrange names again. --- src/wx/about_dialog.cc | 114 ++++++++++++++++++++++++------------------------- 1 file changed, 57 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc index 3c0730870..be01548a4 100644 --- a/src/wx/about_dialog.cc +++ b/src/wx/about_dialog.cc @@ -91,92 +91,92 @@ AboutDialog::AboutDialog (wxWindow* parent) add_section (_("Written by"), written_by); wxArrayString translated_by; - translated_by.Add (wxT ("Adam Klotblixt")); - translated_by.Add (wxT ("Lilian Lefranc")); translated_by.Add (wxT ("Manuel AC")); - translated_by.Add (wxT ("Markus Raab")); translated_by.Add (wxT ("Massimiliano Broggi")); - translated_by.Add (wxT ("Olivier Perriere")); - translated_by.Add (wxT ("Thierry Journet")); translated_by.Add (wxT ("William Fanelli")); + translated_by.Add (wxT ("Thierry Journet")); + translated_by.Add (wxT ("Adam Klotblixt")); + translated_by.Add (wxT ("Lilian Lefranc")); + translated_by.Add (wxT ("Olivier Perriere")); + translated_by.Add (wxT ("Markus Raab")); add_section (_("Translated by"), translated_by); wxArrayString supported_by; + supported_by.Add (wxT ("Manual AC")); + supported_by.Add (wxT ("Kambiz Afshar")); + supported_by.Add (wxT ("Jeff Boot")); + supported_by.Add (wxT ("Kieran Carroll")); + supported_by.Add (wxT ("Frank Cianciolo")); + supported_by.Add (wxT ("Cinema Clarici")); supported_by.Add (wxT ("Adam Colt")); - supported_by.Add (wxT ("Adam Klotblixt")); - supported_by.Add (wxT ("Aldo Midali")); supported_by.Add (wxT ("Andres Fink")); - supported_by.Add (wxT ("Andrä Steiner")); - supported_by.Add (wxT ("Carsten Kurz")); - supported_by.Add (wxT ("Cinema Clarici")); supported_by.Add (wxT ("Evan Freeze")); - supported_by.Add (wxT ("Filip Kovcin")); + supported_by.Add (wxT ("Rodolfo Giuliano")); supported_by.Add (wxT ("Flor Guillaume")); - supported_by.Add (wxT ("Frank Cianciolo")); - supported_by.Add (wxT ("Frank de Wulf")); + supported_by.Add (wxT ("Jonathan Jensen")); + supported_by.Add (wxT ("Adam Klotblixt")); + supported_by.Add (wxT ("Filip Kovcin")); + supported_by.Add (wxT ("Carsten Kurz")); + supported_by.Add (wxT ("Lilian Lefranc")); + supported_by.Add (wxT ("Sean Leigh")); + supported_by.Add (wxT ("Olivier Lemaire")); supported_by.Add (wxT ("Gavin Lewarne")); + supported_by.Add (wxT ("Theo Lipfert")); + supported_by.Add (wxT ("Mattias Mattsson")); + supported_by.Add (wxT ("Kjarten Michaelsen")); + supported_by.Add (wxT ("Aldo Midali")); + supported_by.Add (wxT ("Sylvain Mielle")); + supported_by.Add (wxT ("Lindsay Morris")); + supported_by.Add (wxT ("Tim O'Brien")); supported_by.Add (wxT ("Ivan Pullman")); - supported_by.Add (wxT ("Jeff Boot")); - supported_by.Add (wxT ("Jonathan Jensen")); + supported_by.Add (wxT ("Andrä Steiner")); supported_by.Add (wxT ("Jussi Siponen")); - supported_by.Add (wxT ("Kambiz Afshar")); - supported_by.Add (wxT ("Kieran Carroll")); - supported_by.Add (wxT ("Kjarten Michaelsen")); supported_by.Add (wxT ("Lasse Salling")); - supported_by.Add (wxT ("Lilian Lefranc")); - supported_by.Add (wxT ("Lindsay Morris")); - supported_by.Add (wxT ("Manual AC")); - supported_by.Add (wxT ("Mattias Mattsson")); supported_by.Add (wxT ("Mike Stiebing")); - supported_by.Add (wxT ("Olivier Lemaire")); supported_by.Add (wxT ("Randy Stankey")); - supported_by.Add (wxT ("Rodolfo Giuliano")); - supported_by.Add (wxT ("Sean Leigh")); - supported_by.Add (wxT ("Sylvain Mielle")); - supported_by.Add (wxT ("Theo Lipfert")); - supported_by.Add (wxT ("Tim O'Brien")); supported_by.Add (wxT ("Wolfgang Woehl")); supported_by.Add (wxT ("Wolfram Weber")); + supported_by.Add (wxT ("Frank de Wulf")); add_section (_("Supported by"), supported_by); wxArrayString tested_by; - tested_by.Add (wxT ("Ada de Kamper")); - tested_by.Add (wxT ("Adam Colt")); - tested_by.Add (wxT ("Adam Keay")); - tested_by.Add (wxT ("Anders Nordentoft-Madsen")); - tested_by.Add (wxT ("Andreas Eli")); - tested_by.Add (wxT ("Andreas Weiss")); - tested_by.Add (wxT ("Bill Lam")); - tested_by.Add (wxT ("Brad Miller")); - tested_by.Add (wxT ("Carsten Kurz")); + tested_by.Add (wxT ("Trever Anderson")); + tested_by.Add (wxT ("Mike Blakesley")); tested_by.Add (wxT ("David Booty")); - tested_by.Add (wxT ("Denzil Kriekenbeek")); - tested_by.Add (wxT ("Gavin Lewarne")); - tested_by.Add (wxT ("Greg Rooke")); - tested_by.Add (wxT ("Gérald Maruccia")); + tested_by.Add (wxT ("Roop Chand")); + tested_by.Add (wxT ("Adam Colt")); tested_by.Add (wxT ("John Convertino")); + tested_by.Add (wxT ("Andreas Eli")); + tested_by.Add (wxT ("Maurizio Giampà")); + tested_by.Add (wxT ("Luke Granger-Brown")); + tested_by.Add (wxT ("Steve Guttag")); + tested_by.Add (wxT ("Patrick Haderer")); tested_by.Add (wxT ("Jonathan Jensen")); - tested_by.Add (wxT ("Karim Senoucci")); + tested_by.Add (wxT ("Thierry Journet")); + tested_by.Add (wxT ("Ada de Kamper")); + tested_by.Add (wxT ("Stefan Karner")); + tested_by.Add (wxT ("Adam Keay")); + tested_by.Add (wxT ("Simon Kesselman")); + tested_by.Add (wxT ("Pepijn Klijs")); + tested_by.Add (wxT ("Denzil Kriekenbeek")); + tested_by.Add (wxT ("Carsten Kurz")); + tested_by.Add (wxT ("Bill Lam")); tested_by.Add (wxT ("Lilian Lefranc")); - tested_by.Add (wxT ("Luke Granger-Brown")); - tested_by.Add (wxT ("Markus Raab")); + tested_by.Add (wxT ("Olivier Lemaire")); + tested_by.Add (wxT ("Gavin Lewarne")); tested_by.Add (wxT ("Mattias Mattsson")); - tested_by.Add (wxT ("Maurizio Giampà")); + tested_by.Add (wxT ("Gérald Maruccia")); + tested_by.Add (wxT ("Will Meadows")); + tested_by.Add (wxT ("Brad Miller")); + tested_by.Add (wxT ("Anders Nordentoft-Madsen")); tested_by.Add (wxT ("Mauro Ottonello")); - tested_by.Add (wxT ("Mike Blakesley")); - tested_by.Add (wxT ("Olivier Lemaire")); - tested_by.Add (wxT ("Patrick Haderer")); - tested_by.Add (wxT ("Paul Willmott")); - tested_by.Add (wxT ("Pepijn Klijs")); tested_by.Add (wxT ("Peter Puchner")); - tested_by.Add (wxT ("Roop Chand")); - tested_by.Add (wxT ("Simon Kesselman")); + tested_by.Add (wxT ("Markus Raab")); + tested_by.Add (wxT ("Greg Rooke")); + tested_by.Add (wxT ("Karim Senoucci")); tested_by.Add (wxT ("Simon Vannarath")); - tested_by.Add (wxT ("Stefan Karner")); - tested_by.Add (wxT ("Steve Guttag")); - tested_by.Add (wxT ("Thierry Journet")); - tested_by.Add (wxT ("Trever Anderson")); - tested_by.Add (wxT ("Will Meadows")); + tested_by.Add (wxT ("Andreas Weiss")); + tested_by.Add (wxT ("Paul Willmott")); tested_by.Add (wxT ("Wolfgang Woehl")); add_section (_("Tested by"), tested_by); -- cgit v1.2.3 From 9aec1c791a7669f19550e2dc299f898e57244a1f Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 11 Mar 2014 12:20:51 +0000 Subject: OS X build fixes. --- src/lib/cross.cc | 7 +++++-- src/lib/writer.cc | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 786f4b997..8785553cb 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -310,8 +310,11 @@ Waker::nudge () Waker::Waker () { -#ifdef DCPOMATIC_OSX - IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id); +#ifdef DCPOMATIC_OSX + /* We should use this */ + // IOPMAssertionCreateWithName (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, CFSTR ("Encoding DCP"), &_assertion_id); + /* but it's not available on 10.5, so we use this */ + IOPMAssertionCreate (kIOPMAssertionTypeNoIdleSleep, kIOPMAssertionLevelOn, &_assertion_id); #endif } diff --git a/src/lib/writer.cc b/src/lib/writer.cc index f689ace7c..23f8bee97 100644 --- a/src/lib/writer.cc +++ b/src/lib/writer.cc @@ -40,6 +40,9 @@ #include "i18n.h" +/* OS X strikes again */ +#undef set_key + using std::make_pair; using std::pair; using std::string; -- cgit v1.2.3 From 7372bcd0628806ff645512bc9652845b94562cab Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 11 Mar 2014 23:44:28 +0000 Subject: Scale config dialog contents when scaling the window. --- src/wx/config_dialog.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 2e6f0557f..a3beb7628 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -53,7 +53,7 @@ ConfigDialog::ConfigDialog (wxWindow* parent) { wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); _notebook = new wxNotebook (this, wxID_ANY); - s->Add (_notebook, 1); + s->Add (_notebook, 1, wxEXPAND); make_misc_panel (); _notebook->AddPage (_misc_panel, _("Miscellaneous"), true); -- cgit v1.2.3 From 16e8c1c7222796246f74153bf294909c3efe57dc Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 15 Mar 2014 13:25:09 +0000 Subject: Remove support for FFmpeg postprocessing filters. --- ChangeLog | 6 ++++ src/lib/ffmpeg_content.cc | 4 +-- src/lib/ffmpeg_decoder.cc | 5 --- src/lib/filter.cc | 79 +++++++++++++---------------------------------- src/lib/filter.h | 19 +++++------- src/lib/filter_graph.cc | 2 +- src/lib/image.cc | 45 --------------------------- src/lib/image.h | 1 - src/wx/video_panel.cc | 7 ++--- wscript | 3 -- 10 files changed, 41 insertions(+), 130 deletions(-) (limited to 'src') diff --git a/ChangeLog b/ChangeLog index 3891521c8..2820a2ff4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-03-15 Carl Hetherington + + * Remove support for FFmpeg post-processing filters as they apparently + do not support > 8bpp. I don't think they are worth the pain of + quantizing and then telling the user what has happened. + 2014-03-12 Carl Hetherington * Version 1.66.1 released. diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 47fe4f807..e52e36f78 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -215,13 +215,13 @@ FFmpegContent::technical_summary () const ss = _subtitle_stream->technical_summary (); } - pair filt = Filter::ffmpeg_strings (_filters); + string filt = Filter::ffmpeg_string (_filters); return Content::technical_summary() + " - " + VideoContent::technical_summary() + " - " + AudioContent::technical_summary() + " - " + String::compose ( - "ffmpeg: audio %1, subtitle %2, filters %3 %4", as, ss, filt.first, filt.second + "ffmpeg: audio %1, subtitle %2, filters %3", as, ss, filt ); } diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 347d8cc08..851c64606 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -468,14 +468,9 @@ FFmpegDecoder::decode_video_packet () list, int64_t> > images = graph->process (_frame); - string post_process = Filter::ffmpeg_strings (_ffmpeg_content->filters()).second; - for (list, int64_t> >::iterator i = images.begin(); i != images.end(); ++i) { shared_ptr image = i->first; - if (!post_process.empty ()) { - image = image->post_process (post_process, true); - } if (i->second != AV_NOPTS_VALUE) { diff --git a/src/lib/filter.cc b/src/lib/filter.cc index 640a531e8..a7dd9c5ce 100644 --- a/src/lib/filter.cc +++ b/src/lib/filter.cc @@ -24,7 +24,6 @@ #include "filter.h" extern "C" { #include -#include } #include "i18n.h" @@ -36,15 +35,13 @@ vector Filter::_filters; /** @param i Our id. * @param n User-visible name. * @param c User-visible category. - * @param v String for a FFmpeg video filter descriptor, or "". - * @param p String for a FFmpeg post-processing descriptor, or "". + * @param v String for a FFmpeg video filter descriptor. */ -Filter::Filter (string i, string n, string c, string v, string p) +Filter::Filter (string i, string n, string c, string v) : _id (i) , _name (n) , _category (c) , _vf (v) - , _pp (p) { } @@ -65,75 +62,41 @@ Filter::setup_filters () { /* Note: "none" is a magic id name, so don't use it here */ - maybe_add (N_("pphb"), _("Horizontal deblocking filter"), _("De-blocking"), N_(""), N_("hb")); - maybe_add (N_("ppvb"), _("Vertical deblocking filter"), _("De-blocking"), N_(""), N_("vb")); - maybe_add (N_("ppha"), _("Horizontal deblocking filter A"), _("De-blocking"), N_(""), N_("ha")); - maybe_add (N_("ppva"), _("Vertical deblocking filter A"), _("De-blocking"), N_(""), N_("va")); - maybe_add (N_("pph1"), _("Experimental horizontal deblocking filter 1"), _("De-blocking"), N_(""), N_("h1")); - maybe_add (N_("pphv"), _("Experimental vertical deblocking filter 1"), _("De-blocking"), N_(""), N_("v1")); - maybe_add (N_("ppdr"), _("Deringing filter"), _("Misc"), N_(""), N_("dr")); - maybe_add (N_("pplb"), _("Linear blend deinterlacer"), _("De-interlacing"), N_(""), N_("lb")); - maybe_add (N_("ppli"), _("Linear interpolating deinterlacer"), _("De-interlacing"), N_(""), N_("li")); - maybe_add (N_("ppci"), _("Cubic interpolating deinterlacer"), _("De-interlacing"), N_(""), N_("ci")); - maybe_add (N_("ppmd"), _("Median deinterlacer"), _("De-interlacing"), N_(""), N_("md")); - maybe_add (N_("ppfd"), _("FFMPEG deinterlacer"), _("De-interlacing"), N_(""), N_("fd")); - maybe_add (N_("ppl5"), _("FIR low-pass deinterlacer"), _("De-interlacing"), N_(""), N_("l5")); - maybe_add (N_("mcdeint"), _("Motion compensating deinterlacer"), _("De-interlacing"), N_("mcdeint"), N_("")); - maybe_add (N_("kerndeint"), _("Kernel deinterlacer"), _("De-interlacing"), N_("kerndeint"), N_("")); - maybe_add (N_("yadif"), _("Yet Another Deinterlacing Filter"), _("De-interlacing"), N_("yadif"), N_("")); - maybe_add (N_("pptn"), _("Temporal noise reducer"), _("Noise reduction"), N_(""), N_("tn")); - maybe_add (N_("ppfq"), _("Force quantizer"), _("Misc"), N_(""), N_("fq")); - maybe_add (N_("gradfun"), _("Gradient debander"), _("Misc"), N_("gradfun"), N_("")); - maybe_add (N_("unsharp"), _("Unsharp mask and Gaussian blur"), _("Misc"), N_("unsharp"), N_("")); - maybe_add (N_("denoise3d"), _("3D denoiser"), _("Noise reduction"), N_("denoise3d"), N_("")); - maybe_add (N_("hqdn3d"), _("High quality 3D denoiser"), _("Noise reduction"), N_("hqdn3d"), N_("")); - maybe_add (N_("telecine"), _("Telecine filter"), _("Misc"), N_("telecine"), N_("")); - maybe_add (N_("ow"), _("Overcomplete wavelet denoiser"), _("Noise reduction"), N_("mp=ow"), N_("")); + maybe_add (N_("mcdeint"), _("Motion compensating deinterlacer"), _("De-interlacing"), N_("mcdeint")); + maybe_add (N_("kerndeint"), _("Kernel deinterlacer"), _("De-interlacing"), N_("kerndeint")); + maybe_add (N_("yadif"), _("Yet Another Deinterlacing Filter"), _("De-interlacing"), N_("yadif")); + maybe_add (N_("gradfun"), _("Gradient debander"), _("Misc"), N_("gradfun")); + maybe_add (N_("unsharp"), _("Unsharp mask and Gaussian blur"), _("Misc"), N_("unsharp")); + maybe_add (N_("denoise3d"), _("3D denoiser"), _("Noise reduction"), N_("denoise3d")); + maybe_add (N_("hqdn3d"), _("High quality 3D denoiser"), _("Noise reduction"), N_("hqdn3d")); + maybe_add (N_("telecine"), _("Telecine filter"), _("Misc"), N_("telecine")); + maybe_add (N_("ow"), _("Overcomplete wavelet denoiser"), _("Noise reduction"), N_("mp=ow")); } void -Filter::maybe_add (string i, string n, string c, string v, string p) +Filter::maybe_add (string i, string n, string c, string v) { - if (!v.empty ()) { - if (avfilter_get_by_name (i.c_str())) { - _filters.push_back (new Filter (i, n, c, v, p)); - } - } else if (!p.empty ()) { - pp_mode* m = pp_get_mode_by_name_and_quality (p.c_str(), PP_QUALITY_MAX); - if (m) { - _filters.push_back (new Filter (i, n, c, v, p)); - pp_free_mode (m); - } + if (avfilter_get_by_name (i.c_str())) { + _filters.push_back (new Filter (i, n, c, v)); } } /** @param filters Set of filters. - * @return A pair; .first is a string to pass to FFmpeg for the video filters, - * .second is a string to pass for the post-processors. + * @return String to pass to FFmpeg for the video filters. */ -pair -Filter::ffmpeg_strings (vector const & filters) +string +Filter::ffmpeg_string (vector const & filters) { string vf; - string pp; for (vector::const_iterator i = filters.begin(); i != filters.end(); ++i) { - if (!(*i)->vf().empty ()) { - if (!vf.empty ()) { - vf += N_(","); - } - vf += (*i)->vf (); - } - - if (!(*i)->pp().empty ()) { - if (!pp.empty()) { - pp += N_(","); - } - pp += (*i)->pp (); + if (!vf.empty ()) { + vf += N_(","); } + vf += (*i)->vf (); } - return make_pair (vf, pp); + return vf; } /** @param d Our id. diff --git a/src/lib/filter.h b/src/lib/filter.h index 5971cd5cf..258e74991 100644 --- a/src/lib/filter.h +++ b/src/lib/filter.h @@ -29,12 +29,16 @@ #include /** @class Filter - * @brief A class to describe one of FFmpeg's video or post-processing filters. + * @brief A class to describe one of FFmpeg's video filters. + * + * We don't support FFmpeg's post-processing filters here as they cannot cope with greater than + * 8bpp. FFmpeg quantizes e.g. yuv422p10le down to yuv422p before running such filters, which + * we don't really want to do. */ class Filter : public boost::noncopyable { public: - Filter (std::string, std::string, std::string, std::string, std::string); + Filter (std::string, std::string, std::string, std::string); /** @return our id */ std::string id () const { @@ -51,11 +55,6 @@ public: return _vf; } - /** @return string for a FFmpeg post-processing descriptor */ - std::string pp () const { - return _pp; - } - std::string category () const { return _category; } @@ -63,7 +62,7 @@ public: static std::vector all (); static Filter const * from_id (std::string); static void setup_filters (); - static std::pair ffmpeg_strings (std::vector const &); + static std::string ffmpeg_string (std::vector const &); private: @@ -74,12 +73,10 @@ private: std::string _category; /** string for a FFmpeg video filter descriptor */ std::string _vf; - /** string for a FFmpeg post-processing descriptor */ - std::string _pp; /** all available filters */ static std::vector _filters; - static void maybe_add (std::string, std::string, std::string, std::string, std::string); + static void maybe_add (std::string, std::string, std::string, std::string); }; #endif diff --git a/src/lib/filter_graph.cc b/src/lib/filter_graph.cc index cd5d19807..a36a41f43 100644 --- a/src/lib/filter_graph.cc +++ b/src/lib/filter_graph.cc @@ -60,7 +60,7 @@ FilterGraph::FilterGraph (shared_ptr content, libdcp::Size { _frame = av_frame_alloc (); - string filters = Filter::ffmpeg_strings (content->filters()).first; + string filters = Filter::ffmpeg_string (content->filters()); if (filters.empty ()) { filters = "copy"; } diff --git a/src/lib/image.cc b/src/lib/image.cc index c7dfc91cb..25d1ef276 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -167,51 +167,6 @@ Image::scale (libdcp::Size out_size, Scaler const * scaler, AVPixelFormat out_fo return scaled; } -/** Run a FFmpeg post-process on this image and return the processed version. - * @param pp Flags for the required set of post processes. - * @return Post-processed image. - */ -shared_ptr -Image::post_process (string pp, bool aligned) const -{ - shared_ptr out (new Image (pixel_format(), size (), aligned)); - - int pp_format = 0; - switch (pixel_format()) { - case PIX_FMT_YUV420P: - pp_format = PP_FORMAT_420; - break; - case PIX_FMT_YUV422P10LE: - case PIX_FMT_YUV422P: - case PIX_FMT_UYVY422: - pp_format = PP_FORMAT_422; - break; - case PIX_FMT_YUV444P: - case PIX_FMT_YUV444P9BE: - case PIX_FMT_YUV444P9LE: - case PIX_FMT_YUV444P10BE: - case PIX_FMT_YUV444P10LE: - pp_format = PP_FORMAT_444; - default: - throw PixelFormatError ("post_process", pixel_format()); - } - - pp_mode* mode = pp_get_mode_by_name_and_quality (pp.c_str (), PP_QUALITY_MAX); - pp_context* context = pp_get_context (size().width, size().height, pp_format | PP_CPU_CAPS_MMX2); - - pp_postprocess ( - (const uint8_t **) data(), stride(), - out->data(), out->stride(), - size().width, size().height, - 0, 0, mode, context, 0 - ); - - pp_free_mode (mode); - pp_free_context (context); - - return out; -} - shared_ptr Image::crop (Crop crop, bool aligned) const { diff --git a/src/lib/image.h b/src/lib/image.h index b12db3a14..2d9f32231 100644 --- a/src/lib/image.h +++ b/src/lib/image.h @@ -58,7 +58,6 @@ public: int lines (int) const; boost::shared_ptr scale (libdcp::Size, Scaler const *, AVPixelFormat, bool aligned) const; - boost::shared_ptr post_process (std::string, bool aligned) const; boost::shared_ptr crop (Crop c, bool aligned) const; boost::shared_ptr crop_scale_window (Crop c, libdcp::Size, libdcp::Size, Scaler const *, AVPixelFormat, bool aligned) const; diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index aa0f7d019..38604248c 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -240,12 +240,11 @@ VideoPanel::film_content_changed (int property) _colour_conversion->SetLabel (preset ? std_to_wx (cc[preset.get()].name) : _("Custom")); } else if (property == FFmpegContentProperty::FILTERS) { if (fcs) { - pair p = Filter::ffmpeg_strings (fcs->filters ()); - if (p.first.empty () && p.second.empty ()) { + string const p = Filter::ffmpeg_string (fcs->filters ()); + if (p.empty ()) { _filters->SetLabel (_("None")); } else { - string const b = p.first + " " + p.second; - _filters->SetLabel (std_to_wx (b)); + _filters->SetLabel (std_to_wx (p)); } } } diff --git a/wscript b/wscript index 0274916d5..aa20e9946 100644 --- a/wscript +++ b/wscript @@ -33,8 +33,6 @@ def static_ffmpeg(conf): conf.env.STLIB_SWSCALE = ['swscale'] conf.check_cfg(package='libswresample', args='--cflags', uselib_store='SWRESAMPLE', mandatory=True) conf.env.STLIB_SWRESAMPLE = ['swresample'] - conf.check_cfg(package='libpostproc', args='--cflags', uselib_store='POSTPROC', mandatory=True) - conf.env.STLIB_POSTPROC = ['postproc'] def dynamic_ffmpeg(conf): conf.check_cfg(package='libavformat', args='--cflags --libs', uselib_store='AVFORMAT', mandatory=True) @@ -43,7 +41,6 @@ def dynamic_ffmpeg(conf): conf.check_cfg(package='libavutil', args='--cflags --libs', uselib_store='AVUTIL', mandatory=True) conf.check_cfg(package='libswscale', args='--cflags --libs', uselib_store='SWSCALE', mandatory=True) conf.check_cfg(package='libswresample', args='--cflags --libs', uselib_store='SWRESAMPLE', mandatory=True) - conf.check_cfg(package='libpostproc', args='--cflags --libs', uselib_store='POSTPROC', mandatory=True) def static_openjpeg(conf): conf.check_cfg(package='libopenjpeg', args='--cflags', atleast_version='1.5.0', uselib_store='OPENJPEG', mandatory=True) -- cgit v1.2.3 From 5d3ebbb2e7844485e8dddd6471209d56b05633ae Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 15 Mar 2014 13:53:51 +0000 Subject: Cope with loading films with now-disabled filters. --- src/lib/content.cc | 5 ++++- src/lib/content_factory.cc | 5 +++-- src/lib/content_factory.h | 2 +- src/lib/ffmpeg_content.cc | 9 ++++++-- src/lib/ffmpeg_content.h | 2 +- src/lib/film.cc | 12 ++++++++--- src/lib/film.h | 2 +- src/lib/playlist.cc | 4 ++-- src/lib/playlist.h | 2 +- src/tools/dcpomatic.cc | 54 ++++++++++++++++++++++++++-------------------- 10 files changed, 60 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/lib/content.cc b/src/lib/content.cc index 1883dfb4a..829468247 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -195,7 +195,10 @@ Content::clone () const xmlpp::Document doc; xmlpp::Node* node = doc.create_root_node ("Content"); as_xml (node); - return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::current_state_version); + + /* notes is unused here (we assume) */ + list notes; + return content_factory (film, cxml::NodePtr (new cxml::Node (node)), Film::current_state_version, notes); } string diff --git a/src/lib/content_factory.cc b/src/lib/content_factory.cc index bab22b8eb..98b1dd859 100644 --- a/src/lib/content_factory.cc +++ b/src/lib/content_factory.cc @@ -24,17 +24,18 @@ #include "util.h" using std::string; +using std::list; using boost::shared_ptr; shared_ptr -content_factory (shared_ptr film, cxml::NodePtr node, int version) +content_factory (shared_ptr film, cxml::NodePtr node, int version, list& notes) { string const type = node->string_child ("Type"); boost::shared_ptr content; if (type == "FFmpeg") { - content.reset (new FFmpegContent (film, node, version)); + content.reset (new FFmpegContent (film, node, version, notes)); } else if (type == "Image") { content.reset (new ImageContent (film, node, version)); } else if (type == "Sndfile") { diff --git a/src/lib/content_factory.h b/src/lib/content_factory.h index 071d925e0..2eeebbc9f 100644 --- a/src/lib/content_factory.h +++ b/src/lib/content_factory.h @@ -19,5 +19,5 @@ class Film; -extern boost::shared_ptr content_factory (boost::shared_ptr, cxml::NodePtr, int); +extern boost::shared_ptr content_factory (boost::shared_ptr, cxml::NodePtr, int, std::list &); extern boost::shared_ptr content_factory (boost::shared_ptr, boost::filesystem::path); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index e52e36f78..fadeec9cd 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -58,7 +58,7 @@ FFmpegContent::FFmpegContent (shared_ptr f, boost::filesystem::path } -FFmpegContent::FFmpegContent (shared_ptr f, shared_ptr node, int version) +FFmpegContent::FFmpegContent (shared_ptr f, shared_ptr node, int version, list& notes) : Content (f, node) , VideoContent (f, node, version) , AudioContent (f, node) @@ -82,7 +82,12 @@ FFmpegContent::FFmpegContent (shared_ptr f, shared_ptrnode_children ("Filter"); for (list::iterator i = c.begin(); i != c.end(); ++i) { - _filters.push_back (Filter::from_id ((*i)->content ())); + Filter const * f = Filter::from_id ((*i)->content ()); + if (f) { + _filters.push_back (f); + } else { + notes.push_back (String::compose (_("DCP-o-matic no longer supports the `%1' filter, so it has been turned off."), (*i)->content())); + } } _first_video = node->optional_number_child ("FirstVideo"); diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 9600666b3..6ab95d2fe 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -127,7 +127,7 @@ class FFmpegContent : public VideoContent, public AudioContent, public SubtitleC { public: FFmpegContent (boost::shared_ptr, boost::filesystem::path); - FFmpegContent (boost::shared_ptr, boost::shared_ptr, int version); + FFmpegContent (boost::shared_ptr, boost::shared_ptr, int version, std::list &); FFmpegContent (boost::shared_ptr, std::vector >); boost::shared_ptr shared_from_this () { diff --git a/src/lib/film.cc b/src/lib/film.cc index 8aa0deed0..04692fc1e 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -381,8 +381,10 @@ Film::write_metadata () const _dirty = false; } -/** Read state from our metadata file */ -void +/** Read state from our metadata file. + * @return Notes about things that the user should know about, or empty. + */ +list Film::read_metadata () { LocaleGuard lg; @@ -430,9 +432,13 @@ Film::read_metadata () _three_d = f.bool_child ("ThreeD"); _interop = f.bool_child ("Interop"); _key = libdcp::Key (f.string_child ("Key")); - _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version); + + list notes; + /* This method is the only one that can return notes (so far) */ + _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes); _dirty = false; + return notes; } /** Given a directory name, return its full path within the Film's directory. diff --git a/src/lib/film.h b/src/lib/film.h index de9891c9f..162b67b35 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -83,7 +83,7 @@ public: boost::filesystem::path file (boost::filesystem::path f) const; boost::filesystem::path dir (boost::filesystem::path d) const; - void read_metadata (); + std::list read_metadata (); void write_metadata () const; boost::shared_ptr metadata () const; diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index daa82cb94..608323e3b 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -113,11 +113,11 @@ Playlist::video_identifier () const /** @param node node */ void -Playlist::set_from_xml (shared_ptr film, shared_ptr node, int version) +Playlist::set_from_xml (shared_ptr film, shared_ptr node, int version, list& notes) { list c = node->node_children ("Content"); for (list::iterator i = c.begin(); i != c.end(); ++i) { - _content.push_back (content_factory (film, *i, version)); + _content.push_back (content_factory (film, *i, version, notes)); } sort (_content.begin(), _content.end(), ContentSorter ()); diff --git a/src/lib/playlist.h b/src/lib/playlist.h index 1915e3d04..394023f5c 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -56,7 +56,7 @@ public: ~Playlist (); void as_xml (xmlpp::Node *); - void set_from_xml (boost::shared_ptr, boost::shared_ptr, int); + void set_from_xml (boost::shared_ptr, boost::shared_ptr, int, std::list &); void add (boost::shared_ptr); void remove (boost::shared_ptr); diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 6b534f4de..a36c4e240 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -114,7 +114,7 @@ private: }; -void +static void maybe_save_then_delete_film () { if (!film) { @@ -135,6 +135,30 @@ maybe_save_then_delete_film () film.reset (); } +static void +check_film_state_version (int v) +{ + if (v == 4) { + error_dialog ( + 0, + _("This film was created with an old version of DVD-o-matic and may not load correctly " + "in this version. Please check the film's settings carefully.") + ); + } +} + +static void +load_film (boost::filesystem::path file) +{ + film.reset (new Film (file)); + list const notes = film->read_metadata (); + check_film_state_version (film->state_version ()); + for (list::const_iterator i = notes.begin(); i != notes.end(); ++i) { + error_dialog (0, std_to_wx (*i)); + } + film->log()->set_level (log_level); +} + #define ALWAYS 0x0 #define NEEDS_FILM 0x1 #define NOT_DURING_DCP_CREATION 0x2 @@ -142,14 +166,14 @@ maybe_save_then_delete_film () map menu_items; -void +static 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 +static void set_menu_sensitivity () { list > jobs = JobManager::instance()->get (); @@ -194,7 +218,7 @@ enum { ID_tools_check_for_updates }; -void +static void setup_menu (wxMenuBar* m) { wxMenu* file = new wxMenu; @@ -326,17 +350,6 @@ public: overall_panel->SetSizer (main_sizer); } - void check_film_state_version (int v) - { - if (v == 4) { - error_dialog ( - this, - _("This film was created with an old version of DVD-o-matic and may not load correctly " - "in this version. Please check the film's settings carefully.") - ); - } - } - private: void set_film () @@ -416,10 +429,7 @@ private: if (r == wxID_OK) { maybe_save_then_delete_film (); try { - film.reset (new Film (wx_to_std (c->GetPath ()))); - film->read_metadata (); - check_film_state_version (film->state_version ()); - film->log()->set_level (log_level); + load_film (wx_to_std (c->GetPath ())); set_film (); } catch (std::exception& e) { wxString p = c->GetPath (); @@ -645,9 +655,7 @@ class App : public wxApp 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); + load_film (film_to_load); } 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()))); } @@ -677,7 +685,7 @@ class App : public wxApp _timer->Start (1000); if (film) { - _frame->check_film_state_version (film->state_version ()); + check_film_state_version (film->state_version ()); } UpdateChecker::instance()->StateChanged.connect (boost::bind (&App::update_checker_state_changed, this)); -- cgit v1.2.3 From 9c04891e53ef3f0693a91ca6f50f0e6625c109eb Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 15 Mar 2014 19:34:27 +0000 Subject: Fix KDM dialog to initialise its time period to a week from now. --- ChangeLog | 5 +++++ src/wx/kdm_dialog.cc | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/ChangeLog b/ChangeLog index 0abedf5b1..f42277184 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-03-15 Carl Hetherington + + * Fix KDM dialog to predictably set up its initial range to + a week from now. + 2014-03-12 Carl Hetherington * Hopefully fix i18n on OS X (#324). diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index 5410f6cec..7d136955c 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -83,15 +83,20 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) wxFlexGridSizer* table = new wxFlexGridSizer (3, 2, 6); add_label_to_sizer (table, this, _("From"), true); - _from_date = new wxDatePickerCtrl (this, wxID_ANY); + wxDateTime from; + from.SetToCurrent (); + _from_date = new wxDatePickerCtrl (this, wxID_ANY, from); table->Add (_from_date, 1, wxEXPAND); - _from_time = new wxTimePickerCtrl (this, wxID_ANY); + _from_time = new wxTimePickerCtrl (this, wxID_ANY, from); table->Add (_from_time, 1, wxEXPAND); - + add_label_to_sizer (table, this, _("Until"), true); - _until_date = new wxDatePickerCtrl (this, wxID_ANY); + wxDateTime to = from; + /* 1 week from now */ + to.Add (wxDateSpan (0, 0, 1, 0)); + _until_date = new wxDatePickerCtrl (this, wxID_ANY, to); table->Add (_until_date, 1, wxEXPAND); - _until_time = new wxTimePickerCtrl (this, wxID_ANY); + _until_time = new wxTimePickerCtrl (this, wxID_ANY, to); table->Add (_until_time, 1, wxEXPAND); vertical->Add (table, 0, wxEXPAND | wxALL, 6); -- cgit v1.2.3 From 15fff8992c5c152c2ac195ab063fd02fbc89e025 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 15 Mar 2014 19:50:07 +0000 Subject: Default to write-to in KDM dialog. --- src/wx/kdm_dialog.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index 7d136955c..17d7bd2a1 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -149,6 +149,8 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) vertical->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); } + _write_to->SetValue (true); + _targets->Bind (wxEVT_COMMAND_TREE_SEL_CHANGED, boost::bind (&KDMDialog::setup_sensitivity, this)); _add_cinema->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&KDMDialog::add_cinema_clicked, this)); -- cgit v1.2.3 From 210e8007d4a4e66cccd0249a221daf0e5599f73d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 15 Mar 2014 20:39:10 +0000 Subject: Force size of wxDirPickerCtrl in a couple of places. --- ChangeLog | 2 ++ src/wx/kdm_dialog.cc | 5 ++--- src/wx/new_film_dialog.cc | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/ChangeLog b/ChangeLog index f42277184..e9afa9302 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-03-15 Carl Hetherington + * Improve appearance of new film and KDM dialogs on OS X. + * Fix KDM dialog to predictably set up its initial range to a week from now. diff --git a/src/wx/kdm_dialog.cc b/src/wx/kdm_dialog.cc index 17d7bd2a1..1f4d62bde 100644 --- a/src/wx/kdm_dialog.cc +++ b/src/wx/kdm_dialog.cc @@ -122,7 +122,7 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) } } - table = new wxFlexGridSizer (3, 2, 6); + table = new wxFlexGridSizer (2, 2, 6); _write_to = new wxRadioButton (this, wxID_ANY, _("Write to")); table->Add (_write_to, 1, wxEXPAND); @@ -130,13 +130,12 @@ KDMDialog::KDMDialog (wxWindow* parent, boost::shared_ptr film) #ifdef DCPOMATIC_USE_OWN_DIR_PICKER _folder = new DirPickerCtrl (this); #else - _folder = new wxDirPickerCtrl (this, wxID_ANY); + _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1)); #endif _folder->SetPath (wxStandardPaths::Get().GetDocumentsDir()); table->Add (_folder, 1, wxEXPAND); - table->AddSpacer (0); _email = new wxRadioButton (this, wxID_ANY, _("Send by email")); table->Add (_email, 1, wxEXPAND); diff --git a/src/wx/new_film_dialog.cc b/src/wx/new_film_dialog.cc index e0ad2c457..f6d910282 100644 --- a/src/wx/new_film_dialog.cc +++ b/src/wx/new_film_dialog.cc @@ -50,7 +50,7 @@ NewFilmDialog::NewFilmDialog (wxWindow* parent) #ifdef DCPOMATIC_USE_OWN_DIR_PICKER _folder = new DirPickerCtrl (this); #else - _folder = new wxDirPickerCtrl (this, wxID_ANY); + _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1)); #endif if (!_directory) { -- cgit v1.2.3 From ada5eb78ffee670aea26dce21083b7ab0466036a Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 16 Mar 2014 22:28:43 +0000 Subject: Basic work on new prefs dialog. --- src/lib/config.h | 27 ++ src/tools/dcpomatic.cc | 13 +- src/wx/config_dialog.cc | 1100 ++++++++++++++++++++++++++--------------------- src/wx/config_dialog.h | 102 +---- src/wx/editable_list.h | 1 + 5 files changed, 642 insertions(+), 601 deletions(-) (limited to 'src') diff --git a/src/lib/config.h b/src/lib/config.h index d77969b3e..b9e8d6b02 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -66,6 +66,7 @@ public: void set_use_any_servers (bool u) { _use_any_servers = u; + write (); } bool use_any_servers () const { @@ -75,6 +76,7 @@ public: /** @param s New list of servers */ void set_servers (std::vector s) { _servers = s; + write (); } /** @return Host names / IP addresses of J2K encoding servers that should definitely be used */ @@ -182,35 +184,42 @@ public: /** @param n New number of local encoding threads */ void set_num_local_encoding_threads (int n) { _num_local_encoding_threads = n; + write (); } void set_default_directory (boost::filesystem::path d) { _default_directory = d; + write (); } /** @param p New server port */ void set_server_port_base (int p) { _server_port_base = p; + write (); } /** @param i IP address of a TMS that we can copy DCPs to */ void set_tms_ip (std::string i) { _tms_ip = i; + write (); } /** @param p Path on a TMS that we should write DCPs to */ void set_tms_path (std::string p) { _tms_path = p; + write (); } /** @param u User name to log into the TMS with */ void set_tms_user (std::string u) { _tms_user = u; + write (); } /** @param p Password to log into the TMS with */ void set_tms_password (std::string p) { _tms_password = p; + write (); } void add_cinema (boost::shared_ptr c) { @@ -223,74 +232,92 @@ public: void set_allowed_dcp_frame_rates (std::list const & r) { _allowed_dcp_frame_rates = r; + write (); } void set_default_dci_metadata (DCIMetadata d) { _default_dci_metadata = d; + write (); } void set_language (std::string l) { _language = l; + write (); } void unset_language () { _language = boost::none; + write (); } void set_default_still_length (int s) { _default_still_length = s; + write (); } void set_default_container (Ratio const * c) { _default_container = c; + write (); } void set_default_dcp_content_type (DCPContentType const * t) { _default_dcp_content_type = t; + write (); } void set_dcp_metadata (libdcp::XMLMetadata m) { _dcp_metadata = m; + write (); } void set_default_j2k_bandwidth (int b) { _default_j2k_bandwidth = b; + write (); } void set_default_audio_delay (int d) { _default_audio_delay = d; + write (); } void set_colour_conversions (std::vector const & c) { _colour_conversions = c; + write (); } void set_mail_server (std::string s) { _mail_server = s; + write (); } void set_mail_user (std::string u) { _mail_user = u; + write (); } void set_mail_password (std::string p) { _mail_password = p; + write (); } void set_kdm_from (std::string f) { _kdm_from = f; + write (); } void set_kdm_email (std::string e) { _kdm_email = e; + write (); } void set_check_for_updates (bool c) { _check_for_updates = c; + write (); } void set_check_for_test_updates (bool c) { _check_for_test_updates = c; + write (); } void write () const; diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index a36c4e240..2f64371ae 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2013 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington 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 @@ -29,6 +29,7 @@ #include #include #include +#include #include "wx/film_viewer.h" #include "wx/film_editor.h" #include "wx/job_manager_view.h" @@ -280,6 +281,7 @@ public: : wxFrame (NULL, -1, title) , _hints_dialog (0) , _servers_list_dialog (0) + , _config_dialog (0) { #if defined(DCPOMATIC_WINDOWS) && defined(DCPOMATIC_WINDOWS_CONSOLE) AllocConsole(); @@ -460,10 +462,10 @@ private: void edit_preferences () { - ConfigDialog* d = new ConfigDialog (this); - d->ShowModal (); - d->Destroy (); - Config::instance()->write (); + if (!_config_dialog) { + _config_dialog = create_config_dialog (); + } + _config_dialog->Show (this); } void jobs_make_dcp () @@ -602,6 +604,7 @@ private: HintsDialog* _hints_dialog; ServersListDialog* _servers_list_dialog; + wxPreferencesEditor* _config_dialog; }; static const wxCmdLineEntryDesc command_line_description[] = { diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index a3beb7628..a6910d64f 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington 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 @@ -25,7 +25,9 @@ #include #include #include -#include +#include +#include +#include #include #include "lib/config.h" #include "lib/ratio.h" @@ -35,6 +37,7 @@ #include "lib/colour_conversion.h" #include "config_dialog.h" #include "wx_util.h" +#include "editable_list.h" #include "filter_dialog.h" #include "dir_picker_ctrl.h" #include "dci_metadata_dialog.h" @@ -44,561 +47,662 @@ using std::vector; using std::string; using std::list; +using std::cout; using boost::bind; using boost::shared_ptr; using boost::lexical_cast; -ConfigDialog::ConfigDialog (wxWindow* parent) - : wxDialog (parent, wxID_ANY, _("DCP-o-matic Preferences"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) +class GeneralPage : public wxStockPreferencesPage { - wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); - _notebook = new wxNotebook (this, wxID_ANY); - s->Add (_notebook, 1, wxEXPAND); - - make_misc_panel (); - _notebook->AddPage (_misc_panel, _("Miscellaneous"), true); - make_defaults_panel (); - _notebook->AddPage (_defaults_panel, _("Defaults"), false); - make_servers_panel (); - _notebook->AddPage (_servers_panel, _("Encoding servers"), false); - make_colour_conversions_panel (); - _notebook->AddPage (_colour_conversions_panel, _("Colour conversions"), false); - make_metadata_panel (); - _notebook->AddPage (_metadata_panel, _("Metadata"), false); - make_tms_panel (); - _notebook->AddPage (_tms_panel, _("TMS"), false); - make_kdm_email_panel (); - _notebook->AddPage (_kdm_email_panel, _("KDM email"), false); - - wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL); - overall_sizer->Add (s, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER); - - wxSizer* buttons = CreateSeparatedButtonSizer (wxOK); - if (buttons) { - overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder()); - } - - SetSizer (overall_sizer); - overall_sizer->Layout (); - overall_sizer->SetSizeHints (this); -} - -void -ConfigDialog::make_misc_panel () -{ - _misc_panel = new wxPanel (_notebook); - wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); - _misc_panel->SetSizer (s); - - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); - table->AddGrowableCol (1, 1); - s->Add (table, 1, wxALL | wxEXPAND, 8); - - _set_language = new wxCheckBox (_misc_panel, wxID_ANY, _("Set language")); - table->Add (_set_language, 1); - _language = new wxChoice (_misc_panel, wxID_ANY); - _language->Append (wxT ("English")); - _language->Append (wxT ("Français")); - _language->Append (wxT ("Italiano")); - _language->Append (wxT ("Español")); - _language->Append (wxT ("Svenska")); - _language->Append (wxT ("Deutsch")); - table->Add (_language); - - wxStaticText* restart = add_label_to_sizer (table, _misc_panel, _("(restart DCP-o-matic to see language changes)"), false); - wxFont font = restart->GetFont(); - font.SetStyle (wxFONTSTYLE_ITALIC); - font.SetPointSize (font.GetPointSize() - 1); - restart->SetFont (font); - table->AddSpacer (0); - - add_label_to_sizer (table, _misc_panel, _("Threads to use for encoding on this host"), true); - _num_local_encoding_threads = new wxSpinCtrl (_misc_panel); - table->Add (_num_local_encoding_threads, 1); - - add_label_to_sizer (table, _misc_panel, _("Outgoing mail server"), true); - _mail_server = new wxTextCtrl (_misc_panel, wxID_ANY); - table->Add (_mail_server, 1, wxEXPAND | wxALL); - - add_label_to_sizer (table, _misc_panel, _("Mail user name"), true); - _mail_user = new wxTextCtrl (_misc_panel, wxID_ANY); - table->Add (_mail_user, 1, wxEXPAND | wxALL); - - add_label_to_sizer (table, _misc_panel, _("Mail password"), true); - _mail_password = new wxTextCtrl (_misc_panel, wxID_ANY); - table->Add (_mail_password, 1, wxEXPAND | wxALL); - - wxStaticText* plain = add_label_to_sizer (table, _misc_panel, _("(password will be stored on disk in plaintext)"), false); - plain->SetFont (font); - table->AddSpacer (0); - - add_label_to_sizer (table, _misc_panel, _("From address for KDM emails"), true); - _kdm_from = new wxTextCtrl (_misc_panel, wxID_ANY); - table->Add (_kdm_from, 1, wxEXPAND | wxALL); - - _check_for_updates = new wxCheckBox (_misc_panel, wxID_ANY, _("Check for updates on startup")); - table->Add (_check_for_updates, 1, wxEXPAND | wxALL); - table->AddSpacer (0); - - _check_for_test_updates = new wxCheckBox (_misc_panel, wxID_ANY, _("Check for testing updates as well as stable ones")); - table->Add (_check_for_test_updates, 1, wxEXPAND | wxALL); - table->AddSpacer (0); - - Config* config = Config::instance (); +public: + GeneralPage () + : wxStockPreferencesPage (Kind_General) + {} - _set_language->SetValue (config->language ()); - - if (config->language().get_value_or ("") == "fr") { - _language->SetSelection (1); - } else if (config->language().get_value_or ("") == "it") { + wxWindow* CreateWindow (wxWindow* parent) + { + wxPanel* panel = new wxPanel (parent); + wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); + panel->SetSizer (s); + + wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + table->AddGrowableCol (1, 1); + s->Add (table, 1, wxALL | wxEXPAND, 8); + + _set_language = new wxCheckBox (panel, wxID_ANY, _("Set language")); + table->Add (_set_language, 1); + _language = new wxChoice (panel, wxID_ANY); + _language->Append (wxT ("English")); + _language->Append (wxT ("Français")); + _language->Append (wxT ("Italiano")); + _language->Append (wxT ("Español")); + _language->Append (wxT ("Svenska")); + _language->Append (wxT ("Deutsch")); + table->Add (_language); + + wxStaticText* restart = add_label_to_sizer (table, panel, _("(restart DCP-o-matic to see language changes)"), false); + wxFont font = restart->GetFont(); + font.SetStyle (wxFONTSTYLE_ITALIC); + font.SetPointSize (font.GetPointSize() - 1); + restart->SetFont (font); + table->AddSpacer (0); + + add_label_to_sizer (table, panel, _("Threads to use for encoding on this host"), true); + _num_local_encoding_threads = new wxSpinCtrl (panel); + table->Add (_num_local_encoding_threads, 1); + + add_label_to_sizer (table, panel, _("Outgoing mail server"), true); + _mail_server = new wxTextCtrl (panel, wxID_ANY); + table->Add (_mail_server, 1, wxEXPAND | wxALL); + + add_label_to_sizer (table, panel, _("Mail user name"), true); + _mail_user = new wxTextCtrl (panel, wxID_ANY); + table->Add (_mail_user, 1, wxEXPAND | wxALL); + + add_label_to_sizer (table, panel, _("Mail password"), true); + _mail_password = new wxTextCtrl (panel, wxID_ANY); + table->Add (_mail_password, 1, wxEXPAND | wxALL); + + wxStaticText* plain = add_label_to_sizer (table, panel, _("(password will be stored on disk in plaintext)"), false); + plain->SetFont (font); + table->AddSpacer (0); + + add_label_to_sizer (table, panel, _("From address for KDM emails"), true); + _kdm_from = new wxTextCtrl (panel, wxID_ANY); + table->Add (_kdm_from, 1, wxEXPAND | wxALL); + + _check_for_updates = new wxCheckBox (panel, wxID_ANY, _("Check for updates on startup")); + table->Add (_check_for_updates, 1, wxEXPAND | wxALL); + table->AddSpacer (0); + + _check_for_test_updates = new wxCheckBox (panel, wxID_ANY, _("Check for testing updates as well as stable ones")); + table->Add (_check_for_test_updates, 1, wxEXPAND | wxALL); + table->AddSpacer (0); + + Config* config = Config::instance (); + + _set_language->SetValue (config->language ()); + + if (config->language().get_value_or ("") == "fr") { + _language->SetSelection (1); + } else if (config->language().get_value_or ("") == "it") { _language->SetSelection (2); - } else if (config->language().get_value_or ("") == "es") { - _language->SetSelection (3); - } else if (config->language().get_value_or ("") == "sv") { - _language->SetSelection (4); - } else if (config->language().get_value_or ("") == "de") { - _language->SetSelection (5); - } else { - _language->SetSelection (0); - } - - setup_language_sensitivity (); - - _set_language->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&ConfigDialog::set_language_changed, this)); - _language->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&ConfigDialog::language_changed, this)); - - _num_local_encoding_threads->SetRange (1, 128); - _num_local_encoding_threads->SetValue (config->num_local_encoding_threads ()); - _num_local_encoding_threads->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&ConfigDialog::num_local_encoding_threads_changed, this)); - - _mail_server->SetValue (std_to_wx (config->mail_server ())); - _mail_server->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::mail_server_changed, this)); - _mail_user->SetValue (std_to_wx (config->mail_user ())); - _mail_user->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::mail_user_changed, this)); - _mail_password->SetValue (std_to_wx (config->mail_password ())); - _mail_password->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::mail_password_changed, this)); - _kdm_from->SetValue (std_to_wx (config->kdm_from ())); - _kdm_from->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::kdm_from_changed, this)); - _check_for_updates->SetValue (config->check_for_updates ()); - _check_for_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&ConfigDialog::check_for_updates_changed, this)); - _check_for_test_updates->SetValue (config->check_for_test_updates ()); - _check_for_test_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&ConfigDialog::check_for_test_updates_changed, this)); -} - -void -ConfigDialog::make_defaults_panel () -{ - _defaults_panel = new wxPanel (_notebook); - wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); - _defaults_panel->SetSizer (s); - - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); - table->AddGrowableCol (1, 1); - s->Add (table, 1, wxALL | wxEXPAND, 8); + } else if (config->language().get_value_or ("") == "es") { + _language->SetSelection (3); + } else if (config->language().get_value_or ("") == "sv") { + _language->SetSelection (4); + } else if (config->language().get_value_or ("") == "de") { + _language->SetSelection (5); + } else { + _language->SetSelection (0); + } + + setup_language_sensitivity (); + + _set_language->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::set_language_changed, this)); + _language->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&GeneralPage::language_changed, this)); + + _num_local_encoding_threads->SetRange (1, 128); + _num_local_encoding_threads->SetValue (config->num_local_encoding_threads ()); + _num_local_encoding_threads->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&GeneralPage::num_local_encoding_threads_changed, this)); + + _mail_server->SetValue (std_to_wx (config->mail_server ())); + _mail_server->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&GeneralPage::mail_server_changed, this)); + _mail_user->SetValue (std_to_wx (config->mail_user ())); + _mail_user->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&GeneralPage::mail_user_changed, this)); + _mail_password->SetValue (std_to_wx (config->mail_password ())); + _mail_password->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&GeneralPage::mail_password_changed, this)); + _kdm_from->SetValue (std_to_wx (config->kdm_from ())); + _kdm_from->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&GeneralPage::kdm_from_changed, this)); + _check_for_updates->SetValue (config->check_for_updates ()); + _check_for_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::check_for_updates_changed, this)); + _check_for_test_updates->SetValue (config->check_for_test_updates ()); + _check_for_test_updates->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&GeneralPage::check_for_test_updates_changed, this)); + + return panel; + } +private: + void setup_language_sensitivity () { - add_label_to_sizer (table, _defaults_panel, _("Default duration of still images"), true); - wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - _default_still_length = new wxSpinCtrl (_defaults_panel); - s->Add (_default_still_length); - add_label_to_sizer (s, _defaults_panel, _("s"), false); - table->Add (s, 1); + _language->Enable (_set_language->GetValue ()); } - add_label_to_sizer (table, _defaults_panel, _("Default directory for new films"), true); -#ifdef DCPOMATIC_USE_OWN_DIR_PICKER - _default_directory = new DirPickerCtrl (_defaults_panel); -#else - _default_directory = new wxDirPickerCtrl (_defaults_panel, wxDD_DIR_MUST_EXIST); -#endif - table->Add (_default_directory, 1, wxEXPAND); - - add_label_to_sizer (table, _defaults_panel, _("Default DCI name details"), true); - _default_dci_metadata_button = new wxButton (_defaults_panel, wxID_ANY, _("Edit...")); - table->Add (_default_dci_metadata_button); - - add_label_to_sizer (table, _defaults_panel, _("Default container"), true); - _default_container = new wxChoice (_defaults_panel, wxID_ANY); - table->Add (_default_container); - - add_label_to_sizer (table, _defaults_panel, _("Default content type"), true); - _default_dcp_content_type = new wxChoice (_defaults_panel, wxID_ANY); - table->Add (_default_dcp_content_type); - + void set_language_changed () { - add_label_to_sizer (table, _defaults_panel, _("Default JPEG2000 bandwidth"), true); - wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - _default_j2k_bandwidth = new wxSpinCtrl (_defaults_panel); - s->Add (_default_j2k_bandwidth); - add_label_to_sizer (s, _defaults_panel, _("Mbit/s"), false); - table->Add (s, 1); + setup_language_sensitivity (); + if (_set_language->GetValue ()) { + language_changed (); + } else { + Config::instance()->unset_language (); + } } + void language_changed () + { + switch (_language->GetSelection ()) { + case 0: + Config::instance()->set_language ("en"); + break; + case 1: + Config::instance()->set_language ("fr"); + break; + case 2: + Config::instance()->set_language ("it"); + break; + case 3: + Config::instance()->set_language ("es"); + break; + case 4: + Config::instance()->set_language ("sv"); + break; + case 5: + Config::instance()->set_language ("de"); + break; + } + } + + void mail_server_changed () + { + Config::instance()->set_mail_server (wx_to_std (_mail_server->GetValue ())); + } + + void mail_user_changed () + { + Config::instance()->set_mail_user (wx_to_std (_mail_user->GetValue ())); + } + + void mail_password_changed () { - add_label_to_sizer (table, _defaults_panel, _("Default audio delay"), true); - wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - _default_audio_delay = new wxSpinCtrl (_defaults_panel); - s->Add (_default_audio_delay); - add_label_to_sizer (s, _defaults_panel, _("ms"), false); - table->Add (s, 1); + Config::instance()->set_mail_password (wx_to_std (_mail_password->GetValue ())); + } + + void kdm_from_changed () + { + Config::instance()->set_kdm_from (wx_to_std (_kdm_from->GetValue ())); } - Config* config = Config::instance (); + void check_for_updates_changed () + { + Config::instance()->set_check_for_updates (_check_for_updates->GetValue ()); + } - _default_still_length->SetRange (1, 3600); - _default_still_length->SetValue (config->default_still_length ()); - _default_still_length->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&ConfigDialog::default_still_length_changed, this)); + void check_for_test_updates_changed () + { + Config::instance()->set_check_for_test_updates (_check_for_test_updates->GetValue ()); + } - _default_directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ())); - _default_directory->Bind (wxEVT_COMMAND_DIRPICKER_CHANGED, boost::bind (&ConfigDialog::default_directory_changed, this)); + void num_local_encoding_threads_changed () + { + Config::instance()->set_num_local_encoding_threads (_num_local_encoding_threads->GetValue ()); + } + + wxCheckBox* _set_language; + wxChoice* _language; + wxSpinCtrl* _num_local_encoding_threads; + wxTextCtrl* _mail_server; + wxTextCtrl* _mail_user; + wxTextCtrl* _mail_password; + wxTextCtrl* _kdm_from; + wxCheckBox* _check_for_updates; + wxCheckBox* _check_for_test_updates; +}; + +class DefaultsPage : public wxPreferencesPage +{ +public: + wxString GetName () const + { + return _("Defaults"); + } - _default_dci_metadata_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ConfigDialog::edit_default_dci_metadata_clicked, this)); +#ifdef DCPOMATIC_OSX + wxBitmap GetLargeIcon () const + { + return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); + } +#endif - vector ratio = Ratio::all (); - int n = 0; - for (vector::iterator i = ratio.begin(); i != ratio.end(); ++i) { - _default_container->Append (std_to_wx ((*i)->nickname ())); - if (*i == config->default_container ()) { - _default_container->SetSelection (n); + wxWindow* CreateWindow (wxWindow* parent) + { + wxPanel* panel = new wxPanel (parent); + wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); + panel->SetSizer (s); + + wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + table->AddGrowableCol (1, 1); + s->Add (table, 1, wxALL | wxEXPAND, 8); + + { + add_label_to_sizer (table, panel, _("Default duration of still images"), true); + wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + _default_still_length = new wxSpinCtrl (panel); + s->Add (_default_still_length); + add_label_to_sizer (s, panel, _("s"), false); + table->Add (s, 1); + } + + add_label_to_sizer (table, panel, _("Default directory for new films"), true); +#ifdef DCPOMATIC_USE_OWN_DIR_PICKER + _default_directory = new DirPickerCtrl (panel); +#else + _default_directory = new wxDirPickerCtrl (panel, wxDD_DIR_MUST_EXIST); +#endif + table->Add (_default_directory, 1, wxEXPAND); + + add_label_to_sizer (table, panel, _("Default DCI name details"), true); + _default_dci_metadata_button = new wxButton (panel, wxID_ANY, _("Edit...")); + table->Add (_default_dci_metadata_button); + + add_label_to_sizer (table, panel, _("Default container"), true); + _default_container = new wxChoice (panel, wxID_ANY); + table->Add (_default_container); + + add_label_to_sizer (table, panel, _("Default content type"), true); + _default_dcp_content_type = new wxChoice (panel, wxID_ANY); + table->Add (_default_dcp_content_type); + + { + add_label_to_sizer (table, panel, _("Default JPEG2000 bandwidth"), true); + wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + _default_j2k_bandwidth = new wxSpinCtrl (panel); + s->Add (_default_j2k_bandwidth); + add_label_to_sizer (s, panel, _("Mbit/s"), false); + table->Add (s, 1); } - ++n; + + { + add_label_to_sizer (table, panel, _("Default audio delay"), true); + wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); + _default_audio_delay = new wxSpinCtrl (panel); + s->Add (_default_audio_delay); + add_label_to_sizer (s, panel, _("ms"), false); + table->Add (s, 1); + } + + Config* config = Config::instance (); + + _default_still_length->SetRange (1, 3600); + _default_still_length->SetValue (config->default_still_length ()); + _default_still_length->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::default_still_length_changed, this)); + + _default_directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ())); + _default_directory->Bind (wxEVT_COMMAND_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::default_directory_changed, this)); + + _default_dci_metadata_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DefaultsPage::edit_default_dci_metadata_clicked, this, parent)); + + vector ratio = Ratio::all (); + int n = 0; + for (vector::iterator i = ratio.begin(); i != ratio.end(); ++i) { + _default_container->Append (std_to_wx ((*i)->nickname ())); + if (*i == config->default_container ()) { + _default_container->SetSelection (n); + } + ++n; + } + + _default_container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::default_container_changed, this)); + + vector const ct = DCPContentType::all (); + n = 0; + for (vector::const_iterator i = ct.begin(); i != ct.end(); ++i) { + _default_dcp_content_type->Append (std_to_wx ((*i)->pretty_name ())); + if (*i == config->default_dcp_content_type ()) { + _default_dcp_content_type->SetSelection (n); + } + ++n; + } + + _default_dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::default_dcp_content_type_changed, this)); + + _default_j2k_bandwidth->SetRange (50, 250); + _default_j2k_bandwidth->SetValue (config->default_j2k_bandwidth() / 1000000); + _default_j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::default_j2k_bandwidth_changed, this)); + + _default_audio_delay->SetRange (-1000, 1000); + _default_audio_delay->SetValue (config->default_audio_delay ()); + _default_audio_delay->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::default_audio_delay_changed, this)); + + return panel; } - _default_container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&ConfigDialog::default_container_changed, this)); +private: + void default_j2k_bandwidth_changed () + { + Config::instance()->set_default_j2k_bandwidth (_default_j2k_bandwidth->GetValue() * 1000000); + } - vector const ct = DCPContentType::all (); - n = 0; - for (vector::const_iterator i = ct.begin(); i != ct.end(); ++i) { - _default_dcp_content_type->Append (std_to_wx ((*i)->pretty_name ())); - if (*i == config->default_dcp_content_type ()) { - _default_dcp_content_type->SetSelection (n); - } - ++n; + void default_audio_delay_changed () + { + Config::instance()->set_default_audio_delay (_default_audio_delay->GetValue()); } - _default_dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&ConfigDialog::default_dcp_content_type_changed, this)); - - _default_j2k_bandwidth->SetRange (50, 250); - _default_j2k_bandwidth->SetValue (config->default_j2k_bandwidth() / 1000000); - _default_j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&ConfigDialog::default_j2k_bandwidth_changed, this)); - - _default_audio_delay->SetRange (-1000, 1000); - _default_audio_delay->SetValue (config->default_audio_delay ()); - _default_audio_delay->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&ConfigDialog::default_audio_delay_changed, this)); -} - -void -ConfigDialog::make_tms_panel () -{ - _tms_panel = new wxPanel (_notebook); - wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); - _tms_panel->SetSizer (s); - - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); - table->AddGrowableCol (1, 1); - s->Add (table, 1, wxALL | wxEXPAND, 8); - - add_label_to_sizer (table, _tms_panel, _("IP address"), true); - _tms_ip = new wxTextCtrl (_tms_panel, wxID_ANY); - table->Add (_tms_ip, 1, wxEXPAND); - - add_label_to_sizer (table, _tms_panel, _("Target path"), true); - _tms_path = new wxTextCtrl (_tms_panel, wxID_ANY); - table->Add (_tms_path, 1, wxEXPAND); - - add_label_to_sizer (table, _tms_panel, _("User name"), true); - _tms_user = new wxTextCtrl (_tms_panel, wxID_ANY); - table->Add (_tms_user, 1, wxEXPAND); + void default_directory_changed () + { + Config::instance()->set_default_directory (wx_to_std (_default_directory->GetPath ())); + } - add_label_to_sizer (table, _tms_panel, _("Password"), true); - _tms_password = new wxTextCtrl (_tms_panel, wxID_ANY); - table->Add (_tms_password, 1, wxEXPAND); + void edit_default_dci_metadata_clicked (wxWindow* parent) + { + DCIMetadataDialog* d = new DCIMetadataDialog (parent, Config::instance()->default_dci_metadata ()); + d->ShowModal (); + Config::instance()->set_default_dci_metadata (d->dci_metadata ()); + d->Destroy (); + } - Config* config = Config::instance (); + void default_still_length_changed () + { + Config::instance()->set_default_still_length (_default_still_length->GetValue ()); + } - _tms_ip->SetValue (std_to_wx (config->tms_ip ())); - _tms_ip->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::tms_ip_changed, this)); - _tms_path->SetValue (std_to_wx (config->tms_path ())); - _tms_path->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::tms_path_changed, this)); - _tms_user->SetValue (std_to_wx (config->tms_user ())); - _tms_user->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::tms_user_changed, this)); - _tms_password->SetValue (std_to_wx (config->tms_password ())); - _tms_password->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::tms_password_changed, this)); -} - -void -ConfigDialog::make_metadata_panel () -{ - _metadata_panel = new wxPanel (_notebook); - wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); - _metadata_panel->SetSizer (s); - - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); - table->AddGrowableCol (1, 1); - s->Add (table, 1, wxALL | wxEXPAND, 8); - - add_label_to_sizer (table, _metadata_panel, _("Issuer"), true); - _issuer = new wxTextCtrl (_metadata_panel, wxID_ANY); - table->Add (_issuer, 1, wxEXPAND); - - add_label_to_sizer (table, _metadata_panel, _("Creator"), true); - _creator = new wxTextCtrl (_metadata_panel, wxID_ANY); - table->Add (_creator, 1, wxEXPAND); - - Config* config = Config::instance (); - - _issuer->SetValue (std_to_wx (config->dcp_metadata().issuer)); - _issuer->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::issuer_changed, this)); - _creator->SetValue (std_to_wx (config->dcp_metadata().creator)); - _creator->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::creator_changed, this)); -} - -static string -server_column (string s) -{ - return s; -} - -void -ConfigDialog::make_servers_panel () -{ - _servers_panel = new wxPanel (_notebook); - wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); - _servers_panel->SetSizer (s); - - _use_any_servers = new wxCheckBox (_servers_panel, wxID_ANY, _("Use all servers")); - s->Add (_use_any_servers, 0, wxALL, DCPOMATIC_SIZER_X_GAP); + void default_container_changed () + { + vector ratio = Ratio::all (); + Config::instance()->set_default_container (ratio[_default_container->GetSelection()]); + } - vector columns; - columns.push_back (wx_to_std (_("IP address / host name"))); - _servers_list = new EditableList ( - _servers_panel, - columns, - boost::bind (&Config::servers, Config::instance()), - boost::bind (&Config::set_servers, Config::instance(), _1), - boost::bind (&server_column, _1) - ); - - s->Add (_servers_list, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP); - - _use_any_servers->SetValue (Config::instance()->use_any_servers ()); - _use_any_servers->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&ConfigDialog::use_any_servers_changed, this)); -} - -void -ConfigDialog::use_any_servers_changed () -{ - Config::instance()->set_use_any_servers (_use_any_servers->GetValue ()); -} - -void -ConfigDialog::language_changed () -{ - switch (_language->GetSelection ()) { - case 0: - Config::instance()->set_language ("en"); - break; - case 1: - Config::instance()->set_language ("fr"); - break; - case 2: - Config::instance()->set_language ("it"); - break; - case 3: - Config::instance()->set_language ("es"); - break; - case 4: - Config::instance()->set_language ("sv"); - break; - case 5: - Config::instance()->set_language ("de"); - break; + void default_dcp_content_type_changed () + { + vector ct = DCPContentType::all (); + Config::instance()->set_default_dcp_content_type (ct[_default_dcp_content_type->GetSelection()]); } -} - -void -ConfigDialog::tms_ip_changed () -{ - Config::instance()->set_tms_ip (wx_to_std (_tms_ip->GetValue ())); -} - -void -ConfigDialog::tms_path_changed () -{ - Config::instance()->set_tms_path (wx_to_std (_tms_path->GetValue ())); -} - -void -ConfigDialog::tms_user_changed () -{ - Config::instance()->set_tms_user (wx_to_std (_tms_user->GetValue ())); -} + + wxSpinCtrl* _default_j2k_bandwidth; + wxSpinCtrl* _default_audio_delay; + wxButton* _default_dci_metadata_button; + wxSpinCtrl* _default_still_length; +#ifdef DCPOMATIC_USE_OWN_DIR_PICKER + DirPickerCtrl* _default_directory; +#else + wxDirPickerCtrl* _default_directory; +#endif + wxChoice* _default_container; + wxChoice* _default_dcp_content_type; +}; -void -ConfigDialog::tms_password_changed () +class EncodingServersPage : public wxPreferencesPage { - Config::instance()->set_tms_password (wx_to_std (_tms_password->GetValue ())); -} +public: + wxString GetName () const + { + return _("Encoding Servers"); + } -void -ConfigDialog::num_local_encoding_threads_changed () -{ - Config::instance()->set_num_local_encoding_threads (_num_local_encoding_threads->GetValue ()); -} +#ifdef DCPOMATIC_OSX + wxBitmap GetLargeIcon () const + { + return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); + } +#endif -void -ConfigDialog::default_directory_changed () -{ - Config::instance()->set_default_directory (wx_to_std (_default_directory->GetPath ())); -} + wxWindow* CreateWindow (wxWindow* parent) + { + wxPanel* panel = new wxPanel (parent); + wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); + panel->SetSizer (s); + + _use_any_servers = new wxCheckBox (panel, wxID_ANY, _("Use all servers")); + s->Add (_use_any_servers, 0, wxALL, DCPOMATIC_SIZER_X_GAP); + + vector columns; + columns.push_back (wx_to_std (_("IP address / host name"))); + _servers_list = new EditableList ( + panel, + columns, + boost::bind (&Config::servers, Config::instance()), + boost::bind (&Config::set_servers, Config::instance(), _1), + boost::bind (&EncodingServersPage::server_column, this, _1) + ); + + s->Add (_servers_list, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP); + + _use_any_servers->SetValue (Config::instance()->use_any_servers ()); + _use_any_servers->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&EncodingServersPage::use_any_servers_changed, this)); + + return panel; + } -void -ConfigDialog::edit_default_dci_metadata_clicked () -{ - DCIMetadataDialog* d = new DCIMetadataDialog (this, Config::instance()->default_dci_metadata ()); - d->ShowModal (); - Config::instance()->set_default_dci_metadata (d->dci_metadata ()); - d->Destroy (); -} +private: -void -ConfigDialog::set_language_changed () -{ - setup_language_sensitivity (); - if (_set_language->GetValue ()) { - language_changed (); - } else { - Config::instance()->unset_language (); + void use_any_servers_changed () + { + Config::instance()->set_use_any_servers (_use_any_servers->GetValue ()); } -} - -void -ConfigDialog::setup_language_sensitivity () -{ - _language->Enable (_set_language->GetValue ()); -} -void -ConfigDialog::default_still_length_changed () -{ - Config::instance()->set_default_still_length (_default_still_length->GetValue ()); -} + string server_column (string s) + { + return s; + } -void -ConfigDialog::default_container_changed () -{ - vector ratio = Ratio::all (); - Config::instance()->set_default_container (ratio[_default_container->GetSelection()]); -} + wxCheckBox* _use_any_servers; + EditableList* _servers_list; +}; -void -ConfigDialog::default_dcp_content_type_changed () +class ColourConversionsPage : public wxPreferencesPage { - vector ct = DCPContentType::all (); - Config::instance()->set_default_dcp_content_type (ct[_default_dcp_content_type->GetSelection()]); -} + wxString GetName () const + { + return _("Colour Conversions"); + } -void -ConfigDialog::issuer_changed () -{ - libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); - m.issuer = wx_to_std (_issuer->GetValue ()); - Config::instance()->set_dcp_metadata (m); -} +#ifdef DCPOMATIC_OSX + wxBitmap GetLargeIcon () const + { + return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); + } +#endif + wxWindow* CreateWindow (wxWindow* parent) + { + vector columns; + columns.push_back (wx_to_std (_("Name"))); + return new EditableList ( + parent, + columns, + boost::bind (&Config::colour_conversions, Config::instance()), + boost::bind (&Config::set_colour_conversions, Config::instance(), _1), + boost::bind (&ColourConversionsPage::colour_conversion_column, this, _1), + 300 + ); + } -void -ConfigDialog::creator_changed () -{ - libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); - m.creator = wx_to_std (_creator->GetValue ()); - Config::instance()->set_dcp_metadata (m); -} +private: + string colour_conversion_column (PresetColourConversion c) + { + return c.name; + } +}; -void -ConfigDialog::default_j2k_bandwidth_changed () +class MetadataPage : public wxPreferencesPage { - Config::instance()->set_default_j2k_bandwidth (_default_j2k_bandwidth->GetValue() * 1000000); -} + wxString GetName () const + { + return _("Metadata"); + } -void -ConfigDialog::default_audio_delay_changed () -{ - Config::instance()->set_default_audio_delay (_default_audio_delay->GetValue()); -} +#ifdef DCPOMATIC_OSX + wxBitmap GetLargeIcon () const + { + return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); + } +#endif -static std::string -colour_conversion_column (PresetColourConversion c) -{ - return c.name; -} + wxWindow* CreateWindow (wxWindow* parent) + { + wxPanel* panel = new wxPanel (parent); + wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); + panel->SetSizer (s); + + wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + table->AddGrowableCol (1, 1); + s->Add (table, 1, wxALL | wxEXPAND, 8); + + add_label_to_sizer (table, panel, _("Issuer"), true); + _issuer = new wxTextCtrl (panel, wxID_ANY); + table->Add (_issuer, 1, wxEXPAND); + + add_label_to_sizer (table, panel, _("Creator"), true); + _creator = new wxTextCtrl (panel, wxID_ANY); + table->Add (_creator, 1, wxEXPAND); + + Config* config = Config::instance (); + + _issuer->SetValue (std_to_wx (config->dcp_metadata().issuer)); + _issuer->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&MetadataPage::issuer_changed, this)); + _creator->SetValue (std_to_wx (config->dcp_metadata().creator)); + _creator->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&MetadataPage::creator_changed, this)); + + return panel; + } + +private: + wxTextCtrl* _issuer; + wxTextCtrl* _creator; + + void issuer_changed () + { + libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); + m.issuer = wx_to_std (_issuer->GetValue ()); + Config::instance()->set_dcp_metadata (m); + } + + void creator_changed () + { + libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); + m.creator = wx_to_std (_creator->GetValue ()); + Config::instance()->set_dcp_metadata (m); + } +}; -void -ConfigDialog::make_colour_conversions_panel () +class TMSPage : public wxPreferencesPage { - vector columns; - columns.push_back (wx_to_std (_("Name"))); - _colour_conversions_panel = new EditableList ( - _notebook, - columns, - boost::bind (&Config::colour_conversions, Config::instance()), - boost::bind (&Config::set_colour_conversions, Config::instance(), _1), - boost::bind (&colour_conversion_column, _1), - 300 - ); -} + wxString GetName () const + { + return _("TMS"); + } -void -ConfigDialog::mail_server_changed () -{ - Config::instance()->set_mail_server (wx_to_std (_mail_server->GetValue ())); -} +#ifdef DCPOMATIC_OSX + wxBitmap GetLargeIcon () const + { + return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); + } +#endif -void -ConfigDialog::mail_user_changed () -{ - Config::instance()->set_mail_user (wx_to_std (_mail_user->GetValue ())); -} + wxWindow* CreateWindow (wxWindow* parent) + { + wxPanel* panel = new wxPanel (parent); + wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); + panel->SetSizer (s); + + wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); + table->AddGrowableCol (1, 1); + s->Add (table, 1, wxALL | wxEXPAND, 8); + + add_label_to_sizer (table, panel, _("IP address"), true); + _tms_ip = new wxTextCtrl (panel, wxID_ANY); + table->Add (_tms_ip, 1, wxEXPAND); + + add_label_to_sizer (table, panel, _("Target path"), true); + _tms_path = new wxTextCtrl (panel, wxID_ANY); + table->Add (_tms_path, 1, wxEXPAND); + + add_label_to_sizer (table, panel, _("User name"), true); + _tms_user = new wxTextCtrl (panel, wxID_ANY); + table->Add (_tms_user, 1, wxEXPAND); + + add_label_to_sizer (table, panel, _("Password"), true); + _tms_password = new wxTextCtrl (panel, wxID_ANY); + table->Add (_tms_password, 1, wxEXPAND); + + Config* config = Config::instance (); + + _tms_ip->SetValue (std_to_wx (config->tms_ip ())); + _tms_ip->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TMSPage::tms_ip_changed, this)); + _tms_path->SetValue (std_to_wx (config->tms_path ())); + _tms_path->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TMSPage::tms_path_changed, this)); + _tms_user->SetValue (std_to_wx (config->tms_user ())); + _tms_user->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TMSPage::tms_user_changed, this)); + _tms_password->SetValue (std_to_wx (config->tms_password ())); + _tms_password->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&TMSPage::tms_password_changed, this)); + + return panel; + } -void -ConfigDialog::mail_password_changed () -{ - Config::instance()->set_mail_password (wx_to_std (_mail_password->GetValue ())); -} +private: + void tms_ip_changed () + { + Config::instance()->set_tms_ip (wx_to_std (_tms_ip->GetValue ())); + } + + void tms_path_changed () + { + Config::instance()->set_tms_path (wx_to_std (_tms_path->GetValue ())); + } + + void tms_user_changed () + { + Config::instance()->set_tms_user (wx_to_std (_tms_user->GetValue ())); + } + + void tms_password_changed () + { + Config::instance()->set_tms_password (wx_to_std (_tms_password->GetValue ())); + } -void -ConfigDialog::kdm_from_changed () -{ - Config::instance()->set_kdm_from (wx_to_std (_kdm_from->GetValue ())); -} + wxTextCtrl* _tms_ip; + wxTextCtrl* _tms_path; + wxTextCtrl* _tms_user; + wxTextCtrl* _tms_password; +}; -void -ConfigDialog::make_kdm_email_panel () +class KDMEmailPage : public wxPreferencesPage { - _kdm_email_panel = new wxPanel (_notebook); - wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); - _kdm_email_panel->SetSizer (s); - - _kdm_email = new wxTextCtrl (_kdm_email_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); - s->Add (_kdm_email, 1, wxEXPAND | wxALL, 12); +public: + wxString GetName () const + { + return _("KDM Email"); + } - _kdm_email->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&ConfigDialog::kdm_email_changed, this)); - _kdm_email->SetValue (wx_to_std (Config::instance()->kdm_email ())); -} +#ifdef DCPOMATIC_OSX + wxBitmap GetLargeIcon () const + { + return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); + } +#endif -void -ConfigDialog::kdm_email_changed () -{ - Config::instance()->set_kdm_email (wx_to_std (_kdm_email->GetValue ())); -} + wxWindow* CreateWindow (wxWindow* parent) + { + wxPanel* panel = new wxPanel (parent); + wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); + panel->SetSizer (s); + + _kdm_email = new wxTextCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); + s->Add (_kdm_email, 1, wxEXPAND | wxALL, 12); + + _kdm_email->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_email_changed, this)); + _kdm_email->SetValue (wx_to_std (Config::instance()->kdm_email ())); + + return panel; + } -void -ConfigDialog::check_for_updates_changed () -{ - Config::instance()->set_check_for_updates (_check_for_updates->GetValue ()); -} +private: + void kdm_email_changed () + { + Config::instance()->set_kdm_email (wx_to_std (_kdm_email->GetValue ())); + } -void -ConfigDialog::check_for_test_updates_changed () -{ - Config::instance()->set_check_for_test_updates (_check_for_test_updates->GetValue ()); + wxTextCtrl* _kdm_email; +}; + +wxPreferencesEditor* +create_config_dialog () +{ + wxPreferencesEditor* e = new wxPreferencesEditor (); + e->AddPage (new GeneralPage); + e->AddPage (new DefaultsPage); + e->AddPage (new EncodingServersPage); + e->AddPage (new ColourConversionsPage); + e->AddPage (new MetadataPage); + e->AddPage (new TMSPage); + e->AddPage (new KDMEmailPage); + return e; } diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h index 8a17de58d..183a23440 100644 --- a/src/wx/config_dialog.h +++ b/src/wx/config_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012 Carl Hetherington + Copyright (C) 2012-2014 Carl Hetherington 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 @@ -18,103 +18,9 @@ */ /** @file src/config_dialog.h - * @brief A dialogue to edit DCP-o-matic configuration. + * @brief A dialog to edit DCP-o-matic configuration. */ -#include -#include -#include -#include -#include "wx_util.h" -#include "editable_list.h" - -class DirPickerCtrl; -class wxNotebook; -class PresetColourConversion; -class PresetColourConversionDialog; -class ServerDialog; - -/** @class ConfigDialog - * @brief A dialogue to edit DCP-o-matic configuration. - */ -class ConfigDialog : public wxDialog -{ -public: - ConfigDialog (wxWindow *); - -private: - void set_language_changed (); - void language_changed (); - void tms_ip_changed (); - void tms_path_changed (); - void tms_user_changed (); - void tms_password_changed (); - void num_local_encoding_threads_changed (); - void default_still_length_changed (); - void default_directory_changed (); - void edit_default_dci_metadata_clicked (); - void default_container_changed (); - void default_dcp_content_type_changed (); - void issuer_changed (); - void creator_changed (); - void default_j2k_bandwidth_changed (); - void default_audio_delay_changed (); - void mail_server_changed (); - void mail_user_changed (); - void mail_password_changed (); - void kdm_from_changed (); - void kdm_email_changed (); - void use_any_servers_changed (); - - void setup_language_sensitivity (); - - void make_misc_panel (); - void make_defaults_panel (); - void make_servers_panel (); - void make_tms_panel (); - void make_metadata_panel (); - void make_colour_conversions_panel (); - void make_kdm_email_panel (); - - void check_for_updates_changed (); - void check_for_test_updates_changed (); - - wxNotebook* _notebook; - wxPanel* _misc_panel; - wxPanel* _defaults_panel; - wxPanel* _servers_panel; - wxPanel* _tms_panel; - EditableList* _colour_conversions_panel; - wxPanel* _metadata_panel; - wxCheckBox* _set_language; - wxChoice* _language; - wxChoice* _default_container; - wxChoice* _default_dcp_content_type; - wxTextCtrl* _tms_ip; - wxTextCtrl* _tms_path; - wxTextCtrl* _tms_user; - wxTextCtrl* _tms_password; - wxSpinCtrl* _num_local_encoding_threads; - wxTextCtrl* _mail_server; - wxTextCtrl* _mail_user; - wxTextCtrl* _mail_password; - wxTextCtrl* _kdm_from; - wxSpinCtrl* _default_still_length; -#ifdef DCPOMATIC_USE_OWN_DIR_PICKER - DirPickerCtrl* _default_directory; -#else - wxDirPickerCtrl* _default_directory; -#endif - wxButton* _default_dci_metadata_button; - wxTextCtrl* _issuer; - wxTextCtrl* _creator; - wxSpinCtrl* _default_j2k_bandwidth; - wxSpinCtrl* _default_audio_delay; - wxPanel* _kdm_email_panel; - wxTextCtrl* _kdm_email; - wxCheckBox* _use_any_servers; - wxCheckBox* _check_for_updates; - wxCheckBox* _check_for_test_updates; - EditableList* _servers_list; -}; +class wxPreferencesEditor; +wxPreferencesEditor* create_config_dialog (); diff --git a/src/wx/editable_list.h b/src/wx/editable_list.h index 20d180f20..470be2d09 100644 --- a/src/wx/editable_list.h +++ b/src/wx/editable_list.h @@ -18,6 +18,7 @@ */ #include +#include template class EditableList : public wxPanel -- cgit v1.2.3 From 122eccd147203d2ee7d622ba57db895fe219050c Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 16 Mar 2014 22:29:15 +0000 Subject: Use defaults icon. --- src/wx/config_dialog.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index a6910d64f..d9a9f8978 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -259,7 +259,7 @@ public: #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap ("defaults", wxBITMAP_TYPE_PNG_RESOURCE); } #endif -- cgit v1.2.3 From a32c192781a6de6c534cff2a52f746dde897d435 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 16 Mar 2014 23:05:31 +0000 Subject: Add servers icon from David Vignoni (http://www.icon-king.com) --- icons/servers.png | Bin 0 -> 1948 bytes run/dcpomatic | 5 ++++- src/wx/about_dialog.cc | 4 ++++ src/wx/config_dialog.cc | 4 ++-- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 icons/servers.png (limited to 'src') diff --git a/icons/servers.png b/icons/servers.png new file mode 100644 index 000000000..b3781e45c Binary files /dev/null and b/icons/servers.png differ diff --git a/run/dcpomatic b/run/dcpomatic index 65cca4205..66d79d5c9 100755 --- a/run/dcpomatic +++ b/run/dcpomatic @@ -10,7 +10,8 @@ if [ `uname -s` == "Darwin" ]; then app=build/platform/osx/DCP-o-matic.app macos=$app/Contents/MacOS lib=$app/Contents/lib - mkdir -p $macos $lib + resources=$app/Contents/Resources + mkdir -p $macos $lib $resources cp build/src/tools/dcpomatic $macos cp build/src/lib/libdcpomatic.dylib $lib @@ -56,6 +57,8 @@ if [ `uname -s` == "Darwin" ]; then cp $ENV/libquickmail*.dylib $lib cp $ENV/libcurl*.dylib $lib cp $ENV/libffi*.dylib $lib + cp icons/defaults.png $resources + cp icons/servers.png $resources sed -e "s/@VERSION@/test/g" platform/osx/Info.plist.in > $app/Contents/Info.plist diff --git a/src/wx/about_dialog.cc b/src/wx/about_dialog.cc index be01548a4..01332dfcc 100644 --- a/src/wx/about_dialog.cc +++ b/src/wx/about_dialog.cc @@ -101,6 +101,10 @@ AboutDialog::AboutDialog (wxWindow* parent) translated_by.Add (wxT ("Markus Raab")); add_section (_("Translated by"), translated_by); + wxArrayString artwork_by; + artwork_by.Add (wxT ("David Vignoni")); + add_section (_("Artwork by"), artwork_by); + wxArrayString supported_by; supported_by.Add (wxT ("Manual AC")); supported_by.Add (wxT ("Kambiz Afshar")); diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index d9a9f8978..7fe81de4e 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -425,13 +425,13 @@ class EncodingServersPage : public wxPreferencesPage public: wxString GetName () const { - return _("Encoding Servers"); + return _("Servers"); } #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap ("servers", wxBITMAP_TYPE_PNG_RESOURCE); } #endif -- cgit v1.2.3 From bef548a19c2f884e594fa409a88761f8f4be4518 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 16 Mar 2014 23:11:34 +0000 Subject: Various work on improved config dialog. --- icons/colour_conversions.png | Bin 0 -> 275 bytes icons/colour_conversions.svg | 86 ++++++++++++ icons/defaults.png | Bin 638 -> 581 bytes icons/defaults.svg | 12 +- icons/kdm_email.png | Bin 0 -> 1544 bytes icons/kdm_email.svg | 197 +++++++++++++++++++++++++++ icons/tms.png | Bin 0 -> 1576 bytes icons/tms.svg | 192 ++++++++++++++++++++++++++ run/dcpomatic | 3 + src/wx/config_dialog.cc | 313 +++++++++++++++++++++++-------------------- 10 files changed, 660 insertions(+), 143 deletions(-) create mode 100644 icons/colour_conversions.png create mode 100644 icons/colour_conversions.svg create mode 100644 icons/kdm_email.png create mode 100644 icons/kdm_email.svg create mode 100644 icons/tms.png create mode 100644 icons/tms.svg (limited to 'src') diff --git a/icons/colour_conversions.png b/icons/colour_conversions.png new file mode 100644 index 000000000..5cd2b32bf Binary files /dev/null and b/icons/colour_conversions.png differ diff --git a/icons/colour_conversions.svg b/icons/colour_conversions.svg new file mode 100644 index 000000000..59b35c14f --- /dev/null +++ b/icons/colour_conversions.svg @@ -0,0 +1,86 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/icons/defaults.png b/icons/defaults.png index edca493a0..9fd41a935 100644 Binary files a/icons/defaults.png and b/icons/defaults.png differ diff --git a/icons/defaults.svg b/icons/defaults.svg index 029681578..ab254950d 100644 --- a/icons/defaults.svg +++ b/icons/defaults.svg @@ -14,7 +14,10 @@ id="svg2" version="1.1" inkscape:version="0.48.4 r9939" - sodipodi:docname="New document 1"> + sodipodi:docname="defaults.svg" + inkscape:export-filename="/home/carl/src/dcpomatic/icons/defaults.png" + inkscape:export-xdpi="9.7627115" + inkscape:export-ydpi="9.7627115"> + diff --git a/icons/kdm_email.png b/icons/kdm_email.png new file mode 100644 index 000000000..28701ee49 Binary files /dev/null and b/icons/kdm_email.png differ diff --git a/icons/kdm_email.svg b/icons/kdm_email.svg new file mode 100644 index 000000000..ace413dae --- /dev/null +++ b/icons/kdm_email.svg @@ -0,0 +1,197 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Key + 2007-02-27T15:15:43 + A key icon. + http://openclipart.org/detail/3330/key-by-barretr + + + barretr + + + + + clip art + clipart + icon + image + key + media + png + public domain + svg + + + + + + + + + + + + diff --git a/icons/tms.png b/icons/tms.png new file mode 100644 index 000000000..60e3cc2ff Binary files /dev/null and b/icons/tms.png differ diff --git a/icons/tms.svg b/icons/tms.svg new file mode 100644 index 000000000..c1815b9b3 --- /dev/null +++ b/icons/tms.svg @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/run/dcpomatic b/run/dcpomatic index 66d79d5c9..544ffc040 100755 --- a/run/dcpomatic +++ b/run/dcpomatic @@ -59,6 +59,9 @@ if [ `uname -s` == "Darwin" ]; then cp $ENV/libffi*.dylib $lib cp icons/defaults.png $resources cp icons/servers.png $resources + cp icons/tms.png $resources + cp icons/colour_conversions.png $resources + cp icons/kdm_email.png $resources sed -e "s/@VERSION@/test/g" platform/osx/Info.plist.in > $app/Contents/Info.plist diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc index 7fe81de4e..8938c84f9 100644 --- a/src/wx/config_dialog.cc +++ b/src/wx/config_dialog.cc @@ -52,11 +52,25 @@ using boost::bind; using boost::shared_ptr; using boost::lexical_cast; -class GeneralPage : public wxStockPreferencesPage +class Page { public: - GeneralPage () + Page (wxSize panel_size, int border) + : _panel_size (panel_size) + , _border (border) + {} + +protected: + wxSize _panel_size; + int _border; +}; + +class GeneralPage : public wxStockPreferencesPage, public Page +{ +public: + GeneralPage (wxSize panel_size, int border) : wxStockPreferencesPage (Kind_General) + , Page (panel_size, border) {} wxWindow* CreateWindow (wxWindow* parent) @@ -67,7 +81,7 @@ public: wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); - s->Add (table, 1, wxALL | wxEXPAND, 8); + s->Add (table, 1, wxALL | wxEXPAND, _border); _set_language = new wxCheckBox (panel, wxID_ANY, _("Set language")); table->Add (_set_language, 1); @@ -248,9 +262,13 @@ private: wxCheckBox* _check_for_test_updates; }; -class DefaultsPage : public wxPreferencesPage +class DefaultsPage : public wxPreferencesPage, public Page { public: + DefaultsPage (wxSize panel_size, int border) + : Page (panel_size, border) + {} + wxString GetName () const { return _("Defaults"); @@ -271,42 +289,42 @@ public: wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); - s->Add (table, 1, wxALL | wxEXPAND, 8); + s->Add (table, 1, wxALL | wxEXPAND, _border); { add_label_to_sizer (table, panel, _("Default duration of still images"), true); wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - _default_still_length = new wxSpinCtrl (panel); - s->Add (_default_still_length); + _still_length = new wxSpinCtrl (panel); + s->Add (_still_length); add_label_to_sizer (s, panel, _("s"), false); table->Add (s, 1); } add_label_to_sizer (table, panel, _("Default directory for new films"), true); #ifdef DCPOMATIC_USE_OWN_DIR_PICKER - _default_directory = new DirPickerCtrl (panel); + _directory = new DirPickerCtrl (panel); #else - _default_directory = new wxDirPickerCtrl (panel, wxDD_DIR_MUST_EXIST); + _directory = new wxDirPickerCtrl (panel, wxDD_DIR_MUST_EXIST); #endif - table->Add (_default_directory, 1, wxEXPAND); + table->Add (_directory, 1, wxEXPAND); add_label_to_sizer (table, panel, _("Default DCI name details"), true); - _default_dci_metadata_button = new wxButton (panel, wxID_ANY, _("Edit...")); - table->Add (_default_dci_metadata_button); + _dci_metadata_button = new wxButton (panel, wxID_ANY, _("Edit...")); + table->Add (_dci_metadata_button); add_label_to_sizer (table, panel, _("Default container"), true); - _default_container = new wxChoice (panel, wxID_ANY); - table->Add (_default_container); + _container = new wxChoice (panel, wxID_ANY); + table->Add (_container); add_label_to_sizer (table, panel, _("Default content type"), true); - _default_dcp_content_type = new wxChoice (panel, wxID_ANY); - table->Add (_default_dcp_content_type); + _dcp_content_type = new wxChoice (panel, wxID_ANY); + table->Add (_dcp_content_type); { add_label_to_sizer (table, panel, _("Default JPEG2000 bandwidth"), true); wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - _default_j2k_bandwidth = new wxSpinCtrl (panel); - s->Add (_default_j2k_bandwidth); + _j2k_bandwidth = new wxSpinCtrl (panel); + s->Add (_j2k_bandwidth); add_label_to_sizer (s, panel, _("Mbit/s"), false); table->Add (s, 1); } @@ -314,75 +332,88 @@ public: { add_label_to_sizer (table, panel, _("Default audio delay"), true); wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL); - _default_audio_delay = new wxSpinCtrl (panel); - s->Add (_default_audio_delay); + _audio_delay = new wxSpinCtrl (panel); + s->Add (_audio_delay); add_label_to_sizer (s, panel, _("ms"), false); table->Add (s, 1); } + + add_label_to_sizer (table, panel, _("Default issuer"), true); + _issuer = new wxTextCtrl (panel, wxID_ANY); + table->Add (_issuer, 1, wxEXPAND); + + add_label_to_sizer (table, panel, _("Default creator"), true); + _creator = new wxTextCtrl (panel, wxID_ANY); + table->Add (_creator, 1, wxEXPAND); Config* config = Config::instance (); - _default_still_length->SetRange (1, 3600); - _default_still_length->SetValue (config->default_still_length ()); - _default_still_length->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::default_still_length_changed, this)); + _still_length->SetRange (1, 3600); + _still_length->SetValue (config->default_still_length ()); + _still_length->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::still_length_changed, this)); - _default_directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ())); - _default_directory->Bind (wxEVT_COMMAND_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::default_directory_changed, this)); + _directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ())); + _directory->Bind (wxEVT_COMMAND_DIRPICKER_CHANGED, boost::bind (&DefaultsPage::directory_changed, this)); - _default_dci_metadata_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DefaultsPage::edit_default_dci_metadata_clicked, this, parent)); + _dci_metadata_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DefaultsPage::edit_dci_metadata_clicked, this, parent)); vector ratio = Ratio::all (); int n = 0; for (vector::iterator i = ratio.begin(); i != ratio.end(); ++i) { - _default_container->Append (std_to_wx ((*i)->nickname ())); + _container->Append (std_to_wx ((*i)->nickname ())); if (*i == config->default_container ()) { - _default_container->SetSelection (n); + _container->SetSelection (n); } ++n; } - _default_container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::default_container_changed, this)); + _container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::container_changed, this)); vector const ct = DCPContentType::all (); n = 0; for (vector::const_iterator i = ct.begin(); i != ct.end(); ++i) { - _default_dcp_content_type->Append (std_to_wx ((*i)->pretty_name ())); + _dcp_content_type->Append (std_to_wx ((*i)->pretty_name ())); if (*i == config->default_dcp_content_type ()) { - _default_dcp_content_type->SetSelection (n); + _dcp_content_type->SetSelection (n); } ++n; } - _default_dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::default_dcp_content_type_changed, this)); + _dcp_content_type->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::dcp_content_type_changed, this)); - _default_j2k_bandwidth->SetRange (50, 250); - _default_j2k_bandwidth->SetValue (config->default_j2k_bandwidth() / 1000000); - _default_j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::default_j2k_bandwidth_changed, this)); + _j2k_bandwidth->SetRange (50, 250); + _j2k_bandwidth->SetValue (config->default_j2k_bandwidth() / 1000000); + _j2k_bandwidth->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::j2k_bandwidth_changed, this)); - _default_audio_delay->SetRange (-1000, 1000); - _default_audio_delay->SetValue (config->default_audio_delay ()); - _default_audio_delay->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::default_audio_delay_changed, this)); + _audio_delay->SetRange (-1000, 1000); + _audio_delay->SetValue (config->default_audio_delay ()); + _audio_delay->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&DefaultsPage::audio_delay_changed, this)); + + _issuer->SetValue (std_to_wx (config->dcp_metadata().issuer)); + _issuer->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DefaultsPage::issuer_changed, this)); + _creator->SetValue (std_to_wx (config->dcp_metadata().creator)); + _creator->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&DefaultsPage::creator_changed, this)); return panel; } private: - void default_j2k_bandwidth_changed () + void j2k_bandwidth_changed () { - Config::instance()->set_default_j2k_bandwidth (_default_j2k_bandwidth->GetValue() * 1000000); + Config::instance()->set_default_j2k_bandwidth (_j2k_bandwidth->GetValue() * 1000000); } - void default_audio_delay_changed () + void audio_delay_changed () { - Config::instance()->set_default_audio_delay (_default_audio_delay->GetValue()); + Config::instance()->set_default_audio_delay (_audio_delay->GetValue()); } - void default_directory_changed () + void directory_changed () { - Config::instance()->set_default_directory (wx_to_std (_default_directory->GetPath ())); + Config::instance()->set_default_directory (wx_to_std (_directory->GetPath ())); } - void edit_default_dci_metadata_clicked (wxWindow* parent) + void edit_dci_metadata_clicked (wxWindow* parent) { DCIMetadataDialog* d = new DCIMetadataDialog (parent, Config::instance()->default_dci_metadata ()); d->ShowModal (); @@ -390,39 +421,59 @@ private: d->Destroy (); } - void default_still_length_changed () + void still_length_changed () { - Config::instance()->set_default_still_length (_default_still_length->GetValue ()); + Config::instance()->set_default_still_length (_still_length->GetValue ()); } - void default_container_changed () + void container_changed () { vector ratio = Ratio::all (); - Config::instance()->set_default_container (ratio[_default_container->GetSelection()]); + Config::instance()->set_default_container (ratio[_container->GetSelection()]); } - void default_dcp_content_type_changed () + void dcp_content_type_changed () { vector ct = DCPContentType::all (); - Config::instance()->set_default_dcp_content_type (ct[_default_dcp_content_type->GetSelection()]); + Config::instance()->set_default_dcp_content_type (ct[_dcp_content_type->GetSelection()]); + } + + void issuer_changed () + { + libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); + m.issuer = wx_to_std (_issuer->GetValue ()); + Config::instance()->set_dcp_metadata (m); } - wxSpinCtrl* _default_j2k_bandwidth; - wxSpinCtrl* _default_audio_delay; - wxButton* _default_dci_metadata_button; - wxSpinCtrl* _default_still_length; + void creator_changed () + { + libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); + m.creator = wx_to_std (_creator->GetValue ()); + Config::instance()->set_dcp_metadata (m); + } + + wxSpinCtrl* _j2k_bandwidth; + wxSpinCtrl* _audio_delay; + wxButton* _dci_metadata_button; + wxSpinCtrl* _still_length; #ifdef DCPOMATIC_USE_OWN_DIR_PICKER - DirPickerCtrl* _default_directory; + DirPickerCtrl* _directory; #else - wxDirPickerCtrl* _default_directory; + wxDirPickerCtrl* _directory; #endif - wxChoice* _default_container; - wxChoice* _default_dcp_content_type; + wxChoice* _container; + wxChoice* _dcp_content_type; + wxTextCtrl* _issuer; + wxTextCtrl* _creator; }; -class EncodingServersPage : public wxPreferencesPage +class EncodingServersPage : public wxPreferencesPage, public Page { public: + EncodingServersPage (wxSize panel_size, int border) + : Page (panel_size, border) + {} + wxString GetName () const { return _("Servers"); @@ -437,12 +488,12 @@ public: wxWindow* CreateWindow (wxWindow* parent) { - wxPanel* panel = new wxPanel (parent); + wxPanel* panel = new wxPanel (parent, wxID_ANY, wxDefaultPosition, _panel_size); wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); panel->SetSizer (s); _use_any_servers = new wxCheckBox (panel, wxID_ANY, _("Use all servers")); - s->Add (_use_any_servers, 0, wxALL, DCPOMATIC_SIZER_X_GAP); + s->Add (_use_any_servers, 0, wxALL, _border); vector columns; columns.push_back (wx_to_std (_("IP address / host name"))); @@ -454,7 +505,7 @@ public: boost::bind (&EncodingServersPage::server_column, this, _1) ); - s->Add (_servers_list, 1, wxEXPAND | wxALL, DCPOMATIC_SIZER_X_GAP); + s->Add (_servers_list, 1, wxEXPAND | wxALL, _border); _use_any_servers->SetValue (Config::instance()->use_any_servers ()); _use_any_servers->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&EncodingServersPage::use_any_servers_changed, this)); @@ -478,8 +529,13 @@ private: EditableList* _servers_list; }; -class ColourConversionsPage : public wxPreferencesPage +class ColourConversionsPage : public wxPreferencesPage, public Page { +public: + ColourConversionsPage (wxSize panel_size, int border) + : Page (panel_size, border) + {} + wxString GetName () const { return _("Colour Conversions"); @@ -488,21 +544,28 @@ class ColourConversionsPage : public wxPreferencesPage #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap ("colour_conversions", wxBITMAP_TYPE_PNG_RESOURCE); } #endif wxWindow* CreateWindow (wxWindow* parent) { + wxPanel* panel = new wxPanel (parent, wxID_ANY, wxDefaultPosition, _panel_size); + wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); + panel->SetSizer (s); + vector columns; columns.push_back (wx_to_std (_("Name"))); - return new EditableList ( - parent, + wxPanel* list = new EditableList ( + panel, columns, boost::bind (&Config::colour_conversions, Config::instance()), boost::bind (&Config::set_colour_conversions, Config::instance(), _1), boost::bind (&ColourConversionsPage::colour_conversion_column, this, _1), 300 ); + + s->Add (list, 1, wxEXPAND | wxALL, _border); + return panel; } private: @@ -512,69 +575,13 @@ private: } }; -class MetadataPage : public wxPreferencesPage +class TMSPage : public wxPreferencesPage, public Page { - wxString GetName () const - { - return _("Metadata"); - } - -#ifdef DCPOMATIC_OSX - wxBitmap GetLargeIcon () const - { - return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); - } -#endif - - wxWindow* CreateWindow (wxWindow* parent) - { - wxPanel* panel = new wxPanel (parent); - wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); - panel->SetSizer (s); - - wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); - table->AddGrowableCol (1, 1); - s->Add (table, 1, wxALL | wxEXPAND, 8); - - add_label_to_sizer (table, panel, _("Issuer"), true); - _issuer = new wxTextCtrl (panel, wxID_ANY); - table->Add (_issuer, 1, wxEXPAND); - - add_label_to_sizer (table, panel, _("Creator"), true); - _creator = new wxTextCtrl (panel, wxID_ANY); - table->Add (_creator, 1, wxEXPAND); - - Config* config = Config::instance (); - - _issuer->SetValue (std_to_wx (config->dcp_metadata().issuer)); - _issuer->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&MetadataPage::issuer_changed, this)); - _creator->SetValue (std_to_wx (config->dcp_metadata().creator)); - _creator->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&MetadataPage::creator_changed, this)); - - return panel; - } - -private: - wxTextCtrl* _issuer; - wxTextCtrl* _creator; - - void issuer_changed () - { - libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); - m.issuer = wx_to_std (_issuer->GetValue ()); - Config::instance()->set_dcp_metadata (m); - } - - void creator_changed () - { - libdcp::XMLMetadata m = Config::instance()->dcp_metadata (); - m.creator = wx_to_std (_creator->GetValue ()); - Config::instance()->set_dcp_metadata (m); - } -}; +public: + TMSPage (wxSize panel_size, int border) + : Page (panel_size, border) + {} -class TMSPage : public wxPreferencesPage -{ wxString GetName () const { return _("TMS"); @@ -583,19 +590,19 @@ class TMSPage : public wxPreferencesPage #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap ("tms", wxBITMAP_TYPE_PNG_RESOURCE); } #endif wxWindow* CreateWindow (wxWindow* parent) { - wxPanel* panel = new wxPanel (parent); + wxPanel* panel = new wxPanel (parent, wxID_ANY, wxDefaultPosition, _panel_size); wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); panel->SetSizer (s); wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); table->AddGrowableCol (1, 1); - s->Add (table, 1, wxALL | wxEXPAND, 8); + s->Add (table, 1, wxALL | wxEXPAND, _border); add_label_to_sizer (table, panel, _("IP address"), true); _tms_ip = new wxTextCtrl (panel, wxID_ANY); @@ -654,9 +661,14 @@ private: wxTextCtrl* _tms_password; }; -class KDMEmailPage : public wxPreferencesPage +class KDMEmailPage : public wxPreferencesPage, public Page { public: + + KDMEmailPage (wxSize panel_size, int border) + : Page (panel_size, border) + {} + wxString GetName () const { return _("KDM Email"); @@ -665,18 +677,23 @@ public: #ifdef DCPOMATIC_OSX wxBitmap GetLargeIcon () const { - return wxBitmap ("blank", wxBITMAP_TYPE_PNG_RESOURCE); + return wxBitmap ("kdm_email", wxBITMAP_TYPE_PNG_RESOURCE); } #endif wxWindow* CreateWindow (wxWindow* parent) { + /* We have to force both width and height of this one */ +#ifdef DCPOMATIC_OSX + wxPanel* panel = new wxPanel (parent, wxID_ANY, wxDefaultPosition, wxSize (480, 128)); +#else wxPanel* panel = new wxPanel (parent); +#endif wxBoxSizer* s = new wxBoxSizer (wxVERTICAL); panel->SetSizer (s); - _kdm_email = new wxTextCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); - s->Add (_kdm_email, 1, wxEXPAND | wxALL, 12); + _kdm_email = new wxTextCtrl (panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (480, 128), wxTE_MULTILINE); + s->Add (_kdm_email, 1, wxEXPAND | wxALL, _border); _kdm_email->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&KDMEmailPage::kdm_email_changed, this)); _kdm_email->SetValue (wx_to_std (Config::instance()->kdm_email ())); @@ -697,12 +714,24 @@ wxPreferencesEditor* create_config_dialog () { wxPreferencesEditor* e = new wxPreferencesEditor (); - e->AddPage (new GeneralPage); - e->AddPage (new DefaultsPage); - e->AddPage (new EncodingServersPage); - e->AddPage (new ColourConversionsPage); - e->AddPage (new MetadataPage); - e->AddPage (new TMSPage); - e->AddPage (new KDMEmailPage); + +#ifdef DCPOMATIC_OSX + /* Width that we force some of the config panels to be on OSX so that + the containing window doesn't shrink too much when we select those panels. + This is obviously an unpleasant hack. + */ + wxSize ps = wxSize (480, -1); + int const border = 16; +#else + wxSize ps = wxDefaultSize; + int const border = 8; +#endif + + e->AddPage (new GeneralPage (ps, border)); + e->AddPage (new DefaultsPage (ps, border)); + e->AddPage (new EncodingServersPage (ps, border)); + e->AddPage (new ColourConversionsPage (ps, border)); + e->AddPage (new TMSPage (ps, border)); + e->AddPage (new KDMEmailPage (ps, border)); return e; } -- cgit v1.2.3