mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 10:58:51 +00:00
Use Core() everywhere (#440)
This commit is contained in:
parent
05fe4e60ea
commit
c79106ef84
@ -9,7 +9,7 @@ AnalThread::AnalThread(OptionsDialog *parent) :
|
|||||||
QThread(parent),
|
QThread(parent),
|
||||||
level(2),
|
level(2),
|
||||||
main(nullptr),
|
main(nullptr),
|
||||||
core(CutterCore::getInstance()),
|
core(Core()),
|
||||||
interrupted(false)
|
interrupted(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ FlagDialog::FlagDialog(RVA offset, QWidget *parent) :
|
|||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::FlagDialog),
|
ui(new Ui::FlagDialog),
|
||||||
offset(offset),
|
offset(offset),
|
||||||
core(CutterCore::getInstance())
|
core(Core())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
|
@ -253,7 +253,7 @@ bool NewFileDialog::fillRecentFilesList()
|
|||||||
|
|
||||||
bool NewFileDialog::fillProjectsList()
|
bool NewFileDialog::fillProjectsList()
|
||||||
{
|
{
|
||||||
CutterCore *core = CutterCore::getInstance();
|
CutterCore *core = Core();
|
||||||
|
|
||||||
auto currentDir = Config()->getDirProjects();
|
auto currentDir = Config()->getDirProjects();
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ OptionsDialog::OptionsDialog(MainWindow *main):
|
|||||||
QDialog(0), // parent may not be main
|
QDialog(0), // parent may not be main
|
||||||
analThread(this),
|
analThread(this),
|
||||||
main(main),
|
main(main),
|
||||||
core(CutterCore::getInstance()),
|
core(Core()),
|
||||||
defaultAnalLevel(1),
|
defaultAnalLevel(1),
|
||||||
ui(new Ui::OptionsDialog)
|
ui(new Ui::OptionsDialog)
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ SaveProjectDialog::SaveProjectDialog(bool quit, QWidget *parent) :
|
|||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
CutterCore *core = CutterCore::getInstance();
|
CutterCore *core = Core();
|
||||||
|
|
||||||
if (quit) {
|
if (quit) {
|
||||||
ui->buttonBox->setStandardButtons(QDialogButtonBox::Save
|
ui->buttonBox->setStandardButtons(QDialogButtonBox::Save
|
||||||
|
@ -13,7 +13,7 @@ XrefsDialog::XrefsDialog(QWidget *parent) :
|
|||||||
addr(0),
|
addr(0),
|
||||||
func_name(QString::null),
|
func_name(QString::null),
|
||||||
ui(new Ui::XrefsDialog),
|
ui(new Ui::XrefsDialog),
|
||||||
core(CutterCore::getInstance())
|
core(Core())
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
|
@ -8,7 +8,7 @@ Highlighter::Highlighter(QTextDocument *parent) :
|
|||||||
{
|
{
|
||||||
HighlightingRule rule;
|
HighlightingRule rule;
|
||||||
|
|
||||||
core = CutterCore::getInstance();
|
core = Core();
|
||||||
|
|
||||||
keywordFormat.setForeground(QColor(65, 131, 215));
|
keywordFormat.setForeground(QColor(65, 131, 215));
|
||||||
keywordFormat.setFontWeight(QFont::Bold);
|
keywordFormat.setFontWeight(QFont::Bold);
|
||||||
|
@ -256,8 +256,8 @@ void ClassesWidget::refreshClasses()
|
|||||||
{
|
{
|
||||||
model->beginReload();
|
model->beginReload();
|
||||||
classes = getSource() == Source::BIN
|
classes = getSource() == Source::BIN
|
||||||
? CutterCore::getInstance()->getAllClassesFromBin()
|
? Core()->getAllClassesFromBin()
|
||||||
: CutterCore::getInstance()->getAllClassesFromFlags();
|
: Core()->getAllClassesFromFlags();
|
||||||
model->endReload();
|
model->endReload();
|
||||||
|
|
||||||
qhelpers::adjustColumns(ui->classesTreeView, 3, 0);
|
qhelpers::adjustColumns(ui->classesTreeView, 3, 0);
|
||||||
@ -268,5 +268,5 @@ void ClassesWidget::refreshClasses()
|
|||||||
void ClassesWidget::on_classesTreeView_doubleClicked(const QModelIndex &index)
|
void ClassesWidget::on_classesTreeView_doubleClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
RVA offset = index.data(ClassesModel::OffsetRole).value<RVA>();
|
RVA offset = index.data(ClassesModel::OffsetRole).value<RVA>();
|
||||||
CutterCore::getInstance()->seek(offset);
|
Core()->seek(offset);
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ void CommentsWidget::on_commentsTreeWidget_itemDoubleClicked(QTreeWidgetItem *it
|
|||||||
{
|
{
|
||||||
// Get offset and name of item double clicked
|
// Get offset and name of item double clicked
|
||||||
CommentDescription comment = item->data(0, Qt::UserRole).value<CommentDescription>();
|
CommentDescription comment = item->data(0, Qt::UserRole).value<CommentDescription>();
|
||||||
CutterCore::getInstance()->seek(comment.offset);
|
Core()->seek(comment.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommentsWidget::on_nestedCmtsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int)
|
void CommentsWidget::on_nestedCmtsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item, int)
|
||||||
@ -51,7 +51,7 @@ void CommentsWidget::on_nestedCmtsTreeWidget_itemDoubleClicked(QTreeWidgetItem *
|
|||||||
|
|
||||||
// Get offset and name of item double clicked
|
// Get offset and name of item double clicked
|
||||||
CommentDescription comment = item->data(0, Qt::UserRole).value<CommentDescription>();
|
CommentDescription comment = item->data(0, Qt::UserRole).value<CommentDescription>();
|
||||||
CutterCore::getInstance()->seek(comment.offset);
|
Core()->seek(comment.offset);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,11 +139,11 @@ QMap<QString, QList<QList<QString>>> CutterCore::getNestedComments()
|
|||||||
void CommentsWidget::refreshTree()
|
void CommentsWidget::refreshTree()
|
||||||
{
|
{
|
||||||
ui->nestedCmtsTreeWidget->clear();
|
ui->nestedCmtsTreeWidget->clear();
|
||||||
QList<CommentDescription> comments = CutterCore::getInstance()->getAllComments("CCu");
|
QList<CommentDescription> comments = Core()->getAllComments("CCu");
|
||||||
QMap<QString, QList<CommentDescription>> nestedComments;
|
QMap<QString, QList<CommentDescription>> nestedComments;
|
||||||
|
|
||||||
for (CommentDescription comment : comments) {
|
for (CommentDescription comment : comments) {
|
||||||
QString fcn_name = CutterCore::getInstance()->cmdFunctionAt(comment.offset);
|
QString fcn_name = Core()->cmdFunctionAt(comment.offset);
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
item->setText(0, RAddressString(comment.offset));
|
item->setText(0, RAddressString(comment.offset));
|
||||||
item->setText(1, fcn_name);
|
item->setText(1, fcn_name);
|
||||||
|
@ -173,7 +173,7 @@ void ConsoleWidget::on_inputLineEdit_returnPressed()
|
|||||||
QString input = ui->inputLineEdit->text();
|
QString input = ui->inputLineEdit->text();
|
||||||
if (!input.isEmpty()) {
|
if (!input.isEmpty()) {
|
||||||
if (!isForbidden(input)) {
|
if (!isForbidden(input)) {
|
||||||
QString res = CutterCore::getInstance()->cmd(input);
|
QString res = Core()->cmd(input);
|
||||||
QString cmd_line = "[" + RAddressString(Core()->getOffset()) + "]> " + input + "\n";
|
QString cmd_line = "[" + RAddressString(Core()->getOffset()) + "]> " + input + "\n";
|
||||||
ui->outputTextEdit->appendPlainText(cmd_line + res);
|
ui->outputTextEdit->appendPlainText(cmd_line + res);
|
||||||
scrollOutputToEnd();
|
scrollOutputToEnd();
|
||||||
|
@ -103,12 +103,12 @@ void Dashboard::updateContents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add file hashes and libraries
|
// Add file hashes and libraries
|
||||||
QString md5 = CutterCore::getInstance()->cmd("e file.md5");
|
QString md5 = Core()->cmd("e file.md5");
|
||||||
QString sha1 = CutterCore::getInstance()->cmd("e file.sha1");
|
QString sha1 = Core()->cmd("e file.sha1");
|
||||||
ui->md5Edit->setText(md5);
|
ui->md5Edit->setText(md5);
|
||||||
ui->sha1Edit->setText(sha1);
|
ui->sha1Edit->setText(sha1);
|
||||||
|
|
||||||
QString libs = CutterCore::getInstance()->cmd("il");
|
QString libs = Core()->cmd("il");
|
||||||
QStringList lines = libs.split("\n", QString::SkipEmptyParts);
|
QStringList lines = libs.split("\n", QString::SkipEmptyParts);
|
||||||
if (!lines.isEmpty()) {
|
if (!lines.isEmpty()) {
|
||||||
lines.removeFirst();
|
lines.removeFirst();
|
||||||
@ -142,11 +142,11 @@ void Dashboard::updateContents()
|
|||||||
ui->verticalLayout_2->addSpacerItem(spacer);
|
ui->verticalLayout_2->addSpacerItem(spacer);
|
||||||
|
|
||||||
// Add entropy value
|
// Add entropy value
|
||||||
QString entropy = CutterCore::getInstance()->cmd("ph entropy").trimmed();
|
QString entropy = Core()->cmd("ph entropy").trimmed();
|
||||||
ui->lblEntropy->setText(entropy);
|
ui->lblEntropy->setText(entropy);
|
||||||
|
|
||||||
// Get stats for the graphs
|
// Get stats for the graphs
|
||||||
QStringList stats = CutterCore::getInstance()->getStats();
|
QStringList stats = Core()->getStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dashboard::on_certificateButton_clicked()
|
void Dashboard::on_certificateButton_clicked()
|
||||||
|
@ -505,7 +505,7 @@ bool DisassemblyWidget::eventFilter(QObject *obj, QEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jump != RVA_INVALID) {
|
if (jump != RVA_INVALID) {
|
||||||
CutterCore::getInstance()->seek(jump);
|
Core()->seek(jump);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -28,7 +28,7 @@ EntrypointWidget::~EntrypointWidget() {}
|
|||||||
void EntrypointWidget::fillEntrypoint()
|
void EntrypointWidget::fillEntrypoint()
|
||||||
{
|
{
|
||||||
ui->entrypointTreeWidget->clear();
|
ui->entrypointTreeWidget->clear();
|
||||||
for (auto i : CutterCore::getInstance()->getAllEntrypoint()) {
|
for (auto i : Core()->getAllEntrypoint()) {
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
item->setText(0, RAddressString(i.vaddr));
|
item->setText(0, RAddressString(i.vaddr));
|
||||||
item->setText(1, i.type);
|
item->setText(1, i.type);
|
||||||
@ -48,5 +48,5 @@ void EntrypointWidget::on_entrypointTreeWidget_itemDoubleClicked(QTreeWidgetItem
|
|||||||
int /* column */)
|
int /* column */)
|
||||||
{
|
{
|
||||||
EntrypointDescription ep = item->data(0, Qt::UserRole).value<EntrypointDescription>();
|
EntrypointDescription ep = item->data(0, Qt::UserRole).value<EntrypointDescription>();
|
||||||
CutterCore::getInstance()->seek(ep.vaddr);
|
Core()->seek(ep.vaddr);
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ ExportsWidget::~ExportsWidget() {}
|
|||||||
void ExportsWidget::refreshExports()
|
void ExportsWidget::refreshExports()
|
||||||
{
|
{
|
||||||
exports_model->beginReloadExports();
|
exports_model->beginReloadExports();
|
||||||
exports = CutterCore::getInstance()->getAllExports();
|
exports = Core()->getAllExports();
|
||||||
exports_model->endReloadExports();
|
exports_model->endReloadExports();
|
||||||
|
|
||||||
qhelpers::adjustColumns(ui->exportsTreeView, 3, 0);
|
qhelpers::adjustColumns(ui->exportsTreeView, 3, 0);
|
||||||
@ -163,5 +163,5 @@ void ExportsWidget::setScrollMode()
|
|||||||
void ExportsWidget::on_exportsTreeView_doubleClicked(const QModelIndex &index)
|
void ExportsWidget::on_exportsTreeView_doubleClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
ExportDescription exp = index.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
|
ExportDescription exp = index.data(ExportsModel::ExportDescriptionRole).value<ExportDescription>();
|
||||||
CutterCore::getInstance()->seek(exp.vaddr);
|
Core()->seek(exp.vaddr);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ FlagsWidget::~FlagsWidget() {}
|
|||||||
void FlagsWidget::on_flagsTreeView_doubleClicked(const QModelIndex &index)
|
void FlagsWidget::on_flagsTreeView_doubleClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
FlagDescription flag = index.data(FlagsModel::FlagDescriptionRole).value<FlagDescription>();
|
FlagDescription flag = index.data(FlagsModel::FlagDescriptionRole).value<FlagDescription>();
|
||||||
CutterCore::getInstance()->seek(flag.offset);
|
Core()->seek(flag.offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlagsWidget::on_flagspaceCombo_currentTextChanged(const QString &arg1)
|
void FlagsWidget::on_flagspaceCombo_currentTextChanged(const QString &arg1)
|
||||||
@ -169,7 +169,7 @@ void FlagsWidget::on_actionRename_triggered()
|
|||||||
r->setName(flag.name);
|
r->setName(flag.name);
|
||||||
if (r->exec()) {
|
if (r->exec()) {
|
||||||
QString new_name = r->getName();
|
QString new_name = r->getName();
|
||||||
CutterCore::getInstance()->renameFlag(flag.name, new_name);
|
Core()->renameFlag(flag.name, new_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +204,7 @@ void FlagsWidget::refreshFlagspaces()
|
|||||||
ui->flagspaceCombo->clear();
|
ui->flagspaceCombo->clear();
|
||||||
ui->flagspaceCombo->addItem(tr("(all)"));
|
ui->flagspaceCombo->addItem(tr("(all)"));
|
||||||
|
|
||||||
for (auto i : CutterCore::getInstance()->getAllFlagspaces()) {
|
for (auto i : Core()->getAllFlagspaces()) {
|
||||||
ui->flagspaceCombo->addItem(i.name, QVariant::fromValue(i));
|
ui->flagspaceCombo->addItem(i.name, QVariant::fromValue(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ void FlagsWidget::refreshFlags()
|
|||||||
|
|
||||||
|
|
||||||
flags_model->beginReloadFlags();
|
flags_model->beginReloadFlags();
|
||||||
flags = CutterCore::getInstance()->getAllFlags(flagspace);
|
flags = Core()->getAllFlags(flagspace);
|
||||||
flags_model->endReloadFlags();
|
flags_model->endReloadFlags();
|
||||||
|
|
||||||
qhelpers::adjustColumns(ui->flagsTreeView, 2, 0);
|
qhelpers::adjustColumns(ui->flagsTreeView, 2, 0);
|
||||||
|
@ -169,7 +169,7 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
|
|||||||
return static_cast<int>(Qt::AlignLeft | Qt::AlignVCenter);
|
return static_cast<int>(Qt::AlignLeft | Qt::AlignVCenter);
|
||||||
|
|
||||||
case Qt::ToolTipRole: {
|
case Qt::ToolTipRole: {
|
||||||
QList<QString> info = CutterCore::getInstance()->cmd("afi @ " + function.name).split("\n");
|
QList<QString> info = Core()->cmd("afi @ " + function.name).split("\n");
|
||||||
if (info.length() > 2) {
|
if (info.length() > 2) {
|
||||||
QString size = info[4].split(" ")[1];
|
QString size = info[4].split(" ")[1];
|
||||||
QString complex = info[8].split(" ")[1];
|
QString complex = info[8].split(" ")[1];
|
||||||
@ -177,8 +177,8 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
|
|||||||
return QString("Summary:\n\n Size: " + size +
|
return QString("Summary:\n\n Size: " + size +
|
||||||
"\n Cyclomatic complexity: " + complex +
|
"\n Cyclomatic complexity: " + complex +
|
||||||
"\n Basic blocks: " + bb +
|
"\n Basic blocks: " + bb +
|
||||||
"\n\nDisasm preview:\n\n" + CutterCore::getInstance()->cmd("pdi 10 @ " + function.name) +
|
"\n\nDisasm preview:\n\n" + Core()->cmd("pdi 10 @ " + function.name) +
|
||||||
"\nStrings:\n\n" + CutterCore::getInstance()->cmd("pdsf @ " + function.name));
|
"\nStrings:\n\n" + Core()->cmd("pdsf @ " + function.name));
|
||||||
}
|
}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -435,13 +435,13 @@ void FunctionsWidget::refreshTree()
|
|||||||
{
|
{
|
||||||
functionModel->beginReloadFunctions();
|
functionModel->beginReloadFunctions();
|
||||||
|
|
||||||
functions = CutterCore::getInstance()->getAllFunctions();
|
functions = Core()->getAllFunctions();
|
||||||
|
|
||||||
importAddresses.clear();
|
importAddresses.clear();
|
||||||
foreach (ImportDescription import, CutterCore::getInstance()->getAllImports())
|
foreach (ImportDescription import, Core()->getAllImports())
|
||||||
importAddresses.insert(import.plt);
|
importAddresses.insert(import.plt);
|
||||||
|
|
||||||
mainAdress = (ut64)CutterCore::getInstance()->cmdj("iMj").object()["vaddr"].toInt();
|
mainAdress = (ut64)Core()->cmdj("iMj").object()["vaddr"].toInt();
|
||||||
|
|
||||||
functionModel->endReloadFunctions();
|
functionModel->endReloadFunctions();
|
||||||
|
|
||||||
@ -485,9 +485,9 @@ void FunctionsWidget::on_actionDisasAdd_comment_triggered()
|
|||||||
// Get new function name
|
// Get new function name
|
||||||
QString comment = c->getComment();
|
QString comment = c->getComment();
|
||||||
// Rename function in r2 core
|
// Rename function in r2 core
|
||||||
CutterCore::getInstance()->setComment(function.offset, comment);
|
Core()->setComment(function.offset, comment);
|
||||||
// Seek to new renamed function
|
// Seek to new renamed function
|
||||||
CutterCore::getInstance()->seek(function.offset);
|
Core()->seek(function.offset);
|
||||||
// TODO: Refresh functions tree widget
|
// TODO: Refresh functions tree widget
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -509,10 +509,10 @@ void FunctionsWidget::on_actionFunctionsRename_triggered()
|
|||||||
QString new_name = r->getName();
|
QString new_name = r->getName();
|
||||||
|
|
||||||
// Rename function in r2 core
|
// Rename function in r2 core
|
||||||
CutterCore::getInstance()->renameFunction(function.name, new_name);
|
Core()->renameFunction(function.name, new_name);
|
||||||
|
|
||||||
// Seek to new renamed function
|
// Seek to new renamed function
|
||||||
CutterCore::getInstance()->seek(function.offset);
|
Core()->seek(function.offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,5 +114,5 @@ void ResourcesWidget::refreshResources()
|
|||||||
void ResourcesWidget::onDoubleClicked(const QModelIndex &index)
|
void ResourcesWidget::onDoubleClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
ResourcesDescription res = index.data(Qt::UserRole).value<ResourcesDescription>();
|
ResourcesDescription res = index.data(Qt::UserRole).value<ResourcesDescription>();
|
||||||
CutterCore::getInstance()->seek(res.vaddr);
|
Core()->seek(res.vaddr);
|
||||||
}
|
}
|
||||||
|
@ -32,18 +32,18 @@ void SdbDock::reload(QString _path)
|
|||||||
ui->treeWidget->clear();
|
ui->treeWidget->clear();
|
||||||
QList<QString> keys;
|
QList<QString> keys;
|
||||||
/* key-values */
|
/* key-values */
|
||||||
keys = CutterCore::getInstance()->sdbListKeys(path);
|
keys = Core()->sdbListKeys(path);
|
||||||
foreach (QString key, keys) {
|
foreach (QString key, keys) {
|
||||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||||
tempItem->setText(0, key);
|
tempItem->setText(0, key);
|
||||||
tempItem->setText(1, CutterCore::getInstance()->sdbGet(path, key));
|
tempItem->setText(1, Core()->sdbGet(path, key));
|
||||||
tempItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled |
|
tempItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled |
|
||||||
Qt::ItemIsDragEnabled | Qt::ItemIsEditable);
|
Qt::ItemIsDragEnabled | Qt::ItemIsEditable);
|
||||||
ui->treeWidget->insertTopLevelItem(0, tempItem);
|
ui->treeWidget->insertTopLevelItem(0, tempItem);
|
||||||
}
|
}
|
||||||
qhelpers::adjustColumns(ui->treeWidget, 0);
|
qhelpers::adjustColumns(ui->treeWidget, 0);
|
||||||
/* namespaces */
|
/* namespaces */
|
||||||
keys = CutterCore::getInstance()->sdbList(path);
|
keys = Core()->sdbList(path);
|
||||||
keys.append("..");
|
keys.append("..");
|
||||||
foreach (QString key, keys) {
|
foreach (QString key, keys) {
|
||||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||||
|
@ -29,7 +29,7 @@ void SectionsWidget::refreshSections()
|
|||||||
tree->clear();
|
tree->clear();
|
||||||
|
|
||||||
int row = 0;
|
int row = 0;
|
||||||
for (auto section : CutterCore::getInstance()->getAllSections()) {
|
for (auto section : Core()->getAllSections()) {
|
||||||
fillSections(row++, section);
|
fillSections(row++, section);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,17 +42,17 @@ void SideBar::on_lockButton_clicked()
|
|||||||
|
|
||||||
void SideBar::on_calcInput_textChanged(const QString &arg1)
|
void SideBar::on_calcInput_textChanged(const QString &arg1)
|
||||||
{
|
{
|
||||||
ui->calcOutput->setText(QString::number(CutterCore::getInstance()->math(arg1)));
|
ui->calcOutput->setText(QString::number(Core()->math(arg1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideBar::on_asm2hex_clicked()
|
void SideBar::on_asm2hex_clicked()
|
||||||
{
|
{
|
||||||
ui->hexInput->setPlainText(CutterCore::getInstance()->assemble(ui->asmInput->toPlainText()));
|
ui->hexInput->setPlainText(Core()->assemble(ui->asmInput->toPlainText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideBar::on_hex2asm_clicked()
|
void SideBar::on_hex2asm_clicked()
|
||||||
{
|
{
|
||||||
ui->asmInput->setPlainText(CutterCore::getInstance()->disassemble(ui->hexInput->toPlainText()));
|
ui->asmInput->setPlainText(Core()->disassemble(ui->hexInput->toPlainText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideBar::on_respButton_toggled(bool checked)
|
void SideBar::on_respButton_toggled(bool checked)
|
||||||
|
@ -165,13 +165,13 @@ StringsWidget::~StringsWidget() {}
|
|||||||
void StringsWidget::on_stringsTreeView_doubleClicked(const QModelIndex &index)
|
void StringsWidget::on_stringsTreeView_doubleClicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
StringDescription str = index.data(StringsModel::StringDescriptionRole).value<StringDescription>();
|
StringDescription str = index.data(StringsModel::StringDescriptionRole).value<StringDescription>();
|
||||||
CutterCore::getInstance()->seek(str.vaddr);
|
Core()->seek(str.vaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StringsWidget::refreshStrings()
|
void StringsWidget::refreshStrings()
|
||||||
{
|
{
|
||||||
model->beginReload();
|
model->beginReload();
|
||||||
strings = CutterCore::getInstance()->getAllStrings();
|
strings = Core()->getAllStrings();
|
||||||
model->endReload();
|
model->endReload();
|
||||||
|
|
||||||
qhelpers::adjustColumns(ui->stringsTreeView, 5, 0);
|
qhelpers::adjustColumns(ui->stringsTreeView, 5, 0);
|
||||||
|
@ -29,13 +29,13 @@ void SymbolsWidget::on_symbolsTreeWidget_itemDoubleClicked(QTreeWidgetItem *item
|
|||||||
|
|
||||||
// Get offset and name of item double clicked
|
// Get offset and name of item double clicked
|
||||||
SymbolDescription symbol = item->data(0, Qt::UserRole).value<SymbolDescription>();
|
SymbolDescription symbol = item->data(0, Qt::UserRole).value<SymbolDescription>();
|
||||||
CutterCore::getInstance()->seek(symbol.vaddr);
|
Core()->seek(symbol.vaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SymbolsWidget::fillSymbols()
|
void SymbolsWidget::fillSymbols()
|
||||||
{
|
{
|
||||||
ui->symbolsTreeWidget->clear();
|
ui->symbolsTreeWidget->clear();
|
||||||
for (auto symbol : CutterCore::getInstance()->getAllSymbols()) {
|
for (auto symbol : Core()->getAllSymbols()) {
|
||||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||||
item->setText(0, RAddressString(symbol.vaddr));
|
item->setText(0, RAddressString(symbol.vaddr));
|
||||||
item->setText(1, QString("%1 %2").arg(symbol.bind, symbol.type).trimmed());
|
item->setText(1, QString("%1 %2").arg(symbol.bind, symbol.type).trimmed());
|
||||||
|
@ -129,7 +129,7 @@ TypesWidget::~TypesWidget() {}
|
|||||||
void TypesWidget::refreshTypes()
|
void TypesWidget::refreshTypes()
|
||||||
{
|
{
|
||||||
types_model->beginReloadTypes();
|
types_model->beginReloadTypes();
|
||||||
types = CutterCore::getInstance()->getAllTypes();
|
types = Core()->getAllTypes();
|
||||||
types_model->endReloadTypes();
|
types_model->endReloadTypes();
|
||||||
|
|
||||||
qhelpers::adjustColumns(ui->typesTreeView, 3, 0);
|
qhelpers::adjustColumns(ui->typesTreeView, 3, 0);
|
||||||
@ -144,5 +144,5 @@ void TypesWidget::on_typesTreeView_doubleClicked(const QModelIndex &index)
|
|||||||
{
|
{
|
||||||
Q_UNUSED(index);
|
Q_UNUSED(index);
|
||||||
// TypeDescription exp = index.data(TypesModel::TypeDescriptionRole).value<TypeDescription>();
|
// TypeDescription exp = index.data(TypesModel::TypeDescriptionRole).value<TypeDescription>();
|
||||||
// CutterCore::getInstance()->seek(exp.vaddr);
|
// Core()->seek(exp.vaddr);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ VTablesWidget::~VTablesWidget()
|
|||||||
void VTablesWidget::refreshVTables()
|
void VTablesWidget::refreshVTables()
|
||||||
{
|
{
|
||||||
model->beginReload();
|
model->beginReload();
|
||||||
vtables = CutterCore::getInstance()->getAllVTables();
|
vtables = Core()->getAllVTables();
|
||||||
model->endReload();
|
model->endReload();
|
||||||
|
|
||||||
qhelpers::adjustColumns(ui->vTableTreeView, 3, 0);
|
qhelpers::adjustColumns(ui->vTableTreeView, 3, 0);
|
||||||
@ -184,9 +184,9 @@ void VTablesWidget::on_vTableTreeView_doubleClicked(const QModelIndex &index)
|
|||||||
{
|
{
|
||||||
QModelIndex parent = index.parent();
|
QModelIndex parent = index.parent();
|
||||||
if (parent.isValid())
|
if (parent.isValid())
|
||||||
CutterCore::getInstance()->seek(index.data(
|
Core()->seek(index.data(
|
||||||
VTableModel::VTableDescriptionRole).value<ClassMethodDescription>().addr);
|
VTableModel::VTableDescriptionRole).value<ClassMethodDescription>().addr);
|
||||||
else
|
else
|
||||||
CutterCore::getInstance()->seek(index.data(
|
Core()->seek(index.data(
|
||||||
VTableModel::VTableDescriptionRole).value<VTableDescription>().addr);
|
VTableModel::VTableDescriptionRole).value<VTableDescription>().addr);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user