Skip to content
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 modal confirmation dialogue when exiting with unsaved changes #50

Closed
gavanderhoorn opened this issue Mar 15, 2016 · 6 comments
Closed

Comments

@gavanderhoorn
Copy link
Member

As per subject: there is no confirmation requested if the user exits the application while there are still unsaved changes.

To avoid losing work - by misclicking fi - the user should be presented with a Save changes to FILENAME before closing? or similar dialogue.

@gavanderhoorn gavanderhoorn added this to the Milestone 1 - URDF GUI Editor milestone Mar 15, 2016
@AndyZe
Copy link
Contributor

AndyZe commented Mar 31, 2016

The tentative plan is to check for changes to the urdf as follows:

  1. Set a flag if qtpropertybrowser.cpp::propertyChanged() is called. That will indicate if a link/joint was created or changed. But it doesn't indicate if a link/joint was deleted
  2. Just prior to exiting, check if the number of links/joints has changed since opening the file. That will indicate if a link/joint has been deleted.

I would have liked liked to use qtpropertybrowser::removeProperty(*) to set a flag, but it's getting called way more often than I expected.

Let me know if that sounds OK, @gavanderhoorn

@gavanderhoorn
Copy link
Member Author

@AndyZelenak: the observer/observable approach was what I had in mind, so this sounds ok. Is propertyChanged() not called for remove actions?

We should probably also watch for changes in the treeviewer, to not miss changes when #26 is implemented.

@AndyZe
Copy link
Contributor

AndyZe commented Apr 4, 2016

@gavanderhoorn OK, I need to check if the tree is reordered. Roger that. Unfortunately propertyChanged() is not called on deletion.

How would you like this flag to be shared between the qt_property_browser and urdf_editor sides? I was thinking I would pass it as an argument to qt_property_browser, e.g. propertyChanged(bool & unsavedChanges).

I guess the other option would be a "global" namespace or class variable.

@gavanderhoorn
Copy link
Member Author

Would it perhaps make sense to not monitor the properties directly, but keep track of the state of the ros_workbench parameter? All other user actions result in changes to that, so tracking it's dirty state should suffice to see whether we need to warn about loosing work at exit.

On the other hand: doing this on the Qt side would avoid introducing an additional dependency on ROS (parameter server).

@gavanderhoorn
Copy link
Member Author

Btw. The QWidget documentation contains an example that shows how to implement exactly what this issue asks for. See QWidget::closeEvent(..).

@gavanderhoorn
Copy link
Member Author

Closed via #74.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants