diff --git a/HPPA/FodisWindow.cpp b/HPPA/FodisWindow.cpp index de07731..9602404 100644 --- a/HPPA/FodisWindow.cpp +++ b/HPPA/FodisWindow.cpp @@ -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())); - // ʼݱ·ʾ AppSettings ָʹĬϣ + // 初始化数据保存路径显示(从 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("ѡݱ·"), + 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("Ѵ")); + 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(" ")); + ui.open_btn->setText(QString::fromLocal8Bit("打 开")); } diff --git a/HPPA/FodisWindow.h b/HPPA/FodisWindow.h index 8c75735..3769a12 100644 --- a/HPPA/FodisWindow.h +++ b/HPPA/FodisWindow.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include #include @@ -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(); diff --git a/HPPA/GonggaShanRecordCtl.cpp b/HPPA/GonggaShanRecordCtl.cpp index e0cae19..352612e 100644 --- a/HPPA/GonggaShanRecordCtl.cpp +++ b/HPPA/GonggaShanRecordCtl.cpp @@ -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() diff --git a/HPPA/GonggaShanRecordCtl.h b/HPPA/GonggaShanRecordCtl.h index 3005e49..2289ebb 100644 --- a/HPPA/GonggaShanRecordCtl.h +++ b/HPPA/GonggaShanRecordCtl.h @@ -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 tcpServer6005; diff --git a/HPPA/HPPA.cpp b/HPPA/HPPA.cpp index 9d31c70..b52b3fd 100644 --- a/HPPA/HPPA.cpp +++ b/HPPA/HPPA.cpp @@ -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) diff --git a/HPPA/HPPA.h b/HPPA/HPPA.h index b0fa13d..43c20a2 100644 --- a/HPPA/HPPA.h +++ b/HPPA/HPPA.h @@ -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; diff --git a/HPPA/JinspFiberImager.cpp b/HPPA/JinspFiberImager.cpp index 0e8f123..406e790 100644 --- a/HPPA/JinspFiberImager.cpp +++ b/HPPA/JinspFiberImager.cpp @@ -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; diff --git a/HPPA/JinspFiberImager.h b/HPPA/JinspFiberImager.h index 561b96a..e2ddcc7 100644 --- a/HPPA/JinspFiberImager.h +++ b/HPPA/JinspFiberImager.h @@ -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); diff --git a/HPPA/gonggashanCtl.ui b/HPPA/gonggashanCtl.ui index d13bf1d..53fc367 100644 --- a/HPPA/gonggashanCtl.ui +++ b/HPPA/gonggashanCtl.ui @@ -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; -} + @@ -257,7 +200,57 @@ QSlider::handle:horizontal:pressed { - + + + 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; +} + + + true + + + <!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> + +