2023-09-27 17:30:27 +00:00
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
#include <QSerialPortInfo>
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QMutex>
|
|
|
|
|
#include "Qss.h"
|
|
|
|
|
#include "libmodbus/modbus.h"
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
#include "global.h"
|
|
|
|
|
#include <subform.h>
|
|
|
|
|
|
|
|
|
|
#if defined(_MSC_VER) && (_MSC_VER >= 1600)
|
|
|
|
|
# pragma execution_character_set("utf-8")
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
|
|
|
: QMainWindow(parent)
|
|
|
|
|
, ui(new Ui::MainWindow)
|
|
|
|
|
, mStart(false)
|
|
|
|
|
, mConfig(nullptr) {
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
auto list3 = QSerialPortInfo::availablePorts();
|
|
|
|
|
for(int i=0;i<list3.size();i++){
|
|
|
|
|
qDebug()<<list3[i].portName();//
|
|
|
|
|
ui->comboBox_2->addItem(list3[i].portName());
|
|
|
|
|
}
|
2023-09-30 04:06:01 +00:00
|
|
|
|
ui->comboBox->addItem("2400");
|
|
|
|
|
ui->comboBox->addItem("4800");
|
|
|
|
|
ui->comboBox->addItem("9600");
|
|
|
|
|
ui->comboBox->addItem("57600");
|
|
|
|
|
ui->comboBox->addItem("115200");
|
|
|
|
|
|
|
|
|
|
|
2023-09-27 17:30:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::init_charts()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_pushButton_2_clicked()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_pushButton_clicked()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void MainWindow::on_pushButton_3_clicked()
|
|
|
|
|
{
|
2023-10-01 09:15:57 +00:00
|
|
|
|
if(nullptr == gAsyncData){
|
|
|
|
|
gAsyncData = new ASyncReadData(this);
|
|
|
|
|
connect(gAsyncData,&QSSASyncProcess::Done,[&](){
|
|
|
|
|
qDebug()<<"done";
|
|
|
|
|
});
|
|
|
|
|
qDebug()<<"hello world";
|
|
|
|
|
gAsyncData->Start(nullptr);
|
|
|
|
|
|
|
|
|
|
}
|
2023-09-27 17:30:27 +00:00
|
|
|
|
if(this->mForms.contains(ui->lineEdit_2->text())){
|
2023-09-30 18:23:57 +00:00
|
|
|
|
QMessageBox::warning(this,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD>","<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD>");
|
2023-09-27 17:30:27 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2023-10-01 09:15:57 +00:00
|
|
|
|
SubForm *p1 = new SubForm(ui->comboBox_2->currentText(),
|
2023-09-30 18:23:57 +00:00
|
|
|
|
ui->comboBox->currentText().toInt(),
|
|
|
|
|
ui->lineEdit_2->text().toInt());
|
2023-09-27 17:30:27 +00:00
|
|
|
|
qDebug()<<ui->lineEdit_2->text();
|
2023-10-01 09:15:57 +00:00
|
|
|
|
ui->tabWidget->addTab((QWidget*)p1,"address:" + ui->lineEdit_2->text());
|
2023-09-27 17:30:27 +00:00
|
|
|
|
this->mForms[ui->lineEdit_2->text()] = p1;
|
|
|
|
|
|
|
|
|
|
|
2023-09-30 18:23:57 +00:00
|
|
|
|
|
2023-09-27 17:30:27 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|