wip
This commit is contained in:
@@ -169,10 +169,10 @@ OscarPilotVisualsPanel::OscarPilotVisualsPanel(OscarSettingsWindow *parent) : Fr
|
||||
|
||||
QObject::connect(device(), &Device::interactiveTimeout, this, &OscarPilotVisualsPanel::hideSubToggles);
|
||||
QObject::connect(parent, &OscarSettingsWindow::closeParentToggle, this, &OscarPilotVisualsPanel::hideSubToggles);
|
||||
QObject::connect(parent, &OscarSettingsWindow::updateMetric, this, &OscarPilotVisualsPanel::updateMetric);
|
||||
// QObject::connect(parent, &OscarSettingsWindow::updateMetric, this, &OscarPilotVisualsPanel::updateMetric);
|
||||
|
||||
hideSubToggles();
|
||||
updateMetric();
|
||||
// updateMetric();
|
||||
}
|
||||
|
||||
void OscarPilotVisualsPanel::updateToggles() {
|
||||
@@ -181,45 +181,83 @@ void OscarPilotVisualsPanel::updateToggles() {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
paramsMemory.putBool("FrogPilotTogglesUpdated", false);
|
||||
}).detach();
|
||||
}
|
||||
// }
|
||||
|
||||
void OscarPilotVisualsPanel::updateMetric() {
|
||||
bool previousIsMetric = isMetric;
|
||||
isMetric = params.getBool("IsMetric");
|
||||
// void OscarPilotVisualsPanel::updateMetric() {
|
||||
// bool previousIsMetric = isMetric;
|
||||
// isMetric = params.getBool("IsMetric");
|
||||
|
||||
if (isMetric != previousIsMetric) {
|
||||
double distanceConversion = isMetric ? INCH_TO_CM : CM_TO_INCH;
|
||||
double speedConversion = isMetric ? FOOT_TO_METER : METER_TO_FOOT;
|
||||
params.putInt("LaneLinesWidth", std::nearbyint(params.getInt("LaneLinesWidth") * distanceConversion));
|
||||
params.putInt("RoadEdgesWidth", std::nearbyint(params.getInt("RoadEdgesWidth") * distanceConversion));
|
||||
params.putInt("PathWidth", std::nearbyint(params.getInt("PathWidth") * speedConversion));
|
||||
}
|
||||
// if (isMetric != previousIsMetric) {
|
||||
// double distanceConversion = isMetric ? INCH_TO_CM : CM_TO_INCH;
|
||||
// double speedConversion = isMetric ? FOOT_TO_METER : METER_TO_FOOT;
|
||||
// params.putInt("LaneLinesWidth", std::nearbyint(params.getInt("LaneLinesWidth") * distanceConversion));
|
||||
// params.putInt("RoadEdgesWidth", std::nearbyint(params.getInt("RoadEdgesWidth") * distanceConversion));
|
||||
// params.putInt("PathWidth", std::nearbyint(params.getInt("PathWidth") * speedConversion));
|
||||
// }
|
||||
|
||||
FrogPilotParamValueControl *laneLinesWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["LaneLinesWidth"]);
|
||||
FrogPilotParamValueControl *roadEdgesWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["RoadEdgesWidth"]);
|
||||
FrogPilotParamValueControl *pathWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["PathWidth"]);
|
||||
// FrogPilotParamValueControl *laneLinesWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["LaneLinesWidth"]);
|
||||
// FrogPilotParamValueControl *roadEdgesWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["RoadEdgesWidth"]);
|
||||
// FrogPilotParamValueControl *pathWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["PathWidth"]);
|
||||
|
||||
if (isMetric) {
|
||||
laneLinesWidthToggle->setDescription("Customize the lane line width.\n\nDefault matches the Vienna average of 10 centimeters.");
|
||||
roadEdgesWidthToggle->setDescription("Customize the road edges width.\n\nDefault is 1/2 of the Vienna average lane line width of 10 centimeters.");
|
||||
// if (isMetric) {
|
||||
// laneLinesWidthToggle->setDescription("Customize the lane line width.\n\nDefault matches the Vienna average of 10 centimeters.");
|
||||
// roadEdgesWidthToggle->setDescription("Customize the road edges width.\n\nDefault is 1/2 of the Vienna average lane line width of 10 centimeters.");
|
||||
|
||||
laneLinesWidthToggle->updateControl(0, 60, " centimeters");
|
||||
roadEdgesWidthToggle->updateControl(0, 60, " centimeters");
|
||||
pathWidthToggle->updateControl(0, 30, " meters");
|
||||
} else {
|
||||
laneLinesWidthToggle->setDescription("Customize the lane line width.\n\nDefault matches the MUTCD average of 4 inches.");
|
||||
roadEdgesWidthToggle->setDescription("Customize the road edges width.\n\nDefault is 1/2 of the MUTCD average lane line width of 4 inches.");
|
||||
// laneLinesWidthToggle->updateControl(0, 60, " centimeters");
|
||||
// roadEdgesWidthToggle->updateControl(0, 60, " centimeters");
|
||||
// pathWidthToggle->updateControl(0, 30, " meters");
|
||||
// } else {
|
||||
// laneLinesWidthToggle->setDescription("Customize the lane line width.\n\nDefault matches the MUTCD average of 4 inches.");
|
||||
// roadEdgesWidthToggle->setDescription("Customize the road edges width.\n\nDefault is 1/2 of the MUTCD average lane line width of 4 inches.");
|
||||
|
||||
laneLinesWidthToggle->updateControl(0, 24, " inches");
|
||||
roadEdgesWidthToggle->updateControl(0, 24, " inches");
|
||||
pathWidthToggle->updateControl(0, 100, " feet");
|
||||
}
|
||||
// laneLinesWidthToggle->updateControl(0, 24, " inches");
|
||||
// roadEdgesWidthToggle->updateControl(0, 24, " inches");
|
||||
// pathWidthToggle->updateControl(0, 100, " feet");
|
||||
// }
|
||||
|
||||
laneLinesWidthToggle->refresh();
|
||||
roadEdgesWidthToggle->refresh();
|
||||
// laneLinesWidthToggle->refresh();
|
||||
// roadEdgesWidthToggle->refresh();
|
||||
|
||||
previousIsMetric = isMetric;
|
||||
}
|
||||
// previousIsMetric = isMetric;
|
||||
// }
|
||||
|
||||
// void OscarPilotVisualsPanel::updateMetric() {
|
||||
// bool previousIsMetric = isMetric;
|
||||
// isMetric = params.getBool("IsMetric");
|
||||
|
||||
// if (isMetric != previousIsMetric) {
|
||||
// double distanceConversion = isMetric ? INCH_TO_CM : CM_TO_INCH;
|
||||
// double speedConversion = isMetric ? FOOT_TO_METER : METER_TO_FOOT;
|
||||
// params.putInt("LaneLinesWidth", std::nearbyint(params.getInt("LaneLinesWidth") * distanceConversion));
|
||||
// params.putInt("RoadEdgesWidth", std::nearbyint(params.getInt("RoadEdgesWidth") * distanceConversion));
|
||||
// params.putInt("PathWidth", std::nearbyint(params.getInt("PathWidth") * speedConversion));
|
||||
// }
|
||||
|
||||
// FrogPilotParamValueControl *laneLinesWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["LaneLinesWidth"]);
|
||||
// FrogPilotParamValueControl *roadEdgesWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["RoadEdgesWidth"]);
|
||||
// FrogPilotParamValueControl *pathWidthToggle = static_cast<FrogPilotParamValueControl*>(toggles["PathWidth"]);
|
||||
|
||||
// if (isMetric) {
|
||||
// laneLinesWidthToggle->setDescription("Customize the lane line width.\n\nDefault matches the Vienna average of 10 centimeters.");
|
||||
// roadEdgesWidthToggle->setDescription("Customize the road edges width.\n\nDefault is 1/2 of the Vienna average lane line width of 10 centimeters.");
|
||||
|
||||
// laneLinesWidthToggle->updateControl(0, 60, " centimeters");
|
||||
// roadEdgesWidthToggle->updateControl(0, 60, " centimeters");
|
||||
// pathWidthToggle->updateControl(0, 30, " meters");
|
||||
// } else {
|
||||
// laneLinesWidthToggle->setDescription("Customize the lane line width.\n\nDefault matches the MUTCD average of 4 inches.");
|
||||
// roadEdgesWidthToggle->setDescription("Customize the road edges width.\n\nDefault is 1/2 of the MUTCD average lane line width of 4 inches.");
|
||||
|
||||
// laneLinesWidthToggle->updateControl(0, 24, " inches");
|
||||
// roadEdgesWidthToggle->updateControl(0, 24, " inches");
|
||||
// pathWidthToggle->updateControl(0, 100, " feet");
|
||||
// }
|
||||
|
||||
// laneLinesWidthToggle->refresh();
|
||||
// roadEdgesWidthToggle->refresh();
|
||||
|
||||
// previousIsMetric = isMetric;
|
||||
// }
|
||||
|
||||
void OscarPilotVisualsPanel::parentToggleClicked() {
|
||||
this->openParentToggle();
|
||||
|
||||
Reference in New Issue
Block a user