Added color for import functions (Fix #219)

This commit is contained in:
xarkes 2017-12-20 16:40:46 +01:00
parent 15a1a6bd9c
commit ec2dfe83f7
3 changed files with 20 additions and 2 deletions

View File

@ -45,6 +45,7 @@ void Configuration::loadDefaultTheme()
QColor color7 = QColor(215, 135, 0);
QColor color8 = QColor(108, 108, 108);
QColor color9 = QColor(96, 48, 0);
QColor colorA = QColor(50, 140, 255);
QColor highlightColor = QColor(210, 210, 255);
@ -114,6 +115,8 @@ void Configuration::loadDefaultTheme()
setColor("gui.background", QColor(255, 255, 255));
// Disassembly nodes background
setColor("gui.alt_background", QColor(245, 250, 255));
// Custom
setColor("gui.imports", colorA);
}
@ -129,6 +132,7 @@ void Configuration::loadDarkTheme()
QColor color7 = QColor(255, 130, 0);
QColor color8 = QColor(108, 108, 108);
QColor color9 = QColor(255, 130, 0);
QColor colorA = QColor(50, 140, 255);
QColor highlightColor = QColor(64, 115, 115);
@ -198,6 +202,8 @@ void Configuration::loadDarkTheme()
setColor("gui.background", QColor(36, 66, 79));
// Disassembly nodes background
setColor("gui.alt_background", QColor(58, 100, 128));
// Custom
setColor("gui.imports", colorA);
}
const QFont Configuration::getFont() const

View File

@ -70,6 +70,11 @@ int FunctionModel::columnCount(const QModelIndex &/*parent*/) const
return ColumnCount;
}
bool FunctionModel::functionIsImport(ut64 addr) const
{
return import_addresses->contains(addr);
}
QVariant FunctionModel::data(const QModelIndex &index, int role) const
{
@ -108,7 +113,7 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
case 1:
return tr("Size: %1").arg(RSizeString(function.size));
case 2:
return tr("Import: %1").arg(import_addresses->contains(function.offset) ? tr("true") : tr("false"));
return tr("Import: %1").arg(functionIsImport(function.offset) ? tr("true") : tr("false"));
default:
return QVariant();
}
@ -159,6 +164,11 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
return QVariant();
}
case Qt::ForegroundRole:
if (functionIsImport(function.offset))
return QVariant(ConfigColor("gui.imports"));
return QVariant(QColor(Qt::black));
case FunctionDescriptionRole:
return QVariant::fromValue(function);
@ -570,4 +580,4 @@ void FunctionsWidget::resizeEvent(QResizeEvent *event)
void FunctionsWidget::setScrollMode()
{
qhelpers::setVerticalScrollMode(ui->functionsTreeView);
}
}

View File

@ -33,6 +33,8 @@ private:
int current_index;
bool functionIsImport(ut64 addr) const;
public:
static const int FunctionDescriptionRole = Qt::UserRole;
static const int IsImportRole = Qt::UserRole + 1;