GUI: Abstracting various things in CPUWidget
This commit is contained in:
parent
0ad44b2a0c
commit
e009bea0c8
|
@ -1155,6 +1155,12 @@ bool Disassembly::isSelected(QList<Instruction_t>* buffer, int index)
|
|||
}
|
||||
}
|
||||
|
||||
duint Disassembly::getSelectedVa()
|
||||
{
|
||||
// Wrapper around commonly used code:
|
||||
// Converts the selected index to a valid virtual address
|
||||
return rvaToVa(getInitialSelection());
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
Update/Reload/Refresh/Repaint
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
void selectPrevious(bool expand);
|
||||
bool isSelected(dsint base, dsint offset);
|
||||
bool isSelected(QList<Instruction_t>* buffer, int index);
|
||||
duint getSelectedVa();
|
||||
|
||||
// Update/Reload/Refresh/Repaint
|
||||
void prepareData();
|
||||
|
|
|
@ -15,12 +15,12 @@ class CPUDisassembly : public Disassembly
|
|||
public:
|
||||
explicit CPUDisassembly(CPUWidget* parent);
|
||||
|
||||
// Mouse Management
|
||||
// Mouse management
|
||||
void contextMenuEvent(QContextMenuEvent* event);
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
|
||||
// Context Menu Management
|
||||
// Context menu management
|
||||
void setupRightClickContextMenu();
|
||||
void addFollowReferenceMenuItem(QString name, dsint value, QMenu* menu, bool isReferences);
|
||||
void setupFollowReferenceMenu(dsint wVA, QMenu* menu, bool isReferences);
|
||||
|
|
|
@ -97,6 +97,11 @@ void CPUWidget::setDefaultDisposition(void)
|
|||
ui->mBotHSplitter->setSizes(sizesList);
|
||||
}
|
||||
|
||||
void CPUWidget::setDisasmFocus()
|
||||
{
|
||||
mDisas->setFocus();
|
||||
}
|
||||
|
||||
QVBoxLayout* CPUWidget::getTopLeftUpperWidget()
|
||||
{
|
||||
return ui->mTopLeftUpperFrameLayout;
|
||||
|
@ -126,3 +131,18 @@ CPUSideBar* CPUWidget::getSidebarWidget()
|
|||
{
|
||||
return mSideBar;
|
||||
}
|
||||
|
||||
CPUDisassembly* CPUWidget::getDisasmWidget()
|
||||
{
|
||||
return mDisas;
|
||||
}
|
||||
|
||||
CPUDump* CPUWidget::getDumpWidget()
|
||||
{
|
||||
return mDump;
|
||||
}
|
||||
|
||||
CPUStack* CPUWidget::getStackWidget()
|
||||
{
|
||||
return mStack;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,10 @@ class CPUWidget : public QWidget
|
|||
public:
|
||||
explicit CPUWidget(QWidget* parent = 0);
|
||||
~CPUWidget();
|
||||
void setDefaultDisposition(void);
|
||||
|
||||
// Misc
|
||||
void setDefaultDisposition();
|
||||
void setDisasmFocus();
|
||||
|
||||
// Layout getters
|
||||
QVBoxLayout* getTopLeftUpperWidget();
|
||||
|
@ -33,8 +36,11 @@ public:
|
|||
|
||||
// Widget getters
|
||||
CPUSideBar* getSidebarWidget();
|
||||
CPUDisassembly* getDisasmWidget();
|
||||
CPUDump* getDumpWidget();
|
||||
CPUStack* getStackWidget();
|
||||
|
||||
public:
|
||||
protected:
|
||||
CPUSideBar* mSideBar;
|
||||
CPUDisassembly* mDisas;
|
||||
CPUDump* mDump;
|
||||
|
|
|
@ -233,13 +233,13 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
connect(ui->actionChangeCommandLine, SIGNAL(triggered()), this, SLOT(changeCommandLine()));
|
||||
connect(ui->actionManual, SIGNAL(triggered()), this, SLOT(displayManual()));
|
||||
|
||||
connect(mCpuWidget->mDisas, SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidget()));
|
||||
connect(mCpuWidget->mDisas, SIGNAL(displaySourceManagerWidget()), this, SLOT(displaySourceViewWidget()));
|
||||
connect(mCpuWidget->mDisas, SIGNAL(displaySnowmanWidget()), this, SLOT(displaySnowmanWidget()));
|
||||
connect(mCpuWidget->mDisas, SIGNAL(showPatches()), this, SLOT(patchWindow()));
|
||||
connect(mCpuWidget->mDisas, SIGNAL(decompileAt(dsint, dsint)), this, SLOT(decompileAt(dsint, dsint)));
|
||||
connect(mCpuWidget->mDump, SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidget()));
|
||||
connect(mCpuWidget->mStack, SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidget()));
|
||||
connect(mCpuWidget->getDisasmWidget(), SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidget()));
|
||||
connect(mCpuWidget->getDisasmWidget(), SIGNAL(displaySourceManagerWidget()), this, SLOT(displaySourceViewWidget()));
|
||||
connect(mCpuWidget->getDisasmWidget(), SIGNAL(displaySnowmanWidget()), this, SLOT(displaySnowmanWidget()));
|
||||
connect(mCpuWidget->getDisasmWidget(), SIGNAL(showPatches()), this, SLOT(patchWindow()));
|
||||
connect(mCpuWidget->getDisasmWidget(), SIGNAL(decompileAt(dsint, dsint)), this, SLOT(decompileAt(dsint, dsint)));
|
||||
connect(mCpuWidget->getDumpWidget(), SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidget()));
|
||||
connect(mCpuWidget->getStackWidget(), SIGNAL(displayReferencesWidget()), this, SLOT(displayReferencesWidget()));
|
||||
connect(Config(), SIGNAL(shortcutsUpdated()), this, SLOT(refreshShortcuts()));
|
||||
|
||||
// Set default setttings (when not set)
|
||||
|
@ -258,7 +258,7 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
|
|||
connect(mCloseThread, SIGNAL(canClose()), this, SLOT(canClose()));
|
||||
mCloseDialog = new CloseDialog(this);
|
||||
|
||||
mCpuWidget->mDisas->setFocus();
|
||||
mCpuWidget->setDisasmFocus();
|
||||
|
||||
GuiAddLogMessage(QString().sprintf("Thread id (GUI thread) %X\n", GetCurrentThreadId()).toUtf8().constData());
|
||||
}
|
||||
|
@ -597,7 +597,7 @@ void MainWindow::openFile()
|
|||
saveMRUList();
|
||||
}
|
||||
|
||||
mCpuWidget->mDisas->setFocus();
|
||||
mCpuWidget->setDisasmFocus();
|
||||
}
|
||||
|
||||
void MainWindow::execPause()
|
||||
|
@ -623,7 +623,7 @@ void MainWindow::restartDebugging()
|
|||
}
|
||||
DbgCmdExec(QString().sprintf("init \"%s\"", filename).toUtf8().constData());
|
||||
|
||||
mCpuWidget->mDisas->setFocus();
|
||||
mCpuWidget->setDisasmFocus();
|
||||
}
|
||||
|
||||
void MainWindow::displayBreakpointWidget()
|
||||
|
@ -762,13 +762,13 @@ void MainWindow::setLastException(unsigned int exceptionCode)
|
|||
|
||||
void MainWindow::findStrings()
|
||||
{
|
||||
DbgCmdExec(QString("strref " + QString("%1").arg(mCpuWidget->mDisas->rvaToVa(mCpuWidget->mDisas->getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper()).toUtf8().constData());
|
||||
DbgCmdExec(QString("strref " + QString("%1").arg(mCpuWidget->getDisasmWidget()->getSelectedVa(), sizeof(dsint) * 2, 16, QChar('0')).toUpper()).toUtf8().constData());
|
||||
displayReferencesWidget();
|
||||
}
|
||||
|
||||
void MainWindow::findModularCalls()
|
||||
{
|
||||
DbgCmdExec(QString("modcallfind " + QString("%1").arg(mCpuWidget->mDisas->rvaToVa(mCpuWidget->mDisas->getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper()).toUtf8().constData());
|
||||
DbgCmdExec(QString("modcallfind " + QString("%1").arg(mCpuWidget->getDisasmWidget()->getSelectedVa(), sizeof(dsint) * 2, 16, QChar('0')).toUpper()).toUtf8().constData());
|
||||
displayReferencesWidget();
|
||||
}
|
||||
|
||||
|
@ -962,7 +962,8 @@ void MainWindow::runSelection()
|
|||
{
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
QString command = "bp " + QString("%1").arg(mCpuWidget->mDisas->rvaToVa(mCpuWidget->mDisas->getInitialSelection()), sizeof(dsint) * 2, 16, QChar('0')).toUpper() + ", ss";
|
||||
|
||||
QString command = "bp " + QString("%1").arg(mCpuWidget->getDisasmWidget()->getSelectedVa(), sizeof(dsint) * 2, 16, QChar('0')).toUpper() + ", ss";
|
||||
if(DbgCmdExecDirect(command.toUtf8().constData()))
|
||||
DbgCmdExecDirect("run");
|
||||
}
|
||||
|
@ -1066,7 +1067,7 @@ void MainWindow::displayAttach()
|
|||
AttachDialog attach(this);
|
||||
attach.exec();
|
||||
|
||||
mCpuWidget->mDisas->setFocus();
|
||||
mCpuWidget->setDisasmFocus();
|
||||
}
|
||||
|
||||
void MainWindow::detach()
|
||||
|
|
Loading…
Reference in New Issue