Added detected screen refresh rate display to Qt video config window. Minor memory fixes.

This commit is contained in:
mjbudd77 2021-08-01 21:05:08 -04:00
parent a925270df4
commit 8c19cb5257
6 changed files with 32 additions and 6 deletions

View File

@ -1092,7 +1092,6 @@ void ConsoleDebugger::buildPpuListDisplay(void)
ppuStatContainerWidget = new QWidget(this);
ppuStatContainerWidget->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Maximum );
vbox1 = new QVBoxLayout();
ppuFrame = new QFrame();
grid = new QGridLayout();

View File

@ -37,8 +37,8 @@
ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
: QDialog( parent )
{
QVBoxLayout *main_vbox, *vbox1, *vbox2;
QHBoxLayout *main_hbox, *hbox1;
QVBoxLayout *main_vbox, *vbox1, *vbox2, *vbox;
QHBoxLayout *main_hbox, *hbox1, *hbox;
QLabel *lbl;
QPushButton *button;
QStyle *style;
@ -46,6 +46,7 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
QGridLayout *grid;
QFont font;
int opt, fontCharWidth;
char stmp[128];
font.setFamily("Courier New");
font.setStyle( QFont::StyleNormal );
@ -412,10 +413,25 @@ ConsoleVideoConfDialog_t::ConsoleVideoConfDialog_t(QWidget *parent)
setCheckBoxFromProperty( cursorVisCbx, "SDL.CursorVis" );
grid->addWidget( cursorVisCbx, 1, 0, 2, 1, Qt::AlignLeft);
//grid->addWidget( drawInputAidsCbx, 2, 0, 2, 1, Qt::AlignLeft);
connect(cursorVisCbx , SIGNAL(stateChanged(int)), this, SLOT(cursorVisChanged(int)) );
vbox = new QVBoxLayout();
hbox = new QHBoxLayout();
gbox = new QGroupBox( tr("Screen") );
gbox->setLayout( vbox );
scrRateReadout = new QLineEdit();
scrRateReadout->setFont( font );
scrRateReadout->setReadOnly(true);
scrRateReadout->setAlignment(Qt::AlignCenter);
sprintf( stmp, "%.3f", consoleWindow->getRefreshRate() );
scrRateReadout->setText( tr(stmp) );
hbox->addWidget( new QLabel( tr("Refresh Rate (Hz):") ) );
hbox->addWidget( scrRateReadout );
vbox->addLayout( hbox );
vbox2->addWidget( gbox );
vbox2->addStretch( 5 );
setLayout( main_vbox );

View File

@ -59,6 +59,7 @@ class ConsoleVideoConfDialog_t : public QDialog
QSpinBox *pal_end;
QLineEdit *winSizeReadout;
QLineEdit *vpSizeReadout;
QLineEdit *scrRateReadout;
void setCheckBoxFromProperty( QCheckBox *cbx, const char *property );
void setComboBoxFromProperty( QComboBox *cbx, const char *property );

View File

@ -214,6 +214,7 @@ consoleWin_t::consoleWin_t(QWidget *parent)
this->showFullScreen();
}
refreshRate = 0.0;
updateCounter = 0;
recentRomMenuReset = false;
@ -369,6 +370,7 @@ void consoleWin_t::winScreenChanged(QScreen *scr)
{
return;
}
refreshRate = scr->refreshRate();
//printf("Screen Refresh Rate: %f\n", scr->refreshRate() );
//printf("Screen Changed: %p\n", scr );

View File

@ -152,6 +152,8 @@ class consoleWin_t : public QMainWindow
int loadVideoDriver( int driverId );
double getRefreshRate(void){ return refreshRate; }
emulatorThread_t *emulatorThread;
AviRecordDiskThread_t *aviDiskThread;
@ -258,6 +260,7 @@ class consoleWin_t : public QMainWindow
std::vector <autoFireMenuAction*> afActList;
autoFireMenuAction *afActCustom;
double refreshRate;
unsigned int updateCounter;
protected:
void resizeEvent(QResizeEvent *event) override;

View File

@ -460,6 +460,11 @@ int GamePad_t::convText2ButtConfig( const char *txt, ButtConfig *bmap )
bmap->DeviceNum = -1;
bmap->ButtonNum = -1;
if (txt[0] == 0 )
{
return 0;
}
if (txt[0] == 'k')
{
SDL_Keycode key;
@ -718,7 +723,7 @@ int GamePad_t::loadHotkeyMapFromFile(const char *filename)
char line[256];
char id[128];
char val[128];
bool lineIsHotKey;
bool lineIsHotKey = false;
char modBtn[32], priBtn[32];
char onPressAct[64], onReleaseAct[64];