diff --git a/src/autoapp/UI/MainWindow.cpp b/src/autoapp/UI/MainWindow.cpp index 355b3c1..2f0ee8a 100644 --- a/src/autoapp/UI/MainWindow.cpp +++ b/src/autoapp/UI/MainWindow.cpp @@ -57,24 +57,22 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi // restore audio vol on startup if file exists QFileInfo volFile("/boot/crankshaft/volume"); - if (volFile.exists()) { + QFileInfo capvolFile("/boot/crankshaft/capvolume"); + if (volFile.exists() + capvolFile.exists()) { + QFile volumeFile(QString("/boot/crankshaft/volume")); volumeFile.open(QIODevice::ReadOnly); QTextStream data_volume(&volumeFile); QString linevolume = data_volume.readAll(); volumeFile.close(); - system((std::string("/usr/local/bin/autoapp_helper setvolume ") + std::string(linevolume.toStdString())).c_str()); - } - // restore audio vol on startup if file exists - QFileInfo capvolFile("/boot/crankshaft/capvolume"); - if (capvolFile.exists()) { QFile capvolumeFile(QString("/boot/crankshaft/capvolume")); capvolumeFile.open(QIODevice::ReadOnly); QTextStream data_capvolume(&capvolumeFile); QString linecapvolume = data_capvolume.readAll(); capvolumeFile.close(); - system((std::string("/usr/local/bin/autoapp_helper setcapvolume ") + std::string(linecapvolume.toStdString())).c_str()); + system( (std::string("/usr/local/bin/autoapp_helper setvolume ") + std::string(linevolume.toStdString()) ).c_str()); + system( (std::string("/usr/local/bin/autoapp_helper setcapvolume ") + std::string(linecapvolume.toStdString()) ).c_str()); } // Set default font and size @@ -453,8 +451,8 @@ void f1x::openauto::autoapp::ui::MainWindow::hideRearCamBG() void f1x::openauto::autoapp::ui::MainWindow::saveVolumeOnExit() { - system("/usr/local/bin/autoapp_helper savevolume"); - system("/usr/local/bin/autoapp_helper savecapvolume"); + system("/usr/local/bin/autoapp_helper savevolumes"); + //system("/usr/local/bin/autoapp_helper savecapvolume"); } void f1x::openauto::autoapp::ui::MainWindow::showTime() @@ -549,3 +547,5 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime() } }**/ } + + diff --git a/src/autoapp/UI/SettingsWindow.cpp b/src/autoapp/UI/SettingsWindow.cpp index f656a9d..a7375b7 100644 --- a/src/autoapp/UI/SettingsWindow.cpp +++ b/src/autoapp/UI/SettingsWindow.cpp @@ -107,8 +107,27 @@ void SettingsWindow::onSave() configuration_->save(); - system((std::string("/usr/local/bin/autoapp_helper setvolume ") + std::to_string(ui_->horizontalSliderSystemVolume->value())).c_str()); - system((std::string("/usr/local/bin/autoapp_helper setcapvolume ") + std::to_string(ui_->horizontalSliderSystemCapture->value())).c_str()); + system((std::string("/usr/local/bin/autoapp_helper setvolumes ") + std::to_string(ui_->horizontalSliderSystemVolume->value()) + std::string(" ") + std::to_string(ui_->horizontalSliderSystemCapture->value()) ).c_str()); + system((std::string("/usr/local/bin/autoapp_helper setdisconnect ") + std::to_string(ui_->spinBoxDisconnect->value())).c_str()); + system((std::string("/usr/local/bin/autoapp_helper setshutdown ") + std::to_string(ui_->spinBoxShutdown->value())).c_str()); + system((std::string("/usr/local/bin/autoapp_helper setdaynight ") + std::to_string(ui_->spinBoxDay->value()) + std::string(" ") + std::to_string(ui_->spinBoxNight->value()) ).c_str()); + if (ui_->checkBoxGPIO->isChecked()) { + system((std::string("/usr/local/bin/autoapp_helper setgpios ") + std::string("1 ") + std::string(ui_->comboBoxDevMode->currentText().toStdString() + " ") + std::string(ui_->comboBoxInvert->currentText().toStdString() + " ") + std::string(ui_->comboBoxX11->currentText().toStdString() + " ") + std::string(ui_->comboBoxRearcam->currentText().toStdString() + " ") + std::string(ui_->comboBoxAndroid->currentText().toStdString()) ).c_str()); + } else { + system((std::string("/usr/local/bin/autoapp_helper setgpios ") + std::string("0 ") + std::string(ui_->comboBoxDevMode->currentText().toStdString() + " ") + std::string(ui_->comboBoxInvert->currentText().toStdString() + " ") + std::string(ui_->comboBoxX11->currentText().toStdString() + " ") + std::string(ui_->comboBoxRearcam->currentText().toStdString() + " ") + std::string(ui_->comboBoxAndroid->currentText().toStdString()) ).c_str()); + } + + if (ui_->radioButtonX11->isChecked()) { + system((std::string("/usr/local/bin/autoapp_helper setmode 1")).c_str()); + } else { + system((std::string("/usr/local/bin/autoapp_helper setmode 0")).c_str()); + } + + if (ui_->radioButtonScreenRotated->isChecked()) { + system((std::string("/usr/local/bin/autoapp_helper setflip 1")).c_str()); + } else { + system((std::string("/usr/local/bin/autoapp_helper setflip 0")).c_str()); + } this->close(); } @@ -352,6 +371,56 @@ void SettingsWindow::loadSystemValues() returnFile.close(); ui_->valueDisconnectTimer->setText(disconnecttimer); } + + system("/usr/local/bin/autoapp_helper getgpios"); + if (rFile.exists()) { + QFile returnFile(QString("/tmp/return_value")); + returnFile.open(QIODevice::ReadOnly); + QTextStream data_return(&returnFile); + QStringList gpiosetup = data_return.readAll().split(" "); + returnFile.close(); + if (gpiosetup[0] == "1") { + ui_->checkBoxGPIO->setChecked(true); + } else { + ui_->checkBoxGPIO->setChecked(false); + } + ui_->comboBoxDevMode->setCurrentText(gpiosetup[1]); + ui_->comboBoxInvert->setCurrentText(gpiosetup[2]); + ui_->comboBoxX11->setCurrentText(gpiosetup[3]); + ui_->comboBoxRearcam->setCurrentText(gpiosetup[4]); + ui_->comboBoxAndroid->setCurrentText(gpiosetup[5]); + } + + system("/usr/local/bin/autoapp_helper getmodeflip"); + if (rFile.exists()) { + QFile returnFile(QString("/tmp/return_value")); + returnFile.open(QIODevice::ReadOnly); + QTextStream data_return(&returnFile); + QStringList modeflip = data_return.readAll().split(" "); + returnFile.close(); + if (modeflip[0] == "0") { + ui_->radioButtonEGL->setChecked(true); + } else { + ui_->radioButtonX11->setChecked(true); + } + if (modeflip[1] == "0") { + ui_->radioButtonScreenNormal->setChecked(true); + } else { + ui_->radioButtonScreenRotated->setChecked(true); + } + + } + + system("/usr/local/bin/autoapp_helper getdaynight"); + if (rFile.exists()) { + QFile returnFile(QString("/tmp/return_value")); + returnFile.open(QIODevice::ReadOnly); + QTextStream data_return(&returnFile); + QStringList daynight = data_return.readAll().split(" "); + returnFile.close(); + ui_->spinBoxDay->setValue(daynight[0].toInt()); + ui_->spinBoxNight->setValue(daynight[1].toInt()); + } } void SettingsWindow::onShowBindings() diff --git a/src/autoapp/UI/settingswindow.ui b/src/autoapp/UI/settingswindow.ui index 17fe2f7..22c3691 100644 --- a/src/autoapp/UI/settingswindow.ui +++ b/src/autoapp/UI/settingswindow.ui @@ -86,7 +86,7 @@ color: rgb(238, 238, 236); 0 10 - 621 + 616 91 @@ -105,6 +105,9 @@ color: rgb(238, 238, 236); Left-hand drive + + true + @@ -143,7 +146,7 @@ color: rgb(238, 238, 236); 0 80 - 621 + 616 141 @@ -162,6 +165,9 @@ color: rgb(238, 238, 236); 480p + + true + @@ -227,7 +233,7 @@ color: rgb(238, 238, 236); 0 10 - 621 + 616 61 @@ -259,6 +265,9 @@ color: rgb(238, 238, 236); 30 FPS + + true + @@ -266,7 +275,7 @@ color: rgb(238, 238, 236); 0 230 - 621 + 616 121 @@ -419,7 +428,7 @@ subcontrol-position: center left; 0 360 - 621 + 616 81 @@ -455,6 +464,9 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 400 + + 100 + Qt::Horizontal @@ -470,7 +482,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} -1 10 - 621 + 616 111 @@ -535,7 +547,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 0 130 - 621 + 616 61 @@ -592,7 +604,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 0 70 - 621 + 616 381 @@ -879,7 +891,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 0 10 - 621 + 616 441 @@ -1004,14 +1016,14 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} - Crankshaft NG + CS-NG Base 0 10 - 621 + 616 91 @@ -1154,7 +1166,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 0 110 - 621 + 616 81 @@ -1200,7 +1212,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 0 200 - 621 + 616 81 @@ -1246,7 +1258,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;} 0 300 - 621 + 616 129 @@ -1336,6 +1348,9 @@ subcontrol-position: center left; 10 + + 120 + @@ -1377,6 +1392,1104 @@ subcontrol-position: center left; + + + CS-NG Special + + + + + 0 + 10 + 616 + 141 + + + + GPIO Settings + + + + + 10 + 30 + 100 + 23 + + + + Enable GPIO + + + + + + 90 + 60 + 100 + 30 + + + + false + + + - - - + + + + - - - + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + + + 10 + 60 + 80 + 30 + + + + Dev Mode + + + + + + 300 + 60 + 100 + 30 + + + + false + + + - - - + + + + - - - + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + + + 90 + 100 + 100 + 30 + + + + false + + + - - - + + + + - - - + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + + + 10 + 100 + 80 + 30 + + + + X11 Pin + + + + + + 210 + 100 + 90 + 30 + + + + Rearcam Pin + + + + + + 500 + 60 + 100 + 30 + + + + false + + + - - - + + + + - - - + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + + + 420 + 60 + 80 + 30 + + + + Android Pin + + + + + + 300 + 100 + 100 + 30 + + + + false + + + - - - + + + + - - - + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + 16 + + + + + 17 + + + + + 18 + + + + + 19 + + + + + 20 + + + + + 21 + + + + + 22 + + + + + 23 + + + + + 24 + + + + + 25 + + + + + 26 + + + + + + + 210 + 60 + 90 + 30 + + + + Invert Pin + + + + + + + 0 + 180 + 616 + 81 + + + + Auto Day / Night + + + + + 10 + 40 + 80 + 21 + + + + Start Day + + + + + + 210 + 40 + 80 + 21 + + + + Start Night + + + + + + 90 + 30 + 100 + 41 + + + + QSpinBox::up-button { width: 32px; height: 32px; +subcontrol-origin: margin; +subcontrol-position: center right; +} +QSpinBox::down-button { width: 32px; height: 32px; +subcontrol-origin: margin; +subcontrol-position: center left; +} + + + Qt::AlignCenter + + + 23 + + + 8 + + + + + + 290 + 30 + 100 + 41 + + + + QSpinBox::up-button { width: 32px; height: 32px; +subcontrol-origin: margin; +subcontrol-position: center right; +} +QSpinBox::down-button { width: 32px; height: 32px; +subcontrol-origin: margin; +subcontrol-position: center left; +} + + + Qt::AlignCenter + + + 23 + + + 18 + + + + + + 440 + 40 + 171 + 23 + + + + Needs configured rtc! + + + true + + + + + + 410 + 36 + 21 + 31 + + + + <html><head/><body><p><img src=":/ico_info.png"/></p></body></html> + + + + + + + 0 + 290 + 300 + 61 + + + + Start Mode Openauto + + + + + 120 + 30 + 81 + 23 + + + + X11 + + + + + + 10 + 30 + 81 + 23 + + + + EGL + + + true + + + + + + + 0 + 410 + 616 + 23 + + + + + true + + + + To activate this settings you have to reboot after changing! + + + Qt::AlignCenter + + + true + + + + + + 10 + 406 + 31 + 31 + + + + <html><head/><body><p align="justify"><img src=":/ico_warning.png"/></p></body></html> + + + + + + 320 + 290 + 296 + 61 + + + + Screen Orientation + + + + + 120 + 30 + 120 + 23 + + + + 180° Rotated + + + + + + 10 + 30 + 80 + 23 + + + + Normal + + + true + + + +