Added a refresh rate submenu under View in the Qt hex editor that allows for setting the update rate to the following values in Hz: 5, 10, 20, 30, and 60 (for those with super human eye-to-brain processing times).

This commit is contained in:
mjbudd77 2021-02-18 22:28:59 -05:00
parent 41c9125788
commit 5f46fd098f
2 changed files with 85 additions and 1 deletions

View File

@ -876,7 +876,7 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
//QVBoxLayout *mainLayout;
QGridLayout *grid;
QMenuBar *menuBar;
QMenu *fileMenu, *editMenu, *viewMenu, *colorMenu;
QMenu *fileMenu, *editMenu, *viewMenu, *colorMenu, *subMenu;
QAction *saveROM, *closeAct;
QAction *act, *actHlgt, *actHlgtRV, *actColorFG, *actColorBG;
QActionGroup *group;
@ -1019,6 +1019,55 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
viewRAM->setChecked(true); // Set default view
viewMenu->addSeparator();
// View -> Refresh Rate
subMenu = viewMenu->addMenu( tr("Re&fresh Rate") );
group = new QActionGroup(this);
group->setExclusive(true);
// View -> Refresh Rate -> 5 Hz
act = new QAction(tr("5 Hz"), this);
act->setCheckable(true);
connect(act, SIGNAL(triggered()), this, SLOT(setViewRefresh5Hz(void)) );
group->addAction(act);
subMenu->addAction(act);
// View -> Refresh Rate -> 10 Hz
act = new QAction(tr("10 Hz"), this);
act->setCheckable(true);
act->setChecked(true);
connect(act, SIGNAL(triggered()), this, SLOT(setViewRefresh10Hz(void)) );
group->addAction(act);
subMenu->addAction(act);
// View -> Refresh Rate -> 20 Hz
act = new QAction(tr("20 Hz"), this);
act->setCheckable(true);
connect(act, SIGNAL(triggered()), this, SLOT(setViewRefresh20Hz(void)) );
group->addAction(act);
subMenu->addAction(act);
// View -> Refresh Rate -> 30 Hz
act = new QAction(tr("30 Hz"), this);
act->setCheckable(true);
connect(act, SIGNAL(triggered()), this, SLOT(setViewRefresh30Hz(void)) );
group->addAction(act);
subMenu->addAction(act);
// View -> Refresh Rate -> 60 Hz
act = new QAction(tr("60 Hz"), this);
act->setCheckable(true);
connect(act, SIGNAL(triggered()), this, SLOT(setViewRefresh60Hz(void)) );
group->addAction(act);
subMenu->addAction(act);
// Color Menu
colorMenu = menuBar->addMenu(tr("&Color"));
@ -1350,6 +1399,36 @@ void HexEditorDialog_t::setViewROM(void)
editor->setMode( QHexEdit::MODE_NES_ROM );
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::setViewRefresh5Hz(void)
{
periodicTimer->stop();
periodicTimer->start(200);
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::setViewRefresh10Hz(void)
{
periodicTimer->stop();
periodicTimer->start(100);
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::setViewRefresh20Hz(void)
{
periodicTimer->stop();
periodicTimer->start(50);
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::setViewRefresh30Hz(void)
{
periodicTimer->stop();
periodicTimer->start(33);
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::setViewRefresh60Hz(void)
{
periodicTimer->stop();
periodicTimer->start(16);
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::actvHighlightCB(bool enable)
{
//printf("Highlight: %i \n", enable );

View File

@ -308,6 +308,11 @@ class HexEditorDialog_t : public QDialog
void pasteFromClipboard(void);
void openFindDialog(void);
void undoRomPatch(void);
void setViewRefresh5Hz(void);
void setViewRefresh10Hz(void);
void setViewRefresh20Hz(void);
void setViewRefresh30Hz(void);
void setViewRefresh60Hz(void);
};
int hexEditorNumWindows(void);