diff --git a/src/ui/Panel/SurfacePanel.cpp b/src/ui/Panel/SurfacePanel.cpp index 222afb8a..03eadf18 100644 --- a/src/ui/Panel/SurfacePanel.cpp +++ b/src/ui/Panel/SurfacePanel.cpp @@ -25,6 +25,7 @@ SurfacePanel::SurfacePanel(int index, const QString& filePath, QWidget* parent) m_countY = 0; m_countZ = 0; + m_title = ""; m_xTitle = ""; m_yTitle = ""; m_zTitle = ""; @@ -32,6 +33,7 @@ SurfacePanel::SurfacePanel(int index, const QString& filePath, QWidget* parent) m_time = -1.0; m_thread = nullptr; + m_mutex = nullptr; LOG_INFO("Created SurfacePanel {} for file: {}", index, filePath.toStdString()); } @@ -54,6 +56,7 @@ SurfacePanel::SurfacePanel(int index, std::shared_ptr fileEntr m_countY = 0; m_countZ = 0; + m_title = ""; m_xTitle = ""; m_yTitle = ""; m_zTitle = ""; @@ -61,6 +64,7 @@ SurfacePanel::SurfacePanel(int index, std::shared_ptr fileEntr m_time = -1.0; m_thread = nullptr; + m_mutex = nullptr; if (fileEntry) { LOG_INFO("Created SurfacePanel {} for chart: {}", index, fileEntry->GetName().toStdString()); @@ -152,6 +156,11 @@ QString SurfacePanel::GetTypeDisplayName() const void SurfacePanel::OnDataPanelUpdated(FileEntrySurface* fileEntry) { + if (!m_surfaceContainer) + { + createSurface(); + } + QString strName = fileEntry->GetName(); updateTitle(strName); @@ -219,8 +228,13 @@ void SurfacePanel::updateTitle(const QString & title) { if (nullptr != dockWidget_) { + m_title = title; + dockWidget_->setWindowTitle(title); + disconnect(dockWidget_, &QDockWidget::visibilityChanged, + this, &SurfacePanel::onVisibilityChanged); + connect(dockWidget_, &QDockWidget::visibilityChanged, this, &SurfacePanel::onVisibilityChanged); } @@ -328,6 +342,10 @@ void SurfacePanel::updateParseFile(const QString & strFile, int nT, FileEntrySur } m_thread = new LoadDataThread(this, strFile, nT, listCurve); + connect(m_thread, &LoadDataThread::signalBeginLoadData, + this, &SurfacePanel::slotBeginLoadData); + connect(m_thread, &LoadDataThread::signalEndLoadData, + this, &SurfacePanel::slotEndLoadData); m_thread->setMutex(m_mutex); m_thread->start(); @@ -476,6 +494,23 @@ void SurfacePanel::createSurface() m_surface->scene()->activeCamera()->setCameraPreset(Q3DCamera::CameraPreset(13)); } +void SurfacePanel::slotBeginLoadData() +{ + if (nullptr != dockWidget_) + { + QString title = m_title + " -- " + QString(tr("Begin LoadData")); + dockWidget_->setWindowTitle(title); + } +} + +void SurfacePanel::slotEndLoadData() +{ + if (nullptr != dockWidget_) + { + dockWidget_->setWindowTitle(m_title); + } +} + void SurfacePanel::FinalParseFile() { if (m_iMaxX == m_iMinX) @@ -510,6 +545,8 @@ void LoadDataThread::run() QFile file(m_file); if (file.open(QIODevice::ReadOnly)) { + emit signalBeginLoadData(); + while (!file.atEnd() && !m_exit) { QString strLine = file.readLine().simplified(); @@ -625,5 +662,7 @@ void LoadDataThread::run() } file.close(); + + emit signalEndLoadData(); } } \ No newline at end of file diff --git a/src/ui/Panel/SurfacePanel.h b/src/ui/Panel/SurfacePanel.h index d9665df6..39cf1186 100644 --- a/src/ui/Panel/SurfacePanel.h +++ b/src/ui/Panel/SurfacePanel.h @@ -78,6 +78,9 @@ private: void onVisibilityChanged(bool visible); void createSurface(); + void slotBeginLoadData(); + void slotEndLoadData(); + private: Q3DSurface *m_surface; QWidget *m_surfaceContainer; @@ -99,6 +102,7 @@ private: int m_countY; int m_countZ; + QString m_title; QString m_xTitle; QString m_yTitle; QString m_zTitle; @@ -130,6 +134,10 @@ public: void requestExit() { m_exit = true; } +signals: + void signalBeginLoadData(); + void signalEndLoadData(); + private: SurfacePanel *m_panel; QString m_file;