diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-12-29 15:54:14 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-01 01:54:38 +0100 |
| commit | 4532fecad4bad945482fbcf2d61eef708178835c (patch) | |
| tree | 87c4157d2334e06f59e11dcde252e7a412d7d4d1 | |
| parent | aa8bb7b6f6fe2eed323e6f4f978a76a9a067c545 (diff) | |
Coalesce three radios into a dropdown.
| -rw-r--r-- | src/wx/kdm_output_panel.cc | 48 | ||||
| -rw-r--r-- | src/wx/kdm_output_panel.h | 5 | ||||
| -rw-r--r-- | src/wx/short_kdm_output_panel.cc | 11 | ||||
| -rw-r--r-- | src/wx/tall_kdm_output_panel.cc | 11 |
4 files changed, 37 insertions, 38 deletions
diff --git a/src/wx/kdm_output_panel.cc b/src/wx/kdm_output_panel.cc index 30660c6af..f86808a70 100644 --- a/src/wx/kdm_output_panel.cc +++ b/src/wx/kdm_output_panel.cc @@ -22,6 +22,7 @@ #include "check_box.h" #include "confirm_kdm_email_dialog.h" #include "dcpomatic_button.h" +#include "dcpomatic_choice.h" #include "extra_kdm_email_dialog.h" #include "kdm_advanced_dialog.h" #include "kdm_choice.h" @@ -89,22 +90,23 @@ KDMOutputPanel::create_destination_widgets(wxWindow* parent) _folder->SetPath(wxStandardPaths::Get().GetDocumentsDir()); } - _write_flat = new wxRadioButton(parent, wxID_ANY, _("Write all KDMs to the same folder"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP); - _write_folder = new wxRadioButton(parent, wxID_ANY, _("Write a folder for each cinema's KDMs")); - _write_zip = new wxRadioButton(parent, wxID_ANY, _("Write a ZIP file for each cinema's KDMs")); + _write_collect = new Choice(parent); + _write_collect->add_entry(_("Write all KDMs to the same folder")); + _write_collect->add_entry(_("Write a folder for each cinema's KDMs")); + _write_collect->add_entry(_("Write a ZIP file for each cinema's KDMs")); _email = new CheckBox(parent, _("Send by email")); _add_email_addresses = new wxButton(parent, wxID_ANY, _("Set additional email addresses...")); switch (Config::instance()->last_kdm_write_type().get_value_or(Config::KDM_WRITE_FLAT)) { case Config::KDM_WRITE_FLAT: - _write_flat->SetValue(true); + _write_collect->set(0); break; case Config::KDM_WRITE_FOLDER: - _write_folder->SetValue(true); + _write_collect->set(1); break; case Config::KDM_WRITE_ZIP: - _write_zip->SetValue(true); + _write_collect->set(2); break; } @@ -114,9 +116,7 @@ KDMOutputPanel::create_destination_widgets(wxWindow* parent) _write_to->bind(&KDMOutputPanel::write_to_changed, this); _email->bind(&KDMOutputPanel::email_changed, this); _add_email_addresses->Bind(wxEVT_BUTTON, boost::bind(&KDMOutputPanel::add_email_addresses_clicked, this)); - _write_flat->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this)); - _write_folder->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this)); - _write_zip->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this)); + _write_collect->bind(&KDMOutputPanel::kdm_write_type_changed, this); } @@ -176,9 +176,7 @@ KDMOutputPanel::setup_sensitivity () { bool const write = _write_to->GetValue (); _folder->Enable (write); - _write_flat->Enable (write); - _write_folder->Enable (write); - _write_zip->Enable (write); + _write_collect->Enable(write); } @@ -196,12 +194,16 @@ KDMOutputPanel::advanced_clicked () void KDMOutputPanel::kdm_write_type_changed () { - if (_write_flat->GetValue()) { - Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_FLAT); - } else if (_write_folder->GetValue()) { - Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_FOLDER); - } else if (_write_zip->GetValue()) { - Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_ZIP); + switch (_write_collect->get().get_value_or(0)) { + case 0: + Config::instance()->set_last_kdm_write_type(Config::KDM_WRITE_FLAT); + break; + case 1: + Config::instance()->set_last_kdm_write_type(Config::KDM_WRITE_FOLDER); + break; + case 2: + Config::instance()->set_last_kdm_write_type(Config::KDM_WRITE_ZIP); + break; } } @@ -265,14 +267,16 @@ KDMOutputPanel::make ( try { if (_write_to->GetValue()) { - if (_write_flat->GetValue()) { + switch (_write_collect->get().get_value_or(0)) { + case 0: written = write_files ( kdms, directory(), _filename_format->get(), confirm_overwrite ); - } else if (_write_folder->GetValue()) { + break; + case 1: written = write_directories ( collect (kdms), directory(), @@ -280,7 +284,8 @@ KDMOutputPanel::make ( _filename_format->get(), confirm_overwrite ); - } else if (_write_zip->GetValue()) { + break; + case 2: written = write_zip_files ( collect (kdms), directory(), @@ -288,6 +293,7 @@ KDMOutputPanel::make ( _filename_format->get(), confirm_overwrite ); + break; } } diff --git a/src/wx/kdm_output_panel.h b/src/wx/kdm_output_panel.h index 84cfdecd7..848b15722 100644 --- a/src/wx/kdm_output_panel.h +++ b/src/wx/kdm_output_panel.h @@ -34,6 +34,7 @@ LIBDCP_ENABLE_WARNINGS class CheckBox; +class Choice; class DirPickerCtrl; class Job; class KDMChoice; @@ -89,9 +90,7 @@ protected: #else wxDirPickerCtrl* _folder; #endif - wxRadioButton* _write_flat; - wxRadioButton* _write_folder; - wxRadioButton* _write_zip; + Choice* _write_collect; wxButton* _advanced; CheckBox* _email; wxButton* _add_email_addresses; diff --git a/src/wx/short_kdm_output_panel.cc b/src/wx/short_kdm_output_panel.cc index 5a0fb2504..7e0692319 100644 --- a/src/wx/short_kdm_output_panel.cc +++ b/src/wx/short_kdm_output_panel.cc @@ -20,6 +20,7 @@ #include "check_box.h" +#include "dcpomatic_choice.h" #include "kdm_choice.h" #include "name_format_editor.h" #include "short_kdm_output_panel.h" @@ -68,15 +69,11 @@ ShortKDMOutputPanel::fill_destination_panel(wxPanel* panel) auto table = new wxFlexGridSizer(2, DCPOMATIC_SIZER_X_GAP, 0); table->AddGrowableCol(1); - table->Add(_write_to, 1, wxEXPAND); + table->Add(_write_to, 1, wxEXPAND | wxLEFT); table->Add(_folder, 1, wxEXPAND); - auto write_options = new wxBoxSizer(wxVERTICAL); - write_options->Add(_write_flat, 1, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - write_options->Add(_write_folder, 1, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - write_options->Add(_write_zip, 1, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - table->AddSpacer(0); - table->Add(write_options); + add_label_to_sizer(table, panel, _("Collection"), true, 0, wxALIGN_CENTRE_VERTICAL | wxLEFT | wxRIGHT); + table->Add(_write_collect, 1, wxEXPAND); table->Add(_email, 1, wxEXPAND); table->Add(_add_email_addresses); diff --git a/src/wx/tall_kdm_output_panel.cc b/src/wx/tall_kdm_output_panel.cc index d34c5460d..5d4c5c661 100644 --- a/src/wx/tall_kdm_output_panel.cc +++ b/src/wx/tall_kdm_output_panel.cc @@ -22,6 +22,7 @@ #include "check_box.h" #include "confirm_kdm_email_dialog.h" #include "dcpomatic_button.h" +#include "dcpomatic_choice.h" #include "extra_kdm_email_dialog.h" #include "kdm_advanced_dialog.h" #include "kdm_choice.h" @@ -93,15 +94,11 @@ TallKDMOutputPanel::TallKDMOutputPanel(wxWindow* parent) table->Add (align, 0, wxTOP | wxRIGHT | wxALIGN_TOP, DCPOMATIC_SIZER_GAP); #endif table->Add (_filename_format->panel(), 1, wxEXPAND); - table->Add (_write_to, 1, wxEXPAND); + table->Add (_write_to, 1, wxEXPAND | wxLEFT); table->Add (_folder, 1, wxEXPAND); - auto write_options = new wxBoxSizer(wxVERTICAL); - write_options->Add (_write_flat, 1, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - write_options->Add (_write_folder, 1, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - write_options->Add (_write_zip, 1, wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP); - table->AddSpacer (0); - table->Add (write_options); + add_label_to_sizer(table, this, _("Collection"), true, 0, wxALIGN_CENTRE_VERTICAL | wxLEFT | wxRIGHT); + table->Add(_write_collect, 1, wxEXPAND); table->Add (_email, 1, wxEXPAND); table->Add (_add_email_addresses); |
