1
0
Fork 0

GUI: option to edit script in ScriptView

This commit is contained in:
mrexodia 2017-03-14 09:31:31 +01:00
parent f7d3f7cb74
commit c29aa34baa
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
5 changed files with 14 additions and 1 deletions

View File

@ -1,6 +1,7 @@
#include "ScriptView.h"
#include <QMessageBox>
#include <QFileDialog>
#include <QDesktopServices>
#include "Configuration.h"
#include "Bridge.h"
#include "RichTextPainter.h"
@ -377,6 +378,7 @@ void ScriptView::setupContextMenu()
};
mMenu->addAction(makeShortcutAction(DIcon("arrow-restart.png"), tr("Re&load Script"), SLOT(reload()), "ActionReloadScript"), isempty);
mMenu->addAction(makeShortcutAction(DIcon("control-exit.png"), tr("&Unload Script"), SLOT(unload()), "ActionUnloadScript"), isempty);
mMenu->addAction(makeShortcutAction(DIcon("edit-script.png"), tr("&Edit Script"), SLOT(edit()), "ActionEditScript"), isempty);
mMenu->addSeparator();
mMenu->addAction(makeShortcutAction(DIcon("breakpoint_toggle.png"), tr("Toggle &BP"), SLOT(bpToggle()), "ActionToggleBreakpointScript"), isempty);
mMenu->addAction(makeShortcutAction(DIcon("arrow-run-cursor.png"), tr("Ru&n until selection"), SLOT(runCursor()), "ActionRunToCursorScript"), isempty);
@ -385,7 +387,7 @@ void ScriptView::setupContextMenu()
mMenu->addAction(makeShortcutAction(DIcon("control-stop.png"), tr("&Abort"), SLOT(abort()), "ActionAbortScript"), isempty);
mMenu->addAction(makeAction(DIcon("neworigin.png"), tr("&Continue here..."), SLOT(newIp())), isempty);
mMenu->addSeparator();
mMenu->addAction(makeShortcutAction(DIcon("terminal-command.png"), tr("&Execute Command..."), SLOT(cmdExec()), "ActionExecuteCommandScript"));
mMenu->addAction(makeShortcutAction(DIcon("terminal-command.png"), tr("E&xecute Command..."), SLOT(cmdExec()), "ActionExecuteCommandScript"));
}
bool ScriptView::isScriptCommand(QString text, QString cmd, QString & mnemonic, QString & argument)
@ -474,6 +476,7 @@ void ScriptView::openFile()
void ScriptView::paste()
{
DbgScriptUnload();
filename.clear();
DbgScriptLoad("x64dbg://localhost/clipboard");
}
@ -487,9 +490,16 @@ void ScriptView::reload()
void ScriptView::unload()
{
filename.clear();
DbgScriptUnload();
}
void ScriptView::edit()
{
if(!filename.isEmpty())
QDesktopServices::openUrl(QUrl(QDir::fromNativeSeparators(filename)));
}
void ScriptView::run()
{
if(!getRowCount())

View File

@ -31,6 +31,7 @@ public slots:
void paste();
void reload();
void unload();
void edit();
void run();
void bpToggle();
void runCursor();

View File

@ -523,6 +523,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
defaultShortcuts.insert("ActionLoadScript", Shortcut(tr("Actions -> Load Script"), "Ctrl+O"));
defaultShortcuts.insert("ActionReloadScript", Shortcut(tr("Actions -> Reload Script"), "Ctrl+R"));
defaultShortcuts.insert("ActionUnloadScript", Shortcut(tr("Actions -> Unload Script"), "Ctrl+U"));
defaultShortcuts.insert("ActionEditScript", Shortcut(tr("Actions -> Edit Script"), ""));
defaultShortcuts.insert("ActionRunScript", Shortcut(tr("Actions -> Run Script"), "Space"));
defaultShortcuts.insert("ActionToggleBreakpointScript", Shortcut(tr("Actions -> Toggle Script Breakpoint"), "F2"));
defaultShortcuts.insert("ActionRunToCursorScript", Shortcut(tr("Actions -> Run Script to Cursor"), "Shift+F4"));

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

View File

@ -294,5 +294,6 @@
<file>images/wide.png</file>
<file>images/layout.png</file>
<file>images/summary.png</file>
<file>images/edit-script.png</file>
</qresource>
</RCC>