swaroop: remove SPL editing from player UI.
authorCarl Hetherington <cth@carlh.net>
Thu, 15 Nov 2018 23:59:05 +0000 (23:59 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 22 Nov 2018 23:26:27 +0000 (23:26 +0000)
src/lib/config.cc
src/lib/config.h
src/wx/controls.cc
src/wx/controls.h

index 1a503ad..489e66d 100644 (file)
@@ -176,7 +176,6 @@ Config::set_defaults ()
        _player_watermark_theatre = "";
        _player_watermark_period = 1;
        _player_watermark_duration = 50;
-       _allow_spl_editing = true;
        _player_lock_file = boost::none;
 #endif
 
@@ -529,7 +528,6 @@ try
        BOOST_FOREACH (cxml::ConstNodePtr i, f.node_children("RequiredMonitor")) {
                _required_monitors.push_back(Monitor(i));
        }
-       _allow_spl_editing = f.optional_bool_child("AllowSPLEditing").get_value_or(true);
        _player_lock_file = f.optional_string_child("PlayerLockFile");
 #endif
 
@@ -943,7 +941,6 @@ Config::write_config () const
        BOOST_FOREACH (Monitor i, _required_monitors) {
                i.as_xml(root->add_child("RequiredMonitor"));
        }
-       root->add_child("AllowSPLEditing")->add_child_text(_allow_spl_editing ? "1" : "0");
        if (_player_lock_file) {
                root->add_child("PlayerLockFile")->add_child_text(_player_lock_file->string());
        }
index dd20b58..0e5f9df 100644 (file)
@@ -530,10 +530,6 @@ public:
        }
 #endif
 
-       bool allow_spl_editing () const {
-               return _allow_spl_editing;
-       }
-
        /* SET (mostly) */
 
        void set_master_encoding_threads (int n) {
@@ -1038,10 +1034,6 @@ public:
        }
 #endif
 
-       void set_allow_spl_editing (bool s) {
-               maybe_set (_allow_spl_editing, s);
-       }
-
        void changed (Property p = OTHER);
        boost::signals2::signal<void (Property)> Changed;
        /** Emitted if read() failed on an existing Config file.  There is nothing
@@ -1248,7 +1240,6 @@ private:
        /** a file which, if specified, must be present for the player to work */
        boost::optional<boost::filesystem::path> _player_lock_file;
 #endif
-       bool _allow_spl_editing;
 
        static int const _current_version;
 
index 2d28077..5fa8d71 100644 (file)
@@ -108,15 +108,6 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor
        _current_spl_view->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 580);
        e_sizer->Add (_current_spl_view, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
 
-       wxBoxSizer* buttons_sizer = new wxBoxSizer (wxVERTICAL);
-       _add_button = new wxButton(this, wxID_ANY, _("Add"));
-       buttons_sizer->Add (_add_button);
-       _save_button = new wxButton(this, wxID_ANY, _("Save..."));
-       buttons_sizer->Add (_save_button);
-       _load_button = new wxButton(this, wxID_ANY, _("Load..."));
-       buttons_sizer->Add (_load_button);
-       e_sizer->Add (buttons_sizer, 0, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
-
        _v_sizer->Add (e_sizer, 1, wxEXPAND);
 
        _log = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1, 200), wxTE_READONLY | wxTE_MULTILINE);
@@ -125,9 +116,6 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor
        _content_view->Show (false);
        _spl_view->Show (false);
        _current_spl_view->Show (false);
-       _add_button->Show (false);
-       _save_button->Show (false);
-       _load_button->Show (false);
        _log->Show (false);
 
        wxBoxSizer* h_sizer = new wxBoxSizer (wxHORIZONTAL);
@@ -183,9 +171,6 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor
                _jump_to_selected->Bind (wxEVT_CHECKBOX, boost::bind (&Controls::jump_to_selected_clicked, this));
                _jump_to_selected->SetValue (Config::instance()->jump_to_selected ());
        }
-       _add_button->Bind       (wxEVT_BUTTON,              boost::bind(&Controls::add_clicked, this));
-       _save_button->Bind      (wxEVT_BUTTON,              boost::bind(&Controls::save_clicked, this));
-       _load_button->Bind      (wxEVT_BUTTON,              boost::bind(&Controls::load_clicked, this));
 
        _viewer->PositionChanged.connect (boost::bind(&Controls::position_changed, this));
        _viewer->Started.connect (boost::bind(&Controls::started, this));
