modify data show

This commit is contained in:
brige 2025-10-26 20:14:06 +08:00
parent 1e7538796a
commit e693562387
10 changed files with 451 additions and 185 deletions

View File

@ -936,6 +936,26 @@
<source>Add Table Data File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="81"/>
<source>Basic Information</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="110"/>
<source>Table Name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="103"/>
<source>Enter table name...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="117"/>
<source>Time Parameter:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="20"/>
<source>File Selection</source>
@ -947,7 +967,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="33"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="36"/>
<source>Select table data file...</source>
<translation type="unfinished"></translation>
</message>
@ -973,100 +993,137 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="81"/>
<source>Table Parameters</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="87"/>
<source>Separator:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="95"/>
<source>Comma (,)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="100"/>
<source>Tab</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="105"/>
<source>Space</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="110"/>
<source>Semicolon (;)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="118"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="193"/>
<source>Encoding:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="126"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="201"/>
<source>UTF-8</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="131"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="206"/>
<source>GBK</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="136"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="211"/>
<source>ASCII</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="141"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="216"/>
<source>ISO-8859-1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="149"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="176"/>
<source>Skip Rows:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="169"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="133"/>
<source>File has header row</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="179"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="127"/>
<source>Table Headers Configuration</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="143"/>
<source>Headers (comma-separated):</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="150"/>
<source>e.g., Time, Value1, Value2, Value3...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="160"/>
<source>Tip: Headers will be auto-detected if file has header row</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="170"/>
<source>Parsing Parameters</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="183"/>
<source>Auto-detect parameters</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="192"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="240"/>
<source>Preview</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="223"/>
<source>Description (Optional)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="235"/>
<source>Enter file description...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="273"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="296"/>
<source>Add File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="283"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="306"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="118"/>
<source>Warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="118"/>
<source>Please enter a table name.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="126"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="151"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="176"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="126"/>
<source>Failed to create table file entry.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="151"/>
<source>Unable to get current workspace</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="161"/>
<source>Table file count has reached the limit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="164"/>
<source>File already exists</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="167"/>
<source>File copy failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="170"/>
<source>Invalid file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="173"/>
<source>Failed to add file</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ChartPlotMenuClass</name>

View File

@ -41,6 +41,10 @@ void CurvePanel::RefreshPanel()
// Implement curve-specific refresh logic here
DataPanel::RefreshPanel();
if (auto fileEntry = std::dynamic_pointer_cast<FileEntryCurve>(fileEntry_)) {
OnDataPanelUpdated(fileEntry.get());
}
if (hasChartData_) {
UpdateCurveDisplay();
}
@ -316,3 +320,6 @@ QString CurvePanel::GetTypeDisplayName() const
{
return "Curve";
}
void CurvePanel::OnDataPanelUpdated(FileEntryCurve* fileEntry) {
}

View File

