-
Notifications
You must be signed in to change notification settings - Fork 43
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
Support emitting an event on play/pause/step #306
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
7ad0286
share updated GUI ECM info with server on play
adlarkin 34427bd
clarify docs and fix service request type
adlarkin 915a1a6
send event on play/pause/step
adlarkin 7ff16ce
support service and event
adlarkin de55398
fix tests
adlarkin 054d02c
Flip the default settng of usEvent in order to maintain current behav…
d7e2c4f
ignore stats msgs triggered by a step
adlarkin fa47af3
explicit constructor for new gui event
adlarkin 0112b87
remove deprecation notes (support both event and service)
adlarkin 84887d0
test event behavior
adlarkin 4148b9a
add missing helper test class
adlarkin 9dd7250
Merge branch 'ign-gui6' into adlarkin/share_gui_ecm_changes
80a64f4
Disable tests on windows
3cd906c
Merge branch 'ign-gui6' into adlarkin/share_gui_ecm_changes
chapulina 8e7cb8f
Address PR feedback
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,19 @@ | ||
ign_gui_add_plugin(WorldControl | ||
SOURCES | ||
WorldControl.cc | ||
QT_HEADERS | ||
WorldControl.hh | ||
TEST_SOURCES | ||
WorldControl_TEST.cc | ||
) | ||
|
||
if (NOT MSVC) | ||
ign_gui_add_plugin(WorldControl | ||
SOURCES | ||
WorldControl.cc | ||
WorldControlEventListener.cc | ||
QT_HEADERS | ||
WorldControl.hh | ||
WorldControlEventListener.hh | ||
TEST_SOURCES | ||
WorldControl_TEST.cc | ||
) | ||
else() | ||
ign_gui_add_plugin(WorldControl | ||
SOURCES | ||
WorldControl.cc | ||
QT_HEADERS | ||
WorldControl.hh | ||
) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (C) 2021 Open Source Robotics Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#include "WorldControlEventListener.hh" | ||
|
||
using namespace ignition; | ||
using namespace gui; | ||
|
||
WorldControlEventListener::WorldControlEventListener() | ||
{ | ||
ignition::gui::App()->findChild< | ||
ignition::gui::MainWindow *>()->installEventFilter(this); | ||
} | ||
|
||
WorldControlEventListener::~WorldControlEventListener() = default; | ||
|
||
bool WorldControlEventListener::eventFilter(QObject *_obj, QEvent *_event) | ||
{ | ||
if (_event->type() == ignition::gui::events::WorldControl::kType) | ||
{ | ||
auto worldControlEvent = | ||
reinterpret_cast<gui::events::WorldControl *>(_event); | ||
if (worldControlEvent) | ||
{ | ||
this->listenedToPlay = !worldControlEvent->WorldControlInfo().pause(); | ||
this->listenedToPause = worldControlEvent->WorldControlInfo().pause(); | ||
this->listenedToStep = | ||
worldControlEvent->WorldControlInfo().multi_step() > 0u; | ||
} | ||
} | ||
|
||
// Standard event processing | ||
return QObject::eventFilter(_obj, _event); | ||
} |
Oops, something went wrong.
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.
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.
Just curious, why did you need to separate Windows here? We're already disabling the test on Windows in the test's body.
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.
Because Windows would still compile the testing framework and produce compile time errors.
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 see. It was compiling before. Not sure what causes the compiler error here, but I think it's ok to address this later.
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.
As a follow-up, yes,the tests themselves ignore windows. For example: https://github.com/ignitionrobotics/ign-gui/blob/ignition-gui6_6.0.0/src/plugins/world_control/WorldControl_TEST.cc#L66
However, the new helper test class that was added for checking events (#306 (comment)) has to be added as a QT header, or else there will be linking errors. So, it seemed like this new QT header is what was causing issues on windows, and @nkoenig made a patch in #306 (comment) to prevent compiling the helper test class header on windows. I'm not sure if there's a better way to handle this or not, but hopefully that provides some more context/insights about this change.
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 tried a few different options to make the header compile on windows, and gave up.