|
|
|
@@ -1,7 +1,7 @@
|
|
|
|
#include "selfdrive/frogpilot/ui/visual_settings.h"
|
|
|
|
#include "selfdrive/oscarpilot/settings/basic.h"
|
|
|
|
#include "selfdrive/ui/ui.h"
|
|
|
|
#include "selfdrive/ui/ui.h"
|
|
|
|
|
|
|
|
|
|
|
|
FrogPilotVisualsPanel::FrogPilotVisualsPanel(OscarSettingsWindow *parent) : FrogPilotListWidget(parent) {
|
|
|
|
OscarPilotVisualsPanel::OscarPilotVisualsPanel(OscarSettingsWindow *parent) : FrogPilotListWidget(parent) {
|
|
|
|
const std::vector<std::tuple<QString, QString, QString, QString>> visualToggles {
|
|
|
|
const std::vector<std::tuple<QString, QString, QString, QString>> visualToggles {
|
|
|
|
{"CustomTheme", "Custom Themes", "Enable the ability to use custom themes.", "../frogpilot/assets/wheel_images/frog.png"},
|
|
|
|
{"CustomTheme", "Custom Themes", "Enable the ability to use custom themes.", "../frogpilot/assets/wheel_images/frog.png"},
|
|
|
|
{"CustomColors", "Color Theme", "Switch out the standard openpilot color scheme with a custom color scheme.\n\nWant to submit your own color scheme? Post it in the 'feature-request' channel in the FrogPilot Discord!", ""},
|
|
|
|
{"CustomColors", "Color Theme", "Switch out the standard openpilot color scheme with a custom color scheme.\n\nWant to submit your own color scheme? Post it in the 'feature-request' channel in the FrogPilot Discord!", ""},
|
|
|
|
@@ -167,15 +167,15 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(OscarSettingsWindow *parent) : Frog
|
|
|
|
modelUIKeys = {"AccelerationPath", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"};
|
|
|
|
modelUIKeys = {"AccelerationPath", "LaneLinesWidth", "PathEdgeWidth", "PathWidth", "RoadEdgesWidth", "UnlimitedLength"};
|
|
|
|
qolKeys = {"DriveStats", "HideSpeed", "ShowSLCOffset"};
|
|
|
|
qolKeys = {"DriveStats", "HideSpeed", "ShowSLCOffset"};
|
|
|
|
|
|
|
|
|
|
|
|
QObject::connect(device(), &Device::interactiveTimeout, this, &FrogPilotVisualsPanel::hideSubToggles);
|
|
|
|
QObject::connect(device(), &Device::interactiveTimeout, this, &OscarPilotVisualsPanel::hideSubToggles);
|
|
|
|
QObject::connect(parent, &OscarSettingsWindow::closeParentToggle, this, &FrogPilotVisualsPanel::hideSubToggles);
|
|
|
|
QObject::connect(parent, &OscarSettingsWindow::closeParentToggle, this, &OscarPilotVisualsPanel::hideSubToggles);
|
|
|
|
QObject::connect(parent, &OscarSettingsWindow::updateMetric, this, &FrogPilotVisualsPanel::updateMetric);
|
|
|
|
QObject::connect(parent, &OscarSettingsWindow::updateMetric, this, &OscarPilotVisualsPanel::updateMetric);
|
|
|
|
|
|
|
|
|
|
|
|
hideSubToggles();
|
|
|
|
hideSubToggles();
|
|
|
|
updateMetric();
|
|
|
|
updateMetric();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FrogPilotVisualsPanel::updateToggles() {
|
|
|
|
void OscarPilotVisualsPanel::updateToggles() {
|
|
|
|
std::thread([this]() {
|
|
|
|
std::thread([this]() {
|
|
|
|
paramsMemory.putBool("FrogPilotTogglesUpdated", true);
|
|
|
|
paramsMemory.putBool("FrogPilotTogglesUpdated", true);
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
|
|
|
@@ -183,7 +183,7 @@ void FrogPilotVisualsPanel::updateToggles() {
|
|
|
|
}).detach();
|
|
|
|
}).detach();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FrogPilotVisualsPanel::updateMetric() {
|
|
|
|
void OscarPilotVisualsPanel::updateMetric() {
|
|
|
|
bool previousIsMetric = isMetric;
|
|
|
|
bool previousIsMetric = isMetric;
|
|
|
|
isMetric = params.getBool("IsMetric");
|
|
|
|
isMetric = params.getBool("IsMetric");
|
|
|
|
|
|
|
|
|
|
|
|
@@ -221,11 +221,11 @@ void FrogPilotVisualsPanel::updateMetric() {
|
|
|
|
previousIsMetric = isMetric;
|
|
|
|
previousIsMetric = isMetric;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FrogPilotVisualsPanel::parentToggleClicked() {
|
|
|
|
void OscarPilotVisualsPanel::parentToggleClicked() {
|
|
|
|
this->openParentToggle();
|
|
|
|
this->openParentToggle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FrogPilotVisualsPanel::hideSubToggles() {
|
|
|
|
void OscarPilotVisualsPanel::hideSubToggles() {
|
|
|
|
for (auto &[key, toggle] : toggles) {
|
|
|
|
for (auto &[key, toggle] : toggles) {
|
|
|
|
bool subToggles = modelUIKeys.find(key.c_str()) != modelUIKeys.end() ||
|
|
|
|
bool subToggles = modelUIKeys.find(key.c_str()) != modelUIKeys.end() ||
|
|
|
|
customOnroadUIKeys.find(key.c_str()) != customOnroadUIKeys.end() ||
|
|
|
|
customOnroadUIKeys.find(key.c_str()) != customOnroadUIKeys.end() ||
|
|
|
|
@@ -237,6 +237,6 @@ void FrogPilotVisualsPanel::hideSubToggles() {
|
|
|
|
this->closeParentToggle();
|
|
|
|
this->closeParentToggle();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FrogPilotVisualsPanel::hideEvent(QHideEvent *event) {
|
|
|
|
void OscarPilotVisualsPanel::hideEvent(QHideEvent *event) {
|
|
|
|
hideSubToggles();
|
|
|
|
hideSubToggles();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|