@@ -36,8 +36,16 @@ AutowareStatePanel::AutowareStatePanel(QWidget * parent) : rviz_common::Panel(pa
36
36
this ->setMaximumWidth (400 );
37
37
38
38
// Layout
39
- auto * main_v_layout = new QVBoxLayout;
40
- main_v_layout->setAlignment (Qt::AlignTop);
39
+
40
+ // Create a new container widget
41
+ QWidget * containerWidget = new QWidget (this );
42
+ containerWidget->setSizePolicy (QSizePolicy::Expanding, QSizePolicy::Expanding);
43
+
44
+ containerWidget->setStyleSheet (" QWidget { background-color: #0F1417; color: #d0e6f2; }" );
45
+
46
+ auto * containerLayout = new QVBoxLayout (containerWidget);
47
+ // Set the alignment of the layout
48
+ containerLayout->setAlignment (Qt::AlignTop);
41
49
42
50
auto * operation_mode_group = makeOperationModeGroup ();
43
51
auto * diagnostic_v_layout = new QVBoxLayout;
@@ -56,16 +64,18 @@ AutowareStatePanel::AutowareStatePanel(QWidget * parent) : rviz_common::Panel(pa
56
64
// diagnostic_v_layout->addSpacing(5);
57
65
diagnostic_v_layout->addLayout (fail_safe_group);
58
66
59
- // main_v_layout ->addLayout(diagnostic_group);
67
+ // containerLayout ->addLayout(diagnostic_group);
60
68
61
- main_v_layout ->addLayout (operation_mode_group);
62
- // main_v_layout ->addSpacing(5);
63
- main_v_layout ->addLayout (diagnostic_v_layout);
69
+ containerLayout ->addLayout (operation_mode_group);
70
+ // containerLayout ->addSpacing(5);
71
+ containerLayout ->addLayout (diagnostic_v_layout);
64
72
// main_v_layout->addSpacing(5);
65
- main_v_layout ->addLayout (velocity_limit_group);
73
+ containerLayout ->addLayout (velocity_limit_group);
66
74
67
- // Setting the layout
68
- setLayout (main_v_layout);
75
+ // Main layout for AutowareStatePanel
76
+ QVBoxLayout * mainLayout = new QVBoxLayout (this );
77
+ mainLayout->addWidget (containerWidget);
78
+ setLayout (mainLayout);
69
79
}
70
80
71
81
void AutowareStatePanel::onInitialize ()
@@ -394,28 +404,31 @@ QVBoxLayout * AutowareStatePanel::makeVelocityLimitGroup()
394
404
void AutowareStatePanel::onOperationMode (const OperationModeState::ConstSharedPtr msg)
395
405
{
396
406
auto changeButtonState = [this ](
397
- QPushButton * button, const bool is_desired_mode_available,
407
+ CustomSegmentedButtonItem * button,
408
+ const bool is_desired_mode_available,
398
409
const uint8_t current_mode = OperationModeState::UNKNOWN,
399
410
const uint8_t desired_mode = OperationModeState::STOP) {
400
- if (is_desired_mode_available && current_mode != desired_mode) {
401
- activateButton (button);
402
- button->setStyleSheet (
403
- " QPushButton {"
404
- " background-color: #8BD0F0;color: #003546;"
405
- " font-weight: bold;"
406
- " }"
407
- " QPushButton:hover {"
408
- " background-color: #84c2e6;"
409
- " color: #003546;"
410
- " }" );
411
+ button->setHovered (false ); // Reset hover state
412
+ if (is_desired_mode_available) {
413
+ if (current_mode == desired_mode) {
414
+ // Enabled and Checked
415
+ button->setChecked (true );
416
+ button->setActivated (true );
417
+ button->setCheckableButton (false );
418
+ button->setDisabledButton (false );
419
+ } else {
420
+ // Enabled and Checkable
421
+ button->setChecked (false );
422
+ button->setActivated (false );
423
+ button->setCheckableButton (true );
424
+ button->setDisabledButton (false );
425
+ }
411
426
} else {
412
- button->setStyleSheet (
413
- " QPushButton {"
414
- " background-color: #292d30;color: #6e7276;"
415
- " border: 2px solid #292d30;"
416
- " font-weight: bold;"
417
- " }" );
418
- deactivateButton (button);
427
+ // Disabled and Unchecked
428
+ button->setChecked (false );
429
+ button->setActivated (false );
430
+ button->setCheckableButton (false );
431
+ button->setDisabledButton (true );
419
432
}
420
433
};
421
434
@@ -437,6 +450,11 @@ void AutowareStatePanel::onOperationMode(const OperationModeState::ConstSharedPt
437
450
438
451
// toggle switch for control mode
439
452
changeToggleSwitchState (control_mode_switch_ptr_, !msg->is_autoware_control_enabled );
453
+
454
+ // routing
455
+ if (msg->is_in_transition ) {
456
+ routing_icon->updateStyle (Pending, QColor (" #eef08b" ));
457
+ }
440
458
}
441
459
442
460
void AutowareStatePanel::onRoute (const RouteState::ConstSharedPtr msg)
0 commit comments