From 6877f18489edabfc2d91480b6249d1a594e88b0d Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 2 Mar 2025 12:47:20 +0100 Subject: Rename config_dialog.{cc,h} -> preferences_page.{cc,h} Also trim some includes. --- src/wx/config_dialog.cc | 103 -------------------------------- src/wx/config_dialog.h | 88 --------------------------- src/wx/email_preferences_page.cc | 3 + src/wx/email_preferences_page.h | 10 +++- src/wx/full_config_dialog.cc | 2 +- src/wx/general_preferences_page.cc | 6 +- src/wx/general_preferences_page.h | 9 ++- src/wx/kdm_config_dialog.cc | 2 +- src/wx/kdm_email_preferences_page.cc | 1 + src/wx/kdm_email_preferences_page.h | 3 +- src/wx/keys_preferences_page.cc | 2 + src/wx/keys_preferences_page.h | 2 +- src/wx/locations_preferences_page.cc | 5 ++ src/wx/locations_preferences_page.h | 5 +- src/wx/player_config_dialog.cc | 2 +- src/wx/playlist_editor_config_dialog.cc | 1 - src/wx/preferences_page.cc | 81 +++++++++++++++++++++++++ src/wx/preferences_page.h | 72 ++++++++++++++++++++++ src/wx/sound_preferences_page.cc | 2 +- src/wx/sound_preferences_page.h | 10 +++- src/wx/wscript | 2 +- 21 files changed, 207 insertions(+), 204 deletions(-) delete mode 100644 src/wx/config_dialog.cc delete mode 100644 src/wx/config_dialog.h create mode 100644 src/wx/preferences_page.cc create mode 100644 src/wx/preferences_page.h (limited to 'src') diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc deleted file mode 100644 index 0d95b4118..000000000 --- a/src/wx/config_dialog.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 2012-2021 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - - -#include "audio_backend.h" -#include "audio_mapping_view.h" -#include "certificate_chain_editor.h" -#include "check_box.h" -#include "config_dialog.h" -#include "config_move_dialog.h" -#include "dcpomatic_button.h" -#include "file_picker_ctrl.h" -#include "nag_dialog.h" -#include "static_text.h" -#include "wx_variant.h" -#include "lib/constants.h" -#include "lib/util.h" -#include -#include -#include - - -using std::function; -using std::make_pair; -using std::make_shared; -using std::map; -using std::pair; -using std::shared_ptr; -using std::string; -using std::vector; -using boost::bind; -using boost::optional; -#if BOOST_VERSION >= 106100 -using namespace boost::placeholders; -#endif -using namespace dcpomatic::preferences; - - -Page::Page(wxSize panel_size, int border) - : _border(border) - , _panel(nullptr) - , _panel_size(panel_size) - , _window_exists(false) -{ - _config_connection = Config::instance()->Changed.connect(bind(&Page::config_changed_wrapper, this)); -} - - -wxWindow* -Page::CreateWindow(wxWindow* parent) -{ - return create_window(parent); -} - - -wxWindow* -Page::create_window(wxWindow* parent) -{ - _panel = new wxPanel(parent, wxID_ANY, wxDefaultPosition, _panel_size); - auto s = new wxBoxSizer(wxVERTICAL); - _panel->SetSizer(s); - - setup(); - _window_exists = true; - config_changed(); - - _panel->Bind(wxEVT_DESTROY, bind(&Page::window_destroyed, this)); - - return _panel; -} - -void -Page::config_changed_wrapper() -{ - if (_window_exists) { - config_changed(); - } -} - -void -Page::window_destroyed() -{ - _window_exists = false; -} - - diff --git a/src/wx/config_dialog.h b/src/wx/config_dialog.h deleted file mode 100644 index f87e60f45..000000000 --- a/src/wx/config_dialog.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - Copyright (C) 2012-2018 Carl Hetherington - - This file is part of DCP-o-matic. - - DCP-o-matic is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - DCP-o-matic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with DCP-o-matic. If not, see . - -*/ - - -#ifndef DCPOMATIC_CONFIG_DIALOG_H -#define DCPOMATIC_CONFIG_DIALOG_H - - -#include "editable_list.h" -#include "make_chain_dialog.h" -#include "wx_util.h" -#include "lib/config.h" -#include "lib/cross.h" -#include "lib/dcp_content_type.h" -#include "lib/exceptions.h" -#include "lib/filter.h" -#include "lib/log.h" -#include "lib/ratio.h" -#include -#include -#include -#include -LIBDCP_DISABLE_WARNINGS -#include -#include -#include -#include -#include -LIBDCP_ENABLE_WARNINGS -#include - - -class AudioMappingView; -class CheckBox; - - -namespace dcpomatic { -namespace preferences { - - -class Page : public wxPreferencesPage -{ -public: - Page(wxSize panel_size, int border); - virtual ~Page() {} - - wxWindow* CreateWindow(wxWindow* parent) override; - -protected: - wxWindow* create_window(wxWindow* parent); - - int _border; - wxPanel* _panel; - -private: - virtual void config_changed() = 0; - virtual void setup() = 0; - - void config_changed_wrapper(); - void window_destroyed(); - - wxSize _panel_size; - boost::signals2::scoped_connection _config_connection; - bool _window_exists; -}; - - -} -} - -#endif diff --git a/src/wx/email_preferences_page.cc b/src/wx/email_preferences_page.cc index 6264b9336..79ba3965d 100644 --- a/src/wx/email_preferences_page.cc +++ b/src/wx/email_preferences_page.cc @@ -19,12 +19,15 @@ */ +#include "dcpomatic_button.h" #include "email_preferences_page.h" #include "password_entry.h" #include "send_test_email_dialog.h" +#include "wx_util.h" #include "wx_variant.h" #include "lib/email.h" #include "lib/variant.h" +#include using namespace dcpomatic::preferences; diff --git a/src/wx/email_preferences_page.h b/src/wx/email_preferences_page.h index 8abbcef33..9b058ae77 100644 --- a/src/wx/email_preferences_page.h +++ b/src/wx/email_preferences_page.h @@ -19,7 +19,15 @@ */ -#include "config_dialog.h" +#include "preferences_page.h" + + +class wxChoice; +class wxSpinCtrl; +class wxTextCtrl; + +class Button; +class PasswordEntry; namespace dcpomatic { diff --git a/src/wx/full_config_dialog.cc b/src/wx/full_config_dialog.cc index e0b72d8f8..ae275038d 100644 --- a/src/wx/full_config_dialog.cc +++ b/src/wx/full_config_dialog.cc @@ -25,7 +25,6 @@ #include "check_box.h" -#include "config_dialog.h" #include "config_move_dialog.h" #include "dcpomatic_button.h" #include "dcpomatic_choice.h" @@ -45,6 +44,7 @@ #include "nag_dialog.h" #include "name_format_editor.h" #include "password_entry.h" +#include "preferences_page.h" #include "region_subtag_widget.h" #include "send_test_email_dialog.h" #include "server_dialog.h" diff --git a/src/wx/general_preferences_page.cc b/src/wx/general_preferences_page.cc index c438865b7..abfd500a5 100644 --- a/src/wx/general_preferences_page.cc +++ b/src/wx/general_preferences_page.cc @@ -20,12 +20,16 @@ #include "check_box.h" -#include "config_dialog.h" #include "config_move_dialog.h" +#include "dcpomatic_button.h" #include "file_picker_ctrl.h" #include "general_preferences_page.h" +#include "preferences_page.h" +#include "wx_util.h" #include "wx_variant.h" #include +#include +#include using std::make_pair; diff --git a/src/wx/general_preferences_page.h b/src/wx/general_preferences_page.h index fda849862..34801a2ca 100644 --- a/src/wx/general_preferences_page.h +++ b/src/wx/general_preferences_page.h @@ -19,7 +19,14 @@ */ -#include "config_dialog.h" +#include "preferences_page.h" + + +class wxChoice; +class wxGridBagSizer; + +class CheckBox; +class FilePickerCtrl; namespace dcpomatic { diff --git a/src/wx/kdm_config_dialog.cc b/src/wx/kdm_config_dialog.cc index 58abda4fa..7cb4b15d8 100644 --- a/src/wx/kdm_config_dialog.cc +++ b/src/wx/kdm_config_dialog.cc @@ -25,7 +25,6 @@ #include "check_box.h" -#include "config_dialog.h" #include "email_preferences_page.h" #include "general_preferences_page.h" #include "kdm_email_preferences_page.h" @@ -33,6 +32,7 @@ #include "file_picker_ctrl.h" #include "static_text.h" #include "wx_variant.h" +#include using boost::bind; diff --git a/src/wx/kdm_email_preferences_page.cc b/src/wx/kdm_email_preferences_page.cc index ae7eb0bd1..d6e3b0c17 100644 --- a/src/wx/kdm_email_preferences_page.cc +++ b/src/wx/kdm_email_preferences_page.cc @@ -21,6 +21,7 @@ #include "email_dialog.h" #include "kdm_email_preferences_page.h" +#include "wx_util.h" using std::string; diff --git a/src/wx/kdm_email_preferences_page.h b/src/wx/kdm_email_preferences_page.h index fd51285e6..4697b0c27 100644 --- a/src/wx/kdm_email_preferences_page.h +++ b/src/wx/kdm_email_preferences_page.h @@ -19,7 +19,8 @@ */ -#include "config_dialog.h" +#include "editable_list.h" +#include "preferences_page.h" class EmailDialog; diff --git a/src/wx/keys_preferences_page.cc b/src/wx/keys_preferences_page.cc index 4a0c8bc76..91112ca53 100644 --- a/src/wx/keys_preferences_page.cc +++ b/src/wx/keys_preferences_page.cc @@ -21,9 +21,11 @@ #include "certificate_chain_editor.h" #include "dcpomatic_button.h" +#include "make_chain_dialog.h" #include "nag_dialog.h" #include "keys_preferences_page.h" #include "static_text.h" +#include "wx_util.h" #include "wx_variant.h" #include "lib/exceptions.h" #include "lib/util.h" diff --git a/src/wx/keys_preferences_page.h b/src/wx/keys_preferences_page.h index 34233e745..210a4714b 100644 --- a/src/wx/keys_preferences_page.h +++ b/src/wx/keys_preferences_page.h @@ -19,7 +19,7 @@ */ -#include "config_dialog.h" +#include "preferences_page.h" namespace dcpomatic { diff --git a/src/wx/locations_preferences_page.cc b/src/wx/locations_preferences_page.cc index a992b2ed8..f77f88fb4 100644 --- a/src/wx/locations_preferences_page.cc +++ b/src/wx/locations_preferences_page.cc @@ -20,6 +20,11 @@ #include "locations_preferences_page.h" +#include "wx_util.h" +#include +#include +#include + using boost::bind; diff --git a/src/wx/locations_preferences_page.h b/src/wx/locations_preferences_page.h index de73b8074..8bb9e3e5a 100644 --- a/src/wx/locations_preferences_page.h +++ b/src/wx/locations_preferences_page.h @@ -19,7 +19,10 @@ */ -#include "config_dialog.h" +#include "preferences_page.h" + + +class wxDirPickerCtrl; namespace dcpomatic { diff --git a/src/wx/player_config_dialog.cc b/src/wx/player_config_dialog.cc index f0cbf0e31..303774e71 100644 --- a/src/wx/player_config_dialog.cc +++ b/src/wx/player_config_dialog.cc @@ -25,7 +25,6 @@ #include "check_box.h" -#include "config_dialog.h" #include "dir_picker_ctrl.h" #include "editable_list.h" #include "email_dialog.h" @@ -37,6 +36,7 @@ #include "make_chain_dialog.h" #include "nag_dialog.h" #include "name_format_editor.h" +#include "preferences_page.h" #include "server_dialog.h" #include "sound_preferences_page.h" #include "static_text.h" diff --git a/src/wx/playlist_editor_config_dialog.cc b/src/wx/playlist_editor_config_dialog.cc index 73b44ebe0..dd4eefa2f 100644 --- a/src/wx/playlist_editor_config_dialog.cc +++ b/src/wx/playlist_editor_config_dialog.cc @@ -24,7 +24,6 @@ */ -#include "config_dialog.h" #include "locations_preferences_page.h" #include "playlist_editor_config_dialog.h" #include "wx_variant.h" diff --git a/src/wx/preferences_page.cc b/src/wx/preferences_page.cc new file mode 100644 index 000000000..2ddd48813 --- /dev/null +++ b/src/wx/preferences_page.cc @@ -0,0 +1,81 @@ +/* + Copyright (C) 2012-2021 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see . + +*/ + + +#include "preferences_page.h" +#include "lib/config.h" +#include + + +using boost::bind; +#if BOOST_VERSION >= 106100 +using namespace boost::placeholders; +#endif +using namespace dcpomatic::preferences; + + +Page::Page(wxSize panel_size, int border) + : _border(border) + , _panel(nullptr) + , _panel_size(panel_size) + , _window_exists(false) +{ + _config_connection = Config::instance()->Changed.connect(bind(&Page::config_changed_wrapper, this)); +} + + +wxWindow* +Page::CreateWindow(wxWindow* parent) +{ + return create_window(parent); +} + + +wxWindow* +Page::create_window(wxWindow* parent) +{ + _panel = new wxPanel(parent, wxID_ANY, wxDefaultPosition, _panel_size); + auto s = new wxBoxSizer(wxVERTICAL); + _panel->SetSizer(s); + + setup(); + _window_exists = true; + config_changed(); + + _panel->Bind(wxEVT_DESTROY, bind(&Page::window_destroyed, this)); + + return _panel; +} + +void +Page::config_changed_wrapper() +{ + if (_window_exists) { + config_changed(); + } +} + +void +Page::window_destroyed() +{ + _window_exists = false; +} + + diff --git a/src/wx/preferences_page.h b/src/wx/preferences_page.h new file mode 100644 index 000000000..44605ba86 --- /dev/null +++ b/src/wx/preferences_page.h @@ -0,0 +1,72 @@ +/* + Copyright (C) 2012-2018 Carl Hetherington + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see . + +*/ + + +#ifndef DCPOMATIC_PREFERENCES_PAGE_H +#define DCPOMATIC_PREFERENCES_PAGE_H + + +#include +LIBDCP_DISABLE_WARNINGS +#include +LIBDCP_ENABLE_WARNINGS +#include + +#undef CreateWindow + + +class wxPanel; + + +namespace dcpomatic { +namespace preferences { + + +class Page : public wxPreferencesPage +{ +public: + Page(wxSize panel_size, int border); + virtual ~Page() {} + + wxWindow* CreateWindow(wxWindow* parent) override; + +protected: + wxWindow* create_window(wxWindow* parent); + + int _border; + wxPanel* _panel; + +private: + virtual void config_changed() = 0; + virtual void setup() = 0; + + void config_changed_wrapper(); + void window_destroyed(); + + wxSize _panel_size; + boost::signals2::scoped_connection _config_connection; + bool _window_exists; +}; + + +} +} + +#endif diff --git a/src/wx/sound_preferences_page.cc b/src/wx/sound_preferences_page.cc index 6018c795f..cf21474be 100644 --- a/src/wx/sound_preferences_page.cc +++ b/src/wx/sound_preferences_page.cc @@ -22,7 +22,7 @@ #include "audio_backend.h" #include "audio_mapping_view.h" #include "check_box.h" -#include "config_dialog.h" +#include "dcpomatic_button.h" #include "sound_preferences_page.h" #include "wx_util.h" #include "lib/constants.h" diff --git a/src/wx/sound_preferences_page.h b/src/wx/sound_preferences_page.h index 47bba4c53..f48083de9 100644 --- a/src/wx/sound_preferences_page.h +++ b/src/wx/sound_preferences_page.h @@ -19,7 +19,15 @@ */ -#include "config_dialog.h" +#include "preferences_page.h" + + +class wxChoice; +class wxStaticText; + +class AudioMappingView; +class Button; +class CheckBox; namespace dcpomatic { diff --git a/src/wx/wscript b/src/wx/wscript index c18b83086..6bb10511b 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -41,7 +41,6 @@ sources = """ cinema_dialog.cc closed_captions_dialog.cc colour_conversion_editor.cc - config_dialog.cc config_move_dialog.cc confirm_kdm_email_dialog.cc content_advanced_dialog.cc @@ -140,6 +139,7 @@ sources = """ playhead_to_frame_dialog.cc playlist_controls.cc playlist_editor_config_dialog.cc + preferences_page.cc question_dialog.cc rating_dialog.cc qube_certificate_panel.cc -- cgit v1.2.3