Add shortcut for Advanced string definition and set focus to size specifier (#2340)

This commit is contained in:
Rachel Mant 2020-08-24 23:44:33 -04:00 committed by GitHub
parent abe43262c2
commit 1955288058
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 44 deletions

View File

@ -3,20 +3,17 @@
EditStringDialog::EditStringDialog(QWidget *parent) EditStringDialog::EditStringDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
, ui(new Ui::EditStringDialog) , ui(new Ui::EditStringDialog{})
{ {
ui->setupUi(this); ui->setupUi(this);
ui->spinBox_size->setMinimum(0); ui->spinBox_size->setMinimum(0);
ui->lineEdit_address->setMinimumWidth(150); ui->lineEdit_address->setMinimumWidth(150);
ui->pushButton_ok->setFocus(); ui->spinBox_size->setFocus();
ui->comboBox_type->addItems({"Auto", "ASCII/Latin1", "UTF-8"}); ui->comboBox_type->addItems({"Auto", "ASCII/Latin1", "UTF-8"});
connect(ui->checkBox_autoSize, &QCheckBox::toggled, ui->spinBox_size, &QSpinBox::setDisabled); connect(ui->checkBox_autoSize, &QCheckBox::toggled, ui->spinBox_size, &QSpinBox::setDisabled);
} }
EditStringDialog::~EditStringDialog() EditStringDialog::~EditStringDialog() { }
{
delete ui;
}
void EditStringDialog::setStringStartAddress(uint64_t address) void EditStringDialog::setStringStartAddress(uint64_t address)
{ {

View File

@ -1,6 +1,7 @@
#ifndef EDITSTRINGDIALOG_H #ifndef EDITSTRINGDIALOG_H
#define EDITSTRINGDIALOG_H #define EDITSTRINGDIALOG_H
#include <memory>
#include <QDialog> #include <QDialog>
namespace Ui { namespace Ui {
@ -52,7 +53,7 @@ public:
StringType getStringType() const; StringType getStringType() const;
private: private:
Ui::EditStringDialog *ui; std::unique_ptr<Ui::EditStringDialog> ui;
}; };
#endif // EDITSTRINGDIALOG_H #endif // EDITSTRINGDIALOG_H

View File

@ -23,17 +23,23 @@
<string>Edit string</string> <string>Edit string</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QDialogButtonBox" name="dialogButtonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2"> <item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_address">
<property name="text">
<string>Address:</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QLabel" name="label_size"> <widget class="QLabel" name="label_size">
<property name="minimumSize"> <property name="minimumSize">
@ -54,23 +60,23 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="label_address">
<property name="text">
<string>Address:</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLineEdit" name="lineEdit_address">
<property name="text">
<string/>
</property>
</widget>
</item>
<item> <item>
<widget class="QSpinBox" name="spinBox_size"> <widget class="QSpinBox" name="spinBox_size">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>150</width> <width>150</width>
<height>0</height> <height>24</height>
</size> </size>
</property> </property>
</widget> </widget>
@ -78,9 +84,16 @@
<item> <item>
<widget class="QComboBox" name="comboBox_type"/> <widget class="QComboBox" name="comboBox_type"/>
</item> </item>
<item>
<widget class="QLineEdit" name="lineEdit_address">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item> <item alignment="Qt::AlignTop">
<widget class="QCheckBox" name="checkBox_autoSize"> <widget class="QCheckBox" name="checkBox_autoSize">
<property name="text"> <property name="text">
<string>Auto</string> <string>Auto</string>
@ -89,29 +102,22 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton_cancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="pushButton_ok">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>spinBox_size</tabstop>
<tabstop>checkBox_autoSize</tabstop>
<tabstop>comboBox_type</tabstop>
<tabstop>lineEdit_address</tabstop>
<tabstop>dialogButtonBox</tabstop>
</tabstops>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
<sender>pushButton_cancel</sender> <sender>dialogButtonBox</sender>
<signal>clicked()</signal> <signal>accepted()</signal>
<receiver>EditStringDialog</receiver> <receiver>EditStringDialog</receiver>
<slot>reject()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>51</x> <x>51</x>
@ -124,10 +130,10 @@
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>pushButton_ok</sender> <sender>dialogButtonBox</sender>
<signal>clicked()</signal> <signal>rejected()</signal>
<receiver>EditStringDialog</receiver> <receiver>EditStringDialog</receiver>
<slot>accept()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>143</x> <x>143</x>

View File

@ -248,7 +248,7 @@ void DisassemblyContextMenu::addSetAsMenu()
initAction(&actionSetAsStringRemove, tr("Remove"), initAction(&actionSetAsStringRemove, tr("Remove"),
SLOT(on_actionSetAsStringRemove_triggered())); SLOT(on_actionSetAsStringRemove_triggered()));
initAction(&actionSetAsStringAdvanced, tr("Advanced"), initAction(&actionSetAsStringAdvanced, tr("Advanced"),
SLOT(on_actionSetAsStringAdvanced_triggered())); SLOT(on_actionSetAsStringAdvanced_triggered()), getSetAsStringAdvanced());
setAsString->addAction(&actionSetAsStringAuto); setAsString->addAction(&actionSetAsStringAuto);
@ -604,6 +604,10 @@ QKeySequence DisassemblyContextMenu::getSetAsStringSequence() const
return {Qt::Key_A}; return {Qt::Key_A};
} }
QKeySequence DisassemblyContextMenu::getSetAsStringAdvanced() const
{
return {Qt::SHIFT + Qt::Key_A};
}
QKeySequence DisassemblyContextMenu::getSetToDataSequence() const QKeySequence DisassemblyContextMenu::getSetToDataSequence() const
{ {

View File

@ -89,6 +89,7 @@ private:
QKeySequence getCopyAddressSequence() const; QKeySequence getCopyAddressSequence() const;
QKeySequence getSetToCodeSequence() const; QKeySequence getSetToCodeSequence() const;
QKeySequence getSetAsStringSequence() const; QKeySequence getSetAsStringSequence() const;
QKeySequence getSetAsStringAdvanced() const;
QKeySequence getSetToDataSequence() const; QKeySequence getSetToDataSequence() const;
QKeySequence getSetToDataExSequence() const; QKeySequence getSetToDataExSequence() const;
QKeySequence getAddFlagSequence() const; QKeySequence getAddFlagSequence() const;