2025-04-14T17:11:00
This commit is contained in:
parent
ecec86e4fd
commit
3a6c5fb642
@ -22,6 +22,7 @@ SOURCES += \
|
||||
data/pointcalculate.cpp \
|
||||
global.cpp \
|
||||
logger/logger.cpp \
|
||||
ui/aboutform.cpp \
|
||||
ui/rightwidget.cpp \
|
||||
thirdparty/easylogging/easylogging++.cc \
|
||||
ui/analysissettingform.cpp \
|
||||
@ -48,6 +49,7 @@ HEADERS += \
|
||||
data/pointcalculate.h \
|
||||
defines.h \
|
||||
logger/logger.h \
|
||||
ui/aboutform.h \
|
||||
ui/rightwidget.h \
|
||||
thirdparty/easylogging/easylogging++.h \
|
||||
ui/analysissettingform.h \
|
||||
@ -70,6 +72,7 @@ HEADERS += \
|
||||
|
||||
FORMS += \
|
||||
mainwindow.ui \
|
||||
ui/aboutform.ui \
|
||||
ui/degreeofcrystallinityform.ui \
|
||||
ui/degreeofcureform.ui \
|
||||
ui/experimentsettingform.ui \
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
namespace FileManager {
|
||||
|
||||
Global::ExpeInfo _expeInfo;
|
||||
Global::ExperimentInfo _expeInfo;
|
||||
QFile _expeFile;
|
||||
|
||||
void writeExperimentFile(const CommonData &cd)
|
||||
|
@ -15,7 +15,7 @@ const QString SampleDataFloder = ExperimentDirPath + "/sample_data";
|
||||
const QString BaseLineFolder = ExperimentDirPath + "/base_line";
|
||||
const QString AnalysisStateFolder = ExperimentDirPath + "/analysis_state";
|
||||
|
||||
extern Global::ExpeInfo _expeInfo;
|
||||
extern Global::ExperimentInfo _expeInfo;
|
||||
extern QFile _expeFile;
|
||||
|
||||
void createExperimentFile();
|
||||
|
@ -12,7 +12,7 @@ void XlsxHandler::readFile(const QString sourceFilePath)
|
||||
// 检查文件是否存在
|
||||
if(!QFile::exists(sourceFilePath))
|
||||
{
|
||||
qDebug() << "文件不存在:" << sourceFilePath;
|
||||
qDebug() << "xlsx file not existed:" << sourceFilePath;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ void XlsxHandler::readFile(const QString sourceFilePath)
|
||||
QXlsx::Worksheet *workSheet = xlsx.currentWorksheet();
|
||||
if(!workSheet)
|
||||
{
|
||||
qDebug() << "当前工作表为空。";
|
||||
qDebug() << "current sheet is empty.";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -44,12 +44,11 @@ void XlsxHandler::readFile(const QString sourceFilePath)
|
||||
int index = 2;
|
||||
Global::ExperimentInfo ei;
|
||||
ei.sampleName = workSheet->cellAt(index++, 2)->value().toString();
|
||||
logde << "sample name:" << ei.sampleName.toStdString();
|
||||
// return;
|
||||
|
||||
ei.sampleWeight = workSheet->cellAt(index++, 2)->value().toString();
|
||||
index++; // skip crucible weight.
|
||||
ei.date = workSheet->cellAt(index++, 2)->value().toString();
|
||||
ei.operatorName = workSheet->cellAt(index++, 2)->value().toString();
|
||||
ei.experimentor = workSheet->cellAt(index++, 2)->value().toString();
|
||||
index++; // skip measure type.
|
||||
ei.phaseSize = workSheet->cellAt(index++, 2)->value().toInt();
|
||||
|
||||
QVector<Global::PhaseTotalInfo> phaseTotalVtr;
|
||||
@ -67,12 +66,13 @@ void XlsxHandler::readFile(const QString sourceFilePath)
|
||||
void XlsxHandler::readPhaseData(QXlsx::Worksheet *workSheet, int &startLineIndex,
|
||||
Global::PhaseTotalInfo &phaseTotal)
|
||||
{
|
||||
// int startLineIndex = 9;
|
||||
// skip.# Time/min Temp/℃ Voltage/mW
|
||||
startLineIndex++;
|
||||
// skip.第一段
|
||||
startLineIndex++;
|
||||
|
||||
phaseTotal.phase.cutoff_temp = workSheet->cellAt(startLineIndex++, 2)->value().toFloat();
|
||||
phaseTotal.phase.temp_flow = workSheet->cellAt(startLineIndex++, 2)->value().toFloat();
|
||||
phaseTotal.phase.cutoff_temp = workSheet->cellAt(startLineIndex++, 2)->value().toDouble();
|
||||
phaseTotal.phase.temp_flow = workSheet->cellAt(startLineIndex++, 2)->value().toDouble();
|
||||
phaseTotal.phase.constant_temp_time_min = (uint16_t)(workSheet->cellAt(startLineIndex++, 2)->value().toInt());
|
||||
phaseTotal.phase.gas = static_cast<GasType>(workSheet->cellAt(startLineIndex++, 2)->value().toInt());
|
||||
|
||||
@ -80,18 +80,109 @@ void XlsxHandler::readPhaseData(QXlsx::Worksheet *workSheet, int &startLineIndex
|
||||
for(int i = 0; i < dataSize; i++)
|
||||
{
|
||||
Global::ExperimentData data;
|
||||
data.runTime = workSheet->cellAt(startLineIndex++, 2)->value().toFloat();
|
||||
data.sampleTemp = workSheet->cellAt(startLineIndex++, 3)->value().toFloat();
|
||||
data.dsc = workSheet->cellAt(startLineIndex++, 4)->value().toFloat();
|
||||
data.runTime = workSheet->cellAt(startLineIndex, 2)->value().toDouble();
|
||||
data.sampleTemp = workSheet->cellAt(startLineIndex, 3)->value().toDouble();
|
||||
data.dsc = workSheet->cellAt(startLineIndex, 4)->value().toDouble();
|
||||
|
||||
phaseTotal.dataVtr.push_back(data);
|
||||
|
||||
startLineIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
void XlsxHandler::writeFile()
|
||||
{
|
||||
Global::ExperimentInfo& ei = Global::_experimentInfo;
|
||||
|
||||
QXlsx::Document xlsx;
|
||||
xlsx.addSheet("Sheet1"); // 添加一个新的工作表
|
||||
|
||||
int row = 0;
|
||||
xlsx.write(row++ , 1, ConFileDataInfo);
|
||||
|
||||
xlsx.write(row , 1, ConSampleName);
|
||||
xlsx.write(row , 2, ei.sampleName);
|
||||
row++;
|
||||
|
||||
xlsx.write(row , 1, ConSampleWeight);
|
||||
xlsx.write(row , 2, ei.sampleWeight);
|
||||
xlsx.write(row , 3, ConUnitMg);
|
||||
row++;
|
||||
|
||||
xlsx.write(row , 1, ConCrucibleWeight);
|
||||
xlsx.write(row , 2, 0);
|
||||
xlsx.write(row , 3, ConUnitMg);
|
||||
row++;
|
||||
|
||||
xlsx.write(row , 1, Conexperimenter);
|
||||
xlsx.write(row , 2, ei.experimentor);
|
||||
row++;
|
||||
|
||||
xlsx.write(row , 1, ConDate);
|
||||
xlsx.write(row , 2, ei.date);
|
||||
row++;
|
||||
|
||||
xlsx.write(row , 1, ConMeasureType);
|
||||
xlsx.write(row , 2, "样品");
|
||||
row++;
|
||||
|
||||
xlsx.write(row , 1, ConPhaseSize);
|
||||
xlsx.write(row , 2, ei.phaseVtr.size());
|
||||
row++;
|
||||
|
||||
// write phase data
|
||||
int dataSizeRow = 0;
|
||||
for(int i = 0; i < ei.phaseVtr.size();i++){
|
||||
const Phase& phase = ei.phaseVtr.at(i);
|
||||
|
||||
xlsx.write(row , 1, ConPhaseProfix);
|
||||
xlsx.write(row , 2, ConPhaseHeaderTime);
|
||||
xlsx.write(row , 3, ConPhaseHeaderTemp);
|
||||
xlsx.write(row , 4, ConPhaseHeaderVoltage);
|
||||
row++;
|
||||
|
||||
xlsx.write(row , 1, ConPhaseIndex);
|
||||
xlsx.write(row , 2, i + 1);
|
||||
row++;
|
||||
// phase info
|
||||
xlsx.write(row , 1, ConPhaseCutoffTemp);
|
||||
xlsx.write(row , 2, phase.cutoff_temp);
|
||||
xlsx.write(row , 3, ConUnitDegreeCentigrade);
|
||||
row++;
|
||||
|
||||
xlsx.write(row , 1, ConPhaseHeatingRate);
|
||||
xlsx.write(row , 2, phase.temp_flow);
|
||||
xlsx.write(row , 3, ConUnitDegreeCentigradePerMin);
|
||||
row++;
|
||||
|
||||
xlsx.write(row , 1, ConPhaseConstantTempTime);
|
||||
xlsx.write(row , 2, phase.constant_temp_time_min);
|
||||
xlsx.write(row , 3, ConUnitMin);
|
||||
row++;
|
||||
|
||||
xlsx.write(row , 1, ConPhaseAtmosphere);
|
||||
switch(phase.gas){
|
||||
case GasType::NC:
|
||||
xlsx.write(row , 2, "NC");
|
||||
break;
|
||||
case GasType::N2:
|
||||
xlsx.write(row , 2, "N2");
|
||||
break;
|
||||
case GasType::O2:
|
||||
xlsx.write(row , 2, "O2");
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
row++;
|
||||
|
||||
// phase data.
|
||||
dataSizeRow = row;
|
||||
xlsx.write(row , 1, ConPhaseDataSize);
|
||||
xlsx.write(row , 2, 0);
|
||||
row++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// 创建一个新的 Excel 文档
|
||||
|
@ -13,6 +13,32 @@ namespace XlsxHandler {
|
||||
void readPhaseData(QXlsx::Worksheet*,int& startLineIndex,Global::PhaseTotalInfo&);
|
||||
|
||||
void writeFile();
|
||||
|
||||
const QString ConUnitMg = "mg";
|
||||
const QString ConUnitDegreeCentigrade = "℃";
|
||||
const QString ConUnitDegreeCentigradePerMin = "℃/min";
|
||||
const QString ConUnitMin = "min";
|
||||
|
||||
const QString ConFileDataInfo = "文件数据信息";
|
||||
const QString ConSampleName = "样品名称:";
|
||||
const QString ConSampleWeight = "样品质量:";
|
||||
const QString ConCrucibleWeight = "坩埚质量:";
|
||||
const QString Conexperimenter = "实验人员:";
|
||||
const QString ConDate = "实验日期:";
|
||||
const QString ConMeasureType = "测量类型:";
|
||||
const QString ConPhaseSize = "阶段数量:";
|
||||
|
||||
const QString ConPhaseProfix = "#";
|
||||
const QString ConPhaseHeaderTime = "Time/min";
|
||||
const QString ConPhaseHeaderTemp = "Temp/℃";
|
||||
const QString ConPhaseHeaderVoltage = "Voltage/mW";
|
||||
|
||||
const QString ConPhaseIndex = "阶段索引:";
|
||||
const QString ConPhaseCutoffTemp = "截止温度:";
|
||||
const QString ConPhaseHeatingRate = "升温速率:";
|
||||
const QString ConPhaseConstantTempTime = "恒温时间:";
|
||||
const QString ConPhaseAtmosphere = "气氛:";
|
||||
const QString ConPhaseDataSize = "数据个数:";
|
||||
}
|
||||
|
||||
#endif // XLSX_H
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define DEFINES_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <QtCore>
|
||||
|
||||
typedef uint8_t uchar;
|
||||
|
||||
@ -9,4 +10,6 @@ typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
|
||||
const QString ConSoftVersion = "0.9.0";
|
||||
|
||||
#endif // DEFINES_H
|
||||
|
@ -1,5 +1,13 @@
|
||||
#include "global.h"
|
||||
|
||||
namespace Global {
|
||||
ExperimentInfo _experimentInfo;
|
||||
Mode _mode;
|
||||
|
||||
QVector<QPair<QCPCurve*,QVector<Global::ExperimentData>>> _curveDataVtr;
|
||||
}
|
||||
|
||||
#if 0
|
||||
Global::Global()
|
||||
{
|
||||
_mode = Global::Mode::Analysis;
|
||||
@ -29,3 +37,5 @@ void Global::setDeviceConnectionStatus(const Global::DeviceConnectionStatus stat
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
84
src/global.h
84
src/global.h
@ -7,6 +7,58 @@
|
||||
|
||||
#include "protocol.h"
|
||||
|
||||
namespace Global {
|
||||
enum Mode{
|
||||
Analysis,
|
||||
ConnectedToDev,
|
||||
DeliveredData,
|
||||
ExperimentStart
|
||||
};
|
||||
|
||||
enum DeviceConnectionStatus{
|
||||
Disconnected,
|
||||
Connected
|
||||
};
|
||||
|
||||
struct ExperimentData {
|
||||
float runTime;
|
||||
float constantTempTime;
|
||||
float sampleTemp;
|
||||
float dsc;
|
||||
};
|
||||
|
||||
enum TestType{
|
||||
OIT,
|
||||
NoneOIT
|
||||
};
|
||||
|
||||
struct ExperimentInfo{
|
||||
// experiment info
|
||||
QString sampleName;
|
||||
QString sampleWeight;
|
||||
QString date;
|
||||
QString experimentor;
|
||||
// phase info
|
||||
TestType testType;
|
||||
GasType initialAtmosPhere;
|
||||
int phaseSize;
|
||||
|
||||
QVector<Phase> phaseVtr;
|
||||
};
|
||||
|
||||
struct PhaseTotalInfo{
|
||||
int phaseIndex; // from 1 to 6.
|
||||
Phase phase;
|
||||
QVector<ExperimentData> dataVtr;
|
||||
};
|
||||
|
||||
//
|
||||
extern QVector<QPair<QCPCurve*,QVector<Global::ExperimentData>>> _curveDataVtr;
|
||||
extern ExperimentInfo _experimentInfo;
|
||||
extern Mode _mode;
|
||||
}
|
||||
|
||||
#if 0
|
||||
class Global:public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -40,22 +92,37 @@ public:
|
||||
float dsc;
|
||||
};
|
||||
|
||||
struct ExpeInfo
|
||||
{
|
||||
QString sampleName;
|
||||
float sampleWeight;
|
||||
QString date;
|
||||
QString userName;
|
||||
// struct ExpeInfo
|
||||
// {
|
||||
// QString sampleName;
|
||||
// float sampleWeight;
|
||||
// QString date;
|
||||
// QString userName;
|
||||
// };
|
||||
|
||||
enum TestType{
|
||||
OIT,
|
||||
NoneOIT
|
||||
};
|
||||
|
||||
struct ExperimentInfo{
|
||||
// experiment info
|
||||
QString sampleName;
|
||||
QString sampleWeight;
|
||||
QString date;
|
||||
QString operatorName;
|
||||
QString experimentor;
|
||||
// phase info
|
||||
TestType testType;
|
||||
GasType initialAtmosPhere;
|
||||
int phaseSize;
|
||||
|
||||
QVector<Phase> phaseVtr;
|
||||
};
|
||||
|
||||
ExperimentInfo _experimentInfo;
|
||||
|
||||
struct PhaseTotalInfo{
|
||||
int phaseIndex;
|
||||
int phaseIndex; // from 1 to 6.
|
||||
Phase phase;
|
||||
QVector<ExperimentData> dataVtr;
|
||||
};
|
||||
@ -70,5 +137,6 @@ private:
|
||||
Mode _mode;
|
||||
DeviceConnectionStatus _deviceConnectStatus;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // GLOBAL_H
|
||||
|
26
src/main.cpp
26
src/main.cpp
@ -14,7 +14,7 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
|
||||
Logger::instance();
|
||||
logde<<"main...";
|
||||
@ -25,26 +25,26 @@ int main(int argc, char *argv[])
|
||||
// MainWindow w;
|
||||
// w.show();
|
||||
|
||||
XlsxHandler::test();
|
||||
XlsxHandler::test();
|
||||
|
||||
|
||||
// FileManager::test();
|
||||
// FileManager::test();
|
||||
|
||||
// ExperimentSettingForm es;
|
||||
// es.show();
|
||||
// ExperimentSettingForm es;
|
||||
// es.show();
|
||||
|
||||
// CentralWidget central;
|
||||
// central.show();
|
||||
// CentralWidget central;
|
||||
// central.show();
|
||||
|
||||
// SerialPort::parserTest();
|
||||
// SerialPort::parserTest();
|
||||
|
||||
// SerialPort sp;
|
||||
// SerialPort sp;
|
||||
|
||||
// RealTimeDataForm r;
|
||||
// r.show();
|
||||
// RealTimeDataForm r;
|
||||
// r.show();
|
||||
|
||||
// QObject::connect(&sp,&SerialPort::sigSendSerialPortData,
|
||||
// &r,&RealTimeDataForm::slotRevSerialPortData);
|
||||
// QObject::connect(&sp,&SerialPort::sigSendSerialPortData,
|
||||
// &r,&RealTimeDataForm::slotRevSerialPortData);
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
,_degreeOfCureForm(new DegreeOfCureForm(this))
|
||||
,_OITAutoAnalysisParamForm(new OITAutoAnalysisParamForm(this))
|
||||
,_degreeOfCrystallinityForm(new DegreeOfCrystallinityForm(this))
|
||||
,_aboutForm(new AboutForm(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
this->setToolTip(".....");
|
||||
@ -36,7 +37,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
ui->statusbar->showMessage("showMessage show temp message!");
|
||||
// permenent show
|
||||
QLabel *permenentLabel = new QLabel(this);
|
||||
permenentLabel->setText("Permanent show!");
|
||||
permenentLabel->setText("Software Ver:" + ConSoftVersion);
|
||||
ui->statusbar->addPermanentWidget(permenentLabel);
|
||||
//
|
||||
#if 0
|
||||
@ -69,6 +70,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
setSubWidgetAttribute(_instrumentCoefficientForm);
|
||||
setSubWidgetAttribute(_OITAutoAnalysisParamForm);
|
||||
setSubWidgetAttribute(_degreeOfCrystallinityForm);
|
||||
setSubWidgetAttribute(_aboutForm);
|
||||
|
||||
//
|
||||
setActionEnable(true);
|
||||
@ -114,8 +116,8 @@ void MainWindow::connections()
|
||||
#endif
|
||||
|
||||
// mode
|
||||
connect(Global::instance(), &Global::sigModeModify,
|
||||
_centralWidget, &CentralWidget::slotModeModify);
|
||||
// connect(Global::instance(), &Global::sigModeModify,
|
||||
// _centralWidget, &CentralWidget::slotModeModify);
|
||||
//analysis
|
||||
connect(_leftWidget,&LeftWidget::sigSendAnalysisFileName,
|
||||
_centralWidget,&CentralWidget::slotRecvAnalysisFileName);
|
||||
@ -171,7 +173,8 @@ void MainWindow::on_actionStop_triggered()
|
||||
|
||||
FileManager::close();
|
||||
|
||||
Global::instance()->setMode(Global::Mode::Analysis);
|
||||
// Global::instance()->setMode(Global::Mode::Analysis);
|
||||
Global::_mode = Global::Mode::Analysis;
|
||||
}
|
||||
|
||||
void MainWindow::on_actionNew_triggered()
|
||||
@ -190,12 +193,14 @@ void MainWindow::on_actionStart_triggered()
|
||||
//
|
||||
FileManager::createExperimentFile();
|
||||
|
||||
Global::instance()->setMode(Global::Mode::ExperimentStart);
|
||||
// Global::instance()->setMode(Global::Mode::ExperimentStart);
|
||||
Global::_mode = Global::Mode::ExperimentStart;
|
||||
}
|
||||
|
||||
void MainWindow::on_actionReadOnly_triggered()
|
||||
{
|
||||
Global::instance()->setMode(Global::Mode::ExperimentStart);
|
||||
// Global::instance()->setMode(Global::Mode::ExperimentStart);
|
||||
Global::_mode = Global::Mode::ExperimentStart;
|
||||
SerialPort::instance()->openSp();
|
||||
}
|
||||
|
||||
@ -209,7 +214,8 @@ void MainWindow::on_actionConnectToDev_triggered()
|
||||
if (SerialPort::instance()->openSp())
|
||||
{
|
||||
setActionEnable(true);
|
||||
Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
||||
// Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
||||
Global::_mode = Global::Mode::ConnectedToDev;
|
||||
|
||||
QByteArray ba = DataParser::inquirePhaseInfo();
|
||||
SerialPort::instance()->sendData(ba);
|
||||
@ -305,3 +311,8 @@ void MainWindow::on_actionDegreeOfCuring_triggered()
|
||||
//
|
||||
_degreeOfCureForm->show();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionAbout_triggered()
|
||||
{
|
||||
_aboutForm->show();
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "instrumentcoefficientform.h"
|
||||
#include "degreeofcureform.h"
|
||||
#include "oitautoanalysisparamform.h"
|
||||
#include "aboutform.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
@ -69,6 +70,8 @@ private slots:
|
||||
|
||||
void on_actionDegreeOfCuring_triggered();
|
||||
|
||||
void on_actionAbout_triggered();
|
||||
|
||||
private:
|
||||
void connections();
|
||||
void setActionEnable(const bool);
|
||||
@ -88,5 +91,6 @@ private:
|
||||
InstrumentCoefficientForm* _instrumentCoefficientForm;
|
||||
DegreeOfCureForm *_degreeOfCureForm;
|
||||
OITAutoAnalysisParamForm* _OITAutoAnalysisParamForm;
|
||||
AboutForm *_aboutForm;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
@ -77,6 +77,7 @@
|
||||
<property name="title">
|
||||
<string>帮助</string>
|
||||
</property>
|
||||
<addaction name="actionAbout"/>
|
||||
</widget>
|
||||
<addaction name="menu"/>
|
||||
<addaction name="menu_2"/>
|
||||
@ -247,6 +248,11 @@
|
||||
<string>固化度</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout">
|
||||
<property name="text">
|
||||
<string>关于</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="images.qrc"/>
|
||||
|
@ -182,7 +182,8 @@ namespace DataParser
|
||||
switch(cd.run_type){
|
||||
case DeviceRunStatus::Idle:
|
||||
case DeviceRunStatus::Cooling:
|
||||
Global::instance()->setMode(Global::Mode::Analysis);
|
||||
// Global::instance()->setMode(Global::Mode::Analysis);
|
||||
Global::_mode = Global::Mode::Analysis;
|
||||
return true;
|
||||
break;
|
||||
default:break;
|
||||
|
@ -132,7 +132,7 @@ void SerialPort::slotReadData()
|
||||
// read data
|
||||
if (spp->addr == 0)
|
||||
{
|
||||
if (Global::Mode::ExperimentStart == Global::instance()->getMode())
|
||||
if (Global::Mode::ExperimentStart == Global::_mode)
|
||||
{
|
||||
emit sigSendCommonData(cd);
|
||||
}
|
||||
@ -172,7 +172,8 @@ void SerialPort::commonDataParser(const int dataLength, const u16 addr,
|
||||
{
|
||||
switch(cd.run_type){
|
||||
case DeviceRunStatus::Cooling:
|
||||
Global::instance()->setMode(Global::Mode::Analysis);
|
||||
// Global::instance()->setMode(Global::Mode::Analysis);
|
||||
Global::_mode = Global::Mode::Analysis;
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
@ -198,10 +199,12 @@ void SerialPort::commonDataParser(const int dataLength, const u16 addr,
|
||||
switch (mode)
|
||||
{
|
||||
case DeviceStartMode::Stop:
|
||||
Global::instance()->setMode(Global::Mode::Analysis);
|
||||
// Global::instance()->setMode(Global::Mode::Analysis);
|
||||
Global::_mode = Global::Mode::Analysis;
|
||||
break;
|
||||
case DeviceStartMode::Start:
|
||||
Global::instance()->setMode(Global::Mode::ExperimentStart);
|
||||
// Global::instance()->setMode(Global::Mode::ExperimentStart);
|
||||
Global::_mode = Global::Mode::ExperimentStart;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
24
src/ui/aboutform.cpp
Normal file
24
src/ui/aboutform.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include "aboutform.h"
|
||||
#include "ui_aboutform.h"
|
||||
#include "defines.h"
|
||||
|
||||
AboutForm::AboutForm(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::AboutForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// ui->labelContent->setText(ConSoftVersion);
|
||||
ui->labelContent->setAlignment(Qt::AlignTop | Qt::AlignLeft);
|
||||
ui->labelContent->setText(QString("软件版本:%1").arg(ConSoftVersion));
|
||||
}
|
||||
|
||||
AboutForm::~AboutForm()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AboutForm::on_pushButtonClose_clicked()
|
||||
{
|
||||
hide();
|
||||
}
|
25
src/ui/aboutform.h
Normal file
25
src/ui/aboutform.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef ABOUTFORM_H
|
||||
#define ABOUTFORM_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class AboutForm;
|
||||
}
|
||||
|
||||
class AboutForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutForm(QWidget *parent = nullptr);
|
||||
~AboutForm();
|
||||
|
||||
private slots:
|
||||
void on_pushButtonClose_clicked();
|
||||
|
||||
private:
|
||||
Ui::AboutForm *ui;
|
||||
};
|
||||
|
||||
#endif // ABOUTFORM_H
|
58
src/ui/aboutform.ui
Normal file
58
src/ui/aboutform.ui
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AboutForm</class>
|
||||
<widget class="QWidget" name="AboutForm">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>428</width>
|
||||
<height>290</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="labelLogo">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>70</y>
|
||||
<width>131</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>差示扫描量热仪Logo</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelContent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>20</y>
|
||||
<width>261</width>
|
||||
<height>251</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButtonClose">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>240</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>关闭</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -45,8 +45,8 @@ CentralWidget::CentralWidget(QWidget *parent)
|
||||
_eventHandler->setEnable(true);
|
||||
|
||||
_customPlot->installEventFilter(_eventHandler);
|
||||
// _customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||
_customPlot->setInteractions( QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||
// _customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||
_customPlot->setInteractions( QCP::iRangeZoom | QCP::iSelectPlottables);
|
||||
|
||||
connect(_eventHandler,&EventHandler::sigSendLineXCoord,
|
||||
this,&CentralWidget::sigSendLineXCoord);
|
||||
@ -129,9 +129,35 @@ void CentralWidget::slotRecvCommonData(const CommonData &cd)
|
||||
{
|
||||
qDebug() << "slotRevCommonData";
|
||||
|
||||
_customPlot->graph(0)->addData(cd.sample_temp, cd.dsc); // 添加数据到曲线
|
||||
_customPlot->replot();
|
||||
if(!_currentCurve){
|
||||
_currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis);
|
||||
|
||||
Global::_curveDataVtr.clear();
|
||||
|
||||
Global::_curveDataVtr.push_back(qMakePair<QCPCurve*, QVector<Global::ExperimentData>>(
|
||||
_currentCurve, QVector<Global::ExperimentData>()
|
||||
));
|
||||
}
|
||||
|
||||
QVector<Global::ExperimentData>& edVtr = Global::_curveDataVtr.first().second;
|
||||
|
||||
Global::ExperimentData ed;
|
||||
ed.dsc = cd .dsc;
|
||||
ed.sampleTemp = cd.sample_temp;
|
||||
ed.runTime = cd.add_run_time;
|
||||
ed.constantTempTime = cd.add_constan_temp_time;
|
||||
|
||||
edVtr.push_back(ed);
|
||||
|
||||
_currentCurve->addData(cd.sample_temp, cd.dsc);
|
||||
|
||||
// customPlot->xAxis->rescale();
|
||||
// customPlot->yAxis->rescale();
|
||||
|
||||
// _customPlot->graph(0)->addData(cd.sample_temp, cd.dsc); // 添加数据到曲线
|
||||
|
||||
_customPlot->rescaleAxes();
|
||||
_customPlot->replot();
|
||||
//
|
||||
FileManager::writeExperimentFile(cd);
|
||||
}
|
||||
@ -182,9 +208,8 @@ void CentralWidget::slotRecvAnalysisFileName(const QString &fileName)
|
||||
_currentCurve->setSelectable(QCP::stWhole); // 设置曲线可选
|
||||
// _currentCurve->setSelectable(QCP::stPlottable); // 设置曲线可选
|
||||
|
||||
Global::instance()->_curveDataVtr.push_back(
|
||||
qMakePair<QCPCurve*,QVector<Global::ExperimentData>>(
|
||||
_currentCurve,_dataVtr));
|
||||
Global::_curveDataVtr.push_back(qMakePair<QCPCurve*,QVector<Global::ExperimentData>>(
|
||||
_currentCurve,_dataVtr));
|
||||
|
||||
// 清除第一个图表上的数据
|
||||
#if 0
|
||||
@ -604,7 +629,7 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
|
||||
}
|
||||
|
||||
// Clear data.
|
||||
Global::instance()->_curveDataVtr.clear();
|
||||
Global::_curveDataVtr.clear();
|
||||
|
||||
// Set lines visiable false.
|
||||
_line1->setVisible(false);
|
||||
|
@ -406,12 +406,21 @@ void ExperimentSettingForm::slotConnectToDevice()
|
||||
qDebug() << "ba size:" << ba.size();
|
||||
emit sigDeliverData(ba);
|
||||
|
||||
// Global::instance()->setMode(Global::Mode::ConnectedToDev);
|
||||
//
|
||||
Global::ExperimentInfo& ei = Global::_experimentInfo;
|
||||
ei.phaseVtr = phaseVtr;
|
||||
ei.sampleName = ui->sampleNameLineEdit->text();
|
||||
ei.sampleWeight = ui->sampleWeightLineEdit->text();
|
||||
ei.date = ui->dateTimeLineEdit->text();
|
||||
ei.experimentor = ui->userLineEdit->text();
|
||||
|
||||
#if 0
|
||||
QByteArray startBa = DataParser::setDeviceStartStop(DeviceStartMode::Start);
|
||||
emit sigConnectToDevice(startBa);
|
||||
#endif
|
||||
if(ui->radioButton_OIT->isChecked()){
|
||||
ei.testType = Global::TestType::OIT;
|
||||
} else if(ui->radioButton_OIT_not->isChecked()){
|
||||
ei.testType = Global::TestType::NoneOIT;
|
||||
}
|
||||
|
||||
ei.initialAtmosPhere = (GasType)(ui->comboBox_phase_1_atmosphere->currentIndex());
|
||||
|
||||
hide();
|
||||
}
|
||||
@ -482,7 +491,7 @@ void ExperimentSettingForm::on_pushButton_deliverData_clicked()
|
||||
FileManager::_expeInfo.sampleName = ui->sampleNameLineEdit->text();
|
||||
FileManager::_expeInfo.sampleWeight = ui->sampleWeightLineEdit->text().toInt(nullptr, 16);
|
||||
FileManager::_expeInfo.date = ui->dateTimeLineEdit->text();
|
||||
FileManager::_expeInfo.userName = ui->userLineEdit->text();
|
||||
FileManager::_expeInfo.experimentor = ui->userLineEdit->text();
|
||||
}
|
||||
|
||||
void ExperimentSettingForm::slotRecvPhaseInfo(const QByteArray &ba)
|
||||
|
@ -78,7 +78,7 @@ void LeftWidget::initData()
|
||||
void LeftWidget::slotTreeWidgetItemClicked(QTreeWidgetItem *item, int column){
|
||||
qDebug()<<"item clicked:"<<item->text(0)<<column;
|
||||
|
||||
if(Global::Mode::Analysis != Global::instance()->getMode()){
|
||||
if(Global::Mode::Analysis != Global::_mode){
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ void SpecificHeatComparisonMethodForm::slotSetCurve(const int type, QCPCurve *c
|
||||
|
||||
void SpecificHeatComparisonMethodForm::on_pushButtonCalculate_clicked()
|
||||
{
|
||||
auto& curveDataVtr = Global::instance()->_curveDataVtr;
|
||||
auto& curveDataVtr = Global::_curveDataVtr;
|
||||
QVector<Global::ExperimentData> *baseLineDataVtr = nullptr,
|
||||
*standardSampleDataVtr = nullptr,
|
||||
*sampleDataVtr = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user