diff --git a/src/drivers/Qt/NameTableViewer.cpp b/src/drivers/Qt/NameTableViewer.cpp index 73abff1d..90e2ca3d 100644 --- a/src/drivers/Qt/NameTableViewer.cpp +++ b/src/drivers/Qt/NameTableViewer.cpp @@ -120,7 +120,7 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent) QGroupBox *frame; QMenuBar *menuBar; QMenu *viewMenu, *colorMenu, *subMenu; - QAction *act, *zoomAct[4]; + QAction *act, *zoomAct[4], *rateAct[5]; QActionGroup *group; QLabel *lbl; QFont font; @@ -216,14 +216,54 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent) connect(zoomAct[2], SIGNAL(triggered()), this, SLOT(changeZoom3x(void)) ); connect(zoomAct[3], SIGNAL(triggered()), this, SLOT(changeZoom4x(void)) ); - // View -> Compact View Palette - act = new QAction(tr("Toggle Compact"), this); - //act->setShortcut(QKeySequence::Open); - act->setStatusTip(tr("Toggle Compact")); - connect(act, SIGNAL(triggered()), this, SLOT(menuCompactChanged()) ); + viewMenu->addSeparator(); + + // View -> Refresh + act = new QAction(tr("Refresh"), this); + act->setShortcut( QKeySequence(tr("F5") ) ); + act->setStatusTip(tr("Refresh")); + connect(act, SIGNAL(triggered()), this, SLOT(forceRefresh()) ); viewMenu->addAction(act); + // View -> Auto Refresh Rate + subMenu = viewMenu->addMenu( tr("Auto Refresh Rate")); + group = new QActionGroup(this); + + group->setExclusive(true); + + for (int i=0; i<5; i++) + { + char stmp[8]; + + switch ( i ) + { + case 0: + strcpy( stmp, "Full" ); + break; + default: + sprintf( stmp, "1/%i", 0x01 << i ); + break; + } + + rateAct[i] = new QAction(tr(stmp), this); + rateAct[i]->setCheckable(true); + + group->addAction(rateAct[i]); + subMenu->addAction(rateAct[i]); + } + rateAct[0]->setChecked( NTViewRefresh == 0 ); + rateAct[1]->setChecked( NTViewRefresh == 1 ); + rateAct[2]->setChecked( NTViewRefresh == 3 ); + rateAct[3]->setChecked( NTViewRefresh == 7 ); + rateAct[4]->setChecked( NTViewRefresh == 19 ); + + connect(rateAct[0], SIGNAL(triggered()), this, SLOT(changeRate1(void)) ); + connect(rateAct[1], SIGNAL(triggered()), this, SLOT(changeRate2(void)) ); + connect(rateAct[2], SIGNAL(triggered()), this, SLOT(changeRate4(void)) ); + connect(rateAct[3], SIGNAL(triggered()), this, SLOT(changeRate8(void)) ); + connect(rateAct[4], SIGNAL(triggered()), this, SLOT(changeRate16(void)) ); + // Colors colorMenu = menuBar->addMenu(tr("Colors")); @@ -374,20 +414,7 @@ ppuNameTableViewerDialog_t::ppuNameTableViewerDialog_t(QWidget *parent) connect( showAttrGridCbox , SIGNAL(stateChanged(int)), this, SLOT(showAttrGridChanged(int))); connect( showAttrbCbox , SIGNAL(stateChanged(int)), this, SLOT(showAttrbChanged(int))); connect( ignorePaletteCbox , SIGNAL(stateChanged(int)), this, SLOT(ignorePaletteChanged(int))); -// -// hbox = new QHBoxLayout(); -// refreshSlider = new QSlider( Qt::Horizontal ); -// hbox->addWidget( new QLabel( tr("Refresh: More") ) ); -// hbox->addWidget( refreshSlider ); -// hbox->addWidget( new QLabel( tr("Less") ) ); -// grid->addLayout( hbox, 0, 1, Qt::AlignRight ); -// -// refreshSlider->setMinimum( 0); -// refreshSlider->setMaximum(25); -// refreshSlider->setValue(NTViewRefresh); -// -// connect( refreshSlider, SIGNAL(valueChanged(int)), this, SLOT(refreshSliderChanged(int))); -// + hbox1 = new QHBoxLayout(); hbox = new QHBoxLayout(); @@ -483,6 +510,54 @@ void ppuNameTableViewerDialog_t::changeZoom4x(void) ntView->setViewScale(4); } //---------------------------------------------------- +void ppuNameTableViewerDialog_t::changeRate( int divider ) +{ + if ( divider > 0 ) + { + int i = 60 / divider; + + NTViewRefresh = (60 / i) - 1; + + //printf("NTViewRefresh: %i \n", NTViewRefresh ); + } + else + { + NTViewRefresh = 1; + } +} +//---------------------------------------------------- +void ppuNameTableViewerDialog_t::changeRate1(void) +{ + changeRate(1); +} +//---------------------------------------------------- +void ppuNameTableViewerDialog_t::changeRate2(void) +{ + changeRate(2); +} +//---------------------------------------------------- +void ppuNameTableViewerDialog_t::changeRate4(void) +{ + changeRate(4); +} +//---------------------------------------------------- +void ppuNameTableViewerDialog_t::changeRate8(void) +{ + changeRate(8); +} +//---------------------------------------------------- +void ppuNameTableViewerDialog_t::changeRate16(void) +{ + changeRate(16); +} +//---------------------------------------------------- +void ppuNameTableViewerDialog_t::forceRefresh(void) +{ + NTViewSkip = 100; + + FCEUD_UpdateNTView( -1, true); +} +//---------------------------------------------------- void ppuNameTableViewerDialog_t::updateVisibility(void) { @@ -673,11 +748,6 @@ void ppuNameTableViewerDialog_t::ignorePaletteChanged(int state) ignPalAct->setChecked( hidepal ); } //---------------------------------------------------- -void ppuNameTableViewerDialog_t::refreshSliderChanged(int value) -{ - NTViewRefresh = value; -} -//---------------------------------------------------- ppuNameTableView_t::ppuNameTableView_t(QWidget *parent) : QWidget(parent) { @@ -1351,7 +1421,6 @@ void FCEUD_UpdateNTView(int scanline, bool drawall) if (oldntmirroring != ntmirroring) { - //UpdateMirroringButtons(); oldntmirroring = ntmirroring; } diff --git a/src/drivers/Qt/NameTableViewer.h b/src/drivers/Qt/NameTableViewer.h index af4cb804..aeefc1ef 100644 --- a/src/drivers/Qt/NameTableViewer.h +++ b/src/drivers/Qt/NameTableViewer.h @@ -96,6 +96,7 @@ class ppuNameTableViewerDialog_t : public QDialog void closeEvent(QCloseEvent *bar); void openColorPicker( QColor *c ); + void changeRate( int divider ); ppuNameTableView_t *ntView; QScrollArea *scrollArea; @@ -104,7 +105,6 @@ class ppuNameTableViewerDialog_t : public QDialog QCheckBox *showAttrGridCbox; QCheckBox *showAttrbCbox; QCheckBox *ignorePaletteCbox; - QSlider *refreshSlider; QLineEdit *scanLineEdit; QTimer *updateTimer; QLineEdit *ppuAddrLbl; @@ -132,7 +132,6 @@ class ppuNameTableViewerDialog_t : public QDialog void showTileGridChanged(int state); void showAttrGridChanged(int state); void showScrollLinesChanged(int state); - void refreshSliderChanged(int value); void scanLineChanged( const QString &txt ); void menuScrollLinesChanged( bool checked ); void menuGridLinesChanged( bool checked ); @@ -145,6 +144,12 @@ class ppuNameTableViewerDialog_t : public QDialog void changeZoom2x(void); void changeZoom3x(void); void changeZoom4x(void); + void changeRate1(void); + void changeRate2(void); + void changeRate4(void); + void changeRate8(void); + void changeRate16(void); + void forceRefresh(void); }; int openNameTableViewWindow( QWidget *parent );