@@ -206,56 +191,6 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor
        config_changed (Config::OTHER);
 }
 
-void
-Controls::add_clicked ()
-{
-       shared_ptr<Content> sel = _content_view->selected()->clone();
-       DCPOMATIC_ASSERT (sel);
-       _film->examine_and_add_content (sel);
-       bool const ok = display_progress (_("DCP-o-matic"), _("Loading DCP"));
-       if (!ok || !report_errors_from_last_job(this)) {
-               return;
-       }
-       add_content_to_list (sel, _current_spl_view);
-       setup_sensitivity ();
-}
-
-void
-Controls::save_clicked ()
-{
-       wxFileDialog* d = new wxFileDialog (
-               this, _("Select playlist file"), wxEmptyString, wxEmptyString, wxT ("XML files (*.xml)|*.xml"),
-               wxFD_SAVE | wxFD_OVERWRITE_PROMPT
-               );
-
-       if (d->ShowModal() == wxID_OK) {
-               boost::filesystem::path p(wx_to_std(d->GetPath()));
-               _film->set_name(p.stem().string());
-               _film->write_metadata(p);
-       }
-
-       d->Destroy ();
-}
-
-void
-Controls::load_clicked ()
-{
-       wxFileDialog* d = new wxFileDialog (
-               this, _("Select playlist file"), wxEmptyString, wxEmptyString, wxT ("XML files (*.xml)|*.xml")
-               );
-
-       if (d->ShowModal() == wxID_OK) {
-               _film->read_metadata (boost::filesystem::path(wx_to_std(d->GetPath())));
-               _current_spl_view->DeleteAllItems ();
-               BOOST_FOREACH (shared_ptr<Content> i, _film->content()) {
-                       shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(i);
-                       add_content_to_list (dcp, _current_spl_view);
-               }
-       }
-
-       d->Destroy ();
-}
-
 void
 Controls::config_changed (int property)
 {
@@ -504,9 +439,6 @@ Controls::setup_sensitivity ()
        if (_eye) {
                _eye->Enable (c && _film->three_d ());
        }
-
-       _add_button->Enable (Config::instance()->allow_spl_editing() && static_cast<bool>(_content_view->selected()));
-       _save_button->Enable (Config::instance()->allow_spl_editing());
 }
 
 void
@@ -576,40 +508,9 @@ Controls::show_extended_player_controls (bool s)
        }
        _current_spl_view->Show (s);
        _log->Show (s);
-       _add_button->Show (s);
-       _save_button->Show (s);
-       _load_button->Show (s);
        _v_sizer->Layout ();
 }
 
-void
-Controls::add_content_to_list (shared_ptr<Content> content, wxListCtrl* ctrl)
-{
-       int const N = ctrl->GetItemCount();
-
-       wxListItem it;
-       it.SetId(N);
-       it.SetColumn(0);
-       DCPTime length = content->length_after_trim (_film);
-       int h, m, s, f;
-       length.split (24, h, m, s, f);
-       it.SetText(wxString::Format("%02d:%02d:%02d", h, m, s));
-       ctrl->InsertItem(it);
-
-       shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent>(content);
-       if (dcp && dcp->content_kind()) {
-               it.SetId(N);
-               it.SetColumn(1);
-               it.SetText(std_to_wx(dcp::content_kind_to_string(*dcp->content_kind())));
-               ctrl->SetItem(it);
-       }
-
-       it.SetId(N);
-       it.SetColumn(2);
-       it.SetText(std_to_wx(content->summary()));
-       ctrl->SetItem(it);
-}
-
 void
 Controls::add_playlist_to_list (shared_ptr<Film> film)
 {
index 59fe4e5..3bb9636 100644 (file)
@@ -90,10 +90,6 @@ private:
        void pause_clicked ();
        void stop_clicked ();
 #endif
-       void add_clicked ();
-       void save_clicked ();
-       void load_clicked ();
-       void add_content_to_list (boost::shared_ptr<Content> content, wxListCtrl* list);
        void add_playlist_to_list (boost::shared_ptr<Film> film);
 
        boost::shared_ptr<Film> _film;
@@ -110,9 +106,6 @@ private:
        wxListCtrl* _spl_view;
        wxListCtrl* _current_spl_view;
        wxTextCtrl* _log;
-       wxButton* _add_button;
-       wxButton* _save_button;
-       wxButton* _load_button;
        std::vector<boost::shared_ptr<Film> > _playlists;
        wxSlider* _slider;
        wxButton* _rewind_button;