From 31d593b0a24e87bde91b3ef3d60e6a71bf5313cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Thu, 12 Sep 2024 18:04:46 +0300 Subject: [PATCH 01/11] refactor(tier4_state_rviz_plugin): add button background colors Signed-off-by: KhalilSelyan --- .../src/autoware_state_panel.cpp | 67 +++++++++++++++---- .../src/custom_button.cpp | 45 +++++++++++-- .../src/custom_segmented_button_item.cpp | 20 ++++++ .../src/custom_toggle_switch.cpp | 35 +++++++++- .../src/include/custom_button.hpp | 19 +++++- .../include/custom_segmented_button_item.hpp | 6 ++ .../src/include/custom_toggle_switch.hpp | 5 +- .../src/include/material_colors.hpp | 6 ++ 8 files changed, 177 insertions(+), 26 deletions(-) diff --git a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp index 8109be3d7aca6..e02422a0b6f61 100644 --- a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp +++ b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp @@ -427,7 +427,7 @@ QVBoxLayout * AutowareStatePanel::makeVelocityLimitGroup() CustomSlider * pub_velocity_limit_slider_ = new CustomSlider(Qt::Horizontal); pub_velocity_limit_slider_->setRange(0, 100); pub_velocity_limit_slider_->setValue(0); - pub_velocity_limit_slider_->setMaximumWidth(300); + // pub_velocity_limit_slider_->setMaximumWidth(300); connect(pub_velocity_limit_slider_, &QSlider::sliderPressed, this, [this]() { sliderIsDragging = true; // User starts dragging the handle @@ -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( + "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())); } 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( + "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())); } } @@ -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( + "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())); } void AutowareStatePanel::onMotion(const MotionState::ConstSharedPtr msg) @@ -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( + "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())); } else { deactivateButton(accept_start_button_ptr_); + accept_start_button_ptr_->updateStyle( + "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())); } } @@ -748,14 +783,18 @@ void AutowareStatePanel::onEmergencyStatus( QColor(autoware::state_rviz_plugin::colors::default_colors.error_container.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.on_error_container.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.on_error.c_str()), - QColor(autoware::state_rviz_plugin::colors::default_colors.on_error_container.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.on_error.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.on_error.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.error_container.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.error_container.c_str())); } else { emergency_button_ptr_->updateStyle( "Set Emergency", QColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.on_primary.c_str()), - QColor(autoware::state_rviz_plugin::colors::default_colors.on_primary_container.c_str()), - QColor(autoware::state_rviz_plugin::colors::default_colors.on_primary.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.hover_button_bg.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.pressed_button_bg.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.checked_button_bg.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.error_container.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.surface_tint.c_str())); } } diff --git a/common/tier4_state_rviz_plugin/src/custom_button.cpp b/common/tier4_state_rviz_plugin/src/custom_button.cpp index 7ad43190b0f41..5e641c2a30c8c 100644 --- a/common/tier4_state_rviz_plugin/src/custom_button.cpp +++ b/common/tier4_state_rviz_plugin/src/custom_button.cpp @@ -17,11 +17,14 @@ CustomElevatedButton::CustomElevatedButton( const QString & text, const QColor & bgColor, const QColor & textColor, const QColor & hoverColor, - const QColor & disabledBgColor, const QColor & disabledTextColor, QWidget * parent) + const QColor & pressedColor, const QColor & checkedColor, const QColor & disabledBgColor, + const QColor & disabledTextColor, QWidget * parent) : QPushButton(text, parent), backgroundColor(bgColor), textColor(textColor), hoverColor(hoverColor), + pressedColor(pressedColor), + checkedColor(checkedColor), disabledBgColor(disabledBgColor), disabledTextColor(disabledTextColor) { @@ -63,12 +66,15 @@ QSize CustomElevatedButton::minimumSizeHint() const // cppcheck-suppress unusedFunction void CustomElevatedButton::updateStyle( const QString & text, const QColor & bgColor, const QColor & textColor, const QColor & hoverColor, - const QColor & disabledBgColor, const QColor & disabledTextColor) + const QColor & pressedColor, const QColor & checkedColor, const QColor & disabledBgColor, + const QColor & disabledTextColor) { setText(text); backgroundColor = bgColor; this->textColor = textColor; this->hoverColor = hoverColor; + this->pressedColor = pressedColor; + this->checkedColor = checkedColor; this->disabledBgColor = disabledBgColor; this->disabledTextColor = disabledTextColor; update(); // Force repaint @@ -89,10 +95,16 @@ void CustomElevatedButton::paintEvent(QPaintEvent *) if (!isEnabled()) { buttonColor = disabledBgColor; currentTextColor = disabledTextColor; - } else if (isHovered) { - buttonColor = hoverColor; } else { - buttonColor = backgroundColor; + if (isPressed) { + buttonColor = pressedColor; + } else if (isChecked) { + buttonColor = checkedColor; + } else if (isHovered) { + buttonColor = hoverColor; + } else { + buttonColor = backgroundColor; + } } int cornerRadius = height() / 2; // Making the corner radius proportional to the height @@ -101,8 +113,7 @@ void CustomElevatedButton::paintEvent(QPaintEvent *) QPainterPath backgroundPath; backgroundPath.addRoundedRect(r, cornerRadius, cornerRadius); if (!isEnabled()) { - painter.setBrush( - QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface.c_str())); + painter.setBrush(disabledBgColor); painter.setOpacity(0.12); } else { painter.setBrush(buttonColor); @@ -131,3 +142,23 @@ void CustomElevatedButton::leaveEvent(QEvent * event) update(); QPushButton::leaveEvent(event); } + +void CustomElevatedButton::mousePressEvent(QMouseEvent * event) +{ + isPressed = true; + update(); + QPushButton::mousePressEvent(event); +} + +void CustomElevatedButton::mouseReleaseEvent(QMouseEvent * event) +{ + isPressed = false; + update(); + QPushButton::mouseReleaseEvent(event); +} + +void CustomElevatedButton::setChecked(bool checked) +{ + isChecked = checked; + update(); +} diff --git a/common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp b/common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp index 70f21ca1fec84..10ae20ded5b83 100644 --- a/common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp +++ b/common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp @@ -92,6 +92,8 @@ void CustomSegmentedButtonItem::paintEvent(QPaintEvent *) QColor buttonColor; if (isDisabled) { buttonColor = disabledBgColor; + } else if (isPressed) { + buttonColor = pressedColor; } else if (isHovered && !isChecked() && isCheckable()) { buttonColor = hoverColor; } else if (isActivated) { @@ -177,3 +179,21 @@ void CustomSegmentedButtonItem::leaveEvent(QEvent * event) } QPushButton::leaveEvent(event); } + +void CustomSegmentedButtonItem::mousePressEvent(QMouseEvent * event) +{ + if (event->button() == Qt::LeftButton && !isDisabled) { + isPressed = true; + update(); + } + QPushButton::mousePressEvent(event); +} + +void CustomSegmentedButtonItem::mouseReleaseEvent(QMouseEvent * event) +{ + if (event->button() == Qt::LeftButton && !isDisabled) { + isPressed = false; + update(); + } + QPushButton::mouseReleaseEvent(event); +} diff --git a/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp b/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp index 3b58ded626439..d4dafe2493918 100644 --- a/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp +++ b/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp @@ -44,14 +44,31 @@ void CustomToggleSwitch::paintEvent(QPaintEvent *) QColor(autoware::state_rviz_plugin::colors::default_colors.outline.c_str()); QColor checkedIndicatorColor = QColor(autoware::state_rviz_plugin::colors::default_colors.on_primary.c_str()); - QColor indicatorColor = isChecked ? checkedIndicatorColor : uncheckedIndicatorColor; + + QColor uncheckedHoverIndicatorColor = + QColor(autoware::state_rviz_plugin::colors::default_colors.surface.c_str()); + QColor checkedHoverIndicatorColor = + QColor(autoware::state_rviz_plugin::colors::default_colors.primary_container.c_str()); + + QColor indicatorColor = isChecked + ? (isHovered ? checkedHoverIndicatorColor : checkedIndicatorColor) + : (isHovered ? uncheckedHoverIndicatorColor : uncheckedIndicatorColor); QColor uncheckedBgColor = QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()); QColor checkedBgColor = QColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()); - QColor bgColor = isChecked ? checkedBgColor : uncheckedBgColor; + QColor uncheckedHoverBgColor = + QColor(autoware::state_rviz_plugin::colors::default_colors.disabled_elevated_button_bg.c_str()); + + QColor bgColor = + isChecked ? checkedBgColor : (isHovered ? uncheckedHoverBgColor : uncheckedBgColor); + + // Surface color with 12% opacity for the hover circle + QColor hoverCircleColor = + QColor(autoware::state_rviz_plugin::colors::default_colors.surface.c_str()); + hoverCircleColor.setAlpha(255 * 0.12); // 12% opacity QRect borderR = r.adjusted(-margin, -margin, margin, margin); p.setBrush(bgColor); @@ -85,3 +102,17 @@ void CustomToggleSwitch::setCheckedState(bool state) blockSignalsGuard = false; update(); // Force repaint } + +void CustomToggleSwitch::enterEvent(QEvent * event) +{ + isHovered = true; + update(); + QCheckBox::enterEvent(event); +} + +void CustomToggleSwitch::leaveEvent(QEvent * event) +{ + isHovered = false; + update(); + QCheckBox::leaveEvent(event); +} diff --git a/common/tier4_state_rviz_plugin/src/include/custom_button.hpp b/common/tier4_state_rviz_plugin/src/include/custom_button.hpp index b10663ce09933..b37ac2fbd058c 100644 --- a/common/tier4_state_rviz_plugin/src/include/custom_button.hpp +++ b/common/tier4_state_rviz_plugin/src/include/custom_button.hpp @@ -37,6 +37,10 @@ class CustomElevatedButton : public QPushButton QColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()), const QColor & hoverColor = QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()), + const QColor & pressedColor = + QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()), + const QColor & checkedColor = + QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()), const QColor & disabledBgColor = QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()), const QColor & disabledTextColor = @@ -44,26 +48,37 @@ class CustomElevatedButton : public QPushButton QWidget * parent = nullptr); void updateStyle( const QString & text, const QColor & bgColor, const QColor & textColor, - const QColor & hoverColor, const QColor & disabledBgColor, const QColor & disabledTextColor); + const QColor & hoverColor, const QColor & pressedColor, const QColor & checkedColor, + const QColor & disabledBgColor, const QColor & disabledTextColor); protected: void paintEvent(QPaintEvent * event) override; void enterEvent(QEvent * event) override; void leaveEvent(QEvent * event) override; + void mousePressEvent(QMouseEvent * event) override; + void mouseReleaseEvent(QMouseEvent * event) override; QSize sizeHint() const override; QSize minimumSizeHint() const override; + // set checked state + void setChecked(bool checked); private: QColor backgroundColor = QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_low.c_str()); QColor textColor = QColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()); QColor hoverColor = - QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()); + QColor(autoware::state_rviz_plugin::colors::default_colors.hover_button_bg.c_str()); + QColor pressedColor = + QColor(autoware::state_rviz_plugin::colors::default_colors.pressed_button_bg.c_str()); + QColor checkedColor = + QColor(autoware::state_rviz_plugin::colors::default_colors.checked_button_bg.c_str()); QColor disabledBgColor = QColor(autoware::state_rviz_plugin::colors::default_colors.disabled_elevated_button_bg.c_str()); QColor disabledTextColor = QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface.c_str()); bool isHovered = false; + bool isPressed = false; + bool isChecked = false; }; #endif // CUSTOM_BUTTON_HPP_ diff --git a/common/tier4_state_rviz_plugin/src/include/custom_segmented_button_item.hpp b/common/tier4_state_rviz_plugin/src/include/custom_segmented_button_item.hpp index ee6f48e285975..09d595f14e191 100644 --- a/common/tier4_state_rviz_plugin/src/include/custom_segmented_button_item.hpp +++ b/common/tier4_state_rviz_plugin/src/include/custom_segmented_button_item.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -39,6 +40,8 @@ class CustomSegmentedButtonItem : public QPushButton void paintEvent(QPaintEvent * event) override; void enterEvent(QEvent * event) override; void leaveEvent(QEvent * event) override; + void mousePressEvent(QMouseEvent * event) override; + void mouseReleaseEvent(QMouseEvent * event) override; private: void updateCheckableState(); @@ -47,6 +50,8 @@ class CustomSegmentedButtonItem : public QPushButton QColor checkedBgColor; QColor hoverColor = QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()); + QColor pressedColor = + QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()); QColor inactiveTextColor; QColor activeTextColor; QColor disabledBgColor = @@ -56,6 +61,7 @@ class CustomSegmentedButtonItem : public QPushButton bool isHovered = false; bool isActivated = false; bool isDisabled = false; + bool isPressed = false; }; #endif // CUSTOM_SEGMENTED_BUTTON_ITEM_HPP_ diff --git a/common/tier4_state_rviz_plugin/src/include/custom_toggle_switch.hpp b/common/tier4_state_rviz_plugin/src/include/custom_toggle_switch.hpp index 107d45af8c3f3..39ed075cc5b32 100644 --- a/common/tier4_state_rviz_plugin/src/include/custom_toggle_switch.hpp +++ b/common/tier4_state_rviz_plugin/src/include/custom_toggle_switch.hpp @@ -32,9 +32,12 @@ class CustomToggleSwitch : public QCheckBox protected: void paintEvent(QPaintEvent * event) override; void mouseReleaseEvent(QMouseEvent * event) override; + void enterEvent(QEvent * event) override; + void leaveEvent(QEvent * event) override; private: - bool blockSignalsGuard = false; // Guard variable to block signals during updates + bool blockSignalsGuard = false; + bool isHovered = false; }; #endif // CUSTOM_TOGGLE_SWITCH_HPP_ diff --git a/common/tier4_state_rviz_plugin/src/include/material_colors.hpp b/common/tier4_state_rviz_plugin/src/include/material_colors.hpp index d146b599ab600..b5989ff17b530 100644 --- a/common/tier4_state_rviz_plugin/src/include/material_colors.hpp +++ b/common/tier4_state_rviz_plugin/src/include/material_colors.hpp @@ -78,6 +78,12 @@ struct MaterialColors std::string warning = "#EEF08B"; std::string info = "#8BD0F0"; std::string danger = "#F08B8B"; + + std::string enabled_button_bg = "#8BD0F0"; + std::string hover_button_bg = "#84c2e6"; + std::string pressed_button_bg = "#699BB8"; + std::string checked_button_bg = "#699BB8"; + std::string disabled_button_bg = "#292d30"; }; inline MaterialColors default_colors; From 3e12fe3fc8838942ea5ae6bb196e1899bc0b62a8 Mon Sep 17 00:00:00 2001 From: KhalilSelyan Date: Fri, 13 Sep 2024 13:37:48 +0300 Subject: [PATCH 02/11] refactor(tier4_state_rviz_plugin): update emergency button press/checked state bg color Signed-off-by: KhalilSelyan --- common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp | 4 ++-- .../tier4_state_rviz_plugin/src/include/material_colors.hpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp index e02422a0b6f61..633cab121b0de 100644 --- a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp +++ b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp @@ -783,8 +783,8 @@ void AutowareStatePanel::onEmergencyStatus( QColor(autoware::state_rviz_plugin::colors::default_colors.error_container.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.on_error_container.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.on_error.c_str()), - QColor(autoware::state_rviz_plugin::colors::default_colors.on_error.c_str()), - QColor(autoware::state_rviz_plugin::colors::default_colors.on_error.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.error_press.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.error_press.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.error_container.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.error_container.c_str())); } else { diff --git a/common/tier4_state_rviz_plugin/src/include/material_colors.hpp b/common/tier4_state_rviz_plugin/src/include/material_colors.hpp index b5989ff17b530..03efd92361090 100644 --- a/common/tier4_state_rviz_plugin/src/include/material_colors.hpp +++ b/common/tier4_state_rviz_plugin/src/include/material_colors.hpp @@ -40,6 +40,7 @@ struct MaterialColors std::string error = "#FFB4AB"; std::string on_error = "#690005"; std::string error_container = "#93000A"; + std::string error_press = "#7A0008"; std::string on_error_container = "#FFDAD6"; std::string background = "#0F1417"; std::string on_background = "#DFE3E7"; From 8ce9228e0743188776d4fcaf1d5b21debe8151ba Mon Sep 17 00:00:00 2001 From: KhalilSelyan Date: Fri, 13 Sep 2024 13:43:44 +0300 Subject: [PATCH 03/11] refactor(tier4_state_rviz_plugin): update toggle switch hover colors Signed-off-by: KhalilSelyan --- .../tier4_state_rviz_plugin/src/custom_toggle_switch.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp b/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp index d4dafe2493918..4a3aa8f80ed2c 100644 --- a/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp +++ b/common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp @@ -46,7 +46,7 @@ void CustomToggleSwitch::paintEvent(QPaintEvent *) QColor(autoware::state_rviz_plugin::colors::default_colors.on_primary.c_str()); QColor uncheckedHoverIndicatorColor = - QColor(autoware::state_rviz_plugin::colors::default_colors.surface.c_str()); + QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface_variant.c_str()); QColor checkedHoverIndicatorColor = QColor(autoware::state_rviz_plugin::colors::default_colors.primary_container.c_str()); @@ -59,11 +59,7 @@ void CustomToggleSwitch::paintEvent(QPaintEvent *) QColor checkedBgColor = QColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()); - QColor uncheckedHoverBgColor = - QColor(autoware::state_rviz_plugin::colors::default_colors.disabled_elevated_button_bg.c_str()); - - QColor bgColor = - isChecked ? checkedBgColor : (isHovered ? uncheckedHoverBgColor : uncheckedBgColor); + QColor bgColor = isChecked ? checkedBgColor : uncheckedBgColor; // Surface color with 12% opacity for the hover circle QColor hoverCircleColor = From 5e3428870880f0fc60280f51cbd0b82a0224af92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Mon, 16 Sep 2024 12:23:48 +0300 Subject: [PATCH 04/11] autoware_overlay_rviz_plugin remove speed limit transparency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- .../autoware_overlay_rviz_plugin/src/speed_limit_display.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_limit_display.cpp b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_limit_display.cpp index a6691ffff1c62..1da64aaf320ca 100644 --- a/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_limit_display.cpp +++ b/common/autoware_overlay_rviz_plugin/autoware_overlay_rviz_plugin/src/speed_limit_display.cpp @@ -121,7 +121,6 @@ void SpeedLimitDisplay::drawSpeedLimitIndicator( painter.setRenderHint(QPainter::Antialiasing, true); QColor colorFromHSV; colorFromHSV.setHsv(bg_color.hue(), bg_color.saturation(), bg_color.value()); - colorFromHSV.setAlphaF(bg_alpha); painter.setBrush(colorFromHSV); painter.drawEllipse(innerCircleRect); From 2dc25b8460740e0935b9917742df313b763f42fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Mon, 16 Sep 2024 12:47:18 +0300 Subject: [PATCH 05/11] fix clear emergency colors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp | 2 +- .../tier4_state_rviz_plugin/src/include/material_colors.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp index 633cab121b0de..f031d1e9c313e 100644 --- a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp +++ b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp @@ -781,8 +781,8 @@ void AutowareStatePanel::onEmergencyStatus( emergency_button_ptr_->updateStyle( "Clear Emergency", QColor(autoware::state_rviz_plugin::colors::default_colors.error_container.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.error.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.on_error_container.c_str()), - QColor(autoware::state_rviz_plugin::colors::default_colors.on_error.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.error_press.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.error_press.c_str()), QColor(autoware::state_rviz_plugin::colors::default_colors.error_container.c_str()), diff --git a/common/tier4_state_rviz_plugin/src/include/material_colors.hpp b/common/tier4_state_rviz_plugin/src/include/material_colors.hpp index 03efd92361090..e3ba9084a978d 100644 --- a/common/tier4_state_rviz_plugin/src/include/material_colors.hpp +++ b/common/tier4_state_rviz_plugin/src/include/material_colors.hpp @@ -39,9 +39,9 @@ struct MaterialColors std::string on_tertiary_container = "#E3DFFF"; std::string error = "#FFB4AB"; std::string on_error = "#690005"; - std::string error_container = "#93000A"; - std::string error_press = "#7A0008"; - std::string on_error_container = "#FFDAD6"; + std::string error_container = "#820008"; + std::string error_press = "#982127"; + std::string on_error_container = "#8c0f16"; std::string background = "#0F1417"; std::string on_background = "#DFE3E7"; std::string surface = "#0F1417"; From d6db3be18083bee7fc2003d56781d19c72bd8765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Tue, 17 Sep 2024 11:34:01 +0300 Subject: [PATCH 06/11] fix width of slider label MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- .../tier4_state_rviz_plugin/src/autoware_state_panel.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp index f031d1e9c313e..18551c88a1bfc 100644 --- a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp +++ b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp @@ -455,7 +455,13 @@ QVBoxLayout * AutowareStatePanel::makeVelocityLimitGroup() connect(emergency_button_ptr_, SIGNAL(clicked()), this, SLOT(onClickEmergencyButton())); auto * utility_layout = new QVBoxLayout; auto * velocity_limit_layout = new QHBoxLayout; - QLabel * velocity_limit_label = new QLabel("km/h"); + auto * velocity_limit_label = new QLabel("km/h"); + + QFontMetrics fm(velocity_limit_value_label_->font()); + int width = fm.horizontalAdvance("999"); + + // Set the fixed width for the label + velocity_limit_value_label_->setFixedWidth(width); velocity_limit_layout->addWidget(pub_velocity_limit_slider_); velocity_limit_layout->addSpacing(5); From a0d18d79eecfbf848e73ae629e3b7874d961d0d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Tue, 17 Sep 2024 11:40:12 +0300 Subject: [PATCH 07/11] fix velocity slider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- .../src/custom_slider.cpp | 115 +++++++++--------- 1 file changed, 56 insertions(+), 59 deletions(-) diff --git a/common/tier4_state_rviz_plugin/src/custom_slider.cpp b/common/tier4_state_rviz_plugin/src/custom_slider.cpp index cf3f7c3d4638f..aadfe9677d061 100644 --- a/common/tier4_state_rviz_plugin/src/custom_slider.cpp +++ b/common/tier4_state_rviz_plugin/src/custom_slider.cpp @@ -25,78 +25,75 @@ void CustomSlider::paintEvent(QPaintEvent *) painter.setRenderHint(QPainter::Antialiasing); painter.setPen(Qt::NoPen); - // Initialize style option QStyleOptionSlider opt; initStyleOption(&opt); - QRect grooveRect = + QRectF rect_groove = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderGroove, this); - int centerY = grooveRect.center().y(); - QRect handleRect = + double groove_y = rect_groove.center().y(); + QRectF rect_handle = style()->subControlRect(QStyle::CC_Slider, &opt, QStyle::SC_SliderHandle, this); int value = this->value(); - int minValue = this->minimum(); - int maxValue = this->maximum(); + int val_min = this->minimum(); + int val_max = this->maximum(); - int trackThickness = 14; - int gap = 8; + double track_height = 10.0; + double gap_handle_x = 5.0; - QRect beforeRect( - grooveRect.x(), centerY - trackThickness / 2, handleRect.center().x() - grooveRect.x() - gap, - trackThickness); + // active track + if (value > val_min + 1) { + QRectF rect_before( + rect_groove.x(), groove_y - track_height / 2, + rect_handle.center().x() - rect_groove.x() - gap_handle_x, track_height); - QRect afterRect( - handleRect.center().x() + gap, centerY - trackThickness / 2, - grooveRect.right() - handleRect.center().x() - gap, trackThickness); + QColor color_track_active(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()); + painter.setBrush(color_track_active); + // first half of the track with high radius + painter.drawRoundedRect( + QRectF( + rect_before.left(), groove_y - track_height / 2, rect_before.width() / 2 + track_height / 2, + track_height), + track_height / 2, track_height / 2); - QColor inactiveTrackColor( - autoware::state_rviz_plugin::colors::default_colors.primary_container.c_str()); - QColor activeTrackColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()); - QColor handleColor(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()); - - // only draw the active track if the value is more than the gap from the minimum - if (value > minValue + gap / 2) { - QPainterPath beforePath; - beforePath.moveTo(beforeRect.left(), centerY + trackThickness / 2); // Start from bottom-left - beforePath.quadTo( - beforeRect.left(), centerY - trackThickness / 2, beforeRect.left() + trackThickness * 0.5, - centerY - trackThickness / 2); - beforePath.lineTo(beforeRect.right() - trackThickness * 0.1, centerY - trackThickness / 2); - beforePath.quadTo( - beforeRect.right(), centerY - trackThickness / 2, beforeRect.right(), centerY); - beforePath.quadTo( - beforeRect.right(), centerY + trackThickness / 2, beforeRect.right() - trackThickness * 0.1, - centerY + trackThickness / 2); - beforePath.lineTo(beforeRect.left() + trackThickness * 0.5, centerY + trackThickness / 2); - beforePath.quadTo(beforeRect.left(), centerY + trackThickness / 2, beforeRect.left(), centerY); - painter.fillPath(beforePath, activeTrackColor); + // second half of the track with low radius + painter.drawRoundedRect( + QRectF( + rect_before.center().x(), groove_y - track_height / 2, rect_before.width() / 2, + track_height), + 2.0, 2.0); } - if (value < maxValue - gap / 2) { - QPainterPath afterPath; - afterPath.moveTo(afterRect.left(), centerY + trackThickness / 2); - afterPath.quadTo( - afterRect.left(), centerY - trackThickness / 2, afterRect.left() + trackThickness * 0.1, - centerY - trackThickness / 2); - afterPath.lineTo(afterRect.right() - trackThickness * 0.5, centerY - trackThickness / 2); - afterPath.quadTo(afterRect.right(), centerY - trackThickness / 2, afterRect.right(), centerY); - afterPath.quadTo( - afterRect.right(), centerY + trackThickness / 2, afterRect.right() - trackThickness * 0.5, - centerY + trackThickness / 2); - afterPath.lineTo(afterRect.left() + trackThickness * 0.1, centerY + trackThickness / 2); - afterPath.quadTo(afterRect.left(), centerY + trackThickness / 2, afterRect.left(), centerY); - painter.fillPath(afterPath, inactiveTrackColor); + // inactive track + if (value < val_max - 1) { + QRectF rect_after( + rect_handle.center().x() + gap_handle_x, groove_y - track_height / 2, + rect_groove.right() - rect_handle.center().x() - gap_handle_x, track_height); + + QColor color_track_inactive( + autoware::state_rviz_plugin::colors::default_colors.primary_container.c_str()); + painter.setBrush(color_track_inactive); + // second half of the track with high radius + painter.drawRoundedRect( + QRectF( + rect_after.center().x() - track_height / 2, groove_y - track_height / 2, + rect_after.width() / 2 + track_height / 2, track_height), + track_height / 2, track_height / 2); + + // first half of the track with low radius + painter.drawRoundedRect( + QRectF(rect_after.left(), groove_y - track_height / 2, rect_after.width() / 2, track_height), + 2.0, 2.0); } - painter.setBrush(handleColor); - int handleLineHeight = 30; - int handleLineWidth = 4; - int handleLineRadius = 2; - QRect handleLineRect( - handleRect.center().x() - handleLineWidth / 2, centerY - handleLineHeight / 2, handleLineWidth, - handleLineHeight); - QPainterPath handlePath; - handlePath.addRoundedRect(handleLineRect, handleLineRadius, handleLineRadius); - painter.fillPath(handlePath, handleColor); + double handle_height = 28.0; + double handle_width = 3.0; + double handle_corner_radius = 2.0; + QColor color_handle(autoware::state_rviz_plugin::colors::default_colors.primary.c_str()); + painter.setBrush(color_handle); + painter.drawRoundedRect( + QRectF( + rect_handle.center().x() - handle_width / 2, groove_y - handle_height / 2, handle_width, + handle_height), + handle_corner_radius, handle_corner_radius); } From 49860ce3c2652ff50ede6451203e220b13ade0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Tue, 17 Sep 2024 12:26:39 +0300 Subject: [PATCH 08/11] fix segmented button colors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- .../src/custom_segmented_button_item.cpp | 14 ++++++++----- .../include/custom_segmented_button_item.hpp | 21 ++++++++----------- .../src/include/material_colors.hpp | 4 ++++ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp b/common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp index 10ae20ded5b83..d0ede8ec1dfe6 100644 --- a/common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp +++ b/common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp @@ -15,17 +15,21 @@ CustomSegmentedButtonItem::CustomSegmentedButtonItem(const QString & text, QWidget * parent) : QPushButton(text, parent), - bgColor( - QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_low.c_str())), + bgColor(QColor(autoware::state_rviz_plugin::colors::default_colors.surface.c_str())), checkedBgColor( - QColor(autoware::state_rviz_plugin::colors::default_colors.secondary_container.c_str())), + QColor(autoware::state_rviz_plugin::colors::default_colors.on_secondary_fixed_variant.c_str())), + hoverColor(autoware::state_rviz_plugin::colors::default_colors.on_surface_hover_bg.c_str()), + pressedColor(autoware::state_rviz_plugin::colors::default_colors.on_surface_pressed_bg.c_str()), inactiveTextColor(QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface.c_str())), activeTextColor( QColor(autoware::state_rviz_plugin::colors::default_colors.on_secondary_container.c_str())), + disabledBgColor(autoware::state_rviz_plugin::colors::default_colors.surface.c_str()), + disabledTextColor( + autoware::state_rviz_plugin::colors::default_colors.on_surface_disabled.c_str()), isHovered(false), isActivated(false), - isDisabled(false) - + isDisabled(false), + isPressed(false) { setCheckable(true); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); diff --git a/common/tier4_state_rviz_plugin/src/include/custom_segmented_button_item.hpp b/common/tier4_state_rviz_plugin/src/include/custom_segmented_button_item.hpp index 09d595f14e191..e06fabfb641bf 100644 --- a/common/tier4_state_rviz_plugin/src/include/custom_segmented_button_item.hpp +++ b/common/tier4_state_rviz_plugin/src/include/custom_segmented_button_item.hpp @@ -48,20 +48,17 @@ class CustomSegmentedButtonItem : public QPushButton QColor bgColor; QColor checkedBgColor; - QColor hoverColor = - QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_highest.c_str()); - QColor pressedColor = - QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_high.c_str()); + QColor hoverColor; + QColor pressedColor; QColor inactiveTextColor; QColor activeTextColor; - QColor disabledBgColor = - QColor(autoware::state_rviz_plugin::colors::default_colors.surface_dim.c_str()); - QColor disabledTextColor = - QColor(autoware::state_rviz_plugin::colors::default_colors.on_surface_variant.c_str()); - bool isHovered = false; - bool isActivated = false; - bool isDisabled = false; - bool isPressed = false; + QColor disabledBgColor; + QColor disabledTextColor; + + bool isHovered; + bool isActivated; + bool isDisabled; + bool isPressed; }; #endif // CUSTOM_SEGMENTED_BUTTON_ITEM_HPP_ diff --git a/common/tier4_state_rviz_plugin/src/include/material_colors.hpp b/common/tier4_state_rviz_plugin/src/include/material_colors.hpp index e3ba9084a978d..5c4135950f5a8 100644 --- a/common/tier4_state_rviz_plugin/src/include/material_colors.hpp +++ b/common/tier4_state_rviz_plugin/src/include/material_colors.hpp @@ -85,6 +85,10 @@ struct MaterialColors std::string pressed_button_bg = "#699BB8"; std::string checked_button_bg = "#699BB8"; std::string disabled_button_bg = "#292d30"; + + std::string on_surface_hover_bg = "#212429"; + std::string on_surface_pressed_bg = "#292d32"; + std::string on_surface_disabled = "#5e6266"; }; inline MaterialColors default_colors; From d99bd91172ee89ed658ed5d60d11670b92cf593c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Tue, 17 Sep 2024 13:01:18 +0300 Subject: [PATCH 09/11] fix button colors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- .../src/autoware_state_panel.cpp | 70 ++++++++----------- .../src/include/material_colors.hpp | 4 ++ 2 files changed, 33 insertions(+), 41 deletions(-) diff --git a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp index 18551c88a1bfc..3b16addcffc53 100644 --- a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp +++ b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp @@ -564,28 +564,21 @@ void AutowareStatePanel::onRoute(const RouteState::ConstSharedPtr msg) routing_icon->updateStyle(state, bgColor); routing_label_ptr_->setText(route_state); + clear_route_button_ptr_->updateStyle( + "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_low_hover.c_str()), + QColor( + autoware::state_rviz_plugin::colors::default_colors.surface_container_low_pressed.c_str()), + QColor( + autoware::state_rviz_plugin::colors::default_colors.surface_container_low_pressed.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.disabled_button_bg.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.disabled_button_text.c_str())); if (msg->state == RouteState::SET) { activateButton(clear_route_button_ptr_); - clear_route_button_ptr_->updateStyle( - "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())); } else { deactivateButton(clear_route_button_ptr_); - clear_route_button_ptr_->updateStyle( - "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())); } } @@ -626,11 +619,13 @@ void AutowareStatePanel::onLocalization(const LocalizationInitializationState::C "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())); + QColor(autoware::state_rviz_plugin::colors::default_colors.surface_container_low_hover.c_str()), + QColor( + autoware::state_rviz_plugin::colors::default_colors.surface_container_low_pressed.c_str()), + QColor( + autoware::state_rviz_plugin::colors::default_colors.surface_container_low_pressed.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.disabled_button_bg.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.disabled_button_text.c_str())); } void AutowareStatePanel::onMotion(const MotionState::ConstSharedPtr msg) @@ -667,28 +662,21 @@ void AutowareStatePanel::onMotion(const MotionState::ConstSharedPtr msg) motion_icon->updateStyle(state, bgColor); motion_label_ptr_->setText(motion_state); + accept_start_button_ptr_->updateStyle( + "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_low_hover.c_str()), + QColor( + autoware::state_rviz_plugin::colors::default_colors.surface_container_low_pressed.c_str()), + QColor( + autoware::state_rviz_plugin::colors::default_colors.surface_container_low_pressed.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.disabled_button_bg.c_str()), + QColor(autoware::state_rviz_plugin::colors::default_colors.disabled_button_text.c_str())); if (msg->state == MotionState::STARTING) { activateButton(accept_start_button_ptr_); - accept_start_button_ptr_->updateStyle( - "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())); } else { deactivateButton(accept_start_button_ptr_); - accept_start_button_ptr_->updateStyle( - "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())); } } diff --git a/common/tier4_state_rviz_plugin/src/include/material_colors.hpp b/common/tier4_state_rviz_plugin/src/include/material_colors.hpp index 5c4135950f5a8..5a9b1a32b2e0a 100644 --- a/common/tier4_state_rviz_plugin/src/include/material_colors.hpp +++ b/common/tier4_state_rviz_plugin/src/include/material_colors.hpp @@ -85,10 +85,14 @@ struct MaterialColors std::string pressed_button_bg = "#699BB8"; std::string checked_button_bg = "#699BB8"; std::string disabled_button_bg = "#292d30"; + std::string disabled_button_text = "#6e7276"; std::string on_surface_hover_bg = "#212429"; std::string on_surface_pressed_bg = "#292d32"; std::string on_surface_disabled = "#5e6266"; + + std::string surface_container_low_hover = "#262931"; + std::string surface_container_low_pressed = "#2d303a"; }; inline MaterialColors default_colors; From 37fb14c6c384e0a54d69ab6319ccab792d9b14a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Tue, 17 Sep 2024 13:09:24 +0300 Subject: [PATCH 10/11] fix disabled button colors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- common/tier4_state_rviz_plugin/src/custom_button.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/common/tier4_state_rviz_plugin/src/custom_button.cpp b/common/tier4_state_rviz_plugin/src/custom_button.cpp index 5e641c2a30c8c..1a887497a2903 100644 --- a/common/tier4_state_rviz_plugin/src/custom_button.cpp +++ b/common/tier4_state_rviz_plugin/src/custom_button.cpp @@ -114,7 +114,6 @@ void CustomElevatedButton::paintEvent(QPaintEvent *) backgroundPath.addRoundedRect(r, cornerRadius, cornerRadius); if (!isEnabled()) { painter.setBrush(disabledBgColor); - painter.setOpacity(0.12); } else { painter.setBrush(buttonColor); } @@ -122,9 +121,6 @@ void CustomElevatedButton::paintEvent(QPaintEvent *) painter.drawPath(backgroundPath); // Draw button text - if (!isEnabled()) { - painter.setOpacity(0.38); - } painter.setPen(currentTextColor); painter.drawText(r, Qt::AlignCenter, text()); } From 3bd34d73d55cd5da44d2cf84b89d67783bcacb7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Tue, 17 Sep 2024 14:37:58 +0300 Subject: [PATCH 11/11] remove commented line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp index 3b16addcffc53..ffcf801e758e0 100644 --- a/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp +++ b/common/tier4_state_rviz_plugin/src/autoware_state_panel.cpp @@ -427,7 +427,6 @@ QVBoxLayout * AutowareStatePanel::makeVelocityLimitGroup() CustomSlider * pub_velocity_limit_slider_ = new CustomSlider(Qt::Horizontal); pub_velocity_limit_slider_->setRange(0, 100); pub_velocity_limit_slider_->setValue(0); - // pub_velocity_limit_slider_->setMaximumWidth(300); connect(pub_velocity_limit_slider_, &QSlider::sliderPressed, this, [this]() { sliderIsDragging = true; // User starts dragging the handle