mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Add esil stack options and cleanup (#582)
This commit is contained in:
parent
9f7b96281d
commit
43215a06ac
@ -17,7 +17,6 @@ DebugOptionsWidget::DebugOptionsWidget(PreferencesDialog */*dialog*/, QWidget *p
|
||||
ui->setupUi(this);
|
||||
|
||||
updateDebugPlugin();
|
||||
setupDebugArgs();
|
||||
}
|
||||
|
||||
DebugOptionsWidget::~DebugOptionsWidget() {}
|
||||
@ -36,33 +35,44 @@ void DebugOptionsWidget::updateDebugPlugin()
|
||||
|
||||
connect(ui->pluginComboBox, SIGNAL(currentIndexChanged(const QString &)), this,
|
||||
SLOT(on_pluginComboBox_currentIndexChanged(const QString &)));
|
||||
}
|
||||
|
||||
void DebugOptionsWidget::setupDebugArgs()
|
||||
{
|
||||
// add Enter shortcut to confirm changes
|
||||
QShortcut *enterPress = new QShortcut(QKeySequence(Qt::Key_Return), this);
|
||||
enterPress->setContext(Qt::WidgetWithChildrenShortcut);
|
||||
connect(enterPress, &QShortcut::activated, this, &DebugOptionsWidget::updateDebugArgs);
|
||||
QString debugArgs = Core()->getConfig("dbg.args");
|
||||
ui->debugArgs->setText(debugArgs);
|
||||
ui->debugArgs->setPlaceholderText(debugArgs);
|
||||
connect(ui->debugArgs, &QLineEdit::editingFinished, this, &DebugOptionsWidget::updateDebugArgs);
|
||||
|
||||
QString currentArgs = Core()->getConfig("dbg.args");
|
||||
ui->debugArgs->setText(currentArgs);
|
||||
ui->debugArgs->setPlaceholderText(currentArgs);
|
||||
connect(ui->updateArgsButton, &QAbstractButton::clicked, this, &DebugOptionsWidget::updateDebugArgs);
|
||||
QString stackSize = Core()->getConfig("esil.stack.size");
|
||||
ui->stackSize->setText(stackSize);
|
||||
ui->stackSize->setPlaceholderText(stackSize);
|
||||
QString stackAddr = Core()->getConfig("esil.stack.addr");
|
||||
ui->stackAddr->setText(stackAddr);
|
||||
ui->stackAddr->setPlaceholderText(stackAddr);
|
||||
connect(ui->stackAddr, &QLineEdit::editingFinished, this, &DebugOptionsWidget::updateStackAddr);
|
||||
connect(ui->stackSize, &QLineEdit::editingFinished, this, &DebugOptionsWidget::updateStackSize);
|
||||
}
|
||||
|
||||
void DebugOptionsWidget::updateDebugArgs()
|
||||
{
|
||||
QString newArgs = ui->debugArgs->text();
|
||||
Core()->setConfig("dbg.args", newArgs);
|
||||
ui->debugArgs->setText(newArgs);
|
||||
ui->debugArgs->setPlaceholderText(newArgs);
|
||||
// flash green for 200 ms
|
||||
ui->debugArgs->setStyleSheet("border: 1px solid green;");
|
||||
QTimer::singleShot(200, [this](){ ui->debugArgs->setStyleSheet("");});
|
||||
}
|
||||
|
||||
void DebugOptionsWidget::on_pluginComboBox_currentIndexChanged(const QString &plugin)
|
||||
{
|
||||
Core()->setDebugPlugin(plugin);
|
||||
}
|
||||
|
||||
void DebugOptionsWidget::updateStackSize()
|
||||
{
|
||||
QString newSize = ui->stackSize->text();
|
||||
Core()->setConfig("esil.stack.size", newSize);
|
||||
ui->stackSize->setPlaceholderText(newSize);
|
||||
}
|
||||
|
||||
void DebugOptionsWidget::updateStackAddr()
|
||||
{
|
||||
QString newAddr = ui->stackAddr->text();
|
||||
Core()->setConfig("esil.stack.addr", newAddr);
|
||||
ui->stackAddr->setPlaceholderText(newAddr);
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ private:
|
||||
|
||||
private slots:
|
||||
void updateDebugPlugin();
|
||||
void setupDebugArgs();
|
||||
void updateDebugArgs();
|
||||
void updateStackAddr();
|
||||
void updateStackSize();
|
||||
void on_pluginComboBox_currentIndexChanged(const QString &index);
|
||||
};
|
||||
|
@ -59,10 +59,45 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<layout class="QHBoxLayout" name="esilVMOptions1">
|
||||
<item>
|
||||
<widget class="QPushButton" name="updateArgsButton">
|
||||
<widget class="QLabel" name="esilstackAddr">
|
||||
<property name="text">
|
||||
<string>Confirm</string>
|
||||
<string>ESIL stack address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="stackAddr">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<layout class="QHBoxLayout" name="esilVMOptions2">
|
||||
<item>
|
||||
<widget class="QLabel" name="esilStackSize">
|
||||
<property name="text">
|
||||
<string>ESIL stack size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="stackSize">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user