77 lines
1.7 KiB
C++
77 lines
1.7 KiB
C++
|
|
#include "ui/Panel/ImagePanel.h"
|
||
|
|
#include "ui/DockWidget.h"
|
||
|
|
#include "ui/DockTitleBar.h"
|
||
|
|
#include "common/SpdLogger.h"
|
||
|
|
#include <QHBoxLayout>
|
||
|
|
#include <QFileInfo>
|
||
|
|
#include <QMessageBox>
|
||
|
|
|
||
|
|
ImagePanel::ImagePanel(int index, const QString& filePath, QWidget* parent)
|
||
|
|
: DataPanel(index, FileEntryType::Table, filePath, parent)
|
||
|
|
{
|
||
|
|
LOG_INFO("Created ImagePanel {} for file: {}", index, filePath.toStdString());
|
||
|
|
}
|
||
|
|
|
||
|
|
ImagePanel::ImagePanel(int index, std::shared_ptr<FileEntryImage> fileEntry, QWidget* parent)
|
||
|
|
: DataPanel(index, fileEntry, parent)
|
||
|
|
{
|
||
|
|
if (fileEntry) {
|
||
|
|
LOG_INFO("Created ImagePanel {} for chart: {}", index, fileEntry->GetName().toStdString());
|
||
|
|
// Override the title with chart name
|
||
|
|
title_ = QString("Image Panel %1 - %2").arg(index).arg(fileEntry->GetName());
|
||
|
|
}
|
||
|
|
else {
|
||
|
|
LOG_WARN("Created ImagePanel {} with null chart data", index);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
ImagePanel::~ImagePanel()
|
||
|
|
{
|
||
|
|
LOG_INFO("Destroyed ImagePanel {}", GetIndex());
|
||
|
|
}
|
||
|
|
|
||
|
|
void ImagePanel::RefreshPanel()
|
||
|
|
{
|
||
|
|
// Implement curve-specific refresh logic here
|
||
|
|
DataPanel::RefreshPanel();
|
||
|
|
|
||
|
|
if (auto fileEntry = fileEntry_->AsImage()) {
|
||
|
|
OnDataPanelUpdated(fileEntry);
|
||
|
|
}
|
||
|
|
|
||
|
|
LOG_INFO("Refreshed ImagePanel {}", GetIndex());
|
||
|
|
}
|
||
|
|
|
||
|
|
void ImagePanel::InitUI()
|
||
|
|
{
|
||
|
|
|
||
|
|
QHBoxLayout* mainLayout = new QHBoxLayout(this);
|
||
|
|
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||
|
|
//mainLayout->addWidget(m_pTableWidget);
|
||
|
|
setLayout(mainLayout);
|
||
|
|
}
|
||
|
|
|
||
|
|
QString ImagePanel::GetTypeDisplayName() const
|
||
|
|
{
|
||
|
|
return "Image";
|
||
|
|
}
|
||
|
|
|
||
|
|
void ImagePanel::OnDataPanelUpdated(FileEntryImage* fileEntry)
|
||
|
|
{
|
||
|
|
QString strName = fileEntry->GetName();
|
||
|
|
updateTitle(strName);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void ImagePanel::OnTimeChanged(double time)
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
void ImagePanel::updateTitle(const QString & title)
|
||
|
|
{
|
||
|
|
if (nullptr != dockWidget_)
|
||
|
|
{
|
||
|
|
dockWidget_->setWindowTitle(title);
|
||
|
|
}
|
||
|
|
}
|