GUI: small refactor in Configuration
This commit is contained in:
parent
e8e7112cf5
commit
8a1256b5fd
|
|
@ -176,7 +176,7 @@ void AppearanceDialog::on_editBackgroundColor_textChanged(const QString & arg1)
|
|||
{
|
||||
(*colorMap)[id] = Qt::transparent;
|
||||
ui->buttonSave->setEnabled(true);
|
||||
Config()->emitColorsUpdated();
|
||||
emit Config()->colorsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ void AppearanceDialog::on_editBackgroundColor_textChanged(const QString & arg1)
|
|||
{
|
||||
(*colorMap)[id] = QColor(text);
|
||||
ui->buttonSave->setEnabled(true);
|
||||
Config()->emitColorsUpdated();
|
||||
emit Config()->colorsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ void AppearanceDialog::on_editColor_textChanged(const QString & arg1)
|
|||
{
|
||||
(*colorMap)[id] = QColor(text);
|
||||
ui->buttonSave->setEnabled(true);
|
||||
Config()->emitColorsUpdated();
|
||||
emit Config()->colorsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
}
|
||||
|
|
@ -714,7 +714,7 @@ void AppearanceDialog::on_fontAbstractTables_currentFontChanged(const QFont & f)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -732,7 +732,7 @@ void AppearanceDialog::on_fontAbstractTablesStyle_currentIndexChanged(int index)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -745,7 +745,7 @@ void AppearanceDialog::on_fontAbstractTablesSize_currentIndexChanged(const QStri
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -758,7 +758,7 @@ void AppearanceDialog::on_fontDisassembly_currentFontChanged(const QFont & f)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -776,7 +776,7 @@ void AppearanceDialog::on_fontDisassemblyStyle_currentIndexChanged(int index)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -789,7 +789,7 @@ void AppearanceDialog::on_fontDisassemblySize_currentIndexChanged(const QString
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -802,7 +802,7 @@ void AppearanceDialog::on_fontHexDump_currentFontChanged(const QFont & f)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -820,7 +820,7 @@ void AppearanceDialog::on_fontHexDumpStyle_currentIndexChanged(int index)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -833,7 +833,7 @@ void AppearanceDialog::on_fontHexDumpSize_currentIndexChanged(const QString & ar
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -846,7 +846,7 @@ void AppearanceDialog::on_fontStack_currentFontChanged(const QFont & f)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -864,7 +864,7 @@ void AppearanceDialog::on_fontStackStyle_currentIndexChanged(int index)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -877,7 +877,7 @@ void AppearanceDialog::on_fontStackSize_currentIndexChanged(const QString & arg1
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -890,7 +890,7 @@ void AppearanceDialog::on_fontRegisters_currentFontChanged(const QFont & f)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -908,7 +908,7 @@ void AppearanceDialog::on_fontRegistersStyle_currentIndexChanged(int index)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -921,7 +921,7 @@ void AppearanceDialog::on_fontRegistersSize_currentIndexChanged(const QString &
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -934,7 +934,7 @@ void AppearanceDialog::on_fontHexEdit_currentFontChanged(const QFont & f)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -952,7 +952,7 @@ void AppearanceDialog::on_fontHexEditStyle_currentIndexChanged(int index)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -965,7 +965,7 @@ void AppearanceDialog::on_fontHexEditSize_currentIndexChanged(const QString & ar
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -978,7 +978,7 @@ void AppearanceDialog::on_fontLog_currentFontChanged(const QFont & f)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -996,7 +996,7 @@ void AppearanceDialog::on_fontLogStyle_currentIndexChanged(int index)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -1009,7 +1009,7 @@ void AppearanceDialog::on_fontLogSize_currentIndexChanged(const QString & arg1)
|
|||
(*fontMap)[id] = font;
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -1024,7 +1024,7 @@ void AppearanceDialog::on_buttonApplicationFont_clicked()
|
|||
ui->labelApplicationFont->setText(fontDialog.currentFont().family());
|
||||
if(isInit)
|
||||
return;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
|
|
@ -1034,15 +1034,15 @@ void AppearanceDialog::on_buttonFontDefaults_clicked()
|
|||
isInit = true;
|
||||
fontInit();
|
||||
isInit = false;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
||||
void AppearanceDialog::rejectedSlot()
|
||||
{
|
||||
Config()->Colors = colorBackupMap;
|
||||
Config()->emitColorsUpdated();
|
||||
emit Config()->colorsUpdated();
|
||||
Config()->Fonts = fontBackupMap;
|
||||
Config()->emitFontsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2048,10 +2048,10 @@ void MainWindow::on_actionImportSettings_triggered()
|
|||
}
|
||||
Config()->load();
|
||||
DbgSettingsUpdated();
|
||||
Config()->emitColorsUpdated();
|
||||
Config()->emitFontsUpdated();
|
||||
Config()->emitShortcutsUpdated();
|
||||
Config()->emitTokenizerConfigUpdated();
|
||||
emit Config()->colorsUpdated();
|
||||
emit Config()->fontsUpdated();
|
||||
emit Config()->shortcutsUpdated();
|
||||
emit Config()->tokenizerConfigUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ SettingsDialog::SettingsDialog(QWidget* parent) :
|
|||
adjustSize();
|
||||
bTokenizerConfigUpdated = false;
|
||||
bDisableAutoCompleteUpdated = false;
|
||||
bAsciiAddressDumpModeUpdated = false;
|
||||
LoadSettings(); //load settings from file
|
||||
connect(Bridge::getBridge(), SIGNAL(setLastException(uint)), this, SLOT(setLastException(uint)));
|
||||
lastException = 0;
|
||||
|
|
@ -47,6 +48,9 @@ Qt::CheckState SettingsDialog::bool2check(bool checked)
|
|||
|
||||
void SettingsDialog::LoadSettings()
|
||||
{
|
||||
//Flush pending config changes
|
||||
Config()->save();
|
||||
|
||||
//Defaults
|
||||
memset(&settings, 0, sizeof(SettingsStruct));
|
||||
settings.eventSystemBreakpoint = true;
|
||||
|
|
@ -78,6 +82,7 @@ void SettingsDialog::LoadSettings()
|
|||
settings.disasmMaxModuleSize = -1;
|
||||
settings.guiNoForegroundWindow = true;
|
||||
settings.guiDisableAutoComplete = false;
|
||||
settings.guiAsciiAddressDumpMode = false;
|
||||
|
||||
//Events tab
|
||||
GetSettingBool("Events", "SystemBreakpoint", &settings.eventSystemBreakpoint);
|
||||
|
|
@ -234,6 +239,7 @@ void SettingsDialog::LoadSettings()
|
|||
GetSettingBool("Gui", "ShowGraphRva", &settings.guiShowGraphRva);
|
||||
GetSettingBool("Gui", "ShowExitConfirmation", &settings.guiShowExitConfirmation);
|
||||
GetSettingBool("Gui", "DisableAutoComplete", &settings.guiDisableAutoComplete);
|
||||
GetSettingBool("Gui", "AsciiAddressDumpMode", &settings.guiAsciiAddressDumpMode);
|
||||
ui->chkFpuRegistersLittleEndian->setChecked(settings.guiFpuRegistersLittleEndian);
|
||||
ui->chkSaveColumnOrder->setChecked(settings.guiSaveColumnOrder);
|
||||
ui->chkNoCloseDialog->setChecked(settings.guiNoCloseDialog);
|
||||
|
|
@ -244,6 +250,7 @@ void SettingsDialog::LoadSettings()
|
|||
ui->chkShowGraphRva->setChecked(settings.guiShowGraphRva);
|
||||
ui->chkShowExitConfirmation->setChecked(settings.guiShowExitConfirmation);
|
||||
ui->chkDisableAutoComplete->setChecked(settings.guiDisableAutoComplete);
|
||||
ui->chkAsciiAddressDumpMode->setChecked(settings.guiAsciiAddressDumpMode);
|
||||
|
||||
//Misc tab
|
||||
if(DbgFunctions()->GetJit)
|
||||
|
|
@ -383,6 +390,7 @@ void SettingsDialog::SaveSettings()
|
|||
BridgeSettingSetUint("Gui", "ShowGraphRva", settings.guiShowGraphRva);
|
||||
BridgeSettingSetUint("Gui", "ShowExitConfirmation", settings.guiShowExitConfirmation);
|
||||
BridgeSettingSetUint("Gui", "DisableAutoComplete", settings.guiDisableAutoComplete);
|
||||
BridgeSettingSetUint("Gui", "AsciiAddressDumpMode", settings.guiAsciiAddressDumpMode);
|
||||
|
||||
//Misc tab
|
||||
if(DbgFunctions()->GetJit)
|
||||
|
|
@ -417,14 +425,19 @@ void SettingsDialog::SaveSettings()
|
|||
Config()->load();
|
||||
if(bTokenizerConfigUpdated)
|
||||
{
|
||||
Config()->emitTokenizerConfigUpdated();
|
||||
emit Config()->tokenizerConfigUpdated();
|
||||
bTokenizerConfigUpdated = false;
|
||||
}
|
||||
if(bDisableAutoCompleteUpdated)
|
||||
{
|
||||
Config()->emitDisableAutoCompleteUpdated();
|
||||
emit Config()->disableAutoCompleteUpdated();
|
||||
bDisableAutoCompleteUpdated = false;
|
||||
}
|
||||
if(bAsciiAddressDumpModeUpdated)
|
||||
{
|
||||
emit Config()->asciiAddressDumpModeUpdated();
|
||||
bAsciiAddressDumpModeUpdated = false;
|
||||
}
|
||||
DbgSettingsUpdated();
|
||||
GuiUpdateAllViews();
|
||||
}
|
||||
|
|
@ -867,6 +880,12 @@ void SettingsDialog::on_chkDisableAutoComplete_toggled(bool checked)
|
|||
bDisableAutoCompleteUpdated = true;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkAsciiAddressDumpMode_toggled(bool checked)
|
||||
{
|
||||
settings.guiAsciiAddressDumpMode = checked;
|
||||
bAsciiAddressDumpModeUpdated = true;
|
||||
}
|
||||
|
||||
void SettingsDialog::on_chkUseLocalHelpFile_toggled(bool checked)
|
||||
{
|
||||
settings.miscUseLocalHelpFile = checked;
|
||||
|
|
|
|||
|
|
@ -672,21 +672,6 @@ void Configuration::writeColors()
|
|||
emit colorsUpdated();
|
||||
}
|
||||
|
||||
void Configuration::emitColorsUpdated()
|
||||
{
|
||||
emit colorsUpdated();
|
||||
}
|
||||
|
||||
void Configuration::emitTokenizerConfigUpdated()
|
||||
{
|
||||
emit tokenizerConfigUpdated();
|
||||
}
|
||||
|
||||
void Configuration::emitDisableAutoCompleteUpdated()
|
||||
{
|
||||
emit disableAutoCompleteUpdated();
|
||||
}
|
||||
|
||||
void Configuration::readBools()
|
||||
{
|
||||
Bools = defaultBools;
|
||||
|
|
@ -782,11 +767,6 @@ void Configuration::writeFonts()
|
|||
emit fontsUpdated();
|
||||
}
|
||||
|
||||
void Configuration::emitFontsUpdated()
|
||||
{
|
||||
emit fontsUpdated();
|
||||
}
|
||||
|
||||
void Configuration::readShortcuts()
|
||||
{
|
||||
Shortcuts = defaultShortcuts;
|
||||
|
|
@ -823,11 +803,6 @@ void Configuration::writeShortcuts()
|
|||
emit shortcutsUpdated();
|
||||
}
|
||||
|
||||
void Configuration::emitShortcutsUpdated()
|
||||
{
|
||||
emit shortcutsUpdated();
|
||||
}
|
||||
|
||||
const QColor Configuration::getColor(const QString id) const
|
||||
{
|
||||
if(Colors.contains(id))
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@
|
|||
#define ConfigHScrollBarStyle() "QScrollBar:horizontal{border:1px solid grey;background:#f1f1f1;height:10px}QScrollBar::handle:horizontal{background:#aaaaaa;min-width:20px;margin:1px}QScrollBar::add-line:horizontal,QScrollBar::sub-line:horizontal{width:0;height:0}"
|
||||
#define ConfigVScrollBarStyle() "QScrollBar:vertical{border:1px solid grey;background:#f1f1f1;width:10px}QScrollBar::handle:vertical{background:#aaaaaa;min-height:20px;margin:1px}QScrollBar::add-line:vertical,QScrollBar::sub-line:vertical{width:0;height:0}"
|
||||
|
||||
|
||||
|
||||
class MenuBuilder;
|
||||
class QAction;
|
||||
|
||||
|
|
@ -47,19 +45,14 @@ public:
|
|||
void save();
|
||||
void readColors();
|
||||
void writeColors();
|
||||
void emitColorsUpdated();
|
||||
void emitTokenizerConfigUpdated();
|
||||
void emitDisableAutoCompleteUpdated();
|
||||
void readBools();
|
||||
void writeBools();
|
||||
void readUints();
|
||||
void writeUints();
|
||||
void readFonts();
|
||||
void writeFonts();
|
||||
void emitFontsUpdated();
|
||||
void readShortcuts();
|
||||
void writeShortcuts();
|
||||
void emitShortcutsUpdated();
|
||||
void registerMenuBuilder(MenuBuilder* menu, size_t count);
|
||||
void registerMainMenuStringList(QList<QAction*>* menu);
|
||||
|
||||
|
|
@ -117,6 +110,7 @@ signals:
|
|||
void shortcutsUpdated();
|
||||
void tokenizerConfigUpdated();
|
||||
void disableAutoCompleteUpdated();
|
||||
void asciiAddressDumpModeUpdated();
|
||||
|
||||
private:
|
||||
QColor colorFromConfig(const QString id);
|
||||
|
|
|
|||
Loading…
Reference in New Issue