mirror of https://github.com/mgba-emu/mgba.git
Qt: Hook up memory search to viewer
This commit is contained in:
parent
bd9a9e445e
commit
77cf869941
|
@ -9,6 +9,7 @@
|
|||
#include <mgba/core/core.h>
|
||||
|
||||
#include "GameController.h"
|
||||
#include "MemoryView.h"
|
||||
|
||||
using namespace QGBA;
|
||||
|
||||
|
@ -24,6 +25,7 @@ MemorySearch::MemorySearch(GameController* controller, QWidget* parent)
|
|||
connect(m_ui.refresh, &QPushButton::clicked, this, &MemorySearch::refresh);
|
||||
connect(m_ui.numHex, &QPushButton::clicked, this, &MemorySearch::refresh);
|
||||
connect(m_ui.numDec, &QPushButton::clicked, this, &MemorySearch::refresh);
|
||||
connect(m_ui.viewMem, &QPushButton::clicked, this, &MemorySearch::openMemory);
|
||||
}
|
||||
|
||||
MemorySearch::~MemorySearch() {
|
||||
|
@ -185,3 +187,19 @@ void MemorySearch::refresh() {
|
|||
}
|
||||
m_ui.results->sortItems(0);
|
||||
}
|
||||
|
||||
void MemorySearch::openMemory() {
|
||||
auto items = m_ui.results->selectedItems();
|
||||
if (items.empty()) {
|
||||
return;
|
||||
}
|
||||
QTableWidgetItem* item = items[0];
|
||||
uint32_t address = item->text().toUInt(nullptr, 16);
|
||||
|
||||
MemoryView* memView = new MemoryView(m_controller);
|
||||
memView->jumpToAddress(address);
|
||||
|
||||
connect(m_controller, &GameController::gameStopped, memView, &QWidget::close);
|
||||
memView->setAttribute(Qt::WA_DeleteOnClose);
|
||||
memView->show();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@ public slots:
|
|||
void search();
|
||||
void searchWithin();
|
||||
|
||||
private slots:
|
||||
void openMemory();
|
||||
|
||||
private:
|
||||
bool createParams(mCoreMemorySearchParams*);
|
||||
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
|
@ -194,11 +197,8 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="viewMem">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>View in Memory View</string>
|
||||
<string>Open in Memory Viewer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -22,6 +22,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void update();
|
||||
void jumpToAddress(uint32_t address) { m_ui.hexfield->jumpToAddress(address); }
|
||||
|
||||
private slots:
|
||||
void setIndex(int);
|
||||
|
|
Loading…
Reference in New Issue