mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 18:38:51 +00:00
Allow seeking in unsynchronized widgets using 'g'. (#1731)
This commit is contained in:
parent
567f852c3a
commit
a4ba6f8b2b
@ -844,8 +844,8 @@ void MainWindow::updateDockActionsChecked()
|
|||||||
|
|
||||||
MemoryWidgetType MainWindow::getMemoryWidgetTypeToRestore()
|
MemoryWidgetType MainWindow::getMemoryWidgetTypeToRestore()
|
||||||
{
|
{
|
||||||
if (lastMemoryWidget) {
|
if (lastSyncMemoryWidget) {
|
||||||
return lastMemoryWidget->getType();
|
return lastSyncMemoryWidget->getType();
|
||||||
}
|
}
|
||||||
return MemoryWidgetType::Disassembly;
|
return MemoryWidgetType::Disassembly;
|
||||||
}
|
}
|
||||||
@ -876,8 +876,8 @@ QString MainWindow::getUniqueObjectName(const QString &widgetType) const
|
|||||||
|
|
||||||
void MainWindow::showMemoryWidget()
|
void MainWindow::showMemoryWidget()
|
||||||
{
|
{
|
||||||
if (lastMemoryWidget) {
|
if (lastSyncMemoryWidget) {
|
||||||
if (lastMemoryWidget->tryRaiseMemoryWidget()) {
|
if (lastSyncMemoryWidget->tryRaiseMemoryWidget()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -929,8 +929,14 @@ QMenu *MainWindow::createShowInMenu(QWidget *parent, RVA address)
|
|||||||
void MainWindow::setCurrentMemoryWidget(MemoryDockWidget *memoryWidget)
|
void MainWindow::setCurrentMemoryWidget(MemoryDockWidget *memoryWidget)
|
||||||
{
|
{
|
||||||
if (memoryWidget->getSeekable()->isSynchronized()) {
|
if (memoryWidget->getSeekable()->isSynchronized()) {
|
||||||
lastMemoryWidget = memoryWidget;
|
lastSyncMemoryWidget = memoryWidget;
|
||||||
}
|
}
|
||||||
|
lastMemoryWidget = memoryWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
MemoryDockWidget *MainWindow::getLastMemoryWidget()
|
||||||
|
{
|
||||||
|
return lastMemoryWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryDockWidget *MainWindow::addNewMemoryWidget(MemoryWidgetType type, RVA address,
|
MemoryDockWidget *MainWindow::addNewMemoryWidget(MemoryWidgetType type, RVA address,
|
||||||
@ -999,6 +1005,9 @@ void MainWindow::addMemoryDockWidget(MemoryDockWidget *widget)
|
|||||||
void MainWindow::removeWidget(QDockWidget *widget)
|
void MainWindow::removeWidget(QDockWidget *widget)
|
||||||
{
|
{
|
||||||
dockWidgets.removeAll(widget);
|
dockWidgets.removeAll(widget);
|
||||||
|
if (lastSyncMemoryWidget == widget) {
|
||||||
|
lastSyncMemoryWidget = nullptr;
|
||||||
|
}
|
||||||
if (lastMemoryWidget == widget) {
|
if (lastMemoryWidget == widget) {
|
||||||
lastMemoryWidget = nullptr;
|
lastMemoryWidget = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,7 @@ public:
|
|||||||
|
|
||||||
QMenu *createShowInMenu(QWidget *parent, RVA address);
|
QMenu *createShowInMenu(QWidget *parent, RVA address);
|
||||||
void setCurrentMemoryWidget(MemoryDockWidget* memoryWidget);
|
void setCurrentMemoryWidget(MemoryDockWidget* memoryWidget);
|
||||||
|
MemoryDockWidget* getLastMemoryWidget();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void finalizeOpen();
|
void finalizeOpen();
|
||||||
@ -286,6 +287,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
QMap<QString, std::function<CutterDockWidget*(MainWindow*, QAction*)>> widgetTypeToConstructorMap;
|
QMap<QString, std::function<CutterDockWidget*(MainWindow*, QAction*)>> widgetTypeToConstructorMap;
|
||||||
|
|
||||||
|
MemoryDockWidget* lastSyncMemoryWidget = nullptr;
|
||||||
MemoryDockWidget* lastMemoryWidget = nullptr;
|
MemoryDockWidget* lastMemoryWidget = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "Omnibar.h"
|
#include "Omnibar.h"
|
||||||
#include "core/MainWindow.h"
|
#include "core/MainWindow.h"
|
||||||
|
#include "CutterSeekable.h"
|
||||||
|
|
||||||
#include <QStringListModel>
|
#include <QStringListModel>
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
@ -69,7 +70,13 @@ void Omnibar::on_gotoEntry_returnPressed()
|
|||||||
{
|
{
|
||||||
QString str = this->text();
|
QString str = this->text();
|
||||||
if (!str.isEmpty()) {
|
if (!str.isEmpty()) {
|
||||||
Core()->seekAndShow(str);
|
if (auto memoryWidget = main->getLastMemoryWidget()) {
|
||||||
|
RVA offset = Core()->math(str);
|
||||||
|
memoryWidget->getSeekable()->seek(offset);
|
||||||
|
memoryWidget->raiseMemoryWidget();
|
||||||
|
} else {
|
||||||
|
Core()->seekAndShow(str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this->setText("");
|
this->setText("");
|
||||||
|
Loading…
Reference in New Issue
Block a user