1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 16:08:39 -05:00

Audio preferences dialog: added input devices tab and input volume control

This commit is contained in:
f4exb 2017-01-06 03:02:57 +01:00
parent 979da93acd
commit 751bf6973e
2 changed files with 106 additions and 12 deletions

View File

@ -15,31 +15,47 @@ AudioDialog::AudioDialog(AudioDeviceInfo* audioDeviceInfo, QWidget* parent) :
QTreeWidgetItem* api;
QStringList sl;
sl.append(tr("Default (use first suitable device)"));
api = new QTreeWidgetItem(ui->audioTree, sl, ATDefault);
api = new QTreeWidgetItem(ui->audioOutTree, sl, ATDefault);
api->setFirstColumnSpanned(true);
for(AudioDeviceInfo::Devices::const_iterator it = devices.begin(); it != devices.end(); ++it) {
for(AudioDeviceInfo::Devices::const_iterator it = devices.begin(); it != devices.end(); ++it)
{
int apiIndex;
sl.clear();
for(apiIndex = 0; apiIndex < ui->audioTree->topLevelItemCount(); ++apiIndex) {
if(ui->audioTree->topLevelItem(apiIndex)->text(0) == it->api)
for(apiIndex = 0; apiIndex < ui->audioOutTree->topLevelItemCount(); ++apiIndex)
{
if(ui->audioOutTree->topLevelItem(apiIndex)->text(0) == it->api)
break;
}
if(apiIndex >= ui->audioTree->topLevelItemCount()) {
if(apiIndex >= ui->audioOutTree->topLevelItemCount())
{
sl.append(it->api);
api = new QTreeWidgetItem(ui->audioTree, sl, ATInterface);
api = new QTreeWidgetItem(ui->audioOutTree, sl, ATInterface);
api->setExpanded(true);
api->setFirstColumnSpanned(true);
sl.clear();
} else {
api = ui->audioTree->topLevelItem(apiIndex);
}
else
{
api = ui->audioOutTree->topLevelItem(apiIndex);
}
sl.append(it->name);
new QTreeWidgetItem(api, sl, ATDevice);
}
if(ui->audioTree->currentItem() == NULL)
ui->audioTree->setCurrentItem(ui->audioTree->topLevelItem(0));
if(ui->audioOutTree->currentItem() == NULL)
ui->audioOutTree->setCurrentItem(ui->audioOutTree->topLevelItem(0));
sl.clear();
sl.append(tr("Default (use first suitable device)"));
api = new QTreeWidgetItem(ui->audioInTree, sl, ATDefault);
api->setFirstColumnSpanned(true);
if(ui->audioInTree->currentItem() == NULL)
ui->audioInTree->setCurrentItem(ui->audioInTree->topLevelItem(0));
ui->tabWidget->setCurrentIndex(0);
}

View File

@ -31,7 +31,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTreeWidget" name="audioTree">
<widget class="QTreeWidget" name="audioOutTree">
<column>
<property name="text">
<string notr="true">Device</string>
@ -41,6 +41,84 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tabInput">
<attribute name="title">
<string>Audio Input</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTreeWidget" name="audioInTree">
<column>
<property name="text">
<string>Device</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="inputVolumeLayout">
<item>
<widget class="QLabel" name="inputVolumeLabel">
<property name="maximumSize">
<size>
<width>60</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Volume</string>
</property>
</widget>
</item>
<item>
<widget class="QDial" name="inputVolume">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="pageStep">
<number>1</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="inputVolumeText">
<property name="maximumSize">
<size>
<width>35</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>1.00</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
@ -58,7 +136,7 @@
<tabstops>
<tabstop>buttonBox</tabstop>
<tabstop>tabWidget</tabstop>
<tabstop>audioTree</tabstop>
<tabstop>audioOutTree</tabstop>
</tabstops>
<resources/>
<connections>