Skip to content

Commit

Permalink
Restructured widget source tree, initial support for splitted views
Browse files Browse the repository at this point in the history
  • Loading branch information
Dax89 committed Nov 16, 2020
1 parent 06ea2c3 commit e957692
Show file tree
Hide file tree
Showing 51 changed files with 812 additions and 541 deletions.
2 changes: 1 addition & 1 deletion dialogs/devdialog/tabs/rdiltab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ void RDILTab::updateInformation()

ui->lblTitle->setText(RD_GetInstruction(m_context.get(), item.address));
m_graph.reset(RDILGraph_Create(m_context.get(), item.address));
ui->graphView->setGraph(m_graph.get());
//ui->graphView->setGraph(m_graph.get());
return;

notitle:
Expand Down
21 changes: 15 additions & 6 deletions dialogs/gotodialog/gotodialog.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#include "gotodialog.h"
#include "ui_gotodialog.h"
#include "../../hooks/disassemblerhooks.h"
#include "../../renderer/surfaceqt.h"

GotoDialog::GotoDialog(ICommand* command, QWidget *parent) : QDialog(parent), ui(new Ui::GotoDialog), m_command(command)
GotoDialog::GotoDialog(const RDContextPtr& ctx, QWidget *parent) : QDialog(parent), ui(new Ui::GotoDialog), m_context(ctx)
{
ui->setupUi(this);

m_document = RDContext_GetDocument(command->context().get());

m_document = RDContext_GetDocument(ctx.get());
m_gotomodel = new GotoFilterModel(ui->tvFunctions);
m_gotomodel->setContext(command->context());
m_gotomodel->setContext(ctx);

ui->tvFunctions->setModel(m_gotomodel);
ui->tvFunctions->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
Expand Down Expand Up @@ -45,12 +46,20 @@ void GotoDialog::validateEntry()

void GotoDialog::onGotoClicked()
{
if(this->hasValidAddress()) m_command->goToAddress(m_address);
if(this->hasValidAddress())
{
auto* surface = DisassemblerHooks::instance()->activeSurface();
if(surface) surface->goToAddress(m_address);
}

this->accept();
}

void GotoDialog::onItemSelected(const QModelIndex &index)
{
QModelIndex srcindex = m_gotomodel->mapToSource(index);
if(srcindex.isValid()) m_command->goTo(m_gotomodel->item(index));
if(!srcindex.isValid()) return;

auto* surface = DisassemblerHooks::instance()->activeSurface();
if(surface) surface->goTo(std::addressof(m_gotomodel->item(index)));
}
5 changes: 2 additions & 3 deletions dialogs/gotodialog/gotodialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <QDialog>
#include <rdapi/rdapi.h>
#include "../../hooks/icommand.h"
#include "../../models/gotomodel/gotofiltermodel.h"

namespace Ui {
Expand All @@ -14,7 +13,7 @@ class GotoDialog : public QDialog
Q_OBJECT

public:
explicit GotoDialog(ICommand* command, QWidget *parent = nullptr);
explicit GotoDialog(const RDContextPtr& ctx, QWidget *parent = nullptr);
~GotoDialog();

private:
Expand All @@ -27,7 +26,7 @@ class GotoDialog : public QDialog

private:
Ui::GotoDialog *ui;
ICommand* m_command;
RDContextPtr m_context;
RDDocument* m_document;
GotoFilterModel* m_gotomodel;
rd_address m_address{0};
Expand Down
13 changes: 8 additions & 5 deletions dialogs/referencesdialog/referencesdialog.cpp
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#include "referencesdialog.h"
#include "ui_referencesdialog.h"
#include "../../hooks/disassemblerhooks.h"
#include "../../renderer/surfaceqt.h"

ReferencesDialog::ReferencesDialog(ICommand* command, const RDSymbol* symbol, QWidget *parent) : QDialog(parent), ui(new Ui::ReferencesDialog), m_command(command)
ReferencesDialog::ReferencesDialog(const RDContextPtr& ctx, const RDSymbol* symbol, QWidget *parent) : QDialog(parent), ui(new Ui::ReferencesDialog), m_context(ctx)
{
ui->setupUi(this);

RDDocument* doc = RDContext_GetDocument(command->context().get());
RDDocument* doc = RDContext_GetDocument(ctx.get());
this->setWindowTitle(QString("%1 References").arg(RDDocument_GetSymbolName(doc, symbol->address)));

m_referencesmodel = new ReferencesModel(command, ui->tvReferences);
m_referencesmodel->setContext(command->context());
m_referencesmodel = new ReferencesModel(ui->tvReferences);
m_referencesmodel->setContext(ctx);
m_referencesmodel->xref(symbol->address);

ui->tvReferences->setModel(m_referencesmodel);
Expand All @@ -22,6 +24,7 @@ void ReferencesDialog::on_tvReferences_doubleClicked(const QModelIndex &index)
if(!index.isValid() || !index.internalId())
return;

m_command->goToAddress(static_cast<rd_address>(index.internalId()));
auto* surface = DisassemblerHooks::instance()->activeSurface();
if(surface) surface->goToAddress(static_cast<rd_address>(index.internalId()));
this->accept();
}
5 changes: 2 additions & 3 deletions dialogs/referencesdialog/referencesdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <QDialog>
#include "../../models/referencesmodel.h"
#include "../../hooks/icommand.h"

namespace Ui {
class ReferencesDialog;
Expand All @@ -13,14 +12,14 @@ class ReferencesDialog : public QDialog
Q_OBJECT

public:
explicit ReferencesDialog(ICommand* command, const RDSymbol *symbol, QWidget *parent = nullptr);
explicit ReferencesDialog(const RDContextPtr& ctx, const RDSymbol *symbol, QWidget *parent = nullptr);
~ReferencesDialog();

private slots:
void on_tvReferences_doubleClicked(const QModelIndex &index);

private:
Ui::ReferencesDialog *ui;
RDContextPtr m_context;
ReferencesModel* m_referencesmodel;
ICommand* m_command;
};
Loading

0 comments on commit e957692

Please sign in to comment.