diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-09-14 23:07:34 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2020-09-14 23:07:34 +0200 |
| commit | 50aaa3789864c7330ee92e7e89ad5b6cc2155a82 (patch) | |
| tree | 7d35c91793d7b82494dc62a476fceadfc15abf82 /src | |
| parent | e3c78ffdb5e562841e86e6f59a20494159c44de7 (diff) | |
Don't allow creation of a new film with no name. Otherwise we try
to write metadata to the "create in folder" directory, which throws
an uncaught exception if the specified directory is unwriteable.
If we have a name then DoM tries to create the directory with that name,
which fails more elegantly and with a nicer error.
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/film_name_location_dialog.cc | 16 | ||||
| -rw-r--r-- | src/wx/film_name_location_dialog.h | 3 |
2 files changed, 17 insertions, 2 deletions
diff --git a/src/wx/film_name_location_dialog.cc b/src/wx/film_name_location_dialog.cc index 0cc406d02..2c9b165d0 100644 --- a/src/wx/film_name_location_dialog.cc +++ b/src/wx/film_name_location_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -76,8 +76,22 @@ FilmNameLocationDialog::FilmNameLocationDialog (wxWindow* parent, wxString title } layout (); + + _name->Bind (wxEVT_TEXT, bind(&FilmNameLocationDialog::setup_sensitivity, this)); + setup_sensitivity (); +} + + +void +FilmNameLocationDialog::setup_sensitivity () +{ + wxButton* ok = dynamic_cast<wxButton *>(FindWindowById(wxID_OK, this)); + if (ok) { + ok->Enable (!_name->GetValue().IsEmpty()); + } } + void FilmNameLocationDialog::use_template_clicked () { diff --git a/src/wx/film_name_location_dialog.h b/src/wx/film_name_location_dialog.h index f2f082680..d50ed3b52 100644 --- a/src/wx/film_name_location_dialog.h +++ b/src/wx/film_name_location_dialog.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net> + Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net> This file is part of DCP-o-matic. @@ -40,6 +40,7 @@ public: private: void use_template_clicked (); + void setup_sensitivity (); wxTextCtrl* _name; #ifdef DCPOMATIC_USE_OWN_PICKER |
