From a72656a1ae27a9c6041f90112ad556fb1f6f1e33 Mon Sep 17 00:00:00 2001 From: stalkerg Date: Mon, 27 Aug 2007 15:18:35 +0000 Subject: 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 --- lib/qmmp/Output/oss/CMakeLists.txt | 8 +- lib/qmmp/Output/oss/outputoss.cpp | 11 +- lib/qmmp/Output/oss/outputossfactory.cpp | 5 +- lib/qmmp/Output/oss/settingsdialog.cpp | 60 ++++++ lib/qmmp/Output/oss/settingsdialog.h | 47 +++++ lib/qmmp/Output/oss/settingsdialog.ui | 309 +++++++++++++++++++++++++++++++ 6 files changed, 432 insertions(+), 8 deletions(-) create mode 100644 lib/qmmp/Output/oss/settingsdialog.cpp create mode 100644 lib/qmmp/Output/oss/settingsdialog.h create mode 100644 lib/qmmp/Output/oss/settingsdialog.ui (limited to 'lib') 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 #include #include +#include +#include #include @@ -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 +#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 +#include + +#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 + + +#include "ui_settingsdialog.h" + +/** + @author Yuriy Zhuravlev +*/ +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 @@ + + SettingsDialog + + + + 0 + 0 + 422 + 334 + + + + OSS Plugin Settings + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + 6 + + + + + 0 + + + + Device Settings + + + + 6 + + + 9 + + + 9 + + + 9 + + + 9 + + + + + Audio device + + + + + + + + + + + + + + + + Mixer device + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + 6 + + + + + + + + + + + + + + + + Advanced Settings + + + + 6 + + + 9 + + + 9 + + + 9 + + + 9 + + + + + Soundcard + + + + 9 + + + 9 + + + 9 + + + 9 + + + 6 + + + 6 + + + + + Qt::Vertical + + + + 20 + 111 + + + + + + + + Qt::Horizontal + + + + 188 + 20 + + + + + + + + 20 + + + 5000 + + + 100 + + + + + + + 200 + + + 10000 + + + 500 + + + + + + + Buffer time (ms): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Period time (ms): + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 188 + 20 + + + + + + + + + + + + + + + PCM over Master + + + + + + + + + + + + + + Qt::Horizontal + + + + 191 + 20 + + + + + + + + Cancel + + + + + + + OK + + + + + + + + + cancelButton + clicked() + SettingsDialog + reject() + + + 338 + 283 + + + 164 + 294 + + + + + -- cgit v1.2.3-13-gbd6f