add,山地所贡嘎山7:
优化
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
#include "FodisWindow.h"
|
||||
#include "FodisWindow.h"
|
||||
#include "JinspFiberImagerConfig.h"
|
||||
|
||||
FodisWindow::FodisWindow(QWidget* parent)
|
||||
@ -27,7 +27,7 @@ FodisWindow::FodisWindow(QWidget* parent)
|
||||
|
||||
connect(this->ui.dataFolderBtn, SIGNAL(clicked()), this, SLOT(onSelectDataFolder()));
|
||||
|
||||
// <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> AppSettings <EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>Ĭ<EFBFBD>ϣ<EFBFBD>
|
||||
// 初始化数据保存路径显示(从 AppSettings 恢复或使用默认)
|
||||
ui.dataFolderLineEdit->setText(AppSettings::instance().depthCameraDataFolder());
|
||||
|
||||
setDataFolder(AppSettings::instance().FiberImagerDataFolder());
|
||||
@ -44,7 +44,7 @@ FodisWindow::~FodisWindow()
|
||||
void FodisWindow::onSelectDataFolder()
|
||||
{
|
||||
QString dir = QFileDialog::getExistingDirectory(this,
|
||||
QString::fromLocal8Bit("ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݱ<EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>"),
|
||||
QString::fromLocal8Bit("选择数据保存路径"),
|
||||
ui.dataFolderLineEdit->text());
|
||||
|
||||
setDataFolder(dir);
|
||||
@ -65,10 +65,15 @@ void FodisWindow::setCaptureInterval(int captureIntervalSeconds)
|
||||
}
|
||||
|
||||
void FodisWindow::openFiberImager()
|
||||
{
|
||||
openFiberImager_expose_record("pos_null");
|
||||
}
|
||||
|
||||
void FodisWindow::openFiberImager_expose_record(QString posInfo)
|
||||
{
|
||||
if (!m_JinspFiberImagerOperation->getRecordStatus())
|
||||
{
|
||||
emit openFiberImagerSignal();
|
||||
emit openFiberImagerSignal(posInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,7 +82,7 @@ void FodisWindow::onCamOpened()
|
||||
ui.open_btn->setEnabled(false);
|
||||
ui.close_btn->setEnabled(true);
|
||||
|
||||
ui.open_btn->setText(QString::fromLocal8Bit("<EFBFBD>Ѵ<EFBFBD><EFBFBD><EFBFBD>"));
|
||||
ui.open_btn->setText(QString::fromLocal8Bit("已打开"));
|
||||
}
|
||||
|
||||
void FodisWindow::closeFiberImager()
|
||||
@ -90,5 +95,5 @@ void FodisWindow::onCamClosed()
|
||||
ui.open_btn->setEnabled(true);
|
||||
ui.close_btn->setEnabled(false);
|
||||
|
||||
ui.open_btn->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD> <EFBFBD><EFBFBD>"));
|
||||
ui.open_btn->setText(QString::fromLocal8Bit("打 开"));
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include <QNetworkRequest>
|
||||
@ -31,6 +31,7 @@ public:
|
||||
|
||||
public Q_SLOTS:
|
||||
void openFiberImager();
|
||||
void openFiberImager_expose_record(QString posInfo);
|
||||
void onCamOpened();
|
||||
void closeFiberImager();
|
||||
void onCamClosed();
|
||||
@ -38,7 +39,7 @@ public Q_SLOTS:
|
||||
void onSelectDataFolder();
|
||||
|
||||
signals:
|
||||
void openFiberImagerSignal();
|
||||
void openFiberImagerSignal(QString posInfo);
|
||||
void PlotSpectralSignal();
|
||||
void FiberImagerClosedSignal();
|
||||
|
||||
|
||||
@ -21,13 +21,32 @@ void GonggashanTaskScheduler::setTaskRunning(bool running)
|
||||
Q_EMIT taskStateChanged(m_taskState);
|
||||
}
|
||||
|
||||
void GonggaShanRecordCtl::logStatus(const QString& message)
|
||||
void GonggaShanRecordCtl::logStatus(const QString& message, bool isHearderBlankLine, bool isTailBlankLine)
|
||||
{
|
||||
QString timestamp = QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
|
||||
ui.status_textEdit->append(QString("[%1] %2").arg(timestamp, message));
|
||||
|
||||
if (m_logStream.device()) {
|
||||
if (isHearderBlankLine)
|
||||
{
|
||||
ui.status_textEdit->append("\n");
|
||||
}
|
||||
ui.status_textEdit->append(QString("[%1] %2").arg(timestamp, message));
|
||||
if (isTailBlankLine)
|
||||
{
|
||||
ui.status_textEdit->append("\n");
|
||||
}
|
||||
|
||||
if (m_logStream.device())
|
||||
{
|
||||
if (isHearderBlankLine)
|
||||
{
|
||||
m_logStream << "\n";
|
||||
}
|
||||
m_logStream << "[" << timestamp << "] " << message << "\n";
|
||||
if (isTailBlankLine)
|
||||
{
|
||||
m_logStream << "\n";
|
||||
}
|
||||
|
||||
m_logStream.flush();
|
||||
m_logFile.flush();
|
||||
}
|
||||
@ -66,13 +85,13 @@ void GonggaShanRecordCtl::startListen()
|
||||
}
|
||||
|
||||
QString timestamp = QDateTime::currentDateTime().toString("yyyy-MM-dd_HH-mm-ss");
|
||||
QString logFileName = QString("log%1.txt").arg(timestamp);
|
||||
QString logFileName = QString("%1_log.txt").arg(timestamp);
|
||||
m_logFilePath = AppSettings::instance().dataFolder() + QDir::separator() + logFileName;
|
||||
m_logFile.setFileName(m_logFilePath);
|
||||
m_logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text);
|
||||
m_logStream.setDevice(&m_logFile);
|
||||
|
||||
logStatus("Start listen....");
|
||||
logStatus("Start listen....", true, true);
|
||||
|
||||
MotorParams::TCPConnectionParams tcpConnectionParams6005;
|
||||
tcpConnectionParams6005.port = ui.spinbox_Port->text().toInt();
|
||||
@ -84,7 +103,7 @@ void GonggaShanRecordCtl::startListen()
|
||||
|
||||
void GonggaShanRecordCtl::stopListen()
|
||||
{
|
||||
logStatus("Stop listen");
|
||||
logStatus("Stop listen", true, true);
|
||||
|
||||
disconnect(tcpServer6005, &MotorParams::CommunicationViaTCP::positionReceived, this, &GonggaShanRecordCtl::startRecord);
|
||||
|
||||
@ -100,10 +119,11 @@ void GonggaShanRecordCtl::startRecord(int position)
|
||||
return;
|
||||
}
|
||||
|
||||
logStatus("Reach pos: " + QString::number(position));
|
||||
QString pos = QString::number(position);
|
||||
logStatus("Reach pos: " + pos, true);
|
||||
|
||||
m_taskScheduler->setTaskRunning(true);
|
||||
emit startRcordSignal();
|
||||
emit startRcordSignal("pos_" + pos);
|
||||
}
|
||||
|
||||
void GonggaShanRecordCtl::onFiberImagerStartExposureSignal()
|
||||
|
||||
@ -56,7 +56,7 @@ public Q_SLOTS:
|
||||
|
||||
Q_SIGNALS:
|
||||
// Emitted when user changes any of the R/G/B wavelength values
|
||||
void startRcordSignal();
|
||||
void startRcordSignal(QString posInfo);
|
||||
|
||||
private Q_SLOTS:
|
||||
void startListen();
|
||||
@ -65,7 +65,7 @@ private Q_SLOTS:
|
||||
void startRecord(int position);
|
||||
|
||||
private:
|
||||
void logStatus(const QString& message);
|
||||
void logStatus(const QString& message, bool isHearderBlankLine = false, bool isTailBlankLine = false);
|
||||
|
||||
Ui::gongga_control ui;
|
||||
QPointer<MotorParams::CommunicationViaTCP> tcpServer6005;
|
||||
|
||||
@ -1088,7 +1088,7 @@ void HPPA::setupGonggashanAutoRecordConnection()
|
||||
connect(m_omc, &OneMotorControl::sequenceComplete, m_gonggaShanRecordCtl, &GonggaShanRecordCtl::onRcordFinished);
|
||||
}
|
||||
|
||||
void HPPA::onGonggashanRecord()
|
||||
void HPPA::onGonggashanRecord(QString posInfo)
|
||||
{
|
||||
//设置文件名
|
||||
//AppSettings::instance().setFrameRate(f);
|
||||
@ -1097,7 +1097,7 @@ void HPPA::onGonggashanRecord()
|
||||
|
||||
QString dateStr = QDateTime::currentDateTime().toString("yyyy-MM-dd_HH-mm-ss");
|
||||
//QString fi = AppSettings::instance().fileName() + "_" + dateStr;
|
||||
AppSettings::instance().setFileName(dateStr);
|
||||
AppSettings::instance().setFileName(dateStr + "_" + posInfo);
|
||||
|
||||
this->frame_number->setText("100000");
|
||||
|
||||
@ -1109,7 +1109,7 @@ void HPPA::onGonggashanRecord()
|
||||
onconnect();
|
||||
}
|
||||
|
||||
m_fodisWindow->openFiberImager();
|
||||
m_fodisWindow->openFiberImager_expose_record(posInfo);
|
||||
}
|
||||
|
||||
void HPPA::recordFromRobotArm(int fileCounter)
|
||||
|
||||
@ -363,7 +363,7 @@ private:
|
||||
void showFiberImagerSpectral(DeviceAttribute attribute, DataFrame dataFrame);
|
||||
|
||||
void setupGonggashanAutoRecordConnection();
|
||||
void onGonggashanRecord();
|
||||
|
||||
|
||||
public Q_SLOTS:
|
||||
void onPlotHyperspectralImageRgbImage(int fileNumber, int frameNumber, QString filePath);
|
||||
@ -453,6 +453,8 @@ public Q_SLOTS:
|
||||
void onStretchedImageReady(int fileNumber, const QString& filePath, QPixmap& pixmap);
|
||||
void onStretchProcessingError(int fileNumber, const QString& filePath, const QString& error);
|
||||
|
||||
void onGonggashanRecord(QString posInfo);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
|
||||
@ -172,7 +172,7 @@ void JinspFiberImager::recordTarget(int recordTimes, QString path)
|
||||
//输出到csv
|
||||
QDateTime curDateTime = QDateTime::currentDateTime();
|
||||
QString currentTime = curDateTime.toString("yyyy_MM_dd_hh_mm_ss");
|
||||
QString fileName = path + "/" + currentTime + "_" + QString::fromStdString(deviceInfo.strSN) + "_integratingSphereSpectral_dn.csv";
|
||||
QString fileName = path + "/" + currentTime + "_" + m_posInfo + "_" + QString::fromStdString(deviceInfo.strSN) + "_integratingSphereSpectral_dn.csv";
|
||||
std::ofstream outfile(fileName.toStdString().c_str());
|
||||
|
||||
for (int i = 0; i < attribute.iPixels; i++)
|
||||
@ -318,8 +318,10 @@ void JinspFiberImager::setCaptureInterval(int captureIntervalSeconds)
|
||||
m_captureIntervalMilliseconds = captureIntervalSeconds * 1000;
|
||||
}
|
||||
|
||||
void JinspFiberImager::OpenFiberImagerAndRecord()
|
||||
void JinspFiberImager::OpenFiberImagerAndRecord(QString posInfo)
|
||||
{
|
||||
m_posInfo = posInfo;
|
||||
|
||||
//连接光谱仪
|
||||
QString SN;
|
||||
QString pixelCount;
|
||||
|
||||
@ -55,6 +55,8 @@ private:
|
||||
|
||||
int m_iExposureTime;
|
||||
|
||||
QString m_posInfo;
|
||||
|
||||
// ZZ_U32 m_MaxValueOfFiberSpectrometer;
|
||||
|
||||
public slots:
|
||||
@ -62,7 +64,7 @@ public slots:
|
||||
void recordTarget(int recordTimes, QString path);
|
||||
void autoExpose();
|
||||
|
||||
void OpenFiberImagerAndRecord();
|
||||
void OpenFiberImagerAndRecord(QString posInfo);
|
||||
|
||||
signals:
|
||||
void sendExposureTimeSignal(int exposureTime);
|
||||
|
||||
@ -32,14 +32,6 @@ QSpinBox
|
||||
border: none;
|
||||
}
|
||||
|
||||
QTextEdit
|
||||
{
|
||||
font: 10pt "新宋体";
|
||||
background-color: #142D7F;
|
||||
color: white;
|
||||
border: none;
|
||||
}
|
||||
|
||||
QPushButton
|
||||
{
|
||||
/*width: 172px;
|
||||
@ -82,56 +74,7 @@ QPushButton:pressed
|
||||
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>
|
||||
</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,1,3">
|
||||
<item>
|
||||
@ -257,7 +200,57 @@ QSlider::handle:horizontal:pressed {
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextEdit" name="status_textEdit"/>
|
||||
<widget class="QTextEdit" name="status_textEdit">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QTextEdit
|
||||
{
|
||||
font: 10pt "新宋体";
|
||||
background-color: #142D7F;
|
||||
color: white;
|
||||
border: none;
|
||||
}
|
||||
|
||||
QScrollBar:vertical {
|
||||
background: #0E1C4C;
|
||||
width: 12px;
|
||||
}
|
||||
|
||||
QScrollBar::handle:vertical {
|
||||
background: #4B60A6;
|
||||
border-radius: 6px;
|
||||
min-height: 20px;
|
||||
}
|
||||
|
||||
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {
|
||||
height: 0px;
|
||||
}
|
||||
|
||||
QScrollBar:horizontal {
|
||||
background: #0E1C4C;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
QScrollBar::handle:horizontal {
|
||||
background: #4B60A6;
|
||||
border-radius: 6px;
|
||||
min-width: 20px;
|
||||
}
|
||||
|
||||
QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal {
|
||||
width: 0px;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'新宋体'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
Reference in New Issue
Block a user