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

View File

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