-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set default suffix in "Save as..." file save dialog #2230
Conversation
After a cup of sufficiently strong coffee I realise that this should be fixed on the other save dialogues too so I'll expand on this pull request. |
@zonkmachine Nice work, and good catch on the other save dialogs Are you able to test windows builds using wine? Hopefully we are not too far way from releasing test builds where full testing under windows will take place. |
@curlymorphic Thanks!
No. It's a miracle that I manage to compile anything at all. Building under, or for, Wine are too many alien elements for me right now. I've caught some of the cases now but I don't quite know what to do when the suffix is selected after the file dialogue calls exec() |
To sum up the work so far. ✔️ Save As... Fixed |
644d56d
to
fb8bbc5
Compare
Since we do the work for the .mpt outside of the sfd.exec() the default suffix is added so we need to remove it first. I'll go shopping for a better method but for now .mmp and .mmpz works. |
This should maybe be done in VersionedSaveDialog() but I can't wrap my grey matter around it. As an example I give you this instead. |
Here's an old commit where I tried to tackle a somewhat similar problem 7a03353 (yeah, it's ugly) |
As I understand it that part is for avoiding adding the suffix if the user has already typed it in. I basically just tossed a message box in there after the output file name is done to test for duplicates. |
Since we're using Qt's dialog, it should be identical across platforms.
Agreed. |
No. We set
Maybe handle it under #1834 then and just settle for a more temporary fix for now? |
@zonkmachine if overwrite prompting is going to continue to be a problem moving forward, can we permanently patch in this prompt directly in the |
Looking into it. |
Nope. I can't wrap my head around that one. |
8c45c1f
to
4da73f3
Compare
a8bd754
to
0c62b7a
Compare
@tresf I don't know how to proceed with this one. The PR still works and I've updated it but haven't done anything more to it.
Add to #1834 and fix later? |
{ | ||
QMessageBox mb; | ||
mb.setWindowTitle( tr( "Save project" ) ); | ||
mb.setText( fname + tr( ".mpt already exists. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably shouldn't translate the .mpt
portion
In short, yes, this technique is our only technique. I find people's answer on this to be utter bullshit. Native common dialogs handle these things all the time and Qt should too. Anyway, yes, this is the right approach. Only criticism I have is we should probably consolidate as much of this logic into a single, static (or perhaps not static if it makes sense) in a helper function (reduces complexity as well as the number of language translations as well). |
Yes, they all use |
This time specifically I was speaking about a single, static function to reduce the redundancy in code, e.g. a helper to make a centralized location to test |
@zonkmachine what's the status on this? Can this still be done for 1.2 or should we move the milestone? |
9f60b29
to
1fa761e
Compare
The status is that the code works and is up to date but adds some redundancy and I don't know how to remedy that. |
1fa761e
to
c7b3a39
Compare
Done! Maybe test it a bit first though... 😉 |
c7b3a39
to
b7ca747
Compare
@tresf I've moved the redundant code to a function in versionedFileDialog. Tested and I'm happy with it. Merge? |
@zonkmachine I'll have to defer the decision to merge to someone else. The squash erased the context of my original questions and I don't have time to review thoroughly. If you are happy with it please feel free to merge on your own. |
A bit of an oops there... I'll merge this then. |
When you "save as..." without adding suffix manually, LMMS will add a suffix but not test if the file "name + suffix" exists and will gladly write over an existing file.
This is true on Ubuntu Mate at least.
This patch adds suffix mmp/mmpz as default to VersionedSaveDialog when called in saveProjectAs() which fixes the issue.
When I searched the issue I got the impression that this could be mostly a Linux thing but I have not possibility to test on any other OS.