@ -2,6 +2,7 @@
#include "DataPanel.h"
#include "workspace/ChartData.h"
#include "workspace/FileEntry.h"
#include <memory>
/**
@ -75,6 +76,8 @@ protected:
*/
QString GetTypeDisplayName() const override;
void OnDataPanelUpdated(FileEntryCurve* fileEntry);
private:
/**
* @brief Update curve display based on chart data

View File

@ -40,6 +40,12 @@ public:
*/
int GetIndex() const { return index_; }
/**
* @brief Set associated file entry
* @param fileEntry Shared pointer to FileEntry
*/
void SetFileEntry(std::shared_ptr<FileEntry> fileEntry) { fileEntry_ = fileEntry; }
/**
* @brief Get file type (virtual function, implemented by derived classes)
* @return File type
@ -111,4 +117,6 @@ protected:
QString filePath_; // Associated file path
QString title_; // Panel title
DockWidget* dockWidget_; // Dock widget reference
std::shared_ptr<FileEntry> fileEntry_; // Associated file entry
};

View File

@ -193,6 +193,11 @@ DataPanel* DataPanelManager::CreateDataPanel(FileEntryType fileType, const QStri
return nullptr;
}
auto fileEntries = currentWorkspace_->GetFileEntries(fileType);
if (index < fileEntries.size()) {
panel->SetFileEntry(fileEntries[index]);
}
dockWidget->setWidget(panel);
// Set panel's dock widget reference

View File

@ -6,6 +6,8 @@
#include "app/Application.h"
#include "common/SpdLogger.h"
#include "workspace/WorkSpaceManager.h"
#include "workspace/WorkSpace.h"
#include "ui_AddTableFileDlg.h"
@ -14,7 +16,7 @@ AddTableFileDlg::AddTableFileDlg(QWidget* parent)
: BaseAddFileDlg(FileEntryType::Table, parent)
, ui(new Ui::AddTableFileDlg) {
ui->setupUi(this);
SetupUI(ui);
SetTitle(getDialogTitle());
setupConnections();
}
@ -27,8 +29,7 @@ void AddTableFileDlg::setupConnections() {
// Connect file selection
connect(ui->selectFileBtn, &QToolButton::clicked, this, &AddTableFileDlg::onSelectFileClicked);
connect(ui->filePathEdit, &QLineEdit::textChanged, this, &AddTableFileDlg::onFilePathChanged);
connect(ui->separatorComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &AddTableFileDlg::onDelimiterChanged);
connect(ui->hasHeaderCheckBox, &QCheckBox::toggled, this, &AddTableFileDlg::onHeaderToggled);
connect(ui->addBtn, &QPushButton::clicked, this, [this]() { OnSure(); });
connect(ui->cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
@ -105,26 +106,77 @@ QString AddTableFileDlg::getSelectedFilePath() const {
return ui->filePathEdit->text();
}
QString AddTableFileDlg::getDescription() const {
return ui->descriptionEdit->toPlainText().trimmed();
void AddTableFileDlg::accept()
{
// Validate parameters
if (!validateSpecificParams()) {
return;
}
AddTableFileDlg::TableParams AddTableFileDlg::getTableParams() const {
TableParams params;
// Get delimiter from combo box
int index = ui->separatorComboBox->currentIndex();
switch (index) {
case 0: params.delimiter = ","; break;
case 1: params.delimiter = "\t"; break;
case 2: params.delimiter = " "; break;
case 3: params.delimiter = ";"; break;
default: params.delimiter = ","; break;
// Validate table-specific parameters
if (ui->tableNameEdit->text().isEmpty()) {
QMessageBox::warning(this, tr("Warning"), tr("Please enter a table name."));
return;
}
params.hasHeader = ui->hasHeaderCheckBox->isChecked();
params.xColumn = 1; // Default values
params.yColumn = 2;
params.description = ui->descriptionEdit->toPlainText().trimmed();
return params;
// Create FileEntryTable using factory function
auto fileEntry = CreateFileEntryTable(getSelectedFilePath());
if (!fileEntry) {
QMessageBox::critical(this, tr("Error"), tr("Failed to create table file entry."));
return;
}
// Set table headers if provided
QString headersText = ui->headersEdit->text().trimmed();
if (!headersText.isEmpty()) {
QStringList headers = headersText.split(',', Qt::SkipEmptyParts);
for (QString& header : headers) {
header = header.trimmed();
}
fileEntry->SetTableHeaders(headers);
}
// Set chart properties
FileEntryTable::ChartProperties chartProps;
chartProps.timeParam = ui->timeParamSpinBox->value();
fileEntry->SetChartProperties(chartProps);
// Set description (using table name as description for now)
fileEntry->SetDescription(ui->tableNameEdit->text());
// Add to workspace
WorkSpace* workspace = WorkSpaceManager::Get().GetCurrent();
if (!workspace) {
QMessageBox::critical(this, tr("Error"), tr("Unable to get current workspace"));
return;
}
// Add FileEntryTable to workspace using SetFileEntry method
auto result = workspace->SetFileEntry(fileEntry);
if (result != WorkSpace::FileEntryResult::Ok) {
QString errorMsg;
switch (result) {
case WorkSpace::FileEntryResult::LimitExceeded:
errorMsg = tr("Table file count has reached the limit");
break;
case WorkSpace::FileEntryResult::Duplicate:
errorMsg = tr("File already exists");
break;
case WorkSpace::FileEntryResult::CopyFailed:
errorMsg = tr("File copy failed");
break;
case WorkSpace::FileEntryResult::InvalidFile:
errorMsg = tr("Invalid file");
break;
default:
errorMsg = tr("Failed to add file");
break;
}
QMessageBox::warning(this, tr("Error"), errorMsg);
return;
}
LOG_INFO("Added table file to workspace: {}", getSelectedFilePath().toUtf8().constData());
QDialog::accept();
}

View File

@ -21,9 +21,7 @@ public:
explicit AddTableFileDlg(QWidget* parent = nullptr);
~AddTableFileDlg() override;
TableParams getTableParams() const;
QString getSelectedFilePath() const;
QString getDescription() const;
protected:
QString getFileFilter() const override;
@ -36,6 +34,9 @@ private slots:
void onDelimiterChanged();
void onHeaderToggled(bool hasHeader);
public slots:
void accept() override;
private:
void setupConnections();
void updateFileInfo(const QString& filePath);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>450</height>
<width>676</width>
<height>683</height>
</rect>
</property>
<property name="windowTitle">
@ -29,12 +29,12 @@
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="filePathEdit">
<property name="placeholderText">
<string>Select table data file...</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>Select table data file...</string>
</property>
</widget>
</item>
<item row="0" column="2">
@ -76,50 +76,125 @@
</widget>
</item>
<item>
<widget class="QGroupBox" name="paramsGroupBox">
<widget class="QGroupBox" name="basicInfoGroupBox">
<property name="title">
<string>Table Parameters</string>
<string>Basic Information</string>
</property>
<layout class="QGridLayout" name="paramsGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="separatorLabel">
<property name="text">
<string>Separator:</string>
<layout class="QGridLayout" name="basicInfoGridLayout">
<item row="1" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="timeParamSpinBox">
<property name="decimals">
<number>3</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>999999.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="separatorComboBox">
<item>
<property name="text">
<string>Comma (,)</string>
<item row="0" column="1" colspan="2">
<widget class="QLineEdit" name="tableNameEdit">
<property name="placeholderText">
<string>Enter table name...</string>
</property>
</widget>
</item>
<item>
<item row="0" column="0">
<widget class="QLabel" name="tableNameLabel">
<property name="text">
<string>Tab</string>
<string>Table Name:</string>
</property>
</item>
<item>
<property name="text">
<string>Space</string>
</property>
</item>
<item>
<property name="text">
<string>Semicolon (;)</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="timeParamLabel">
<property name="text">
<string>Time Parameter:</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="headersGroupBox">
<property name="title">
<string>Table Headers Configuration</string>
</property>
<layout class="QVBoxLayout" name="headersVerticalLayout">
<item>
<widget class="QCheckBox" name="hasHeaderCheckBox">
<property name="text">
<string>File has header row</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="headersLabel">
<property name="text">
<string>Headers (comma-separated):</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="headersEdit">
<property name="placeholderText">
<string>e.g., Time, Value1, Value2, Value3...</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="headersHintLabel">
<property name="styleSheet">
<string notr="true">color: gray; font-size: 11px;</string>
</property>
<property name="text">
<string>Tip: Headers will be auto-detected if file has header row</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="paramsGroupBox">
<property name="title">
<string>Parsing Parameters</string>
</property>
<layout class="QGridLayout" name="paramsGridLayout">
<item row="1" column="0">
<widget class="QLabel" name="skipRowsLabel">
<property name="text">
<string>Skip Rows:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="autoDetectCheckBox">
<property name="text">
<string>Auto-detect parameters</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="encodingLabel">
<property name="text">
<string>Encoding:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="0" column="1">
<widget class="QComboBox" name="encodingComboBox">
<item>
<property name="text">
@ -143,14 +218,7 @@
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="skipRowsLabel">
<property name="text">
<string>Skip Rows:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="1">
<widget class="QSpinBox" name="skipRowsSpinBox">
<property name="minimum">
<number>0</number>
@ -163,26 +231,6 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="hasHeaderCheckBox">
<property name="text">
<string>File has header row</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="autoDetectCheckBox">
<property name="text">
<string>Auto-detect parameters</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -212,46 +260,21 @@
<property name="columnCount">
<number>5</number>
</property>
<row/>
<row/>
<row/>
<row/>
<row/>
<column/>
<column/>
<column/>
<column/>
<column/>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="descGroupBox">
<property name="title">
<string>Description (Optional)</string>
</property>
<layout class="QVBoxLayout" name="descVerticalLayout">
<item>
<widget class="QTextEdit" name="descriptionEdit">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>60</height>
</size>
</property>
<property name="placeholderText">
<string>Enter file description...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="buttonLayout">
<item>

View File

@ -59,14 +59,17 @@ std::shared_ptr<FileEntry> CreateFileEntrySurface(const QString& filePath) {
return fileEntry;
}
std::shared_ptr<FileEntry> CreateFileEntryTable(const QString& filePath) {
auto fileEntry = std::make_shared<FileEntry>();
fileEntry->SetType(FileEntryType::Table);
if (!filePath.isEmpty()) {
fileEntry->SetPath(filePath);
std::shared_ptr<FileEntryTable> CreateFileEntryTable(const QString& filePath) {
QFileInfo fileInfo(filePath);
if (!filePath.isEmpty() && !fileInfo.exists()) {
LOG_ERROR("File does not exist: {}", filePath.toUtf8().constData());
return nullptr;
}
auto fileEntry = std::make_shared<FileEntryTable>();
fileEntry->SetPath(filePath);
fileEntry->SetName(fileInfo.baseName()); // Use base name as default display name
return fileEntry;
}
@ -124,3 +127,60 @@ void FileEntrySurface::SetDescription(const QString& description) {
const QString& FileEntrySurface::GetDescription() const {
return description_;
}
// FileEntryTable method implementations
void FileEntryTable::SetChartProperties(const ChartProperties& properties) {
chartProperties_ = properties;
}
const FileEntryTable::ChartProperties& FileEntryTable::GetChartProperties() const {
return chartProperties_;
}
void FileEntryTable::AddTableProperty(const TableProperty& table) {
tableProperties_.append(table);
}
void FileEntryTable::RemoveTableProperty(int index) {
if (index >= 0 && index < tableProperties_.size()) {
tableProperties_.removeAt(index);
}
}
void FileEntryTable::SetTableProperty(int index, const TableProperty& table) {
if (index >= 0 && index < tableProperties_.size()) {
tableProperties_[index] = table;
}
}
const FileEntryTable::TableProperties& FileEntryTable::GetTableProperties() const {
return tableProperties_;
}
void FileEntryTable::SetTableHeaders(const QStringList& headers) {
tableHeaders_ = headers;
}
void FileEntryTable::SetTableHeaders(const QString& headerString) {
tableHeaders_ = headerString.split(',', Qt::SkipEmptyParts);
// Trim whitespace from each header
for (QString& header : tableHeaders_) {
header = header.trimmed();
}
}
const QStringList& FileEntryTable::GetTableHeaders() const {
return tableHeaders_;
}
FileEntryTable* FileEntryTable::AsTable() {
return this;
}
void FileEntryTable::SetDescription(const QString& description) {
description_ = description;
}
const QString& FileEntryTable::GetDescription() const {
return description_;
}

View File

@ -32,6 +32,7 @@ inline bool FileEntryTypeFromString(const char* s, FileEntryType& out) {
class FileEntryCurve;
class FileEntryLight;
class FileEntrySurface;
class FileEntryTable;
class FileEntry {
public:
@ -52,6 +53,7 @@ public:
virtual FileEntryCurve* AsCurve() { return nullptr; }
virtual FileEntryLight* AsLight() { return nullptr; }
virtual FileEntrySurface* AsSurface() { return nullptr; }
virtual FileEntryTable* AsTable() { return nullptr; }
protected:
FileEntryType type_;
@ -64,7 +66,7 @@ protected:
std::shared_ptr<FileEntry> CreateFileEntry(FileEntryType type, const QString& filePath);
std::shared_ptr<FileEntryCurve> CreateFileEntryCurve(const QString& filePath);
std::shared_ptr<FileEntry> CreateFileEntrySurface(const QString& filePath);
std::shared_ptr<FileEntry> CreateFileEntryTable(const QString& filePath);
std::shared_ptr<FileEntryTable> CreateFileEntryTable(const QString& filePath);
std::shared_ptr<FileEntryLight> CreateFileEntryLight(const QString& filePath);
@ -163,6 +165,54 @@ private:
QString description_;
};
class FileEntryTable : public FileEntry {
public:
struct ChartProperties {
QString name;
QString path;
double timeParam;
};
struct TableProperty {
QString name;
QColor color;
QList<int> datas;
};
using TableProperties = QList<TableProperty>;
public:
FileEntryTable() { type_ = FileEntryType::Table; }
// Chart properties management
void SetChartProperties(const ChartProperties& properties);
const ChartProperties& GetChartProperties() const;
// Table properties management
void AddTableProperty(const TableProperty& table);
void RemoveTableProperty(int index);
void SetTableProperty(int index, const TableProperty& table);
const TableProperties& GetTableProperties() const;
// Table headers management
void SetTableHeaders(const QStringList& headers);
void SetTableHeaders(const QString& headerString); // Parse from comma-separated string
const QStringList& GetTableHeaders() const;
// Type conversion
FileEntryTable* AsTable() override;
// Description management
void SetDescription(const QString& description);
const QString& GetDescription() const;
private:
ChartProperties chartProperties_;
QStringList tableHeaders_;
TableProperties tableProperties_;
QString description_;
};
class FileEntryLight : public FileEntry {
public:
struct ColorProperties {