Revert wifi setup which caused breaks / Include cam setup

This commit is contained in:
hawkeyexp 2018-08-11 14:50:07 +02:00
parent 46c2cb075c
commit 4a7fbae6f6
2 changed files with 116 additions and 107 deletions

View File

@ -110,96 +110,94 @@ void SettingsWindow::onSave()
// generate param string for autoapp_helper
std::string params;
params.append( std::to_string(ui_->horizontalSliderSystemVolume->value()) );
params.append(";");
params.append("#");
params.append( std::to_string(ui_->horizontalSliderSystemCapture->value()) );
params.append(";");
params.append("#");
params.append( std::to_string(ui_->spinBoxDisconnect->value()) );
params.append(";");
params.append("#");
params.append( std::to_string(ui_->spinBoxShutdown->value()) );
params.append(";");
params.append("#");
params.append( std::to_string(ui_->spinBoxDay->value()) );
params.append(";");
params.append("#");
params.append( std::to_string(ui_->spinBoxNight->value()) );
params.append(";");
params.append("#");
if (ui_->checkBoxGPIO->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append(";");
params.append("#");
params.append( std::string(ui_->comboBoxDevMode->currentText().toStdString()) );
params.append(";");
params.append("#");
params.append( std::string(ui_->comboBoxInvert->currentText().toStdString()) );
params.append(";");
params.append("#");
params.append( std::string(ui_->comboBoxX11->currentText().toStdString()) );
params.append(";");
params.append("#");
params.append( std::string(ui_->comboBoxRearcam->currentText().toStdString()) );
params.append(";");
params.append("#");
params.append( std::string(ui_->comboBoxAndroid->currentText().toStdString()) );
params.append(";");
params.append("#");
if (ui_->radioButtonX11->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append(";");
params.append("#");
if (ui_->radioButtonScreenRotated->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append(";");
params.append("#");
params.append( std::string("'") + std::string(ui_->comboBoxPulseOutput->currentText().toStdString()) + std::string("'") );
params.append(";");
params.append("#");
params.append( std::string("'") + std::string(ui_->comboBoxPulseInput->currentText().toStdString()) + std::string("'") );
params.append(";");
params.append("#");
params.append( std::string(ui_->comboBoxHardwareRTC->currentText().toStdString()) );
params.append(";");
params.append("#");
params.append( std::string(ui_->comboBoxTZ->currentText().toStdString()) );
params.append(";");
params.append("#");
params.append( std::string(ui_->comboBoxHardwareDAC->currentText().toStdString()) );
params.append(";");
params.append("#");
if (ui_->checkBoxDisableShutdown->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append(";");
params.append("#");
if (ui_->checkBoxDisableScreenOff->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append(";");
params.append("#");
if (ui_->radioButtonDebugmodeEnabled->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append(";");
params.append("#");
params.append( std::string(ui_->comboBoxGPIOShutdown->currentText().toStdString()) );
params.append(";");
params.append("#");
params.append( std::to_string(ui_->spinBoxGPIOShutdownDelay->value()) );
params.append(";");
params.append( std::string(ui_->lineEditWifiClientSSID->text().toStdString()) );
params.append(";");
params.append( std::string(ui_->lineEditWifiClientPassword->text().toStdString()) );
params.append(";");
params.append("#");
if (ui_->checkBoxHotspot->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append(";");
params.append( std::string(ui_->lineEditWifiHotspotPassword->text().toStdString()) );
params.append(";");
params.append("#");
params.append( std::string(ui_->comboBoxCam->currentText().toStdString()) );
params.append("#");
if (ui_->checkBoxHardwareSave->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append(";");
params.append("#");
system((std::string("/usr/local/bin/autoapp_helper setparams#") + std::string(params) + std::string(" &") ).c_str());
this->close();
}
@ -353,7 +351,7 @@ void SettingsWindow::loadSystemValues()
QFile paramFile(QString("/tmp/return_value"));
paramFile.open(QIODevice::ReadOnly);
QTextStream data_param(&paramFile);
QStringList getparams = data_param.readAll().split(";");
QStringList getparams = data_param.readAll().split("#");
paramFile.close();
// version string
ui_->valueSystemVersion->setText(getparams[0]);
@ -563,17 +561,18 @@ void SettingsWindow::loadSystemValues()
// Wifi Credentials
ui_->lineEditWifiClientSSID->setText(getparams[30]);
ui_->lineEditWifiClientPassword->setText(getparams[31]);
// Wifi Hotspot Credentials
if (getparams[32] == "1") {
if (getparams[31] == "1") {
ui_->checkBoxHotspot->setChecked(true);
} else {
ui_->checkBoxHotspot->setChecked(false);
}
ui_->lineEditWifiHotspotSSID->setText(getparams[33]);
ui_->lineEditWifiHotspotPassword->setText(getparams[34]);
ui_->lineEditWifiHotspotSSID->setText(getparams[32]);
// set cam
ui_->comboBoxCam->setCurrentText(getparams[33]);
}
}

View File

@ -1250,36 +1250,17 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<property name="title">
<string>Wifi client settings</string>
</property>
<widget class="QLineEdit" name="lineEditWifiClientPassword">
<property name="geometry">
<rect>
<x>390</x>
<y>30</y>
<width>251</width>
<height>31</height>
</rect>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="echoMode">
<enum>QLineEdit::PasswordEchoOnEdit</enum>
</property>
<property name="clearButtonEnabled">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="labelWifiClientPassword">
<widget class="QLabel" name="labelWifiClientNote">
<property name="geometry">
<rect>
<x>310</x>
<y>30</y>
<width>71</width>
<width>331</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Password:</string>
<string>Credentials must be set in crankshaft_env.sh!</string>
</property>
</widget>
<widget class="QLabel" name="labelUseWarningIcon">
@ -1316,7 +1297,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<widget class="QLineEdit" name="lineEditWifiClientSSID">
<property name="geometry">
<rect>
<x>90</x>
<x>100</x>
<y>30</y>
<width>200</width>
<height>31</height>
@ -1328,12 +1309,12 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<rect>
<x>10</x>
<y>30</y>
<width>71</width>
<width>81</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>SSID:</string>
<string>Used SSID:</string>
</property>
</widget>
</widget>
@ -1349,36 +1330,17 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<property name="title">
<string>Hotspot settings</string>
</property>
<widget class="QLineEdit" name="lineEditWifiHotspotPassword">
<property name="geometry">
<rect>
<x>390</x>
<y>60</y>
<width>251</width>
<height>31</height>
</rect>
</property>
<property name="frame">
<bool>true</bool>
</property>
<property name="echoMode">
<enum>QLineEdit::Normal</enum>
</property>
<property name="clearButtonEnabled">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="labelWifiHotspotPassword">
<widget class="QLabel" name="labelWifiHotspotNote">
<property name="geometry">
<rect>
<x>310</x>
<y>60</y>
<width>71</width>
<width>331</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Password:</string>
<string>Credentials must be set in crankshaft_env.sh!</string>
</property>
</widget>
<widget class="QLabel" name="labelUseWarningIcon_2">
@ -1415,7 +1377,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<widget class="QLineEdit" name="lineEditWifiHotspotSSID">
<property name="geometry">
<rect>
<x>90</x>
<x>100</x>
<y>60</y>
<width>200</width>
<height>31</height>
@ -1433,12 +1395,12 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<rect>
<x>10</x>
<y>60</y>
<width>71</width>
<width>81</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>SSID:</string>
<string>Used SSID:</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxHotspot">
@ -3274,7 +3236,7 @@ subcontrol-position: center left;
<x>0</x>
<y>10</y>
<width>646</width>
<height>231</height>
<height>241</height>
</rect>
</property>
<property name="title">
@ -3488,26 +3450,33 @@ subcontrol-position: center left;
<string>Timezone</string>
</property>
</widget>
<widget class="QLabel" name="labelTimeZoneIcon">
<widget class="QCheckBox" name="checkBoxHardwareSave">
<property name="geometry">
<rect>
<x>60</x>
<y>186</y>
<width>21</width>
<height>31</height>
<x>440</x>
<y>118</y>
<width>201</width>
<height>23</height>
</rect>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_info.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Exec setup on save?</string>
</property>
</widget>
<widget class="QLabel" name="labelTimeZone">
<widget class="QLabel" name="labelTimeZone_2">
<property name="geometry">
<rect>
<x>90</x>
<y>180</y>
<width>521</width>
<height>41</height>
<x>470</x>
<y>143</y>
<width>171</width>
<height>61</height>
</rect>
</property>
<property name="font">
@ -3516,23 +3485,64 @@ subcontrol-position: center left;
</font>
</property>
<property name="text">
<string>Timezone is needed for rtc - Sync with timeserver can be done via
&quot;crankshaft rtc sync&quot; in shell.</string>
<string>This must be selected if any hw-setup should be done on save!</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxHardwareSave">
<widget class="QLabel" name="labelTimeZoneIcon_2">
<property name="geometry">
<rect>
<x>480</x>
<y>43</y>
<width>161</width>
<height>23</height>
<x>440</x>
<y>157</y>
<width>21</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Exec setup on save?</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_info.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="labelHardwareCam">
<property name="geometry">
<rect>
<x>10</x>
<y>190</y>
<width>80</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>RPI-Cam</string>
</property>
</widget>
<widget class="QComboBox" name="comboBoxCam">
<property name="geometry">
<rect>
<x>90</x>
<y>190</y>
<width>300</width>
<height>30</height>
</rect>
</property>
<property name="editable">
<bool>false</bool>
</property>
<property name="currentText">
<string>none</string>
</property>
<item>
<property name="text">
<string>none</string>
</property>
</item>
<item>
<property name="text">
<string>enabled</string>
</property>
</item>
</widget>
</widget>
<widget class="QLabel" name="labelSettingsInfo_3">
<property name="geometry">