modify datatime
This commit is contained in:
parent
1ac2c4d797
commit
c2c88b4ebc
@ -81,6 +81,13 @@ public:
|
|||||||
* @brief Refresh panel content (virtual function, implemented by derived classes)
|
* @brief Refresh panel content (virtual function, implemented by derived classes)
|
||||||
*/
|
*/
|
||||||
virtual void RefreshPanel() {}
|
virtual void RefreshPanel() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handle time change event (virtual function, implemented by derived classes)
|
||||||
|
* @param time Current time value from Timestep
|
||||||
|
*/
|
||||||
|
virtual void OnTimeChanged(double time) {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize UI (virtual function, derived classes implement specific layout)
|
* @brief Initialize UI (virtual function, derived classes implement specific layout)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -5,10 +5,12 @@
|
|||||||
#include "ui/DockTitleBar.h"
|
#include "ui/DockTitleBar.h"
|
||||||
#include "ui/MainWindow.h"
|
#include "ui/MainWindow.h"
|
||||||
#include "workspace/FileEntry.h"
|
#include "workspace/FileEntry.h"
|
||||||
|
#include "workspace/Timestep.h"
|
||||||
#include "common/SpdLogger.h"
|
#include "common/SpdLogger.h"
|
||||||
|
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QSet>
|
||||||
|
|
||||||
const QString DataPanelManager::PANEL_OBJECT_NAME_PREFIX = "DataPanel_";
|
const QString DataPanelManager::PANEL_OBJECT_NAME_PREFIX = "DataPanel_";
|
||||||
|
|
||||||
@ -42,6 +44,18 @@ void DataPanelManager::SetWorkspace(WorkSpace* workspace)
|
|||||||
// Connect new workspace signals
|
// Connect new workspace signals
|
||||||
if (currentWorkspace_) {
|
if (currentWorkspace_) {
|
||||||
connect(currentWorkspace_, &WorkSpace::FilesChanged, this, &DataPanelManager::OnFilesChanged);
|
connect(currentWorkspace_, &WorkSpace::FilesChanged, this, &DataPanelManager::OnFilesChanged);
|
||||||
|
|
||||||
|
// Connect to Timestep signals if available
|
||||||
|
if (currentWorkspace_->GetTimestep()) {
|
||||||
|
connect(currentWorkspace_->GetTimestep(), &Timestep::TimeChanged, this, &DataPanelManager::OnTimeChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connect to TimestepChanged signal to handle future Timestep changes
|
||||||
|
connect(currentWorkspace_, &WorkSpace::TimestepChanged, this, [this](Timestep* timestep) {
|
||||||
|
if (timestep) {
|
||||||
|
connect(timestep, &Timestep::TimeChanged, this, &DataPanelManager::OnTimeChanged);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update all panel types
|
// Update all panel types
|
||||||
@ -293,12 +307,31 @@ QString DataPanelManager::GeneratePanelObjectName(FileEntryType fileType, int in
|
|||||||
|
|
||||||
int DataPanelManager::FindNextAvailableIndex(FileEntryType fileType) const
|
int DataPanelManager::FindNextAvailableIndex(FileEntryType fileType) const
|
||||||
{
|
{
|
||||||
int index = 0;
|
QSet<int> usedIndices;
|
||||||
QString baseKey = QString("%1_").arg(FileEntryTypeToString(fileType));
|
QString typeStr = FileEntryTypeToString(fileType);
|
||||||
|
|
||||||
while (dataPanels_.contains(baseKey + QString::number(index))) {
|
for (auto it = dataPanels_.constBegin(); it != dataPanels_.constEnd(); ++it) {
|
||||||
index++;
|
if (it.value()->GetFileType() == fileType) {
|
||||||
|
usedIndices.insert(it.value()->GetIndex());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return index;
|
for (int i = 1; i <= GetMaxPanelCount(); ++i) {
|
||||||
|
if (!usedIndices.contains(i)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1; // No available index
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataPanelManager::OnTimeChanged(double time)
|
||||||
|
{
|
||||||
|
// Notify all active panels about time change
|
||||||
|
for (auto it = dataPanels_.constBegin(); it != dataPanels_.constEnd(); ++it) {
|
||||||
|
DataPanel* panel = it.value();
|
||||||
|
if (panel) {
|
||||||
|
panel->OnTimeChanged(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -68,6 +68,12 @@ public slots:
|
|||||||
*/
|
*/
|
||||||
void OnPanelClosed();
|
void OnPanelClosed();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handle time change event from Timestep
|
||||||
|
* @param time Current time value
|
||||||
|
*/
|
||||||
|
void OnTimeChanged(double time);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief Update panels for specific file type
|
* @brief Update panels for specific file type
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user