GUI: simplify GUI for specifying system breakpoint scripts
Thanks to Matti, Brit and JustMagic for help!
This commit is contained in:
parent
d24c278d2b
commit
6518994beb
|
@ -43,7 +43,7 @@
|
|||
#include "CPUMultiDump.h"
|
||||
#include "CPUStack.h"
|
||||
#include "GotoDialog.h"
|
||||
#include "BrowseDialog.h"
|
||||
#include "SystemBreakpointScriptDialog.h"
|
||||
#include "CustomizeMenuDialog.h"
|
||||
#include "main.h"
|
||||
#include "SimpleTraceDialog.h"
|
||||
|
@ -2102,26 +2102,8 @@ void MainWindow::animateCommandSlot()
|
|||
|
||||
void MainWindow::setInitializationScript()
|
||||
{
|
||||
QString global, debuggee;
|
||||
char globalChar[MAX_SETTING_SIZE];
|
||||
if(DbgIsDebugging())
|
||||
{
|
||||
debuggee = QString(DbgFunctions()->DbgGetDebuggeeInitScript());
|
||||
BrowseDialog browseScript(this, tr("Set Initialization Script for Debuggee"), tr("Set Initialization Script for Debuggee"), tr("Script files (*.txt *.scr);;All files (*.*)"), debuggee, false);
|
||||
browseScript.setWindowIcon(DIcon("initscript.png"));
|
||||
if(browseScript.exec() == QDialog::Accepted)
|
||||
DbgFunctions()->DbgSetDebuggeeInitScript(browseScript.path.toUtf8().constData());
|
||||
}
|
||||
if(BridgeSettingGet("Engine", "InitializeScript", globalChar))
|
||||
global = QString(globalChar);
|
||||
else
|
||||
global = QString();
|
||||
BrowseDialog browseScript(this, tr("Set Global Initialization Script"), tr("Set Global Initialization Script"), tr("Script files (*.txt *.scr);;All files (*.*)"), global, false);
|
||||
browseScript.setWindowIcon(DIcon("initscript.png"));
|
||||
if(browseScript.exec() == QDialog::Accepted)
|
||||
{
|
||||
BridgeSettingSet("Engine", "InitializeScript", browseScript.path.toUtf8().constData());
|
||||
}
|
||||
SystemBreakpointScriptDialog dialog(this);
|
||||
dialog.exec();
|
||||
}
|
||||
|
||||
void MainWindow::customizeMenu()
|
||||
|
|
|
@ -1069,7 +1069,7 @@
|
|||
<normaloff>:/icons/images/initscript.png</normaloff>:/icons/images/initscript.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Set Initialization Script</string>
|
||||
<string>System breakpoint scripts</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionImportSettings">
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
#include "SystemBreakpointScriptDialog.h"
|
||||
#include "ui_SystemBreakpointScriptDialog.h"
|
||||
#include "Bridge.h"
|
||||
#include "Configuration.h"
|
||||
#include <QDirModel>
|
||||
#include <QFileDialog>
|
||||
#include <QCompleter>
|
||||
|
||||
SystemBreakpointScriptDialog::SystemBreakpointScriptDialog(QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::SystemBreakpointScriptDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint | Qt::MSWindowsFixedSizeDialogHint);
|
||||
|
||||
auto dirCompleter = [](QLineEdit * lineEdit)
|
||||
{
|
||||
QCompleter* completer = new QCompleter(lineEdit);
|
||||
completer->setModel(new QDirModel(completer));
|
||||
lineEdit->setCompleter(completer);
|
||||
};
|
||||
dirCompleter(ui->lineEditGlobal);
|
||||
dirCompleter(ui->lineEditDebuggee);
|
||||
|
||||
{
|
||||
char globalChar[MAX_SETTING_SIZE];
|
||||
if(BridgeSettingGet("Engine", "InitializeScript", globalChar))
|
||||
ui->lineEditGlobal->setText(globalChar);
|
||||
}
|
||||
|
||||
if(DbgIsDebugging())
|
||||
{
|
||||
char moduleName[MAX_MODULE_SIZE];
|
||||
if(DbgFunctions()->ModNameFromAddr(DbgValFromString("mod.main()"), moduleName, true))
|
||||
{
|
||||
ui->groupBoxDebuggee->setTitle(tr("2. System breakpoint script for %1").arg(moduleName));
|
||||
}
|
||||
|
||||
ui->lineEditDebuggee->setText(DbgFunctions()->DbgGetDebuggeeInitScript());
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->groupBoxDebuggee->setEnabled(false);
|
||||
}
|
||||
|
||||
Config()->setupWindowPos(this);
|
||||
}
|
||||
|
||||
SystemBreakpointScriptDialog::~SystemBreakpointScriptDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void SystemBreakpointScriptDialog::on_pushButtonGlobal_clicked()
|
||||
{
|
||||
QString file = QFileDialog::getOpenFileName(this, ui->groupBoxGlobal->title(), ui->lineEditGlobal->text(), tr("Script files (*.txt *.scr);;All files (*.*)"));
|
||||
if(!file.isEmpty())
|
||||
ui->lineEditGlobal->setText(QDir::toNativeSeparators(file));
|
||||
}
|
||||
|
||||
void SystemBreakpointScriptDialog::on_pushButtonDebuggee_clicked()
|
||||
{
|
||||
QString file = QFileDialog::getOpenFileName(this, ui->groupBoxDebuggee->title(), ui->lineEditDebuggee->text(), tr("Script files (*.txt *.scr);;All files (*.*)"));
|
||||
if(!file.isEmpty())
|
||||
ui->lineEditDebuggee->setText(QDir::toNativeSeparators(file));
|
||||
}
|
||||
|
||||
void SystemBreakpointScriptDialog::on_SystemBreakpointScriptDialog_accepted()
|
||||
{
|
||||
BridgeSettingSet("Engine", "InitializeScript", ui->lineEditGlobal->text().toUtf8().constData());
|
||||
if(ui->groupBoxDebuggee->isEnabled())
|
||||
DbgFunctions()->DbgSetDebuggeeInitScript(ui->lineEditDebuggee->text().toUtf8().constData());
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class SystemBreakpointScriptDialog;
|
||||
}
|
||||
|
||||
class SystemBreakpointScriptDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SystemBreakpointScriptDialog(QWidget* parent = nullptr);
|
||||
~SystemBreakpointScriptDialog();
|
||||
|
||||
private slots:
|
||||
void on_pushButtonGlobal_clicked();
|
||||
void on_pushButtonDebuggee_clicked();
|
||||
void on_SystemBreakpointScriptDialog_accepted();
|
||||
|
||||
private:
|
||||
Ui::SystemBreakpointScriptDialog* ui;
|
||||
};
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SystemBreakpointScriptDialog</class>
|
||||
<widget class="QDialog" name="SystemBreakpointScriptDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>865</width>
|
||||
<height>169</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>System breakpoint scripts</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../../resource.qrc">
|
||||
<normaloff>:/icons/images/initscript.png</normaloff>:/icons/images/initscript.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxGlobal">
|
||||
<property name="title">
|
||||
<string>1. System breakpoint script for every process</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelGlobal">
|
||||
<property name="text">
|
||||
<string>Path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditGlobal"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGlobal">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxDebuggee">
|
||||
<property name="title">
|
||||
<string>2. System breakpoint script for a specific process (attach to a process to specify)</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelDebuggee">
|
||||
<property name="text">
|
||||
<string>Path:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditDebuggee"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonDebuggee">
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../resource.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>SystemBreakpointScriptDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>227</x>
|
||||
<y>151</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>168</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>SystemBreakpointScriptDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>295</x>
|
||||
<y>157</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>168</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -333,6 +333,7 @@ Configuration::Configuration() : QObject(), noMoreMsgbox(false)
|
|||
addWindowPosConfig(guiUint, "FavouriteTools");
|
||||
addWindowPosConfig(guiUint, "HexEditDialog");
|
||||
addWindowPosConfig(guiUint, "WordEditDialog");
|
||||
addWindowPosConfig(guiUint, "SystemBreakpointScriptDialog");
|
||||
defaultUints.insert("Gui", guiUint);
|
||||
|
||||
//uint settings
|
||||
|
|
|
@ -75,6 +75,7 @@ RESOURCES += \
|
|||
|
||||
SOURCES += \
|
||||
Src/Gui/CPURegistersView.cpp \
|
||||
Src/Gui/SystemBreakpointScriptDialog.cpp \
|
||||
Src/Tracer/TraceRegisters.cpp \
|
||||
Src/Tracer/TraceWidget.cpp \
|
||||
Src/main.cpp \
|
||||
|
@ -192,6 +193,7 @@ SOURCES += \
|
|||
|
||||
HEADERS += \
|
||||
Src/Gui/CPURegistersView.h \
|
||||
Src/Gui/SystemBreakpointScriptDialog.h \
|
||||
Src/Tracer/TraceRegisters.h \
|
||||
Src/Tracer/TraceWidget.h \
|
||||
Src/main.h \
|
||||
|
@ -317,6 +319,7 @@ HEADERS += \
|
|||
|
||||
|
||||
FORMS += \
|
||||
Src/Gui/SystemBreakpointScriptDialog.ui \
|
||||
Src/Gui/MainWindow.ui \
|
||||
Src/Gui/CPUWidget.ui \
|
||||
Src/Gui/GotoDialog.ui \
|
||||
|
|
Loading…
Reference in New Issue