Merge pull request #169 from mjbudd77/master

Added hex editor fore and back ground color options to config file. O…
This commit is contained in:
mjbudd77 2020-08-30 19:20:57 -04:00 committed by GitHub
commit 2524c1d88e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 3 deletions

View File

@ -815,6 +815,10 @@ void HexEditorDialog_t::pickForeGroundColor(void)
if ( ret == QDialog::Accepted )
{
QString colorText;
colorText = dialog.selectedColor().name();
//printf("FG Color string '%s'\n", colorText.toStdString().c_str() );
g_config->setOption("SDL.HexEditFgColor", colorText.toStdString().c_str() );
editor->setForeGroundColor( dialog.selectedColor() );
}
}
@ -830,6 +834,10 @@ void HexEditorDialog_t::pickBackGroundColor(void)
if ( ret == QDialog::Accepted )
{
QString colorText;
colorText = dialog.selectedColor().name();
//printf("BG Color string '%s'\n", colorText.toStdString().c_str() );
g_config->setOption("SDL.HexEditBgColor", colorText.toStdString().c_str() );
editor->setBackGroundColor( dialog.selectedColor() );
}
}
@ -954,6 +962,8 @@ QHexEdit::QHexEdit(QWidget *parent)
: QWidget( parent )
{
QPalette pal;
QColor bg, fg;
std::string colorString;
this->parent = (HexEditorDialog_t*)parent;
this->setFocusPolicy(Qt::StrongFocus);
@ -962,10 +972,15 @@ QHexEdit::QHexEdit(QWidget *parent)
font.setStyle( QFont::StyleNormal );
font.setStyleHint( QFont::Monospace );
g_config->getOption("SDL.HexEditBgColor", &colorString);
bg.setNamedColor( colorString.c_str() );
g_config->getOption("SDL.HexEditFgColor", &colorString);
fg.setNamedColor( colorString.c_str() );
pal = this->palette();
pal.setColor(QPalette::Base , Qt::black);
pal.setColor(QPalette::Background, Qt::black);
pal.setColor(QPalette::WindowText, Qt::white);
pal.setColor(QPalette::Base , bg );
pal.setColor(QPalette::Background, bg );
pal.setColor(QPalette::WindowText, fg );
//editor->setAutoFillBackground(true);
this->setPalette(pal);

View File

@ -254,6 +254,10 @@ InitConfig()
config->addOption("pauseframe", "SDL.PauseFrame", 0);
config->addOption("recordhud", "SDL.RecordHUD", 1);
config->addOption("moviemsg", "SDL.MovieMsg", 1);
// Hex Editor Options
config->addOption("hexEditBgColor", "SDL.HexEditBgColor", "#000000");
config->addOption("hexEditFgColor", "SDL.HexEditFgColor", "#FFFFFF");
// overwrite the config file?
config->addOption("no-config", "SDL.NoConfig", 0);