mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-25 14:25:25 +00:00
* fix #124 * use cmdj instead of cmd
This commit is contained in:
parent
b5a2ec74b0
commit
b119181757
@ -119,6 +119,7 @@ void Configuration::loadDefaultTheme()
|
|||||||
setColor("gui.alt_background", QColor(245, 250, 255));
|
setColor("gui.alt_background", QColor(245, 250, 255));
|
||||||
// Custom
|
// Custom
|
||||||
setColor("gui.imports", colorA);
|
setColor("gui.imports", colorA);
|
||||||
|
setColor("gui.main", color2);
|
||||||
setColor("gui.navbar.err", QColor(255, 0, 0));
|
setColor("gui.navbar.err", QColor(255, 0, 0));
|
||||||
setColor("gui.navbar.code", QColor(104, 229, 69));
|
setColor("gui.navbar.code", QColor(104, 229, 69));
|
||||||
setColor("gui.navbar.str", QColor(69, 104, 229));
|
setColor("gui.navbar.str", QColor(69, 104, 229));
|
||||||
@ -213,6 +214,7 @@ void Configuration::loadDarkTheme()
|
|||||||
setColor("gui.alt_background", QColor(58, 100, 128));
|
setColor("gui.alt_background", QColor(58, 100, 128));
|
||||||
// Custom
|
// Custom
|
||||||
setColor("gui.imports", colorA);
|
setColor("gui.imports", colorA);
|
||||||
|
setColor("gui.main", color2);
|
||||||
setColor("gui.navbar.err", QColor(255, 0, 0));
|
setColor("gui.navbar.err", QColor(255, 0, 0));
|
||||||
setColor("gui.navbar.code", QColor(104, 229, 69));
|
setColor("gui.navbar.code", QColor(104, 229, 69));
|
||||||
setColor("gui.navbar.str", QColor(69, 104, 229));
|
setColor("gui.navbar.str", QColor(69, 104, 229));
|
||||||
|
@ -13,11 +13,13 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QResource>
|
#include <QResource>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
|
#include <QJsonObject>
|
||||||
|
|
||||||
FunctionModel::FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *importAddresses, bool nested, QFont default_font, QFont highlight_font, QObject *parent)
|
FunctionModel::FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *importAddresses, ut64 *mainAdress, bool nested, QFont default_font, QFont highlight_font, QObject *parent)
|
||||||
: QAbstractItemModel(parent),
|
: QAbstractItemModel(parent),
|
||||||
functions(functions),
|
functions(functions),
|
||||||
importAddresses(importAddresses),
|
importAddresses(importAddresses),
|
||||||
|
mainAdress(mainAdress),
|
||||||
highlightFont(highlight_font),
|
highlightFont(highlight_font),
|
||||||
defaultFont(default_font),
|
defaultFont(default_font),
|
||||||
nested(nested),
|
nested(nested),
|
||||||
@ -75,6 +77,10 @@ bool FunctionModel::functionIsImport(ut64 addr) const
|
|||||||
return importAddresses->contains(addr);
|
return importAddresses->contains(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FunctionModel::functionIsMain(ut64 addr) const
|
||||||
|
{
|
||||||
|
return *mainAdress == addr;
|
||||||
|
}
|
||||||
|
|
||||||
QVariant FunctionModel::data(const QModelIndex &index, int role) const
|
QVariant FunctionModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
@ -167,6 +173,8 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
|
|||||||
case Qt::ForegroundRole:
|
case Qt::ForegroundRole:
|
||||||
if (functionIsImport(function.offset))
|
if (functionIsImport(function.offset))
|
||||||
return QVariant(ConfigColor("gui.imports"));
|
return QVariant(ConfigColor("gui.imports"));
|
||||||
|
if (functionIsMain(function.offset))
|
||||||
|
return QVariant(ConfigColor("gui.main"));
|
||||||
return QVariant(this->property("color"));
|
return QVariant(this->property("color"));
|
||||||
|
|
||||||
case FunctionDescriptionRole:
|
case FunctionDescriptionRole:
|
||||||
@ -361,7 +369,7 @@ FunctionsWidget::FunctionsWidget(MainWindow *main, QWidget *parent) :
|
|||||||
QFont default_font = QFont(font_info.family(), font_info.pointSize());
|
QFont default_font = QFont(font_info.family(), font_info.pointSize());
|
||||||
QFont highlight_font = QFont(font_info.family(), font_info.pointSize(), QFont::Bold);
|
QFont highlight_font = QFont(font_info.family(), font_info.pointSize(), QFont::Bold);
|
||||||
|
|
||||||
functionModel = new FunctionModel(&functions, &importAddresses, false, default_font, highlight_font, this);
|
functionModel = new FunctionModel(&functions, &importAddresses, &mainAdress, false, default_font, highlight_font, this);
|
||||||
functionProxyModel = new FunctionSortFilterProxyModel(functionModel, this);
|
functionProxyModel = new FunctionSortFilterProxyModel(functionModel, this);
|
||||||
ui->functionsTreeView->setModel(functionProxyModel);
|
ui->functionsTreeView->setModel(functionProxyModel);
|
||||||
ui->functionsTreeView->sortByColumn(FunctionModel::NameColumn, Qt::AscendingOrder);
|
ui->functionsTreeView->sortByColumn(FunctionModel::NameColumn, Qt::AscendingOrder);
|
||||||
@ -400,6 +408,8 @@ void FunctionsWidget::refreshTree()
|
|||||||
foreach (ImportDescription import, CutterCore::getInstance()->getAllImports())
|
foreach (ImportDescription import, CutterCore::getInstance()->getAllImports())
|
||||||
importAddresses.insert(import.plt);
|
importAddresses.insert(import.plt);
|
||||||
|
|
||||||
|
mainAdress = (ut64)CutterCore::getInstance()->cmdj("iMj").object()["vaddr"].toInt();
|
||||||
|
|
||||||
functionModel->endReloadFunctions();
|
functionModel->endReloadFunctions();
|
||||||
|
|
||||||
// resize offset and size columns
|
// resize offset and size columns
|
||||||
|
@ -25,6 +25,7 @@ class FunctionModel : public QAbstractItemModel
|
|||||||
private:
|
private:
|
||||||
QList<FunctionDescription> *functions;
|
QList<FunctionDescription> *functions;
|
||||||
QSet<RVA> *importAddresses;
|
QSet<RVA> *importAddresses;
|
||||||
|
ut64 *mainAdress;
|
||||||
|
|
||||||
|
|
||||||
QFont highlightFont;
|
QFont highlightFont;
|
||||||
@ -35,13 +36,15 @@ private:
|
|||||||
|
|
||||||
bool functionIsImport(ut64 addr) const;
|
bool functionIsImport(ut64 addr) const;
|
||||||
|
|
||||||
|
bool functionIsMain(ut64 addr) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const int FunctionDescriptionRole = Qt::UserRole;
|
static const int FunctionDescriptionRole = Qt::UserRole;
|
||||||
static const int IsImportRole = Qt::UserRole + 1;
|
static const int IsImportRole = Qt::UserRole + 1;
|
||||||
|
|
||||||
enum Column { NameColumn = 0, SizeColumn, ImportColumn, OffsetColumn, ColumnCount };
|
enum Column { NameColumn = 0, SizeColumn, ImportColumn, OffsetColumn, ColumnCount };
|
||||||
|
|
||||||
FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *importAddresses, bool nested, QFont defaultFont, QFont highlightFont, QObject *parent = 0);
|
FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *importAddresses, ut64 *mainAdress, bool nested, QFont defaultFont, QFont highlightFont, QObject *parent = 0);
|
||||||
|
|
||||||
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
||||||
QModelIndex parent(const QModelIndex &index) const;
|
QModelIndex parent(const QModelIndex &index) const;
|
||||||
@ -116,6 +119,7 @@ private:
|
|||||||
|
|
||||||
QList<FunctionDescription> functions;
|
QList<FunctionDescription> functions;
|
||||||
QSet<RVA> importAddresses;
|
QSet<RVA> importAddresses;
|
||||||
|
ut64 mainAdress;
|
||||||
|
|
||||||
FunctionModel *functionModel;
|
FunctionModel *functionModel;
|
||||||
FunctionSortFilterProxyModel *functionProxyModel;
|
FunctionSortFilterProxyModel *functionProxyModel;
|
||||||
|
Loading…
Reference in New Issue
Block a user