light dilaog

This commit is contained in:
brige 2025-10-27 22:58:41 +08:00
parent 843d2cf158
commit 87c2f23446
16 changed files with 1319 additions and 636 deletions

View File

@ -54,6 +54,11 @@
<source>Chart 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="97"/>
<source>Enter chart name...</source>
@ -65,157 +70,142 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="112"/>
<source>Wave</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="117"/>
<source>Report</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="125"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="114"/>
<source>X Axis Title:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="132"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="121"/>
<source>Enter X axis title...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="139"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="128"/>
<source>Y Axis Title:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="146"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="135"/>
<source>Enter Y axis title...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="153"/>
<source>Time Parameter:</source>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="142"/>
<source>Time:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="176"/>
<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="228"/>
<source>X Min:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="288"/>
<source>X Max:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="242"/>
<source>Y Min:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="235"/>
<source>Y Max:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="208"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="187"/>
<source>X Tick Count:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="383"/>
<source>Curve Name:</source>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="207"/>
<source>X Min:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="94"/>
<source>Chart 1</source>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="214"/>
<source>Y Max:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="295"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="221"/>
<source>Y Min:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="267"/>
<source>X Max:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="274"/>
<source>Y Tick Count:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="305"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="284"/>
<source>Curve Management</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="313"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="292"/>
<source>Curves:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="339"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="318"/>
<source>Add Curve</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="352"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="331"/>
<source>Remove</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="377"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="356"/>
<source>Selected Curve Properties</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="390"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="362"/>
<source>Curve Name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="369"/>
<source>Enter curve name...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="397"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="376"/>
<source>Curve Color:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="412"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="391"/>
<source>Select Color</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="425"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="404"/>
<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="450"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="429"/>
<source>Data Start:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="470"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="449"/>
<source>Data Stop:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="490"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="472"/>
<source>X Value:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="516"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="498"/>
<source>Y Value:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="563"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="542"/>
<source>Add File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="573"/>
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="552"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
@ -405,6 +395,11 @@
</context>
<context>
<name>AddLightFileDlg</name>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="14"/>
<source>Add Light Data File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="20"/>
<source>File Selection</source>
@ -415,11 +410,6 @@
<source>File Path:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="14"/>
<source>Add Light Data File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="36"/>
<source>Select light data file...</source>
@ -438,6 +428,7 @@
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="57"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="71"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="328"/>
<source>-</source>
<translation type="unfinished"></translation>
</message>
@ -489,7 +480,7 @@
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="230"/>
<source>Add Light</source>
<source>Add Light Row</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -503,63 +494,78 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="274"/>
<source>Light Name:</source>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="276"/>
<source>Light Names:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="281"/>
<source>Enter light name...</source>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="283"/>
<source>Enter light names (comma separated)...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="288"/>
<source>Light Index:</source>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="290"/>
<source>Light Data:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="329"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="299"/>
<source>Enter data values (comma separated integers)...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="312"/>
<source>Edit Data</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="321"/>
<source>Row Index:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="358"/>
<source>Add File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="336"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="365"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="302"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="339"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="359"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="396"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="302"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="359"/>
<source>Unable to get current workspace</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="324"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="381"/>
<source>Curve file count has reached the limit (9 files)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="327"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="384"/>
<source>File already exists</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="330"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="387"/>
<source>File copy failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="333"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="390"/>
<source>Invalid file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="336"/>
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="393"/>
<source>Failed to add file</source>
<translation type="unfinished"></translation>
</message>
@ -652,6 +658,11 @@
</context>
<context>
<name>AddSurfaceFileDlg</name>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="14"/>
<source>Add Surface File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="20"/>
<source>File Selection</source>
@ -662,11 +673,6 @@
<source>Select surface data file...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="14"/>
<source>Add Surface File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="33"/>
<source>Browse...</source>
@ -809,11 +815,6 @@
<source>,</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="524"/>
<source>Has Header Row</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="484"/>
<source>X Grid Size:</source>
@ -825,13 +826,8 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="112"/>
<source>Select Surface Data File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="118"/>
<source>Please add at least one surface.</source>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="524"/>
<source>Has Header Row</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -839,12 +835,22 @@
<source>Surface Data Files (*.txt *.dat *.csv);;All Files (*.*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="112"/>
<source>Select Surface Data File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="118"/>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="124"/>
<source>Warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="118"/>
<source>Please add at least one surface.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="124"/>
<source>Please fill in all axis titles.</source>
@ -906,190 +912,281 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="81"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="27"/>
<source>File Selection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="33"/>
<source>File Path:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="43"/>
<source>Select table data file...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="50"/>
<source>...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="57"/>
<source>File Name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="64"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="78"/>
<source>-</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="71"/>
<source>File Size:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="88"/>
<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>Table Name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="124"/>
<source>Time Parameter:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="20"/>
<source>File Selection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="26"/>
<source>File Path:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="36"/>
<source>Select table data file...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="43"/>
<source>...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="50"/>
<source>File Name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="57"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="71"/>
<source>-</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="64"/>
<source>File Size:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="193"/>
<source>Encoding:</source>
<translation type="unfinished"></translation>
</message>
<message>
<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="206"/>
<source>GBK</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="211"/>
<source>ASCII</source>
<translation type="unfinished"></translation>
</message>
<message>
<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="176"/>
<source>Skip Rows:</source>
<translation type="unfinished"></translation>
</message>
<message>
<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="127"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="134"/>
<source>Table Headers Configuration</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="143"/>
<source>Headers (comma-separated):</source>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="140"/>
<source>File has header row</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="150"/>
<source>Headers (comma-separated):</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="157"/>
<source>e.g., Time, Value1, Value2, Value3...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="160"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="167"/>
<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"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="177"/>
<source>Parsing Parameters</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="183"/>
<source>Skip Rows:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="190"/>
<source>Auto-detect parameters</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="240"/>
<source>Preview</source>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="200"/>
<source>Encoding:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="296"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="208"/>
<source>UTF-8</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="213"/>
<source>GBK</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="218"/>
<source>ASCII</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="223"/>
<source>ISO-8859-1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="251"/>
<source>Curves Configuration</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="259"/>
<source>Add Curve</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="269"/>
<source>Remove Curve</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="307"/>
<source>Curve Properties</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="313"/>
<source>Name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="320"/>
<source>Enter curve name...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="327"/>
<source>Color:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="342"/>
<source>Select Color</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="383"/>
<source>Data:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="390"/>
<source>Enter data values (comma-separated)...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="400"/>
<source>Data values must match the number of headers</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="435"/>
<source>Add File</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="306"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="445"/>
<source>Cancel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="118"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="100"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="295"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="302"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="312"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="318"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="324"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="350"/>
<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>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="100"/>
<source>Please configure table headers first.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="170"/>
<source>Select Curve Color</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="296"/>
<source>Please configure table headers.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="303"/>
<source>Please add at least one curve.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="313"/>
<source>Curve %1 name cannot be empty.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="319"/>
<source>Curve &apos;%1&apos; data cannot be empty.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="325"/>
<source>Curve &apos;%1&apos; data count (%2) doesn&apos;t match headers count (%3).</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="350"/>
<source>Please enter a table name.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="358"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="381"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="406"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="358"/>
<source>Failed to create table file entry.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="381"/>
<source>Unable to get current workspace</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="391"/>
<source>Table file count has reached the limit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="394"/>
<source>File already exists</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="397"/>
<source>File copy failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="400"/>
<source>Invalid file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="173"/>
<location filename="../ui/WorkSpace/AddTableFileDlg.cpp" line="403"/>
<source>Failed to add file</source>
<translation type="unfinished"></translation>
</message>
@ -1409,14 +1506,6 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FitCurve</name>
<message>
<location filename="../ui/Panel/FitCurve.ui" line="14"/>
<source>FitCurveDialog</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FitCurveChartView</name>
<message>
@ -1879,30 +1968,6 @@
<source>altitude:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8051"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8245"/>
<source>Curve[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8052"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8246"/>
<source>Surface[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8053"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8247"/>
<source>Table[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8054"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8248"/>
<source>Light[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="54"/>
<source>Open Workspace</source>
@ -1969,14 +2034,6 @@
<source>Failed to create file entry</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="126"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="171"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="216"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="261"/>
<source>invalid file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="114"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="159"/>
@ -2001,6 +2058,38 @@
<source>copy file failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="126"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="171"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="216"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="261"/>
<source>invalid file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8051"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8245"/>
<source>Curve[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8052"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8246"/>
<source>Surface[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8053"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8247"/>
<source>Table[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8054"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8248"/>
<source>Light[%1]</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QtBoolEdit</name>

View File

@ -102,7 +102,7 @@ void DataPanelManager::OnWorkspaceChanged(WorkSpace* workspace)
SetWorkspace(workspace);
}
void DataPanelManager::OnFilesChanged(FileEntryType type)
void DataPanelManager::OnFilesChanged(FileEntryType type, std::shared_ptr<FileEntry> fileEntry)
{
// Only respond to supported file types
if (!DataPanelFactory::IsTypeSupported(type)) {

View File

@ -61,7 +61,7 @@ public slots:
* @brief Handle file changes
* @param type File type
*/
void OnFilesChanged(FileEntryType type);
void OnFilesChanged(FileEntryType type, std::shared_ptr<FileEntry> fileEntry);
/**
* @brief Handle panel close event

View File

@ -175,7 +175,7 @@ void PropertyBrowser::InitPropertyManager() {
doubleSpinBoxFactory);
}
void PropertyBrowser::OnWorkspaceFilesChanged(FileEntryType /*type*/) {
void PropertyBrowser::OnWorkspaceFilesChanged(FileEntryType /*type*/, std::shared_ptr<FileEntry> /*fileEntry*/) {
if (!currentWorkspace_) return;
auto it = idToProperty_.find(tr("WorkSpace"));
if (it == idToProperty_.end()) return;

View File

@ -18,7 +18,7 @@ public:
void OnWorkSpaceChange(const QVariant& value);
void OnEntityChange(const QVariant& value);
void OnWorkspaceFilesChanged(enum class FileEntryType type);
void OnWorkspaceFilesChanged(enum class FileEntryType type, std::shared_ptr<FileEntry> fileEntry);
void Test();

View File

@ -51,7 +51,8 @@ void AddLightFileDlg::setupConnections() {
// Light properties connections
connect(ui->lightNameEdit, &QLineEdit::textChanged, this, &AddLightFileDlg::onLightNameChanged);
connect(ui->lightIndexSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AddLightFileDlg::onLightIndexChanged);
connect(ui->lightDataEdit, &QLineEdit::textChanged, this, &AddLightFileDlg::onLightDataChanged);
connect(ui->editDataBtn, &QPushButton::clicked, this, &AddLightFileDlg::onEditDataClicked);
// Dialog buttons
connect(ui->addFileBtn, &QPushButton::clicked, this, &AddLightFileDlg::onSure);
@ -107,17 +108,16 @@ void AddLightFileDlg::onAddLightClicked() {
}
// Create new light with default properties
FileEntryLight::LightProperty newLight;
newLight.name = generateLightName();
newLight.index = lights_.size();
FileEntryLight::LightRowProperty newLight;
newLight.name = QStringList() << generateLightName();
// Add to lights list
lights_.append(newLight);
// Add to UI list widget
QListWidgetItem* item = new QListWidgetItem(QString("%1 [Index: %2]")
.arg(newLight.name)
.arg(newLight.index));
QListWidgetItem* item = new QListWidgetItem(QString("%1 [Row: %2]")
.arg(newLight.name.join(", "))
.arg(lights_.size() - 1));
ui->lightListWidget->addItem(item);
// Select the new item
@ -151,14 +151,13 @@ void AddLightFileDlg::onRemoveLightClicked() {
updateLightProperties();
}
// Update list display with new indices
// Update list display with new row indices
for (int i = 0; i < lights_.size(); ++i) {
lights_[i].index = i;
QListWidgetItem* item = ui->lightListWidget->item(i);
if (item) {
item->setText(QString("%1 [Index: %2]")
.arg(lights_[i].name)
.arg(lights_[i].index));
item->setText(QString("%1 [Row: %2]")
.arg(lights_[i].name.join(", "))
.arg(i));
}
}
}
@ -189,30 +188,19 @@ void AddLightFileDlg::onLightSelectionChanged() {
void AddLightFileDlg::onLightNameChanged() {
if (currentLightIndex_ >= 0 && currentLightIndex_ < lights_.size()) {
QString newName = ui->lightNameEdit->text();
lights_[currentLightIndex_].name = newName;
// Update list widget item text
QListWidgetItem* item = ui->lightListWidget->item(currentLightIndex_);
if (item) {
item->setText(QString("%1 [Index: %2]")
.arg(newName)
.arg(lights_[currentLightIndex_].index));
QString namesText = ui->lightNameEdit->text();
QStringList names = namesText.split(",", Qt::SkipEmptyParts);
for (int i = 0; i < names.size(); ++i) {
names[i] = names[i].trimmed();
}
}
}
void AddLightFileDlg::onLightIndexChanged() {
if (currentLightIndex_ >= 0 && currentLightIndex_ < lights_.size()) {
int newIndex = ui->lightIndexSpinBox->value();
lights_[currentLightIndex_].index = newIndex;
lights_[currentLightIndex_].name = names;
// Update list widget item text
QListWidgetItem* item = ui->lightListWidget->item(currentLightIndex_);
if (item) {
item->setText(QString("%1 [Index: %2]")
.arg(lights_[currentLightIndex_].name)
.arg(newIndex));
item->setText(QString("%1 [Row: %2]")
.arg(names.join(", "))
.arg(currentLightIndex_));
}
}
}
@ -233,31 +221,63 @@ void AddLightFileDlg::updateCloseColorPreview(const QColor& color) {
ui->closeColorPreview->setStyleSheet(styleSheet);
}
void AddLightFileDlg::addLightToList(const FileEntryLight::LightProperty& light) {
QListWidgetItem* item = new QListWidgetItem(QString("%1 [Index: %2]")
.arg(light.name)
.arg(light.index));
void AddLightFileDlg::addLightToList(const FileEntryLight::LightRowProperty& light) {
QListWidgetItem* item = new QListWidgetItem(QString("%1 [Row: %2]")
.arg(light.name.join(", "))
.arg(lights_.size()));
ui->lightListWidget->addItem(item);
}
void AddLightFileDlg::updateLightProperties() {
if (currentLightIndex_ >= 0 && currentLightIndex_ < lights_.size()) {
const FileEntryLight::LightProperty& light = lights_[currentLightIndex_];
ui->lightNameEdit->setText(light.name);
ui->lightIndexSpinBox->setValue(light.index);
const FileEntryLight::LightRowProperty& light = lights_[currentLightIndex_];
ui->lightNameEdit->setText(light.name.join(", "));
// Update data edit
QStringList dataStrings;
for (int dataValue : light.data) {
dataStrings.append(QString::number(dataValue));
}
ui->lightDataEdit->setText(dataStrings.join(", "));
// Update row index display
ui->rowIndexValue->setText(QString::number(currentLightIndex_));
// Update data display
updateDataDisplay();
}
}
void AddLightFileDlg::saveLightProperties() {
if (currentLightIndex_ >= 0 && currentLightIndex_ < lights_.size()) {
lights_[currentLightIndex_].name = ui->lightNameEdit->text();
lights_[currentLightIndex_].index = ui->lightIndexSpinBox->value();
// Save names
QString namesText = ui->lightNameEdit->text();
QStringList names = namesText.split(",", Qt::SkipEmptyParts);
for (int i = 0; i < names.size(); ++i) {
names[i] = names[i].trimmed();
}
lights_[currentLightIndex_].name = names;
// Save data
QString dataText = ui->lightDataEdit->text();
QStringList dataStrings = dataText.split(",", Qt::SkipEmptyParts);
QList<int> dataValues;
for (const QString& str : dataStrings) {
bool ok;
int dataValue = str.trimmed().toInt(&ok);
if (ok) {
dataValues.append(dataValue);
}
}
lights_[currentLightIndex_].data = dataValues;
}
}
void AddLightFileDlg::clearLightProperties() {
ui->lightNameEdit->clear();
ui->lightIndexSpinBox->setValue(0);
ui->lightDataEdit->clear();
ui->rowIndexValue->setText("-");
}
void AddLightFileDlg::enableLightProperties(bool enabled) {
@ -265,7 +285,44 @@ void AddLightFileDlg::enableLightProperties(bool enabled) {
}
QString AddLightFileDlg::generateLightName() {
return QString("Light %1").arg(lights_.size() + 1);
return QString("Light_%1").arg(lights_.size() + 1);
}
void AddLightFileDlg::updateDataDisplay() {
if (currentLightIndex_ >= 0 && currentLightIndex_ < lights_.size()) {
const FileEntryLight::LightRowProperty& light = lights_[currentLightIndex_];
QStringList dataStrings;
for (int dataValue : light.data) {
dataStrings.append(QString::number(dataValue));
}
ui->lightDataEdit->setText(dataStrings.join(", "));
} else {
ui->lightDataEdit->clear();
}
}
void AddLightFileDlg::onLightDataChanged() {
// Parse comma-separated data values and store them
if (currentLightIndex_ >= 0 && currentLightIndex_ < lights_.size()) {
QString dataText = ui->lightDataEdit->text();
QStringList dataStrings = dataText.split(',', Qt::SkipEmptyParts);
QList<int> dataValues;
for (const QString& str : dataStrings) {
bool ok;
int dataValue = str.trimmed().toInt(&ok);
if (ok) {
dataValues.append(dataValue);
}
}
lights_[currentLightIndex_].data = dataValues;
}
}
void AddLightFileDlg::onEditDataClicked() {
// Future implementation: could open a detailed data editor dialog
// For now, just focus on the data edit field
ui->lightDataEdit->setFocus();
}
bool AddLightFileDlg::validateSpecificParams() {

View File

@ -8,7 +8,6 @@
class QLineEdit;
class QCheckBox;
class QSpinBox;
class QDoubleSpinBox;
class QTextEdit;
class QToolButton;
@ -42,25 +41,29 @@ private slots:
void onLightListWidgetItemClicked(QListWidgetItem* item);
void onLightSelectionChanged();
void onLightNameChanged();
void onLightIndexChanged();
void onSure();
private:
void setupConnections();
void updateOpenColorPreview(const QColor& color);
void updateCloseColorPreview(const QColor& color);
void addLightToList(const FileEntryLight::LightProperty& light);
void addLightToList(const FileEntryLight::LightRowProperty& light);
void updateLightProperties();
void saveLightProperties();
void clearLightProperties();
void enableLightProperties(bool enabled);
QString generateLightName();
// New methods for data handling
void updateDataDisplay();
void onLightDataChanged();
void onEditDataClicked();
Ui::AddLightFileDlg* ui;
int currentLightIndex_;
QColor openColor_;
QColor closeColor_;
FileEntryLight::ColorProperties colorProperties_;
FileEntryLight::LightProperties lights_;
FileEntryLight::LightRowProperties lights_;
};

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>600</width>
<height>487</height>
<height>516</height>
</rect>
</property>
<property name="windowTitle">
@ -222,12 +222,12 @@
<widget class="QPushButton" name="addLightBtn">
<property name="maximumSize">
<size>
<width>80</width>
<width>180</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Add Light</string>
<string>Add Light Row</string>
</property>
</widget>
</item>
@ -267,40 +267,69 @@
<property name="title">
<string>Selected Light Properties</string>
</property>
<layout class="QGridLayout" name="lightPropertiesGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lightNameLabel">
<property name="text">
<string>Light Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lightNameEdit">
<property name="placeholderText">
<string>Enter light name...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lightIndexLabel">
<property name="text">
<string>Light Index:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="lightIndexSpinBox">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>999999</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
<layout class="QVBoxLayout" name="lightPropertiesVLayout">
<item>
<layout class="QGridLayout" name="lightPropertiesGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lightNameLabel">
<property name="text">
<string>Light Names:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lightNameEdit">
<property name="placeholderText">
<string>Enter light names (comma separated)...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lightDataLabel">
<property name="text">
<string>Light Data:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="lightDataLayout">
<item>
<widget class="QLineEdit" name="lightDataEdit">
<property name="placeholderText">
<string>Enter data values (comma separated integers)...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="editDataBtn">
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Edit Data</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="rowIndexLabel">
<property name="text">
<string>Row Index:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="rowIndexValue">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>

View File

@ -3,6 +3,7 @@
#include <QMessageBox>
#include <QFileInfo>
#include <QFileDialog>
#include <QColorDialog>
#include "app/Application.h"
#include "common/SpdLogger.h"
@ -14,7 +15,8 @@
AddTableFileDlg::AddTableFileDlg(QWidget* parent)
: BaseAddFileDlg(FileEntryType::Table, parent)
, ui(new Ui::AddTableFileDlg) {
, ui(new Ui::AddTableFileDlg)
, m_currentCurveIndex(-1) {
SetupUI(ui);
SetTitle(getDialogTitle());
@ -27,28 +29,26 @@ AddTableFileDlg::~AddTableFileDlg() {
void AddTableFileDlg::setupConnections() {
// Connect file selection
connect(ui->selectFileBtn, &QToolButton::clicked, this, &AddTableFileDlg::onSelectFileClicked);
connect(ui->selectFileBtn, &QToolButton::clicked, this, &AddTableFileDlg::OnSelectFile);
connect(ui->filePathEdit, &QLineEdit::textChanged, this, &AddTableFileDlg::onFilePathChanged);
connect(ui->hasHeaderCheckBox, &QCheckBox::toggled, this, &AddTableFileDlg::onHeaderToggled);
connect(ui->headersEdit, &QLineEdit::textChanged, this, &AddTableFileDlg::onHeadersChanged);
// Connect curve management
connect(ui->addCurveBtn, &QPushButton::clicked, this, &AddTableFileDlg::onAddCurveClicked);
connect(ui->removeCurveBtn, &QPushButton::clicked, this, &AddTableFileDlg::onRemoveCurveClicked);
connect(ui->curvesListWidget, &QListWidget::currentRowChanged, this, &AddTableFileDlg::onCurveSelectionChanged);
// Connect curve properties
connect(ui->curveNameEdit, &QLineEdit::textChanged, this, &AddTableFileDlg::onCurveNameChanged);
connect(ui->colorBtn, &QPushButton::clicked, this, &AddTableFileDlg::onCurveColorClicked);
connect(ui->curveDataEdit, &QLineEdit::textChanged, this, &AddTableFileDlg::onCurveDataChanged);
connect(ui->addBtn, &QPushButton::clicked, this, [this]() { OnSure(); });
connect(ui->cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
}
void AddTableFileDlg::onSelectFileClicked() {
const QString workspacePath = Application::GetWorkSpacePath();
QString filePath = QFileDialog::getOpenFileName(
this,
QStringLiteral("Select Table File"),
workspacePath,
getFileFilter()
);
if (!filePath.isEmpty()) {
ui->filePathEdit->setText(filePath);
}
}
void AddTableFileDlg::onFilePathChanged(const QString& filePath) {
updateFileInfo(filePath);
}
@ -56,6 +56,7 @@ void AddTableFileDlg::onFilePathChanged(const QString& filePath) {
void AddTableFileDlg::updateFileInfo(const QString& filePath) {
QFileInfo fileInfo(filePath);
ui->fileNameValue->setText(fileInfo.fileName());
ui->filePathEdit->setText(filePath);
qint64 size = fileInfo.size();
QString sizeText;
@ -77,6 +78,203 @@ void AddTableFileDlg::onHeaderToggled(bool hasHeader) {
// Handle header toggle if needed
}
void AddTableFileDlg::onHeadersChanged() {
// Update data validation when headers change
if (m_currentCurveIndex >= 0 && m_currentCurveIndex < m_curves.size()) {
QString data = ui->curveDataEdit->text();
QStringList headers = getHeadersList();
if (!data.isEmpty() && !validateCurveData(data, headers.size())) {
ui->dataValidationLabel->setText(QString("Data values must match the number of headers (%1)").arg(headers.size()));
ui->dataValidationLabel->setStyleSheet("color: red; font-size: 11px;");
} else {
ui->dataValidationLabel->setText(QString("Data values must match the number of headers (%1)").arg(headers.size()));
ui->dataValidationLabel->setStyleSheet("color: gray; font-size: 11px;");
}
}
}
void AddTableFileDlg::onAddCurveClicked() {
QStringList headers = getHeadersList();
if (headers.isEmpty()) {
QMessageBox::warning(this, tr("Warning"), tr("Please configure table headers first."));
return;
}
// Save current curve properties if any
saveCurveProperties();
// Create new curve with default values
CurveData newCurve;
newCurve.name = QString("Curve %1").arg(m_curves.size() + 1);
newCurve.color = QColor::fromHsv((m_curves.size() * 60) % 360, 200, 200); // Different colors
m_curves.append(newCurve);
updateCurvesList();
// Select the new curve
ui->curvesListWidget->setCurrentRow(m_curves.size() - 1);
}
void AddTableFileDlg::onRemoveCurveClicked() {
int currentRow = ui->curvesListWidget->currentRow();
if (currentRow >= 0 && currentRow < m_curves.size()) {
m_curves.removeAt(currentRow);
updateCurvesList();
if (m_curves.isEmpty()) {
m_currentCurveIndex = -1;
ui->curvePropertiesGroupBox->setEnabled(false);
ui->removeCurveBtn->setEnabled(false);
} else {
// Select previous curve or first curve
int newIndex = qMin(currentRow, m_curves.size() - 1);
ui->curvesListWidget->setCurrentRow(newIndex);
}
}
}
void AddTableFileDlg::onCurveSelectionChanged() {
// Save current curve properties before switching
saveCurveProperties();
int currentRow = ui->curvesListWidget->currentRow();
m_currentCurveIndex = currentRow;
if (currentRow >= 0 && currentRow < m_curves.size()) {
ui->curvePropertiesGroupBox->setEnabled(true);
ui->removeCurveBtn->setEnabled(true);
updateCurveProperties();
} else {
ui->curvePropertiesGroupBox->setEnabled(false);
ui->removeCurveBtn->setEnabled(false);
}
}
void AddTableFileDlg::onCurveNameChanged() {
if (m_currentCurveIndex >= 0 && m_currentCurveIndex < m_curves.size()) {
QString newName = ui->curveNameEdit->text();
m_curves[m_currentCurveIndex].name = newName;
// Update list item text
QListWidgetItem* item = ui->curvesListWidget->item(m_currentCurveIndex);
if (item) {
item->setText(newName);
}
}
}
void AddTableFileDlg::onCurveColorClicked() {
if (m_currentCurveIndex >= 0 && m_currentCurveIndex < m_curves.size()) {
QColor currentColor = m_curves[m_currentCurveIndex].color;
QColor newColor = QColorDialog::getColor(currentColor, this, tr("Select Curve Color"));
if (newColor.isValid()) {
m_curves[m_currentCurveIndex].color = newColor;
// Update color preview
QString colorStyle = QString("background-color: rgb(%1, %2, %3); border: 1px solid gray;")
.arg(newColor.red()).arg(newColor.green()).arg(newColor.blue());
ui->colorPreviewLabel->setStyleSheet(colorStyle);
}
}
}
void AddTableFileDlg::onCurveDataChanged() {
if (m_currentCurveIndex >= 0 && m_currentCurveIndex < m_curves.size()) {
QString dataText = ui->curveDataEdit->text();
QStringList dataList = dataText.split(',', Qt::SkipEmptyParts);
// Trim whitespace from each data item
for (QString& data : dataList) {
data = data.trimmed();
}
m_curves[m_currentCurveIndex].data = dataList;
// Validate data count
QStringList headers = getHeadersList();
if (!dataText.isEmpty() && !validateCurveData(dataText, headers.size())) {
ui->dataValidationLabel->setText(QString("Data count (%1) doesn't match headers count (%2)")
.arg(dataList.size()).arg(headers.size()));
ui->dataValidationLabel->setStyleSheet("color: red; font-size: 11px;");
} else {
ui->dataValidationLabel->setText(QString("Data values must match the number of headers (%1)").arg(headers.size()));
ui->dataValidationLabel->setStyleSheet("color: gray; font-size: 11px;");
}
}
}
void AddTableFileDlg::updateCurvesList() {
ui->curvesListWidget->clear();
for (const CurveData& curve : m_curves) {
ui->curvesListWidget->addItem(curve.name);
}
}
void AddTableFileDlg::updateCurveProperties() {
if (m_currentCurveIndex >= 0 && m_currentCurveIndex < m_curves.size()) {
const CurveData& curve = m_curves[m_currentCurveIndex];
// Block signals to prevent recursive updates
ui->curveNameEdit->blockSignals(true);
ui->curveDataEdit->blockSignals(true);
ui->curveNameEdit->setText(curve.name);
ui->curveDataEdit->setText(curve.data.join(", "));
// Update color preview
QString colorStyle = QString("background-color: rgb(%1, %2, %3); border: 1px solid gray;")
.arg(curve.color.red()).arg(curve.color.green()).arg(curve.color.blue());
ui->colorPreviewLabel->setStyleSheet(colorStyle);
ui->curveNameEdit->blockSignals(false);
ui->curveDataEdit->blockSignals(false);
// Update validation
QStringList headers = getHeadersList();
if (!curve.data.isEmpty() && !validateCurveData(curve.data.join(", "), headers.size())) {
ui->dataValidationLabel->setText(QString("Data count (%1) doesn't match headers count (%2)")
.arg(curve.data.size()).arg(headers.size()));
ui->dataValidationLabel->setStyleSheet("color: red; font-size: 11px;");
} else {
ui->dataValidationLabel->setText(QString("Data values must match the number of headers (%1)").arg(headers.size()));
ui->dataValidationLabel->setStyleSheet("color: gray; font-size: 11px;");
}
}
}
void AddTableFileDlg::saveCurveProperties() {
if (m_currentCurveIndex >= 0 && m_currentCurveIndex < m_curves.size()) {
// Properties are already saved in real-time through signal handlers
// This method is kept for consistency and future extensions
}
}
bool AddTableFileDlg::validateCurveData(const QString& data, int expectedCount) {
if (data.isEmpty()) {
return true; // Empty data is allowed
}
QStringList dataList = data.split(',', Qt::SkipEmptyParts);
return dataList.size() == expectedCount;
}
QStringList AddTableFileDlg::getHeadersList() const {
QString headersText = ui->headersEdit->text().trimmed();
if (headersText.isEmpty()) {
return QStringList();
}
QStringList headers = headersText.split(',', Qt::SkipEmptyParts);
for (QString& header : headers) {
header = header.trimmed();
}
return headers;
}
bool AddTableFileDlg::validateSpecificParams() {
if (ui->filePathEdit->text().isEmpty()) {
QMessageBox::warning(this, QStringLiteral("Warning"),
@ -91,6 +289,45 @@ bool AddTableFileDlg::validateSpecificParams() {
return false;
}
// Validate headers
QStringList headers = getHeadersList();
if (headers.isEmpty()) {
QMessageBox::warning(this, tr("Warning"),
tr("Please configure table headers."));
return false;
}
// Validate curves
if (m_curves.isEmpty()) {
QMessageBox::warning(this, tr("Warning"),
tr("Please add at least one curve."));
return false;
}
// Validate each curve's data
for (int i = 0; i < m_curves.size(); ++i) {
const CurveData& curve = m_curves[i];
if (curve.name.isEmpty()) {
QMessageBox::warning(this, tr("Warning"),
tr("Curve %1 name cannot be empty.").arg(i + 1));
return false;
}
if (curve.data.isEmpty()) {
QMessageBox::warning(this, tr("Warning"),
tr("Curve '%1' data cannot be empty.").arg(curve.name));
return false;
}
if (curve.data.size() != headers.size()) {
QMessageBox::warning(this, tr("Warning"),
tr("Curve '%1' data count (%2) doesn't match headers count (%3).")
.arg(curve.name).arg(curve.data.size()).arg(headers.size()));
return false;
}
}
return true;
}
@ -108,11 +345,6 @@ QString AddTableFileDlg::getSelectedFilePath() const {
void AddTableFileDlg::accept()
{
// Validate parameters
if (!validateSpecificParams()) {
return;
}
// Validate table-specific parameters
if (ui->tableNameEdit->text().isEmpty()) {
QMessageBox::warning(this, tr("Warning"), tr("Please enter a table name."));

View File

@ -1,11 +1,23 @@
#pragma once
#include <QColor>
namespace Ui {
class AddTableFileDlg;
}
#include "BaseAddFileDlg.h"
struct CurveData {
QString name;
QColor color;
QStringList data;
CurveData() : color(Qt::blue) {}
CurveData(const QString& n, const QColor& c, const QStringList& d)
: name(n), color(c), data(d) {}
};
class AddTableFileDlg : public BaseAddFileDlg {
Q_OBJECT
@ -29,10 +41,18 @@ protected:
bool validateSpecificParams() override;
private slots:
void onSelectFileClicked();
void onFilePathChanged(const QString& filePath);
void onDelimiterChanged();
void onHeaderToggled(bool hasHeader);
void onHeadersChanged();
// Curve management slots
void onAddCurveClicked();
void onRemoveCurveClicked();
void onCurveSelectionChanged();
void onCurveNameChanged();
void onCurveColorClicked();
void onCurveDataChanged();
public slots:
void accept() override;
@ -40,6 +60,13 @@ public slots:
private:
void setupConnections();
void updateFileInfo(const QString& filePath);
void updateCurvesList();
void updateCurveProperties();
void saveCurveProperties();
bool validateCurveData(const QString& data, int expectedCount);
QStringList getHeadersList() const;
Ui::AddTableFileDlg* ui;
QList<CurveData> m_curves;
int m_currentCurveIndex;
};

View File

@ -7,272 +7,411 @@
<x>0</x>
<y>0</y>
<width>676</width>
<height>683</height>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>Add Table Data File</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="mainVerticalLayout">
<item>
<widget class="QGroupBox" name="fileGroupBox">
<property name="title">
<string>File Selection</string>
<widget class="QSplitter" name="mainSplitter">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<layout class="QGridLayout" name="fileGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="filePathLabel">
<property name="text">
<string>File Path:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="filePathEdit">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>Select table data file...</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="selectFileBtn">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="fileNameLabel">
<property name="text">
<string>File Name:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLabel" name="fileNameValue">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="fileSizeLabel">
<property name="text">
<string>File Size:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLabel" name="fileSizeValue">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="basicInfoGroupBox">
<property name="title">
<string>Basic Information</string>
</property>
<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" colspan="2">
<widget class="QLineEdit" name="tableNameEdit">
<property name="placeholderText">
<string>Enter table name...</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="tableNameLabel">
<property name="text">
<string>Table Name:</string>
</property>
</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="0" column="1">
<widget class="QComboBox" name="encodingComboBox">
<item>
<property name="text">
<string>UTF-8</string>
<widget class="QWidget" name="leftWidget">
<layout class="QVBoxLayout" name="leftVerticalLayout">
<item>
<widget class="QGroupBox" name="fileGroupBox">
<property name="title">
<string>File Selection</string>
</property>
</item>
<item>
<property name="text">
<string>GBK</string>
<layout class="QGridLayout" name="fileGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="filePathLabel">
<property name="text">
<string>File Path:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="filePathEdit">
<property name="readOnly">
<bool>true</bool>
</property>
<property name="placeholderText">
<string>Select table data file...</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="selectFileBtn">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="fileNameLabel">
<property name="text">
<string>File Name:</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLabel" name="fileNameValue">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="fileSizeLabel">
<property name="text">
<string>File Size:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLabel" name="fileSizeValue">
<property name="text">
<string>-</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="basicInfoGroupBox">
<property name="title">
<string>Basic Information</string>
</property>
</item>
<item>
<property name="text">
<string>ASCII</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" colspan="2">
<widget class="QLineEdit" name="tableNameEdit">
<property name="placeholderText">
<string>Enter table name...</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="tableNameLabel">
<property name="text">
<string>Table Name:</string>
</property>
</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>
</item>
<item>
<property name="text">
<string>ISO-8859-1</string>
<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>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="skipRowsSpinBox">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="previewGroupBox">
<property name="title">
<string>Preview</string>
</property>
<layout class="QVBoxLayout" name="previewVerticalLayout">
<item>
<widget class="QTableWidget" name="previewTable">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="rowCount">
<number>5</number>
</property>
<property name="columnCount">
<number>5</number>
</property>
<row/>
<row/>
<row/>
<row/>
<row/>
<column/>
<column/>
<column/>
<column/>
<column/>
</widget>
</item>
</layout>
<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="0" column="1">
<widget class="QComboBox" name="encodingComboBox">
<item>
<property name="text">
<string>UTF-8</string>
</property>
</item>
<item>
<property name="text">
<string>GBK</string>
</property>
</item>
<item>
<property name="text">
<string>ASCII</string>
</property>
</item>
<item>
<property name="text">
<string>ISO-8859-1</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="skipRowsSpinBox">
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="rightWidget">
<layout class="QVBoxLayout" name="rightVerticalLayout">
<item>
<widget class="QGroupBox" name="curvesGroupBox">
<property name="title">
<string>Curves Configuration</string>
</property>
<layout class="QVBoxLayout" name="curvesVerticalLayout">
<item>
<layout class="QHBoxLayout" name="curveButtonsLayout">
<item>
<widget class="QPushButton" name="addCurveBtn">
<property name="text">
<string>Add Curve</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeCurveBtn">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Remove Curve</string>
</property>
</widget>
</item>
<item>
<spacer name="curveButtonsSpacer">
<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>
<widget class="QListWidget" name="curvesListWidget">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>150</height>
</size>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="curvePropertiesGroupBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="title">
<string>Curve Properties</string>
</property>
<layout class="QGridLayout" name="curvePropertiesGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="curveNameLabel">
<property name="text">
<string>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>Color:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="colorLayout">
<item>
<widget class="QPushButton" name="colorBtn">
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Select Color</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="colorPreviewLabel">
<property name="minimumSize">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 255); border: 1px solid gray;</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="curveDataLabel">
<property name="text">
<string>Data:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="curveDataEdit">
<property name="placeholderText">
<string>Enter data values (comma-separated)...</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="dataValidationLabel">
<property name="styleSheet">
<string notr="true">color: gray; font-size: 11px;</string>
</property>
<property name="text">
<string>Data values must match the number of headers</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>

View File

@ -38,7 +38,7 @@ void BaseAddFileDlg::OnSelectFile() {
QString filePath = QFileDialog::getOpenFileName(
this,
getDialogTitle(),
QString(),
workspacePath,
getFileFilter()
);

View File

@ -467,6 +467,109 @@ bool FileEntryCurve::SaveFiles(tinyxml2::XMLElement* scene, tinyxml2::XMLDocumen
return true;
}
// FileEntryLight SaveFiles implementation
bool FileEntryLight::SaveFiles(tinyxml2::XMLElement* scene, tinyxml2::XMLDocument* doc) {
if (!scene || !doc) {
LOG_ERROR("Invalid XML parameters");
return false;
}
// 创建 <chart> 元素
tinyxml2::XMLElement* chartElement = doc->NewElement("chart");
scene->InsertEndChild(chartElement);
// 设置chart属性
chartElement->SetAttribute("name", name_.toUtf8().constData());
chartElement->SetAttribute("path", fileName_.toUtf8().constData());
// 保存颜色属性
chartElement->SetAttribute("openColor", QColorToString(colorProperties_.openColor).toUtf8().constData());
chartElement->SetAttribute("closeColor", QColorToString(colorProperties_.closeColor).toUtf8().constData());
// 为每个LightRowProperty创建<light>元素
for (const auto& lightRow : lightProperties_) {
tinyxml2::XMLElement* lightElement = doc->NewElement("curve");
chartElement->InsertEndChild(lightElement);
// 保存name列表以逗号分隔
QString nameStr = lightRow.name.join(",");
lightElement->SetAttribute("name", nameStr.toUtf8().constData());
// 保存data列表以逗号分隔
QStringList dataStrList;
for (int value : lightRow.data) {
dataStrList.append(QString::number(value));
}
QString dataStr = dataStrList.join(",");
lightElement->SetAttribute("data", dataStr.toUtf8().constData());
}
return true;
}
// FileEntryLight ParseFiles implementation
bool FileEntryLight::ParseFiles(const tinyxml2::XMLElement* chartElement) {
if (!chartElement) {
LOG_ERROR("Invalid XML element");
return false;
}
// 解析chart属性
const char* nameAttr = chartElement->Attribute("name");
const char* pathAttr = chartElement->Attribute("path");
if (nameAttr) name_ = QString::fromUtf8(nameAttr);
if (pathAttr) {
QString fullPath = QString::fromUtf8(pathAttr);
QFileInfo fileInfo(fullPath);
fileName_ = fileInfo.fileName();
path_ = fileInfo.absolutePath();
}
// 解析颜色属性
const char* openColorAttr = chartElement->Attribute("openColor");
const char* closeColorAttr = chartElement->Attribute("closeColor");
if (openColorAttr) {
colorProperties_.openColor = StringToQColor(QString::fromUtf8(openColorAttr));
}
if (closeColorAttr) {
colorProperties_.closeColor = StringToQColor(QString::fromUtf8(closeColorAttr));
}
// 解析所有<light>元素
lightProperties_.clear();
for (const tinyxml2::XMLElement* lightElement = chartElement->FirstChildElement("curve");
lightElement != nullptr;
lightElement = lightElement->NextSiblingElement("curve")) {
LightRowProperty lightRow;
// 解析name属性逗号分隔的字符串列表
const char* nameAttr = lightElement->Attribute("name");
if (nameAttr) {
QString nameStr = QString::fromUtf8(nameAttr);
lightRow.name = nameStr.split(",", Qt::SkipEmptyParts);
}
// 解析data属性逗号分隔的整数列表
const char* dataAttr = lightElement->Attribute("data");
if (dataAttr) {
QString dataStr = QString::fromUtf8(dataAttr);
QStringList dataStrList = dataStr.split(",", Qt::SkipEmptyParts);
for (const QString& str : dataStrList) {
bool ok;
int value = str.trimmed().toInt(&ok);
if (ok) {
lightRow.data.append(value);
}
}
}
lightProperties_.append(lightRow);
}
return true;
}
// FileEntryCurve ParseFiles implementation
bool FileEntryCurve::ParseFiles(const tinyxml2::XMLElement* chartElement) {
if (!chartElement) {

View File

@ -264,12 +264,13 @@ public:
QColor closeColor;
};
struct LightProperty {
QString name;
int index;
struct LightRowProperty {
QStringList name;
QList<int> data;
};
using LightProperties = QList<LightProperty>;
using LightRowProperties = QList<LightRowProperty>;
public:
FileEntryLight() { type_ = FileEntryType::Light; }
@ -277,14 +278,18 @@ public:
void SetColorProperties(const ColorProperties& props) { colorProperties_ = props; }
const ColorProperties& GetColorProperties() const { return colorProperties_; }
void AddLightProperty(const LightProperty& prop) { lightProperties_.append(prop); }
void AddLightProperty(const LightRowProperty& prop) { lightProperties_.append(prop); }
void RemoveLightProperty(int index) { lightProperties_.removeAt(index); }
const LightProperties& GetLightProperties() const { return lightProperties_; }
const LightRowProperties& GetLightProperties() const { return lightProperties_; }
FileEntryLight* AsLight() override { return this; }
// XML处理方法
bool SaveFiles(tinyxml2::XMLElement* scene, tinyxml2::XMLDocument* doc) override;
bool ParseFiles(const tinyxml2::XMLElement* element) override;
private:
ColorProperties colorProperties_;
LightProperties lightProperties_;
LightRowProperties lightProperties_;
};

View File

@ -165,8 +165,7 @@ WorkSpace::FileEntryResult WorkSpace::SetFileEntry(std::shared_ptr<FileEntry> fi
}
// Update file entry with workspace-relative path
fileName = fileInfo.fileName();
fileEntry->SetFileNanme(fileInfo.fileName());
fileEntry->SetPath(targetPath);
}
else {
QString filePath = QString("%1/%2").arg(GetDir(), fileEntry->GetFileName());
@ -178,7 +177,7 @@ WorkSpace::FileEntryResult WorkSpace::SetFileEntry(std::shared_ptr<FileEntry> fi
vec.push_back(fileEntry);
++filesSeq_;
emit FilesChanged(type);
emit FilesChanged(type, fileEntry);
LOG_INFO("Successfully added file entry: {} (type: {})",
fileName.toUtf8().constData(),
FileEntryTypeToString(type));
@ -231,7 +230,7 @@ bool WorkSpace::SetFileEntryCount(FileEntryType type, int count) {
vec.resize(count);
}
++filesSeq_;
emit FilesChanged(type);
emit FilesChanged(type, nullptr); // No specific fileEntry for batch operations
return true;
}

View File

@ -149,7 +149,7 @@ Q_SIGNALS:
void EntityRemoved(class Entity* entity);
void TimestepChanged(class Timestep* timestep);
void LampStatusChanged(class LampStatus* lampStatus);
void FilesChanged(FileEntryType type);
void FilesChanged(FileEntryType type, std::shared_ptr<FileEntry> fileEntry);
protected:
const QString& GetSimMatlabName() const {