summaryrefslogtreecommitdiff
path: root/src/wx
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-02-17 19:25:33 +0000
committerCarl Hetherington <cth@carlh.net>2016-02-17 19:25:33 +0000
commit4228cb5b5323e9dc4bc87182b27427e48bb59d91 (patch)
tree42b0222c333c7bb27f7ae68196837d9dbfa6b65a /src/wx
parent4f19455332f1f4cc4c313338b7fb0b6fc508d5b4 (diff)
Use a separate file (in a configurable location) to store cinema / screen certificates (#796).
Diffstat (limited to 'src/wx')
-rw-r--r--src/wx/config_dialog.cc20
-rw-r--r--src/wx/file_picker_ctrl.cc3
-rw-r--r--src/wx/wx_util.cc14
-rw-r--r--src/wx/wx_util.h4
4 files changed, 28 insertions, 13 deletions
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index 8af125a97..696f7a65f 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -26,6 +26,7 @@
#include "editable_list.h"
#include "filter_dialog.h"
#include "dir_picker_ctrl.h"
+#include "file_picker_ctrl.h"
#include "isdcf_metadata_dialog.h"
#include "server_dialog.h"
#include "make_chain_dialog.h"
@@ -43,8 +44,8 @@
#include <dcp/certificate_chain.h>
#include <wx/stdpaths.h>
#include <wx/preferences.h>
-#include <wx/filepicker.h>
#include <wx/spinctrl.h>
+#include <wx/filepicker.h>
#include <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
@@ -188,6 +189,11 @@ private:
table->Add (_num_local_encoding_threads, wxGBPosition (r, 1));
++r;
+ add_label_to_sizer (table, _panel, _("Cinema and screen database file"), true, wxGBPosition (r, 0));
+ _cinemas_file = new FilePickerCtrl (_panel, _("Select cinema and screen database file"), "*.xml");
+ table->Add (_cinemas_file, wxGBPosition (r, 1));
+ ++r;
+
_automatic_audio_analysis = new wxCheckBox (_panel, wxID_ANY, _("Automatically analyse content audio"));
table->Add (_automatic_audio_analysis, wxGBPosition (r, 0), wxGBSpan (1, 2));
++r;
@@ -214,8 +220,9 @@ private:
table->Add (bottom_table, wxGBPosition (r, 0), wxGBSpan (2, 2), wxEXPAND);
++r;
- _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));
+ _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));
+ _cinemas_file->Bind (wxEVT_COMMAND_FILEPICKER_CHANGED, boost::bind (&GeneralPage::cinemas_file_changed, this));
_num_local_encoding_threads->SetRange (1, 128);
_num_local_encoding_threads->Bind (wxEVT_COMMAND_SPINCTRL_UPDATED, boost::bind (&GeneralPage::num_local_encoding_threads_changed, this));
@@ -268,6 +275,7 @@ private:
checked_set (_check_for_test_updates, config->check_for_test_updates ());
checked_set (_issuer, config->dcp_issuer ());
checked_set (_creator, config->dcp_creator ());
+ checked_set (_cinemas_file, config->cinemas_file());
setup_sensitivity ();
}
@@ -363,9 +371,15 @@ private:
Config::instance()->set_dcp_creator (wx_to_std (_creator->GetValue ()));
}
+ void cinemas_file_changed ()
+ {
+ Config::instance()->set_cinemas_file (wx_to_std (_cinemas_file->GetPath ()));
+ }
+
wxCheckBox* _set_language;
wxChoice* _language;
wxSpinCtrl* _num_local_encoding_threads;
+ FilePickerCtrl* _cinemas_file;
wxCheckBox* _automatic_audio_analysis;
wxCheckBox* _check_for_updates;
wxCheckBox* _check_for_test_updates;
diff --git a/src/wx/file_picker_ctrl.cc b/src/wx/file_picker_ctrl.cc
index 8de1596a9..9b52fc1cf 100644
--- a/src/wx/file_picker_ctrl.cc
+++ b/src/wx/file_picker_ctrl.cc
@@ -39,7 +39,7 @@ FilePickerCtrl::FilePickerCtrl (wxWindow* parent, wxString prompt, wxString wild
size.SetHeight (-1);
_file = new wxButton (this, wxID_ANY, _("(None)"), wxDefaultPosition, size, wxBU_LEFT);
- _sizer->Add (_file, 1, wxEXPAND | wxALL, 6);
+ _sizer->Add (_file, 1, wxEXPAND, 0);
SetSizerAndFit (_sizer);
@@ -71,6 +71,7 @@ void
FilePickerCtrl::browse_clicked ()
{
wxFileDialog* d = new wxFileDialog (this, _prompt, wxEmptyString, wxEmptyString, _wildcard);
+ d->SetPath (_path);
if (d->ShowModal () == wxID_OK) {
SetPath (d->GetPath ());
}
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 1e990c495..d7620eff4 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -21,12 +21,12 @@
* @brief Some utility functions and classes.
*/
-#include <boost/thread.hpp>
-#include <wx/filepicker.h>
-#include <wx/spinctrl.h>
+#include "wx_util.h"
+#include "file_picker_ctrl.h"
#include "lib/config.h"
#include "lib/util.h"
-#include "wx_util.h"
+#include <wx/spinctrl.h>
+#include <boost/thread.hpp>
using namespace std;
using namespace boost;
@@ -136,16 +136,16 @@ string_client_data (wxClientData* o)
}
void
-checked_set (wxFilePickerCtrl* widget, string value)
+checked_set (FilePickerCtrl* widget, boost::filesystem::path value)
{
- if (widget->GetPath() != std_to_wx (value)) {
+ if (widget->GetPath() != std_to_wx (value.string())) {
if (value.empty()) {
/* Hack to make wxWidgets clear the control when we are passed
an empty value.
*/
value = " ";
}
- widget->SetPath (std_to_wx (value));
+ widget->SetPath (std_to_wx (value.string()));
}
}
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index aaa59c4ac..112289c78 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -34,7 +34,7 @@
#include <gtk/gtk.h>
#endif
-class wxFilePickerCtrl;
+class FilePickerCtrl;
class wxSpinCtrl;
class wxSpinCtrlDouble;
class wxGridBagSizer;
@@ -69,7 +69,7 @@ extern wxString context_translation (wxString);
extern std::string string_client_data (wxClientData* o);
extern wxString time_to_timecode (DCPTime t, double fps);
-extern void checked_set (wxFilePickerCtrl* widget, std::string value);
+extern void checked_set (FilePickerCtrl* widget, boost::filesystem::path value);
extern void checked_set (wxSpinCtrl* widget, int value);
extern void checked_set (wxSpinCtrlDouble* widget, double value);
extern void checked_set (wxChoice* widget, int value);