Added missing config paramaters for Qt Hex Editor.

This commit is contained in:
mjbudd77 2021-07-18 20:01:15 -04:00
parent bf41302862
commit 829e8cb3f1
2 changed files with 49 additions and 11 deletions

View File

@ -1087,7 +1087,7 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
QAction *act, *actHlgt, *actHlgtRV;
ColorMenuItem *actColorFG, *actColorBG, *actRowColColor, *actAltColColor;
QActionGroup *group;
int useNativeMenuBar;
int opt, useNativeMenuBar, refreshRateOpt;
QSettings settings;
QDialog::setWindowTitle( tr("Hex Editor") );
@ -1096,6 +1096,11 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
menuBar = new QMenuBar(this);
grid = new QGridLayout(this);
editor = new QHexEdit(this);
vbar = new QScrollBar( Qt::Vertical, this );
hbar = new QScrollBar( Qt::Horizontal, this );
// This is needed for menu bar to show up on MacOS
g_config->getOption( "SDL.UseNativeMenuBar", &useNativeMenuBar );
@ -1262,9 +1267,12 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
group->setExclusive(true);
g_config->getOption("SDL.HexEditRefreshRate", &refreshRateOpt);
// View -> Refresh Rate -> 5 Hz
act = new QAction(tr("5 Hz"), this);
act->setCheckable(true);
act->setChecked( refreshRateOpt == 5 );
connect(act, SIGNAL(triggered()), this, SLOT(setViewRefresh5Hz(void)) );
group->addAction(act);
@ -1273,7 +1281,7 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
// View -> Refresh Rate -> 10 Hz
act = new QAction(tr("10 Hz"), this);
act->setCheckable(true);
act->setChecked(true);
act->setChecked( refreshRateOpt == 10 );
connect(act, SIGNAL(triggered()), this, SLOT(setViewRefresh10Hz(void)) );
group->addAction(act);
@ -1282,6 +1290,7 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
// View -> Refresh Rate -> 20 Hz
act = new QAction(tr("20 Hz"), this);
act->setCheckable(true);
act->setChecked( refreshRateOpt == 20 );
connect(act, SIGNAL(triggered()), this, SLOT(setViewRefresh20Hz(void)) );
group->addAction(act);
@ -1290,6 +1299,7 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
// View -> Refresh Rate -> 30 Hz
act = new QAction(tr("30 Hz"), this);
act->setCheckable(true);
act->setChecked( refreshRateOpt == 30 );
connect(act, SIGNAL(triggered()), this, SLOT(setViewRefresh30Hz(void)) );
group->addAction(act);
@ -1298,6 +1308,7 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
// View -> Refresh Rate -> 60 Hz
act = new QAction(tr("60 Hz"), this);
act->setCheckable(true);
act->setChecked( refreshRateOpt == 60 );
connect(act, SIGNAL(triggered()), this, SLOT(setViewRefresh60Hz(void)) );
group->addAction(act);
@ -1307,41 +1318,53 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
colorMenu = menuBar->addMenu(tr("&Color"));
// Color -> Highlight Activity
g_config->getOption("SDL.HexEditActivityHlgt", &opt);
editor->setHighlightActivity( opt );
actHlgt = new QAction(tr("Highlight &Activity"), this);
//actHlgt->setShortcuts(QKeySequence::Open);
actHlgt->setStatusTip(tr("Highlight Activity"));
actHlgt->setCheckable(true);
actHlgt->setChecked(true);
actHlgt->setChecked(opt);
connect(actHlgt, SIGNAL(triggered(bool)), this, SLOT(actvHighlightCB(bool)) );
colorMenu->addAction(actHlgt);
// Color -> Highlight Reverse Video
g_config->getOption("SDL.HexEditReverseVideo", &opt);
editor->setHighlightReverseVideo( opt );
actHlgtRV = new QAction(tr("Highlight &Reverse Video"), this);
//actHlgtRV->setShortcuts(QKeySequence::Open);
actHlgtRV->setStatusTip(tr("Highlight Reverse Video"));
actHlgtRV->setCheckable(true);
actHlgtRV->setChecked(true);
actHlgtRV->setChecked(opt);
connect(actHlgtRV, SIGNAL(triggered(bool)), this, SLOT(actvHighlightRVCB(bool)) );
colorMenu->addAction(actHlgtRV);
// Color -> Highlight Reverse Video
g_config->getOption("SDL.HexEditRowColumnHlgt", &opt);
editor->setRowColHlgtEna( opt );
rolColHlgtAct = new QAction(tr("Highlight &Cursor Row/Column"), this);
//rolColHlgtAct->setShortcuts(QKeySequence::Open);
rolColHlgtAct->setStatusTip(tr("Highlight Cursor Row/Column"));
rolColHlgtAct->setCheckable(true);
rolColHlgtAct->setChecked(false);
rolColHlgtAct->setChecked(opt);
connect(rolColHlgtAct, SIGNAL(triggered(bool)), this, SLOT(rolColHlgtChanged(bool)) );
colorMenu->addAction(rolColHlgtAct);
// Color -> Highlight Reverse Video
g_config->getOption("SDL.HexEditAltnColumnColor", &opt);
editor->setAltColHlgtEna( opt );
altColHlgtAct = new QAction(tr("&Alternating Column Colors"), this);
//altColHlgtAct->setShortcuts(QKeySequence::Open);
altColHlgtAct->setStatusTip(tr("&Alternating Column Colors"));
altColHlgtAct->setCheckable(true);
altColHlgtAct->setChecked(false);
altColHlgtAct->setChecked(opt);
connect(altColHlgtAct, SIGNAL(triggered(bool)), this, SLOT(altColHlgtChanged(bool)) );
colorMenu->addAction(altColHlgtAct);
@ -1392,10 +1415,6 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
//-----------------------------------------------------------------------
//mainLayout = new QVBoxLayout();
grid = new QGridLayout(this);
editor = new QHexEdit(this);
vbar = new QScrollBar( Qt::Vertical, this );
hbar = new QScrollBar( Qt::Horizontal, this );
grid->setMenuBar( menuBar );
@ -1430,7 +1449,8 @@ HexEditorDialog_t::HexEditorDialog_t(QWidget *parent)
connect( periodicTimer, &QTimer::timeout, this, &HexEditorDialog_t::updatePeriodic );
periodicTimer->start( 100 ); // 10hz
//printf("Refresh Rate: %i\n", 1000 / refreshRateOpt );
periodicTimer->start( 1000 / refreshRateOpt );
// Lock the mutex before adding a new window to the list,
// we want to be sure that the emulator is not iterating the list
@ -1742,54 +1762,67 @@ void HexEditorDialog_t::changeFontRequest(void)
//----------------------------------------------------------------------------
void HexEditorDialog_t::setViewRefresh5Hz(void)
{
g_config->setOption("SDL.HexEditRefreshRate", 5);
periodicTimer->stop();
periodicTimer->start(200);
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::setViewRefresh10Hz(void)
{
g_config->setOption("SDL.HexEditRefreshRate", 10);
periodicTimer->stop();
periodicTimer->start(100);
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::setViewRefresh20Hz(void)
{
g_config->setOption("SDL.HexEditRefreshRate", 20);
periodicTimer->stop();
periodicTimer->start(50);
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::setViewRefresh30Hz(void)
{
g_config->setOption("SDL.HexEditRefreshRate", 30);
periodicTimer->stop();
periodicTimer->start(33);
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::setViewRefresh60Hz(void)
{
g_config->setOption("SDL.HexEditRefreshRate", 60);
periodicTimer->stop();
periodicTimer->start(16);
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::actvHighlightCB(bool enable)
{
g_config->setOption("SDL.HexEditActivityHlgt", enable);
//printf("Highlight: %i \n", enable );
editor->setHighlightActivity( enable );
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::actvHighlightRVCB(bool enable)
{
g_config->setOption("SDL.HexEditReverseVideo", enable);
//printf("Highlight: %i \n", enable );
editor->setHighlightReverseVideo( enable );
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::rolColHlgtChanged(bool enable)
{
g_config->setOption("SDL.HexEditRowColumnHlgt", enable);
//printf("Highlight: %i \n", enable );
editor->setRowColHlgtEna( enable );
}
//----------------------------------------------------------------------------
void HexEditorDialog_t::altColHlgtChanged(bool enable)
{
g_config->setOption("SDL.HexEditAltnColumnColor", enable);
//printf("Highlight: %i \n", enable );
editor->setAltColHlgtEna( enable );
}

View File

@ -568,6 +568,11 @@ InitConfig()
config->addOption("SDL.HexEditCursorColorRC", "#000080");
config->addOption("SDL.HexEditAltColColor" , "#545454");
config->addOption("SDL.HexEditFont" , "");
config->addOption("SDL.HexEditActivityHlgt", true);
config->addOption("SDL.HexEditReverseVideo", true);
config->addOption("SDL.HexEditRowColumnHlgt", false);
config->addOption("SDL.HexEditAltnColumnColor", false);
config->addOption("SDL.HexEditRefreshRate", 10);
// Debugger Options
config->addOption("autoLoadDebugFiles" , "SDL.AutoLoadDebugFiles", 1);