[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [artikulate] src: Allow devices to be selected.
From: Andreas Cord-Landwehr <cordlandwehr () kde ! org>
Date: 2013-05-25 11:52:24
Message-ID: 20130525115224.8E93DA6076 () git ! kde ! org
[Download RAW message or body]
Git commit 330f925673dddebc59ecf852d98b6836fa66b9da by Andreas Cord-Landwehr.
Committed on 23/05/2013 at 23:02.
Pushed by cordlandwehr into branch 'master'.
Allow devices to be selected.
M +15 -1 src/artikulate.kcfg
M +34 -3 src/ui/sounddevicedialogpage.cpp
M +2 -0 src/ui/sounddevicedialogpage.h
M +5 -5 src/ui/sounddevicedialogpage.ui
http://commits.kde.org/artikulate/330f925673dddebc59ecf852d98b6836fa66b9da
diff --git a/src/artikulate.kcfg b/src/artikulate.kcfg
index 1251c56..66184cf 100644
--- a/src/artikulate.kcfg
+++ b/src/artikulate.kcfg
@@ -8,10 +8,24 @@
<group name="artikulate">
<entry name="UseCourseRepository" type="Bool">
<label>If enabled, course files are only read from the local contributor repository</label>
- <default> false </default>
+ <default>false</default>
</entry>
<entry name="CourseRepositoryPath" type="Path">
<label>Path to local contributor repository</label>
</entry>
+ <entry name="AudioInputDevice" type="String">
+ <label>Name of audio input device</label>
+ </entry>
+ <entry name="AudioOutputDevice" type="String">
+ <label>Name of audio output device</label>
+ </entry>
+ <entry name="AudioInputVolume" type="Int">
+ <label>Audio input volume</label>
+ <default>90</default>
+ </entry>
+ <entry name="AudioOutputVolume" type="Int">
+ <label>Audio output volume</label>
+ <default>90</default>
+ </entry>
</group>
</kcfg>
diff --git a/src/ui/sounddevicedialogpage.cpp b/src/ui/sounddevicedialogpage.cpp
index 4270087..b742950 100644
--- a/src/ui/sounddevicedialogpage.cpp
+++ b/src/ui/sounddevicedialogpage.cpp
@@ -22,13 +22,38 @@
#include "settings.h"
#include <KLocale>
-#include <QUuid>
+#include <QAudioDeviceInfo>
+#include <QAudioCaptureSource>
SoundDeviceDialogPage::SoundDeviceDialogPage()
: QWidget(0)
{
ui = new Ui::SoundDeviceDialogPage;
ui->setupUi(this);
+
+ // set input volume slider
+ ui->kcfg_AudioInputVolume->setTickInterval(1);
+ ui->kcfg_AudioInputVolume->setMinimum(1);
+ ui->kcfg_AudioInputVolume->setMaximum(100);
+
+ // set output volume slider
+ ui->kcfg_AudioOutputVolume->setTickInterval(1);
+ ui->kcfg_AudioOutputVolume->setMinimum(1);
+ ui->kcfg_AudioOutputVolume->setMaximum(100);
+
+ // devices
+ QAudioCaptureSource captureSource; // = new QAudioCaptureSource(m_parent);
+ m_audioInputs = captureSource.audioInputs();
+ for (int i=0; i < m_audioInputs.length(); ++i) {
+ ui->kcfg_AudioInputDevice->insertItem(i, m_audioInputs.at(i), i);
+ }
+
+ QAudioDeviceInfo info;
+ QList<QAudioDeviceInfo> audioOutputs = info.availableDevices(QAudio::AudioOutput);
+ for (int i=0; i < audioOutputs.length(); ++i) {
+ ui->kcfg_AudioOutputDevice->insertItem(i, audioOutputs.at(i).deviceName(), i);
+ m_audioOutputs.append(audioOutputs.at(i).deviceName());
+ }
}
SoundDeviceDialogPage::~SoundDeviceDialogPage()
@@ -38,11 +63,17 @@ SoundDeviceDialogPage::~SoundDeviceDialogPage()
void SoundDeviceDialogPage::loadSettings()
{
- //TODO
+// ui->kcfg_AudioInputDevice(Settings::audioInputDevice());
+// ui->kcfg_AudioOutputDevice(Settings::audioOutputDevice());
+ ui->kcfg_AudioInputVolume->setValue(Settings::audioInputVolume());
+ ui->kcfg_AudioOutputVolume->setValue(Settings::audioOutputVolume());
}
void SoundDeviceDialogPage::saveSettings()
{
- //TODO
+ Settings::setAudioInputDevice(m_audioInputs.at(ui->kcfg_AudioInputDevice->currentIndex()));
+ Settings::setAudioInputDevice(m_audioOutputs.at(ui->kcfg_AudioOutputDevice->currentIndex()));
+ Settings::setAudioInputVolume(ui->kcfg_AudioInputVolume->value());
+ Settings::setAudioOutputVolume(ui->kcfg_AudioOutputVolume->value());
Settings::self()->writeConfig();
}
diff --git a/src/ui/sounddevicedialogpage.h b/src/ui/sounddevicedialogpage.h
index 46d145d..416a68b 100644
--- a/src/ui/sounddevicedialogpage.h
+++ b/src/ui/sounddevicedialogpage.h
@@ -39,6 +39,8 @@ public slots:
private:
Ui::SoundDeviceDialogPage *ui;
+ QList<QString> m_audioInputs;
+ QList<QString> m_audioOutputs;
};
#endif
diff --git a/src/ui/sounddevicedialogpage.ui b/src/ui/sounddevicedialogpage.ui
index 7b07dae..0e4d608 100644
--- a/src/ui/sounddevicedialogpage.ui
+++ b/src/ui/sounddevicedialogpage.ui
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>325</width>
- <height>275</height>
+ <height>281</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
@@ -34,7 +34,7 @@
</widget>
</item>
<item row="0" column="1">
- <widget class="KComboBox" name="kcfg_inputDevice">
+ <widget class="KComboBox" name="kcfg_AudioInputDevice">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -51,7 +51,7 @@
</widget>
</item>
<item row="2" column="1">
- <widget class="QSlider" name="kcfg_inputVolume">
+ <widget class="QSlider" name="kcfg_AudioInputVolume">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@@ -83,7 +83,7 @@
</widget>
</item>
<item row="1" column="1">
- <widget class="KComboBox" name="kcfg_outputDevice">
+ <widget class="KComboBox" name="kcfg_AudioOutputDevice">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@@ -100,7 +100,7 @@
</widget>
</item>
<item row="3" column="1">
- <widget class="QSlider" name="kcfg_outputVolume">
+ <widget class="QSlider" name="kcfg_AudioOutputVolume">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic