qt: Fixes to the process for selecting an existing hdd image #3086
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
In settings -> hdd selection -> existing disk, when you type a filename then select specify, you'll get an error about the file not existing. Sometimes the dialog will still appear for selection, but this seems to vary a little by OS.
The message is mainly because once the file entry loses focus (
editingFinished
signal) it's connected tofileSelected
which then connects toonExistingFileSelected
. The file does need to be checked once selected and I believe that was the intent. However, the way the signals are wired up you can actually wind up with the check happening twice: once before selection and once after selection.I tried to go for a minimal fix without too much impact to the existing logic (which could use some updating, really). I did this by allowing the function to differentiate between the signal received when focus is lost (
editingFinished
) and when a file is actually selected from a dialog (fileSelected
). Now, if you type in an existing image name and then tab out or otherwise remove focus, the CHS / size fields are correctly auto-populated. If the image name does not exist, there is no error dialog displayed. However, the OK button is not enabled, requiring a manual selection.Additionally, there was another bug where the CHS selection was supposed to be disabled when selecting an existing image. Another event (
on_comboBoxFormat_currentIndexChanged
) caused it to get re-enabled. This was fixed by moving the section in the constructor to after that event fires (combo box being populated).Checklist
References
N/A