Catch error in openProject, show message and reload old proj
This MR introduces a try-catch block to openProject
, which shows an error message to the user on a failed read from the pet-file as well as loading the old state of PeTrack from before trying to open the new project.
Currently, only BORDER/VALUE
is throwing an exception on a wrong value. This could and should be extended in the future.
To discuss: Currently, when opening an invalid file on a new PeTrack window, the Sequence remains loaded. (This is not the case with an already opened file, as the old sequence will be reloaded). This opens a general question:
If we read a pet-file without a sequence, do we want to unload the current sequence?
Answere: yes, was resolved in !268 (merged)
If so, that would resolve the difference. If not, do we still want to do it in this specific case of loading an invalid project or do we not care?
Closes #369 (closed)
Reviewer Checklist
Formatting
-
the pre-build checks succeed
General code quality
-
naming conventions are met (see .clang-tidy for detailed information) -
no static analyzer warnings in new code parts (e.g., use clang-tidy for checking)
General usability
-
old versions of pet-files are still loadable
Only if changes in UI
-
new elements are also saved and loaded from pet-file -
check if tab order is still correct -
all new SpinBoxes are promoted -
new keybindings added to Petrack::keyBindings()