diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2021-09-19 14:34:05 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2021-09-19 14:34:05 +0000 |
| commit | bf033d40386c2654b2a2b60dd8a90a43099d3be4 (patch) | |
| tree | a629022bce2682211d86997d5b03e8310ddc1a62 /src/plugins/Input/xmp/settingsdialog.cpp | |
| parent | c034c4d62c0b02404bd65c9cab478e3ae00d0883 (diff) | |
| download | qmmp-bf033d40386c2654b2a2b60dd8a90a43099d3be4.tar.gz qmmp-bf033d40386c2654b2a2b60dd8a90a43099d3be4.tar.bz2 qmmp-bf033d40386c2654b2a2b60dd8a90a43099d3be4.zip | |
replaced modplug by xmp
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@10304 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/Input/xmp/settingsdialog.cpp')
| -rw-r--r-- | src/plugins/Input/xmp/settingsdialog.cpp | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/plugins/Input/xmp/settingsdialog.cpp b/src/plugins/Input/xmp/settingsdialog.cpp new file mode 100644 index 000000000..ca2d3cc1a --- /dev/null +++ b/src/plugins/Input/xmp/settingsdialog.cpp @@ -0,0 +1,97 @@ +/*************************************************************************** + * Copyright (C) 2015-2021 by Ilya Kotov * + * forkotov02@ya.ru * + * * + * 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., * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * + ***************************************************************************/ + +#include <QSettings> +#include <QDir> +#include <xmp.h> +#include "decoder_xmp.h" +#include "settingsdialog.h" + +SettingsDialog::SettingsDialog(QWidget *parent) + : QDialog(parent) +{ + m_ui.setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + //prepare combobox + m_ui.srateComboBox->addItem(tr("22050 Hz"), 22050); + m_ui.srateComboBox->addItem(tr("44100 Hz"), 44100); + m_ui.srateComboBox->addItem(tr("48000 Hz"), 48000); + m_ui.intTypeComboBox->addItem(tr("Nearest neighbor"), XMP_INTERP_NEAREST); + m_ui.intTypeComboBox->addItem(tr("Linear"), XMP_INTERP_LINEAR); + m_ui.intTypeComboBox->addItem(tr("Cubic spline"), XMP_INTERP_SPLINE); + //load settings + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + settings.beginGroup("Xmp"); + m_ui.ampFactorSpinBox->setValue(settings.value("amp_factor", 1).toInt()); + m_ui.stereoMixingSpinBox->setValue(settings.value("stereo_mix", 70).toInt()); + int index = m_ui.intTypeComboBox->findData(settings.value("interpolation", XMP_INTERP_LINEAR).toInt()); + if(index >= 0) + m_ui.intTypeComboBox->setCurrentIndex(index); + index = m_ui.srateComboBox->findData(settings.value("sample_rate", 44100).toInt()); + if(index >= 0) + m_ui.srateComboBox->setCurrentIndex(index); + m_ui.lowPassCheckBox->setChecked(settings.value("lowpass", false).toBool()); + m_ui.vblankCheckBox->setChecked(settings.value("vblank", false).toBool()); + m_ui.fx9BugCheckBox->setChecked(settings.value("fx9bug", false).toBool()); + settings.endGroup(); +} + + +SettingsDialog::~SettingsDialog() +{} + +void SettingsDialog::writeSettings() +{ + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + settings.beginGroup("Xmp"); + settings.setValue("amp_factor", m_ui.ampFactorSpinBox->value()); + settings.setValue("stereo_mix", m_ui.stereoMixingSpinBox->value()); + int index = m_ui.intTypeComboBox->currentIndex(); + if(index >= 0) + settings.setValue("interpolation", m_ui.intTypeComboBox->itemData(index)); + index = m_ui.srateComboBox->currentIndex(); + if(index >= 0) + settings.setValue("sample_rate", m_ui.srateComboBox->itemData(index)); + settings.setValue("lowpass", m_ui.lowPassCheckBox->isChecked()); + settings.setValue("vblank", m_ui.vblankCheckBox->isChecked()); + settings.setValue("fx9bug", m_ui.fx9BugCheckBox->isChecked()); + settings.endGroup(); + //apply settings for the created decoder + if (DecoderXmp::instance()) + { + //DecoderXmp::instance()->mutex()->lock(); + DecoderXmp::instance()->readSettings(); + //DecoderXmp::instance()->mutex()->unlock(); + } +} + +void SettingsDialog::on_buttonBox_clicked(QAbstractButton *button) +{ + switch ((int) m_ui.buttonBox->buttonRole(button)) + { + case QDialogButtonBox::AcceptRole: + writeSettings(); + accept(); + break; + case QDialogButtonBox::ApplyRole: + writeSettings(); + break; + } +} |
