Added logic for Qt PPU Viewer scanline entry box.

This commit is contained in:
Matthew Budd 2020-10-04 23:38:10 -04:00
parent b19c86bc10
commit 59d726230d
2 changed files with 22 additions and 1 deletions

View File

@ -69,6 +69,7 @@ ppuViewerDialog_t::ppuViewerDialog_t(QWidget *parent)
QVBoxLayout *patternVbox[2];
QHBoxLayout *hbox;
QGridLayout *grid;
char stmp[64];
ppuViewWindow = this;
@ -150,6 +151,13 @@ ppuViewerDialog_t::ppuViewerDialog_t(QWidget *parent)
patternView[0]->setTileLabel( tileLabel[0] );
patternView[1]->setTileLabel( tileLabel[1] );
scanLineEdit->setMaxLength( 3 );
scanLineEdit->setInputMask( ">900;" );
sprintf( stmp, "%i", PPUViewScanline );
scanLineEdit->setText( tr(stmp) );
connect( scanLineEdit, SIGNAL(textEdited(const QString &)), this, SLOT(scanLineChanged(const QString &)));
refreshSlider->setMinimum( 0);
refreshSlider->setMaximum(25);
refreshSlider->setValue(PPUViewRefresh);
@ -182,6 +190,19 @@ void ppuViewerDialog_t::closeWindow(void)
deleteLater();
}
//----------------------------------------------------
void ppuViewerDialog_t::scanLineChanged( const QString &txt )
{
std::string s;
s = txt.toStdString();
if ( s.size() > 0 )
{
PPUViewScanline = strtoul( s.c_str(), NULL, 10 );
}
//printf("ScanLine: '%s' %i\n", s.c_str(), PPUViewScanline );
}
//----------------------------------------------------
void ppuViewerDialog_t::sprite8x16Changed0(int state)
{
PPUView_sprite16Mode[0] = (state == Qt::Unchecked) ? 0 : 1;

View File

@ -107,7 +107,7 @@ class ppuViewerDialog_t : public QDialog
void sprite8x16Changed0(int state);
void sprite8x16Changed1(int state);
void refreshSliderChanged(int value);
void scanLineChanged( const QString &s );
};
int openPPUViewWindow( QWidget *parent );