modify CurverFileDialog
This commit is contained in:
parent
db7e71e44a
commit
32eaf74017
@ -46,69 +46,351 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="81"/>
|
||||
<source>Curve Parameters</source>
|
||||
<source>Chart Properties</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="87"/>
|
||||
<source>X Column:</source>
|
||||
<source>Chart Name:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="107"/>
|
||||
<source>Y Column:</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="97"/>
|
||||
<source>Enter chart name...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="127"/>
|
||||
<source>Separator:</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="104"/>
|
||||
<source>X Axis Title:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="135"/>
|
||||
<source>Comma (,)</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="111"/>
|
||||
<source>Enter X axis title...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="140"/>
|
||||
<source>Tab</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="118"/>
|
||||
<source>Y Axis Title:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="145"/>
|
||||
<source>Space</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="125"/>
|
||||
<source>Enter Y axis title...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="150"/>
|
||||
<source>Semicolon (;)</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="132"/>
|
||||
<source>Time Parameter:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="158"/>
|
||||
<source>File has header row</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="155"/>
|
||||
<source>Axis Range Settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="171"/>
|
||||
<source>Description (Optional)</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="161"/>
|
||||
<source>X Min:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="183"/>
|
||||
<source>Enter file description...</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="181"/>
|
||||
<source>X Max:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="201"/>
|
||||
<source>Y Min:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="221"/>
|
||||
<source>Y Max:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="241"/>
|
||||
<source>X Tick Count:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="342"/>
|
||||
<source>Curve Name:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="94"/>
|
||||
<source>Chart 1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="264"/>
|
||||
<source>Curve Management</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="272"/>
|
||||
<source>Curves:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="292"/>
|
||||
<source>Add Curve</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="305"/>
|
||||
<source>Remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="333"/>
|
||||
<source>Selected Curve Properties</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="349"/>
|
||||
<source>Enter curve name...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="356"/>
|
||||
<source>Curve Color:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="365"/>
|
||||
<source>Select Color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="384"/>
|
||||
<source>background-color: rgb(255, 0, 0); border: 1px solid black;</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="409"/>
|
||||
<source>Data Start:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="429"/>
|
||||
<source>Data Stop:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="455"/>
|
||||
<source>Data Format Parameters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="461"/>
|
||||
<source>X Column:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="481"/>
|
||||
<source>Y Column:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="501"/>
|
||||
<source>Separator:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="509"/>
|
||||
<source>Comma (,)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="514"/>
|
||||
<source>Tab</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="519"/>
|
||||
<source>Space</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="524"/>
|
||||
<source>Semicolon (;)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="532"/>
|
||||
<source>File has header row</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="545"/>
|
||||
<source>Description (Optional)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="557"/>
|
||||
<source>Enter file description...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="595"/>
|
||||
<source>Add File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="231"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="605"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="288"/>
|
||||
<source>Curve %1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="319"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="326"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="332"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="338"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="344"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="359"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="365"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="373"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="380"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="386"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="393"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="399"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="407"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="412"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="418"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="423"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="434"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="439"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="448"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="453"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="460"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="467"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="473"/>
|
||||
<source>Validation Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="319"/>
|
||||
<source>Please select a data file.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="326"/>
|
||||
<source>Selected file does not exist.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="332"/>
|
||||
<source>Selected file is not readable. Please check file permissions.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="338"/>
|
||||
<source>File is too large (over 100MB). Please select a smaller file.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="344"/>
|
||||
<source>At least one curve must be defined.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="360"/>
|
||||
<source>Curve %1 name cannot be empty.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="366"/>
|
||||
<source>Curve name '%1' is duplicated. Please use different names.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="374"/>
|
||||
<source>Curve name '%1' is too long. Please limit to 50 characters.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="381"/>
|
||||
<source>Curve '%1' start and stop values must be greater than 0.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="387"/>
|
||||
<source>Curve '%1' start value cannot be greater than stop value.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="394"/>
|
||||
<source>Curve '%1' data range is too small. At least 2 data points are required.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="400"/>
|
||||
<source>Curve '%1' stop value is too large. Please ensure it does not exceed 1000000.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="407"/>
|
||||
<source>Chart name cannot be empty.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="412"/>
|
||||
<source>Chart name is too long. Please limit to 100 characters.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="418"/>
|
||||
<source>X axis title is too long. Please limit to 50 characters.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="423"/>
|
||||
<source>Y axis title is too long. Please limit to 50 characters.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="434"/>
|
||||
<source>X axis minimum value must be less than maximum value.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="439"/>
|
||||
<source>Y axis minimum value must be less than maximum value.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="448"/>
|
||||
<source>X column and Y column cannot be the same.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="453"/>
|
||||
<source>Data column indices must be greater than 0.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="460"/>
|
||||
<source>Time parameter cannot be negative.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="467"/>
|
||||
<source>X axis tick count must be at least 2.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="473"/>
|
||||
<source>Description is too long. Please limit to 500 characters.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AddLightFileDlg</name>
|
||||
|
||||
@ -3,16 +3,21 @@
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QColorDialog>
|
||||
#include <QListWidget>
|
||||
|
||||
#include "ui_AddCurveFileDlg.h"
|
||||
|
||||
AddCurveFileDlg::AddCurveFileDlg(QWidget* parent)
|
||||
: BaseAddFileDlg(FileEntryType::Curve, parent)
|
||||
, ui(new Ui::AddCurveFileDlg) {
|
||||
, ui(new Ui::AddCurveFileDlg)
|
||||
, currentCurveIndex_(-1)
|
||||
, selectedColor_(255, 0, 0) { // Default to red color
|
||||
|
||||
ui->setupUi(this);
|
||||
SetupUI(ui);
|
||||
SetTitle(getDialogTitle());
|
||||
setupSpecificUI();
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
AddCurveFileDlg::~AddCurveFileDlg() {
|
||||
@ -20,16 +25,52 @@ AddCurveFileDlg::~AddCurveFileDlg() {
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::setupSpecificUI() {
|
||||
ui->xColumnSpinBox->setValue(1);
|
||||
ui->yColumnSpinBox->setValue(2);
|
||||
ui->separatorComboBox->setCurrentIndex(0);
|
||||
ui->hasHeaderCheckBox->setChecked(true);
|
||||
// Initialize curve properties group as disabled
|
||||
enableCurveProperties(false);
|
||||
|
||||
// Initialize color preview
|
||||
updateColorPreview(selectedColor_);
|
||||
|
||||
// Add a default curve
|
||||
CurveProperties defaultCurve;
|
||||
defaultCurve.name = generateCurveName();
|
||||
defaultCurve.color = generateCurveColor();
|
||||
defaultCurve.start = 1;
|
||||
defaultCurve.stop = 241;
|
||||
|
||||
curves_.append(defaultCurve);
|
||||
addCurveToList(defaultCurve);
|
||||
|
||||
// Select the first curve
|
||||
if (ui->curveListWidget->count() > 0) {
|
||||
ui->curveListWidget->setCurrentRow(0);
|
||||
onCurveSelectionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::setupConnections() {
|
||||
// File selection connections
|
||||
connect(ui->selectFileBtn, &QToolButton::clicked, this, &AddCurveFileDlg::onSelectFileClicked);
|
||||
connect(ui->filePathEdit, &QLineEdit::textChanged, this, &AddCurveFileDlg::onFilePathChanged);
|
||||
connect(ui->addBtn, &QPushButton::clicked, this, &QDialog::accept);
|
||||
|
||||
// Data format connections
|
||||
connect(ui->separatorComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &AddCurveFileDlg::onDelimiterChanged);
|
||||
connect(ui->hasHeaderCheckBox, &QCheckBox::toggled, this, &AddCurveFileDlg::onHeaderToggled);
|
||||
|
||||
// Curve management connections
|
||||
connect(ui->addCurveBtn, &QPushButton::clicked, this, &AddCurveFileDlg::onAddCurveClicked);
|
||||
connect(ui->removeCurveBtn, &QPushButton::clicked, this, &AddCurveFileDlg::onRemoveCurveClicked);
|
||||
connect(ui->curveListWidget, &QListWidget::currentRowChanged, this, &AddCurveFileDlg::onCurveSelectionChanged);
|
||||
|
||||
// Curve properties connections
|
||||
connect(ui->colorButton, &QPushButton::clicked, this, &AddCurveFileDlg::onColorButtonClicked);
|
||||
connect(ui->curveNameEdit, &QLineEdit::textChanged, this, &AddCurveFileDlg::onCurveNameChanged);
|
||||
connect(ui->dataStartSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AddCurveFileDlg::onCurveDataChanged);
|
||||
connect(ui->dataStopSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AddCurveFileDlg::onCurveDataChanged);
|
||||
|
||||
// Dialog buttons
|
||||
connect(ui->addBtn, &QPushButton::clicked, this, &AddCurveFileDlg::onSure);
|
||||
connect(ui->cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
@ -47,6 +88,17 @@ void AddCurveFileDlg::onSelectFileClicked() {
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::updateFileInfo(const QString& filePath) {
|
||||
QFileInfo fileInfo(filePath);
|
||||
if (fileInfo.exists()) {
|
||||
ui->fileNameValue->setText(fileInfo.fileName());
|
||||
ui->fileSizeValue->setText(QString::number(fileInfo.size()) + " bytes");
|
||||
} else {
|
||||
ui->fileNameValue->setText("-");
|
||||
ui->fileSizeValue->setText("-");
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onFilePathChanged() {
|
||||
QString filePath = ui->filePathEdit->text();
|
||||
if (!filePath.isEmpty()) {
|
||||
@ -54,23 +106,371 @@ void AddCurveFileDlg::onFilePathChanged() {
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onAddCurveClicked() {
|
||||
// Save current curve properties if any curve is selected
|
||||
if (currentCurveIndex_ >= 0) {
|
||||
saveCurveProperties();
|
||||
}
|
||||
|
||||
// Create new curve with default properties
|
||||
CurveProperties newCurve;
|
||||
newCurve.name = generateCurveName();
|
||||
newCurve.color = generateCurveColor();
|
||||
newCurve.start = 1;
|
||||
newCurve.stop = 241;
|
||||
|
||||
// Add to curves list and UI
|
||||
curves_.append(newCurve);
|
||||
addCurveToList(newCurve);
|
||||
|
||||
// Select the new curve
|
||||
ui->curveListWidget->setCurrentRow(curves_.size() - 1);
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onRemoveCurveClicked() {
|
||||
int currentRow = ui->curveListWidget->currentRow();
|
||||
if (currentRow < 0 || currentRow >= curves_.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't allow removing the last curve
|
||||
if (curves_.size() <= 1) {
|
||||
QMessageBox::information(this, "Information", "At least one curve must remain.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove from curves list and UI
|
||||
curves_.removeAt(currentRow);
|
||||
delete ui->curveListWidget->takeItem(currentRow);
|
||||
|
||||
// Update current index
|
||||
if (currentRow >= curves_.size()) {
|
||||
currentRow = curves_.size() - 1;
|
||||
}
|
||||
|
||||
if (currentRow >= 0) {
|
||||
ui->curveListWidget->setCurrentRow(currentRow);
|
||||
} else {
|
||||
currentCurveIndex_ = -1;
|
||||
clearCurveProperties();
|
||||
enableCurveProperties(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onCurveSelectionChanged() {
|
||||
int currentRow = ui->curveListWidget->currentRow();
|
||||
|
||||
// Save previous curve properties
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size()) {
|
||||
saveCurveProperties();
|
||||
}
|
||||
|
||||
currentCurveIndex_ = currentRow;
|
||||
|
||||
if (currentRow >= 0 && currentRow < curves_.size()) {
|
||||
// Load selected curve properties
|
||||
updateCurveProperties();
|
||||
enableCurveProperties(true);
|
||||
} else {
|
||||
clearCurveProperties();
|
||||
enableCurveProperties(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onCurveNameChanged() {
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size()) {
|
||||
QString newName = ui->curveNameEdit->text();
|
||||
curves_[currentCurveIndex_].name = newName;
|
||||
|
||||
// Update list item text
|
||||
QListWidgetItem* item = ui->curveListWidget->item(currentCurveIndex_);
|
||||
if (item) {
|
||||
item->setText(QString("%1 [%2,%3] (%4,%5,%6)")
|
||||
.arg(newName)
|
||||
.arg(curves_[currentCurveIndex_].start)
|
||||
.arg(curves_[currentCurveIndex_].stop)
|
||||
.arg(curves_[currentCurveIndex_].color.red())
|
||||
.arg(curves_[currentCurveIndex_].color.green())
|
||||
.arg(curves_[currentCurveIndex_].color.blue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onCurveDataChanged() {
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size()) {
|
||||
curves_[currentCurveIndex_].start = ui->dataStartSpinBox->value();
|
||||
curves_[currentCurveIndex_].stop = ui->dataStopSpinBox->value();
|
||||
|
||||
// Update list item text
|
||||
QListWidgetItem* item = ui->curveListWidget->item(currentCurveIndex_);
|
||||
if (item) {
|
||||
item->setText(QString("%1 [%2,%3] (%4,%5,%6)")
|
||||
.arg(curves_[currentCurveIndex_].name)
|
||||
.arg(curves_[currentCurveIndex_].start)
|
||||
.arg(curves_[currentCurveIndex_].stop)
|
||||
.arg(curves_[currentCurveIndex_].color.red())
|
||||
.arg(curves_[currentCurveIndex_].color.green())
|
||||
.arg(curves_[currentCurveIndex_].color.blue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onColorButtonClicked() {
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size()) {
|
||||
QColor color = QColorDialog::getColor(curves_[currentCurveIndex_].color, this, "Select Curve Color");
|
||||
if (color.isValid()) {
|
||||
curves_[currentCurveIndex_].color = color;
|
||||
selectedColor_ = color;
|
||||
updateColorPreview(color);
|
||||
|
||||
// Update list item text
|
||||
QListWidgetItem* item = ui->curveListWidget->item(currentCurveIndex_);
|
||||
if (item) {
|
||||
item->setText(QString("%1 [%2,%3] (%4,%5,%6)")
|
||||
.arg(curves_[currentCurveIndex_].name)
|
||||
.arg(curves_[currentCurveIndex_].start)
|
||||
.arg(curves_[currentCurveIndex_].stop)
|
||||
.arg(color.red())
|
||||
.arg(color.green())
|
||||
.arg(color.blue()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::addCurveToList(const CurveProperties& curve) {
|
||||
QString itemText = QString("%1 [%2,%3] (%4,%5,%6)")
|
||||
.arg(curve.name)
|
||||
.arg(curve.start)
|
||||
.arg(curve.stop)
|
||||
.arg(curve.color.red())
|
||||
.arg(curve.color.green())
|
||||
.arg(curve.color.blue());
|
||||
|
||||
ui->curveListWidget->addItem(itemText);
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::updateCurveProperties() {
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size()) {
|
||||
const CurveProperties& curve = curves_[currentCurveIndex_];
|
||||
|
||||
ui->curveNameEdit->setText(curve.name);
|
||||
ui->dataStartSpinBox->setValue(curve.start);
|
||||
ui->dataStopSpinBox->setValue(curve.stop);
|
||||
|
||||
selectedColor_ = curve.color;
|
||||
updateColorPreview(curve.color);
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::saveCurveProperties() {
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size()) {
|
||||
curves_[currentCurveIndex_].name = ui->curveNameEdit->text();
|
||||
curves_[currentCurveIndex_].start = ui->dataStartSpinBox->value();
|
||||
curves_[currentCurveIndex_].stop = ui->dataStopSpinBox->value();
|
||||
curves_[currentCurveIndex_].color = selectedColor_;
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::clearCurveProperties() {
|
||||
ui->curveNameEdit->clear();
|
||||
ui->dataStartSpinBox->setValue(1);
|
||||
ui->dataStopSpinBox->setValue(241);
|
||||
selectedColor_ = QColor(255, 0, 0);
|
||||
updateColorPreview(selectedColor_);
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::enableCurveProperties(bool enabled) {
|
||||
ui->curvePropertiesGroupBox->setEnabled(enabled);
|
||||
}
|
||||
|
||||
QString AddCurveFileDlg::generateCurveName() {
|
||||
return tr("Curve %1").arg(curves_.size() + 1);
|
||||
}
|
||||
|
||||
QColor AddCurveFileDlg::generateCurveColor() const {
|
||||
// Generate different colors for each curve
|
||||
static const QColor colors[] = {
|
||||
QColor(255, 0, 0), // Red
|
||||
QColor(0, 255, 0), // Green
|
||||
QColor(0, 0, 255), // Blue
|
||||
QColor(255, 255, 0), // Yellow
|
||||
QColor(255, 0, 255), // Magenta
|
||||
QColor(0, 255, 255), // Cyan
|
||||
QColor(255, 128, 0), // Orange
|
||||
QColor(128, 0, 255), // Purple
|
||||
};
|
||||
|
||||
int colorIndex = curves_.size() % (sizeof(colors) / sizeof(colors[0]));
|
||||
return colors[colorIndex];
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::updateColorPreview(const QColor& color) {
|
||||
QString styleSheet = QString("background-color: rgb(%1, %2, %3); border: 1px solid black;")
|
||||
.arg(color.red())
|
||||
.arg(color.green())
|
||||
.arg(color.blue());
|
||||
ui->colorPreview->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
bool AddCurveFileDlg::validateSpecificParams() {
|
||||
if (ui->filePathEdit->text().trimmed().isEmpty()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("Please select a curve data file."));
|
||||
// File path validation
|
||||
if (ui->filePathEdit->text().isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Please select a data file."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// File existence validation
|
||||
QFileInfo fileInfo(ui->filePathEdit->text());
|
||||
if (!fileInfo.exists()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("The selected file does not exist."));
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Selected file does not exist."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ui->xColumnSpinBox->value() == ui->yColumnSpinBox->value()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("X and Y columns must be different."));
|
||||
// File readability validation
|
||||
if (!fileInfo.isReadable()) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Selected file is not readable. Please check file permissions."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// File size validation (avoid memory issues with large files)
|
||||
if (fileInfo.size() > 100 * 1024 * 1024) { // 100MB limit
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("File is too large (over 100MB). Please select a smaller file."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Curve count validation
|
||||
if (curves_.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("At least one curve must be defined."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save current curve properties
|
||||
if (currentCurveIndex_ >= 0) {
|
||||
saveCurveProperties();
|
||||
}
|
||||
|
||||
// Curve name uniqueness validation
|
||||
QStringList curveNames;
|
||||
for (int i = 0; i < curves_.size(); ++i) {
|
||||
const CurveProperties& curve = curves_[i];
|
||||
|
||||
if (curve.name.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve %1 name cannot be empty.").arg(i + 1));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (curveNames.contains(curve.name)) {
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve name '%1' is duplicated. Please use different names.").arg(curve.name));
|
||||
return false;
|
||||
}
|
||||
curveNames.append(curve.name);
|
||||
|
||||
// Curve name length validation
|
||||
if (curve.name.length() > 50) {
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve name '%1' is too long. Please limit to 50 characters.").arg(curve.name));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Data range validation
|
||||
if (curve.start < 1 || curve.stop < 1) {
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve '%1' start and stop values must be greater than 0.").arg(curve.name));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (curve.start > curve.stop) {
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve '%1' start value cannot be greater than stop value.").arg(curve.name));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Data range reasonableness validation
|
||||
if (curve.stop - curve.start < 1) {
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve '%1' data range is too small. At least 2 data points are required.").arg(curve.name));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (curve.stop > 1000000) {
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
tr("Curve '%1' stop value is too large. Please ensure it does not exceed 1000000.").arg(curve.name));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Chart properties validation
|
||||
if (ui->chartNameEdit->text().isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Chart name cannot be empty."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ui->chartNameEdit->text().length() > 100) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Chart name is too long. Please limit to 100 characters."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Axis title validation
|
||||
if (ui->xTitleEdit->text().length() > 50) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("X axis title is too long. Please limit to 50 characters."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ui->yTitleEdit->text().length() > 50) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Y axis title is too long. Please limit to 50 characters."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Axis range validation
|
||||
double xMin = ui->xMinSpinBox->value();
|
||||
double xMax = ui->xMaxSpinBox->value();
|
||||
double yMin = ui->yMinSpinBox->value();
|
||||
double yMax = ui->yMaxSpinBox->value();
|
||||
|
||||
if (xMin >= xMax) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("X axis minimum value must be less than maximum value."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (yMin >= yMax) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Y axis minimum value must be less than maximum value."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Data column validation
|
||||
int xColumn = ui->xColumnSpinBox->value();
|
||||
int yColumn = ui->yColumnSpinBox->value();
|
||||
|
||||
if (xColumn == yColumn) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("X column and Y column cannot be the same."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (xColumn < 1 || yColumn < 1) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Data column indices must be greater than 0."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Time parameter validation
|
||||
double timeParam = ui->timeParamSpinBox->value();
|
||||
if (timeParam < 0) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Time parameter cannot be negative."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// X axis tick count validation
|
||||
int xTickCount = ui->xCountSpinBox->value();
|
||||
if (xTickCount < 2) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("X axis tick count must be at least 2."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Description length validation
|
||||
if (ui->descriptionEdit->toPlainText().length() > 500) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Description is too long. Please limit to 500 characters."));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -78,37 +478,75 @@ bool AddCurveFileDlg::validateSpecificParams() {
|
||||
}
|
||||
|
||||
QString AddCurveFileDlg::getFileFilter() const {
|
||||
return QStringLiteral("Curve Data Files (*.txt *.csv *.dat);;All Files (*.*)");
|
||||
return "Data Files (*.txt *.csv *.dat);;All Files (*.*)";
|
||||
}
|
||||
|
||||
QString AddCurveFileDlg::getDialogTitle() const {
|
||||
return QStringLiteral("Add Curve Data File");
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onDelimiterChanged() {
|
||||
// Handle delimiter change if needed
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onHeaderToggled(bool hasHeader) {
|
||||
// Handle header toggle if needed
|
||||
return "Add Curve Data File";
|
||||
}
|
||||
|
||||
AddCurveFileDlg::CurveParams AddCurveFileDlg::getCurveParams() const {
|
||||
CurveParams params;
|
||||
params.xColumn = ui->xColumnSpinBox->value();
|
||||
params.yColumn = ui->yColumnSpinBox->value();
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
params.hasHeader = ui->hasHeaderCheckBox->isChecked();
|
||||
params.description = ui->descriptionEdit->toPlainText().trimmed();
|
||||
params.chart = getChartProperties();
|
||||
params.curves = getCurveProperties();
|
||||
params.format = getDataFormatParams();
|
||||
return params;
|
||||
}
|
||||
|
||||
AddCurveFileDlg::ChartProperties AddCurveFileDlg::getChartProperties() const {
|
||||
ChartProperties chart;
|
||||
chart.name = ui->chartNameEdit->text();
|
||||
chart.path = ui->filePathEdit->text();
|
||||
chart.xTitle = ui->xTitleEdit->text();
|
||||
chart.yTitle = ui->yTitleEdit->text();
|
||||
chart.xMin = ui->xMinSpinBox->value();
|
||||
chart.xMax = ui->xMaxSpinBox->value();
|
||||
chart.xCount = ui->xCountSpinBox->value();
|
||||
chart.yMin = ui->yMinSpinBox->value();
|
||||
chart.yMax = ui->yMaxSpinBox->value();
|
||||
chart.timeParam = ui->timeParamSpinBox->value();
|
||||
return chart;
|
||||
}
|
||||
|
||||
QList<AddCurveFileDlg::CurveProperties> AddCurveFileDlg::getCurveProperties() const {
|
||||
return curves_;
|
||||
}
|
||||
|
||||
AddCurveFileDlg::DataFormatParams AddCurveFileDlg::getDataFormatParams() const {
|
||||
DataFormatParams format;
|
||||
|
||||
// Get delimiter based on combo box selection
|
||||
QString delimiterText = ui->separatorComboBox->currentText();
|
||||
if (delimiterText.contains("Comma")) {
|
||||
format.delimiter = ",";
|
||||
} else if (delimiterText.contains("Tab")) {
|
||||
format.delimiter = "\t";
|
||||
} else if (delimiterText.contains("Space")) {
|
||||
format.delimiter = " ";
|
||||
} else if (delimiterText.contains("Semicolon")) {
|
||||
format.delimiter = ";";
|
||||
} else {
|
||||
format.delimiter = ","; // Default
|
||||
}
|
||||
|
||||
format.hasHeader = ui->hasHeaderCheckBox->isChecked();
|
||||
format.xColumn = ui->xColumnSpinBox->value();
|
||||
format.yColumn = ui->yColumnSpinBox->value();
|
||||
format.description = ui->descriptionEdit->toPlainText();
|
||||
|
||||
return format;
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onDelimiterChanged() {
|
||||
// This slot can be used for future delimiter-related logic
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onHeaderToggled(bool hasHeader) {
|
||||
// This slot can be used for future header-related logic
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onSure() {
|
||||
if (validateSpecificParams()) {
|
||||
accept();
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseAddFileDlg.h"
|
||||
#include <QColor>
|
||||
#include <QList>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class QDoubleSpinBox;
|
||||
class QComboBox;
|
||||
class QTextEdit;
|
||||
class QToolButton;
|
||||
class QLabel;
|
||||
QT_END_NAMESPACE
|
||||
class QPushButton;
|
||||
class QListWidget;
|
||||
class QListWidgetItem;
|
||||
|
||||
namespace Ui {
|
||||
class AddCurveFileDlg;
|
||||
@ -20,7 +24,30 @@ class AddCurveFileDlg : public BaseAddFileDlg {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
struct CurveParams {
|
||||
// Chart properties structure
|
||||
struct ChartProperties {
|
||||
QString name;
|
||||
QString path;
|
||||
QString xTitle;
|
||||
QString yTitle;
|
||||
double xMin;
|
||||
double xMax;
|
||||
int xCount;
|
||||
double yMin;
|
||||
double yMax;
|
||||
double timeParam;
|
||||
};
|
||||
|
||||
// Curve properties structure
|
||||
struct CurveProperties {
|
||||
QString name;
|
||||
QColor color;
|
||||
int start;
|
||||
int stop;
|
||||
};
|
||||
|
||||
// Data format parameters structure
|
||||
struct DataFormatParams {
|
||||
QString delimiter;
|
||||
bool hasHeader;
|
||||
int xColumn;
|
||||
@ -28,10 +55,20 @@ public:
|
||||
QString description;
|
||||
};
|
||||
|
||||
// Combined parameters structure
|
||||
struct CurveParams {
|
||||
ChartProperties chart;
|
||||
QList<CurveProperties> curves; // Changed to support multiple curves
|
||||
DataFormatParams format;
|
||||
};
|
||||
|
||||
explicit AddCurveFileDlg(QWidget* parent = nullptr);
|
||||
~AddCurveFileDlg() override;
|
||||
|
||||
CurveParams getCurveParams() const;
|
||||
ChartProperties getChartProperties() const;
|
||||
QList<CurveProperties> getCurveProperties() const; // Changed to return list
|
||||
DataFormatParams getDataFormatParams() const;
|
||||
|
||||
protected:
|
||||
QString getFileFilter() const override;
|
||||
@ -44,10 +81,27 @@ private slots:
|
||||
void onHeaderToggled(bool hasHeader);
|
||||
void onSelectFileClicked();
|
||||
void onFilePathChanged();
|
||||
void onColorButtonClicked();
|
||||
void onAddCurveClicked();
|
||||
void onRemoveCurveClicked();
|
||||
void onCurveSelectionChanged();
|
||||
void onCurveNameChanged();
|
||||
void onCurveDataChanged();
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
void updateFileInfo(const QString& filePath);
|
||||
void updateColorPreview(const QColor& color);
|
||||
void addCurveToList(const CurveProperties& curve);
|
||||
void updateCurveProperties();
|
||||
void saveCurveProperties();
|
||||
void clearCurveProperties();
|
||||
void enableCurveProperties(bool enabled);
|
||||
QString generateCurveName();
|
||||
QColor generateCurveColor() const;
|
||||
|
||||
private:
|
||||
Ui::AddCurveFileDlg* ui;
|
||||
QList<CurveProperties> curves_;
|
||||
int currentCurveIndex_;
|
||||
QColor selectedColor_;
|
||||
};
|
||||
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>450</height>
|
||||
<width>600</width>
|
||||
<height>700</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -75,10 +75,384 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="chartGroupBox">
|
||||
<property name="title">
|
||||
<string>Chart Properties</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="chartGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="chartNameLabel">
|
||||
<property name="text">
|
||||
<string>Chart Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="chartNameEdit">
|
||||
<property name="text">
|
||||
<string>Chart 1</string>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter chart name...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="xTitleLabel">
|
||||
<property name="text">
|
||||
<string>X Axis Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="xTitleEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Enter X axis title...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="yTitleLabel">
|
||||
<property name="text">
|
||||
<string>Y Axis Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="yTitleEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Enter Y axis title...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="timeParamLabel">
|
||||
<property name="text">
|
||||
<string>Time Parameter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QDoubleSpinBox" name="timeParamSpinBox">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="axisRangeGroupBox">
|
||||
<property name="title">
|
||||
<string>Axis Range Settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="axisRangeGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="xMinLabel">
|
||||
<property name="text">
|
||||
<string>X Min:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="xMinSpinBox">
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="xMaxLabel">
|
||||
<property name="text">
|
||||
<string>X Max:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QDoubleSpinBox" name="xMaxSpinBox">
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>250.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="yMinLabel">
|
||||
<property name="text">
|
||||
<string>Y Min:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="yMinSpinBox">
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>-800.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="yMaxLabel">
|
||||
<property name="text">
|
||||
<string>Y Max:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QDoubleSpinBox" name="yMaxSpinBox">
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>800.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="xCountLabel">
|
||||
<property name="text">
|
||||
<string>X Tick Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="xCountSpinBox">
|
||||
<property name="minimum">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>50</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="curveGroupBox">
|
||||
<property name="title">
|
||||
<string>Curve Management</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="curveVerticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="curveButtonLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="curveListLabel">
|
||||
<property name="text">
|
||||
<string>Curves:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="curveButtonSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addCurveBtn">
|
||||
<property name="text">
|
||||
<string>Add Curve</string>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeCurveBtn">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="curveListWidget">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>120</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="curvePropertiesGroupBox">
|
||||
<property name="title">
|
||||
<string>Selected Curve Properties</string>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="curvePropertiesGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="curveNameLabel">
|
||||
<property name="text">
|
||||
<string>Curve Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="curveNameEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Enter curve name...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="curveColorLabel">
|
||||
<property name="text">
|
||||
<string>Curve Color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="colorLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="colorButton">
|
||||
<property name="text">
|
||||
<string>Select Color</string>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="colorPreview">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string>background-color: rgb(255, 0, 0); border: 1px solid black;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="colorSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="dataStartLabel">
|
||||
<property name="text">
|
||||
<string>Data Start:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="dataStartSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="dataStopLabel">
|
||||
<property name="text">
|
||||
<string>Data Stop:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="dataStopSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>241</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="paramsGroupBox">
|
||||
<property name="title">
|
||||
<string>Curve Parameters</string>
|
||||
<string>Data Format Parameters</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="paramsGridLayout">
|
||||
<item row="0" column="0">
|
||||
@ -176,7 +550,7 @@
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
@ -195,7 +569,7 @@
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
|
||||
@ -23,11 +23,9 @@ BaseAddFileDlg::BaseAddFileDlg(FileEntryType fileType, QWidget* parent)
|
||||
, tbSelectFile_(nullptr)
|
||||
, lblFileName_(nullptr)
|
||||
, lblFileSize_(nullptr)
|
||||
, teDescription_(nullptr)
|
||||
, pbAdd_(nullptr)
|
||||
, pbCancel_(nullptr) {
|
||||
, teDescription_(nullptr) {
|
||||
|
||||
setupBaseUI();
|
||||
//setupBaseUI();
|
||||
initBaseConnect();
|
||||
}
|
||||
|
||||
@ -91,20 +89,10 @@ void BaseAddFileDlg::setupBaseUI() {
|
||||
descLayout->addWidget(teDescription_);
|
||||
mainLayout->addWidget(descGroup);
|
||||
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout();
|
||||
buttonLayout->addStretch();
|
||||
pbAdd_ = new QPushButton(QStringLiteral("Add"), this);
|
||||
pbCancel_ = new QPushButton(QStringLiteral("Cancel"), this);
|
||||
buttonLayout->addWidget(pbAdd_);
|
||||
buttonLayout->addWidget(pbCancel_);
|
||||
|
||||
mainLayout->addLayout(buttonLayout);
|
||||
}
|
||||
|
||||
void BaseAddFileDlg::initBaseConnect() {
|
||||
connect(tbSelectFile_, &QToolButton::clicked, this, &BaseAddFileDlg::OnSelectFile);
|
||||
connect(pbAdd_, &QPushButton::clicked, this, &BaseAddFileDlg::OnSure);
|
||||
connect(pbCancel_, &QPushButton::clicked, this, &BaseAddFileDlg::reject);
|
||||
}
|
||||
|
||||
void BaseAddFileDlg::OnSelectFile() {
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
class QLineEdit;
|
||||
class QLabel;
|
||||
class QTextEdit;
|
||||
class QPushButton;
|
||||
class QToolButton;
|
||||
|
||||
class BaseAddFileDlg : public Dialog {
|
||||
@ -38,8 +37,6 @@ protected:
|
||||
QLabel* lblFileName_;
|
||||
QLabel* lblFileSize_;
|
||||
QTextEdit* teDescription_;
|
||||
QPushButton* pbAdd_;
|
||||
QPushButton* pbCancel_;
|
||||
|
||||
void setupBaseUI();
|
||||
void initBaseConnect();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user