diff --git a/BDTest.pro b/BDTest.pro index 293254e..5c9b4f8 100644 --- a/BDTest.pro +++ b/BDTest.pro @@ -4,6 +4,11 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport CONFIG += c++17 +msvc{ + QMAKE_CFLAGS += /utf-8 + QMAKE_CXXFLAGS += /utf-8 +} + # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 @@ -25,7 +30,8 @@ SOURCES += \ src/cpp/interfaceTestWin.cpp \ src/cpp/msgInputWin.cpp \ src/cpp/statusTestWin.cpp \ - src/cpp/precisionTestWin.cpp + src/cpp/precisionTestWin.cpp \ + src/cpp/testThread.cpp HEADERS += \ src/include/posTestWin.h \ @@ -39,6 +45,7 @@ HEADERS += \ src/include/serialport.h \ src/include/sqlitedb.h \ src/include/statusTestWin.h \ + src/include/testThread.h \ src/include/titlebar.h \ src/include/utils.h diff --git a/src/cpp/globalParams.cpp b/src/cpp/globalParams.cpp index a82056a..1b13f6a 100644 --- a/src/cpp/globalParams.cpp +++ b/src/cpp/globalParams.cpp @@ -4,4 +4,11 @@ namespace globalParams { QString curUserId; QString curUserType; + QString configPath = "config/cfg.ini"; + QString company; + QString bdType; + QString carType; + QString classGroup; + QString bdSN; + QString marker; } diff --git a/src/cpp/interfaceTestWin.cpp b/src/cpp/interfaceTestWin.cpp index 896319d..65e4707 100644 --- a/src/cpp/interfaceTestWin.cpp +++ b/src/cpp/interfaceTestWin.cpp @@ -1,5 +1,9 @@ #include "interfaceTestWin.h" #include "ui_interfaceTestWin.h" +#include "testThread.h" +#include "globalParams.h" +#include +#include InterfaceTestWin::InterfaceTestWin(QWidget *parent) : QWidget(parent) @@ -78,9 +82,69 @@ InterfaceTestWin::InterfaceTestWin(QWidget *parent) aItem->setTextAlignment(Qt::AlignCenter); aItemList.append(aItem); canModel->insertRow(canModel->rowCount(),aItemList); + + connect(&TestThread::getInstance(),SIGNAL(serialRecvResultSignal(bool)),this,SLOT(serialRecvResultHandle(bool)),Qt::QueuedConnection); + connect(&TestThread::getInstance(),SIGNAL(serialSendResultSignal(bool)),this,SLOT(serialSendResultHandle(bool)),Qt::QueuedConnection); } InterfaceTestWin::~InterfaceTestWin() { delete ui; } + +void InterfaceTestWin::serialRecvResultHandle(bool result) +{ + QMap map; + map["BDSN"] = globalParams::bdSN; + map["TESTER"] = globalParams::curUserId; + QDateTime cur = QDateTime::currentDateTime(); + map["TEST_TIME"] = cur.toString("yyyy-MM-dd hh:mm:ss"); + if(result){ + serialModel->item(0,1)->setText("正常"); + serialModel->item(0,1)->setForeground(QBrush(QColor(0,140,0))); + map["SERIAL_RECV"] = "PASS"; + }else{ + serialModel->item(0,1)->setText("不正常"); + serialModel->item(0,1)->setForeground(QBrush(Qt::red)); + map["SERIAL_RECV"] = "FAIL"; + } + SQLITEDB::getInstance().saveRecord("INTERFACE_TEST",map); +} + +void InterfaceTestWin::serialSendResultHandle(bool result) +{ + QMap map; + map["BDSN"] = globalParams::bdSN; + map["TESTER"] = globalParams::curUserId; + QDateTime cur = QDateTime::currentDateTime(); + map["TEST_TIME"] = cur.toString("yyyy-MM-dd hh:mm:ss"); + if(result){ + serialModel->item(1,1)->setText("正常"); + serialModel->item(1,1)->setForeground(QBrush(QColor(0,140,0))); + map["SERIAL_SEND"] = "PASS"; + }else{ + serialModel->item(1,1)->setText("不正常"); + serialModel->item(1,1)->setForeground(QBrush(Qt::red)); + map["SERIAL_SEND"] = "FAIL"; + } + SQLITEDB::getInstance().saveRecord("INTERFACE_TEST",map); +} + +void InterfaceTestWin::on_btnSerialTest_clicked() +{ + if(TestThread::getInstance().isOnTest()){ + QMessageBox::warning(this,"警告","请等待其他测试项完成再开始测试!",QMessageBox::Ok,QMessageBox::NoButton); + return; + } + + serialModel->item(0,1)->setText(""); + serialModel->item(0,1)->setForeground(QBrush(Qt::black)); + serialModel->item(1,1)->setText(""); + serialModel->item(1,1)->setForeground(QBrush(Qt::black)); + + QVector testList; + testList.append(TEST_TYPE::SERIAL); + TestThread::getInstance().setTestList(testList); + TestThread::getInstance().start(); +} + diff --git a/src/cpp/loginWin.cpp b/src/cpp/loginWin.cpp index ebabf20..edbc745 100644 --- a/src/cpp/loginWin.cpp +++ b/src/cpp/loginWin.cpp @@ -64,7 +64,7 @@ LoginWin::~LoginWin() void LoginWin::windowCloseHandle() { - QSettings setting("config/cfg.ini",QSettings::IniFormat); + QSettings setting(globalParams::configPath,QSettings::IniFormat); QString check; if(ui->ckbRemember->isChecked()){ check = "1"; @@ -197,7 +197,7 @@ bool LoginWin::nativeEvent(const QByteArray &eventType, void *message, long *res void LoginWin::readCfg() { - QSettings setting("config/cfg.ini",QSettings::IniFormat); + QSettings setting(globalParams::configPath,QSettings::IniFormat); QString names = setting.value("users/names").toString().trimmed(); QStringList nameList = names.split(";"); @@ -234,7 +234,7 @@ void LoginWin::readCfg() void LoginWin::saveCfg() { - QSettings setting("config/cfg.ini",QSettings::IniFormat); + QSettings setting(globalParams::configPath,QSettings::IniFormat); QString names; QString curname = ui->cmbName->currentText(); diff --git a/src/cpp/main.cpp b/src/cpp/main.cpp index 7cf00a5..d53e185 100644 --- a/src/cpp/main.cpp +++ b/src/cpp/main.cpp @@ -12,6 +12,7 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); QFont font = a.font(); font.setFamily("Microsoft YaHei UI"); + font.setPointSize(9); a.setFont(font); LoginWin login; login.show(); diff --git a/src/cpp/mainwindow.cpp b/src/cpp/mainwindow.cpp index 92808d5..330f12a 100644 --- a/src/cpp/mainwindow.cpp +++ b/src/cpp/mainwindow.cpp @@ -2,6 +2,7 @@ #include "ui_mainwindow.h" #include "globalParams.h" #include "msgInputWin.h" +#include "testThread.h" #include #include #include @@ -16,6 +17,8 @@ MainWindow::MainWindow(QWidget *parent) this->setWindowTitle("北斗用户机测试软件"); //this->setPalette(QPalette(QColor(255,255,255))); //this->setPalette(QPalette(QColor(225,225,225))); + ui->tabWidget->setCurrentIndex(0); + serialPortInit(); //状态栏显示当前用户 @@ -35,6 +38,38 @@ MainWindow::MainWindow(QWidget *parent) userLayout->addWidget(lbCurUserId); userLayout->addWidget(lbUserSpaceRight); ui->statusbar->addWidget(userBox); + + //显示测试进度 + QGroupBox *progressBox = new QGroupBox(); + progressBox->setStyleSheet("QGroupBox{border:none;}"); + QHBoxLayout *progressLayout = new QHBoxLayout(progressBox); + progressLayout->setMargin(0); + QLabel *lbProgressSpaceLeft = new QLabel(); + QLabel *lbProgressSpaceMid1 = new QLabel(); + QLabel *lbProgressSpaceMid2 = new QLabel(); + QLabel *lbProgressSpaceMid3 = new QLabel(); + QLabel *lbProgressSpaceRight = new QLabel(); + lbProgressSpaceLeft->setFixedWidth(5); + lbProgressSpaceMid1->setFixedWidth(5); + lbProgressSpaceMid2->setFixedWidth(5); + lbProgressSpaceMid3->setFixedWidth(5); + lbProgressSpaceRight->setFixedWidth(5); + + QLabel *lbCurTest = new QLabel("当前测试项:"); + QLabel *lbTestTime = new QLabel("测试时间:"); + lbCurTestItem = new QLabel(""); + lbCurTestTimeCounts = new QLabel(""); + + progressLayout->addWidget(lbProgressSpaceLeft); + progressLayout->addWidget(lbCurTest); + progressLayout->addWidget(lbCurTestItem); + progressLayout->addWidget(lbProgressSpaceMid1); + progressLayout->addWidget(lbTestTime); + progressLayout->addWidget(lbCurTestTimeCounts); + progressLayout->addWidget(lbProgressSpaceRight); + + ui->statusbar->addWidget(progressBox); + //状态栏显示接收比特数 QGroupBox *byteBox = new QGroupBox(); byteBox->setStyleSheet("QGroupBox{border:none;}"); @@ -80,6 +115,8 @@ MainWindow::MainWindow(QWidget *parent) byteLayout->addWidget(lbByteSpaceRight); ui->statusbar->addWidget(byteBox); + connect(&TestThread::getInstance(),SIGNAL(writeDataSignal(QByteArray)),this,SIGNAL(writeDataSignal(QByteArray)),Qt::QueuedConnection); + connect(&TestThread::getInstance(),SIGNAL(curTestInfoSignal(QString,int)),this,SLOT(curTestInfoHandle(QString,int)),Qt::QueuedConnection); } MainWindow::~MainWindow() @@ -100,7 +137,13 @@ void MainWindow::receiverSerialDataHandle(const QByteArray &data) qDebug()<<"new data can't append to buf"; return; } +} +void MainWindow::writeBytesHandle(int bytes) +{ + long long totalLen = lbSendByte->text().toLongLong(); + totalLen += bytes; + lbSendByte->setText(QString::number(totalLen)); } void MainWindow::loginHandle() @@ -109,6 +152,12 @@ void MainWindow::loginHandle() this->show(); } +void MainWindow::curTestInfoHandle(const QString &item, int timeCounts) +{ + lbCurTestItem->setText(item); + lbCurTestTimeCounts->setText(QString::number(timeCounts)); +} + void MainWindow::btnCleanClickedHandle() { lbSendByte->setText("0"); @@ -140,6 +189,9 @@ void MainWindow::serialPortInit() { serial = new SerialPort(); connect(serial,SIGNAL(recvSerialDataSignal(QByteArray)),this,SLOT(receiverSerialDataHandle(QByteArray)),Qt::QueuedConnection); + connect(this,SIGNAL(writeDataSignal(QByteArray)),serial,SLOT(writeData(QByteArray)),Qt::QueuedConnection); + connect(serial,SIGNAL(writeBytesSignal(int)),this,SLOT(writeBytesHandle(int)),Qt::QueuedConnection); + connect(serial,SIGNAL(recvSerialDataSignal(QByteArray)),&TestThread::getInstance(),SLOT(receiverSerialDataHandle(QByteArray)),Qt::QueuedConnection); QStringList nameList; foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) { diff --git a/src/cpp/msgInputWin.cpp b/src/cpp/msgInputWin.cpp index f96aa2d..f35caf3 100644 --- a/src/cpp/msgInputWin.cpp +++ b/src/cpp/msgInputWin.cpp @@ -1,6 +1,9 @@ #include "msgInputWin.h" #include "ui_msgInputWin.h" +#include "globalParams.h" #include +#include +#include MsgInputWin::MsgInputWin(QWidget *parent) : QWidget(parent) @@ -52,6 +55,7 @@ MsgInputWin::MsgInputWin(QWidget *parent) aItemList.append(aItem); msgModel->insertRow(msgModel->rowCount(),aItemList); QComboBox *carType = new QComboBox(); + carType->setEditable(true); ui->tableView->setIndexWidget(msgModel->index(msgModel->rowCount()-1,1),carType); aItemList.clear(); @@ -83,9 +87,76 @@ MsgInputWin::MsgInputWin(QWidget *parent) aItem = new QStandardItem(""); aItemList.append(aItem); msgModel->insertRow(msgModel->rowCount(),aItemList); + + connect(msgModel,SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(dataChangedHandle(QModelIndex,QModelIndex)),Qt::QueuedConnection); + connect(carType,SIGNAL(currentTextChanged(QString)),this,SLOT(currentCarTypeChangedHandle(QString)),Qt::QueuedConnection); + readCfg(); + } MsgInputWin::~MsgInputWin() { + saveCfg(); delete ui; } + +void MsgInputWin::dataChangedHandle(const QModelIndex &topLeft, const QModelIndex &bottomRight) +{ + if(topLeft==bottomRight && bottomRight.row()==0){ + globalParams::company = msgModel->item(0,1)->text(); + }else if(topLeft==bottomRight && bottomRight.row()==1){ + globalParams::classGroup = msgModel->item(1,1)->text(); + }else if(topLeft==bottomRight && bottomRight.row()==3){ + globalParams::bdType = msgModel->item(3,1)->text(); + }else if(topLeft==bottomRight && bottomRight.row()==4){ + globalParams::bdSN = msgModel->item(4,1)->text(); + }else if(topLeft==bottomRight && bottomRight.row()==5){ + globalParams::marker = msgModel->item(5,1)->text(); + } +} + +void MsgInputWin::currentCarTypeChangedHandle(const QString &text) +{ + globalParams::carType = text; +} + +void MsgInputWin::readCfg() +{ + QSettings setting(globalParams::configPath,QSettings::IniFormat); + QString company = setting.value("information/company").toString(); + QString group = setting.value("information/class_group").toString(); + QString curCarType = setting.value("information/current_car_type").toString(); + QString bdType = setting.value("information/bd_type").toString(); + QString bdSN = setting.value("information/bd_sn").toString(); + QString marker = setting.value("information/marker").toString(); + + msgModel->item(0,1)->setText(company); + msgModel->item(1,1)->setText(group); + QComboBox *box = qobject_cast(ui->tableView->indexWidget(msgModel->index(2,1))); + box->setCurrentText(curCarType); + msgModel->item(3,1)->setText(bdType); + msgModel->item(4,1)->setText(bdSN); + msgModel->item(5,1)->setText(marker); +} + +void MsgInputWin::saveCfg() +{ + QString company = msgModel->item(0,1)->text(); + QString group = msgModel->item(1,1)->text(); + + QComboBox *box = qobject_cast(ui->tableView->indexWidget(msgModel->index(2,1))); + + QString curCarType = box->currentText(); + QString bdType = msgModel->item(3,1)->text(); + QString bdSN = msgModel->item(4,1)->text(); + QString marker = msgModel->item(5,1)->text(); + + QSettings setting(globalParams::configPath,QSettings::IniFormat); + setting.setValue("information/company",company); + setting.setValue("information/class_group",group); + setting.setValue("information/current_car_type",curCarType); + setting.setValue("information/bd_type",bdType); + setting.setValue("information/bd_sn",bdSN); + setting.setValue("information/marker",marker); + +} diff --git a/src/cpp/serialport.cpp b/src/cpp/serialport.cpp index d3f8915..b720877 100644 --- a/src/cpp/serialport.cpp +++ b/src/cpp/serialport.cpp @@ -4,9 +4,9 @@ SerialPort::SerialPort(QObject *parent) : QObject(parent) { serial = new QSerialPort; - thread = new QThread; - this->moveToThread(thread); - thread->start(); + //thread = new QThread; + //this->moveToThread(thread); + //thread->start(); connect(serial,SIGNAL(readyRead()),this,SLOT(readData()),Qt::QueuedConnection); } @@ -67,17 +67,11 @@ int SerialPort::getBaud() return curBaud; } -void SerialPort::writeData(const QString &cmd) -{ - if(serial && serial->isOpen()){ - serial->write(cmd.toLocal8Bit()); - } -} - void SerialPort::writeData(const QByteArray &buf) { if(serial && serial->isOpen()){ - serial->write(buf); + int size = serial->write(buf); + writeBytesSignal(size); } } diff --git a/src/cpp/sqlitedb.cpp b/src/cpp/sqlitedb.cpp index ed7bd72..9088730 100644 --- a/src/cpp/sqlitedb.cpp +++ b/src/cpp/sqlitedb.cpp @@ -31,6 +31,7 @@ void SQLITEDB::openDateBase() }else{ qDebug()<<"打开数据库成功"; } + if(!tableExist("USERS")){ QSqlQuery query(DB); query.prepare("CREATE TABLE [USERS](\ @@ -51,6 +52,83 @@ void SQLITEDB::openDateBase() } } } + + if(!tableExist("INFORMATION")){ + QSqlQuery query(DB); + query.prepare("CREATE TABLE [INFORMATION](\ +[BDSN] TEXT(32) PRIMARY KEY NOT NULL, \ +[TESTER] TEXT(255), \ +[TEST_TIME] DATETIME, \ +[COMPANY] TEXT(255), \ +[GROUP] TEXT(255), \ +[BD_TYPE] TEXT(255), \ +[CAR_TYPE] TEXT(255), \ +[MAKER] TEXT(255));"); + } + + if(!tableExist("INTERFACE_TEST")){ + QSqlQuery query(DB); + query.prepare("CREATE TABLE [INTERFACE_TEST](\ +[BDSN] TEXT(32) PRIMARY KEY NOT NULL, \ +[TESTER] TEXT(255), \ +[TEST_TIME] DATETIME, \ +[SERIAL_SEND] TEXT(10), \ +[SERIAL_RECV] TEXT(10), \ +[CAN_SEND] TEXT(10), \ +[CAN_RECV] TEXT(10));"); + } + + if(!tableExist("POSITION_PRECISION")){ + QSqlQuery query(DB); + query.prepare("CREATE TABLE [POSITION_PRECISION](\ +[BDSN] TEXT(32) NOT NULL, \ +[TEST_TIME] DATETIME, \ +[TESTER] TEXT(255), \ +[MODE] TEXT(32) NOT NULL, \ +[REF_LAT] TEXT(16), \ +[REF_LON] TEXT(16), \ +[SAMPLE_POINTS] TEXT(10), \ +[HORIZONTAL_ERR] TEXT(10), \ +[VERTICAL_ERR] TEXT(10));"); + } + + if(!tableExist("POSITION_TEST")){ + QSqlQuery query(DB); + query.prepare("CREATE TABLE [POSITION_TEST](\ +[BDSN] TEXT(32) NOT NULL, \ +[TESTER] TEXT(255), \ +[TEST_TIME] DATETIME, \ +[MODE] TEXT(32) NOT NULL, \ +[TIME] TEXT(32), \ +[LONGITUDE] TEXT(16), \ +[LATITUDE] TEXT(16), \ +[HEIGHT] TEXT(16), \ +[PDOP] TEXT(8), \[VDOP] TEXT(8), \ +[HDOP] TEXT(8), \ +[SAT_NUM] TEXT(8), \ +PRIMARY KEY([BDSN], [MODE]));"); + } + + if(!tableExist("STATUS")){ + QSqlQuery query(DB); + query.prepare("CREATE TABLE [STATUS](\ +[BDSN] TEXT(32) PRIMARY KEY NOT NULL, \ +[TESTER] TEXT(255), \ +[TEST_TIME] DATETIME, \ +[RNSS_SN] TEXT(32), \ +[RDSS_SN] TEXT(32), \ +[MPD009] TEXT(32), \ +[MPD007] TEXT(32), \ +[PRM] TEXT(32), \ +[MPD007_VALID_DATE] TEXT(255), \ +[PRM_VALID_DATE] TEXT(255), \ +[BD_ID_NUM] TEXT(10), \ +[BD_SERVICE_FEQ] TEXT(10), \ +[BD_COMMUNICATION_LEVEL] TEXT(10), \ +[BD_BROCAST_ADDRESS] TEXT(12), \ +[BD_SECRECY_MARK] TEXT(10));"); + } + } void SQLITEDB::closeDateBase() diff --git a/src/cpp/testThread.cpp b/src/cpp/testThread.cpp new file mode 100644 index 0000000..cef7fc0 --- /dev/null +++ b/src/cpp/testThread.cpp @@ -0,0 +1,85 @@ +#include "testThread.h" + +bool TestThread::setTestList(const QVector &list) +{ + if(onTest){ + return false; + } + testList = list; + return true; +} + +void TestThread::stopTest() +{ + quit = true; +} + +bool TestThread::isOnTest() +{ + return onTest; +} + +TestThread::TestThread() {} + +TestThread::~TestThread() {} + +void TestThread::receiverSerialDataHandle(const QByteArray &data) +{ + if(!onTest){ + return; + } + unprocessData.append(data); +} + +void TestThread::run() +{ + onTest = true; + quit = false; + for(int i=0;i0){ + emit serialRecvResultSignal(true); + }else{ + emit serialRecvResultSignal(false); + } + unprocessData.clear(); + //todo + bool bsend = false; + for(int i=0;i<5;i++){//测试串口发送 + if(quit){ + break; + } + emit curTestInfoSignal("串口发送",i); + emit writeDataSignal("version\r\n"); + sleep(1); + QString txt = QString::fromLatin1(unprocessData); + if(txt.contains("v")){ + bsend = true; + break; + } + } + emit serialSendResultSignal(bsend); + break; + } + default: + break; + } + } + onTest = false; +} diff --git a/src/include/globalParams.h b/src/include/globalParams.h index 9c470a7..411a05f 100644 --- a/src/include/globalParams.h +++ b/src/include/globalParams.h @@ -6,6 +6,13 @@ namespace globalParams { extern QString curUserId; extern QString curUserType; + extern QString configPath; + extern QString company; + extern QString bdType; + extern QString carType; + extern QString classGroup; + extern QString bdSN; + extern QString marker; } #endif // GLOBALPARAMS_H diff --git a/src/include/interfaceTestWin.h b/src/include/interfaceTestWin.h index 5b0b998..754e49c 100644 --- a/src/include/interfaceTestWin.h +++ b/src/include/interfaceTestWin.h @@ -4,6 +4,7 @@ #include #include #include +#include "sqlitedb.h" namespace Ui { class InterfaceTestWin; @@ -17,6 +18,11 @@ public: explicit InterfaceTestWin(QWidget *parent = nullptr); ~InterfaceTestWin(); +private slots: + void serialRecvResultHandle(bool result); + void serialSendResultHandle(bool result); + void on_btnSerialTest_clicked(); + private: Ui::InterfaceTestWin *ui; QStandardItemModel *serialModel; diff --git a/src/include/mainwindow.h b/src/include/mainwindow.h index 85919f0..1c96cd4 100644 --- a/src/include/mainwindow.h +++ b/src/include/mainwindow.h @@ -19,9 +19,14 @@ public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); +signals: + void writeDataSignal(const QByteArray &buf); + private slots: void receiverSerialDataHandle(const QByteArray &data); + void writeBytesHandle(int bytes); void loginHandle(); + void curTestInfoHandle(const QString &item,int timeCounts); void btnCleanClickedHandle(); void on_tbtnFresh_clicked(); void on_tbtnConnect_clicked(); @@ -34,6 +39,8 @@ private: QLabel *lbComStatus; QLabel *lbSendByte; QLabel *lbRecvByte; + QLabel *lbCurTestItem; + QLabel *lbCurTestTimeCounts; bool bconnected = false; void serialPortInit(); }; diff --git a/src/include/msgInputWin.h b/src/include/msgInputWin.h index e39cd60..25cfd0a 100644 --- a/src/include/msgInputWin.h +++ b/src/include/msgInputWin.h @@ -17,10 +17,16 @@ public: explicit MsgInputWin(QWidget *parent = nullptr); ~MsgInputWin(); +private slots: + void dataChangedHandle(const QModelIndex &topLeft, const QModelIndex &bottomRight); + void currentCarTypeChangedHandle(const QString &text); + private: Ui::MsgInputWin *ui; QStandardItemModel *msgModel; QItemSelectionModel *msgSelect; + void readCfg(); + void saveCfg(); }; #endif // MSGINPUTWIN_H diff --git a/src/include/serialport.h b/src/include/serialport.h index aec0bbd..f0fcfd5 100644 --- a/src/include/serialport.h +++ b/src/include/serialport.h @@ -14,9 +14,9 @@ public: signals: void recvSerialDataSignal(const QByteArray &buf); + void writeBytesSignal(int bytes); public slots: - void writeData(const QString &cmd); void writeData(const QByteArray &buf); void readData(); bool open(); diff --git a/src/include/sqlitedb.h b/src/include/sqlitedb.h index 79c9bd9..05ef8e2 100644 --- a/src/include/sqlitedb.h +++ b/src/include/sqlitedb.h @@ -34,9 +34,6 @@ public: QVector> getRecord(const QString &table,const QMap &condition); bool saveRecord(const QString &table,const QMap &map); -signals: - void synchronismPercentSignal(int per); - void displayLogSignal(const QString &txt,const QColor &color); }; #endif // SQLITEDB_H diff --git a/src/include/testThread.h b/src/include/testThread.h new file mode 100644 index 0000000..2650371 --- /dev/null +++ b/src/include/testThread.h @@ -0,0 +1,48 @@ +#ifndef TESTTHREAD_H +#define TESTTHREAD_H + +#include + +typedef enum { + SERIAL = 0, + CAN, +}TEST_TYPE; + +class TestThread : public QThread +{ + Q_OBJECT +public: + static TestThread& getInstance() + { + static TestThread instance; + return instance; + } + bool setTestList(const QVector &list); + void stopTest(); + bool isOnTest(); +private: + TestThread(); + ~TestThread(); + TestThread(const TestThread&); + TestThread& operator=(const TestThread&); + +signals: + void writeDataSignal(const QByteArray &buf); + void serialRecvResultSignal(bool result); + void serialSendResultSignal(bool result); + void curTestInfoSignal(const QString &item,int timeCounts); + +private slots: + void receiverSerialDataHandle(const QByteArray &data); + +protected: + void run() override; + +private: + QVector testList; + bool onTest = false; + bool quit = false; + QByteArray unprocessData; +}; + +#endif // TESTTHREAD_H diff --git a/src/ui/loginWin.ui b/src/ui/loginWin.ui index 0900c5a..b1be703 100644 --- a/src/ui/loginWin.ui +++ b/src/ui/loginWin.ui @@ -136,6 +136,12 @@ 30 + + + 0 + 0 + + Microsoft YaHei