Skip to content

Commit

Permalink
preparing for release 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Jan 31, 2024
1 parent 766d11c commit 473f5e8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/DataLoadROS/dataload_ros.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,17 @@ bool DataLoadROS::readDataFromFile(PJ::FileLoadInfo* info, PJ::PlotDataMapRef& p
auto all_topics = getAllTopics(temp_bag.get(), ros_parser);

//----------------------------------

// FIXME: we keep this here for backward compatibility
if (info->plugin_config.hasChildNodes())
{
xmlLoadState(info->plugin_config.firstChildElement());
}

if (!info->selected_datasources.empty())
{
_config.topics = info->selected_datasources;
}
else
if (info->plugin_config.hasChildNodes() || _config.topics.empty())
{
QSettings settings;
_config.loadFromSettings(settings, "DataLoadROS");

DialogSelectRosTopics* dialog = new DialogSelectRosTopics(all_topics, _config);

if (dialog->exec() != static_cast<int>(QDialog::Accepted))
Expand Down Expand Up @@ -169,6 +168,7 @@ bool DataLoadROS::readDataFromFile(PJ::FileLoadInfo* info, PJ::PlotDataMapRef& p
}

QProgressDialog progress_dialog;
progress_dialog.setWindowTitle("Loading the rosbag");
progress_dialog.setLabelText("Loading... please wait");
progress_dialog.setWindowModality(Qt::ApplicationModal);

Expand Down
15 changes: 8 additions & 7 deletions src/DataLoadROS2/dataload_ros2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,15 @@ bool DataLoadROS2::readDataFromFile(PJ::FileLoadInfo* info,
QMessageBox::warning(nullptr, tr("Error"), msg);
}

// FIXME: we keep this for backward compatibility
if (info->plugin_config.hasChildNodes())
{
xmlLoadState(info->plugin_config.firstChildElement());
}

if (!info->selected_datasources.empty())
{
_config.topics = info->selected_datasources;
}
else
if (!info->plugin_config.hasChildNodes() || _config.topics.empty())
{
loadDefaultSettings();
DialogSelectRosTopics* dialog = new DialogSelectRosTopics(all_topics_qt, _config);

if (dialog->exec() != static_cast<int>(QDialog::Accepted))
Expand Down Expand Up @@ -161,12 +159,16 @@ bool DataLoadROS2::readDataFromFile(PJ::FileLoadInfo* info,
std::string topic_type = topicTypesByName.at(topic_name);
topic_selected.insert(topic_name);

parser.addParser(topic_name, CreateParserROS2( *parserFactories(), topic_name, topic_type, plot_map));
auto ros2_parser = CreateParserROS2( *parserFactories(),
topic_name, topic_type, plot_map);
parser.addParser(topic_name, ros2_parser);

}

parser.setConfig(_config);

QProgressDialog progress_dialog;
progress_dialog.setWindowTitle("Loading the rosbag");
progress_dialog.setLabelText("Loading... please wait");
progress_dialog.setWindowModality(Qt::ApplicationModal);
progress_dialog.setRange(0, bag_metadata.message_count);
Expand Down Expand Up @@ -233,7 +235,6 @@ bool DataLoadROS2::readDataFromFile(PJ::FileLoadInfo* info,

qDebug() << "The rosbag loaded the data in " << diff << " milliseconds";

info->selected_datasources = _config.topics;
return true;
}

Expand Down
9 changes: 9 additions & 0 deletions src/parser_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ void RosParserConfig::xmlSaveState(QDomDocument &doc, QDomElement &parent_elem)
QDomElement suffix_elem = doc.createElement("remove_suffix_from_strings");
suffix_elem.setAttribute("value", remove_suffix_from_strings ? "true" : "false");
parent_elem.appendChild(suffix_elem);

QDomElement topics_elem = doc.createElement("selected_topics");
topics_elem.setAttribute("value", topics.join(';'));
parent_elem.appendChild(topics_elem);
}

void RosParserConfig::xmlLoadState(const QDomElement &parent_element)
Expand All @@ -44,6 +48,11 @@ void RosParserConfig::xmlLoadState(const QDomElement &parent_element)

QDomElement suffix_elem = parent_element.firstChildElement("remove_suffix_from_strings");
remove_suffix_from_strings = (suffix_elem.attribute("value")== "true");

QDomElement topics_elem = parent_element.firstChildElement("selected_topics");
if(!topics_elem.isNull()) {
topics = topics_elem.attribute("value").split(';');
}
}

void RosParserConfig::saveToSettings(QSettings &settings, QString prefix) const
Expand Down

0 comments on commit 473f5e8

Please sign in to comment.