-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add confirmation dialogue on exit with unsaved changes. #74
Conversation
This might not detect if the tree gets reordered, but I can't test that since it's not implemented yet (Issue #26). I'm thinking we should create a new issue for that |
Hi Andy, thanks for the PR. I test it on top of #73 and it works as described. As you write, we can't test reordering, as it isn't there yet. A general note: do you think it would be possible to change your implementation slightly and have the confirmation dialogue shown before the main UI is hidden? Functionally it would all remain the same, but without the main UI the dialogue seems to 'come out of nowhere', which seems a bit strange. I'm guessing an implementation as shown in the |
Another advantage of catching the close event would be that we can add the ability to cancel closing the application from the confirmation dialogue. |
@@ -272,8 +278,10 @@ namespace urdf_editor | |||
addJoint(sel); | |||
} | |||
} | |||
else | |||
else // Remove |
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.
is this a comment that should be removed, or do you feel the else
branch should be removed?
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.
That was just a comment, since this is the converse of "Add". But I'll remove it, since that is confusing
Another general comment: would it make sense to define some additional slots (in That way we'd avoid having to add lines that update |
@gavanderhoorn I've talked to several people and they recommended removing the confirmation after "Save As." It was just one too many boxes to click through. I think I will include that in the next commit. |
@gavanderhoorn Please clarify about QWidget::closeEvent(..). We already have URDFEditor::on_actionE_xit_triggered (sic). Is that where you want me to catch the close? on_actionE_xit_triggered is only called from File-->Exit. It's not called if you quit by clicking the X. |
29a146b looks very nice, thanks. As to The close event will also be triggered by A more complete example is shown in the Application Example. The |
@AndyZelenak wrote:
ok. I found the lack of confirmation more annoying, but perhaps we should only popup a dialogue when saving was not successful. Wrt |
@gavanderhoorn I think this has everything. I'll rebase & squash tomorrow if you don't accept it before then. |
if (reply == QMessageBox::Cancel) | ||
return false; | ||
if (reply == QMessageBox::No) | ||
return true; |
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.
Indentation seems to be off here. ROS C++ style is 2 spaces per level.
commit f7d6a77 Author: Andy Zelenak <andyz@utexas.edu> Date: Mon Apr 11 17:07:36 2016 -0600 Add dialog box when exiting with unsaved changes. Issue #50 commit 37b7d9c Author: Andy Zelenak <andyz@utexas.edu> Date: Mon Apr 11 16:03:14 2016 -0600 Detecting all new joints/links, all deletes, and all changes. Reordering may not be detected.
Thanks for rebasing @AndyZelenak, that saved me some work. There is still one minor issue: cancelling the 'save as' dialogue opened by clicking That should be just some shuffling around of the if/else clauses/bodies, so we can ticket that and fix it later. |
I've just manually merged this PR to include some minor changes and to rebase it on current Thanks for this @AndyZelenak, appreciated 👍. |
commit f7d6a77
Author: Andy Zelenak andyz@utexas.edu
Date: Mon Apr 11 17:07:36 2016 -0600
commit 37b7d9c
Author: Andy Zelenak andyz@utexas.edu
Date: Mon Apr 11 16:03:14 2016 -0600