+2017-05-04 Carl Hetherington <cth@carlh.net>
+
+ * Nag users to backup config.xml if they make a DKDM.
+
2017-05-03 Carl Hetherington <cth@carlh.net>
* Version 2.11.3 released.
_dcp_metadata_filename_format = dcp::NameFormat ("%t");
_dcp_asset_filename_format = dcp::NameFormat ("%t");
_jump_to_selected = true;
+ for (int i = 0; i < NAG_COUNT; ++i) {
+ _nagged[i] = false;
+ }
_preview_sound = false;
_preview_sound_output = optional<string> ();
_dcp_metadata_filename_format = dcp::NameFormat (f.optional_string_child("DCPMetadataFilenameFormat").get_value_or ("%t"));
_dcp_asset_filename_format = dcp::NameFormat (f.optional_string_child("DCPAssetFilenameFormat").get_value_or ("%t"));
_jump_to_selected = f.optional_bool_child("JumpToSelected").get_value_or (true);
+ BOOST_FOREACH (cxml::NodePtr i, f.node_children("Nagged")) {
+ int const id = i->number_attribute<int>("Id");
+ if (id >= 0 && id < NAG_COUNT) {
+ _nagged[id] = raw_convert<int>(i->content());
+ }
+ }
_preview_sound = f.optional_bool_child("PreviewSound").get_value_or (false);
_preview_sound_output = f.optional_string_child("PreviewSoundOutput");
root->add_child("DCPMetadataFilenameFormat")->add_child_text (_dcp_metadata_filename_format.specification ());
root->add_child("DCPAssetFilenameFormat")->add_child_text (_dcp_asset_filename_format.specification ());
root->add_child("JumpToSelected")->add_child_text (_jump_to_selected ? "1" : "0");
+ for (int i = 0; i < NAG_COUNT; ++i) {
+ xmlpp::Element* e = root->add_child ("Nagged");
+ e->set_attribute ("Id", raw_convert<string>(i));
+ e->add_child_text (_nagged[i] ? "1" : "0");
+ }
root->add_child("PreviewSound")->add_child_text (_preview_sound ? "1" : "0");
if (_preview_sound_output) {
root->add_child("PreviewSoundOutput")->add_child_text (_preview_sound_output.get());
{
boost::filesystem::remove (template_path (name));
}
+
+/** @return Path to the config.xml, for telling the user what it is */
+boost::filesystem::path
+Config::config_path ()
+{
+ return path("config.xml", false);
+}
return _jump_to_selected;
}
+ enum Nag {
+ NAG_DKDM_CONFIG,
+ NAG_COUNT
+ };
+
+ bool nagged (Nag nag) const {
+ return _nagged[nag];
+ }
+
bool preview_sound () const {
return _preview_sound;
}
maybe_set (_jump_to_selected, j);
}
+ void set_nagged (Nag nag, bool nagged) {
+ maybe_set (_nagged[nag], nagged);
+ }
+
void changed (Property p = OTHER);
boost::signals2::signal<void (Property)> Changed;
/** Emitted if read() failed on an existing Config file. There is nothing
static void drop ();
static void restore_defaults ();
static bool have_existing (std::string);
+ static boost::filesystem::path config_path ();
private:
Config ();
dcp::NameFormat _dcp_metadata_filename_format;
dcp::NameFormat _dcp_asset_filename_format;
bool _jump_to_selected;
+ bool _nagged[NAG_COUNT];
bool _preview_sound;
/** name of a specific sound output stream to use for preview, or empty to use the default */
boost::optional<std::string> _preview_sound_output;
#include "wx/video_waveform_dialog.h"
#include "wx/save_template_dialog.h"
#include "wx/templates_dialog.h"
+#include "wx/nag_dialog.h"
#include "lib/film.h"
#include "lib/config.h"
#include "lib/util.h"
return;
}
+ NagDialog::maybe_nag (
+ this,
+ Config::NAG_DKDM_CONFIG,
+ wxString::Format (
+ _("You are making a DKDM which is encrypted by a private key held in"
+ "\n\n<tt>%s</tt>\n\nIt is <span weight=\"bold\" size=\"larger\">VITALLY IMPORTANT</span> "
+ "that you <span weight=\"bold\" size=\"larger\">BACK UP THIS FILE</span> since if it is lost "
+ "your DKDMs (and the DCPs they protect) will become useless."), std_to_wx(Config::config_path().string()).data()
+ )
+ );
+
optional<dcp::EncryptedKDM> kdm;
try {
kdm = _film->make_kdm (
--- /dev/null
+/*
+ Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+
+ 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 <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "nag_dialog.h"
+#include "wx_util.h"
+#include <wx/richtext/richtextctrl.h>
+#include <boost/foreach.hpp>
+
+using boost::shared_ptr;
+
+NagDialog::NagDialog (wxWindow* parent, Config::Nag nag, wxString message)
+ : wxDialog (parent, wxID_ANY, _("Important notice"))
+ , _nag (nag)
+{
+ wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
+ _text = new wxStaticText (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (400, 300));
+ sizer->Add (_text, 1, wxEXPAND | wxALL, 6);
+
+ wxCheckBox* b = new wxCheckBox (this, wxID_ANY, _("Don't show this message again"));
+ b->SetValue (true);
+ Config::instance()->set_nagged (_nag, true);
+ sizer->Add (b, 0, wxALL, 6);
+ b->Bind (wxEVT_CHECKBOX, bind (&NagDialog::shut_up, this, _1));
+
+ wxStdDialogButtonSizer* buttons = CreateStdDialogButtonSizer (0);
+ sizer->Add (CreateSeparatedSizer(buttons), wxSizerFlags().Expand().DoubleBorder());
+ buttons->SetAffirmativeButton (new wxButton (this, wxID_OK));
+ buttons->Realize ();
+
+ SetSizer (sizer);
+ sizer->Layout ();
+ sizer->SetSizeHints (this);
+
+ _text->SetLabelMarkup (message);
+}
+
+void
+NagDialog::shut_up (wxCommandEvent& ev)
+{
+ Config::instance()->set_nagged (_nag, ev.IsChecked());
+}
+
+void
+NagDialog::maybe_nag (wxWindow* parent, Config::Nag nag, wxString message)
+{
+ if (!Config::instance()->nagged (nag)) {
+ NagDialog* d = new NagDialog (parent, nag, message);
+ d->ShowModal ();
+ d->Destroy ();
+ }
+}
--- /dev/null
+/*
+ Copyright (C) 2017 Carl Hetherington <cth@carlh.net>
+
+ 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 <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "lib/config.h"
+#include <wx/wx.h>
+
+class wxRichTextCtrl;
+
+class NagDialog : public wxDialog
+{
+public:
+ static void maybe_nag (wxWindow* parent, Config::Nag nag, wxString message);
+
+private:
+ NagDialog (wxWindow* parent, Config::Nag nag, wxString message);
+ void shut_up (wxCommandEvent& ev);
+
+ wxStaticText* _text;
+ Config::Nag _nag;
+};
key_dialog.cc
make_chain_dialog.cc
move_to_dialog.cc
+ nag_dialog.cc
name_format_editor.cc
new_film_dialog.cc
normal_job_view.cc