整理代码

This commit is contained in:
woohii 2019-05-07 16:47:08 +08:00
parent 8a40c44aef
commit 4b9106d7f0
5 changed files with 448 additions and 297 deletions

View File

@ -96,7 +96,7 @@ INCLUDEPATH += \
RESOURCES += \
SAKResources.qrc \
Libs/StyleSheet/qss.qrc
3rd/StyleSheet/qss.qrc
win32{
RC_ICONS = window.ico
@ -129,7 +129,7 @@ UI_DIR = $$OUT_PWD/ui
#--------------------------------------------------------------------------------------------
# 子项目
include(SAKTools.pri)
include(Src/Modules/SAKTools.pri)
# 取消该宏的定义可以将串口模块屏蔽
winrt || arm-linux{

View File

@ -1,7 +1,9 @@
v1.2.3
v1.3.0
01. 添加终端输出页面,用于查看内部输出信息
02. 添加新建设备页面功能
03. 添加新建设备窗口功能
03. 添加新建设备窗口功能
04. crc计算器添加更多的crc标准参数模型
05. 内部功能优化
v1.2.2 2019年04月19日
01. 优化高亮设置ui交互

View File

@ -18,6 +18,8 @@
#include <QPixmap>
#include <QSettings>
#include <QKeyEvent>
#include <QMetaEnum>
#include <QLoggingCategory>
#include "SAKIODeviceWidget.hh"
#include "SAKHighlighterSettingPanel.hh"
@ -25,22 +27,23 @@
#include "ui_SAKIODeviceWidget.h"
SAKIODeviceWidget::SAKIODeviceWidget(SAKIODevice *_device, SAKIODeviceControler *_controler, QWidget *parent)
:QWidget(parent)
,device(_device)
,controler(_controler)
,autoResponseSettingPanel(new SAKAutoResponseSettingPanel)
,cycleTimer(new QTimer)
,customControlerLayout(new QHBoxLayout)
,delayTimer(new QTimer)
,ui(new Ui::SAKIODeviceWidget)
,clearInfoTimer(new QTimer)
:QWidget (parent)
,device (_device)
,controler (_controler)
,autoResponseSettingPanel (new SAKAutoResponseSettingPanel)
,cycleTimer (new QTimer)
,customControlerLayout (new QHBoxLayout)
,delayTimer (new QTimer)
,ui (new Ui::SAKIODeviceWidget)
,clearInfoTimer (new QTimer)
{
ui->setupUi(this);
initUiPointer();
inputTextModelComboBox = ui->comboBoxInputMode;
outputTextModelComboBox = ui->comboBoxOutputMode;
inputTextModelComboBox = inputModelComboBox;
outputTextModelComboBox = outputModelComboBox;
rwParameterSettingButton = ui->pushButtonRWParameter;
rwParameterSettingButton = readWriteSettingPushButton;
/// 初始化输入输出模式
@ -53,8 +56,8 @@ SAKIODeviceWidget::SAKIODeviceWidget(SAKIODevice *_device, SAKIODeviceControler
}
/// 初始化数据成员
highlighterSettingButton = ui->pushButtonHighlighting;
highlighterSettingPanel = new SAKHighlighterSettingPanel(ui->textBrowserOutputData->document());
highlighterSettingButton = highlightSettingPushButton;
highlighterSettingPanel = new SAKHighlighterSettingPanel(outputTextBroswer->document());
Connect();
setCustomControler(controler);
@ -67,22 +70,23 @@ SAKIODeviceWidget::SAKIODeviceWidget(SAKIODevice *_device, SAKIODeviceControler
SAKIODeviceWidget::~SAKIODeviceWidget()
{
delete ui;
delete logCategory;
}
void SAKIODeviceWidget::initUI()
{
ui->checkBoxOutputMS->setEnabled(true);
ui->checkBoxOutputDate->setChecked(false);
ui->checkBoxOutputTime->setChecked(true);
ui->lineEditCycleTime->setValidator(new QIntValidator(10, 24*60*60*1000, ui->lineEditCycleTime));
showMsCheckBox->setEnabled(true);
showDateCheckBox->setChecked(false);
showTimeCheckBox->setChecked(true);
cycleTimeLineEdit->setValidator(new QIntValidator(10, 24*60*60*1000, cycleTimeLineEdit));
ui->lineEditBytesDelayTime->setValidator(new QIntValidator(10, 24*60*60*1000, ui->lineEditBytesDelayTime));
#if 0 /// 按钮图标
ui->pushButtonClearInput->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogResetButton));
ui->pushButtonClearOutput->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogResetButton));
ui->pushButtonReadInFile->setIcon(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon));
ui->pushButtonSaveOutput->setIcon(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon));
ui->pushButtonRefresh->setIcon(QApplication::style()->standardIcon(QStyle::SP_BrowserReload));
clearInputPushButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogResetButton));
clearOutputPushButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_DialogResetButton));
readinFilePushButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon));
saveOutputPushButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon));
refreshPushButton->setIcon(QApplication::style()->standardIcon(QStyle::SP_BrowserReload));
#endif
readOutputMode();
@ -91,43 +95,43 @@ void SAKIODeviceWidget::initUI()
readDelayTime();
readAutoResponseFlag();
ui->labelRX->setPixmap(QPixmap(":/images/RtRxGray.png").scaled(rxtxSize, Qt::KeepAspectRatio));
ui->labelTX->setPixmap(QPixmap(":/images/RtRxGray.png").scaled(rxtxSize, Qt::KeepAspectRatio));
rxLabel->setPixmap(QPixmap(":/images/RtRxGray.png").scaled(rxtxSize, Qt::KeepAspectRatio));
txLabel->setPixmap(QPixmap(":/images/RtRxGray.png").scaled(rxtxSize, Qt::KeepAspectRatio));
ui->labelInfoIcon->setPixmap(QPixmap(":/images/Info.png").scaled(QSize(ui->labelInfoIcon->width()-4,
ui->labelInfoIcon->height() - 4),
Qt::KeepAspectRatio));
ui->textBrowserOutputData->setLineWrapMode(QTextEdit::WidgetWidth);
outputTextBroswer->setLineWrapMode(QTextEdit::WidgetWidth);
}
void SAKIODeviceWidget::outputTimeInfoCheckBoxClicked(bool checked)
{
if (checked){
ui->checkBoxOutputMS->setEnabled(true);
showMsCheckBox->setEnabled(true);
}else {
ui->checkBoxOutputMS->setChecked(false);
ui->checkBoxOutputMS->setEnabled(false);
showMsCheckBox->setChecked(false);
showMsCheckBox->setEnabled(false);
}
}
void SAKIODeviceWidget::outputReceiveDataOnlyCheckBoxClicked(bool cheaked)
{
ui->textBrowserOutputData->clear();
outputTextBroswer->clear();
if (cheaked){
ui->checkBoxOutputDate->setChecked(false);
ui->checkBoxOutputDate->setEnabled(false);
ui->checkBoxOutputTime->setChecked(false);
ui->checkBoxOutputTime->setEnabled(false);
ui->checkBoxOutputMS->setChecked(false);
ui->checkBoxOutputMS->setEnabled(false);
showDateCheckBox->setChecked(false);
showDateCheckBox->setEnabled(false);
showTimeCheckBox->setChecked(false);
showTimeCheckBox->setEnabled(false);
showMsCheckBox->setChecked(false);
showMsCheckBox->setEnabled(false);
}else{
ui->checkBoxOutputDate->setChecked(false);
ui->checkBoxOutputDate->setEnabled(true);
ui->checkBoxOutputTime->setChecked(true);
ui->checkBoxOutputTime->setEnabled(true);
ui->checkBoxOutputMS->setChecked(false);
ui->checkBoxOutputMS->setEnabled(true);
showDateCheckBox->setChecked(false);
showDateCheckBox->setEnabled(true);
showTimeCheckBox->setChecked(true);
showTimeCheckBox->setEnabled(true);
showMsCheckBox->setChecked(false);
showMsCheckBox->setEnabled(true);
}
}
@ -149,13 +153,13 @@ void SAKIODeviceWidget::setCustomControler(SAKIODeviceControler *controler)
void SAKIODeviceWidget::setRefreshPBtText(QString text)
{
ui->pushButtonRefresh->setText(text);
refreshPushButton->setText(text);
}
void SAKIODeviceWidget::Connect()
{
/// 打开/关闭设备
connect(ui->pushButtonOpen, SIGNAL(clicked(bool)), this, SLOT(openOrClose()));
connect(switchPushButton, SIGNAL(clicked(bool)), this, SLOT(openOrClose()));
connect(this, SIGNAL(need2open()), controler, SLOT(open()));
connect(this, SIGNAL(need2close()), device, SLOT(close()));
connect(controler, SIGNAL(need2open(QString,QString)), device, SLOT(open(QString,QString)));
@ -165,33 +169,31 @@ void SAKIODeviceWidget::Connect()
connect(device, SIGNAL(deviceCloseSuccessfully()), this, SLOT(afterDeviceClose()));
/// 刷新设备
connect(ui->pushButtonRefresh, SIGNAL(clicked(bool)), controler, SLOT(refresh()));
connect(refreshPushButton, SIGNAL(clicked(bool)), controler, SLOT(refresh()));
connect(cycleTimer, SIGNAL(timeout()), this, SLOT(cycleTimerTimeout()));
connect(delayTimer, SIGNAL(timeout()), this, SLOT(delayTimerTimeout()));
connect(ui->checkBoxCycle, SIGNAL(clicked(bool)), this, SLOT(checkedBoxCycleClicked(bool)));
connect(cycleEnableCheckBox, SIGNAL(clicked(bool)), this, SLOT(checkedBoxCycleClicked(bool)));
connect(ui->checkBoxBytesDelay, SIGNAL(clicked(bool)), this, SLOT(checkedBoxDelayClicked(bool)));
connect(device, SIGNAL(errorStr(QString)), this, SLOT(outputErrorString(QString)));
connect(device, SIGNAL(infoStr(QString)), this, SLOT(outputInformationString(QString)));
connect(ui->textEditInputData, SIGNAL(textChanged()), this, SLOT(textFormatControl()));
connect(ui->pushButtonReadInFile, SIGNAL(clicked(bool)), this, SLOT(openFile()));
connect(ui->pushButtonSaveOutput, SIGNAL(clicked(bool)), this, SLOT(saveOutputData()));
connect(inputTextEdit, SIGNAL(textChanged()), this, SLOT(textFormatControl()));
connect(readinFilePushButton, SIGNAL(clicked(bool)), this, SLOT(openFile()));
connect(ui->checkBoxOutputTime, SIGNAL(clicked(bool)), this, SLOT(outputTimeInfoCheckBoxClicked(bool)));
connect(ui->checkBoxOutputReceiveDataOnly, SIGNAL(clicked(bool)), this, SLOT(outputReceiveDataOnlyCheckBoxClicked(bool)));
connect(showTimeCheckBox, SIGNAL(clicked(bool)), this, SLOT(outputTimeInfoCheckBoxClicked(bool)));
/// 数据收发
connect(ui->pushButtonSendData, SIGNAL(clicked(bool)), this, SLOT(writeBytes()));
connect(sendPushButton, SIGNAL(clicked(bool)), this, SLOT(writeBytes()));
connect(this, SIGNAL(need2writeBytes(QByteArray)), device, SLOT(writeBytes(QByteArray)));
connect(device, SIGNAL(bytesRead(QByteArray)), this, SLOT(bytesRead(QByteArray)));
connect(device, SIGNAL(bytesWritten(QByteArray)), this, SLOT(bytesWritten(QByteArray)));
/// 重置收发计数
connect(ui->pushButtonResetReceiveDataCount, SIGNAL(clicked(bool)), this, SLOT(resetReceiveDataCount()));
connect(ui->pushButtonResetSendDataCount, SIGNAL(clicked(bool)), this, SLOT(resetSendDataCount()));
connect(resetRxCountPushButton, SIGNAL(clicked(bool)), this, SLOT(resetReceiveDataCount()));
connect(resetTxCountPushButton, SIGNAL(clicked(bool)), this, SLOT(resetSendDataCount()));
/// 循环周期
connect(ui->lineEditCycleTime, SIGNAL(textChanged(QString)), this, SLOT(setCycleTime(QString)));
connect(cycleTimeLineEdit, SIGNAL(textChanged(QString)), this, SLOT(setCycleTime(QString)));
/// 字节间延时
connect(ui->lineEditBytesDelayTime, SIGNAL(textChanged(QString)), this, SLOT(setDelayTime(QString)));
@ -200,15 +202,15 @@ void SAKIODeviceWidget::Connect()
connect(device, SIGNAL(bytesWritten(QByteArray)), this, SLOT(updateTxImage()));
/// 文本模式
connect(ui->comboBoxInputMode, SIGNAL(currentTextChanged(QString)), this , SLOT(setInputMode(QString)));
connect(ui->comboBoxOutputMode, SIGNAL(currentTextChanged(QString)), this, SLOT(setOutputMode(QString)));
connect(inputModelComboBox, SIGNAL(currentTextChanged(QString)), this , SLOT(setInputMode(QString)));
connect(outputModelComboBox, SIGNAL(currentTextChanged(QString)), this, SLOT(setOutputMode(QString)));
/// 循环发送与字节间延时发送
connect(ui->checkBoxBytesDelay, SIGNAL(clicked(bool)), this, SLOT(cancleCycle()));
connect(ui->checkBoxCycle, SIGNAL(clicked(bool)), this, SLOT(cancleBytesDelay()));
connect(cycleEnableCheckBox, SIGNAL(clicked(bool)), this, SLOT(cancleBytesDelay()));
/// 弹出自动回复设置面板
connect(ui->pushButtonAutoRespone, SIGNAL(clicked(bool)), autoResponseSettingPanel, SLOT(show()));
connect(autoResponseSettingPushButton, SIGNAL(clicked(bool)), autoResponseSettingPanel, SLOT(show()));
/// 自动回复
connect(autoResponseSettingPanel, SIGNAL(autoResponseFlagChanged(bool)), this, SLOT(setAutoResponseFlag(bool)));
@ -226,26 +228,26 @@ void SAKIODeviceWidget::Connect()
void SAKIODeviceWidget::afterDeviceOpen()
{
controler->afterDeviceOpen();
ui->pushButtonRefresh->setEnabled(false);
ui->pushButtonOpen->setText(tr("关闭"));
refreshPushButton->setEnabled(false);
switchPushButton->setText(tr("关闭"));
}
void SAKIODeviceWidget::afterDeviceClose()
{
controler->afterDeviceClose();
ui->pushButtonRefresh->setEnabled(true);
ui->pushButtonOpen->setText(tr("打开"));
refreshPushButton->setEnabled(true);
switchPushButton->setText(tr("打开"));
if (cycleTimer->isActive()){
cycleTimer->stop();
ui->pushButtonSendData->setEnabled(true);
ui->lineEditCycleTime->setEnabled(true);
sendPushButton->setEnabled(true);
cycleTimeLineEdit->setEnabled(true);
}
if (delayTimer->isActive()){
delayTimer->stop();
ui->pushButtonSendData->setEnabled(true);
ui->lineEditCycleTime->setEnabled(true);
sendPushButton->setEnabled(true);
cycleTimeLineEdit->setEnabled(true);
}
}
@ -284,15 +286,15 @@ void SAKIODeviceWidget::writeBytes()
{
QString tipStr = tr("设备未就绪,本次发送操作取消!");
if (ui->checkBoxCycle->isChecked()){
if (cycleEnableCheckBox->isChecked()){
if (device->isOpen()){
qlonglong cycleTime = ui->lineEditCycleTime->text().toLongLong();
qlonglong cycleTime = cycleTimeLineEdit->text().toLongLong();
if (cycleTime == 0){
cycleTime = 1000;
}
cycleTimer->start(static_cast<int>(cycleTime));
ui->pushButtonSendData->setEnabled(false);
ui->lineEditCycleTime->setEnabled(false);
sendPushButton->setEnabled(false);
cycleTimeLineEdit->setEnabled(false);
}else {
outputInfo(tipStr, "red");
}
@ -311,8 +313,8 @@ void SAKIODeviceWidget::writeBytes()
delayTime = 1000;
}
delayTimer->start(static_cast<int>(delayTime));
ui->pushButtonSendData->setEnabled(false);
ui->lineEditCycleTime->setEnabled(false);
sendPushButton->setEnabled(false);
cycleTimeLineEdit->setEnabled(false);
}
}else {
outputInfo(tipStr, "red");
@ -332,8 +334,8 @@ void SAKIODeviceWidget::checkedBoxCycleClicked(bool checked)
}else{
cycleTimer->stop();
ui->pushButtonSendData->setEnabled(true);
ui->lineEditCycleTime->setEnabled(true);
sendPushButton->setEnabled(true);
cycleTimeLineEdit->setEnabled(true);
}
}
@ -343,8 +345,8 @@ void SAKIODeviceWidget::checkedBoxDelayClicked(bool checked)
}else {
delayTimer->stop();
ui->pushButtonSendData->setEnabled(true);
ui->lineEditCycleTime->setEnabled(true);
sendPushButton->setEnabled(true);
cycleTimeLineEdit->setEnabled(true);
}
}
@ -363,8 +365,8 @@ void SAKIODeviceWidget::delayTimerTimeout()
if (device->isOpen()){
if (dataTemp.isEmpty()){
delayTimer->stop();
ui->pushButtonSendData->setEnabled(true);
ui->lineEditCycleTime->setEnabled(true);
sendPushButton->setEnabled(true);
cycleTimeLineEdit->setEnabled(true);
}else {
QByteArray array;
array[0] = dataTemp.at(0);
@ -372,8 +374,8 @@ void SAKIODeviceWidget::delayTimerTimeout()
dataTemp.remove(0, 1);
if (dataTemp.isEmpty()){
delayTimer->stop();
ui->pushButtonSendData->setEnabled(true);
ui->lineEditCycleTime->setEnabled(true);
sendPushButton->setEnabled(true);
cycleTimeLineEdit->setEnabled(true);
}
}
}else {
@ -389,14 +391,14 @@ void SAKIODeviceWidget::cancleBytesDelay()
void SAKIODeviceWidget::cancleCycle()
{
ui->checkBoxCycle->setChecked(false);
cycleEnableCheckBox->setChecked(false);
}
QByteArray SAKIODeviceWidget::dataBytes()
{
QByteArray data;
QString str = ui->textEditInputData->toPlainText();
QString str = inputTextEdit->toPlainText();
if (str.isEmpty()){
str = "(null)";
data = str.toLatin1();
@ -424,9 +426,9 @@ QByteArray SAKIODeviceWidget::dataBytes()
data.append(static_cast<int8_t>(QString(str).toInt(nullptr, 16)));
}
}else if (inputTextMode.compare(QString(textModel.valueToKey(Ascii))) == 0){
data = ui->textEditInputData->toPlainText().toLatin1();
data = inputTextEdit->toPlainText().toLatin1();
}else if (inputTextMode.compare(QString(textModel.valueToKey(Local8bit))) == 0){
data = ui->textEditInputData->toPlainText().toLocal8Bit();
data = inputTextEdit->toPlainText().toLocal8Bit();
}else {
Q_ASSERT_X(false, __FUNCTION__, "Unknow input mode");
}
@ -436,10 +438,10 @@ QByteArray SAKIODeviceWidget::dataBytes()
void SAKIODeviceWidget::textFormatControl()
{
disconnect(ui->textEditInputData, SIGNAL(textChanged()), this, SLOT(textFormatControl()));
QString plaintext = ui->textEditInputData->toPlainText();
disconnect(inputTextEdit, SIGNAL(textChanged()), this, SLOT(textFormatControl()));
QString plaintext = inputTextEdit->toPlainText();
if (plaintext.isEmpty()){
connect(ui->textEditInputData, SIGNAL(textChanged()), this, SLOT(textFormatControl()));
connect(inputTextEdit, SIGNAL(textChanged()), this, SLOT(textFormatControl()));
return;
}else {
if (inputTextMode.compare(QString(textModel.valueToKey(Bin))) == 0){
@ -451,8 +453,8 @@ void SAKIODeviceWidget::textFormatControl()
}
strTemp.append(plaintext.at(i));
}
ui->textEditInputData->setText(strTemp);
ui->textEditInputData->moveCursor(QTextCursor::End);
inputTextEdit->setText(strTemp);
inputTextEdit->moveCursor(QTextCursor::End);
}else if(inputTextMode.compare(QString(textModel.valueToKey(Oct))) == 0) {
QString strTemp;
plaintext.remove(QRegExp("[^0-7]"));
@ -462,8 +464,8 @@ void SAKIODeviceWidget::textFormatControl()
}
strTemp.append(plaintext.at(i));
}
ui->textEditInputData->setText(strTemp);
ui->textEditInputData->moveCursor(QTextCursor::End);
inputTextEdit->setText(strTemp);
inputTextEdit->moveCursor(QTextCursor::End);
}else if(inputTextMode.compare(QString(textModel.valueToKey(Dec))) == 0) {
QString strTemp;
plaintext.remove(QRegExp("[^0-9]"));
@ -473,8 +475,8 @@ void SAKIODeviceWidget::textFormatControl()
}
strTemp.append(plaintext.at(i));
}
ui->textEditInputData->setText(strTemp);
ui->textEditInputData->moveCursor(QTextCursor::End);
inputTextEdit->setText(strTemp);
inputTextEdit->moveCursor(QTextCursor::End);
}else if(inputTextMode.compare(QString(textModel.valueToKey(Hex))) == 0) {
QString strTemp;
plaintext.remove(QRegExp("[^0-9a-fA-F]"));
@ -484,30 +486,30 @@ void SAKIODeviceWidget::textFormatControl()
}
strTemp.append(plaintext.at(i));
}
ui->textEditInputData->setText(strTemp.toUpper());
ui->textEditInputData->moveCursor(QTextCursor::End);
inputTextEdit->setText(strTemp.toUpper());
inputTextEdit->moveCursor(QTextCursor::End);
}else if(inputTextMode.compare(QString(textModel.valueToKey(Ascii))) == 0) {
plaintext.remove(QRegExp("[^\0u00-\u007f ]"));
ui->textEditInputData->setText(plaintext);
ui->textEditInputData->moveCursor(QTextCursor::End);
inputTextEdit->setText(plaintext);
inputTextEdit->moveCursor(QTextCursor::End);
}else if(inputTextMode.compare(QString(textModel.valueToKey(Local8bit))) == 0) {
/// nothing to do
}else {
Q_ASSERT_X(false, __FUNCTION__, "Unknow output mode");
}
}
connect(ui->textEditInputData, SIGNAL(textChanged()), this, SLOT(textFormatControl()));
connect(inputTextEdit, SIGNAL(textChanged()), this, SLOT(textFormatControl()));
}
void SAKIODeviceWidget::bytesRead(QByteArray data)
{
/// 更新接收统计
qlonglong receiveFrameCount = ui->labelReceiveFrames->text().toLongLong();
qlonglong receiveFrameCount = rxFramesLabel->text().toLongLong();
receiveFrameCount += 1;
ui->labelReceiveFrames->setText(QString::number(receiveFrameCount));
qlonglong receiveBytesCount = ui->labelReceiveBytes->text().toLongLong();
rxFramesLabel->setText(QString::number(receiveFrameCount));
qlonglong receiveBytesCount = rxBytesLabel->text().toLongLong();
receiveBytesCount += data.length();
ui->labelReceiveBytes->setText(QString::number(receiveBytesCount));
rxBytesLabel->setText(QString::number(receiveBytesCount));
refreshOutputData(data, true);
}
@ -519,7 +521,7 @@ void SAKIODeviceWidget::openFile()
QFile file(fileName);
if(file.open(QFile::ReadOnly)){
QByteArray data = file.readAll();
ui->textEditInputData->setText(QString(data).toUtf8());
inputTextEdit->setText(QString(data).toUtf8());
file.close();
}else{
qWarning() << QString("%1 %2").arg(tr("无法打开文件")).arg(fileName);
@ -527,51 +529,37 @@ void SAKIODeviceWidget::openFile()
}
}
void SAKIODeviceWidget::saveOutputData()
{
QString outFileName = QFileDialog::getSaveFileName();
QFile outFile(outFileName);
outFile.open(QIODevice::WriteOnly|QIODevice::Text);
QTextStream outStream(&outFile);
outStream << ui->textBrowserOutputData->toPlainText();
outFile.flush();
outFile.close();
}
void SAKIODeviceWidget::bytesWritten(QByteArray data)
{
qlonglong writeBytes = ui->labelSendBytes->text().toLongLong();
qlonglong writeBytes = txBytesLabel->text().toLongLong();
writeBytes += data.length();
ui->labelSendBytes->setText(QString::number(writeBytes));
txBytesLabel->setText(QString::number(writeBytes));
qlonglong writeFrame = ui->labelSendFrames->text().toLongLong();
qlonglong writeFrame = txFramesLabel->text().toLongLong();
writeFrame += 1;
ui->labelSendFrames->setText(QString::number(writeFrame));
txFramesLabel->setText(QString::number(writeFrame));
refreshOutputData(data, false);
}
void SAKIODeviceWidget::refreshOutputData(QByteArray &data, bool isReceivedData)
{
if (ui->checkBoxPause->isChecked()){
return;
}
// if (ui->checkBoxPause->isChecked()){
// return;
// }
QString str;
if (!ui->checkBoxOutputReceiveDataOnly->isChecked()){
str.append("[");
}
// if (!ui->checkBoxOutputReceiveDataOnly->isChecked()){
// str.append("[");
// }
if (ui->checkBoxOutputDate->isChecked()){
if (showDateCheckBox->isChecked()){
str.append(QDate::currentDate().toString("yyyy/MM/dd "));
str = QString("<font color=silver>%1</font>").arg(str);
}
if (ui->checkBoxOutputTime->isChecked()){
if (ui->checkBoxOutputMS->isChecked()){
if (showTimeCheckBox->isChecked()){
if (showMsCheckBox->isChecked()){
str.append(QTime::currentTime().toString("hh:mm:ss.z "));
}else {
str.append(QTime::currentTime().toString("hh:mm:ss "));
@ -579,16 +567,16 @@ void SAKIODeviceWidget::refreshOutputData(QByteArray &data, bool isReceivedData)
str = QString("<font color=silver>%1</font>").arg(str);
}
if (!ui->checkBoxOutputReceiveDataOnly->isChecked()){
if (isReceivedData){
str.append("<font color=blue>Rx</font>");
}else {
str.append("<font color=purple>Tx</font>");
}
str.append("<font color=silver>] </font>");
}
// if (!ui->checkBoxOutputReceiveDataOnly->isChecked()){
// if (isReceivedData){
// str.append("<font color=blue>Rx</font>");
// }else {
// str.append("<font color=purple>Tx</font>");
// }
// str.append("<font color=silver>] </font>");
// }
outputTextMode = ui->comboBoxOutputMode->currentText();
outputTextMode = outputModelComboBox->currentText();
if (outputTextMode.compare(QString(textModel.valueToKey(Bin))) == 0){
for (int i = 0; i < data.length(); i++){
str.append(QString("%1 ").arg(QString::number(static_cast<uint8_t>(data.at(i)), 2), 8, '0'));
@ -613,34 +601,34 @@ void SAKIODeviceWidget::refreshOutputData(QByteArray &data, bool isReceivedData)
Q_ASSERT_X(false, __FUNCTION__, "Unknow output mode");
}
if (ui->checkBoxOutputReceiveDataOnly->isChecked()){
if (!isReceivedData){
return;
}
// if (ui->checkBoxOutputReceiveDataOnly->isChecked()){
// if (!isReceivedData){
// return;
// }
/**
*
**/
if (!ui->textBrowserOutputData->toPlainText().isEmpty()){
str = ui->textBrowserOutputData->toPlainText() + " " + str;
}
ui->textBrowserOutputData->setText(QString("<font color=blue>%1</font>").arg(str));
ui->textBrowserOutputData->verticalScrollBar()->setSliderPosition(ui->textBrowserOutputData->verticalScrollBar()->maximum());
}else {
ui->textBrowserOutputData->append(str);
}
// /**
// * 以下这种追加文本的方式存在问题,在文本较多,追加频繁时,界面卡顿。
// **/
// if (!outputTextBroswer->toPlainText().isEmpty()){
// str = outputTextBroswer->toPlainText() + " " + str;
// }
// outputTextBroswer->setText(QString("<font color=blue>%1</font>").arg(str));
// outputTextBroswer->verticalScrollBar()->setSliderPosition(outputTextBroswer->verticalScrollBar()->maximum());
// }else {
// outputTextBroswer->append(str);
// }
}
void SAKIODeviceWidget::resetSendDataCount()
{
ui->labelSendBytes->setText("0");
ui->labelSendFrames->setText("0");
txBytesLabel->setText("0");
txFramesLabel->setText("0");
}
void SAKIODeviceWidget::resetReceiveDataCount()
{
ui->labelReceiveBytes->setText("0");
ui->labelReceiveFrames->setText("0");
rxBytesLabel->setText("0");
rxFramesLabel->setText("0");
}
void SAKIODeviceWidget::setOutputMode(QString mode)
@ -659,7 +647,7 @@ void SAKIODeviceWidget::readOutputMode()
value = QString(textModel.valueToKey(Ascii));
}
ui->comboBoxOutputMode->setCurrentText(value);
outputModelComboBox->setCurrentText(value);
}
void SAKIODeviceWidget::setInputMode(QString mode)
@ -682,16 +670,16 @@ void SAKIODeviceWidget::readInputMode()
inputTextMode = value;
textFormatControl();
ui->comboBoxInputMode->setCurrentText(value);
inputModelComboBox->setCurrentText(value);
}
void SAKIODeviceWidget::updateTxImage()
{
static bool b = false;
if (b){
ui->labelTX->setPixmap(QPixmap(":/images/RtRxGray.png").scaled(rxtxSize, Qt::KeepAspectRatio));
txLabel->setPixmap(QPixmap(":/images/RtRxGray.png").scaled(rxtxSize, Qt::KeepAspectRatio));
}else{
ui->labelTX->setPixmap(QPixmap(":/images/RtRxRed.png").scaled(rxtxSize, Qt::KeepAspectRatio));
txLabel->setPixmap(QPixmap(":/images/RtRxRed.png").scaled(rxtxSize, Qt::KeepAspectRatio));
}
b = !b;
@ -701,9 +689,9 @@ void SAKIODeviceWidget::updateRxImage()
{
static bool b = false;
if (b){
ui->labelRX->setPixmap(QPixmap(":/images/RtRxGray.png").scaled(rxtxSize, Qt::KeepAspectRatio));
rxLabel->setPixmap(QPixmap(":/images/RtRxGray.png").scaled(rxtxSize, Qt::KeepAspectRatio));
}else{
ui->labelRX->setPixmap(QPixmap(":/images/RtRxRed.png").scaled(rxtxSize, Qt::KeepAspectRatio));
rxLabel->setPixmap(QPixmap(":/images/RtRxRed.png").scaled(rxtxSize, Qt::KeepAspectRatio));
}
b = !b;
@ -735,7 +723,7 @@ void SAKIODeviceWidget::readCycleTime()
QString option = QString("CycleTime");
QString value = readSetting(option);
ui->lineEditCycleTime->setText(value);
cycleTimeLineEdit->setText(value);
}
void SAKIODeviceWidget::setAutoResponseFlag(bool enableAutoResponse)
@ -800,71 +788,179 @@ void SAKIODeviceWidget::initUiPointer()
/*
*
*/
refreshPushButton = ui->pushButtonRefresh;
switchPushButton = ui->pushButtonOpen;
rxLabel = ui->labelRX;
txLabel = ui->labelTX;
refreshPushButton = ui->refreshPushButton;
switchPushButton = ui->switchPushButton;
rxLabel = ui->rxLabel;
txLabel = ui->txLabel;
/*
*
*/
inputModelComboBox = ui->comboBoxInputMode;
cycleEnableCheckBox = ui->checkBoxCycle;
cycleTimeLineEdit = ui->lineEditCycleTime;
readinFilePushButton = ui->pushButtonReadInFile;
clearInputPushButton = ui->pushButtonClearInput;
sendPushButton = ui->pushButtonSendData;
inputTextEdit = ui->textEditInputData;
inputModelComboBox = ui->inputModelComboBox;
cycleEnableCheckBox = ui->cycleEnableCheckBox;
cycleTimeLineEdit = ui->cycleTimeLineEdit;
readinFilePushButton = ui->readinFilePushButton;
clearInputPushButton = ui->clearInputPushButton;
sendPushButton = ui->sendPushButton;
inputTextEdit = ui->inputTextEdit;
/*
*
*/
outputModelComboBox = ui->comboBoxOutputMode;
showDateCheckBox = ui->checkBoxOutputDate;
showTimeCheckBox = ui->checkBoxOutputTime;
showMsCheckBox = ui->checkBoxOutputMS;
// showRxDataCheckBox = ui->checkBoxShowRxOutput;
// showTxDataCheckBox = ui->checkBoxShowTxOutput;
clearOutputPushButton = ui->pushButtonClearOutput;
saveOutputPushButton = ui->pushButtonSaveOutput;
outputTextBroswer = ui->textBrowserOutputData;
outputModelComboBox = ui->outputModelComboBox;
autoWrapCheckBox = ui->autoWrapCheckBox;
showDateCheckBox = ui->showDateCheckBox;
showTimeCheckBox = ui->showTimeCheckBox;
showMsCheckBox = ui->showMsCheckBox;
showRxDataCheckBox = ui->showRxDataCheckBox;
showTxDataCheckBox = ui->showTxDataCheckBox;
clearOutputPushButton = ui->clearOutputPushButton;
saveOutputPushButton = ui->saveOutputPushButton;
outputTextBroswer = ui->outputTextBroswer;
/*
*
*/
rxFramesLabel = ui->labelReceiveFrames;
txFramesLabel = ui->labelSendFrames;
rxBytesLabel = ui->labelReceiveBytes;
txBytesLabel = ui->labelSendBytes;
resetRxCountPushButton = ui->pushButtonResetReceiveDataCount;
resetTxCountPushButton = ui->pushButtonResetSendDataCount;
rxFramesLabel = ui->rxFramesLabel;
txFramesLabel = ui->txFramesLabel;
rxBytesLabel = ui->rxBytesLabel;
txBytesLabel = ui->txBytesLabel;
resetRxCountPushButton = ui->resetRxCountPushButton;
resetTxCountPushButton = ui->resetTxCountPushButton;
/*
*
*/
autoResponseSettingPushButton = ui->pushButtonAutoRespone;
highlightSettingPushButton = ui->pushButtonHighlighting;
readWriteSettingPushButton = ui->pushButtonRWParameter;
connect(autoResponseSettingPushButton, &QPushButton::clicked, this, &SAKIODeviceWidget::createAutoResponseSettingWindow);
connect(highlightSettingPushButton, &QPushButton::clicked, this, &SAKIODeviceWidget::createHighlightSettingWindow);
connect(readWriteSettingPushButton, &QPushButton::clicked, this, &SAKIODeviceWidget::createReadWriteSettingWindow);
autoResponseSettingPushButton = ui->autoResponseSettingPushButton;
highlightSettingPushButton = ui->highlightSettingPushButton;
readWriteSettingPushButton = ui->readWriteSettingPushButton;
}
void SAKIODeviceWidget::createAutoResponseSettingWindow()
void SAKIODeviceWidget::on_autoResponseSettingPushButton_clicked()
{
SAKAutoResponseSettingPanel *window = new SAKAutoResponseSettingPanel(this);
window->show();
}
void SAKIODeviceWidget::createHighlightSettingWindow()
void SAKIODeviceWidget::on_highlightSettingPushButton_clicked()
{
SAKHighlighterSettingPanel *window = new SAKHighlighterSettingPanel(outputTextBroswer->document(), this);
window->show();
}
void SAKIODeviceWidget::createReadWriteSettingWindow()
void SAKIODeviceWidget::on_readWriteSettingPushButton()
{
SAKReadWriteSetting *window = new SAKReadWriteSetting(this);
window->show();
}
void SAKIODeviceWidget::on_resetRxCountPushButton_clicked()
{
receiveFrames = 0;
setLabelText(rxFramesLabel, receiveFrames);
receiveBytes = 0;
setLabelText(rxBytesLabel, receiveBytes);
}
void SAKIODeviceWidget::on_resetTxCountPushButton_clicked()
{
sendFrames = 0;
setLabelText(txFramesLabel, sendFrames);
sendBytes = 0;
setLabelText(txFramesLabel, sendBytes);
}
void SAKIODeviceWidget::setLabelText(QLabel *label, quint64 text)
{
label->setText(QString::number(text));
}
void SAKIODeviceWidget::on_outputModelComboBox_currentIndexChanged(const QString &text)
{
QMetaEnum model = QMetaEnum::fromType<TextDisplayModel>();
bool ok = false;
int ret = model.keyToValue(text.toLatin1().data(), &ok);
if (ok){
outputTextModel = static_cast<TextDisplayModel>(ret);
}else{
QLoggingCategory category(logCategory);
qCWarning(category) << "Output text model error!";
}
}
void SAKIODeviceWidget::on_showDateCheckBox_clicked()
{
if (showDateCheckBox->isChecked()) {
showDate = true;
}else{
showDate = false;
}
}
void SAKIODeviceWidget::on_autoWrapCheckBox_clicked()
{
if (autoWrapCheckBox->isChecked()){
autoWrap = true;
}else{
autoWrap = false;
}
}
void SAKIODeviceWidget::on_showTimeCheckBox_clicked()
{
if (showTimeCheckBox->isChecked()){
showTime = true;
}else{
showTime = false;
}
}
void SAKIODeviceWidget::on_showMsCheckBox_clicked()
{
if (showMsCheckBox->isChecked()){
showMS = true;
}else{
showMS = false;
}
}
void SAKIODeviceWidget::on_showRxDataCheckBox_clicked()
{
if (showRxDataCheckBox->isChecked()){
showRxData = true;
}else{
showRxData = false;
}
}
void SAKIODeviceWidget::on_showTxDataCheckBox_clicked()
{
if (showTxDataCheckBox->isChecked()){
showTxData = true;
}else {
showTxData = false;
}
}
void SAKIODeviceWidget::on_clearOutputPushButton_clicked()
{
outputTextBroswer->clear();
}
void SAKIODeviceWidget::on_saveOutputPushButton_clicked()
{
QString outFileName = QFileDialog::getSaveFileName();
QFile outFile(outFileName);
if(outFile.open(QIODevice::WriteOnly|QIODevice::Text)){
QTextStream outStream(&outFile);
outStream << outputTextBroswer->toPlainText();
outFile.flush();
outFile.close();
}else{
QLoggingCategory category(logCategory);
qCWarning(category) << "Can not open file:" << outFile.fileName() << "," << outFile.errorString();
}
}

View File

@ -34,6 +34,11 @@ namespace Ui {
class SAKIODeviceWidget;
}
/// @warning Hei, Developer! Takeacre of this warning!
/// 由于使用了信号与槽的自动关联指向ui控件的指针变量的名称必须与ui控件的objectName保持一致。
/// 使用designer改变ui控件变量名称时objectName属性会自动更新不要在designer中手动更改ui控件的objectName。
/// objectName与变量名称不一致会导致信号与槽的关联失效。
class SAKIODeviceWidget : public QWidget
{
Q_OBJECT
@ -57,17 +62,22 @@ public:
};
Q_ENUM(TextDisplayModel)
protected:
/*
*
*/
// 设备管理组
QPushButton *refreshPushButton = nullptr; /// 刷新按钮
QPushButton *switchPushButton = nullptr; /// 打开关闭设备按钮
QLabel *rxLabel = nullptr; /// 接受指示灯
QLabel *txLabel = nullptr; /// 发送指示灯
private slots:
void on_refreshPushButton_clicked(){emit need2refresh();}
void on_switchPushButton_clicked(){emit need2OpenOrClose();}
// 输入设置组
protected:
TextDisplayModel inputModel;
bool cyclEnable;
quint32 cycleTime;
/*
*
*/
QComboBox *inputModelComboBox = nullptr; /// 输入模式预选框
QCheckBox *cycleEnableCheckBox = nullptr; /// 循环使能复选框
QLineEdit *cycleTimeLineEdit = nullptr; /// 循环周期输入框
@ -75,12 +85,21 @@ protected:
QPushButton *clearInputPushButton = nullptr; /// 清空输入框按钮
QPushButton *sendPushButton = nullptr; /// 发送数据按钮
QTextEdit *inputTextEdit = nullptr; /// 数据输入框
private slots:
//数据输出组管理
protected:
TextDisplayModel outputTextModel = SAKIODeviceWidget::Hex;
bool showDate;
bool autoWrap;
bool showTime;
bool showMS;
bool showRxData;
bool showTxData;
/*
*
*/
QComboBox *outputModelComboBox = nullptr; /// 输出模式复选框
QCheckBox *showDateCheckBox = nullptr; /// 显示日期使能复选框
QCheckBox *autoWrapCheckBox = nullptr; /// 自动换行使能复选框
QCheckBox *showTimeCheckBox = nullptr; /// 显示时间使能复选框
QCheckBox *showMsCheckBox = nullptr; /// 显示毫秒使能复选框
QCheckBox *showRxDataCheckBox = nullptr; /// 显示接收数据使能复选框
@ -88,24 +107,49 @@ protected:
QPushButton *clearOutputPushButton = nullptr; /// 清空输出按钮
QPushButton *saveOutputPushButton = nullptr; /// 保存输出按钮
QTextBrowser *outputTextBroswer = nullptr; /// 用于输出显示收发的数据
private slots:
void on_outputModelComboBox_currentIndexChanged(const QString &text);
void on_showDateCheckBox_clicked();
void on_autoWrapCheckBox_clicked();
void on_showTimeCheckBox_clicked();
void on_showMsCheckBox_clicked();
void on_showRxDataCheckBox_clicked();
void on_showTxDataCheckBox_clicked();
void on_clearOutputPushButton_clicked();
void on_saveOutputPushButton_clicked();
// 数据管理组
protected:
quint64 receiveFrames = 0; /// 接受帧数
quint64 receiveBytes = 0; /// 接受字节数
quint64 sendFrames = 0; /// 发送帧数
quint64 sendBytes = 0; /// 发送字节数
/*
*
*/
QLabel *rxFramesLabel = nullptr; /// 用于显示接受帧数
QLabel *txFramesLabel = nullptr; /// 用于显示发送帧数
QLabel *rxBytesLabel = nullptr; /// 用于显示接收字节数
QLabel *txBytesLabel = nullptr; /// 用于显示发送字节数
QPushButton *resetRxCountPushButton = nullptr; /// 重置接收计数
QPushButton *resetTxCountPushButton = nullptr; /// 重置发送计数
private slots:
void on_resetRxCountPushButton_clicked();
void on_resetTxCountPushButton_clicked();
/*
*
*/
// 其他设置组
protected:
QPushButton *autoResponseSettingPushButton = nullptr; /// 自动回复设置面板调出按钮
QPushButton *highlightSettingPushButton = nullptr; /// 高亮设置面板调出按钮
QPushButton *readWriteSettingPushButton = nullptr; /// 读写设置面包调出按钮
private slots:
void on_autoResponseSettingPushButton_clicked(); /// 创建一个高亮设置窗口并显示,该窗口关闭后将被销毁
void on_highlightSettingPushButton_clicked(); /// 创建一个高亮设置窗口并显示,该窗口关闭后将被销毁
void on_readWriteSettingPushButton(); /// 创建一个读写参数设置窗口并显示,该窗口关闭后将被销毁
private:
/**
* @brief ui --
*/
@ -114,7 +158,8 @@ protected:
/**
* @brief initUiPointer -- ui控件的数据成员
*/
void initUiPointer();
void initUiPointer();
void setLabelText(QLabel* label, quint64 text);
private:
/*
*
@ -123,18 +168,19 @@ private:
/**
* @brief createAutoResponseSettingWindow --
*/
void createAutoResponseSettingWindow();
// void createAutoResponseSettingWindow();
/**
* @brief createHighlightSettingWindow --
*/
void createHighlightSettingWindow();
// void createHighlightSettingWindow();
/**
* @brief createReadWriteSettingWindow --
*/
void createReadWriteSettingWindow();
// void createReadWriteSettingWindow();
private:
const char *logCategory = "SAKIODeviceWidget";
SAKIODevice *device = nullptr;
SAKIODeviceControler *controler = nullptr;
SAKAutoResponseSettingPanel *autoResponseSettingPanel = nullptr;
@ -192,7 +238,6 @@ private slots:
void readInputMode();
void openFile();
void saveOutputData();
void textFormatControl();
void outputTimeInfoCheckBoxClicked(bool checked);
@ -232,6 +277,7 @@ signals:
void need2open();
void need2close();
void need2refresh();
void need2OpenOrClose();
};
#endif // SAKIODEVICEWIDGET_H

View File

@ -21,7 +21,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QTextBrowser" name="textBrowserOutputData"/>
<widget class="QTextBrowser" name="outputTextBroswer"/>
</item>
</layout>
</widget>
@ -39,7 +39,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QTextEdit" name="textEditInputData"/>
<widget class="QTextEdit" name="inputTextEdit"/>
</item>
</layout>
</widget>
@ -99,7 +99,7 @@
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="1" column="1">
<widget class="QLabel" name="labelRX">
<widget class="QLabel" name="rxLabel">
<property name="minimumSize">
<size>
<width>22</width>
@ -122,7 +122,7 @@
<item row="1" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>发(Tx)</string>
<string>Tx</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@ -130,7 +130,7 @@
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="labelTX">
<widget class="QLabel" name="txLabel">
<property name="minimumSize">
<size>
<width>22</width>
@ -148,7 +148,7 @@
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>收(Rx)</string>
<string>Rx</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
@ -156,14 +156,14 @@
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QPushButton" name="pushButtonRefresh">
<widget class="QPushButton" name="refreshPushButton">
<property name="text">
<string>刷新</string>
</property>
</widget>
</item>
<item row="0" column="2" colspan="2">
<widget class="QPushButton" name="pushButtonOpen">
<widget class="QPushButton" name="switchPushButton">
<property name="text">
<string>打开</string>
</property>
@ -199,7 +199,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxInputMode">
<widget class="QComboBox" name="inputModelComboBox">
<property name="currentIndex">
<number>4</number>
</property>
@ -236,28 +236,28 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="pushButtonClearInput">
<widget class="QPushButton" name="clearInputPushButton">
<property name="text">
<string>清空输入</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="pushButtonSendData">
<widget class="QPushButton" name="sendPushButton">
<property name="text">
<string>发送数据</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxCycle">
<widget class="QCheckBox" name="cycleEnableCheckBox">
<property name="text">
<string>循环周期(单位:毫秒)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLineEdit" name="lineEditCycleTime">
<widget class="QLineEdit" name="cycleTimeLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -270,7 +270,7 @@
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pushButtonReadInFile">
<widget class="QPushButton" name="readinFilePushButton">
<property name="text">
<string>读入文件</string>
</property>
@ -323,22 +323,28 @@
<string>数据输出设置</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="1">
<widget class="QCheckBox" name="checkBoxPause">
<item row="2" column="0">
<widget class="QCheckBox" name="showDateCheckBox">
<property name="text">
<string>暂停输出</string>
<string>输出日期</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="checkBoxOutputTime">
<item row="4" column="1">
<widget class="QCheckBox" name="showMsCheckBox">
<property name="text">
<string>输出时间</string>
<string>显示毫秒</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBoxOutputMode">
<widget class="QComboBox" name="outputModelComboBox">
<property name="currentIndex">
<number>4</number>
</property>
@ -374,23 +380,45 @@
</item>
</widget>
</item>
<item row="4" column="1">
<widget class="QCheckBox" name="checkBoxOutputMS">
<item row="9" column="1">
<widget class="QPushButton" name="saveOutputPushButton">
<property name="text">
<string>显示毫秒</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
<string>保存输出</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="checkBoxOutputReceiveDataOnly">
<item row="2" column="1">
<widget class="QCheckBox" name="autoWrapCheckBox">
<property name="text">
<string>只输出接收到的数据数据</string>
<string>自动换行</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="showTxDataCheckBox">
<property name="text">
<string>显示发送</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="showRxDataCheckBox">
<property name="text">
<string>显示接收</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QPushButton" name="clearOutputPushButton">
<property name="text">
<string>清空输出</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="showTimeCheckBox">
<property name="text">
<string>输出时间</string>
</property>
</widget>
</item>
@ -401,27 +429,6 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBoxOutputDate">
<property name="text">
<string>输出日期</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QPushButton" name="pushButtonClearOutput">
<property name="text">
<string>清空输出</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QPushButton" name="pushButtonSaveOutput">
<property name="text">
<string>保存输出</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -458,16 +465,16 @@
</widget>
</item>
<item row="4" column="0">
<widget class="QPushButton" name="pushButtonResetSendDataCount">
<widget class="QPushButton" name="resetTxCountPushButton">
<property name="text">
<string>复位发送</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="labelSendFrames">
<widget class="QLabel" name="txFramesLabel">
<property name="styleSheet">
<string notr="true">QLabel#labelSendFrames{
<string notr="true">QLabel#txFramesLabel{
color:blue
}</string>
</property>
@ -480,9 +487,9 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="labelReceiveFrames">
<widget class="QLabel" name="rxFramesLabel">
<property name="styleSheet">
<string notr="true">QLabel#labelReceiveFrames{
<string notr="true">QLabel#rxFramesLabel{
color:green
}</string>
</property>
@ -495,9 +502,9 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="labelReceiveBytes">
<widget class="QLabel" name="rxBytesLabel">
<property name="styleSheet">
<string notr="true">QLabel#labelReceiveBytes{
<string notr="true">QLabel#rxBytesLabel{
color:green
}</string>
</property>
@ -520,9 +527,9 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labelSendBytes">
<widget class="QLabel" name="txBytesLabel">
<property name="styleSheet">
<string notr="true">QLabel#labelSendBytes{
<string notr="true">QLabel#txBytesLabel{
color:blue
}</string>
</property>
@ -545,7 +552,7 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="pushButtonResetReceiveDataCount">
<widget class="QPushButton" name="resetRxCountPushButton">
<property name="text">
<string>复位接收</string>
</property>
@ -561,21 +568,21 @@
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="1">
<widget class="QPushButton" name="pushButtonHighlighting">
<widget class="QPushButton" name="highlightSettingPushButton">
<property name="text">
<string>高亮设置</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButtonAutoRespone">
<widget class="QPushButton" name="autoResponseSettingPushButton">
<property name="text">
<string>自动回复</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButtonRWParameter">
<widget class="QPushButton" name="readWriteSettingPushButton">
<property name="text">
<string>读写参数</string>
</property>
@ -683,9 +690,9 @@
<resources/>
<connections>
<connection>
<sender>pushButtonClearOutput</sender>
<sender>clearOutputPushButton</sender>
<signal>clicked()</signal>
<receiver>textBrowserOutputData</receiver>
<receiver>outputTextBroswer</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
@ -699,9 +706,9 @@
</hints>
</connection>
<connection>
<sender>pushButtonClearInput</sender>
<sender>clearInputPushButton</sender>
<signal>clicked()</signal>
<receiver>textEditInputData</receiver>
<receiver>inputTextEdit</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">