+2018-01-04 Carl Hetherington <cth@carlh.net>
+
+ * Set up a default KDM write mode and preselect the last used
+ one when re-opening the KDM window (#1137).
+
2018-01-03 Carl Hetherington <cth@carlh.net>
* Version 2.11.35 released.
}
_sound = false;
_sound_output = optional<string> ();
+ _last_kdm_write_type = KDM_WRITE_FLAT;
/* I think the scaling factor here should be the ratio of the longest frame
encode time to the shortest; if the thread count is T, longest time is L
_cover_sheet = f.optional_string_child("CoverSheet").get();
}
_last_player_load_directory = f.optional_string_child("LastPlayerLoadDirectory");
+ if (f.optional_string_child("LastKDMWriteType")) {
+ if (f.optional_string_child("LastKDMWriteType").get() == "flat") {
+ _last_kdm_write_type = KDM_WRITE_FLAT;
+ } else if (f.optional_string_child("LastKDMWriteType").get() == "folder") {
+ _last_kdm_write_type = KDM_WRITE_FOLDER;
+ } else if (f.optional_string_child("LastKDMWriteType").get() == "zip") {
+ _last_kdm_write_type = KDM_WRITE_ZIP;
+ }
+ }
_frames_in_memory_multiplier = f.optional_number_child<int>("FramesInMemoryMultiplier").get_value_or(3);
/* Replace any cinemas from config.xml with those from the configured file */
if (_last_player_load_directory) {
root->add_child("LastPlayerLoadDirectory")->add_child_text(_last_player_load_directory->string());
}
+ if (_last_kdm_write_type) {
+ switch (_last_kdm_write_type.get()) {
+ case KDM_WRITE_FLAT:
+ root->add_child("LastKDMWriteType")->add_child_text("flat");
+ break;
+ case KDM_WRITE_FOLDER:
+ root->add_child("LastKDMWriteType")->add_child_text("folder");
+ break;
+ case KDM_WRITE_ZIP:
+ root->add_child("LastKDMWriteType")->add_child_text("zip");
+ break;
+ }
+ }
/* [XML] FramesInMemoryMultiplier value to multiply the encoding threads count by to get the maximum number of
frames to be held in memory at once.
*/
return _last_player_load_directory;
}
+ enum KDMWriteType {
+ KDM_WRITE_FLAT,
+ KDM_WRITE_FOLDER,
+ KDM_WRITE_ZIP
+ };
+
+ boost::optional<KDMWriteType> last_kdm_write_type () const {
+ return _last_kdm_write_type;
+ }
+
int frames_in_memory_multiplier () const {
return _frames_in_memory_multiplier;
}
maybe_set (_last_player_load_directory, d);
}
+ void set_last_kdm_write_type (KDMWriteType t) {
+ maybe_set (_last_kdm_write_type, t);
+ }
+
void unset_sound_output () {
if (!_sound_output) {
return;
boost::optional<std::string> _sound_output;
std::string _cover_sheet;
boost::optional<boost::filesystem::path> _last_player_load_directory;
+ boost::optional<KDMWriteType> _last_kdm_write_type;
int _frames_in_memory_multiplier;
/** Singleton instance, or 0 */
table->Add (_email, 1, wxEXPAND);
table->AddSpacer (0);
+ switch (Config::instance()->last_kdm_write_type().get_value_or(Config::KDM_WRITE_FLAT)) {
+ case Config::KDM_WRITE_FLAT:
+ _write_flat->SetValue (true);
+ break;
+ case Config::KDM_WRITE_FOLDER:
+ _write_folder->SetValue (true);
+ break;
+ case Config::KDM_WRITE_ZIP:
+ _write_zip->SetValue (true);
+ break;
+ }
+
_write_to->SetValue (true);
- _write_to->Bind (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
- _email->Bind (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+ _write_to->Bind (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+ _email->Bind (wxEVT_CHECKBOX, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
+ _write_flat->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
+ _write_folder->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
+ _write_zip->Bind (wxEVT_RADIOBUTTON, boost::bind (&KDMOutputPanel::kdm_write_type_changed, this));
SetSizer (table);
}
_write_zip->Enable (write);
}
+void
+KDMOutputPanel::kdm_write_type_changed ()
+{
+ if (_write_flat->GetValue()) {
+ Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_FLAT);
+ } else if (_write_folder->GetValue()) {
+ Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_FOLDER);
+ } else if (_write_zip->GetValue()) {
+ Config::instance()->set_last_kdm_write_type (Config::KDM_WRITE_ZIP);
+ }
+}
+
pair<shared_ptr<Job>, int>
KDMOutputPanel::make (
list<ScreenKDM> screen_kdms, string name, KDMTimingPanel* timing, function<bool (boost::filesystem::path)> confirm_overwrite, shared_ptr<Log> log
);
private:
+ void kdm_write_type_changed ();
+
wxChoice* _type;
NameFormatEditor* _container_name_format;
NameFormatEditor* _filename_format;