Automatically set the output filename if the user wants that.

This commit is contained in:
Moritz Bunkus 2004-03-09 16:35:22 +00:00
parent 1b83f04cd5
commit d62e9f5c5e
6 changed files with 50 additions and 10 deletions

View File

@ -1,10 +1,16 @@
2004-03-09 Moritz Bunkus <moritz@bunkus.org>
* mmg: new feature: Automatically set the output file name when
the first file is added to the same name but with a '.mkv'
extension if it hasn't been set yet. Can be disabled on the
'settings' page.
* mkvmerge: bug fix: More of the non-ASCII character fixes (in
--tags and --chapters this time).
* mkvmerge/mmg: new feature: Made the process priority selectable
and default to 'normal' again (was 'lower' before).
on the 'settings' page and default to 'normal' again (was 'lower'
before).
2004-03-07 Moritz Bunkus <moritz@bunkus.org>

View File

@ -1234,12 +1234,25 @@ mmg_dialog::on_window_selected(wxCommandEvent &evt) {
}
void
mmg_dialog::set_title_maybe(const char *new_title) {
if ((strlen(new_title) > 0) &&
mmg_dialog::set_title_maybe(const wxString &new_title) {
if ((new_title.length() > 0) &&
(global_page->tc_title->GetValue().length() == 0))
global_page->tc_title->SetValue(new_title);
}
void
mmg_dialog::set_output_maybe(const wxString &new_output) {
wxString output;
if (settings_page->cb_autoset_output_filename->IsChecked() &&
(new_output.length() > 0) &&
(tc_output->GetValue().length() == 0)) {
output = new_output.BeforeLast('.');
output += ".mkv";
tc_output->SetValue(output);
}
}
IMPLEMENT_CLASS(mmg_dialog, wxFrame);
BEGIN_EVENT_TABLE(mmg_dialog, wxFrame)
EVT_BUTTON(ID_B_BROWSEOUTPUT, mmg_dialog::on_browse_output)

View File

@ -149,7 +149,8 @@ public:
void on_window_selected(wxCommandEvent &evt);
void set_title_maybe(const char *new_title);
void set_title_maybe(const wxString &new_title);
void set_output_maybe(const wxString &new_output);
};
extern mmg_dialog *mdlg;

View File

@ -634,7 +634,8 @@ void tab_input::on_add_file(wxCommandEvent &evt) {
lb_input_files->Append(name);
file.file_name = new wxString(dlg.GetPath());
mdlg->set_title_maybe(file.title->c_str());
mdlg->set_title_maybe(*file.title);
mdlg->set_output_maybe(*file.file_name);
files.push_back(file);
}
}

View File

@ -45,7 +45,7 @@ tab_settings::tab_settings(wxWindow *parent):
wxDefaultSize, 0);
new wxStaticBox(this, -1, wxS("Miscellaneous options"), wxPoint(10, 65),
wxSize(475, 50));
wxSize(475, 75));
new wxStaticText(this, -1, wxS("Process priority:"), wxPoint(15, 85));
cob_priority =
new wxComboBox(this, ID_COB_PRIORITY, wxS(""), wxPoint(120, 85 + YOFF),
@ -60,6 +60,16 @@ tab_settings::tab_settings(wxWindow *parent):
cob_priority->Append(wxS("lower"));
cob_priority->Append(wxS("lowest"));
cb_autoset_output_filename =
new wxCheckBox(this, ID_CB_AUTOSET_OUTPUT_FILENAME,
wxS("Auto-set output filename"), wxPoint(15, 115 + YOFF));
cb_autoset_output_filename->
SetToolTip(wxS("If checked mmg will automatically set the output filename "
"if it hasn't been set already. This happens when you add "
"a file. It will be set to the same name as the "
"input file but with the extension '.mkv'. If unset mmg "
"will not touch the output filename."));
new wxStaticBox(this, -1, wxS("About"), wxPoint(10, 350),
wxSize(475, 104));
@ -100,7 +110,7 @@ tab_settings::on_browse(wxCommandEvent &evt) {
}
void
tab_settings::on_priority_selected(wxCommandEvent &evt) {
tab_settings::on_xyz_selected(wxCommandEvent &evt) {
save_preferences();
}
@ -108,6 +118,7 @@ void
tab_settings::load_preferences() {
wxConfig *cfg = (wxConfig *)wxConfigBase::Get();
wxString priority;
bool b;
int i;
cfg->SetPath(wxS("/GUI"));
@ -124,6 +135,10 @@ tab_settings::load_preferences() {
cob_priority->SetSelection(i);
break;
}
if (!cfg->Read(wxS("autoset_output_filename"), &b))
b = true;
cb_autoset_output_filename->SetValue(b);
}
void
@ -132,6 +147,8 @@ tab_settings::save_preferences() {
cfg->SetPath(wxS("/GUI"));
cfg->Write(wxS("mkvmerge_executable"), tc_mkvmerge->GetValue());
cfg->Write(wxS("process_priority"), cob_priority->GetValue());
cfg->Write(wxS("autoset_output_filename"),
cb_autoset_output_filename->IsChecked());
cfg->Flush();
}
@ -174,5 +191,6 @@ tab_settings::query_mkvmerge_capabilities() {
IMPLEMENT_CLASS(tab_settings, wxPanel);
BEGIN_EVENT_TABLE(tab_settings, wxPanel)
EVT_BUTTON(ID_B_BROWSEMKVMERGE, tab_settings::on_browse)
EVT_COMBOBOX(ID_COB_PRIORITY, tab_settings::on_priority_selected)
EVT_COMBOBOX(ID_COB_PRIORITY, tab_settings::on_xyz_selected)
EVT_CHECKBOX(ID_CB_AUTOSET_OUTPUT_FILENAME, tab_settings::on_xyz_selected)
END_EVENT_TABLE();

View File

@ -25,13 +25,14 @@
#define ID_TC_MKVMERGE 15000
#define ID_B_BROWSEMKVMERGE 15001
#define ID_COB_PRIORITY 15002
#define ID_CB_AUTOSET_OUTPUT_FILENAME 15003
class tab_settings: public wxPanel {
DECLARE_CLASS(tab_settings);
DECLARE_EVENT_TABLE();
public:
wxTextCtrl *tc_mkvmerge;
wxCheckBox *cb_show_commandline;
wxCheckBox *cb_show_commandline, *cb_autoset_output_filename;
wxComboBox *cob_priority;
public:
@ -39,7 +40,7 @@ public:
virtual ~tab_settings();
void on_browse(wxCommandEvent &evt);
void on_priority_selected(wxCommandEvent &evt);
void on_xyz_selected(wxCommandEvent &evt);
void load_preferences();
void save_preferences();