Skip to content

Commit

Permalink
Allow Goto Memory View to use Flash/RAM views, delete added views whe…
Browse files Browse the repository at this point in the history
…n closed
  • Loading branch information
calc84maniac committed Aug 12, 2024
1 parent 76da0fe commit 192e49b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
11 changes: 11 additions & 0 deletions gui/qt/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2009,6 +2009,15 @@ void MainWindow::gotoDisasmAddr(uint32_t address) {
void MainWindow::gotoMemAddr(uint32_t address) {
if (m_memWidget != Q_NULLPTR) {
memGoto(m_memWidget, address);
} else {
for (HexWidget *edit : { ui->flashEdit, ui->ramEdit }) {
uint32_t offset = address - edit->getBase();
if (offset < edit->getSize()) {

Check warning on line 2015 in gui/qt/debugger.cpp

View workflow job for this annotation

GitHub Actions / Build: ubuntu-20.04 - Qt6-Dynamic

comparison of integer expressions of different signedness: ‘uint32_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]

Check warning on line 2015 in gui/qt/debugger.cpp

View workflow job for this annotation

GitHub Actions / Build: ubuntu-20.04 - Qt6

comparison of integer expressions of different signedness: ‘uint32_t’ {aka ‘unsigned int’} and ‘int’ [-Wsign-compare]

Check warning on line 2015 in gui/qt/debugger.cpp

View workflow job for this annotation

GitHub Actions / Build: macos-13 Qt6_intel

comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]

Check warning on line 2015 in gui/qt/debugger.cpp

View workflow job for this annotation

GitHub Actions / Build: macos-12 Qt5_intel

comparison of integers of different signs: 'uint32_t' (aka 'unsigned int') and 'int' [-Wsign-compare]
edit->setFocus();
edit->setOffset(offset);
break;
}
}
}
}

Expand Down Expand Up @@ -2710,6 +2719,7 @@ void MainWindow::addVisualizerDock(const QString &magic, const QString &config)
});

dw->setState(m_uiEditMode);
dw->setAttribute(Qt::WA_DeleteOnClose);
addDockWidget(Qt::RightDockWidgetArea, dw);
dw->setObjectName(magic);
dw->setWidget(widget);
Expand All @@ -2730,6 +2740,7 @@ void MainWindow::addMemDock(const QString &magic, int bytes, bool ascii) {
dw = new DockWidget(TXT_MEM_DOCK, this);
dw->setObjectName(magic);
dw->setState(m_uiEditMode);
dw->setAttribute(Qt::WA_DeleteOnClose);

if (m_setup) {
dw->setFloating(true);
Expand Down
2 changes: 2 additions & 0 deletions gui/qt/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ MainWindow::MainWindow(CEmuOpts &cliOpts, QWidget *p) : QMainWindow(p), ui(new U
connect(ui->buttonRamSync, &QToolButton::clicked, this, &MainWindow::ramSyncPressed);
connect(ui->flashEdit, &HexWidget::customContextMenuRequested, this, &MainWindow::contextMem);
connect(ui->ramEdit, &HexWidget::customContextMenuRequested, this, &MainWindow::contextMem);
connect(ui->flashEdit, &HexWidget::focused, [this] { m_memWidget = Q_NULLPTR; });
connect(ui->ramEdit, &HexWidget::focused, [this] { m_memWidget = Q_NULLPTR; });

// keymap
connect(ui->radioNaturalKeys, &QRadioButton::clicked, this, &MainWindow::keymapChanged);
Expand Down
3 changes: 2 additions & 1 deletion gui/qt/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <QShortcut> /* Different module in Qt5 vs Qt6 */
#include <QtCore/QSettings>
#include <QtCore/QTimer>
#include <QtCore/QPointer>
#include <QtGui/QTextCursor>
#include <QtGui/QFont>
#include <QtWidgets/QMessageBox>
Expand Down Expand Up @@ -699,7 +700,7 @@ class MainWindow : public QMainWindow {
QStringList m_docksVisualizerConfig;
QList<DockWidget*> m_dockPtrs;
QSettings *m_config = Q_NULLPTR;
HexWidget *m_memWidget = Q_NULLPTR;
QPointer<HexWidget> m_memWidget = Q_NULLPTR;

QString m_pathRom;
QString m_pathRam;
Expand Down

0 comments on commit 192e49b

Please sign in to comment.