diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-05-20 22:51:49 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-05-06 20:42:50 +0200 |
| commit | a3fcbb3a76e079a5485a0552ea5d35b8d6739116 (patch) | |
| tree | 58f6476b7197c0e32b5aa3d52d0859a9b04db268 /src/tools | |
| parent | a4105c6e8dc83407abc9b12e80c958673c942888 (diff) | |
Use sqlite for cinema and DKDM recipient lists.
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/dcpomatic.cc | 74 | ||||
| -rw-r--r-- | src/tools/dcpomatic_batch.cc | 36 | ||||
| -rw-r--r-- | src/tools/dcpomatic_kdm.cc | 6 | ||||
| -rw-r--r-- | src/tools/wscript | 2 |
4 files changed, 49 insertions, 69 deletions
diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index 1c43d8a07..85fc96c3e 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -42,6 +42,7 @@ #include "wx/id.h" #include "wx/job_manager_view.h" #include "wx/kdm_dialog.h" +#include "wx/load_config_from_zip_dialog.h" #include "wx/nag_dialog.h" #include "wx/paste_dialog.h" #include "wx/recreate_chain_dialog.h" @@ -94,6 +95,7 @@ #include "lib/subtitle_film_encoder.h" #include "lib/text_content.h" #include "lib/transcode_job.h" +#include "lib/unzipper.h" #include "lib/update_checker.h" #include "lib/variant.h" #include "lib/version.h" @@ -328,7 +330,7 @@ public: #endif _config_changed_connection = Config::instance()->Changed.connect(boost::bind(&DOMFrame::config_changed, this, _1)); - config_changed (Config::OTHER); + config_changed(Config::OTHER); _analytics_message_connection = Analytics::instance()->Message.connect(boost::bind(&DOMFrame::analytics_message, this, _1, _2)); @@ -795,9 +797,22 @@ private: { FileDialog dialog(this, _("Specify ZIP file"), wxT("ZIP files (*.zip)|*.zip"), wxFD_OPEN, "Preferences"); - if (dialog.show()) { - Config::instance()->load_from_zip(dialog.path()); + if (!dialog.show()) { + return; + } + + auto action = Config::CinemasAction::WRITE_TO_CURRENT_PATH; + + if (Config::zip_contains_cinemas(dialog.path()) && Config::cinemas_file_from_zip(dialog.path()) != Config::instance()->cinemas_file()) { + LoadConfigFromZIPDialog how(this, dialog.path()); + if (how.ShowModal() == wxID_CANCEL) { + return; + } + + action = how.action(); } + + Config::instance()->load_from_zip(dialog.path(), action); } void jobs_make_dcp () @@ -1466,48 +1481,19 @@ private: m->Append (help, _("&Help")); } - void config_changed (Config::Property what) + void config_changed(Config::Property what) { /* Instantly save any config changes when using the DCP-o-matic GUI */ - switch (what) { - case Config::CINEMAS: - try { - Config::instance()->write_cinemas(); - } catch (exception& e) { - error_dialog ( - this, - wxString::Format ( - _("Could not write to cinemas file at %s. Your changes have not been saved."), - std_to_wx (Config::instance()->cinemas_file().string()).data() - ) - ); - } - break; - case Config::DKDM_RECIPIENTS: - try { - Config::instance()->write_dkdm_recipients(); - } catch (exception& e) { - error_dialog ( - this, - wxString::Format ( - _("Could not write to DKDM recipients file at %s. Your changes have not been saved."), - std_to_wx(Config::instance()->dkdm_recipients_file().string()).data() - ) - ); - } - break; - default: - try { - Config::instance()->write_config(); - } catch (exception& e) { - error_dialog ( - this, - wxString::Format ( - _("Could not write to config file at %s. Your changes have not been saved."), - std_to_wx (Config::instance()->cinemas_file().string()).data() - ) - ); - } + try { + Config::instance()->write_config(); + } catch (exception& e) { + error_dialog ( + this, + wxString::Format ( + _("Could not write to config file at %s. Your changes have not been saved."), + std_to_wx (Config::instance()->cinemas_file().string()).data() + ) + ); } for (int i = 0; i < _history_items; ++i) { @@ -1548,6 +1534,8 @@ private: if (what == Config::GROK) { setup_grok_library_path(); } +#else + LIBDCP_UNUSED(what); #endif } diff --git a/src/tools/dcpomatic_batch.cc b/src/tools/dcpomatic_batch.cc index 0a228b933..32e8dec08 100644 --- a/src/tools/dcpomatic_batch.cc +++ b/src/tools/dcpomatic_batch.cc @@ -358,36 +358,24 @@ private: void config_changed (Config::Property what) { /* Instantly save any config changes when using the DCP-o-matic GUI */ - if (what == Config::CINEMAS) { - try { - Config::instance()->write_cinemas(); - } catch (exception& e) { - error_dialog ( - this, - wxString::Format( - _("Could not write to cinemas file at %s. Your changes have not been saved."), - std_to_wx (Config::instance()->cinemas_file().string()).data() - ) - ); - } - } else { - try { - Config::instance()->write_config(); - } catch (exception& e) { - error_dialog ( - this, - wxString::Format( - _("Could not write to config file at %s. Your changes have not been saved."), - std_to_wx (Config::instance()->cinemas_file().string()).data() - ) - ); - } + try { + Config::instance()->write_config(); + } catch (exception& e) { + error_dialog ( + this, + wxString::Format( + _("Could not write to config file at %s. Your changes have not been saved."), + std_to_wx (Config::instance()->cinemas_file().string()).data() + ) + ); } #ifdef DCPOMATIC_GROK if (what == Config::GROK) { setup_grok_library_path(); } +#else + LIBDCP_UNUSED(what); #endif } diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index 6f8c3c71e..af16f57aa 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -405,11 +405,15 @@ private: return kdm; }; + CinemaList cinemas; + for (auto i: _screens->screens()) { auto kdm = kdm_for_screen( make_kdm, - i, + i.first, + *cinemas.cinema(i.first), + *cinemas.screen(i.second), _timing->from(), _timing->until(), _output->formulation(), diff --git a/src/tools/wscript b/src/tools/wscript index a79995480..e6d7c4be1 100644 --- a/src/tools/wscript +++ b/src/tools/wscript @@ -98,7 +98,7 @@ def configure(conf): def build(bld): uselib = 'BOOST_THREAD BOOST_DATETIME DCP XMLSEC CXML XMLPP AVFORMAT AVFILTER AVCODEC ' uselib += 'AVUTIL SWSCALE SWRESAMPLE POSTPROC CURL BOOST_FILESYSTEM SSH ZIP CAIROMM FONTCONFIG PANGOMM SUB ' - uselib += 'SNDFILE SAMPLERATE BOOST_REGEX ICU NETTLE RTAUDIO PNG JPEG LEQM_NRT ' + uselib += 'SNDFILE SAMPLERATE BOOST_REGEX ICU NETTLE RTAUDIO PNG JPEG LEQM_NRT SQLITE3 ' if bld.env.ENABLE_DISK: if bld.env.TARGET_LINUX: |
