1
0
Fork 0

Disable data copy in find pattern dialog

This commit is contained in:
torusrxxx 2018-05-02 11:54:17 +08:00 committed by Duncan Ogilvie
parent dba3178428
commit 9741c06798
7 changed files with 22 additions and 14 deletions

View File

@ -1204,6 +1204,7 @@ void CPUDisassembly::findPatternSlot()
{ {
HexEditDialog hexEdit(this); HexEditDialog hexEdit(this);
hexEdit.showEntireBlock(true); hexEdit.showEntireBlock(true);
hexEdit.isDataCopiable(false);
hexEdit.mHexEdit->setOverwriteMode(false); hexEdit.mHexEdit->setOverwriteMode(false);
hexEdit.setWindowTitle(tr("Find Pattern...")); hexEdit.setWindowTitle(tr("Find Pattern..."));
if(hexEdit.exec() != QDialog::Accepted) if(hexEdit.exec() != QDialog::Accepted)

View File

@ -1620,6 +1620,7 @@ void CPUDump::findPattern()
{ {
HexEditDialog hexEdit(this); HexEditDialog hexEdit(this);
hexEdit.showEntireBlock(true); hexEdit.showEntireBlock(true);
hexEdit.isDataCopiable(false);
hexEdit.mHexEdit->setOverwriteMode(false); hexEdit.mHexEdit->setOverwriteMode(false);
hexEdit.setWindowTitle(tr("Find Pattern...")); hexEdit.setWindowTitle(tr("Find Pattern..."));
if(hexEdit.exec() != QDialog::Accepted) if(hexEdit.exec() != QDialog::Accepted)

View File

@ -939,6 +939,7 @@ void CPUStack::findPattern()
{ {
HexEditDialog hexEdit(this); HexEditDialog hexEdit(this);
hexEdit.showEntireBlock(true); hexEdit.showEntireBlock(true);
hexEdit.isDataCopiable(false);
hexEdit.mHexEdit->setOverwriteMode(false); hexEdit.mHexEdit->setOverwriteMode(false);
hexEdit.setWindowTitle(tr("Find Pattern...")); hexEdit.setWindowTitle(tr("Find Pattern..."));
if(hexEdit.exec() != QDialog::Accepted) if(hexEdit.exec() != QDialog::Accepted)

View File

@ -30,6 +30,7 @@ HexEditDialog::HexEditDialog(QWidget* parent) : QDialog(parent), ui(new Ui::HexE
mHexEdit->widget()->setFocus(); mHexEdit->widget()->setFocus();
connect(mHexEdit, SIGNAL(dataChanged()), this, SLOT(dataChangedSlot())); connect(mHexEdit, SIGNAL(dataChanged()), this, SLOT(dataChangedSlot()));
connect(mHexEdit, SIGNAL(dataEdited()), this, SLOT(dataEditedSlot())); connect(mHexEdit, SIGNAL(dataEdited()), this, SLOT(dataEditedSlot()));
connect(ui->btnCodePage2, SIGNAL(clicked()), this, SLOT(on_btnCodepage_clicked()));
connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateStyle())); connect(Config(), SIGNAL(colorsUpdated()), this, SLOT(updateStyle()));
connect(Bridge::getBridge(), SIGNAL(repaintGui()), this, SLOT(updateStyle())); connect(Bridge::getBridge(), SIGNAL(repaintGui()), this, SLOT(updateStyle()));
@ -47,18 +48,18 @@ HexEditDialog::~HexEditDialog()
void HexEditDialog::showEntireBlock(bool show) void HexEditDialog::showEntireBlock(bool show)
{ {
if(show) ui->chkEntireBlock->setVisible(show);
ui->chkEntireBlock->show();
else
ui->chkEntireBlock->hide();
} }
void HexEditDialog::showKeepSize(bool show) void HexEditDialog::showKeepSize(bool show)
{ {
if(show) ui->chkKeepSize->setVisible(show);
ui->chkKeepSize->show(); }
else
ui->chkKeepSize->hide(); void HexEditDialog::isDataCopiable(bool copyDataEnabled)
{
if(copyDataEnabled == false)
ui->tabModeSelect->removeTab(2); //This can't be undone!
} }
void HexEditDialog::updateCodepage() void HexEditDialog::updateCodepage()
@ -70,6 +71,7 @@ void HexEditDialog::updateCodepage()
ui->lineEditCodepage->setEncoding(QTextCodec::codecForName(allCodecs.at(lastCodepage))); ui->lineEditCodepage->setEncoding(QTextCodec::codecForName(allCodecs.at(lastCodepage)));
ui->lineEditCodepage->setData(mHexEdit->data()); ui->lineEditCodepage->setData(mHexEdit->data());
ui->labelLastCodepage->setText(QString(allCodecs.at(lastCodepage).constData())); ui->labelLastCodepage->setText(QString(allCodecs.at(lastCodepage).constData()));
ui->labelLastCodepage2->setText(ui->labelLastCodepage->text());
} }
void HexEditDialog::updateCodepage(const QByteArray & name) void HexEditDialog::updateCodepage(const QByteArray & name)
@ -77,6 +79,7 @@ void HexEditDialog::updateCodepage(const QByteArray & name)
ui->lineEditCodepage->setEncoding(QTextCodec::codecForName(name)); ui->lineEditCodepage->setEncoding(QTextCodec::codecForName(name));
ui->lineEditCodepage->setData(mHexEdit->data()); ui->lineEditCodepage->setData(mHexEdit->data());
ui->labelLastCodepage->setText(QString(name)); ui->labelLastCodepage->setText(QString(name));
ui->labelLastCodepage2->setText(ui->labelLastCodepage->text());
} }
bool HexEditDialog::entireBlock() bool HexEditDialog::entireBlock()

View File

@ -19,6 +19,7 @@ public:
void showEntireBlock(bool show); void showEntireBlock(bool show);
void showKeepSize(bool show); void showKeepSize(bool show);
void isDataCopiable(bool copyDataEnabled);
void updateCodepage(); void updateCodepage();
bool entireBlock(); bool entireBlock();

View File

@ -67,11 +67,11 @@
</layout> </layout>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabModeSelect">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tabHexEdit">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum"> <sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -317,7 +317,7 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
<widget class="QWidget" name="tab_2"> <widget class="QWidget" name="tabStringEditor">
<attribute name="title"> <attribute name="title">
<string>String</string> <string>String</string>
</attribute> </attribute>
@ -347,12 +347,12 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="labelLastCodePage2"> <widget class="QLabel" name="labelLastCodepage2">
<property name="text"> <property name="text">
<string>Last &amp;Codepage:</string> <string>Last &amp;Codepage:</string>
</property> </property>
<property name="buddy"> <property name="buddy">
<cstring>plainEditText_2</cstring> <cstring>plainTextEdit_2</cstring>
</property> </property>
</widget> </widget>
</item> </item>
@ -384,7 +384,7 @@
</layout> </layout>
</widget> </widget>
</widget> </widget>
<widget class="QWidget" name="tab_3"> <widget class="QWidget" name="tabCopyData">
<attribute name="title"> <attribute name="title">
<string>Copy data</string> <string>Copy data</string>
</attribute> </attribute>

View File

@ -578,6 +578,7 @@ void MemoryMapView::findPatternSlot()
{ {
HexEditDialog hexEdit(this); HexEditDialog hexEdit(this);
hexEdit.showEntireBlock(true); hexEdit.showEntireBlock(true);
hexEdit.isDataCopiable(false);
hexEdit.mHexEdit->setOverwriteMode(false); hexEdit.mHexEdit->setOverwriteMode(false);
hexEdit.setWindowTitle(tr("Find Pattern...")); hexEdit.setWindowTitle(tr("Find Pattern..."));
if(hexEdit.exec() != QDialog::Accepted) if(hexEdit.exec() != QDialog::Accepted)