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