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_);
97 action->setVisible(
false);
102 widget_->installEventFilter(
this);
114 namespace po = boost::program_options;
118 const int argc = qargv.count();
123 std::vector<QByteArray> argv_array;
124 std::vector<const char *> argv(argc+1);
127 for (
int i = 0; i < argc; ++i)
129 argv_array.push_back(qargv.at(i).toLocal8Bit());
130 argv[i+1] = argv_array[i].constData();
133 po::variables_map vm;
134 po::options_description
options;
135 options.add_options()
136 (
"display-config,d", po::value<std::string>(),
"")
142 po::store(po::parse_command_line(argc+1, argv.data(), options), vm);
145 if (vm.count(
"hide-menu"))
151 if (vm.count(
"display-config"))
157 if (vm.count(
"ogre-log"))
163 catch (std::exception& e)
165 ROS_ERROR(
"Error parsing command line: %s", e.what());
180 instance_settings.
contains(
"rviz_config_file"))
182 display_config_ = instance_settings.
value(
"rviz_config_file").toString().toLocal8Bit().constData();;
187 instance_settings.
contains(
"hide_menu"))
206 if (dialog->exec() != QDialog::Accepted)
220 if (watched ==
widget_ && event->type() == QEvent::Close)
227 return QObject::eventFilter(watched, event);
void onDisplayConfigChanged(const QString &fullpath)
virtual void saveSettings(qt_gui_cpp::Settings &plugin_settings, qt_gui_cpp::Settings &instance_settings) const
std::string GetFile() const
Get the file path entered by the user.
virtual void initPlugin(qt_gui_cpp::PluginContext &context)
uint8_t set_from_cmdline_
virtual void restoreSettings(const qt_gui_cpp::Settings &plugin_settings, const qt_gui_cpp::Settings &instance_settings)
void setSplashPath(const QString &splash_path)
rviz::VisualizationFrame * widget_
void addWidget(QWidget *widget)
void initialize(const QString &display_config_file="")
void displayConfigFileChanged(const QString &fullpath)
bool GetHide() const
Get the hide menu option.
void SetHide(const bool hide)
Set the hide menu option.
bool hasConfiguration() const
std::string display_config_
void setValue(const QString &key, const QVariant &value)
QMenuBar * menu_bar_
Pointer to menu bar.
const QStringList & argv() const
bool contains(const QString &key) const
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.
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const