SOUND,
SOUND_OUTPUT,
INTERFACE_COMPLEXITY,
+ PLAYER_DCP_DIRECTORY,
OTHER
};
}
void set_player_dcp_directory (boost::filesystem::path p) {
- maybe_set (_player_dcp_directory, p);
+ maybe_set (_player_dcp_directory, p, PLAYER_DCP_DIRECTORY);
}
void unset_player_dcp_directory () {
return;
}
_player_dcp_directory = boost::none;
- changed ();
+ changed (PLAYER_DCP_DIRECTORY);
}
void changed (Property p = OTHER);
Bind (wxEVT_MENU, boost::bind (&DOMFrame::forward_frame, this), ID_forward_frame);
UpdateChecker::instance()->StateChanged.connect (boost::bind (&DOMFrame::update_checker_state_changed, this));
+ _controls->DCPDirectorySelected.connect (boost::bind(&DOMFrame::load_dcp, this, _1));
setup_screen ();
}
void setup_screen ()
{
_controls->Show (_mode != Config::PLAYER_MODE_FULL);
+ _controls->show_dcp_directory (_mode == Config::PLAYER_MODE_DUAL);
_info->Show (_mode != Config::PLAYER_MODE_FULL);
_overall_panel->SetBackgroundColour (_mode == Config::PLAYER_MODE_FULL ? wxColour(0, 0, 0) : wxNullColour);
ShowFullScreen (_mode == Config::PLAYER_MODE_FULL);
+/*
+ Copyright (C) 2018 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 "controls.h"
#include "film_viewer.h"
#include "wx_util.h"
#include "lib/job_manager.h"
#include <wx/wx.h>
#include <wx/tglbtn.h>
+#include <wx/listctrl.h>
using std::string;
using boost::optional;
/** @param outline_content true if viewer should present an "outline content" checkbox.
* @param jump_to_selected true if viewer should present a "jump to selected" checkbox.
*/
-Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool outline_content, bool jump_to_selected, bool eye)
+Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool outline_content, bool jump_to_selected, bool eye, bool dcp_directory)
: wxPanel (parent)
, _viewer (viewer)
, _slider_being_moved (false)
_v_sizer->Add (view_options, 0, wxALL, DCPOMATIC_SIZER_GAP);
+ _dcp_directory = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxSize(600, -1), wxLC_REPORT | wxLC_NO_HEADER);
+ _dcp_directory->AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 580);
+ _v_sizer->Add (_dcp_directory, 0, wxALL, DCPOMATIC_SIZER_GAP);
+ _dcp_directory->Show (dcp_directory);
+
wxBoxSizer* h_sizer = new wxBoxSizer (wxHORIZONTAL);
wxBoxSizer* time_sizer = new wxBoxSizer (wxVERTICAL);
_forward_button->Bind (wxEVT_LEFT_DOWN, boost::bind (&Controls::forward_clicked, this, _1));
_frame_number->Bind (wxEVT_LEFT_DOWN, boost::bind (&Controls::frame_number_clicked, this));
_timecode->Bind (wxEVT_LEFT_DOWN, boost::bind (&Controls::timecode_clicked, this));
+ _dcp_directory->Bind (wxEVT_LIST_ITEM_SELECTED, boost::bind (&Controls::dcp_directory_selected, this));
if (_jump_to_selected) {
_jump_to_selected->Bind (wxEVT_CHECKBOX, boost::bind (&Controls::jump_to_selected_clicked, this));
_jump_to_selected->SetValue (Config::instance()->jump_to_selected ());
film_changed ();
setup_sensitivity ();
+ update_dcp_directory ();
JobManager::instance()->ActiveJobsChanged.connect (
bind (&Controls::active_jobs_changed, this, _2)
);
+
+ _config_changed_connection = Config::instance()->Changed.connect (bind(&Controls::config_changed, this, _1));
+}
+
+void
+Controls::config_changed (int property)
+{
+ if (property == Config::PLAYER_DCP_DIRECTORY) {
+ update_dcp_directory ();
+ }
}
void
{
return _film;
}
+
+void
+Controls::show_dcp_directory (bool s)
+{
+ _dcp_directory->Show (s);
+}
+
+void
+Controls::update_dcp_directory ()
+{
+ using namespace boost::filesystem;
+
+ _dcp_directory->DeleteAllItems ();
+ _dcp_directories.clear ();
+ optional<path> dir = Config::instance()->player_dcp_directory();
+ if (!dir) {
+ return;
+ }
+
+ for (directory_iterator i = directory_iterator(*dir); i != directory_iterator(); ++i) {
+ try {
+ if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) {
+ string const x = i->path().string().substr(dir->string().length() + 1);
+ _dcp_directory->InsertItem(_dcp_directory->GetItemCount(), std_to_wx(x));
+ _dcp_directories.push_back(x);
+ }
+ } catch (boost::filesystem::filesystem_error& e) {
+ /* Never mind */
+ }
+ }
+}
+
+void
+Controls::dcp_directory_selected ()
+{
+ long int s = _dcp_directory->GetNextItem (-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ if (s == -1) {
+ return;
+ }
+
+ DCPOMATIC_ASSERT (s < int(_dcp_directories.size()));
+ DCPDirectorySelected (*Config::instance()->player_dcp_directory() / _dcp_directories[s]);
+}
+/*
+ Copyright (C) 2018 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/dcpomatic_time.h"
#include "lib/types.h"
#include "lib/film.h"
class Content;
class PlayerVideo;
class wxToggleButton;
+class wxListCtrl;
class Controls : public wxPanel
{
public:
- Controls (wxWindow* parent, boost::shared_ptr<FilmViewer>, bool outline_content = true, bool jump_to_selected = true, bool eyes = true);
+ Controls (
+ wxWindow* parent,
+ boost::shared_ptr<FilmViewer>,
+ bool outline_content = true,
+ bool jump_to_selected = true,
+ bool eyes = true,
+ bool dcp_directory = false
+ );
boost::shared_ptr<Film> film () const;
void back_frame ();
void forward_frame ();
+ void show_dcp_directory (bool s);
+
+ boost::signals2::signal<void (boost::filesystem::path)> DCPDirectorySelected;
+
private:
void update_position_label ();
void update_position_slider ();
void started ();
void stopped ();
void film_changed ();
+ void update_dcp_directory ();
+ void dcp_directory_changed ();
+ void dcp_directory_selected ();
+ void config_changed (int property);
boost::shared_ptr<Film> _film;
boost::shared_ptr<FilmViewer> _viewer;
wxCheckBox* _outline_content;
wxChoice* _eye;
wxCheckBox* _jump_to_selected;
+ wxListCtrl* _dcp_directory;
+ std::vector<boost::filesystem::path> _dcp_directories;
wxSlider* _slider;
wxButton* _rewind_button;
wxButton* _back_button;
wxToggleButton* _play_button;
ClosedCaptionsDialog* _closed_captions_dialog;
+
+ boost::signals2::scoped_connection _config_changed_connection;
};
/*
- Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "wx_util.h"
#include "editable_list.h"
#include "filter_dialog.h"
-#include "dir_picker_ctrl.h"
#include "file_picker_ctrl.h"
+#include "dir_picker_ctrl.h"
#include "isdcf_metadata_dialog.h"
#include "server_dialog.h"
#include "make_chain_dialog.h"
table->Add (_log_file, wxGBPosition (r, 1));
++r;
+ add_label_to_sizer (table, _panel, _("DCP directory"), true, wxGBPosition (r, 0));
+ _dcp_directory = new wxDirPickerCtrl (_panel, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1));
+ table->Add (_dcp_directory, 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));
_respect_kdm->Bind (wxEVT_CHECKBOX, bind(&PlayerGeneralPage::respect_kdm_changed, this));
_log_file->Bind (wxEVT_FILEPICKER_CHANGED, bind(&PlayerGeneralPage::log_file_changed, this));
+ _dcp_directory->Bind (wxEVT_DIRPICKER_CHANGED, bind(&PlayerGeneralPage::dcp_directory_changed, this));
}
void config_changed ()
if (config->player_log_file()) {
checked_set (_log_file, *config->player_log_file());
}
+ if (config->player_dcp_directory()) {
+ checked_set (_dcp_directory, *config->player_dcp_directory());
+ }
}
private:
Config::instance()->set_player_log_file(wx_to_std(_log_file->GetPath()));
}
+ void dcp_directory_changed ()
+ {
+ Config::instance()->set_player_dcp_directory(wx_to_std(_dcp_directory->GetPath()));
+ }
+
wxChoice* _player_mode;
wxChoice* _image_display;
wxCheckBox* _respect_kdm;
FilePickerCtrl* _log_file;
+ wxDirPickerCtrl* _dcp_directory;
};
wxPreferencesEditor*