Init sound card handling

This commit is contained in:
hawkeyexp 2018-07-15 08:48:52 +02:00
parent 42ee3289d1
commit c82ea93668
2 changed files with 161 additions and 1 deletions

View File

@ -128,7 +128,8 @@ void SettingsWindow::onSave()
} else {
system((std::string("/usr/local/bin/autoapp_helper setflip 0")).c_str());
}
system((std::string("/usr/local/bin/autoapp_helper setoutput ") + std::string("'") + std::string(ui_->comboBoxPulseOutput->currentText().toStdString()) + std::string("'") ).c_str());
system((std::string("/usr/local/bin/autoapp_helper setinput ") + std::string("'") + std::string(ui_->comboBoxPulseInput->currentText().toStdString()) + std::string("'") ).c_str());
this->close();
}
@ -423,6 +424,47 @@ void SettingsWindow::loadSystemValues()
ui_->spinBoxDay->setValue(daynight[0].toInt());
ui_->spinBoxNight->setValue(daynight[1].toInt());
}
system("/usr/local/bin/autoapp_helper getoutputs");
if (rFile.exists()) {
QFile returnFile(QString("/tmp/return_value"));
returnFile.open(QIODevice::ReadOnly);
QTextStream data_return(&returnFile);
QStringList outputs = data_return.readAll().split("\n");
returnFile.close();
int cleaner = ui_->comboBoxPulseOutput->count();
while (cleaner > 0) {
ui_->comboBoxPulseOutput->removeItem(cleaner);
cleaner--;
}
int indexout = outputs.count();
int countout = 0;
while (countout < indexout-1) {
ui_->comboBoxPulseOutput->addItem(outputs[countout]);
countout++;
}
}
system("/usr/local/bin/autoapp_helper getinputs");
if (rFile.exists()) {
QFile returnFile(QString("/tmp/return_value"));
returnFile.open(QIODevice::ReadOnly);
QTextStream data_return(&returnFile);
QStringList inputs = data_return.readAll().split("\n");
returnFile.close();
int cleaner = ui_->comboBoxPulseInput->count();
while (cleaner > 0) {
ui_->comboBoxPulseInput->removeItem(cleaner);
cleaner--;
}
int indexin = inputs.count();
int countin = 0;
while (countin < indexin-1) {
ui_->comboBoxPulseInput->addItem(inputs[countin]);
countin++;
}
}
}
void SettingsWindow::onShowBindings()

View File

@ -581,6 +581,124 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBoxPulse">
<property name="geometry">
<rect>
<x>0</x>
<y>220</y>
<width>616</width>
<height>151</height>
</rect>
</property>
<property name="title">
<string>Pulse Input / Output Device</string>
</property>
<widget class="QComboBox" name="comboBoxPulseOutput">
<property name="geometry">
<rect>
<x>90</x>
<y>30</y>
<width>400</width>
<height>30</height>
</rect>
</property>
<property name="editable">
<bool>false</bool>
</property>
<property name="currentText">
<string>default</string>
</property>
<item>
<property name="text">
<string>default</string>
</property>
</item>
</widget>
<widget class="QLabel" name="labelPulseOutput">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>80</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Output</string>
</property>
</widget>
<widget class="QComboBox" name="comboBoxPulseInput">
<property name="geometry">
<rect>
<x>90</x>
<y>70</y>
<width>400</width>
<height>30</height>
</rect>
</property>
<property name="editable">
<bool>false</bool>
</property>
<property name="currentText">
<string>default</string>
</property>
<item>
<property name="text">
<string>default</string>
</property>
</item>
</widget>
<widget class="QLabel" name="labelPulseInput">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>80</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Input</string>
</property>
</widget>
<widget class="QLabel" name="labelSettingsInfo_2">
<property name="geometry">
<rect>
<x>0</x>
<y>120</y>
<width>616</width>
<height>23</height>
</rect>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>To activate changed audio device you have to reboot!</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="labelSettingsInfo_Icon_2">
<property name="geometry">
<rect>
<x>90</x>
<y>114</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;justify&quot;&gt;&lt;img src=&quot;:/ico_warning.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tabInput">
<attribute name="title">