Skip to content

Commit

Permalink
Add an auto fill type information check (#107) (#110)
Browse files Browse the repository at this point in the history
* Add an auto fill type information check (#107)

* Refs #20306: Add autofill type information check

Signed-off-by: EduPonz <[email protected]>

* Refs #20306: Apply Miguel's suggestions

Signed-off-by: EduPonz <[email protected]>

---------

Signed-off-by: EduPonz <[email protected]>
(cherry picked from commit a002fdb)

# Conflicts:
#	forms/participantdialog.ui
#	include/eprosimashapesdemo/qt/participantdialog.h
#	include/eprosimashapesdemo/shapesdemo/ShapesDemo.h
#	src/qt/participantdialog.cpp

* Refs #20031: Fix conflicts

Signed-off-by: JesusPoderoso <[email protected]>

* Refs #20031: Fix warning

Signed-off-by: JesusPoderoso <[email protected]>

---------

Signed-off-by: JesusPoderoso <[email protected]>
Co-authored-by: Eduardo Ponz Segrelles <[email protected]>
Co-authored-by: JesusPoderoso <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2024
1 parent 4fb574a commit 5ab162a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
31 changes: 29 additions & 2 deletions forms/participantdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,40 @@
</widget>
</item>
<item row="21" column="0">
<widget class="Line" name="line_5">
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="22" column="0">
<widget class="QLabel" name="label_9">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Advanced options</string>
</property>
</widget>
</item>
<item row="23" column="1">
<widget class="QCheckBox" name="typeinformationCheckBox">
<property name="text">
<string>Autofill type information</string>
</property>
</widget>
</item>
<item row="24" column="0">
<widget class="Line" name="line_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="25" column="0">
<widget class="QLabel" name="label_12">
<property name="font">
<font>
Expand All @@ -181,7 +208,7 @@
</property>
</widget>
</item>
<item row="23" column="1">
<item row="26" column="1">
<widget class="QCheckBox" name="rosTopicCheckBox">
<property name="text">
<string>Use ROS 2 Topics</string>
Expand Down
3 changes: 3 additions & 0 deletions include/eprosimashapesdemo/qt/participantdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ private slots:

void tcp_enable_buttons();

void on_typeinformationCheckBox_stateChanged(
int arg1);

private:

ShapesDemoOptions* m_options;
Expand Down
4 changes: 4 additions & 0 deletions include/eprosimashapesdemo/shapesdemo/ShapesDemo.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class ShapesDemoOptions
uint32_t m_updateIntervalMs;
uint32_t m_movementSpeed;
uint32_t m_domainId;
bool m_auto_fill_type_information;

ShapesDemoOptions()
{
m_udp_transport = true;
Expand All @@ -86,6 +88,8 @@ class ShapesDemoOptions
m_movementSpeed = 7;
m_domainId = 0;
m_tcp_type = QString("TCP LAN Server");
m_auto_fill_type_information = true;

#ifdef ENABLE_ROS_COMPONENTS
m_ros2_topic = detect_ros_2_installation();
#else
Expand Down
9 changes: 9 additions & 0 deletions src/qt/participantdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ParticipantDialog::ParticipantDialog(
this->ui->rosTopicCheckBox->setVisible(false);
#endif // ifdef ENABLE_ROS_COMPONENTS

this->ui->typeinformationCheckBox->setChecked(m_options->m_auto_fill_type_information);

setEnableState();
setAttribute ( Qt::WA_DeleteOnClose, true );
Expand Down Expand Up @@ -100,6 +101,7 @@ void ParticipantDialog::setEnableState()
this->ui->SHMcheckBox->setEnabled(mb_started);
this->ui->UDPcheckBox->setEnabled(mb_started);
this->ui->TCPcheckBox->setEnabled(mb_started);
this->ui->typeinformationCheckBox->setEnabled(mb_started);

// Enable in Running
this->ui->pushButton_stop->setEnabled(!mb_started);
Expand Down Expand Up @@ -237,3 +239,10 @@ void ParticipantDialog::on_TCPcomboBox_currentTextChanged(

tcp_enable_buttons();
}

void ParticipantDialog::on_typeinformationCheckBox_stateChanged(
int arg1)
{
m_options->m_auto_fill_type_information = arg1;
mp_sd->setOptions(*m_options);
}
2 changes: 2 additions & 0 deletions src/shapesdemo/ShapesDemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ bool ShapesDemo::init()

// If the creation has been correct, register type
m_isInitialized = true;
m_type->auto_fill_type_information(m_options.m_auto_fill_type_information);
m_type->auto_fill_type_object(false);
m_type.register_type(mp_participant);
#ifdef ENABLE_ROS_COMPONENTS
m_ros_type.register_type(mp_participant);
Expand Down

0 comments on commit 5ab162a

Please sign in to comment.