mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 03:16:10 +00:00
Added debug option to define program arguments
This commit is contained in:
parent
ac4751eb4a
commit
cd1656fc30
@ -1,9 +1,10 @@
|
||||
#include <QLabel>
|
||||
#include <QFontDialog>
|
||||
|
||||
#include "DebugOptionsWidget.h"
|
||||
#include "ui_DebugOptionsWidget.h"
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#include <QComboBox>
|
||||
#include <QShortcut>
|
||||
#include <QFontDialog>
|
||||
#include "PreferencesDialog.h"
|
||||
|
||||
#include "utils/Helpers.h"
|
||||
@ -16,6 +17,7 @@ DebugOptionsWidget::DebugOptionsWidget(PreferencesDialog */*dialog*/, QWidget *p
|
||||
ui->setupUi(this);
|
||||
|
||||
updateDebugPlugin();
|
||||
setupDebugArgs();
|
||||
}
|
||||
|
||||
DebugOptionsWidget::~DebugOptionsWidget() {}
|
||||
@ -36,6 +38,30 @@ void DebugOptionsWidget::updateDebugPlugin()
|
||||
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 currentArgs = Core()->getConfig("dbg.args");
|
||||
ui->debugArgs->setText(currentArgs);
|
||||
ui->debugArgs->setPlaceholderText(currentArgs);
|
||||
connect(ui->updateArgsButton, &QAbstractButton::clicked, this, &DebugOptionsWidget::updateDebugArgs);
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -24,6 +24,7 @@ private:
|
||||
|
||||
private slots:
|
||||
void updateDebugPlugin();
|
||||
|
||||
void setupDebugArgs();
|
||||
void updateDebugArgs();
|
||||
void on_pluginComboBox_currentIndexChanged(const QString &index);
|
||||
};
|
||||
|
@ -20,6 +20,8 @@
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="pluginSelectionLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="pluginLabel">
|
||||
<property name="text">
|
||||
<string>Debug Plugin:</string>
|
||||
@ -38,6 +40,36 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QHBoxLayout" name="argSelectionLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="argsLabel">
|
||||
<property name="text">
|
||||
<string>Program Arguments:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="debugArgs">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="updateArgsButton">
|
||||
<property name="text">
|
||||
<string>Confirm</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
Loading…
Reference in New Issue
Block a user