Changeset - 40c94e30a042
[Not reviewed]
Hasan Yavuz Ă–ZDERYA - 10 years ago 2015-10-10 13:21:53
hy@ozderya.net
seperately buffer the ASCII and HEX command texts
2 files changed with 13 insertions and 0 deletions:
0 comments (0 inline, 0 general)
commandwidget.cpp
Show inline comments
 
@@ -68,18 +68,28 @@ void CommandWidget::onSendClicked()
 
            int textSize = ui->leCommand->text().size();
 
            ui->leCommand->setSelection(textSize-1, textSize);
 
            return;
 
        }
 
    }
 

	
 
    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();
 
}
commandwidget.h
Show inline comments
 
@@ -37,21 +37,24 @@ public:
 

	
 
signals:
 
    void deleteRequested(CommandWidget* thisWidget); // emitted when delete button is clicked
 

	
 
    // emitted when send button is clicked
 
    //
 
    // in case of hex mode, command text should be a hexadecimal
 
    // string containing hexadecimal characters only (not even spaces)
 
    void sendCommand(QString command, bool ascii);
 

	
 
private:
 
    Ui::CommandWidget *ui;
 
    QString storedAsciiText;
 
    QString storedHexText;
 

	
 
    bool isASCIIMode(); // true: ascii mode, false hex mode
 

	
 
private slots:
 
    void onDeleteClicked();
 
    void onSendClicked();
 
    void onASCIIToggled(bool checked);
 
};
 

	
 
#endif // COMMANDWIDGET_H
0 comments (0 inline, 0 general)