This commit is contained in:
Your Name
2024-02-17 14:42:15 -06:00
parent faab849d39
commit a72cbe9191
4 changed files with 15 additions and 15 deletions

View File

@@ -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();
} }

View File

@@ -3,13 +3,13 @@
#include <set> #include <set>
#include "selfdrive/frogpilot/ui/frogpilot_functions.h" #include "selfdrive/frogpilot/ui/frogpilot_functions.h"
#include "selfdrive/ui/qt/offroad/settings.h" #include "selfdrive/oscarpilot/settings/settings.h"
class FrogPilotVisualsPanel : public FrogPilotListWidget { class OscarPilotVisualsPanel : public FrogPilotListWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit FrogPilotVisualsPanel(OscarSettingsWindow *parent); explicit OscarPilotVisualsPanel(OscarSettingsWindow *parent);
signals: signals:
void closeParentToggle(); void closeParentToggle();

View File

@@ -26,7 +26,7 @@
// #include "selfdrive/frogpilot/navigation/ui/navigation_settings.h" // #include "selfdrive/frogpilot/navigation/ui/navigation_settings.h"
// #include "selfdrive/frogpilot/ui/control_settings.h" // #include "selfdrive/frogpilot/ui/control_settings.h"
#include "selfdrive/frogpilot/ui/vehicle_settings.h" #include "selfdrive/oscarpilot/settings/basic.h"
// #include "selfdrive/frogpilot/ui/visual_settings.h" // #include "selfdrive/frogpilot/ui/visual_settings.h"
#include "selfdrive/oscarpilot/settings/settings.h" #include "selfdrive/oscarpilot/settings/settings.h"

View File

@@ -28,7 +28,7 @@ widgets_src = ["ui.cc", "qt/widgets/input.cc", "qt/widgets/drive_stats.cc", "qt/
"../frogpilot/ui/frogpilot_functions.cc", "../frogpilot/navigation/ui/navigation_settings.cc", "../frogpilot/ui/frogpilot_functions.cc", "../frogpilot/navigation/ui/navigation_settings.cc",
"../frogpilot/ui/control_settings.cc", "../frogpilot/ui/vehicle_settings.cc", "../frogpilot/ui/control_settings.cc", "../frogpilot/ui/vehicle_settings.cc",
"../frogpilot/ui/visual_settings.cc", "../frogpilot/ui/visual_settings.cc",
"../oscarpilot/settings/settings.cc" "../oscarpilot/settings/settings.cc", "../oscarpilot/settings/basic.cc",
] ]
qt_env['CPPDEFINES'] = [] qt_env['CPPDEFINES'] = []