Skip to content

Commit

Permalink
specify all states colors for elevated buttons
Browse files Browse the repository at this point in the history
Signed-off-by: KhalilSelyan <[email protected]>
  • Loading branch information
KhalilSelyan committed Sep 11, 2024
1 parent a13058b commit d432432
Showing 1 changed file with 45 additions and 10 deletions.
55 changes: 45 additions & 10 deletions common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,18 +560,26 @@ void AutowareStatePanel::onRoute(const RouteState::ConstSharedPtr msg)

if (msg->state == RouteState::SET) {
activateButton(clear_route_button_ptr_);
clear_route_button_ptr_->updateStyle(

Check warning on line 563 in common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp#L563

Added line #L563 was not covered by tests
"Clear Route",
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_low.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface.c_str()));

Check warning on line 571 in common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp#L565-L571

Added lines #L565 - L571 were not covered by tests
} else {
clear_route_button_ptr_->setStyleSheet(
QString("QPushButton {"
"background-color: %1;color: %2;"
"border: 2px solid %3;"
"font-weight: bold;"
"}")
.arg(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str())
.arg(autoware::state_rviz_plugin::colors::default_colors.outline.c_str())
.arg(
autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()));
deactivateButton(clear_route_button_ptr_);
clear_route_button_ptr_->updateStyle(

Check warning on line 574 in common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp#L574

Added line #L574 was not covered by tests
"Clear Route",
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_low.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface.c_str()));

Check warning on line 582 in common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Code Duplication

The module contains 4 functions with similar structure: AutowareStatePanel::makeLocalizationGroup,AutowareStatePanel::makeMotionGroup,AutowareStatePanel::onMotion,AutowareStatePanel::onRoute. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.

Check warning on line 582 in common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp#L576-L582

Added lines #L576 - L582 were not covered by tests
}
}

Expand Down Expand Up @@ -608,6 +616,15 @@ void AutowareStatePanel::onLocalization(const LocalizationInitializationState::C

localization_icon->updateStyle(state, bgColor);
localization_label_ptr_->setText(localization_state);
init_by_gnss_button_ptr_->updateStyle(

Check warning on line 619 in common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp#L619

Added line #L619 was not covered by tests
"Initialize with GNSS",
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_low.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface.c_str()));

Check warning on line 627 in common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp#L621-L627

Added lines #L621 - L627 were not covered by tests
}

void AutowareStatePanel::onMotion(const MotionState::ConstSharedPtr msg)
Expand Down Expand Up @@ -646,8 +663,26 @@ void AutowareStatePanel::onMotion(const MotionState::ConstSharedPtr msg)

if (msg->state == MotionState::STARTING) {
activateButton(accept_start_button_ptr_);
accept_start_button_ptr_->updateStyle(

Check warning on line 666 in common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp#L666

Added line #L666 was not covered by tests
"Accept Start",
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_low.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface.c_str()));

Check warning on line 674 in common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp#L668-L674

Added lines #L668 - L674 were not covered by tests
} else {
deactivateButton(accept_start_button_ptr_);
accept_start_button_ptr_->updateStyle(

Check warning on line 677 in common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp#L677

Added line #L677 was not covered by tests
"Accept Start",
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_low.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()),
QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface.c_str()));

Check warning on line 685 in common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp

View check run for this annotation

Codecov / codecov/patch

common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp#L679-L685

Added lines #L679 - L685 were not covered by tests
}
}

Expand Down

0 comments on commit d432432

Please sign in to comment.