-
Notifications
You must be signed in to change notification settings - Fork 44
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
Confirmation dialog when closing main window #225
Confirmation dialog when closing main window #225
Conversation
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.
Looks good! I left a couple comments
include/ignition/gui/MainWindow.hh
Outdated
/// \brief Show the confirmation dialog on exit | ||
bool showDialogOnExit{false}; |
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.
New publicly visible data members break ABI, to avoid this you can add it to the MainWindowPrivate
class in MainWindow.cc
and access it using this->dataPtr
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.
Oh my bad, you are right. Thanks for the suggestion.
Check 50ac123:
In order to avoid breaking ABI I added that member variable to MainWindowPrivate
class and it was removed from WindowsConfig
. This change made me move one level up the parsing of the dialog_on_exit
XML node (to Application.cc
). Besides, the dialog_on_exit
XML attribute isn't part of window
XML node anymore (gazebosim/gz-sim@c3d6718).
It ended up not being as tidy as before. PTAL
src/MainWindow.cc
Outdated
@@ -470,6 +477,12 @@ bool WindowConfig::MergeFromXML(const std::string &_windowXml) | |||
} | |||
} | |||
|
|||
// Show dialog on exit | |||
if (auto dialogOnExitElem = winElem->FirstChildElement("dialog_on_exit")) |
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.
In my opinion, I think the confirmation dialog should always appear by default (regardless if <dialog_on_exit>true</dialog_on_exit>
is in gui.config
or not) and when the user does not want the confirmation then they would set <dialog_on_exit>false</dialog_on_exit>
but lets see what others think
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.
I don't have a strong opinion either way. I think it is safer for it to be on by default, but then I checked Gazebo-classic, and it doesn't seem to have a confirmation dialog. So... 🤷♀️
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.
In general I would to stick with the current behaviour and document this new feature. I open and close many times ign-gazebo and this is adding an overhead for me.
Maybe we can discuss in the next ignition meeting
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.
I think that leaving this off by default is the safer option.
Although ignition-gazebo
is the direct consumer of ignition-gui
we probably don't want to change the behavior of all the applications that are developed on top of ignition::gui::Application
(extern projects).
Signed-off-by: Franco Cipollone <[email protected]>
Signed-off-by: Franco Cipollone <[email protected]>
a8367c9
to
50ac123
Compare
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.
Looks good, left a minor comment. Also, there are a couple of tests failing. UNIT_Application_TEST
might be flaky but UNIT_MainWindow_TEST
is seg faulting at MainWindowTest.Constructor
src/Application.cc
Outdated
// Closing behavior. | ||
if (auto dialogOnExitElem = doc.FirstChildElement("dialog_on_exit")) | ||
{ | ||
bool showDialogOnExit{false}; | ||
dialogOnExitElem->QueryBoolText(&showDialogOnExit); | ||
this->dataPtr->mainWin->SetShowDialogOnExit(showDialogOnExit); | ||
} |
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.
I think the previous behavior where <dialog_on_exit>
was in <window>
was better. You can move this section to the above if (auto winElem = doc.FirstChildElement("window"))
and then update this if
to if (auto dialogOnExitElem = winElem->FirstChildElement("dialog_on_exit"))
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.
Agree, from a user perspective it is better to have it within the <window>
node.
Done!
Signed-off-by: Franco Cipollone <[email protected]>
Codecov Report
@@ Coverage Diff @@
## ign-gui3 #225 +/- ##
============================================
+ Coverage 65.56% 65.68% +0.12%
============================================
Files 23 23
Lines 2817 2827 +10
============================================
+ Hits 1847 1857 +10
Misses 970 970
Continue to review full report at Codecov.
|
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.
Thanks for iterating! Can you add a test for codecov? Adding <window>
and <dialog_on_exit>
to test/config/test.config
should suffice. Also, add the new <dialog_on_exit>
element under "Overview" to layout tutorials
Signed-off-by: Franco Cipollone <[email protected]>
Signed-off-by: Franco Cipollone <[email protected]>
Thanks for the quick re-review! |
* Release 3.5.1 (#195) Signed-off-by: Steve Peters <[email protected]> * check_test_ran.py: remove grep/xsltproc (#203) We aren't using QTest anymore in ign-gui, so remove the parts of check_test_ran.py that translated QTest xml files into junit, since they don't work easily on Windows and aren't needed any longer. Fixes #198. Signed-off-by: Steve Peters <[email protected]> * Fixed material specular in scene3D (#218) Signed-off-by: ahcorde <[email protected]> * Remove tools/code_check and update codecov (#222) Signed-off-by: Louise Poubel <[email protected]> * Removed duplicated code with rendering::sceneFromFirstRenderEngine (#223) Signed-off-by: ahcorde <[email protected]> * Emit more events from Scene3D (#213) * Start porting events from ign-gazebo Signed-off-by: Louise Poubel <[email protected]> * Remove test that fails due to #216 Signed-off-by: Louise Poubel <[email protected]> * Move Scene3d_TEST.cc to test/integration There seems to be a problem with loading the ignition-rendering-ogre plugin from the Scene3D test if it links to that plugin. Making Scene3D_TEST.cc into an integration test works because it doesn't directly call any plugin methods. This also changes the linking for the Grid3D plugin to only link to the ignition-rendering core library target instead of the IGNITION-RENDERING_LIBRARIES variable which includes the ogre component library plugins. Signed-off-by: Steve Peters <[email protected]> * process qt events to allow scene to initialize Signed-off-by: Steve Peters <[email protected]> * Add test helper to check event Signed-off-by: Louise Poubel <[email protected]> * added more tests Signed-off-by: ahcorde <[email protected]> * make linters happy Signed-off-by: ahcorde <[email protected]> * Move TestHelper code to .cc file, fix windows? Signed-off-by: Steve Peters <[email protected]> * Fix windows? Signed-off-by: ahcorde <[email protected]> * Fix windows? Signed-off-by: Alejandro Hernández <[email protected]> * Expect values of Vector3 point in click events Signed-off-by: Steve Peters <[email protected]> * Remove debug message Signed-off-by: Steve Peters <[email protected]> * Remove unused variable Signed-off-by: Steve Peters <[email protected]> Co-authored-by: Steve Peters <[email protected]> Co-authored-by: ahcorde <[email protected]> * Avoid grid3D crash (#227) Signed-off-by: ahcorde <[email protected]> * Confirmation dialog when closing main window (#225) * Adds confirmation dialog when closing window * Updates docs and extends test coverage. * Adds dialog_on_exit atribute to example .config Signed-off-by: Franco Cipollone <[email protected]> * update codeowners (#232) Signed-off-by: Jenn Nguyen <[email protected]> * 🎈 3.6.0 (#233) Signed-off-by: Louise Poubel <[email protected]> * Bump required ign-rendering version to 4.8 (#234) Signed-off-by: Louise Poubel <[email protected]> Co-authored-by: Steve Peters <[email protected]> Co-authored-by: Alejandro Hernández Cordero <[email protected]> Co-authored-by: Franco Cipollone <[email protected]> Co-authored-by: Jenn Nguyen <[email protected]>
Signed-off-by: Franco Cipollone [email protected]
🎉 New feature
Related to gazebosim/gz-sim#820
Summary
A new property (
dialog_on_exit
) was added to theWindowConfig
struct to enable displaying a confirmation dialog when exiting the window.In the
.config
file:confirmation_dialog.mp4
Test it
Press the X button or Quit from the menu.
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge