diff --git a/CMakeLists.txt b/CMakeLists.txt index a062e57a..03d62c90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ project(Medusa) # medusa version set(VERSION_MAJOR 0) set(VERSION_MINOR 4) -set(VERSION_PATCH 2) +set(VERSION_PATCH 3) configure_file( ${CMAKE_SOURCE_DIR}/inc/medusa/version.hpp.in diff --git a/inc/medusa/disassembly_view.hpp b/inc/medusa/disassembly_view.hpp index 9da5026b..7cb291fe 100644 --- a/inc/medusa/disassembly_view.hpp +++ b/inc/medusa/disassembly_view.hpp @@ -23,10 +23,9 @@ class Medusa_EXPORT Appearance { char const* m_pName; char const* m_pDescription; - char const* m_pDefaultValue; - Information(char const* pName = "", char const* pDescription = "", char const* pDefaultValue = "") - : m_pName(pName), m_pDescription(pDescription), m_pDefaultValue(pDefaultValue) {} + Information(char const* pName = "", char const* pDescription = "") + : m_pName(pName), m_pDescription(pDescription) {} }; typedef std::map MapType; diff --git a/src/core/disassembly_view.cpp b/src/core/disassembly_view.cpp index 26579548..9a2d9447 100644 --- a/src/core/disassembly_view.cpp +++ b/src/core/disassembly_view.cpp @@ -14,17 +14,17 @@ Appearance::MapType& Appearance::GetColors(void) static MapType s_Colors; if (s_Colors.empty()) { - s_Colors["color.background_listing"] = Information("Background listing", "", "#1e1e1e"); - s_Colors["color.background_address"] = Information("Background address", "", "#626262"); - s_Colors["color.instruction_mnemonic"] = Information("Instruction mnemonic", "", "#9a86d6"); - s_Colors["color.instruction_register"] = Information("Instruction register", "", "#00aa7f"); - s_Colors["color.instruction_immediate"] = Information("Instruction immediate", "", "#ffaa00"); - s_Colors["color.comment"] = Information("Comment", "", "#55aa00"); - s_Colors["color.selection"] = Information("Selection", "", "#760000"); - s_Colors["color.operator"] = Information("Operator", "", "#ff0000"); - s_Colors["color.keyword"] = Information("Keyword", "", "#55aaff"); - s_Colors["color.label"] = Information("Label", "", "#aaaa7f"); - s_Colors["color.string"] = Information("String", "", "#bd72ff"); + s_Colors["color.background_listing"] = Information("Background listing", ""); + s_Colors["color.background_address"] = Information("Background address", ""); + s_Colors["color.instruction_mnemonic"] = Information("Instruction mnemonic", ""); + s_Colors["color.instruction_register"] = Information("Instruction register", ""); + s_Colors["color.instruction_immediate"] = Information("Instruction immediate", ""); + s_Colors["color.comment"] = Information("Comment", ""); + s_Colors["color.selection"] = Information("Selection", ""); + s_Colors["color.operator"] = Information("Operator", ""); + s_Colors["color.keyword"] = Information("Keyword", ""); + s_Colors["color.label"] = Information("Label", ""); + s_Colors["color.string"] = Information("String", ""); } return s_Colors; @@ -35,7 +35,7 @@ Appearance::MapType& Appearance::GetFonts(void) static MapType s_Fonts; if (s_Fonts.empty()) { - s_Fonts["font.listing"] = Information("Listing", "", "DejaVu Sans Mono,10,-1,5,50,0,0,0,0,0"); + s_Fonts["font.listing"] = Information("Listing", ""); } return s_Fonts; diff --git a/src/core/user_configuration.cpp b/src/core/user_configuration.cpp index aff59a1b..48423b2d 100644 --- a/src/core/user_configuration.cpp +++ b/src/core/user_configuration.cpp @@ -99,13 +99,49 @@ bool UserConfiguration::_WriteDefaultOptions(void) std::lock_guard Lock(m_Mutex); namespace pt = boost::property_tree; pt::ptree PropTree; + PropTree.put("core.modules_path", "."); + + PropTree.put("color.background_listing", "#1e1e1e"); + PropTree.put("color.background_address", "#626262"); + PropTree.put("color.instruction_mnemonic", "#9a86d6"); + PropTree.put("color.instruction_register", "#00aa7f"); + PropTree.put("color.instruction_immediate", "#ffaa00"); + PropTree.put("color.comment", "#55aa00"); + PropTree.put("color.selection", "#760000"); + PropTree.put("color.operator", "#ff0000"); + PropTree.put("color.keyword", "#55aaff"); + PropTree.put("color.label", "#aaaa7f"); + PropTree.put("color.string", "#bd72ff"); + + PropTree.put("action.add_disassembly_view", "Ctrl+D"); + PropTree.put("action.add_semantic_view", "Ctrl+S"); + PropTree.put("action.add_control_flow_graph_view", "Ctrl+F"); + PropTree.put("action.show_label_dialog", "N"); + PropTree.put("action.show_comment_dialog", ";"); + PropTree.put("action.change_value_size", "D, V"); + PropTree.put("action.to_character", "D, C"); + PropTree.put("action.to_reference", "R"); + PropTree.put("action.not_value", "~"); + PropTree.put("action.negate_value", "-"); + PropTree.put("action.reset_value", "Del"); + PropTree.put("action.undefine", "U"); + PropTree.put("action.to_word", "D, W"); + PropTree.put("action.to_dword", "D, D"); + PropTree.put("action.to_qword", "D, Q"); + PropTree.put("action.analyze", "A"); + PropTree.put("action.create_function", "F"); + PropTree.put("action.to_utf8_string", "D, S, 1"); + PropTree.put("action.to_utf16_name", "D, S, 2"); + + PropTree.put("font.listing", "DejaVu Sans Mono,10,-1,5,50,0,0,0,0,0"); + pt::ini_parser::write_ini(m_CfgPath.string(), PropTree); return true; } catch (std::exception& e) { - Log::Write("core") << "exception: " << e.what() << LogEnd; + Log::Write("core") << e.what() << LogEnd; return false; } } diff --git a/src/ui/qt/DisassemblyView.cpp b/src/ui/qt/DisassemblyView.cpp index e15bb28b..e3d4ed14 100644 --- a/src/ui/qt/DisassemblyView.cpp +++ b/src/ui/qt/DisassemblyView.cpp @@ -70,6 +70,7 @@ void DisassemblyView::setFont(void) QFont font; font.setStyleHint(QFont::Monospace); font.fromString(fontInfo); + QAbstractScrollArea::setFont(font); _wChar = fontMetrics().width('M'); diff --git a/src/ui/qt/SettingsDialog.cpp b/src/ui/qt/SettingsDialog.cpp index 61b07c01..fd242199 100644 --- a/src/ui/qt/SettingsDialog.cpp +++ b/src/ui/qt/SettingsDialog.cpp @@ -96,9 +96,8 @@ SettingsDialog::SettingsDialog(QWidget* pParent, medusa::Medusa& rCore) QString Value; std::string Opt; if (!UserCfg.GetOption(rFontPair.first, Opt)) - Value = rFontInfo.m_pDefaultValue; - else - Value = QString::fromStdString(Opt); + continue; + Value = QString::fromStdString(Opt); AppearanceWidget->setItemWidget(pFontItem, 1, new QFontPicker(this, Value)); } @@ -114,9 +113,8 @@ SettingsDialog::SettingsDialog(QWidget* pParent, medusa::Medusa& rCore) QString Value; std::string Opt; if (!UserCfg.GetOption(rColorPair.first, Opt)) - Value = rColorInfo.m_pDefaultValue; - else - Value = QString::fromStdString(Opt); + continue; + Value = QString::fromStdString(Opt); AppearanceWidget->setItemWidget(pColorItem, 1, new QColorPicker(this, Value)); } @@ -144,7 +142,7 @@ SettingsDialog::~SettingsDialog() { } -void SettingsDialog::SaveSettings() +void SettingsDialog::SaveSettings() { medusa::UserConfiguration UserCfg; diff --git a/src/ui/qt/main.cpp b/src/ui/qt/main.cpp index a69f014e..5b817339 100644 --- a/src/ui/qt/main.cpp +++ b/src/ui/qt/main.cpp @@ -43,7 +43,8 @@ int main(int argc, char *argv[]) MainWindow window; a.setWindowIcon(QIcon(":/logo/medusa.png")); - QFontDatabase::addApplicationFont(":/font/DejaVuSansMono.ttf"); + if (QFontDatabase::addApplicationFont(":/fonts/DejaVuSansMono.ttf") == -1) + medusa::Log::Write("ui_qt") << "unable to load default font" << medusa::LogEnd; window.show(); return (a.exec()); } \ No newline at end of file