DYTSrouce/src/ui/Panel/LightPanel.cpp

86 lines
2.1 KiB
C++
Raw Normal View History

2025-10-27 12:39:49 +00:00
#include "ui/Panel/LightPanel.h"
#include "ui/DockWidget.h"
#include "ui/DockTitleBar.h"
#include "common/SpdLogger.h"
#include <QHBoxLayout>
#include <QFileInfo>
#include <QMessageBox>
LightPanel::LightPanel(int index, const QString& filePath, QWidget* parent)
: DataPanel(index, FileEntryType::Curve, filePath, parent)
{
LOG_INFO("Created LightPanel {} for file: {}", index, filePath.toStdString());
}
LightPanel::LightPanel(int index, std::shared_ptr<FileEntryLight> fileEntry, QWidget* parent)
: DataPanel(index, fileEntry, parent)
{
if (fileEntry) {
LOG_INFO("Created LightPanel {} for chart: {}", index, fileEntry->GetName().toStdString());
// Override the title with chart name
title_ = QString("Light Panel %1 - %2").arg(index).arg(fileEntry->GetName());
}
else {
LOG_WARN("Created LightPanel {} with null chart data", index);
}
}
LightPanel::~LightPanel()
{
LOG_INFO("Destroyed LightPanel {}", GetIndex());
}
void LightPanel::RefreshPanel()
{
// Implement curve-specific refresh logic here
DataPanel::RefreshPanel();
if (auto fileEntry = fileEntry_->AsLight()) {
OnDataPanelUpdated(fileEntry);
}
LOG_INFO("Refreshed TablePanel {}", GetIndex());
}
void LightPanel::InitUI()
{
QHBoxLayout* mainLayout = new QHBoxLayout(this);
mainLayout->setContentsMargins(0, 0, 0, 0);
//mainLayout->addWidget(m_pTableWidget);
setLayout(mainLayout);
}
QString LightPanel::GetTypeDisplayName() const
{
return "Light";
}
void LightPanel::OnDataPanelUpdated(FileEntryLight* fileEntry)
{
QString strName = fileEntry->GetName();
updateTitle(strName);
//FileEntryTable::ChartProperties propChart = fileEntry->GetChartProperties();
//QStringList tableHeader = propChart.headerString.split(',', Qt::SkipEmptyParts);
//SetHeader(tableHeader);
//QString strFile = fileEntry->GetPath() + "/" + fileEntry->GetFileName();
//FileEntryTable::TableProperties listCurve = fileEntry->GetTableProperties();
//updateParseFile(strFile, propChart.timeParam, listCurve);
}
void LightPanel::OnTimeChanged(double time)
{
}
void LightPanel::updateTitle(const QString & title)
{
if (nullptr != dockWidget_)
{
dockWidget_->setWindowTitle(title);
}
}