Changeset - 91504904883a
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-10-10 14:19:37
hy@ozderya.net
instead of keeping different ascii and hex commands, convert between them
2 files changed with 2 insertions and 10 deletions:
0 comments (0 inline, 0 general)
commandedit.cpp
Show inline comments
 
@@ -73,16 +73,18 @@ CommandEdit::~CommandEdit()
 
void CommandEdit::setMode(bool ascii)
 
{
 
    ascii_mode = ascii;
 
    if (ascii)
 
    {
 
        setValidator(asciiValidator);
 
        setText(QByteArray::fromHex(text().remove(" ").toLatin1()));
 
    }
 
    else
 
    {
 
        setValidator(hexValidator);
 
        setText(text().toLatin1().toHex());
 
    }
 
}
 

	
 
void CommandEdit::keyPressEvent(QKeyEvent * event)
 
{
 
    if (ascii_mode)
commandwidget.cpp
Show inline comments
 
@@ -74,22 +74,12 @@ void CommandWidget::onSendClicked()
 
    emit sendCommand(command, ui->pbASCII->isChecked());
 
}
 

	
 
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()
 
{
 
    return ui->pbASCII->isChecked();
 
}
0 comments (0 inline, 0 general)