Added logic to disable square2, noise, and pcm sliders on Qt sound config window if low sound quality is active.
This commit is contained in:
parent
3788dc872e
commit
4ab45b82d8
|
@ -41,6 +41,8 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
||||||
QGroupBox *frame;
|
QGroupBox *frame;
|
||||||
QSlider *vslider;
|
QSlider *vslider;
|
||||||
|
|
||||||
|
sndQuality = 1;
|
||||||
|
|
||||||
setWindowTitle(tr("Sound Config"));
|
setWindowTitle(tr("Sound Config"));
|
||||||
|
|
||||||
mainLayout = new QVBoxLayout();
|
mainLayout = new QVBoxLayout();
|
||||||
|
@ -73,6 +75,7 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
||||||
qualitySelect->addItem(tr("Very High"), 2);
|
qualitySelect->addItem(tr("Very High"), 2);
|
||||||
|
|
||||||
setComboBoxFromProperty(qualitySelect, "SDL.Sound.Quality");
|
setComboBoxFromProperty(qualitySelect, "SDL.Sound.Quality");
|
||||||
|
g_config->getOption("SDL.Sound.Quality", &sndQuality );
|
||||||
|
|
||||||
connect(qualitySelect, SIGNAL(currentIndexChanged(int)), this, SLOT(soundQualityChanged(int)));
|
connect(qualitySelect, SIGNAL(currentIndexChanged(int)), this, SLOT(soundQualityChanged(int)));
|
||||||
|
|
||||||
|
@ -192,47 +195,47 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
||||||
frame = new QGroupBox(tr("Square2"));
|
frame = new QGroupBox(tr("Square2"));
|
||||||
vbox2 = new QVBoxLayout();
|
vbox2 = new QVBoxLayout();
|
||||||
sqr2Lbl = new QLabel("255");
|
sqr2Lbl = new QLabel("255");
|
||||||
vslider = new QSlider(Qt::Vertical);
|
sqr2Slider = new QSlider(Qt::Vertical);
|
||||||
vslider->setMinimum(0);
|
sqr2Slider->setMinimum(0);
|
||||||
vslider->setMaximum(255);
|
sqr2Slider->setMaximum(255);
|
||||||
setSliderFromProperty(vslider, sqr2Lbl, "SDL.Sound.Square2Volume");
|
setSliderFromProperty(sqr2Slider, sqr2Lbl, "SDL.Sound.Square2Volume");
|
||||||
|
|
||||||
vbox2->addWidget(sqr2Lbl);
|
vbox2->addWidget(sqr2Lbl);
|
||||||
vbox2->addWidget(vslider);
|
vbox2->addWidget(sqr2Slider);
|
||||||
frame->setLayout(vbox2);
|
frame->setLayout(vbox2);
|
||||||
hbox2->addWidget(frame);
|
hbox2->addWidget(frame);
|
||||||
|
|
||||||
connect(vslider, SIGNAL(valueChanged(int)), this, SLOT(square2Changed(int)));
|
connect(sqr2Slider, SIGNAL(valueChanged(int)), this, SLOT(square2Changed(int)));
|
||||||
|
|
||||||
frame = new QGroupBox(tr("Noise"));
|
frame = new QGroupBox(tr("Noise"));
|
||||||
vbox2 = new QVBoxLayout();
|
vbox2 = new QVBoxLayout();
|
||||||
nseLbl = new QLabel("255");
|
nseLbl = new QLabel("255");
|
||||||
vslider = new QSlider(Qt::Vertical);
|
nseSlider = new QSlider(Qt::Vertical);
|
||||||
vslider->setMinimum(0);
|
nseSlider->setMinimum(0);
|
||||||
vslider->setMaximum(255);
|
nseSlider->setMaximum(255);
|
||||||
setSliderFromProperty(vslider, nseLbl, "SDL.Sound.NoiseVolume");
|
setSliderFromProperty(nseSlider, nseLbl, "SDL.Sound.NoiseVolume");
|
||||||
|
|
||||||
vbox2->addWidget(nseLbl);
|
vbox2->addWidget(nseLbl);
|
||||||
vbox2->addWidget(vslider);
|
vbox2->addWidget(nseSlider);
|
||||||
frame->setLayout(vbox2);
|
frame->setLayout(vbox2);
|
||||||
hbox2->addWidget(frame);
|
hbox2->addWidget(frame);
|
||||||
|
|
||||||
connect(vslider, SIGNAL(valueChanged(int)), this, SLOT(noiseChanged(int)));
|
connect(nseSlider, SIGNAL(valueChanged(int)), this, SLOT(noiseChanged(int)));
|
||||||
|
|
||||||
frame = new QGroupBox(tr("PCM"));
|
frame = new QGroupBox(tr("PCM"));
|
||||||
vbox2 = new QVBoxLayout();
|
vbox2 = new QVBoxLayout();
|
||||||
pcmLbl = new QLabel("255");
|
pcmLbl = new QLabel("255");
|
||||||
vslider = new QSlider(Qt::Vertical);
|
pcmSlider = new QSlider(Qt::Vertical);
|
||||||
vslider->setMinimum(0);
|
pcmSlider->setMinimum(0);
|
||||||
vslider->setMaximum(255);
|
pcmSlider->setMaximum(255);
|
||||||
setSliderFromProperty(vslider, pcmLbl, "SDL.Sound.PCMVolume");
|
setSliderFromProperty(pcmSlider, pcmLbl, "SDL.Sound.PCMVolume");
|
||||||
|
|
||||||
vbox2->addWidget(pcmLbl);
|
vbox2->addWidget(pcmLbl);
|
||||||
vbox2->addWidget(vslider);
|
vbox2->addWidget(pcmSlider);
|
||||||
frame->setLayout(vbox2);
|
frame->setLayout(vbox2);
|
||||||
hbox2->addWidget(frame);
|
hbox2->addWidget(frame);
|
||||||
|
|
||||||
connect(vslider, SIGNAL(valueChanged(int)), this, SLOT(pcmChanged(int)));
|
connect(pcmSlider, SIGNAL(valueChanged(int)), this, SLOT(pcmChanged(int)));
|
||||||
|
|
||||||
closeButton = new QPushButton( tr("Close") );
|
closeButton = new QPushButton( tr("Close") );
|
||||||
closeButton->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
|
closeButton->setIcon(style()->standardIcon(QStyle::SP_DialogCloseButton));
|
||||||
|
@ -247,6 +250,8 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
|
||||||
|
|
||||||
// Set Final Layout
|
// Set Final Layout
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
|
setSliderEnables();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
ConsoleSndConfDialog_t::~ConsoleSndConfDialog_t(void)
|
ConsoleSndConfDialog_t::~ConsoleSndConfDialog_t(void)
|
||||||
|
@ -269,6 +274,29 @@ void ConsoleSndConfDialog_t::closeWindow(void)
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
void ConsoleSndConfDialog_t::setSliderEnables(void)
|
||||||
|
{
|
||||||
|
if ( sndQuality == 0 )
|
||||||
|
{
|
||||||
|
sqr2Lbl->setEnabled(false);
|
||||||
|
nseLbl->setEnabled(false);
|
||||||
|
pcmLbl->setEnabled(false);
|
||||||
|
sqr2Slider->setEnabled(false);
|
||||||
|
nseSlider->setEnabled(false);
|
||||||
|
pcmSlider->setEnabled(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sqr2Lbl->setEnabled(true);
|
||||||
|
nseLbl->setEnabled(true);
|
||||||
|
pcmLbl->setEnabled(true);
|
||||||
|
sqr2Slider->setEnabled(true);
|
||||||
|
nseSlider->setEnabled(true);
|
||||||
|
pcmSlider->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//----------------------------------------------------
|
||||||
void ConsoleSndConfDialog_t::setCheckBoxFromProperty(QCheckBox *cbx, const char *property)
|
void ConsoleSndConfDialog_t::setCheckBoxFromProperty(QCheckBox *cbx, const char *property)
|
||||||
{
|
{
|
||||||
int pval;
|
int pval;
|
||||||
|
@ -489,6 +517,7 @@ void ConsoleSndConfDialog_t::soundQualityChanged(int index)
|
||||||
//printf("Sound Quality: %i : %i \n", index, qualitySelect->itemData(index).toInt() );
|
//printf("Sound Quality: %i : %i \n", index, qualitySelect->itemData(index).toInt() );
|
||||||
|
|
||||||
g_config->setOption("SDL.Sound.Quality", qualitySelect->itemData(index).toInt());
|
g_config->setOption("SDL.Sound.Quality", qualitySelect->itemData(index).toInt());
|
||||||
|
g_config->getOption("SDL.Sound.Quality", &sndQuality );
|
||||||
|
|
||||||
// reset sound subsystem for changes to take effect
|
// reset sound subsystem for changes to take effect
|
||||||
if (fceuWrapperTryLock())
|
if (fceuWrapperTryLock())
|
||||||
|
@ -498,6 +527,8 @@ void ConsoleSndConfDialog_t::soundQualityChanged(int index)
|
||||||
fceuWrapperUnLock();
|
fceuWrapperUnLock();
|
||||||
}
|
}
|
||||||
g_config->save();
|
g_config->save();
|
||||||
|
|
||||||
|
setSliderEnables();
|
||||||
}
|
}
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
void ConsoleSndConfDialog_t::soundRateChanged(int index)
|
void ConsoleSndConfDialog_t::soundRateChanged(int index)
|
||||||
|
|
|
@ -27,6 +27,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *event);
|
void closeEvent(QCloseEvent *event);
|
||||||
|
|
||||||
|
int sndQuality;
|
||||||
QCheckBox *enaChkbox;
|
QCheckBox *enaChkbox;
|
||||||
QCheckBox *enaLowPass;
|
QCheckBox *enaLowPass;
|
||||||
QCheckBox *swapDutyChkbox;
|
QCheckBox *swapDutyChkbox;
|
||||||
|
@ -40,10 +41,14 @@ protected:
|
||||||
QLabel *sqr2Lbl;
|
QLabel *sqr2Lbl;
|
||||||
QLabel *nseLbl;
|
QLabel *nseLbl;
|
||||||
QLabel *pcmLbl;
|
QLabel *pcmLbl;
|
||||||
|
QSlider *sqr2Slider;
|
||||||
|
QSlider *nseSlider;
|
||||||
|
QSlider *pcmSlider;
|
||||||
|
|
||||||
void setCheckBoxFromProperty(QCheckBox *cbx, const char *property);
|
void setCheckBoxFromProperty(QCheckBox *cbx, const char *property);
|
||||||
void setComboBoxFromProperty(QComboBox *cbx, const char *property);
|
void setComboBoxFromProperty(QComboBox *cbx, const char *property);
|
||||||
void setSliderFromProperty(QSlider *slider, QLabel *lbl, const char *property);
|
void setSliderFromProperty(QSlider *slider, QLabel *lbl, const char *property);
|
||||||
|
void setSliderEnables(void);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void closeWindow(void);
|
void closeWindow(void);
|
||||||
|
|
Loading…
Reference in New Issue