Fix player config window on macOS (#2376).
[dcpomatic.git] / src / wx / player_config_dialog.cc
index 7af42932654616ffe213c6c0980c40564be315bf..a7bb35bda427beca8e2e4b2f68f57d1ab46c119d 100644 (file)
 
 */
 
+
 /** @file src/player_config_dialog.cc
  *  @brief A dialogue to edit DCP-o-matic Player configuration.
  */
 
+
+#include "check_box.h"
 #include "config_dialog.h"
-#include "wx_util.h"
+#include "dir_picker_ctrl.h"
 #include "editable_list.h"
-#include "filter_dialog.h"
+#include "email_dialog.h"
 #include "file_picker_ctrl.h"
-#include "dir_picker_ctrl.h"
-#include "isdcf_metadata_dialog.h"
-#include "server_dialog.h"
+#include "filter_dialog.h"
 #include "make_chain_dialog.h"
-#include "email_dialog.h"
-#include "name_format_editor.h"
 #include "nag_dialog.h"
-#include "monitor_dialog.h"
-#include "check_box.h"
+#include "name_format_editor.h"
+#include "server_dialog.h"
 #include "static_text.h"
+#include "wx_util.h"
 #include "lib/config.h"
-#include "lib/ratio.h"
-#include "lib/filter.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 "lib/util.h"
-#include "lib/cross.h"
-#include "lib/exceptions.h"
-#include <dcp/locale_convert.h>
-#include <dcp/exceptions.h>
 #include <dcp/certificate_chain.h>
-#include <wx/stdpaths.h>
+#include <dcp/exceptions.h>
+#include <dcp/locale_convert.h>
+#include <dcp/warnings.h>
+LIBDCP_DISABLE_WARNINGS
+#include <wx/filepicker.h>
 #include <wx/preferences.h>
 #include <wx/spinctrl.h>
-#include <wx/filepicker.h>
+#include <wx/stdpaths.h>
+LIBDCP_ENABLE_WARNINGS
 #include <RtAudio.h>
 #include <boost/filesystem.hpp>
-#include <boost/foreach.hpp>
-#include <iostream>
 
-using std::vector;
-using std::string;
+
+using std::function;
 using std::list;
-using std::cout;
-using std::pair;
 using std::make_pair;
 using std::map;
+using std::pair;
+using std::shared_ptr;
+using std::string;
+using std::vector;
 using boost::bind;
-using boost::shared_ptr;
-using boost::function;
 using boost::optional;
 #if BOOST_VERSION >= 106100
 using namespace boost::placeholders;
 #endif
 using dcp::locale_convert;
 
+
 class PlayerGeneralPage : public GeneralPage
 {
 public:
@@ -81,7 +83,7 @@ public:
        {}
 
 private:
-       void setup ()
+       void setup () override
        {
                wxGridBagSizer* table = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
                _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
@@ -123,25 +125,19 @@ private:
                table->Add (_respect_kdm, wxGBPosition(r, 0), wxGBSpan(1, 2));
                ++r;
 
-               add_label_to_sizer (table, _panel, _("Activity log file"), true, wxGBPosition (r, 0));
-               _activity_log_file = new FilePickerCtrl (_panel, _("Select activity log file"), "*", true, true);
-               table->Add (_activity_log_file, wxGBPosition(r, 1));
-               ++r;
-
                add_label_to_sizer (table, _panel, _("Debug log file"), true, wxGBPosition (r, 0));
-               _debug_log_file = new FilePickerCtrl (_panel, _("Select debug log file"), "*", true, true);
+               _debug_log_file = new FilePickerCtrl (_panel, _("Select debug log file"), "*", false, true);
                table->Add (_debug_log_file, wxGBPosition(r, 1));
                ++r;
 
                _player_mode->Bind (wxEVT_CHOICE, bind(&PlayerGeneralPage::player_mode_changed, this));
                _image_display->Bind (wxEVT_CHOICE, bind(&PlayerGeneralPage::image_display_changed, this));
                _video_display_mode->Bind (wxEVT_CHOICE, bind(&PlayerGeneralPage::video_display_mode_changed, this));
-               _respect_kdm->Bind (wxEVT_CHECKBOX, bind(&PlayerGeneralPage::respect_kdm_changed, this));
-               _activity_log_file->Bind (wxEVT_FILEPICKER_CHANGED, bind(&PlayerGeneralPage::activity_log_file_changed, this));
+               _respect_kdm->bind(&PlayerGeneralPage::respect_kdm_changed, this);
                _debug_log_file->Bind (wxEVT_FILEPICKER_CHANGED, bind(&PlayerGeneralPage::debug_log_file_changed, this));
        }
 
-       void config_changed ()
+       void config_changed () override
        {
                GeneralPage::config_changed ();
 
@@ -170,9 +166,6 @@ private:
 
                checked_set (_image_display, config->image_display());
                checked_set (_respect_kdm, config->respect_kdm_validity_periods());
-               if (config->player_activity_log_file()) {
-                       checked_set (_activity_log_file, *config->player_activity_log_file());
-               }
                if (config->player_debug_log_file()) {
                        checked_set (_debug_log_file, *config->player_debug_log_file());
                }
@@ -213,11 +206,6 @@ private:
                Config::instance()->set_respect_kdm_validity_periods(_respect_kdm->GetValue());
        }
 
-       void activity_log_file_changed ()
-       {
-               Config::instance()->set_player_activity_log_file(wx_to_std(_activity_log_file->GetPath()));
-       }
-
        void debug_log_file_changed ()
        {
                Config::instance()->set_player_debug_log_file(wx_to_std(_debug_log_file->GetPath()));
@@ -226,8 +214,7 @@ private:
        wxChoice* _player_mode;
        wxChoice* _image_display;
        wxChoice* _video_display_mode;
-       wxCheckBox* _respect_kdm;
-       FilePickerCtrl* _activity_log_file;
+       CheckBox* _respect_kdm;
        FilePickerCtrl* _debug_log_file;
 };
 
@@ -246,15 +233,15 @@ public:
                , _log_timing (0)
        {}
 
-       wxString GetName () const
+       wxString GetName () const override
        {
                return _("Advanced");
        }
 
 #ifdef DCPOMATIC_OSX
-       wxBitmap GetLargeIcon () const
+       wxBitmap GetLargeIcon () const override
        {
-               return wxBitmap ("advanced", wxBITMAP_TYPE_PNG_RESOURCE);
+               return wxBitmap(icon_path("advanced"), wxBITMAP_TYPE_PNG);
        }
 #endif
 
@@ -270,9 +257,9 @@ private:
                table->Add (m, 0, flags, DCPOMATIC_SIZER_Y_GAP);
        }
 
-       void setup ()
+       void setup () override
        {
-               wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+               auto table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
                table->AddGrowableCol (1, 1);
                _panel->GetSizer()->Add (table, 1, wxALL | wxEXPAND, _border);
 
@@ -297,18 +284,18 @@ private:
                table->AddSpacer (0);
 #endif
 
-               _log_general->Bind (wxEVT_CHECKBOX, boost::bind (&PlayerAdvancedPage::log_changed, this));
-               _log_warning->Bind (wxEVT_CHECKBOX, boost::bind (&PlayerAdvancedPage::log_changed, this));
-               _log_error->Bind (wxEVT_CHECKBOX, boost::bind (&PlayerAdvancedPage::log_changed, this));
-               _log_timing->Bind (wxEVT_CHECKBOX, boost::bind (&PlayerAdvancedPage::log_changed, this));
+               _log_general->bind(&PlayerAdvancedPage::log_changed, this);
+               _log_warning->bind(&PlayerAdvancedPage::log_changed, this);
+               _log_error->bind(&PlayerAdvancedPage::log_changed, this);
+               _log_timing->bind(&PlayerAdvancedPage::log_changed, this);
 #ifdef DCPOMATIC_WINDOWS
-               _win32_console->Bind (wxEVT_CHECKBOX, boost::bind (&PlayerAdvancedPage::win32_console_changed, this));
+               _win32_console->bind(&PlayerAdvancedPage::win32_console_changed, this);
 #endif
        }
 
-       void config_changed ()
+       void config_changed () override
        {
-               Config* config = Config::instance ();
+               auto config = Config::instance ();
 
                checked_set (_log_general, config->log_types() & LogEntry::TYPE_GENERAL);
                checked_set (_log_warning, config->log_types() & LogEntry::TYPE_WARNING);
@@ -344,12 +331,12 @@ private:
        }
 #endif
 
-       wxCheckBox* _log_general;
-       wxCheckBox* _log_warning;
-       wxCheckBox* _log_error;
-       wxCheckBox* _log_timing;
+       CheckBox* _log_general;
+       CheckBox* _log_warning;
+       CheckBox* _log_error;
+       CheckBox* _log_timing;
 #ifdef DCPOMATIC_WINDOWS
-       wxCheckBox* _win32_console;
+       CheckBox* _win32_console;
 #endif
 };
 
@@ -357,17 +344,17 @@ private:
 wxPreferencesEditor*
 create_player_config_dialog ()
 {
-       wxPreferencesEditor* e = new wxPreferencesEditor (_("DCP-o-matic Player Preferences"));
+       auto e = new wxPreferencesEditor (_("DCP-o-matic Player Preferences"));
 
 #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 (520, -1);
+       auto ps = wxSize (520, -1);
        int const border = 16;
 #else
-       wxSize ps = wxSize (-1, -1);
+       auto ps = wxSize (-1, -1);
        int const border = 8;
 #endif