Compare commits
2 Commits
7ded94c2a4
...
39578dc9fe
| Author | SHA1 | Date | |
|---|---|---|---|
| 39578dc9fe | |||
| e326dcb20c |
@ -498,7 +498,8 @@ void OneMotionCaptureCoordinator::stopStepMotion()
|
|||||||
m_cameraCtrl->stop_record();
|
m_cameraCtrl->stop_record();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit stopMotorSignal(0);
|
//emit stopMotorSignal(0);
|
||||||
|
move2LocBeforeStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OneMotionCaptureCoordinator::handleCaptureCompleteWhenFrameNumberMeet()
|
void OneMotionCaptureCoordinator::handleCaptureCompleteWhenFrameNumberMeet()
|
||||||
@ -528,6 +529,10 @@ void OneMotionCaptureCoordinator::getLocBeforeStart()
|
|||||||
loop.exec();
|
loop.exec();
|
||||||
|
|
||||||
disconnect(conn);
|
disconnect(conn);
|
||||||
|
|
||||||
|
std::vector<double> pos;
|
||||||
|
pos.push_back(0);
|
||||||
|
m_locBeforeStart = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OneMotionCaptureCoordinator::move2LocBeforeStart()
|
void OneMotionCaptureCoordinator::move2LocBeforeStart()
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
#include "FodisWindow.h"
|
#include "FodisWindow.h"
|
||||||
|
#include "JinspFiberImagerConfig.h"
|
||||||
|
|
||||||
FodisWindow::FodisWindow(QWidget* parent)
|
FodisWindow::FodisWindow(QWidget* parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
@ -6,7 +7,8 @@ FodisWindow::FodisWindow(QWidget* parent)
|
|||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
m_FiberImagerThread = new QThread();
|
m_FiberImagerThread = new QThread();
|
||||||
m_JinspFiberImagerOperation = new JinspFiberImager(false, "COM9", "JINSP");
|
m_JinspFiberImagerOperation = new JinspFiberImager(false, JinspFiberImagerConfig::instance().portName().toStdString(), "JINSP");
|
||||||
|
connect(m_JinspFiberImagerOperation, &JinspFiberImager::spectalCaptured, this, &FodisWindow::spectalCaptured);
|
||||||
m_JinspFiberImagerOperation->moveToThread(m_FiberImagerThread);
|
m_JinspFiberImagerOperation->moveToThread(m_FiberImagerThread);
|
||||||
m_FiberImagerThread->start();
|
m_FiberImagerThread->start();
|
||||||
|
|
||||||
|
|||||||
@ -42,6 +42,8 @@ signals:
|
|||||||
void PlotSpectralSignal();
|
void PlotSpectralSignal();
|
||||||
void FiberImagerClosedSignal();
|
void FiberImagerClosedSignal();
|
||||||
|
|
||||||
|
void spectalCaptured(DeviceAttribute attribute, DataFrame dataFrame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::FodisWindow ui;
|
Ui::FodisWindow ui;
|
||||||
QThread* m_FiberImagerThread;
|
QThread* m_FiberImagerThread;
|
||||||
|
|||||||
25
HPPA/GonggaShanRecordCtl.cpp
Normal file
25
HPPA/GonggaShanRecordCtl.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
#include "GonggaShanRecordCtl.h"
|
||||||
|
|
||||||
|
GonggaShanRecordCtl::GonggaShanRecordCtl(QWidget* parent)
|
||||||
|
: QDialog(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
connect(ui.btnListen, &QPushButton::clicked, this, &GonggaShanRecordCtl::startListen);
|
||||||
|
connect(ui.btnDisListen, &QPushButton::clicked, this, &GonggaShanRecordCtl::stopListen);
|
||||||
|
}
|
||||||
|
|
||||||
|
GonggaShanRecordCtl::~GonggaShanRecordCtl()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GonggaShanRecordCtl::startListen()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void GonggaShanRecordCtl::stopListen()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
34
HPPA/GonggaShanRecordCtl.h
Normal file
34
HPPA/GonggaShanRecordCtl.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "ui_gonggashanCtl.h"
|
||||||
|
|
||||||
|
class GonggaShanRecordCtl : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
GonggaShanRecordCtl(QWidget* parent = nullptr);
|
||||||
|
~GonggaShanRecordCtl();
|
||||||
|
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
// Emitted when user changes any of the R/G/B wavelength values
|
||||||
|
void startRcordHsiSignal();
|
||||||
|
void stopRcordHsiSignal();
|
||||||
|
|
||||||
|
void startRcordFodisSignal();
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void startListen();
|
||||||
|
void stopListen();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::gongga_control ui;
|
||||||
|
};
|
||||||
@ -455,6 +455,44 @@ HPPA::HPPA(QWidget* parent)
|
|||||||
m_carousel->addWidget(sa_SingleLensReflexCamera);
|
m_carousel->addWidget(sa_SingleLensReflexCamera);
|
||||||
m_carousel->setContentsMargins(0, 0, 0, 0);
|
m_carousel->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
QChartView * m_FiberImagerChartView = new QChartView();
|
||||||
|
m_FiberImagerChartView->setRenderHint(QPainter::Antialiasing);
|
||||||
|
m_FiberImagerChartView->setStyleSheet(R"(
|
||||||
|
background: #0D1233;
|
||||||
|
)");
|
||||||
|
|
||||||
|
m_FiberImagerChart = new QChart();
|
||||||
|
m_FiberImagerChart->setBackgroundBrush(QColor("#0D1233"));
|
||||||
|
m_FiberImagerChart->legend()->hide();
|
||||||
|
//m_FiberImagerChart->setTitle("Simple line chart example");
|
||||||
|
|
||||||
|
QValueAxis* axisX_FiberImagerChart = new QValueAxis();
|
||||||
|
QValueAxis* axisY_FiberImagerChart = new QValueAxis();
|
||||||
|
setAxis(axisX, axisY);
|
||||||
|
m_FiberImagerChart->addAxis(axisX_FiberImagerChart, Qt::AlignBottom);
|
||||||
|
m_FiberImagerChart->addAxis(axisY_FiberImagerChart, Qt::AlignLeft);
|
||||||
|
m_FiberImagerChartView->setChart(m_FiberImagerChart);
|
||||||
|
|
||||||
|
QScrollArea* sa_FiberImager = new QScrollArea();
|
||||||
|
sa_FiberImager->setObjectName("sa_FiberImager");
|
||||||
|
sa_FiberImager->setStyleSheet(R"(
|
||||||
|
border: none;
|
||||||
|
background-color: #0D1233;
|
||||||
|
)");
|
||||||
|
QGridLayout* gridLayout_sa_FiberImager = new QGridLayout(sa_FiberImager);
|
||||||
|
gridLayout_sa_FiberImager->setSpacing(6);
|
||||||
|
gridLayout_sa_FiberImager->setObjectName(QString::fromUtf8("gridLayout_sa_FiberImager"));
|
||||||
|
gridLayout_sa_FiberImager->setVerticalSpacing(0);
|
||||||
|
gridLayout_sa_FiberImager->setContentsMargins(0, 0, 0, 0);
|
||||||
|
gridLayout_sa_FiberImager->addWidget(m_FiberImagerChartView);
|
||||||
|
|
||||||
|
m_carousel->addWidget(sa_FiberImager);
|
||||||
|
m_carousel->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_carousel->play();
|
m_carousel->play();
|
||||||
|
|
||||||
gridLayout_carouselContainer->addWidget(m_carousel);
|
gridLayout_carouselContainer->addWidget(m_carousel);
|
||||||
@ -1021,9 +1059,16 @@ void HPPA::initControlTabwidget()
|
|||||||
|
|
||||||
//is11
|
//is11
|
||||||
m_fodisWindow = new FodisWindow(this);
|
m_fodisWindow = new FodisWindow(this);
|
||||||
|
connect(m_fodisWindow, &FodisWindow::spectalCaptured, this, &HPPA::showFiberImagerSpectral);
|
||||||
m_fodisWindow->setWindowFlags(Qt::Widget);
|
m_fodisWindow->setWindowFlags(Qt::Widget);
|
||||||
ui.controlTabWidget->addTab(m_fodisWindow, QString::fromLocal8Bit("FODIS"));
|
ui.controlTabWidget->addTab(m_fodisWindow, QString::fromLocal8Bit("FODIS"));
|
||||||
|
|
||||||
|
//
|
||||||
|
m_gonggaShanRecordCtl = new GonggaShanRecordCtl(this);
|
||||||
|
m_gonggaShanRecordCtl->setWindowFlags(Qt::Widget);
|
||||||
|
ui.controlTabWidget->addTab(m_gonggaShanRecordCtl, QString::fromLocal8Bit("触发采集"));
|
||||||
|
|
||||||
|
|
||||||
// Connect ImageControl band change to re-render (m_ic created in initControlTabwidget)
|
// Connect ImageControl band change to re-render (m_ic created in initControlTabwidget)
|
||||||
//connect(m_ic, SIGNAL(bandSelectionChanged(double, double, double)),
|
//connect(m_ic, SIGNAL(bandSelectionChanged(double, double, double)),
|
||||||
// this, SLOT(onBandSelectionChanged(double, double, double)));
|
// this, SLOT(onBandSelectionChanged(double, double, double)));
|
||||||
@ -1530,6 +1575,7 @@ void HPPA::createGonggaRotatingPlatformScenario()
|
|||||||
m_tabManager->showTab(m_ic);
|
m_tabManager->showTab(m_ic);
|
||||||
m_tabManager->showTab(m_fodisWindow);
|
m_tabManager->showTab(m_fodisWindow);
|
||||||
m_tabManager->showTab(m_omc);
|
m_tabManager->showTab(m_omc);
|
||||||
|
m_tabManager->showTab(m_gonggaShanRecordCtl);
|
||||||
|
|
||||||
m_view3DModelManager->switchScenario(View3DModelManager::ScenarioType::OneMotor);
|
m_view3DModelManager->switchScenario(View3DModelManager::ScenarioType::OneMotor);
|
||||||
}
|
}
|
||||||
@ -2084,6 +2130,37 @@ void HPPA::setAxis(QValueAxis* axisX, QValueAxis* axisY)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HPPA::showFiberImagerSpectral(DeviceAttribute attribute, DataFrame dataFrame)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
QLineSeries* series = new QLineSeries();
|
||||||
|
|
||||||
|
const int count = qMin(attribute.iPixels, 4096);
|
||||||
|
for (int i = 0; i < count; ++i)
|
||||||
|
{
|
||||||
|
double wavelength = attribute.fWaveLengthInNM[i];
|
||||||
|
double intensity = dataFrame.lData[i];
|
||||||
|
series->append(wavelength, intensity);
|
||||||
|
}
|
||||||
|
|
||||||
|
series->setPen(QPen(QColor("#FF928A"), 2));
|
||||||
|
|
||||||
|
m_FiberImagerChart->removeAllSeries();
|
||||||
|
m_FiberImagerChart->addSeries(series);
|
||||||
|
m_FiberImagerChart->createDefaultAxes();
|
||||||
|
|
||||||
|
QValueAxis* axisX = qobject_cast<QValueAxis*>(m_FiberImagerChart->axisX());
|
||||||
|
QValueAxis* axisY = qobject_cast<QValueAxis*>(m_FiberImagerChart->axisY());
|
||||||
|
|
||||||
|
setAxis(axisX, axisY);
|
||||||
|
}
|
||||||
|
catch (const std::exception&)
|
||||||
|
{
|
||||||
|
std::cout << "显示光谱有错误!" << std::endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HPPA::timerEvent(QTimerEvent* event)
|
void HPPA::timerEvent(QTimerEvent* event)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,6 +89,8 @@
|
|||||||
#include "PowerControl3D.h"
|
#include "PowerControl3D.h"
|
||||||
#include "FodisWindow.h"
|
#include "FodisWindow.h"
|
||||||
|
|
||||||
|
#include "GonggaShanRecordCtl.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#define PI 3.1415926
|
#define PI 3.1415926
|
||||||
@ -321,6 +323,7 @@ private:
|
|||||||
OneMotorControl* m_omc;
|
OneMotorControl* m_omc;
|
||||||
TwoMotorControl* m_tmc;
|
TwoMotorControl* m_tmc;
|
||||||
FodisWindow* m_fodisWindow;
|
FodisWindow* m_fodisWindow;
|
||||||
|
GonggaShanRecordCtl* m_gonggaShanRecordCtl;
|
||||||
QPointer<TimedDataCollection> m_tdc;
|
QPointer<TimedDataCollection> m_tdc;
|
||||||
|
|
||||||
View3DModelManager* m_view3DModelManager;
|
View3DModelManager* m_view3DModelManager;
|
||||||
@ -356,6 +359,9 @@ private:
|
|||||||
void showQuickPreview(int fileNumber, const QString& filePath, const cv::Mat& rgbImage);
|
void showQuickPreview(int fileNumber, const QString& filePath, const cv::Mat& rgbImage);
|
||||||
|
|
||||||
|
|
||||||
|
QChart* m_FiberImagerChart;
|
||||||
|
void showFiberImagerSpectral(DeviceAttribute attribute, DataFrame dataFrame);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QString filePath);
|
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QString filePath);
|
||||||
void focusPlotSpectralImg(int state);
|
void focusPlotSpectralImg(int state);
|
||||||
|
|||||||
@ -119,6 +119,7 @@
|
|||||||
<ClCompile Include="DepthCameraWindow.cpp" />
|
<ClCompile Include="DepthCameraWindow.cpp" />
|
||||||
<ClCompile Include="FileNameLineEdit.cpp" />
|
<ClCompile Include="FileNameLineEdit.cpp" />
|
||||||
<ClCompile Include="FodisWindow.cpp" />
|
<ClCompile Include="FodisWindow.cpp" />
|
||||||
|
<ClCompile Include="GonggaShanRecordCtl.cpp" />
|
||||||
<ClCompile Include="hppaConfigFile.cpp" />
|
<ClCompile Include="hppaConfigFile.cpp" />
|
||||||
<ClCompile Include="HyperImagerControl.cpp" />
|
<ClCompile Include="HyperImagerControl.cpp" />
|
||||||
<ClCompile Include="imageControl.cpp" />
|
<ClCompile Include="imageControl.cpp" />
|
||||||
@ -126,6 +127,7 @@
|
|||||||
<ClCompile Include="imager_base.cpp" />
|
<ClCompile Include="imager_base.cpp" />
|
||||||
<ClCompile Include="irisximeaimager.cpp" />
|
<ClCompile Include="irisximeaimager.cpp" />
|
||||||
<ClCompile Include="JinspFiberImager.cpp" />
|
<ClCompile Include="JinspFiberImager.cpp" />
|
||||||
|
<ClCompile Include="JinspFiberImagerConfig.cpp" />
|
||||||
<ClCompile Include="LayerTree.cpp" />
|
<ClCompile Include="LayerTree.cpp" />
|
||||||
<ClCompile Include="LayerTreeGroupNode.cpp" />
|
<ClCompile Include="LayerTreeGroupNode.cpp" />
|
||||||
<ClCompile Include="LayerTreeImageNode.cpp" />
|
<ClCompile Include="LayerTreeImageNode.cpp" />
|
||||||
@ -180,6 +182,7 @@
|
|||||||
<QtUic Include="DepthCamera.ui" />
|
<QtUic Include="DepthCamera.ui" />
|
||||||
<QtUic Include="FocusDialog.ui" />
|
<QtUic Include="FocusDialog.ui" />
|
||||||
<QtUic Include="fodis.ui" />
|
<QtUic Include="fodis.ui" />
|
||||||
|
<QtUic Include="gonggashanCtl.ui" />
|
||||||
<QtUic Include="HPPA.ui" />
|
<QtUic Include="HPPA.ui" />
|
||||||
<QtMoc Include="HPPA.h" />
|
<QtMoc Include="HPPA.h" />
|
||||||
<ClCompile Include="fileOperation.cpp" />
|
<ClCompile Include="fileOperation.cpp" />
|
||||||
@ -236,6 +239,7 @@
|
|||||||
<QtMoc Include="CommunicationInterfaceBase.h" />
|
<QtMoc Include="CommunicationInterfaceBase.h" />
|
||||||
<QtMoc Include="FodisWindow.h" />
|
<QtMoc Include="FodisWindow.h" />
|
||||||
<ClInclude Include="FiberSpectrometerOperationBase.h" />
|
<ClInclude Include="FiberSpectrometerOperationBase.h" />
|
||||||
|
<QtMoc Include="GonggaShanRecordCtl.h" />
|
||||||
<ClInclude Include="imager_base.h" />
|
<ClInclude Include="imager_base.h" />
|
||||||
<ClInclude Include="irisximeaimager.h" />
|
<ClInclude Include="irisximeaimager.h" />
|
||||||
<QtMoc Include="OneMotorControl.h" />
|
<QtMoc Include="OneMotorControl.h" />
|
||||||
|
|||||||
@ -259,6 +259,12 @@
|
|||||||
<ClCompile Include="JinspFiberImager.cpp">
|
<ClCompile Include="JinspFiberImager.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="JinspFiberImagerConfig.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="GonggaShanRecordCtl.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="fileOperation.h">
|
<QtMoc Include="fileOperation.h">
|
||||||
@ -426,6 +432,9 @@
|
|||||||
<QtMoc Include="JinspFiberImager.h">
|
<QtMoc Include="JinspFiberImager.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
<QtMoc Include="GonggaShanRecordCtl.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="imageProcessor.h">
|
<ClInclude Include="imageProcessor.h">
|
||||||
@ -547,6 +556,9 @@
|
|||||||
<QtUic Include="fodis.ui">
|
<QtUic Include="fodis.ui">
|
||||||
<Filter>Form Files</Filter>
|
<Filter>Form Files</Filter>
|
||||||
</QtUic>
|
</QtUic>
|
||||||
|
<QtUic Include="gonggashanCtl.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="cpp.hint" />
|
<None Include="cpp.hint" />
|
||||||
|
|||||||
@ -13,6 +13,9 @@ JinspFiberImager::JinspFiberImager(bool bIsUSBMode, std::string ucPortNumber, st
|
|||||||
m_record = false;
|
m_record = false;
|
||||||
|
|
||||||
m_captureIntervalMilliseconds = 5 * 1000;
|
m_captureIntervalMilliseconds = 5 * 1000;
|
||||||
|
|
||||||
|
qRegisterMetaType<DeviceAttribute>("DeviceAttribute");
|
||||||
|
qRegisterMetaType<DataFrame>("DataFrame");
|
||||||
}
|
}
|
||||||
|
|
||||||
JinspFiberImager::~JinspFiberImager()
|
JinspFiberImager::~JinspFiberImager()
|
||||||
@ -162,6 +165,8 @@ void JinspFiberImager::recordTarget(int recordTimes, QString path)
|
|||||||
m_IntegratingSphereData.lData[i] = m_IntegratingSphereData.lData[i] / recordTimes;
|
m_IntegratingSphereData.lData[i] = m_IntegratingSphereData.lData[i] / recordTimes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//将m_IntegratingSphereData通过信号发送
|
||||||
|
emit spectalCaptured(attribute, m_IntegratingSphereData);
|
||||||
|
|
||||||
//输出到csv
|
//输出到csv
|
||||||
QDateTime curDateTime = QDateTime::currentDateTime();
|
QDateTime curDateTime = QDateTime::currentDateTime();
|
||||||
|
|||||||
@ -64,4 +64,5 @@ public slots:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendExposureTimeSignal(int exposureTime);
|
void sendExposureTimeSignal(int exposureTime);
|
||||||
|
void spectalCaptured(DeviceAttribute attribute, DataFrame dataFrame);
|
||||||
};
|
};
|
||||||
|
|||||||
85
HPPA/JinspFiberImagerConfig.cpp
Normal file
85
HPPA/JinspFiberImagerConfig.cpp
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#include "JinspFiberImagerConfig.h"
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QJsonValue>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
const QString JinspFiberImagerConfig::kDefaultPortName = QStringLiteral("COM9");
|
||||||
|
const QString JinspFiberImagerConfig::kConfigFileName = QStringLiteral("jinsp_fiber_imager_config.json");
|
||||||
|
|
||||||
|
JinspFiberImagerConfig::JinspFiberImagerConfig()
|
||||||
|
: m_configFilePath(QCoreApplication::applicationDirPath() + "/" + kConfigFileName)
|
||||||
|
, m_portName(kDefaultPortName)
|
||||||
|
{
|
||||||
|
loadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
JinspFiberImagerConfig& JinspFiberImagerConfig::instance()
|
||||||
|
{
|
||||||
|
static JinspFiberImagerConfig s;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString JinspFiberImagerConfig::portName() const
|
||||||
|
{
|
||||||
|
return m_portName;
|
||||||
|
}
|
||||||
|
|
||||||
|
void JinspFiberImagerConfig::setPortName(const QString& port)
|
||||||
|
{
|
||||||
|
if (m_portName != port)
|
||||||
|
{
|
||||||
|
m_portName = port;
|
||||||
|
saveConfig();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void JinspFiberImagerConfig::loadConfig()
|
||||||
|
{
|
||||||
|
QFile file(m_configFilePath);
|
||||||
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
|
{
|
||||||
|
qDebug() << "JinspFiberImagerConfig: No config file found, using default port:" << kDefaultPortName;
|
||||||
|
saveConfig();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray jsonData = file.readAll();
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
QJsonParseError parseError;
|
||||||
|
QJsonDocument doc = QJsonDocument::fromJson(jsonData, &parseError);
|
||||||
|
if (parseError.error != QJsonParseError::NoError)
|
||||||
|
{
|
||||||
|
qWarning() << "JinspFiberImagerConfig: JSON parse error:" << parseError.errorString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QJsonObject obj = doc.object();
|
||||||
|
if (obj.contains("portName"))
|
||||||
|
{
|
||||||
|
m_portName = obj["portName"].toString(kDefaultPortName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void JinspFiberImagerConfig::saveConfig()
|
||||||
|
{
|
||||||
|
QJsonObject obj;
|
||||||
|
obj["portName"] = m_portName;
|
||||||
|
|
||||||
|
QJsonDocument doc(obj);
|
||||||
|
|
||||||
|
QFile file(m_configFilePath);
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||||
|
{
|
||||||
|
qWarning() << "JinspFiberImagerConfig: Failed to open config file for writing:" << m_configFilePath;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
file.write(doc.toJson(QJsonDocument::Indented));
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
qDebug() << "JinspFiberImagerConfig: Config saved to" << m_configFilePath;
|
||||||
|
}
|
||||||
26
HPPA/JinspFiberImagerConfig.h
Normal file
26
HPPA/JinspFiberImagerConfig.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
class JinspFiberImagerConfig
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static JinspFiberImagerConfig& instance();
|
||||||
|
|
||||||
|
QString portName() const;
|
||||||
|
void setPortName(const QString& port);
|
||||||
|
|
||||||
|
static const QString kDefaultPortName;
|
||||||
|
static const QString kConfigFileName;
|
||||||
|
|
||||||
|
private:
|
||||||
|
JinspFiberImagerConfig();
|
||||||
|
JinspFiberImagerConfig(const JinspFiberImagerConfig&) = delete;
|
||||||
|
JinspFiberImagerConfig& operator=(const JinspFiberImagerConfig&) = delete;
|
||||||
|
|
||||||
|
QString m_configFilePath;
|
||||||
|
QString m_portName;
|
||||||
|
|
||||||
|
void loadConfig();
|
||||||
|
void saveConfig();
|
||||||
|
};
|
||||||
287
HPPA/gonggashanCtl.ui
Normal file
287
HPPA/gonggashanCtl.ui
Normal file
@ -0,0 +1,287 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>gongga_control</class>
|
||||||
|
<widget class="QWidget" name="gongga_control">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>535</width>
|
||||||
|
<height>229</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>贡嘎山触发采集</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QGroupBox
|
||||||
|
{
|
||||||
|
border: 12px solid transparent;
|
||||||
|
/*border-top: 12px solid transparent;
|
||||||
|
border-right: 0px solid transparent;
|
||||||
|
border-bottom: 0px solid transparent;
|
||||||
|
border-left: 0px solid transparent;*/
|
||||||
|
color: #ACCDFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPushButton
|
||||||
|
{
|
||||||
|
/*width: 172px;
|
||||||
|
height: 56px;*/
|
||||||
|
font: 10pt "新宋体";
|
||||||
|
background-color: qlineargradient(
|
||||||
|
spread:pad,
|
||||||
|
x1:0.5, y1:0, x2:0.5, y2:1,
|
||||||
|
stop:0 #283D86,
|
||||||
|
stop:1 #0F1A40
|
||||||
|
);
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
QPushButton:hover
|
||||||
|
{
|
||||||
|
background-color: qlineargradient(
|
||||||
|
spread:pad,
|
||||||
|
x1:0, y1:0, x2:1, y2:0,
|
||||||
|
stop:0 #3A4875,
|
||||||
|
stop:1 #5F6B91
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/* 按下时的效果 */
|
||||||
|
QPushButton:pressed
|
||||||
|
{
|
||||||
|
background-color: qlineargradient(
|
||||||
|
spread:pad,
|
||||||
|
x1:0, y1:0, x2:1, y2:0,
|
||||||
|
stop:0 #1A254F,
|
||||||
|
stop:1 #3A466B
|
||||||
|
);
|
||||||
|
/* 可选:添加下压效果 */
|
||||||
|
padding-top: 9px;
|
||||||
|
padding-bottom: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QLabel {
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
QSlider::groove:horizontal {
|
||||||
|
height: 10px;
|
||||||
|
background: #1e2a44;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 已滑过:渐变蓝 */
|
||||||
|
QSlider::sub-page:horizontal {
|
||||||
|
background: qlineargradient(
|
||||||
|
x1:0, y1:0, x2:1, y2:0,
|
||||||
|
stop:0 #1f4fff,
|
||||||
|
stop:0.5 #2f6bff,
|
||||||
|
stop:1 #5fa0ff
|
||||||
|
);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 未滑过 */
|
||||||
|
QSlider::add-page:horizontal {
|
||||||
|
height: 10px;
|
||||||
|
background: #2a3550;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ===== 滑块按钮 ===== */
|
||||||
|
QSlider::handle:horizontal {
|
||||||
|
width: 15px;
|
||||||
|
height: 10px;
|
||||||
|
|
||||||
|
/* 蓝色实心 */
|
||||||
|
background: #2f6bff;
|
||||||
|
|
||||||
|
/* 白色外圈 */
|
||||||
|
border: 2px solid #ffffff;
|
||||||
|
border-radius: 5px;
|
||||||
|
|
||||||
|
/* 垂直居中 */
|
||||||
|
margin: -5px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 悬停 */
|
||||||
|
QSlider::handle:horizontal:hover {
|
||||||
|
background: #4d8dff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 按下 */
|
||||||
|
QSlider::handle:horizontal:pressed {
|
||||||
|
background: #1f4fff;
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupAdjustments">
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QLabel
|
||||||
|
{
|
||||||
|
color: #ACCDFF;
|
||||||
|
font-size: 14px;
|
||||||
|
font: 9pt "Adobe Devanagari";
|
||||||
|
}</string>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>通讯参数</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QLineEdit" name="lineEdit_IP">
|
||||||
|
<property name="text">
|
||||||
|
<string>192.168.1.2</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="labelIP">
|
||||||
|
<property name="text">
|
||||||
|
<string>ip</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="labelPort">
|
||||||
|
<property name="text">
|
||||||
|
<string>端口</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QSpinBox" name="spinbox_Port">
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>65535</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>666</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupPresets">
|
||||||
|
<property name="title">
|
||||||
|
<string>采集</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="btnListen">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>43</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>43</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>开始监听</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="btnDisListen">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>43</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>停止监听</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
Reference in New Issue
Block a user