summaryrefslogtreecommitdiffstats
path: root/kradio3/plugins/oss-sound/oss-sound-configuration.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-22 18:23:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-02-22 18:23:26 +0000
commitae364d9bed0589bf1a22cd5f530c563462379e3e (patch)
treee32727e2664e7ce68d0d30270afa040320ae35a1 /kradio3/plugins/oss-sound/oss-sound-configuration.cpp
downloadtderadio-ae364d9bed0589bf1a22cd5f530c563462379e3e.tar.gz
tderadio-ae364d9bed0589bf1a22cd5f530c563462379e3e.zip
Added old KDE3 version of kradio
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kradio@1094417 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kradio3/plugins/oss-sound/oss-sound-configuration.cpp')
-rw-r--r--kradio3/plugins/oss-sound/oss-sound-configuration.cpp86
1 files changed, 86 insertions, 0 deletions
diff --git a/kradio3/plugins/oss-sound/oss-sound-configuration.cpp b/kradio3/plugins/oss-sound/oss-sound-configuration.cpp
new file mode 100644
index 0000000..5665114
--- /dev/null
+++ b/kradio3/plugins/oss-sound/oss-sound-configuration.cpp
@@ -0,0 +1,86 @@
+/***************************************************************************
+ oss-sound-configuration.cpp - description
+ -------------------
+ begin : Thu Sep 30 2004
+ copyright : (C) 2004 by Martin Witte
+ email : witte@kawo1.rwth-aachen.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include <qcheckbox.h>
+
+#include <kurlrequester.h>
+#include <knuminput.h>
+
+#include "oss-sound-configuration.h"
+#include "oss-sound.h"
+
+OSSSoundConfiguration::OSSSoundConfiguration (QWidget *parent, OSSSoundDevice *dev)
+ : OSSSoundConfigurationUI(parent),
+ m_SoundDevice (dev),
+ m_dirty(true),
+ m_ignore_gui_updates(false)
+{
+ connect(editDSPDevice, SIGNAL(textChanged(const QString &)), this, SLOT(slotSetDirty()));
+ connect(editMixerDevice, SIGNAL(textChanged(const QString &)), this, SLOT(slotSetDirty()));
+ connect(editBufferSize, SIGNAL(valueChanged(int)), this, SLOT(slotSetDirty()));
+ connect(chkDisablePlayback, SIGNAL(toggled(bool)), this, SLOT(slotSetDirty()));
+ connect(chkDisableCapture, SIGNAL(toggled(bool)), this, SLOT(slotSetDirty()));
+ slotCancel();
+}
+
+
+OSSSoundConfiguration::~OSSSoundConfiguration ()
+{
+}
+
+
+void OSSSoundConfiguration::slotOK()
+{
+ if (m_SoundDevice && m_dirty) {
+ m_SoundDevice->setBufferSize ( editBufferSize ->value() * 1024);
+ m_SoundDevice->enablePlayback (!chkDisablePlayback->isChecked());
+ m_SoundDevice->enableCapture (!chkDisableCapture ->isChecked());
+ m_SoundDevice->setDSPDeviceName ( editDSPDevice ->url());
+ m_SoundDevice->setMixerDeviceName( editMixerDevice ->url());
+ m_dirty = false;
+ }
+}
+
+
+void OSSSoundConfiguration::slotCancel()
+{
+ if (m_dirty) {
+ m_ignore_gui_updates = true;
+ editDSPDevice ->setURL (m_SoundDevice ? m_SoundDevice->getDSPDeviceName() : QString::null);
+ editMixerDevice ->setURL (m_SoundDevice ? m_SoundDevice->getMixerDeviceName() : QString::null);
+ editBufferSize ->setValue (m_SoundDevice ? m_SoundDevice->getBufferSize()/1024 : 4);
+ chkDisablePlayback->setChecked(m_SoundDevice ? !m_SoundDevice->isPlaybackEnabled() : false);
+ chkDisableCapture ->setChecked(m_SoundDevice ? !m_SoundDevice->isCaptureEnabled() : false);
+ m_ignore_gui_updates = false;
+ m_dirty = false;
+ }
+}
+
+void OSSSoundConfiguration::slotUpdateConfig()
+{
+ slotSetDirty();
+ slotCancel();
+}
+
+void OSSSoundConfiguration::slotSetDirty()
+{
+ if (!m_ignore_gui_updates) {
+ m_dirty = true;
+ }
+}
+
+#include "oss-sound-configuration.moc"