1
0
Fork 0

GUI: removed redundant buttons from HexEditDialog

This commit is contained in:
mrexodia 2016-06-06 12:10:42 +02:00
parent cc3194cc02
commit a0307a0974
No known key found for this signature in database
GPG Key ID: D72F9A4FAA0073B4
3 changed files with 123 additions and 222 deletions

View File

@ -25,7 +25,6 @@ HexEditDialog::HexEditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::HexE
mHexEdit->setOverwriteMode(true);
ui->scrollArea->setWidget(mHexEdit);
mHexEdit->widget()->setFocus();
mHexEdit->setTabOrder(ui->btnUnicode2Hex, mHexEdit->widget());
connect(mHexEdit, SIGNAL(dataChanged()), this, SLOT(dataChangedSlot()));
connect(mHexEdit, SIGNAL(dataEdited()), this, SLOT(dataEditedSlot()));
@ -73,22 +72,6 @@ void HexEditDialog::updateStyle()
mHexEdit->setSelectionColor(ConfigColor("HexEditSelectionColor"));
}
void HexEditDialog::on_btnAscii2Hex_clicked()
{
QByteArray data = ui->lineEditAscii->data();
data = resizeData(data);
ui->lineEditUnicode->setData(data);
mHexEdit->setData(data);
}
void HexEditDialog::on_btnUnicode2Hex_clicked()
{
QByteArray data = ui->lineEditUnicode->data();
data = resizeData(data);
ui->lineEditAscii->setData(data);
mHexEdit->setData(data);
}
void HexEditDialog::on_chkKeepSize_toggled(bool checked)
{
mHexEdit->setKeepSize(checked);
@ -117,12 +100,18 @@ void HexEditDialog::dataEditedSlot()
void HexEditDialog::on_lineEditAscii_dataEdited()
{
on_btnAscii2Hex_clicked();
QByteArray data = ui->lineEditAscii->data();
data = resizeData(data);
ui->lineEditUnicode->setData(data);
mHexEdit->setData(data);
}
void HexEditDialog::on_lineEditUnicode_dataEdited()
{
on_btnUnicode2Hex_clicked();
QByteArray data = ui->lineEditUnicode->data();
data = resizeData(data);
ui->lineEditAscii->setData(data);
mHexEdit->setData(data);
}
QByteArray HexEditDialog::resizeData(QByteArray & data)

View File

@ -26,8 +26,6 @@ public:
private slots:
void updateStyle();
void on_btnAscii2Hex_clicked();
void on_btnUnicode2Hex_clicked();
void on_chkKeepSize_toggled(bool checked);
void dataChangedSlot();
void dataEditedSlot();

View File

@ -17,205 +17,121 @@
<iconset resource="../../resource.qrc">
<normaloff>:/icons/images/document-binary.png</normaloff>:/icons/images/document-binary.png</iconset>
</property>
<widget class="QScrollArea" name="scrollArea">
<property name="geometry">
<rect>
<x>10</x>
<y>130</y>
<width>361</width>
<height>101</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>359</width>
<height>99</height>
</rect>
</property>
</widget>
</widget>
<widget class="HexLineEdit" name="lineEditUnicode">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>361</width>
<height>20</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {border-style: outset; border-width: 1px; border-color: black}</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>32767</number>
</property>
<property name="frame">
<bool>false</bool>
</property>
</widget>
<widget class="HexLineEdit" name="lineEditAscii">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>361</width>
<height>20</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QLineEdit {border-style: outset; border-width: 1px; border-color: black}</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>32767</number>
</property>
<property name="frame">
<bool>false</bool>
</property>
</widget>
<widget class="QLabel" name="labelAscii">
<property name="geometry">
<rect>
<x>10</x>
<y>9</y>
<width>32</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>&amp;ASCII:</string>
</property>
<property name="buddy">
<cstring>lineEditAscii</cstring>
</property>
</widget>
<widget class="QLabel" name="labelUnicode">
<property name="geometry">
<rect>
<x>10</x>
<y>59</y>
<width>50</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>&amp;UNICODE:</string>
</property>
<property name="buddy">
<cstring>lineEditUnicode</cstring>
</property>
</widget>
<widget class="QLabel" name="labelHex">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>31</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>&amp;Hex:</string>
</property>
<property name="buddy">
<cstring>scrollArea</cstring>
</property>
</widget>
<widget class="QPushButton" name="btnAscii2Hex">
<property name="geometry">
<rect>
<x>271</x>
<y>53</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Ascii2Hex</string>
</property>
</widget>
<widget class="QPushButton" name="btnUnicode2Hex">
<property name="geometry">
<rect>
<x>271</x>
<y>103</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Unicode2Hex</string>
</property>
</widget>
<widget class="QPushButton" name="btnOk">
<property name="geometry">
<rect>
<x>216</x>
<y>240</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>&amp;OK</string>
</property>
</widget>
<widget class="QPushButton" name="btnCancel">
<property name="geometry">
<rect>
<x>297</x>
<y>240</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
</widget>
<widget class="QCheckBox" name="chkKeepSize">
<property name="geometry">
<rect>
<x>10</x>
<y>240</y>
<width>71</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>&amp;Keep Size</string>
</property>
</widget>
<widget class="QCheckBox" name="chkEntireBlock">
<property name="geometry">
<rect>
<x>80</x>
<y>240</y>
<width>81</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>&amp;Entire Block</string>
</property>
</widget>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="labelAscii">
<property name="text">
<string>&amp;ASCII:</string>
</property>
<property name="buddy">
<cstring>lineEditAscii</cstring>
</property>
</widget>
</item>
<item row="1" column="0" colspan="4">
<widget class="HexLineEdit" name="lineEditAscii">
<property name="styleSheet">
<string notr="true">QLineEdit {border-style: outset; border-width: 1px; border-color: black}</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>32767</number>
</property>
<property name="frame">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="labelUnicode">
<property name="text">
<string>&amp;UNICODE:</string>
</property>
<property name="buddy">
<cstring>lineEditUnicode</cstring>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<widget class="HexLineEdit" name="lineEditUnicode">
<property name="styleSheet">
<string notr="true">QLineEdit {border-style: outset; border-width: 1px; border-color: black}</string>
</property>
<property name="inputMask">
<string/>
</property>
<property name="maxLength">
<number>32767</number>
</property>
<property name="frame">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="labelHex">
<property name="text">
<string>&amp;Hex:</string>
</property>
<property name="buddy">
<cstring>scrollArea</cstring>
</property>
</widget>
</item>
<item row="5" column="0" colspan="4">
<widget class="QScrollArea" name="scrollArea">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>361</width>
<height>118</height>
</rect>
</property>
</widget>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="chkKeepSize">
<property name="text">
<string>&amp;Keep Size</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QCheckBox" name="chkEntireBlock">
<property name="text">
<string>&amp;Entire Block</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="btnOk">
<property name="text">
<string>&amp;OK</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QPushButton" name="btnCancel">
<property name="text">
<string>&amp;Cancel</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
@ -226,9 +142,7 @@
</customwidgets>
<tabstops>
<tabstop>lineEditAscii</tabstop>
<tabstop>btnAscii2Hex</tabstop>
<tabstop>lineEditUnicode</tabstop>
<tabstop>btnUnicode2Hex</tabstop>
<tabstop>chkKeepSize</tabstop>
<tabstop>chkEntireBlock</tabstop>
<tabstop>btnOk</tabstop>