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

Fix splash screen and help panel #277

Merged
merged 8 commits into from
Jun 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions rviz_common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,10 @@ configure_file(src/rviz_common/env_config.cpp.in ${ENV_CONFIG_CPP} @ONLY)
set(rviz_common_headers_to_moc
${ENV_CONFIG_HPP}
src/rviz_common/add_display_dialog.hpp
# src/rviz_common/help_panel.hpp
src/rviz_common/help_panel.hpp
include/rviz_common/properties/enum_property.hpp
include/rviz_common/properties/property_tree_widget.hpp
include/rviz_common/properties/splitter_handle.hpp
# src/rviz_common/selection_panel.hpp
include/rviz_common/display_group.hpp
include/rviz_common/frame_position_tracking_view_controller.hpp
include/rviz_common/properties/quaternion_property.hpp
Expand Down Expand Up @@ -142,7 +141,7 @@ set(rviz_common_source_files
src/rviz_common/failed_view_controller.cpp
src/rviz_common/frame_manager.cpp
src/rviz_common/frame_position_tracking_view_controller.cpp
# src/rviz_common/help_panel.cpp
src/rviz_common/help_panel.cpp
src/rviz_common/load_resource.cpp
src/rviz_common/loading_dialog.cpp
src/rviz_common/logging.cpp
Expand Down Expand Up @@ -288,6 +287,16 @@ install(
DESTINATION "share/${PROJECT_NAME}"
)

install(
DIRECTORY "${CMAKE_SOURCE_DIR}/images"
DESTINATION "share/${PROJECT_NAME}"
)

install(
DIRECTORY "${CMAKE_SOURCE_DIR}/help"
DESTINATION "share/${PROJECT_NAME}"
)

if(BUILD_TESTING)
# TODO(wjwwood): replace this with ament_lint_auto() and/or add the copyright linter back
find_package(ament_cmake_cppcheck REQUIRED)
Expand Down
10 changes: 5 additions & 5 deletions rviz_common/default.rviz
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Panels:
Expanded:
# - /2D Pose Estimate1
# - /2D Nav Goal1
# - /Publish Point1
- /Publish Point1
Name: Tool Properties
Splitter Ratio: 0.588679
- Class: rviz_common/Views
Expand Down Expand Up @@ -60,14 +60,14 @@ Visualization Manager:
- Class: rviz_default_plugins/MoveCamera
- Class: rviz_default_plugins/Select
# - Class: rviz/FocusCamera
# - Class: rviz/Measure
- Class: rviz_default_plugins/Measure
# - Class: rviz/SetInitialPose
# Topic: /initialpose
# - Class: rviz/SetGoal
# Topic: /move_base_simple/goal
# - Class: rviz/PublishPoint
# Single click: true
# Topic: /clicked_point
- Class: rviz_default_plugins/PublishPoint
Single click: true
Topic: /clicked_point
Value: true
Views:
Current:
Expand Down
174 changes: 87 additions & 87 deletions rviz/help/help.html → rviz_common/help/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,28 @@ <h2>Key controls</h2>

<h3>Switching between tools</h3>
<p>
<em>These controls work in all modes.</em>
<em>These controls work in all modes, except for tools capturing all keys (Select tool).</em>
<table border="0" cellspacing="0" cellpadding="3">
<tr class="odd">
<td class="key">M</td>
<td>Switch to the Move-Camera tool.</td>
</tr>
<tr class="even">
<td class="key">I</td>
<td>Switch to the Interact tool.</td>
</tr>
<tr class="odd">
<!--<td class="key">I</td>-->
<!--<td>Switch to the Interact tool.</td>-->
<!--</tr>-->
<!--<tr class="odd">-->
<td class="key">S</td>
<td>Switch to the Select tool.</td>
</tr>
<tr class="even">
<td class="key">G</td>
<td>Switch to the 2D Nav Goal tool.</td>
</tr>
<tr class="odd">
<td class="key">P</td>
<td>Switch to the 2D Pose Estimate tool.</td>
</tr>
<!--<tr class="even">-->
<!--<td class="key">G</td>-->
<!--<td>Switch to the 2D Nav Goal tool.</td>-->
<!--</tr>-->
<!--<tr class="odd">-->
<!--<td class="key">P</td>-->
<!--<td>Switch to the 2D Pose Estimate tool.</td>-->
<!--</tr>-->
</table>
</p>

Expand Down Expand Up @@ -73,7 +73,7 @@ <h3>Modifying Displays list</h3>
<p>
<table border="0" cellspacing="0" cellpadding="3">
<tr class="odd">
<td class="key">Ctrl-A</td>
<td class="key">Ctrl-N</td>
<td>Add a display</td>
</tr>
<tr class="even">
Expand Down Expand Up @@ -138,81 +138,81 @@ <h3>Orbit view controller</h3>
</table>
</p>

<h3>XYOrbit view controller</h3>
<p>
<em>
Similar to the Orbit view controller, but the focal point is kept
on the Z=0 (ground) plane.
</em>
<table border="0" cellspacing="0" cellpadding="3">
<tr class="odd">
<td class="key">Left</td>
<td>Drag to rotate around the focal point.</td>
</tr>
<tr class="even">
<td><div class="key">Middle</div> or<div class="key">Shift-Left</div></td>
<td>Drag to move the focal point in the ground plane.</td>
</tr>
<tr class="odd">
<td class="key">Scroll Wheel</td>
<td>Roll up or down to zoom towards or away from the focal point.</td>
</tr>
<tr class="even">
<td class="key">Right</td>
<td>Drag up or down to zoom towards or away from the focal point.</td>
</tr>
</table>
</p>
<!--<h3>XYOrbit view controller</h3>-->
<!--<p>-->
<!--<em>-->
<!--Similar to the Orbit view controller, but the focal point is kept-->
<!--on the Z=0 (ground) plane.-->
<!--</em>-->
<!--<table border="0" cellspacing="0" cellpadding="3">-->
<!--<tr class="odd">-->
<!--<td class="key">Left</td>-->
<!--<td>Drag to rotate around the focal point.</td>-->
<!--</tr>-->
<!--<tr class="even">-->
<!--<td><div class="key">Middle</div> or<div class="key">Shift-Left</div></td>-->
<!--<td>Drag to move the focal point in the ground plane.</td>-->
<!--</tr>-->
<!--<tr class="odd">-->
<!--<td class="key">Scroll Wheel</td>-->
<!--<td>Roll up or down to zoom towards or away from the focal point.</td>-->
<!--</tr>-->
<!--<tr class="even">-->
<!--<td class="key">Right</td>-->
<!--<td>Drag up or down to zoom towards or away from the focal point.</td>-->
<!--</tr>-->
<!--</table>-->
<!--</p>-->

<h3>FPS view controller</h3>
<p>
<em>
Inspired by first-person shooter games. Drag to point your head.
</em>
<table border="0" cellspacing="0" cellpadding="3">
<tr class="odd">
<td class="key">Left</td>
<td>Dragging rotates the viewpoint in the direction of the drag.</td>
</tr>
<tr class="even">
<td><div class="key">Middle</div> or<div class="key">Shift-Left</div></td>
<td>Drag to strafe (translate) left/right and up/down.</td>
</tr>
<tr class="odd">
<td class="key">Scroll Wheel</td>
<td>Roll up or down to move the viewpoint forwards or back.</td>
</tr>
<tr class="even">
<td class="key">Right</td>
<td>Drag up or down to move the viewport forwards or back.</td>
</tr>
</table>
</p>
<!--<h3>FPS view controller</h3>-->
<!--<p>-->
<!--<em>-->
<!--Inspired by first-person shooter games. Drag to point your head.-->
<!--</em>-->
<!--<table border="0" cellspacing="0" cellpadding="3">-->
<!--<tr class="odd">-->
<!--<td class="key">Left</td>-->
<!--<td>Dragging rotates the viewpoint in the direction of the drag.</td>-->
<!--</tr>-->
<!--<tr class="even">-->
<!--<td><div class="key">Middle</div> or<div class="key">Shift-Left</div></td>-->
<!--<td>Drag to strafe (translate) left/right and up/down.</td>-->
<!--</tr>-->
<!--<tr class="odd">-->
<!--<td class="key">Scroll Wheel</td>-->
<!--<td>Roll up or down to move the viewpoint forwards or back.</td>-->
<!--</tr>-->
<!--<tr class="even">-->
<!--<td class="key">Right</td>-->
<!--<td>Drag up or down to move the viewport forwards or back.</td>-->
<!--</tr>-->
<!--</table>-->
<!--</p>-->

<h3>TopDownOrtho view controller</h3>
<p>
<em>
Top-down orthographic view.
</em>
<table border="0" cellspacing="0" cellpadding="3">
<tr class="odd">
<td class="key">Left</td>
<td>Dragging left/right rotates the view.</td>
</tr>
<tr class="even">
<td><div class="key">Middle</div> or<div class="key">Shift-Left</div></td>
<td>Drag to move the viewpoint in the XY plane.</td>
</tr>
<tr class="odd">
<td class="key">Scroll Wheel</td>
<td>Roll up or down to zoom in or out.</td>
</tr>
<tr class="even">
<td class="key">Right</td>
<td>Drag up or down to zoom in or out.</td>
</tr>
</table>
</p>
<!--<h3>TopDownOrtho view controller</h3>-->
<!--<p>-->
<!--<em>-->
<!--Top-down orthographic view.-->
<!--</em>-->
<!--<table border="0" cellspacing="0" cellpadding="3">-->
<!--<tr class="odd">-->
<!--<td class="key">Left</td>-->
<!--<td>Dragging left/right rotates the view.</td>-->
<!--</tr>-->
<!--<tr class="even">-->
<!--<td><div class="key">Middle</div> or<div class="key">Shift-Left</div></td>-->
<!--<td>Drag to move the viewpoint in the XY plane.</td>-->
<!--</tr>-->
<!--<tr class="odd">-->
<!--<td class="key">Scroll Wheel</td>-->
<!--<td>Roll up or down to zoom in or out.</td>-->
<!--</tr>-->
<!--<tr class="even">-->
<!--<td class="key">Right</td>-->
<!--<td>Drag up or down to zoom in or out.</td>-->
<!--</tr>-->
<!--</table>-->
<!--</p>-->

</body>
</html>
File renamed without changes
4 changes: 4 additions & 0 deletions rviz_common/include/rviz_common/display_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ class RVIZ_COMMON_PUBLIC DisplayContext : public QObject
void
setStatus(const QString & message) = 0;

virtual
QString
getHelpPath() const = 0;

virtual
std::shared_ptr<rclcpp::Clock>
getClock() = 0;
Expand Down
32 changes: 13 additions & 19 deletions rviz_common/src/rviz_common/help_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,48 +27,42 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "rviz_common/help_panel.hpp"
#include "./help_panel.hpp"

#include <string>

#include <QVBoxLayout> // NOLINT: cpplint is unable to handle the include order here
#include <QDir> // NOLINT: cpplint is unable to handle the include order here
#include <QTextBrowser> // NOLINT: cpplint is unable to handle the include order here
#include <QUrl> // NOLINT: cpplint is unable to handle the include order here

#include <boost/filesystem.hpp> // NOLINT: cpplint is unable to handle the include order here

#include "rviz_common/visualization_manager.hpp"
#include <QVBoxLayout> // NOLINT: cpplint is unable to handle the include order here

namespace fs = boost::filesystem;
#include "rviz_common/display_context.hpp"

namespace rviz
namespace rviz_common
{

HelpPanel::HelpPanel(QWidget * parent)
: Panel(parent),
browser_(NULL)
browser_(nullptr)
{
QVBoxLayout * layout = new QVBoxLayout(this);
const auto layout = new QVBoxLayout(this);
browser_ = new QTextBrowser();
layout->addWidget(browser_);
}

HelpPanel::~HelpPanel()
{
}
HelpPanel::~HelpPanel() = default;

void HelpPanel::onInitialize()
{
setHelpFile(vis_manager_->getHelpPath() );
setHelpFile(getDisplayContext()->getHelpPath());
}

void HelpPanel::setHelpFile(const QString & qfile_path)
{
std::string file_path = qfile_path.toStdString();
QFileInfo path_info(qfile_path);

if (!fs::exists(file_path)) {
if (!path_info.exists()) {
browser_->setText("Help file '" + qfile_path + "' does not exist.");
} else if (fs::is_directory(file_path)) {
} else if (path_info.isDir()) {
browser_->setText("Help file '" + qfile_path + "' is a directory, not a file.");
} else {
QUrl url = QUrl::fromLocalFile(qfile_path);
Expand All @@ -80,4 +74,4 @@ void HelpPanel::setHelpFile(const QString & qfile_path)
}
}

} // end namespace rviz
} // namespace rviz_common
8 changes: 4 additions & 4 deletions rviz_common/src/rviz_common/help_panel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

class QTextBrowser;

namespace rviz
namespace rviz_common
{

class HelpPanel : public Panel
Expand All @@ -44,9 +44,9 @@ class HelpPanel : public Panel

public:
explicit HelpPanel(QWidget * parent = 0);
virtual ~HelpPanel();
~HelpPanel() override;

virtual void onInitialize();
void onInitialize() override;

/** @brief Load the given html file. */
void setHelpFile(const QString & file_path);
Expand All @@ -55,6 +55,6 @@ class HelpPanel : public Panel
QTextBrowser * browser_;
};

} // end namespace rviz
} // namespace rviz_common

#endif // RVIZ_COMMON__HELP_PANEL_HPP_
Loading