Added checkbox logic for video config window.

This commit is contained in:
Matthew Budd 2020-07-07 20:53:31 -04:00
parent 313bba68f9
commit ea1782bfe5
4 changed files with 155 additions and 12 deletions

View File

@ -41,7 +41,7 @@ ConsoleSndConfDialog_t::ConsoleSndConfDialog_t(QWidget *parent)
// Audio Quality Select
hbox2 = new QHBoxLayout();
lbl = new QLabel("Quality:");
lbl = new QLabel( tr("Quality:") );
qualitySelect = new QComboBox();

View File

@ -1,10 +1,12 @@
// ConsoleVideoConf.cpp
//
#include "../../fceu.h"
#include "Qt/main.h"
#include "Qt/dface.h"
#include "Qt/config.h"
#include "Qt/fceuWrapper.h"
#include "Qt/ConsoleVideoConf.h"
//----------------------------------------------------
ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
: QDialog( parent )
@ -12,6 +14,7 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
QVBoxLayout *main_vbox;
QHBoxLayout *hbox1;
QLabel *lbl;
QPushButton *button;
setWindowTitle( tr("Video Config") );
@ -20,21 +23,23 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
// Video Driver Select
lbl = new QLabel( tr("Driver:") );
drvSel = new QComboBox();
driverSelect = new QComboBox();
drvSel->addItem( tr("OpenGL"), 0 );
//drvSel->addItem( tr("SDL"), 1 );
driverSelect->addItem( tr("OpenGL"), 0 );
//driverSelect->addItem( tr("SDL"), 1 );
hbox1 = new QHBoxLayout();
hbox1->addWidget( lbl );
hbox1->addWidget( drvSel );
hbox1->addWidget( driverSelect );
main_vbox->addLayout( hbox1 );
// Enable OpenGL Linear Filter
// Enable OpenGL Linear Filter Checkbox
gl_LF_chkBox = new QCheckBox( tr("Enable OpenGL Linear Filter") );
setCheckBoxFromProperty( gl_LF_chkBox , "SDL.OpenGLip");
main_vbox->addWidget( gl_LF_chkBox );
// Region Select
@ -53,6 +58,51 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
main_vbox->addLayout( hbox1 );
// Enable New PPU Checkbox
new_PPU_ena = new QCheckBox( tr("Enable New PPU") );
// Enable New PPU Checkbox
frmskipcbx = new QCheckBox( tr("Enable Frameskip") );
// Disable Sprite Limit Checkbox
sprtLimCbx = new QCheckBox( tr("Disable Sprite Limit") );
// Clip Sides Checkbox
clipSidesCbx = new QCheckBox( tr("Clip Sides") );
// Show FPS Checkbox
showFPS_cbx = new QCheckBox( tr("Show FPS") );
setCheckBoxFromProperty( new_PPU_ena , "SDL.NewPPU");
setCheckBoxFromProperty( frmskipcbx , "SDL.Frameskip");
setCheckBoxFromProperty( sprtLimCbx , "SDL.DisableSpriteLimit");
setCheckBoxFromProperty( clipSidesCbx , "SDL.ClipSides");
setCheckBoxFromProperty( showFPS_cbx , "SDL.ShowFPS");
connect(new_PPU_ena , SIGNAL(stateChanged(int)), this, SLOT(use_new_PPU_changed(int)) );
connect(frmskipcbx , SIGNAL(stateChanged(int)), this, SLOT(frameskip_changed(int)) );
connect(sprtLimCbx , SIGNAL(stateChanged(int)), this, SLOT(useSpriteLimitChanged(int)) );
connect(clipSidesCbx, SIGNAL(stateChanged(int)), this, SLOT(clipSidesChanged(int)) );
connect(showFPS_cbx , SIGNAL(stateChanged(int)), this, SLOT(showFPSChanged(int)) );
main_vbox->addWidget( new_PPU_ena );
main_vbox->addWidget( frmskipcbx );
main_vbox->addWidget( sprtLimCbx );
main_vbox->addWidget( clipSidesCbx);
main_vbox->addWidget( showFPS_cbx );
hbox1 = new QHBoxLayout();
button = new QPushButton( tr("Apply") );
hbox1->addWidget( button );
connect(button, SIGNAL(clicked()), this, SLOT(applyChanges(void)) );
button = new QPushButton( tr("Close") );
hbox1->addWidget( button );
connect(button, SIGNAL(clicked()), this, SLOT(closewindow(void)) );
main_vbox->addLayout( hbox1 );
setLayout( main_vbox );
}
@ -62,3 +112,82 @@ ConsoleVideoConfDialog_t::~ConsoleVideoConfDialog_t(void)
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::resetVideo(void)
{
KillVideo ();
InitVideo (GameInfo);
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::setCheckBoxFromProperty( QCheckBox *cbx, const char *property )
{
int pval;
g_config->getOption (property, &pval);
cbx->setCheckState( pval ? Qt::Checked : Qt::Unchecked );
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::use_new_PPU_changed( int value )
{
//printf("Value:%i \n", value );
g_config->setOption("SDL.NewPPU", (value == Qt::Checked) );
g_config->save ();
fceuWrapperLock();
UpdateEMUCore (g_config);
fceuWrapperUnLock();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::frameskip_changed( int value )
{
//printf("Value:%i \n", value );
g_config->setOption("SDL.Frameskip", (value == Qt::Checked) );
g_config->save ();
fceuWrapperLock();
UpdateEMUCore (g_config);
fceuWrapperUnLock();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::useSpriteLimitChanged( int value )
{
//printf("Value:%i \n", value );
g_config->setOption("SDL.DisableSpriteLimit", (value == Qt::Checked) );
g_config->save ();
fceuWrapperLock();
UpdateEMUCore (g_config);
fceuWrapperUnLock();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::clipSidesChanged( int value )
{
//printf("Value:%i \n", value );
g_config->setOption("SDL.ClipSides", (value == Qt::Checked) );
g_config->save ();
fceuWrapperLock();
UpdateEMUCore (g_config);
fceuWrapperUnLock();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::showFPSChanged( int value )
{
//printf("Value:%i \n", value );
g_config->setOption("SDL.ShowFPS", (value == Qt::Checked) );
g_config->save ();
fceuWrapperLock();
UpdateEMUCore (g_config);
fceuWrapperUnLock();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::applyChanges( void )
{
resetVideo();
}
//----------------------------------------------------
void ConsoleVideoConfDialog_t::closewindow( void )
{
done(0);
}
//----------------------------------------------------

View File

@ -25,15 +25,29 @@ class ConsoleVideoConfDialog_t : public QDialog
~ConsoleVideoConfDialog_t(void);
protected:
QCheckBox *gl_LF_chkBox;
QComboBox *drvSel;
QComboBox *driverSelect;
QComboBox *regionSelect;
QCheckBox *gl_LF_chkBox;
QCheckBox *new_PPU_ena;
QCheckBox *frmskipcbx;
QCheckBox *sprtLimCbx;
QCheckBox *clipSidesCbx;
QCheckBox *showFPS_cbx;
//void setCheckBoxFromProperty( QCheckBox *cbx, const char *property );
void setCheckBoxFromProperty( QCheckBox *cbx, const char *property );
//void setComboBoxFromProperty( QComboBox *cbx, const char *property );
//void setSliderFromProperty( QSlider *slider, QLabel *lbl, const char *property );
void resetVideo(void);
private slots:
void use_new_PPU_changed( int value );
void frameskip_changed( int value );
void useSpriteLimitChanged( int value );
void clipSidesChanged( int value );
void showFPSChanged( int value );
void applyChanges( void );
void closewindow( void );
};

View File

@ -309,7 +309,7 @@ void consoleWin_t::openHotkeyConfWin(void)
{
HotKeyConfDialog_t *hkConfWin;
printf("Open Hot Key Config Window\n");
//printf("Open Hot Key Config Window\n");
hkConfWin = new HotKeyConfDialog_t(this);
@ -318,7 +318,7 @@ void consoleWin_t::openHotkeyConfWin(void)
delete hkConfWin;
printf("Hotkey Config Window Destroyed\n");
//printf("Hotkey Config Window Destroyed\n");
}
void consoleWin_t::aboutQPlot(void)