23 #include <QCloseEvent> 26 #include <boost/program_options.hpp> 42 MultiplotPlugin::MultiplotPlugin() :
44 runAllPlotsOnStart_(false) {
45 setObjectName(
"MultiplotPlugin");
71 instanceSettings.
remove(
"history");
73 instanceSettings.
setValue(
"history/max_length",
74 (
unsigned int)maxConfigHistoryLength);
76 for (
size_t i = 0; i < configHistory.count(); ++i)
77 instanceSettings.
setValue(
"history/config_"+QString::number(i),
90 maxConfigHistoryLength = instanceSettings.
value(
"history/max_length",
91 (
unsigned int)maxConfigHistoryLength).toUInt();
93 while (instanceSettings.
contains(
"history/config_"+QString::
94 number(configHistory.count())))
95 configHistory.append(instanceSettings.
value(
"history/config_"+
96 QString::number(configHistory.count())).toString());
106 size_t argc = arguments.count();
107 std::vector<QByteArray>
args;
109 const char *argv[argc+1];
110 argv[0] =
"rqt_multiplot";
112 for (
int i = 0; i < argc; ++i) {
113 args.push_back(arguments[i].toLocal8Bit());
114 argv[i+1] = args[i].constData();
117 boost::program_options::variables_map variables;
118 boost::program_options::options_description options;
120 options.add_options()
121 (
"multiplot-config,c", boost::program_options::value<std::string>(),
"");
122 options.add_options()
123 (
"multiplot-bag,b", boost::program_options::value<std::string>(),
"");
124 options.add_options()
125 (
"multiplot-run-all,r", boost::program_options::bool_switch(
130 boost::program_options::store(boost::program_options::parse_command_line(
131 argc+1, argv, options), variables);
132 boost::program_options::notify(variables);
134 if (variables.count(
"multiplot-config")) {
135 QUrl url = QUrl::fromUserInput(QString::fromStdString(
136 variables[
"multiplot-config"].as<std::string>()));
139 if (variables.count(
"multiplot-bag"))
141 variables[
"multiplot-bag"].as<std::string>()));
143 catch (
const std::exception& exception) {
144 ROS_ERROR(
"Error parsing command line: %s", exception.what());
void parseArguments(const QStringList &arguments)
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
void addWidget(QWidget *widget)
bool contains(const QString &key) const
const QStringList & argv() const
MultiplotWidget * widget_
void setValue(const QString &key, const QVariant &value)
virtual ~MultiplotPlugin()
void saveSettings(qt_gui_cpp::Settings &pluginSettings, qt_gui_cpp::Settings &instanceSettings) const
void initPlugin(qt_gui_cpp::PluginContext &context)
void remove(const QString &key)
void restoreSettings(const qt_gui_cpp::Settings &pluginSettings, const qt_gui_cpp::Settings &instanceSettings)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)