mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2025-01-18 16:04:52 +00:00
mmg: show error message for invalid frame/field or chapter splitting args
This commit is contained in:
parent
3bf5ed5c00
commit
8919a7deb1
@ -607,15 +607,33 @@ tab_global::is_valid_split_timecode_list() {
|
||||
|
||||
bool
|
||||
tab_global::is_valid_split_frame_list() {
|
||||
auto show_error = [&]() -> bool {
|
||||
wxMessageBox(Z("The format of the split argument is invalid."), Z("mkvmerge GUI error"), wxOK | wxCENTER | wxICON_ERROR);
|
||||
return false;
|
||||
};
|
||||
|
||||
if (cob_split_args->GetValue().IsEmpty())
|
||||
return show_error();
|
||||
|
||||
uint64_t value;
|
||||
std::vector<wxString> parts = split(cob_split_args->GetValue(), wxString(wxT(",")));
|
||||
for (auto &part : parts)
|
||||
if (!parse_number(wxMB(part), value) || !value)
|
||||
return false;
|
||||
return show_error();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
tab_global::is_valid_split_chapters_list() {
|
||||
auto value = cob_split_args->GetValue();
|
||||
if ((value == wxT("all")) || wxRegEx{wxT("^[[:digit:]]+(,[[:digit:]])*$")}.Matches(value))
|
||||
return true;
|
||||
|
||||
wxMessageBox(Z("The format of the split argument is invalid."), Z("mkvmerge GUI error"), wxOK | wxCENTER | wxICON_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
tab_global::validate_settings() {
|
||||
auto idx = cob_split_mode->GetSelection();
|
||||
@ -623,7 +641,8 @@ tab_global::validate_settings() {
|
||||
if ( ((1 == idx) && !is_valid_split_size())
|
||||
|| ((2 == idx) && !is_valid_split_timecode(cob_split_args->GetValue()))
|
||||
|| ((3 == idx) && !is_valid_split_timecode_list())
|
||||
|| ((5 == idx) && !is_valid_split_frame_list()))
|
||||
|| ((5 == idx) && !is_valid_split_frame_list())
|
||||
|| ((6 == idx) && !is_valid_split_chapters_list()))
|
||||
return false;
|
||||
|
||||
int64_t dummy_i;
|
||||
|
@ -69,6 +69,7 @@ public:
|
||||
bool is_valid_split_timecode(wxString s);
|
||||
bool is_valid_split_timecode_list();
|
||||
bool is_valid_split_frame_list();
|
||||
bool is_valid_split_chapters_list();
|
||||
void enable_split_controls();
|
||||
|
||||
void translate_ui();
|
||||
|
Loading…
Reference in New Issue
Block a user