From ed621e55a87b990e459b1da688fe2026aadb6f8e Mon Sep 17 00:00:00 2001 From: Itay Cohen <itaycohen23@gmail.com> Date: Tue, 11 Dec 2018 20:23:01 +0200 Subject: [PATCH] Closing #929 | Color functions at offset 0x00 in the Imports widget (#992) * Color function at offset 0. Closing #929 --- src/common/Configuration.cpp | 4 ++++ src/widgets/ImportsWidget.cpp | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/common/Configuration.cpp b/src/common/Configuration.cpp index 014f2cfa..687b2866 100644 --- a/src/common/Configuration.cpp +++ b/src/common/Configuration.cpp @@ -156,6 +156,8 @@ void Configuration::loadDefaultTheme() setColor("gui.navbar.sym", QColor(229, 150, 69)); setColor("gui.navbar.empty", QColor(100, 100, 100)); setColor("gui.breakpoint_background", QColor(233, 143, 143)); + setColor("gui.item_invalid", QColor(155, 155, 155)); + setColor("gui.item_unsafe", QColor(255, 129, 123)); } void Configuration::loadBaseDark() @@ -189,6 +191,8 @@ void Configuration::loadBaseDark() setColor("gui.dataoffset", QColor(255, 255, 255)); // Custom setColor("gui.imports", QColor(50, 140, 255)); + setColor("gui.item_invalid", QColor(155, 155, 155)); + setColor("gui.item_unsafe", QColor(255, 129, 123)); setColor("gui.main", QColor(0, 128, 0)); // GUI: navbar diff --git a/src/widgets/ImportsWidget.cpp b/src/widgets/ImportsWidget.cpp index 245de5a7..13ab7764 100644 --- a/src/widgets/ImportsWidget.cpp +++ b/src/widgets/ImportsWidget.cpp @@ -31,8 +31,12 @@ QVariant ImportsModel::data(const QModelIndex &index, int role) const switch (role) { case Qt::ForegroundRole: if (index.column() < ImportsModel::ColumnCount) { + // Red color for unsafe functions if (banned.match(import.name).hasMatch()) - return QColor(255, 129, 123); + return Config()->getColor("gui.item_unsafe"); + // Grey color for symbols at offset 0 which can only be filled at runtime + if (import.plt == 0) + return Config()->getColor("gui.item_invalid"); } break; case Qt::DisplayRole: