mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-11-03 03:03:43 +08:00
rename and move around
This commit is contained in:
@@ -54,7 +54,6 @@ lateral_panel_qt_src = [
|
||||
|
||||
longitudinal_panel_qt_src = [
|
||||
"sunnypilot/qt/offroad/settings/longitudinal/custom_acc_increment.cc",
|
||||
"sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_assist.cc",
|
||||
"sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_policy.cc",
|
||||
"sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_settings.cc",
|
||||
]
|
||||
|
||||
+13
-18
@@ -4,12 +4,21 @@
|
||||
* This file is part of sunnypilot and is licensed under the MIT License.
|
||||
* See the LICENSE.md file in the root directory for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/ui/sunnypilot/ui.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/expandable_row.h"
|
||||
enum class SpeedLimitMode {
|
||||
OFF,
|
||||
INFORMATION,
|
||||
WARNING,
|
||||
ASSIST,
|
||||
};
|
||||
|
||||
inline const char *SpeedLimitModeTexts[]{
|
||||
QT_TR_NOOP("Off"),
|
||||
QT_TR_NOOP("Information"),
|
||||
QT_TR_NOOP("Warning"),
|
||||
QT_TR_NOOP("Assist"),
|
||||
};
|
||||
|
||||
enum class SpeedLimitOffsetType {
|
||||
NONE,
|
||||
@@ -38,17 +47,3 @@ inline const char *SpeedLimitSourcePolicyTexts[]{
|
||||
QT_TR_NOOP("Map\nFirst"),
|
||||
QT_TR_NOOP("Combined\nData")
|
||||
};
|
||||
|
||||
class SpeedLimitAssist : public ExpandableToggleRow {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SpeedLimitAssist(const QString ¶m, const QString &title, const QString &desc, const QString &icon, QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void speedLimitSettingsButtonClicked();
|
||||
|
||||
private:
|
||||
Params params;
|
||||
PushButtonSP *speedLimitSettings;
|
||||
};
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
|
||||
*
|
||||
* This file is part of sunnypilot and is licensed under the MIT License.
|
||||
* See the LICENSE.md file in the root directory for more details.
|
||||
*/
|
||||
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_assist.h"
|
||||
|
||||
SpeedLimitAssist::SpeedLimitAssist(const QString ¶m, const QString &title, const QString &desc, const QString &icon, QWidget *parent)
|
||||
: ExpandableToggleRow(param, title, desc, icon, parent) {
|
||||
|
||||
auto *speedLimitFrame = new QFrame(this);
|
||||
auto *speedLimitFrameLayout = new QVBoxLayout();
|
||||
speedLimitFrame->setLayout(speedLimitFrameLayout);
|
||||
speedLimitFrameLayout->setSpacing(0);
|
||||
speedLimitFrameLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
speedLimitSettings = new PushButtonSP(tr("Customize Speed Limit"));
|
||||
speedLimitFrameLayout->addWidget(speedLimitSettings);
|
||||
connect(speedLimitSettings, &QPushButton::clicked, [&]() {
|
||||
emit speedLimitSettingsButtonClicked();
|
||||
});
|
||||
addItem(speedLimitFrame);
|
||||
}
|
||||
+2
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "selfdrive/ui/sunnypilot/ui.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_assist.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/helpers.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h"
|
||||
|
||||
class SpeedLimitPolicy : public QWidget {
|
||||
@@ -20,6 +20,7 @@ public:
|
||||
void refresh();
|
||||
void showEvent(QShowEvent *event) override;
|
||||
|
||||
signals:
|
||||
signals:
|
||||
void backPress();
|
||||
|
||||
|
||||
+29
@@ -22,6 +22,34 @@ SpeedLimitSettings::SpeedLimitSettings(QWidget *parent) : QStackedWidget(parent)
|
||||
|
||||
ListWidgetSP *list = new ListWidgetSP(this, true);
|
||||
|
||||
// Speed Limit Assist
|
||||
// TODO-SP: OptionControlSP with Speed Limit Information/Warning as a single option
|
||||
speedLimitAssistToggle = new ParamControlSP(
|
||||
"SpeedLimitAssist",
|
||||
tr("Speed Limit Assist (SLA)"),
|
||||
tr("When you engage ACC, you will be prompted to set the cruising speed to the speed limit of the road adjusted by the Offset and Source Policy specified, or the current driving speed. "
|
||||
"The maximum cruising speed will always be the MAX set speed."),
|
||||
"",
|
||||
this);
|
||||
list->addItem(speedLimitAssistToggle);
|
||||
|
||||
// TODO-SP: Combine Assist/Warning/Information
|
||||
// std::vector<QString> speed_limit_texts{
|
||||
// SpeedLimitModeTexts[static_cast<int>(SpeedLimitMode::OFF)],
|
||||
// SpeedLimitModeTexts[static_cast<int>(SpeedLimitMode::INFORMATION)],
|
||||
// SpeedLimitModeTexts[static_cast<int>(SpeedLimitMode::WARNING)],
|
||||
// SpeedLimitModeTexts[static_cast<int>(SpeedLimitMode::ASSIST)],
|
||||
// };
|
||||
// speed_limit_mode_settings = new ButtonParamControlSP(
|
||||
// "SpeedLimitMode",
|
||||
// tr("Speed Limit Mode"),
|
||||
// tr("When you engage ACC, you will be prompted to set the cruising speed to the speed limit of the road adjusted by the Offset and Source Policy specified, or the current driving speed. "
|
||||
// "The maximum cruising speed will always be the MAX set speed."),
|
||||
// "",
|
||||
// speed_limit_texts,
|
||||
// 250);
|
||||
// list->addItem(speed_limit_mode_settings);
|
||||
|
||||
auto *speedLimitBtnFrame = new QFrame(this);
|
||||
auto *speedLimitBtnFrameLayout = new QGridLayout();
|
||||
speedLimitBtnFrame->setLayout(speedLimitBtnFrameLayout);
|
||||
@@ -73,6 +101,7 @@ SpeedLimitSettings::SpeedLimitSettings(QWidget *parent) : QStackedWidget(parent)
|
||||
|
||||
list->addItem(offsetFrame);
|
||||
|
||||
// connect(speed_limit_mode_settings, &ButtonParamControlSP::buttonClicked, this, &SpeedLimitSettings::refresh);
|
||||
connect(speed_limit_offset, &OptionControlSP::updateLabels, this, &SpeedLimitSettings::refresh);
|
||||
connect(speed_limit_offset_settings, &ButtonParamControlSP::showDescriptionEvent, speed_limit_offset, &OptionControlSP::showDescription);
|
||||
connect(speed_limit_offset_settings, &ButtonParamControlSP::buttonClicked, this, &SpeedLimitSettings::refresh);
|
||||
|
||||
+3
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "selfdrive/ui/sunnypilot/ui.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_assist.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/helpers.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_policy.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h"
|
||||
|
||||
@@ -27,6 +27,8 @@ signals:
|
||||
private:
|
||||
Params params;
|
||||
QFrame *subPanelFrame;
|
||||
ParamControlSP *speedLimitAssistToggle;
|
||||
// ButtonParamControlSP *speed_limit_mode_settings;
|
||||
PushButtonSP *speedLimitSource;
|
||||
ButtonParamControlSP *speed_limit_offset_settings;
|
||||
OptionControlSP *speed_limit_offset;
|
||||
|
||||
@@ -55,28 +55,21 @@ LongitudinalPanel::LongitudinalPanel(QWidget *parent) : QWidget(parent) {
|
||||
|
||||
QObject::connect(uiState(), &UIState::offroadTransition, this, &LongitudinalPanel::refresh);
|
||||
|
||||
slcControl = new SpeedLimitAssist(
|
||||
"SpeedLimitAssist",
|
||||
tr("Speed Limit Assist (SLA)"),
|
||||
tr("When you engage ACC, you will be prompted to set the cruising speed to the speed limit of the road adjusted by the Offset and Source Policy specified, or the current driving speed. "
|
||||
"The maximum cruising speed will always be the MAX set speed."),
|
||||
"",
|
||||
this);
|
||||
list->addItem(slcControl);
|
||||
|
||||
connect(slcControl, &SpeedLimitAssist::speedLimitSettingsButtonClicked, [=]() {
|
||||
speedLimitSettings = new PushButtonSP(tr("Speed Limit"), 750, this);
|
||||
connect(speedLimitSettings, &QPushButton::clicked, [&]() {
|
||||
cruisePanelScroller->setLastScrollPosition();
|
||||
main_layout->setCurrentWidget(speedLimitScren);
|
||||
main_layout->setCurrentWidget(speedLimitScreen);
|
||||
});
|
||||
list->addItem(speedLimitSettings);
|
||||
|
||||
speedLimitScren = new SpeedLimitSettings(this);
|
||||
connect(speedLimitScren, &SpeedLimitSettings::backPress, [=]() {
|
||||
speedLimitScreen = new SpeedLimitSettings(this);
|
||||
connect(speedLimitScreen, &SpeedLimitSettings::backPress, [=]() {
|
||||
cruisePanelScroller->restoreScrollPosition();
|
||||
main_layout->setCurrentWidget(cruisePanelScreen);
|
||||
});
|
||||
|
||||
main_layout->addWidget(cruisePanelScreen);
|
||||
main_layout->addWidget(speedLimitScren);
|
||||
main_layout->addWidget(speedLimitScreen);
|
||||
main_layout->setCurrentWidget(cruisePanelScreen);
|
||||
refresh(offroad);
|
||||
}
|
||||
@@ -129,8 +122,6 @@ void LongitudinalPanel::refresh(bool _offroad) {
|
||||
customAccIncrement->showDescription();
|
||||
params.remove("IntelligentCruiseButtonManagement");
|
||||
intelligentCruiseButtonManagement->toggleFlipped(false);
|
||||
params.remove("SpeedLimitAssist");
|
||||
slcControl->toggleFlipped(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +134,6 @@ void LongitudinalPanel::refresh(bool _offroad) {
|
||||
customAccIncrement->refresh();
|
||||
|
||||
SmartCruiseControlVision->setEnabled(has_longitudinal_control || icbm_allowed);
|
||||
slcControl->setEnabled(has_longitudinal_control || icbm_allowed);
|
||||
|
||||
offroad = _offroad;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/custom_acc_increment.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_assist.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/longitudinal/speed_limit/speed_limit_settings.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h"
|
||||
#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h"
|
||||
@@ -35,6 +34,6 @@ private:
|
||||
CustomAccIncrement *customAccIncrement = nullptr;
|
||||
ParamControl *SmartCruiseControlVision;
|
||||
ParamControl *intelligentCruiseButtonManagement = nullptr;
|
||||
SpeedLimitSettings *speedLimitScren;
|
||||
SpeedLimitAssist *slcControl;
|
||||
SpeedLimitSettings *speedLimitScreen;
|
||||
PushButtonSP *speedLimitSettings;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user