33 #include <OGRE/OgreLogManager.h> 35 #include <QCloseEvent> 36 #include <QFileDialog> 39 #include <boost/program_options.hpp> 55 setObjectName(
"RViz");
60 Ogre::LogManager* log_manager = Ogre::LogManager::getSingletonPtr();
61 if (log_manager &&
log_)
63 log_manager->destroyLog(
log_);
74 Ogre::LogManager* log_manager = Ogre::LogManager::getSingletonPtr();
77 log_manager =
new Ogre::LogManager();
80 log_ = log_manager->createLog(filename.toStdString().c_str(),
false,
false, !
ogre_log_);
96 const QObjectList& children =
menu_bar_->children();
97 for (QObjectList::const_iterator it = children.begin(); !menu && it != children.end(); it++)
99 menu =
dynamic_cast<QMenu*
>(*it);
105 const QObjectList& children = menu->children();
106 if (!children.empty())
108 QAction*
action =
dynamic_cast<QAction*
>(children.last());
111 action->setVisible(
false);
116 widget_->setWindowTitle(
"RViz[*]");
124 widget_->installEventFilter(
this);
129 namespace po = boost::program_options;
133 const int argc = qargv.count();
138 std::vector<QByteArray> argv_array;
139 std::vector<const char *> argv(argc+1);
142 for (
int i = 0; i < argc; ++i)
144 argv_array.push_back(qargv.at(i).toLocal8Bit());
145 argv[i+1] = argv_array[i].constData();
148 po::variables_map vm;
149 po::options_description
options;
150 options.add_options()
151 (
"display-config,d", po::value<std::string>(),
"")
157 po::store(po::parse_command_line(argc+1, argv.data(), options), vm);
160 if (vm.count(
"hide-menu"))
165 if (vm.count(
"display-config"))
170 if (vm.count(
"ogre-log"))
175 catch (std::exception& e)
177 ROS_ERROR(
"Error parsing command line: %s", e.what());
191 if (instance_settings.
contains(
"rviz_config_file"))
193 display_config_ = instance_settings.
value(
"rviz_config_file").toString().toLocal8Bit().constData();;
197 if (instance_settings.
contains(
"hide_menu"))
216 if (dialog->exec() != QDialog::Accepted)
229 if (watched ==
widget_ && event->type() == QEvent::Close)
236 return QObject::eventFilter(watched, event);
virtual void initPlugin(qt_gui_cpp::PluginContext &context)
virtual void restoreSettings(const qt_gui_cpp::Settings &plugin_settings, const qt_gui_cpp::Settings &instance_settings)
bool GetHide() const
Get the hide menu option.
bool hasConfiguration() const
rviz::VisualizationFrame * widget_
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void addWidget(QWidget *widget)
void initialize(const QString &display_config_file="")
std::string GetFile() const
Get the file path entered by the user.
bool contains(const QString &key) const
const QStringList & argv() const
void SetHide(const bool hide)
Set the hide menu option.
std::string display_config_
void setValue(const QString &key, const QVariant &value)
QMenuBar * menu_bar_
Pointer to menu bar.
void loadDisplayConfig(const QString &path)
qt_gui_cpp::PluginContext * context_
void triggerConfiguration()
virtual bool eventFilter(QObject *watched, QEvent *event)
void SetFile(const std::string &file)
Populate the file path line edit.
virtual void saveSettings(qt_gui_cpp::Settings &plugin_settings, qt_gui_cpp::Settings &instance_settings) const
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)