visualization_frame.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef RVIZ_VISUALIZATION_FRAME_H
31 #define RVIZ_VISUALIZATION_FRAME_H
32 
33 #include <QMainWindow>
34 #include <QList>
35 
36 #include <string>
37 #include <deque>
38 
39 #include "rviz/config.h"
41 #include "rviz/panel.h"
42 
43 #include <ros/time.h>
44 
45 class QSplashScreen;
46 class QAction;
47 class QActionGroup;
48 class QTimer;
49 class QDockWidget;
50 class QLabel;
51 class QToolButton;
52 
53 namespace rviz
54 {
55 
56 class PanelFactory;
57 class RenderPanel;
58 class VisualizationManager;
59 class Tool;
60 class WidgetGeometryChangeDetector;
61 
71 class VisualizationFrame : public QMainWindow, public WindowManagerInterface
72 {
73 Q_OBJECT
74 public:
75  VisualizationFrame( QWidget* parent = 0 );
77 
78  void setApp( QApplication * app );
79 
81  void setShowChooseNewMaster( bool show );
82 
85  void setHelpPath( const QString& help_path );
86 
91  void setSplashPath( const QString& splash_path );
92 
102  void initialize( const QString& display_config_file = "" );
103 
105 
106  // overrides from WindowManagerInterface
107  virtual QWidget* getParentWindow();
108  virtual PanelDockWidget* addPane( const QString& name,
109  QWidget* panel,
110  Qt::DockWidgetArea area = Qt::LeftDockWidgetArea,
111  bool floating = true );
112 
113  QDockWidget* addPanelByName( const QString& name,
114  const QString& class_lookup_name,
115  Qt::DockWidgetArea area = Qt::LeftDockWidgetArea,
116  bool floating = true );
117 
122  void loadPersistentSettings();
123 
128  void savePersistentSettings();
129 
132  void loadDisplayConfig( const QString& path );
133 
140  bool saveDisplayConfig( const QString& path );
141 
142  QString getErrorMessage() const { return error_message_; }
143 
150  virtual void load( const Config& config );
151 
159  virtual void save( Config config );
160 
162  void setHideButtonVisibility( bool visible );
163 
164 public Q_SLOTS:
168 
170  virtual void setStatus( const QString & message );
171 
172 Q_SIGNALS:
174  void statusUpdate( const QString& message );
175 
177  void fullScreenChange( bool hidden );
178 
179 protected Q_SLOTS:
180  void onOpen();
181  void onSave();
182  void onSaveAs();
183  void onSaveImage();
184  void onRecentConfigSelected();
185  void onHelpWiki();
186  void onHelpAbout();
187  void openNewPanelDialog();
188  void openNewToolDialog();
189  void showHelpPanel();
190  void onDockPanelChange();
191 
193  void onToolbarRemoveTool( QAction* remove_tool_menu_action );
194 
196  void onButtonStyleTool( QAction* button_style_tool_menu_action );
197 
200  void onToolbarActionTriggered( QAction* action );
201 
207  void addTool( Tool* tool );
208 
210  void removeTool( Tool* tool );
211 
215  void refreshTool( Tool* tool );
216 
221  void indicateToolIsCurrent(Tool* tool);
222 
226  void changeMaster();
227 
232  void onDeletePanel();
233 
235  void setFullScreen( bool full_screen );
236 
238  void exitFullScreen();
239 
240 protected Q_SLOTS:
242  void markLoadingDone();
243 
245  void setImageSaveDirectory( const QString& directory );
246 
247  void reset();
248 
249  void onHelpDestroyed();
250 
251  void hideLeftDock( bool hide );
252  void hideRightDock( bool hide );
253 
254  virtual void onDockPanelVisibilityChange( bool visible );
255 
256  void updateFps();
257 
258 protected:
262  void initConfigs();
263 
264  void initMenus();
265 
267  void initToolbars();
268 
271  bool prepareToExit();
272 
273  virtual void closeEvent( QCloseEvent* event );
274 
275  virtual void leaveEvent ( QEvent * event );
276 
277  void markRecentConfig(const std::string& path);
278  void updateRecentConfigMenu();
279 
281  void loadPanels( const Config& config );
282 
284  void configureToolbars( const Config& config );
285 
287  void saveToolbars( Config config );
288 
290  void savePanels( Config config );
291 
292  void loadWindowGeometry( const Config& config );
293  void saveWindowGeometry( Config config );
294 
299  void setDisplayConfigFile( const std::string& path );
300 
301  void hideDockImpl( Qt::DockWidgetArea area, bool hide );
302 
303  QApplication* app_;
304 
306 
308 
309  std::string config_dir_;
311  std::string display_config_file_;
313  std::string last_config_dir_;
314  std::string last_image_dir_;
315  std::string home_dir_;
316 
317  QMenu* file_menu_;
319  QMenu* view_menu_;
322 
323  QToolBar* toolbar_;
324 
326 
327  std::string package_path_;
328  QString help_path_;
329  QString splash_path_;
330 
331  QSplashScreen* splash_;
332 
333  typedef std::deque<std::string> D_string;
334  D_string recent_configs_;
335 
336  QActionGroup* toolbar_actions_;
337  std::map<QAction*,Tool*> action_to_tool_map_;
338  std::map<Tool*,QAction*> tool_to_action_map_;
340 
343 
345 
346  struct PanelRecord
347  {
350  QString name;
351  QString class_id;
352  QAction* delete_action;
353  };
354  QList<PanelRecord> custom_panels_;
355 
359 
362  bool loading_;
364 
365  QLabel* status_label_;
366  QLabel* fps_label_;
367  QStatusBar* original_status_bar_;
368 
371 
372  QString error_message_;
373 
376 };
377 
378 }
379 
380 #endif // RVIZ_VISUALIZATION_FRAME_H
app
void indicateToolIsCurrent(Tool *tool)
Mark the given tool as the current one.
void addTool(Tool *tool)
Add the given tool to this frame&#39;s toolbar.
QString getErrorMessage() const
void saveToolbars(Config config)
Saves the user configuration of the toolbar to the config node.
void exitFullScreen()
Exit full screen mode.
void setHideButtonVisibility(bool visible)
Hide or show the hide-dock buttons.
void removeTool(Tool *tool)
Remove the given tool from the frame&#39;s toolbar.
void fullScreenChange(bool hidden)
Emitted when the interface enters or leaves full screen mode.
VisualizationManager * getManager()
QDockWidget * addPanelByName(const QString &name, const QString &class_lookup_name, Qt::DockWidgetArea area=Qt::LeftDockWidgetArea, bool floating=true)
bool saveDisplayConfig(const QString &path)
Save display and other settings to the given file.
virtual void load(const Config &config)
Load the properties of all subsystems from the given Config.
QString error_message_
Error message (if any) from most recent saveDisplayConfig() call.
void onDeletePanel()
Delete a panel widget.
void statusUpdate(const QString &message)
Emitted during file-loading and initialization to indicate progress.
void setSplashPath(const QString &splash_path)
Set the path to the "splash" image file. This image is shown during initialization and loading of the...
virtual QWidget * getParentWindow()
void onToolbarRemoveTool(QAction *remove_tool_menu_action)
Remove a the tool whose name is given by remove_tool_menu_action->text().
config
void initialize(const QString &display_config_file="")
Initialize the visualizer. Creates the VisualizationManager.
void savePanels(Config config)
Saves custom panels to the given config node.
bool toolbar_visible_
Indicates if the toolbar should be visible outside of fullscreen mode.
std::map< Tool *, QAction * > tool_to_action_map_
virtual void setStatus(const QString &message)
virtual void onDockPanelVisibilityChange(bool visible)
virtual void closeEvent(QCloseEvent *event)
void savePersistentSettings()
Save the "general" config file, which has just the few things which should not be saved with a displa...
Configuration data storage class.
Definition: config.h:125
void loadWindowGeometry(const Config &config)
void onToolbarActionTriggered(QAction *action)
Looks up the Tool for this action and calls VisualizationManager::setCurrentTool().
QList< PanelRecord > custom_panels_
void setDisplayConfigFile(const std::string &path)
Set the display config file path.
void setImageSaveDirectory(const QString &directory)
Set the default directory in which to save screenshot images.
VisualizationManager * manager_
void setFullScreen(bool full_screen)
Set full screen mode.
void loadPersistentSettings()
Load the "general" config file, which has just the few things which should not be saved with a displa...
The VisualizationManager class is the central manager class of rviz, holding all the Displays...
void setHelpPath(const QString &help_path)
Set the path to the help file. Should contain HTML. Default is a file in the RViz package...
std::map< QAction *, Tool * > action_to_tool_map_
std::deque< std::string > D_string
virtual PanelDockWidget * addPane(const QString &name, QWidget *panel, Qt::DockWidgetArea area=Qt::LeftDockWidgetArea, bool floating=true)
void initConfigs()
Initialize the default config directory (~/.rviz) and set up the persistent_settings_file_ and displa...
void markLoadingDone()
Set loading_ to false.
action
void onButtonStyleTool(QAction *button_style_tool_menu_action)
Change the button style of the toolbar.
void loadDisplayConfig(const QString &path)
Load display and other settings from the given file.
bool loading_
True just when loading a display config file, false all other times.
void setDisplayConfigModified()
Call this to let the frame know that something that would get saved in the display config has changed...
void hideDockImpl(Qt::DockWidgetArea area, bool hide)
void saveWindowGeometry(Config config)
void changeMaster()
Save the current state and quit with exit code 255 to signal the wrapper that we would like to restar...
VisualizationFrame(QWidget *parent=0)
Utility class for watching for events which indicate that widget geometry has changed.
QTimer * post_load_timer_
Single-shot timer for calling postLoad() a short time after loadDisplayConfig() finishes.
bool prepareToExit()
Check for unsaved changes, prompt to save config, etc.
WidgetGeometryChangeDetector * geom_change_detector_
void initToolbars()
Sets up the top toolbar with QToolbuttions for adding/deleting tools and modifiying the tool view...
void setApp(QApplication *app)
The main rviz window.
void loadPanels(const Config &config)
Loads custom panels from the given config node.
Dock widget class for docking widgets into VisualizationFrame.
void markRecentConfig(const std::string &path)
void setShowChooseNewMaster(bool show)
Call this before initialize() to have it take effect.
virtual void save(Config config)
Save the properties of each subsystem and most editable rviz data.
void refreshTool(Tool *tool)
Refresh the given tool in this frame&#39;s&#39; toolbar.
void configureToolbars(const Config &config)
Applies the user defined toolbar configuration from the given config node.
virtual void leaveEvent(QEvent *event)


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Sat Apr 27 2019 02:33:42