mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-21 04:16:12 +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);
|
ui->setupUi(this);
|
||||||
|
|
||||||
updateDebugPlugin();
|
updateDebugPlugin();
|
||||||
setupDebugArgs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugOptionsWidget::~DebugOptionsWidget() {}
|
DebugOptionsWidget::~DebugOptionsWidget() {}
|
||||||
@ -36,33 +35,44 @@ void DebugOptionsWidget::updateDebugPlugin()
|
|||||||
|
|
||||||
connect(ui->pluginComboBox, SIGNAL(currentIndexChanged(const QString &)), this,
|
connect(ui->pluginComboBox, SIGNAL(currentIndexChanged(const QString &)), this,
|
||||||
SLOT(on_pluginComboBox_currentIndexChanged(const QString &)));
|
SLOT(on_pluginComboBox_currentIndexChanged(const QString &)));
|
||||||
}
|
|
||||||
|
|
||||||
void DebugOptionsWidget::setupDebugArgs()
|
QString debugArgs = Core()->getConfig("dbg.args");
|
||||||
{
|
ui->debugArgs->setText(debugArgs);
|
||||||
// add Enter shortcut to confirm changes
|
ui->debugArgs->setPlaceholderText(debugArgs);
|
||||||
QShortcut *enterPress = new QShortcut(QKeySequence(Qt::Key_Return), this);
|
connect(ui->debugArgs, &QLineEdit::editingFinished, this, &DebugOptionsWidget::updateDebugArgs);
|
||||||
enterPress->setContext(Qt::WidgetWithChildrenShortcut);
|
|
||||||
connect(enterPress, &QShortcut::activated, this, &DebugOptionsWidget::updateDebugArgs);
|
|
||||||
|
|
||||||
QString currentArgs = Core()->getConfig("dbg.args");
|
QString stackSize = Core()->getConfig("esil.stack.size");
|
||||||
ui->debugArgs->setText(currentArgs);
|
ui->stackSize->setText(stackSize);
|
||||||
ui->debugArgs->setPlaceholderText(currentArgs);
|
ui->stackSize->setPlaceholderText(stackSize);
|
||||||
connect(ui->updateArgsButton, &QAbstractButton::clicked, this, &DebugOptionsWidget::updateDebugArgs);
|
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()
|
void DebugOptionsWidget::updateDebugArgs()
|
||||||
{
|
{
|
||||||
QString newArgs = ui->debugArgs->text();
|
QString newArgs = ui->debugArgs->text();
|
||||||
Core()->setConfig("dbg.args", newArgs);
|
Core()->setConfig("dbg.args", newArgs);
|
||||||
ui->debugArgs->setText(newArgs);
|
|
||||||
ui->debugArgs->setPlaceholderText(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)
|
void DebugOptionsWidget::on_pluginComboBox_currentIndexChanged(const QString &plugin)
|
||||||
{
|
{
|
||||||
Core()->setDebugPlugin(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:
|
private slots:
|
||||||
void updateDebugPlugin();
|
void updateDebugPlugin();
|
||||||
void setupDebugArgs();
|
|
||||||
void updateDebugArgs();
|
void updateDebugArgs();
|
||||||
|
void updateStackAddr();
|
||||||
|
void updateStackSize();
|
||||||
void on_pluginComboBox_currentIndexChanged(const QString &index);
|
void on_pluginComboBox_currentIndexChanged(const QString &index);
|
||||||
};
|
};
|
||||||
|
@ -59,10 +59,45 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<layout class="QHBoxLayout" name="esilVMOptions1">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="updateArgsButton">
|
<widget class="QLabel" name="esilstackAddr">
|
||||||
<property name="text">
|
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user