From 1511b57efa929d7e4304d416ee0ab9edc3b7ff2e Mon Sep 17 00:00:00 2001 From: Peter LaFosse Date: Mon, 13 Apr 2020 17:09:55 -0400 Subject: Make addresses clickable in scripting console --- ui/logview.h | 2 ++ ui/scriptingconsole.h | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/logview.h b/ui/logview.h index 0b5272c0..be129a31 100644 --- a/ui/logview.h +++ b/ui/logview.h @@ -125,6 +125,8 @@ public: virtual bool canCopy(); static void SetLogLevel(BNLogLevel level); + static bool IsHexString(const QString& str, std::pair offsetLen); + static bool StartsWith0x(const QString& str, std::pair offsetLen); protected: void contextMenuEvent(QContextMenuEvent* event) override; diff --git a/ui/scriptingconsole.h b/ui/scriptingconsole.h index 48eefa6d..4f2cc5a5 100644 --- a/ui/scriptingconsole.h +++ b/ui/scriptingconsole.h @@ -98,13 +98,18 @@ class BINARYNINJAUIAPI ScriptingConsoleOutput: public QTextEdit UIActionHandler* m_handler; UIActionHandler m_actionHandler; ContextMenuManager* m_contextMenuManager; + BinaryViewRef m_data; Menu* m_menu; public: ScriptingConsoleOutput(ScriptingConsole* parent, Menu* menu); - + bool IsNavigable(const QString& str, const std::pair& offsetLen, uint64_t& value, bool highlight) const; protected: void contextMenuEvent(QContextMenuEvent* event) override; + +public Q_SLOTS: + virtual void mousePressEvent(QMouseEvent* event) override; + void viewChanged(QWidget* frame); }; class ScriptingConsoleWidget; @@ -146,6 +151,9 @@ private Q_SLOTS: void cancel(); void showCancelButton(); +Q_SIGNALS: + void viewChanged(QWidget* frame); + protected: void customEvent(QEvent* event) override; void notifyFontChanged() override; @@ -167,6 +175,7 @@ public: virtual void NotifyOutput(const std::string& text) override; virtual void NotifyError(const std::string& text) override; virtual void NotifyInputReadyStateChanged(BNScriptingProviderInputReadyState state) override; + virtual void notifyViewChanged(ViewFrame* frame) override; void moveUpInHistory(); void moveDownInHistory(); -- cgit v1.3.1