aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstalkerg <stalkerg@90c681e8-e032-0410-971d-27865f9a5e38>2007-08-27 15:18:35 +0000
committerstalkerg <stalkerg@90c681e8-e032-0410-971d-27865f9a5e38>2007-08-27 15:18:35 +0000
commita72656a1ae27a9c6041f90112ad556fb1f6f1e33 (patch)
tree74dd108de4a343ab346c096574c6dbf53d1f995c
parent90a14d49d7c52b8288d37aaaae4e6bc44671e82a (diff)
downloadqmmp-a72656a1ae27a9c6041f90112ad556fb1f6f1e33.tar.gz
qmmp-a72656a1ae27a9c6041f90112ad556fb1f6f1e33.tar.bz2
qmmp-a72656a1ae27a9c6041f90112ad556fb1f6f1e33.zip
Add simple settings dialog for OSS plugin.
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@129 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--lib/qmmp/Output/oss/CMakeLists.txt8
-rw-r--r--lib/qmmp/Output/oss/outputoss.cpp11
-rw-r--r--lib/qmmp/Output/oss/outputossfactory.cpp5
-rw-r--r--lib/qmmp/Output/oss/settingsdialog.cpp60
-rw-r--r--lib/qmmp/Output/oss/settingsdialog.h47
-rw-r--r--lib/qmmp/Output/oss/settingsdialog.ui309
6 files changed, 432 insertions, 8 deletions
diff --git a/lib/qmmp/Output/oss/CMakeLists.txt b/lib/qmmp/Output/oss/CMakeLists.txt
index 639e1cd94..0e44e5213 100644
--- a/lib/qmmp/Output/oss/CMakeLists.txt
+++ b/lib/qmmp/Output/oss/CMakeLists.txt
@@ -40,11 +40,13 @@ ADD_DEFINITIONS(${SAMPLERATE_CFLAGS})
SET(liboss_SRCS
outputossfactory.cpp
outputoss.cpp
+ settingsdialog.cpp
)
SET(liboss_MOC_HDRS
outputossfactory.h
outputoss.h
+ settingsdialog.h
)
#SET(libjack_RCCS translations/translations.qrc)
@@ -53,9 +55,13 @@ QT4_ADD_RESOURCES(libjack_RCC_SRCS ${libjack_RCCS})
QT4_WRAP_CPP(liboss_MOC_SRCS ${liboss_MOC_HDRS})
+SET(liboss_UIS
+ settingsdialog.ui
+)
+QT4_WRAP_UI(liboss_UIS_H ${liboss_UIS})
-ADD_LIBRARY(oss SHARED ${liboss_SRCS} ${liboss_MOC_SRCS})
+ADD_LIBRARY(oss SHARED ${liboss_SRCS} ${liboss_MOC_SRCS} ${liboss_UIS_H})
target_link_libraries(oss ${QT_LIBRARIES} -lqmmp )
install(TARGETS oss DESTINATION lib/qmmp/Output)
diff --git a/lib/qmmp/Output/oss/outputoss.cpp b/lib/qmmp/Output/oss/outputoss.cpp
index 63faf5c10..37953b84e 100644
--- a/lib/qmmp/Output/oss/outputoss.cpp
+++ b/lib/qmmp/Output/oss/outputoss.cpp
@@ -29,6 +29,8 @@
#include <stdio.h>
#include <string.h>
#include <QtGlobal>
+#include <QSettings>
+#include <QDir>
#include <iostream>
@@ -93,7 +95,10 @@ OutputOSS::OutputOSS(QObject * parent)
do_select(TRUE),
m_audio_fd(-1), m_mixer_fd(-1)
{
+QSettings settings(QDir::homePath()+"/.qmmp/qmmprc", QSettings::IniFormat);
m_master = true;
+m_audio_device = settings.value("OSS/device","/dev/dsp").toString();
+m_mixer_device = settings.value("OSS/mixer_device","/dev/mixer").toString();
openMixer();
}
@@ -249,13 +254,7 @@ void OutputOSS::resetDSP()
bool OutputOSS::initialize()
{
m_inited = m_pause = m_play = m_userStop = FALSE;
- m_audio_device = "/dev/dsp";
- m_mixer_device = "/dev/mixer";
- /*if (!audio_device) {
- error(QString("AudioOutput: cannot initialize, no device name"));
- return FALSE;
- }*/
reset();
if (m_audio_fd < 0)
diff --git a/lib/qmmp/Output/oss/outputossfactory.cpp b/lib/qmmp/Output/oss/outputossfactory.cpp
index 11454b173..a2212fc52 100644
--- a/lib/qmmp/Output/oss/outputossfactory.cpp
+++ b/lib/qmmp/Output/oss/outputossfactory.cpp
@@ -20,6 +20,7 @@
#include <QtGui>
+#include "settingsdialog.h"
#include "outputoss.h"
#include "outputossfactory.h"
@@ -35,8 +36,10 @@ Output* OutputOSSFactory::create(QObject* parent)
return new OutputOSS(parent);
}
-void OutputOSSFactory::showSettings(QWidget*)
+void OutputOSSFactory::showSettings(QWidget* parent)
{
+ SettingsDialog *s = new SettingsDialog(parent);
+ s -> show();
}
void OutputOSSFactory::showAbout(QWidget *parent)
diff --git a/lib/qmmp/Output/oss/settingsdialog.cpp b/lib/qmmp/Output/oss/settingsdialog.cpp
new file mode 100644
index 000000000..8d75b06eb
--- /dev/null
+++ b/lib/qmmp/Output/oss/settingsdialog.cpp
@@ -0,0 +1,60 @@
+/***************************************************************************
+ * Copyright (C) 2007 by Zhuravlev Uriy *
+ * stalkerg@gmail.com *
+ * *
+ * 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. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#include <QSettings>
+#include <QDir>
+
+#include "settingsdialog.h"
+
+SettingsDialog::SettingsDialog ( QWidget *parent )
+ : QDialog ( parent )
+{
+ ui.setupUi ( this );
+ setAttribute ( Qt::WA_DeleteOnClose );
+ connect(ui.okButton, SIGNAL(clicked()), SLOT(writeSettings()));
+ QSettings settings(QDir::homePath()+"/.qmmp/qmmprc", QSettings::IniFormat);
+ settings.beginGroup("OSS");
+ ui.lineEdit->insert(settings.value("device","/dev/dsp").toString());
+ ui.lineEdit_2->insert(settings.value("mixer_device","/dev/mixer").toString());
+ ui.bufferSpinBox->setValue(settings.value("buffer_time",500).toInt());
+ ui.periodSpinBox->setValue(settings.value("period_time",100).toInt());
+
+ settings.endGroup();
+}
+
+
+SettingsDialog::~SettingsDialog()
+{}
+
+
+
+void SettingsDialog::writeSettings()
+{
+ qDebug("SettingsDialog (OSS):: writeSettings()");
+ QSettings settings(QDir::homePath()+"/.qmmp/qmmprc", QSettings::IniFormat);
+ settings.beginGroup("OSS");
+ settings.setValue("device", ui.lineEdit->text());
+ settings.setValue("buffer_time",ui.bufferSpinBox->value());
+ settings.setValue("period_time",ui.periodSpinBox->value());
+ settings.setValue("mixer_device", ui.lineEdit_2->text());
+ settings.endGroup();
+ accept();
+}
+
+
diff --git a/lib/qmmp/Output/oss/settingsdialog.h b/lib/qmmp/Output/oss/settingsdialog.h
new file mode 100644
index 000000000..fd75c5698
--- /dev/null
+++ b/lib/qmmp/Output/oss/settingsdialog.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * Copyright (C) 2007 by Zhuravlev Uriy *
+ * stalkerg@gmail.com *
+ * *
+ * 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. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+#ifndef SETTINGSDIALOG_H
+#define SETTINGSDIALOG_H
+
+#include <QDialog>
+
+
+#include "ui_settingsdialog.h"
+
+/**
+ @author Yuriy Zhuravlev <stalkerg@gmail.com>
+*/
+class SettingsDialog : public QDialog
+{
+Q_OBJECT
+public:
+ SettingsDialog(QWidget *parent = 0);
+
+ ~SettingsDialog();
+
+private slots:
+ void writeSettings();
+
+private:
+ Ui::SettingsDialog ui;
+
+};
+
+#endif
diff --git a/lib/qmmp/Output/oss/settingsdialog.ui b/lib/qmmp/Output/oss/settingsdialog.ui
new file mode 100644
index 000000000..ce1c40894
--- /dev/null
+++ b/lib/qmmp/Output/oss/settingsdialog.ui
@@ -0,0 +1,309 @@
+<ui version="4.0" >
+ <class>SettingsDialog</class>
+ <widget class="QDialog" name="SettingsDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>422</width>
+ <height>334</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>OSS Plugin Settings</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="leftMargin" >
+ <number>9</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
+ <property name="horizontalSpacing" >
+ <number>6</number>
+ </property>
+ <property name="verticalSpacing" >
+ <number>6</number>
+ </property>
+ <item row="0" column="0" colspan="3" >
+ <widget class="QTabWidget" name="tabWidget" >
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab" >
+ <attribute name="title" >
+ <string>Device Settings</string>
+ </attribute>
+ <layout class="QVBoxLayout" >
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <property name="leftMargin" >
+ <number>9</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Audio device</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QLineEdit" name="lineEdit" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2" >
+ <property name="title" >
+ <string>Mixer device</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="leftMargin" >
+ <number>9</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
+ <property name="horizontalSpacing" >
+ <number>6</number>
+ </property>
+ <property name="verticalSpacing" >
+ <number>6</number>
+ </property>
+ <item row="0" column="0" >
+ <widget class="QLineEdit" name="lineEdit_2" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="tab_2" >
+ <attribute name="title" >
+ <string>Advanced Settings</string>
+ </attribute>
+ <layout class="QVBoxLayout" >
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <property name="leftMargin" >
+ <number>9</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="groupBox_3" >
+ <property name="title" >
+ <string>Soundcard</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="leftMargin" >
+ <number>9</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
+ <property name="horizontalSpacing" >
+ <number>6</number>
+ </property>
+ <property name="verticalSpacing" >
+ <number>6</number>
+ </property>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>111</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>188</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QSpinBox" name="periodSpinBox" >
+ <property name="minimum" >
+ <number>20</number>
+ </property>
+ <property name="maximum" >
+ <number>5000</number>
+ </property>
+ <property name="value" >
+ <number>100</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QSpinBox" name="bufferSpinBox" >
+ <property name="minimum" >
+ <number>200</number>
+ </property>
+ <property name="maximum" >
+ <number>10000</number>
+ </property>
+ <property name="value" >
+ <number>500</number>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Buffer time (ms):</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>Period time (ms):</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>188</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QCheckBox" name="checkBox" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>PCM over Master</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>191</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="2" >
+ <widget class="QPushButton" name="cancelButton" >
+ <property name="text" >
+ <string>Cancel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QPushButton" name="okButton" >
+ <property name="text" >
+ <string>OK</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>cancelButton</sender>
+ <signal>clicked()</signal>
+ <receiver>SettingsDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>338</x>
+ <y>283</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>164</x>
+ <y>294</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>