# HG changeset patch # User Hasan Yavuz Ă–ZDERYA # Date 2015-10-10 14:19:37 # Node ID 91504904883a633cd8e8eb71a3008f2d92115d9a # Parent 51e636c4e69bf7c1c397d44103c3e2b217ea7eaf instead of keeping different ascii and hex commands, convert between them diff --git a/commandedit.cpp b/commandedit.cpp --- a/commandedit.cpp +++ b/commandedit.cpp @@ -76,10 +76,12 @@ void CommandEdit::setMode(bool ascii) if (ascii) { setValidator(asciiValidator); + setText(QByteArray::fromHex(text().remove(" ").toLatin1())); } else { setValidator(hexValidator); + setText(text().toLatin1().toHex()); } } diff --git a/commandwidget.cpp b/commandwidget.cpp --- a/commandwidget.cpp +++ b/commandwidget.cpp @@ -77,16 +77,6 @@ void CommandWidget::onSendClicked() void CommandWidget::onASCIIToggled(bool checked) { ui->leCommand->setMode(checked); - if (checked) - { - storedHexText = ui->leCommand->text(); - ui->leCommand->setText(storedAsciiText); - } - else - { - storedAsciiText = ui->leCommand->text(); - ui->leCommand->setText(storedHexText); - } } bool CommandWidget::isASCIIMode()