Merge branch 'new_osg' of http://brigecode.icu:16623/PM/DYTSrouce into new_osg
This commit is contained in:
commit
b79754b443
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,4 +3,5 @@ build/
|
||||
bin/
|
||||
thirdparty/
|
||||
tritoin/
|
||||
CMakeFiles/
|
||||
QWEN.md
|
||||
|
||||
@ -245,160 +245,197 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="288"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="291"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="323"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="330"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="336"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="342"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="348"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="363"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="369"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="377"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="384"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="390"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="397"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="403"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="411"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="416"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="422"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="427"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="438"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="443"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="452"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="457"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="464"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="471"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="477"/>
|
||||
<source>Validation Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="319"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="323"/>
|
||||
<source>Please select a data file.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="326"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="330"/>
|
||||
<source>Selected file does not exist.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="332"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="336"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="342"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="348"/>
|
||||
<source>At least one curve must be defined.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="360"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="364"/>
|
||||
<source>Curve %1 name cannot be empty.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="366"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="370"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="378"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="385"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="391"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="398"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="404"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="411"/>
|
||||
<source>Chart name cannot be empty.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="412"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="416"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="422"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="427"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="438"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="443"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="452"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="457"/>
|
||||
<source>Data column indices must be greater than 0.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="460"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="464"/>
|
||||
<source>Time parameter cannot be negative.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="467"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="471"/>
|
||||
<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"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="477"/>
|
||||
<source>Description is too long. Please limit to 500 characters.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="497"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="524"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="549"/>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="497"/>
|
||||
<source>Failed to create file entry</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="524"/>
|
||||
<source>Unable to get current workspace</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="534"/>
|
||||
<source>Curve file count has reached the limit (9 files)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="537"/>
|
||||
<source>File already exists</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="540"/>
|
||||
<source>File copy failed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="543"/>
|
||||
<source>Invalid file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.cpp" line="546"/>
|
||||
<source>Failed to add file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AddLightFileDlg</name>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="14"/>
|
||||
<source>Add Light Spectrum File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="20"/>
|
||||
<source>File Selection</source>
|
||||
@ -410,8 +447,13 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="33"/>
|
||||
<source>Select light spectrum file...</source>
|
||||
<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>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
@ -437,144 +479,121 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="81"/>
|
||||
<source>Spectrum Parameters</source>
|
||||
<source>Color Properties</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="87"/>
|
||||
<source>Wavelength Column:</source>
|
||||
<source>Open Color:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="107"/>
|
||||
<source>Intensity Column:</source>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="102"/>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="155"/>
|
||||
<source>Select Color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="127"/>
|
||||
<source>Separator:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="135"/>
|
||||
<source>Comma (,)</source>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="115"/>
|
||||
<source>background-color: rgb(0, 255, 0); border: 1px solid black;</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="140"/>
|
||||
<source>Tab</source>
|
||||
<source>Close Color:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="145"/>
|
||||
<source>Space</source>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="168"/>
|
||||
<source>background-color: rgb(255, 0, 0); border: 1px solid black;</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="150"/>
|
||||
<source>Semicolon (;)</source>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="196"/>
|
||||
<source>Light Management</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="158"/>
|
||||
<source>Wavelength Unit:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="166"/>
|
||||
<source>nm (nanometer)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="171"/>
|
||||
<source>μm (micrometer)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="176"/>
|
||||
<source>cm⁻¹ (wavenumber)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="181"/>
|
||||
<source>eV (electron volt)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="189"/>
|
||||
<source>Intensity Unit:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="197"/>
|
||||
<source>Arbitrary Units</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="202"/>
|
||||
<source>Counts</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="207"/>
|
||||
<source>W/m²/nm</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="212"/>
|
||||
<source>μW/cm²/nm</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="220"/>
|
||||
<source>File has header row</source>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="204"/>
|
||||
<source>Lights:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="230"/>
|
||||
<source>Normalize intensity values</source>
|
||||
<source>Add Light</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="243"/>
|
||||
<source>Wavelength Range (Optional)</source>
|
||||
<source>Remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="249"/>
|
||||
<source>Min Wavelength:</source>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="268"/>
|
||||
<source>Selected Light Properties</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="269"/>
|
||||
<source>Max Wavelength:</source>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="274"/>
|
||||
<source>Light Name:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="289"/>
|
||||
<source>Enable wavelength range filtering</source>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="281"/>
|
||||
<source>Enter light name...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="302"/>
|
||||
<source>Description (Optional)</source>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="288"/>
|
||||
<source>Light Index:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="314"/>
|
||||
<source>Enter file description...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="352"/>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="329"/>
|
||||
<source>Add File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="362"/>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="336"/>
|
||||
<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"/>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="302"/>
|
||||
<source>Unable to get current workspace</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="324"/>
|
||||
<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"/>
|
||||
<source>File already exists</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="330"/>
|
||||
<source>File copy failed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="333"/>
|
||||
<source>Invalid file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.cpp" line="336"/>
|
||||
<source>Failed to add file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AddParamSetting</name>
|
||||
@ -664,11 +683,6 @@
|
||||
</context>
|
||||
<context>
|
||||
<name>AddSurfaceFileDlg</name>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="14"/>
|
||||
<source>Add Surface Data File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="20"/>
|
||||
<source>File Selection</source>
|
||||
@ -676,113 +690,242 @@
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="26"/>
|
||||
<source>File Path:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="33"/>
|
||||
<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>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="43"/>
|
||||
<source>...</source>
|
||||
<source>Chart Properties</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="50"/>
|
||||
<source>File Name:</source>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="49"/>
|
||||
<source>X Axis Title:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="57"/>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="71"/>
|
||||
<source>-</source>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="59"/>
|
||||
<source>Y Axis Title:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="64"/>
|
||||
<source>File Size:</source>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="69"/>
|
||||
<source>Z Axis Title:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="81"/>
|
||||
<source>Surface Parameters</source>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="79"/>
|
||||
<source>Time Parameter:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="87"/>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="99"/>
|
||||
<source>X Range:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="121"/>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="185"/>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="249"/>
|
||||
<source>to</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="143"/>
|
||||
<source>X Count:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="163"/>
|
||||
<source>Y Range:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="207"/>
|
||||
<source>Y Count:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="227"/>
|
||||
<source>Z Range:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="271"/>
|
||||
<source>Z Count:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="294"/>
|
||||
<source>Surface Management</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="302"/>
|
||||
<source>Add Surface</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="319"/>
|
||||
<source>Remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="328"/>
|
||||
<source>Surface Properties</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="334"/>
|
||||
<source>Name:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="344"/>
|
||||
<source>Color:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="357"/>
|
||||
<source>Select Color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="364"/>
|
||||
<source>Start Point:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="381"/>
|
||||
<source>End Point:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="404"/>
|
||||
<source>Data Format Parameters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="410"/>
|
||||
<source>X Column:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="107"/>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="430"/>
|
||||
<source>Y Column:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="127"/>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="450"/>
|
||||
<source>Z Column:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="147"/>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="470"/>
|
||||
<source>Separator:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="155"/>
|
||||
<source>Comma (,)</source>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="477"/>
|
||||
<source>,</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="160"/>
|
||||
<source>Tab</source>
|
||||
<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="165"/>
|
||||
<source>Space</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="170"/>
|
||||
<source>Semicolon (;)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="178"/>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="484"/>
|
||||
<source>X Grid Size:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="198"/>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="504"/>
|
||||
<source>Y Grid Size:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="218"/>
|
||||
<source>File has header row</source>
|
||||
<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.ui" line="231"/>
|
||||
<source>Description (Optional)</source>
|
||||
<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.ui" line="243"/>
|
||||
<source>Enter file description...</source>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="107"/>
|
||||
<source>Surface Data Files (*.txt *.dat *.csv);;All Files (*.*)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="281"/>
|
||||
<source>Add File</source>
|
||||
<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.ui" line="291"/>
|
||||
<source>Cancel</source>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="124"/>
|
||||
<source>Please fill in all axis titles.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="153"/>
|
||||
<source>Select Surface Color</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="365"/>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="383"/>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="408"/>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="365"/>
|
||||
<source>Failed to create surface file entry.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="383"/>
|
||||
<source>Unable to get current workspace</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="393"/>
|
||||
<source>Surface file count has reached the limit (9 files)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="396"/>
|
||||
<source>File already exists</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="399"/>
|
||||
<source>File copy failed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="402"/>
|
||||
<source>Invalid file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.cpp" line="405"/>
|
||||
<source>Failed to add file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
@ -1740,30 +1883,34 @@
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="66"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="90"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="114"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="118"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="122"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="132"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="156"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="160"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="164"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="174"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="198"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="202"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="206"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="216"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="240"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="244"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="113"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="117"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="121"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="125"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="135"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="158"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="162"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="166"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="170"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="180"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="203"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="207"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="211"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="215"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="225"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="248"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="252"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="256"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="260"/>
|
||||
<source>prompt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="66"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="90"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="132"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="174"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="216"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="135"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="180"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="225"/>
|
||||
<source>please create workspace first</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1773,42 +1920,50 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="108"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="150"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="102"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="147"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="192"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="234"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="237"/>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="109"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="151"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="103"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="148"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="193"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="235"/>
|
||||
<source>Failed to set file path</source>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="238"/>
|
||||
<source>Failed to create file entry</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="115"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="157"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="199"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="241"/>
|
||||
<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"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="204"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="249"/>
|
||||
<source>up to 9 files allowed for this type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="119"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="161"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="203"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="245"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="118"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="163"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="208"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="253"/>
|
||||
<source>file already added for this type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="123"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="165"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="207"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="249"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="122"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="167"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="212"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="257"/>
|
||||
<source>copy file failed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@ -96,20 +96,19 @@ void FileManagerMenu::AddWaveFile() {
|
||||
if (dialog && dialog->exec() == QDialog::Accepted) {
|
||||
QString selectedPath = dialog->getSelectedFilePath();
|
||||
|
||||
// Create file entry
|
||||
switch (current->CreateFileEntry(FileEntryType::Curve)) {
|
||||
case WorkSpace::FileEntryResult::Ok: {
|
||||
// Get the index of the newly created file entry
|
||||
auto entries = current->GetFileEntries(FileEntryType::Curve);
|
||||
int newIndex = static_cast<int>(entries.size()) - 1;
|
||||
|
||||
// Set file path
|
||||
if (!current->SetFileEntryPath(FileEntryType::Curve, newIndex, selectedPath)) {
|
||||
QMessageBox::warning(&MainFrame::Get(), QObject::tr("Error"),
|
||||
QObject::tr("Failed to set file path"));
|
||||
}
|
||||
break;
|
||||
// Create file entry using factory function
|
||||
auto fileEntry = CreateFileEntryCurve(selectedPath);
|
||||
if (!fileEntry) {
|
||||
QMessageBox::warning(&MainFrame::Get(), QObject::tr("Error"),
|
||||
QObject::tr("Failed to create file entry"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add to workspace
|
||||
switch (current->SetFileEntry(fileEntry)) {
|
||||
case WorkSpace::FileEntryResult::Ok:
|
||||
// Success - no action needed
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("up to 9 files allowed for this type"));
|
||||
@ -122,6 +121,10 @@ void FileManagerMenu::AddWaveFile() {
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("copy file failed"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::InvalidFile:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("invalid file"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -138,20 +141,19 @@ void FileManagerMenu::AddSurfaceFile() {
|
||||
if (dialog && dialog->exec() == QDialog::Accepted) {
|
||||
QString selectedPath = dialog->getSelectedFilePath();
|
||||
|
||||
// Create file entry
|
||||
switch (current->CreateFileEntry(FileEntryType::Surface)) {
|
||||
case WorkSpace::FileEntryResult::Ok: {
|
||||
// Get the index of the newly created file entry
|
||||
auto entries = current->GetFileEntries(FileEntryType::Surface);
|
||||
int newIndex = static_cast<int>(entries.size()) - 1;
|
||||
|
||||
// Set file path
|
||||
if (!current->SetFileEntryPath(FileEntryType::Surface, newIndex, selectedPath)) {
|
||||
QMessageBox::warning(&MainFrame::Get(), QObject::tr("Error"),
|
||||
QObject::tr("Failed to set file path"));
|
||||
}
|
||||
break;
|
||||
// Create file entry using factory function
|
||||
auto fileEntry = CreateFileEntrySurface(selectedPath);
|
||||
if (!fileEntry) {
|
||||
QMessageBox::warning(&MainFrame::Get(), QObject::tr("Error"),
|
||||
QObject::tr("Failed to create file entry"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add to workspace
|
||||
switch (current->SetFileEntry(fileEntry)) {
|
||||
case WorkSpace::FileEntryResult::Ok:
|
||||
// Success - no action needed
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("up to 9 files allowed for this type"));
|
||||
@ -164,6 +166,10 @@ void FileManagerMenu::AddSurfaceFile() {
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("copy file failed"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::InvalidFile:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("invalid file"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -180,20 +186,19 @@ void FileManagerMenu::AddTableFile() {
|
||||
if (dialog && dialog->exec() == QDialog::Accepted) {
|
||||
QString selectedPath = dialog->getSelectedFilePath();
|
||||
|
||||
// Create file entry
|
||||
switch (current->CreateFileEntry(FileEntryType::Table)) {
|
||||
case WorkSpace::FileEntryResult::Ok: {
|
||||
// Get the index of the newly created file entry
|
||||
auto entries = current->GetFileEntries(FileEntryType::Table);
|
||||
int newIndex = static_cast<int>(entries.size()) - 1;
|
||||
|
||||
// Set file path
|
||||
if (!current->SetFileEntryPath(FileEntryType::Table, newIndex, selectedPath)) {
|
||||
QMessageBox::warning(&MainFrame::Get(), QObject::tr("Error"),
|
||||
QObject::tr("Failed to set file path"));
|
||||
}
|
||||
break;
|
||||
// Create file entry using factory function
|
||||
auto fileEntry = CreateFileEntryTable(selectedPath);
|
||||
if (!fileEntry) {
|
||||
QMessageBox::warning(&MainFrame::Get(), QObject::tr("Error"),
|
||||
QObject::tr("Failed to create file entry"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add to workspace
|
||||
switch (current->SetFileEntry(fileEntry)) {
|
||||
case WorkSpace::FileEntryResult::Ok:
|
||||
// Success - no action needed
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("up to 9 files allowed for this type"));
|
||||
@ -206,6 +211,10 @@ void FileManagerMenu::AddTableFile() {
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("copy file failed"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::InvalidFile:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("invalid file"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -222,20 +231,19 @@ void FileManagerMenu::AddLightFile() {
|
||||
if (dialog && dialog->exec() == QDialog::Accepted) {
|
||||
QString selectedPath = dialog->getSelectedFilePath();
|
||||
|
||||
// Create file entry
|
||||
switch (current->CreateFileEntry(FileEntryType::Light)) {
|
||||
case WorkSpace::FileEntryResult::Ok: {
|
||||
// Get the index of the newly created file entry
|
||||
auto entries = current->GetFileEntries(FileEntryType::Light);
|
||||
int newIndex = static_cast<int>(entries.size()) - 1;
|
||||
|
||||
// Set file path
|
||||
if (!current->SetFileEntryPath(FileEntryType::Light, newIndex, selectedPath)) {
|
||||
QMessageBox::warning(&MainFrame::Get(), QObject::tr("Error"),
|
||||
QObject::tr("Failed to set file path"));
|
||||
}
|
||||
break;
|
||||
// Create file entry using factory function
|
||||
auto fileEntry = CreateFileEntryLight(selectedPath);
|
||||
if (!fileEntry) {
|
||||
QMessageBox::warning(&MainFrame::Get(), QObject::tr("Error"),
|
||||
QObject::tr("Failed to create file entry"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add to workspace
|
||||
switch (current->SetFileEntry(fileEntry)) {
|
||||
case WorkSpace::FileEntryResult::Ok:
|
||||
// Success - no action needed
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("up to 9 files allowed for this type"));
|
||||
@ -248,6 +256,10 @@ void FileManagerMenu::AddLightFile() {
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("copy file failed"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::InvalidFile:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("invalid file"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ void DataPanelManager::UpdatePanelsForType(FileEntryType fileType)
|
||||
}
|
||||
|
||||
// Get files of specified type from current workspace
|
||||
std::vector<FileEntry> files = currentWorkspace_->GetFileEntries(fileType);
|
||||
std::vector<std::shared_ptr<FileEntry>> files = currentWorkspace_->GetFileEntries(fileType);
|
||||
|
||||
// Limit to maximum panels per type
|
||||
const int maxPanels = qMin(static_cast<int>(files.size()), GetMaxPanelCount());
|
||||
@ -135,8 +135,8 @@ void DataPanelManager::UpdatePanelsForType(FileEntryType fileType)
|
||||
|
||||
// Create or update panels
|
||||
for (int i = 0; i < maxPanels; ++i) {
|
||||
const FileEntry& fileEntry = files[i];
|
||||
QString filePath = currentWorkspace_->GetFileEntryAbsPath(fileEntry.type, i);
|
||||
std::shared_ptr<FileEntry> fileEntry = files[i];
|
||||
QString filePath = currentWorkspace_->GetFileEntryAbsPath(fileEntry->GetType(), i);
|
||||
QString panelKey = QString("%1_%2").arg(FileEntryTypeToString(fileType)).arg(i);
|
||||
|
||||
if (dataPanels_.contains(panelKey)) {
|
||||
|
||||
@ -192,7 +192,7 @@ const QString QWorkspaceAttribute::GetCommondFilePath() const
|
||||
return workspace_->GetCommondFilePath();
|
||||
}
|
||||
|
||||
std::vector<FileEntry> QWorkspaceAttribute::GetFileEntries(FileEntryType type) const {
|
||||
std::vector<std::shared_ptr<FileEntry>> QWorkspaceAttribute::GetFileEntries(FileEntryType type) const {
|
||||
if (nullptr == workspace_) {
|
||||
return {};
|
||||
}
|
||||
@ -210,7 +210,18 @@ void QWorkspaceAttribute::SetFileEntryPath(FileEntryType type, int index, const
|
||||
if (nullptr == workspace_) {
|
||||
return;
|
||||
}
|
||||
workspace_->SetFileEntryPath(type, index, path);
|
||||
|
||||
// Get the file entries for this type
|
||||
auto entries = workspace_->GetFileEntries(type);
|
||||
if (index < 0 || index >= static_cast<int>(entries.size())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the path of the specific entry
|
||||
entries[index]->SetPath(path);
|
||||
|
||||
// Trigger files changed signal
|
||||
workspace_->SetFileEntryCount(type, static_cast<int>(entries.size()));
|
||||
}
|
||||
|
||||
QString QWorkspaceAttribute::GetFileEntryAbsPath(FileEntryType type, int index) const {
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
const QString GetCommondFilePath() const;
|
||||
|
||||
// Grouped files API
|
||||
std::vector<FileEntry> GetFileEntries(FileEntryType type) const;
|
||||
std::vector<std::shared_ptr<FileEntry>> GetFileEntries(FileEntryType type) const;
|
||||
void SetFileEntryCount(FileEntryType type, int count);
|
||||
void SetFileEntryPath(FileEntryType type, int index, const QString& path);
|
||||
QString GetFileEntryAbsPath(FileEntryType type, int index) const;
|
||||
|
||||
@ -6,6 +6,9 @@
|
||||
#include <QColorDialog>
|
||||
#include <QListWidget>
|
||||
|
||||
#include "workspace/WorkSpace.h"
|
||||
#include "workspace/WorkSpaceManager.h"
|
||||
|
||||
#include "ui_AddCurveFileDlg.h"
|
||||
|
||||
AddCurveFileDlg::AddCurveFileDlg(QWidget* parent)
|
||||
@ -16,7 +19,6 @@ AddCurveFileDlg::AddCurveFileDlg(QWidget* parent)
|
||||
|
||||
SetupUI(ui);
|
||||
SetTitle(getDialogTitle());
|
||||
setupSpecificUI();
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
@ -24,44 +26,15 @@ AddCurveFileDlg::~AddCurveFileDlg() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::setupSpecificUI() {
|
||||
// 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);
|
||||
|
||||
// Data format connections
|
||||
connect(ui->separatorComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &AddCurveFileDlg::onDelimiterChanged);
|
||||
connect(ui->hasHeaderCheckBox, &QCheckBox::toggled, this, &AddCurveFileDlg::onHeaderToggled);
|
||||
connect(ui->selectFileBtn, &QToolButton::clicked, this, &AddCurveFileDlg::OnSelectFile);
|
||||
|
||||
// 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);
|
||||
connect(ui->curveListWidget, &QListWidget::itemClicked, this, &AddCurveFileDlg::onCurveListWidgetItemClicked);
|
||||
|
||||
// Curve properties connections
|
||||
connect(ui->colorButton, &QPushButton::clicked, this, &AddCurveFileDlg::onColorButtonClicked);
|
||||
@ -74,36 +47,29 @@ void AddCurveFileDlg::setupConnections() {
|
||||
connect(ui->cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onSelectFileClicked() {
|
||||
QString fileName = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
getDialogTitle(),
|
||||
QString(),
|
||||
getFileFilter()
|
||||
);
|
||||
|
||||
if (!fileName.isEmpty()) {
|
||||
ui->filePathEdit->setText(fileName);
|
||||
updateFileInfo(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
qint64 size = fileInfo.size();
|
||||
QString sizeText;
|
||||
if (size < 1024) {
|
||||
sizeText = QString("%1 B").arg(size);
|
||||
}
|
||||
else if (size < 1024 * 1024) {
|
||||
sizeText = QString("%1 KB").arg(size / 1024.0, 0, 'f', 1);
|
||||
}
|
||||
else {
|
||||
sizeText = QString("%1 MB").arg(size / (1024.0 * 1024.0), 0, 'f', 1);
|
||||
}
|
||||
ui->fileSizeValue->setText(sizeText);
|
||||
} else {
|
||||
ui->fileNameValue->setText("-");
|
||||
ui->fileSizeValue->setText("-");
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onFilePathChanged() {
|
||||
QString filePath = ui->filePathEdit->text();
|
||||
if (!filePath.isEmpty()) {
|
||||
updateFileInfo(filePath);
|
||||
}
|
||||
ui->filePathEdit->setText(filePath);
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onAddCurveClicked() {
|
||||
@ -113,7 +79,7 @@ void AddCurveFileDlg::onAddCurveClicked() {
|
||||
}
|
||||
|
||||
// Create new curve with default properties
|
||||
CurveProperties newCurve;
|
||||
FileEntryCurve::CurveProperty newCurve;
|
||||
newCurve.name = generateCurveName();
|
||||
newCurve.color = generateCurveColor();
|
||||
newCurve.start = 1;
|
||||
@ -121,7 +87,17 @@ void AddCurveFileDlg::onAddCurveClicked() {
|
||||
|
||||
// Add to curves list and UI
|
||||
curves_.append(newCurve);
|
||||
addCurveToList(newCurve);
|
||||
|
||||
// Add to UI list widget
|
||||
QListWidgetItem* item = new QListWidgetItem(QString("%1 [%2,%3] (%4,%5,%6)")
|
||||
.arg(newCurve.name)
|
||||
.arg(newCurve.start)
|
||||
.arg(newCurve.stop)
|
||||
.arg(newCurve.color.red())
|
||||
.arg(newCurve.color.green())
|
||||
.arg(newCurve.color.blue()));
|
||||
ui->curveListWidget->addItem(item);
|
||||
++currentCurveIndex_;
|
||||
|
||||
// Select the new curve
|
||||
ui->curveListWidget->setCurrentRow(curves_.size() - 1);
|
||||
@ -134,7 +110,7 @@ void AddCurveFileDlg::onRemoveCurveClicked() {
|
||||
}
|
||||
|
||||
// Don't allow removing the last curve
|
||||
if (curves_.size() <= 1) {
|
||||
if (curves_.size() <= 0) {
|
||||
QMessageBox::information(this, "Information", "At least one curve must remain.");
|
||||
return;
|
||||
}
|
||||
@ -157,6 +133,33 @@ void AddCurveFileDlg::onRemoveCurveClicked() {
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onCurveListWidgetItemClicked(QListWidgetItem* item) {
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取点击项的索引
|
||||
int clickedIndex = ui->curveListWidget->row(item);
|
||||
|
||||
// 如果点击的是当前选中项,可以进入编辑模式
|
||||
if (clickedIndex == currentCurveIndex_) {
|
||||
ui->curveNameEdit->setText(curves_[currentCurveIndex_].name);
|
||||
ui->dataStartSpinBox->setValue(curves_[currentCurveIndex_].start);
|
||||
ui->dataStopSpinBox->setValue(curves_[currentCurveIndex_].stop);
|
||||
updateColorPreview(curves_[currentCurveIndex_].color);
|
||||
|
||||
// 启用曲线属性编辑
|
||||
enableCurveProperties(true);
|
||||
|
||||
// 将焦点设置到曲线名称编辑框,方便用户直接编辑
|
||||
ui->curveNameEdit->setFocus();
|
||||
ui->curveNameEdit->selectAll();
|
||||
} else {
|
||||
// 如果点击的是不同的项,更新选择
|
||||
onCurveSelectionChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onCurveSelectionChanged() {
|
||||
int currentRow = ui->curveListWidget->currentRow();
|
||||
|
||||
@ -238,7 +241,7 @@ void AddCurveFileDlg::onColorButtonClicked() {
|
||||
}
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::addCurveToList(const CurveProperties& curve) {
|
||||
void AddCurveFileDlg::addCurveToList(const FileEntryCurve::CurveProperty& curve) {
|
||||
QString itemText = QString("%1 [%2,%3] (%4,%5,%6)")
|
||||
.arg(curve.name)
|
||||
.arg(curve.start)
|
||||
@ -252,7 +255,7 @@ void AddCurveFileDlg::addCurveToList(const CurveProperties& curve) {
|
||||
|
||||
void AddCurveFileDlg::updateCurveProperties() {
|
||||
if (currentCurveIndex_ >= 0 && currentCurveIndex_ < curves_.size()) {
|
||||
const CurveProperties& curve = curves_[currentCurveIndex_];
|
||||
const FileEntryCurve::CurveProperty& curve = curves_[currentCurveIndex_];
|
||||
|
||||
ui->curveNameEdit->setText(curve.name);
|
||||
ui->dataStartSpinBox->setValue(curve.start);
|
||||
@ -315,13 +318,14 @@ void AddCurveFileDlg::updateColorPreview(const QColor& color) {
|
||||
|
||||
bool AddCurveFileDlg::validateSpecificParams() {
|
||||
// File path validation
|
||||
if (ui->filePathEdit->text().isEmpty()) {
|
||||
const QString& selectFilePath = getSelectedFilePath();
|
||||
if (selectFilePath.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Please select a data file."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// File existence validation
|
||||
QFileInfo fileInfo(ui->filePathEdit->text());
|
||||
QFileInfo fileInfo(selectFilePath);
|
||||
if (!fileInfo.exists()) {
|
||||
QMessageBox::warning(this, tr("Validation Error"), tr("Selected file does not exist."));
|
||||
return false;
|
||||
@ -353,7 +357,7 @@ bool AddCurveFileDlg::validateSpecificParams() {
|
||||
// Curve name uniqueness validation
|
||||
QStringList curveNames;
|
||||
for (int i = 0; i < curves_.size(); ++i) {
|
||||
const CurveProperties& curve = curves_[i];
|
||||
const FileEntryCurve::CurveProperty& curve = curves_[i];
|
||||
|
||||
if (curve.name.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Validation Error"),
|
||||
@ -485,68 +489,67 @@ QString AddCurveFileDlg::getDialogTitle() const {
|
||||
return "Add Curve Data File";
|
||||
}
|
||||
|
||||
AddCurveFileDlg::CurveParams AddCurveFileDlg::getCurveParams() const {
|
||||
CurveParams params;
|
||||
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()) {
|
||||
// Create FileEntryCurve object using factory function
|
||||
auto fileEntryCurve = CreateFileEntryCurve(getSelectedFilePath());
|
||||
if (!fileEntryCurve) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Failed to create file entry"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Set curve properties
|
||||
fileEntryCurve->SetName(ui->chartNameEdit->text());
|
||||
|
||||
// Set chart properties
|
||||
FileEntryCurve::ChartProperties chartProps;
|
||||
chartProps.xCount = ui->xCountSpinBox->value();
|
||||
chartProps.xTitle = ui->xTitleEdit->text();
|
||||
chartProps.yTitle = ui->yTitleEdit->text();
|
||||
chartProps.xMin = ui->xMinSpinBox->value();
|
||||
chartProps.xMax = ui->xMaxSpinBox->value();
|
||||
chartProps.yMin = ui->yMinSpinBox->value();
|
||||
chartProps.yMax = ui->yMaxSpinBox->value();
|
||||
chartProps.timeParam = ui->timeParamSpinBox->value();
|
||||
fileEntryCurve->SetChartProperties(chartProps);
|
||||
|
||||
// Add curve properties
|
||||
for (const auto& curve : curves_) {
|
||||
fileEntryCurve->AddCurveProperty(curve);
|
||||
}
|
||||
|
||||
// Get current workspace
|
||||
WorkSpace* workspace = WorkSpaceManager::Get().GetCurrent();
|
||||
if (!workspace) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Unable to get current workspace"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add FileEntryCurve to workspace using new SetFileEntry method
|
||||
auto result = workspace->SetFileEntry(fileEntryCurve);
|
||||
if (result != WorkSpace::FileEntryResult::Ok) {
|
||||
QString errorMsg;
|
||||
switch (result) {
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
errorMsg = tr("Curve file count has reached the limit (9 files)");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::Duplicate:
|
||||
errorMsg = tr("File already exists");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::CopyFailed:
|
||||
errorMsg = tr("File copy failed");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::InvalidFile:
|
||||
errorMsg = tr("Invalid file");
|
||||
break;
|
||||
default:
|
||||
errorMsg = tr("Failed to add file");
|
||||
break;
|
||||
}
|
||||
QMessageBox::warning(this, tr("Error"), errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseAddFileDlg.h"
|
||||
#include "workspace/FileEntry.h"
|
||||
#include <QColor>
|
||||
#include <QList>
|
||||
#include <memory>
|
||||
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
@ -24,66 +26,20 @@ class AddCurveFileDlg : public BaseAddFileDlg {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// 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;
|
||||
int yColumn;
|
||||
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;
|
||||
QString getDialogTitle() const override;
|
||||
void setupSpecificUI() override;
|
||||
bool validateSpecificParams() override;
|
||||
void updateFileInfo(const QString& filePath) override;
|
||||
|
||||
private slots:
|
||||
void onDelimiterChanged();
|
||||
void onHeaderToggled(bool hasHeader);
|
||||
void onSelectFileClicked();
|
||||
void onFilePathChanged();
|
||||
void onColorButtonClicked();
|
||||
void onAddCurveClicked();
|
||||
void onRemoveCurveClicked();
|
||||
void onCurveListWidgetItemClicked(QListWidgetItem* item);
|
||||
void onCurveSelectionChanged();
|
||||
void onCurveNameChanged();
|
||||
void onCurveDataChanged();
|
||||
@ -91,9 +47,8 @@ private slots:
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
void updateFileInfo(const QString& filePath);
|
||||
void updateColorPreview(const QColor& color);
|
||||
void addCurveToList(const CurveProperties& curve);
|
||||
void addCurveToList(const FileEntryCurve::CurveProperty& curve);
|
||||
void updateCurveProperties();
|
||||
void saveCurveProperties();
|
||||
void clearCurveProperties();
|
||||
@ -102,7 +57,9 @@ private:
|
||||
QColor generateCurveColor() const;
|
||||
|
||||
Ui::AddCurveFileDlg* ui;
|
||||
QList<CurveProperties> curves_;
|
||||
int currentCurveIndex_;
|
||||
QColor selectedColor_;
|
||||
|
||||
FileEntryCurve::ChartProperties chartProperties_;
|
||||
FileEntryCurve::CurveProperties curves_;
|
||||
};
|
||||
@ -1,32 +1,277 @@
|
||||
#include "AddLightFileDlg.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QColorDialog>
|
||||
#include <QListWidget>
|
||||
|
||||
#include "workspace/WorkSpace.h"
|
||||
#include "workspace/WorkSpaceManager.h"
|
||||
|
||||
#include "ui_AddLightFileDlg.h"
|
||||
|
||||
AddLightFileDlg::AddLightFileDlg(QWidget* parent)
|
||||
: BaseAddFileDlg(FileEntryType::Light, parent)
|
||||
, ui(new Ui::AddLightFileDlg) {
|
||||
, ui(new Ui::AddLightFileDlg)
|
||||
, currentLightIndex_(-1)
|
||||
, openColor_(0, 255, 0) // Default to green color
|
||||
, closeColor_(255, 0, 0) { // Default to red color
|
||||
|
||||
ui->setupUi(this);
|
||||
SetupUI(ui);
|
||||
SetTitle(getDialogTitle());
|
||||
setupSpecificUI();
|
||||
setupConnections();
|
||||
|
||||
// Initialize color properties
|
||||
colorProperties_.openColor = openColor_;
|
||||
colorProperties_.closeColor = closeColor_;
|
||||
|
||||
// Update color previews
|
||||
updateOpenColorPreview(openColor_);
|
||||
updateCloseColorPreview(closeColor_);
|
||||
}
|
||||
|
||||
AddLightFileDlg::~AddLightFileDlg() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AddLightFileDlg::setupSpecificUI() {
|
||||
void AddLightFileDlg::setupConnections() {
|
||||
// File selection connections
|
||||
connect(ui->selectFileBtn, &QToolButton::clicked, this, &AddLightFileDlg::OnSelectFile);
|
||||
|
||||
// Color selection connections
|
||||
connect(ui->openColorButton, &QPushButton::clicked, this, &AddLightFileDlg::onOpenColorButtonClicked);
|
||||
connect(ui->closeColorButton, &QPushButton::clicked, this, &AddLightFileDlg::onCloseColorButtonClicked);
|
||||
|
||||
// Light management connections
|
||||
connect(ui->addLightBtn, &QPushButton::clicked, this, &AddLightFileDlg::onAddLightClicked);
|
||||
connect(ui->removeLightBtn, &QPushButton::clicked, this, &AddLightFileDlg::onRemoveLightClicked);
|
||||
connect(ui->lightListWidget, &QListWidget::currentRowChanged, this, &AddLightFileDlg::onLightSelectionChanged);
|
||||
connect(ui->lightListWidget, &QListWidget::itemClicked, this, &AddLightFileDlg::onLightListWidgetItemClicked);
|
||||
|
||||
// Light properties connections
|
||||
connect(ui->lightNameEdit, &QLineEdit::textChanged, this, &AddLightFileDlg::onLightNameChanged);
|
||||
connect(ui->lightIndexSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AddLightFileDlg::onLightIndexChanged);
|
||||
|
||||
// Dialog buttons
|
||||
connect(ui->addFileBtn, &QPushButton::clicked, this, &AddLightFileDlg::onSure);
|
||||
connect(ui->cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
void AddLightFileDlg::updateFileInfo(const QString& filePath) {
|
||||
QFileInfo fileInfo(filePath);
|
||||
if (fileInfo.exists()) {
|
||||
ui->fileNameValue->setText(fileInfo.fileName());
|
||||
qint64 size = fileInfo.size();
|
||||
QString sizeText;
|
||||
if (size < 1024) {
|
||||
sizeText = QString("%1 B").arg(size);
|
||||
}
|
||||
else if (size < 1024 * 1024) {
|
||||
sizeText = QString("%1 KB").arg(size / 1024.0, 0, 'f', 1);
|
||||
}
|
||||
else {
|
||||
sizeText = QString("%1 MB").arg(size / (1024.0 * 1024.0), 0, 'f', 1);
|
||||
}
|
||||
ui->fileSizeValue->setText(sizeText);
|
||||
} else {
|
||||
ui->fileNameValue->setText("-");
|
||||
ui->fileSizeValue->setText("-");
|
||||
}
|
||||
|
||||
ui->filePathEdit->setText(filePath);
|
||||
}
|
||||
|
||||
void AddLightFileDlg::onOpenColorButtonClicked() {
|
||||
QColor color = QColorDialog::getColor(openColor_, this, "Select Open Color");
|
||||
if (color.isValid()) {
|
||||
openColor_ = color;
|
||||
colorProperties_.openColor = color;
|
||||
updateOpenColorPreview(color);
|
||||
}
|
||||
}
|
||||
|
||||
void AddLightFileDlg::onCloseColorButtonClicked() {
|
||||
QColor color = QColorDialog::getColor(closeColor_, this, "Select Close Color");
|
||||
if (color.isValid()) {
|
||||
closeColor_ = color;
|
||||
colorProperties_.closeColor = color;
|
||||
updateCloseColorPreview(color);
|
||||
}
|
||||
}
|
||||
|
||||
void AddLightFileDlg::onAddLightClicked() {
|
||||
// Save current light properties if any light is selected
|
||||
if (currentLightIndex_ >= 0) {
|
||||
saveLightProperties();
|
||||
}
|
||||
|
||||
// Create new light with default properties
|
||||
FileEntryLight::LightProperty newLight;
|
||||
newLight.name = generateLightName();
|
||||
newLight.index = lights_.size();
|
||||
|
||||
// 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));
|
||||
ui->lightListWidget->addItem(item);
|
||||
|
||||
// Select the new item
|
||||
ui->lightListWidget->setCurrentRow(lights_.size() - 1);
|
||||
currentLightIndex_ = lights_.size() - 1;
|
||||
|
||||
// Enable properties editing
|
||||
enableLightProperties(true);
|
||||
updateLightProperties();
|
||||
}
|
||||
|
||||
void AddLightFileDlg::onRemoveLightClicked() {
|
||||
int currentRow = ui->lightListWidget->currentRow();
|
||||
if (currentRow >= 0 && currentRow < lights_.size()) {
|
||||
// Remove from data
|
||||
lights_.removeAt(currentRow);
|
||||
|
||||
// Remove from UI
|
||||
delete ui->lightListWidget->takeItem(currentRow);
|
||||
|
||||
// Update current index
|
||||
if (lights_.isEmpty()) {
|
||||
currentLightIndex_ = -1;
|
||||
enableLightProperties(false);
|
||||
clearLightProperties();
|
||||
} else {
|
||||
// Select next item or previous if at end
|
||||
int newIndex = qMin(currentRow, lights_.size() - 1);
|
||||
ui->lightListWidget->setCurrentRow(newIndex);
|
||||
currentLightIndex_ = newIndex;
|
||||
updateLightProperties();
|
||||
}
|
||||
|
||||
// Update list display with new 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddLightFileDlg::onLightListWidgetItemClicked(QListWidgetItem* item) {
|
||||
Q_UNUSED(item)
|
||||
onLightSelectionChanged();
|
||||
}
|
||||
|
||||
void AddLightFileDlg::onLightSelectionChanged() {
|
||||
int currentRow = ui->lightListWidget->currentRow();
|
||||
if (currentRow >= 0 && currentRow < lights_.size()) {
|
||||
// Save previous light properties
|
||||
if (currentLightIndex_ >= 0 && currentLightIndex_ < lights_.size()) {
|
||||
saveLightProperties();
|
||||
}
|
||||
|
||||
currentLightIndex_ = currentRow;
|
||||
enableLightProperties(true);
|
||||
updateLightProperties();
|
||||
} else {
|
||||
currentLightIndex_ = -1;
|
||||
enableLightProperties(false);
|
||||
clearLightProperties();
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddLightFileDlg::onLightIndexChanged() {
|
||||
if (currentLightIndex_ >= 0 && currentLightIndex_ < lights_.size()) {
|
||||
int newIndex = ui->lightIndexSpinBox->value();
|
||||
lights_[currentLightIndex_].index = newIndex;
|
||||
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddLightFileDlg::updateOpenColorPreview(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->openColorPreview->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
void AddLightFileDlg::updateCloseColorPreview(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->closeColorPreview->setStyleSheet(styleSheet);
|
||||
}
|
||||
|
||||
void AddLightFileDlg::addLightToList(const FileEntryLight::LightProperty& light) {
|
||||
QListWidgetItem* item = new QListWidgetItem(QString("%1 [Index: %2]")
|
||||
.arg(light.name)
|
||||
.arg(light.index));
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void AddLightFileDlg::saveLightProperties() {
|
||||
if (currentLightIndex_ >= 0 && currentLightIndex_ < lights_.size()) {
|
||||
lights_[currentLightIndex_].name = ui->lightNameEdit->text();
|
||||
lights_[currentLightIndex_].index = ui->lightIndexSpinBox->value();
|
||||
}
|
||||
}
|
||||
|
||||
void AddLightFileDlg::clearLightProperties() {
|
||||
ui->lightNameEdit->clear();
|
||||
ui->lightIndexSpinBox->setValue(0);
|
||||
}
|
||||
|
||||
void AddLightFileDlg::enableLightProperties(bool enabled) {
|
||||
ui->lightPropertiesGroupBox->setEnabled(enabled);
|
||||
}
|
||||
|
||||
QString AddLightFileDlg::generateLightName() {
|
||||
return QString("Light %1").arg(lights_.size() + 1);
|
||||
}
|
||||
|
||||
bool AddLightFileDlg::validateSpecificParams() {
|
||||
LightParams params = getLightParams();
|
||||
|
||||
if (params.delimiter.isEmpty()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("Please specify a delimiter for light data."));
|
||||
// Check if at least one light is defined
|
||||
if (lights_.isEmpty()) {
|
||||
QMessageBox::warning(this, "Validation Error", "At least one light must be defined.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -34,37 +279,69 @@ bool AddLightFileDlg::validateSpecificParams() {
|
||||
}
|
||||
|
||||
QString AddLightFileDlg::getFileFilter() const {
|
||||
return QStringLiteral("Light Spectrum Files (*.txt *.csv *.dat *.spe *.asc);;All Files (*.*)");
|
||||
return "Light Data Files (*.txt *.csv *.dat);;All Files (*.*)";
|
||||
}
|
||||
|
||||
QString AddLightFileDlg::getDialogTitle() const {
|
||||
return QStringLiteral("Add Light Spectrum File");
|
||||
return "Add Light Data File";
|
||||
}
|
||||
|
||||
void AddLightFileDlg::onDelimiterChanged() {
|
||||
// Handle delimiter change if needed
|
||||
}
|
||||
|
||||
void AddLightFileDlg::onHeaderToggled(bool hasHeader) {
|
||||
// Handle header toggle if needed
|
||||
}
|
||||
|
||||
AddLightFileDlg::LightParams AddLightFileDlg::getLightParams() const {
|
||||
LightParams params;
|
||||
params.wavelengthColumn = ui->wavelengthColumnSpinBox->value();
|
||||
params.intensityColumn = ui->intensityColumnSpinBox->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;
|
||||
void AddLightFileDlg::onSure() {
|
||||
// Save current light properties if any light is selected
|
||||
if (currentLightIndex_ >= 0) {
|
||||
saveLightProperties();
|
||||
}
|
||||
|
||||
params.hasHeader = ui->hasHeaderCheckBox->isChecked();
|
||||
params.description = ui->descriptionEdit->toPlainText().trimmed();
|
||||
return params;
|
||||
if (!validateSpecificParams()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get current workspace
|
||||
WorkSpace* workspace = WorkSpaceManager::Get().GetCurrent();
|
||||
if (!workspace) {
|
||||
QMessageBox::warning(this, tr("Error"), tr("Unable to get current workspace"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Create FileEntryLight and set properties
|
||||
auto lightEntry = CreateFileEntryLight(getSelectedFilePath());
|
||||
if (lightEntry) {
|
||||
// Set color properties
|
||||
lightEntry->SetColorProperties(colorProperties_);
|
||||
|
||||
// Add all light properties
|
||||
for (const auto& light : lights_) {
|
||||
lightEntry->AddLightProperty(light);
|
||||
}
|
||||
|
||||
// Add to workspace
|
||||
auto result = workspace->SetFileEntry(lightEntry);
|
||||
if (result != WorkSpace::FileEntryResult::Ok) {
|
||||
QString errorMsg;
|
||||
switch (result) {
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
errorMsg = tr("Curve file count has reached the limit (9 files)");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::Duplicate:
|
||||
errorMsg = tr("File already exists");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::CopyFailed:
|
||||
errorMsg = tr("File copy failed");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::InvalidFile:
|
||||
errorMsg = tr("Invalid file");
|
||||
break;
|
||||
default:
|
||||
errorMsg = tr("Failed to add file");
|
||||
break;
|
||||
}
|
||||
QMessageBox::warning(this, tr("Error"), errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
accept();
|
||||
} else {
|
||||
QMessageBox::critical(this, "Error", "Failed to create light file entry.");
|
||||
}
|
||||
}
|
||||
@ -1,39 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseAddFileDlg.h"
|
||||
#include "workspace/FileEntry.h"
|
||||
#include <QColor>
|
||||
#include <QList>
|
||||
#include <memory>
|
||||
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class QDoubleSpinBox;
|
||||
class QTextEdit;
|
||||
class QToolButton;
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class QListWidget;
|
||||
class QListWidgetItem;
|
||||
|
||||
namespace Ui {
|
||||
class AddLightFileDlg;
|
||||
}
|
||||
|
||||
#include "BaseAddFileDlg.h"
|
||||
|
||||
|
||||
class AddLightFileDlg : public BaseAddFileDlg {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
struct LightParams {
|
||||
QString delimiter;
|
||||
bool hasHeader;
|
||||
int wavelengthColumn;
|
||||
int intensityColumn;
|
||||
QString description;
|
||||
};
|
||||
|
||||
explicit AddLightFileDlg(QWidget* parent = nullptr);
|
||||
~AddLightFileDlg() override;
|
||||
|
||||
LightParams getLightParams() const;
|
||||
|
||||
protected:
|
||||
QString getFileFilter() const override;
|
||||
QString getDialogTitle() const override;
|
||||
void setupSpecificUI() override;
|
||||
bool validateSpecificParams() override;
|
||||
void updateFileInfo(const QString& filePath) override;
|
||||
|
||||
private slots:
|
||||
void onDelimiterChanged();
|
||||
void onHeaderToggled(bool hasHeader);
|
||||
void onOpenColorButtonClicked();
|
||||
void onCloseColorButtonClicked();
|
||||
void onAddLightClicked();
|
||||
void onRemoveLightClicked();
|
||||
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 updateLightProperties();
|
||||
void saveLightProperties();
|
||||
void clearLightProperties();
|
||||
void enableLightProperties(bool enabled);
|
||||
QString generateLightName();
|
||||
|
||||
Ui::AddLightFileDlg* ui;
|
||||
int currentLightIndex_;
|
||||
QColor openColor_;
|
||||
QColor closeColor_;
|
||||
|
||||
FileEntryLight::ColorProperties colorProperties_;
|
||||
FileEntryLight::LightProperties lights_;
|
||||
};
|
||||
@ -6,12 +6,12 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>480</height>
|
||||
<width>600</width>
|
||||
<height>487</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add Light Spectrum File</string>
|
||||
<string>Add Light Data File</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@ -29,12 +29,12 @@
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="filePathEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Select light spectrum file...</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Select light data file...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
@ -76,265 +76,242 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="paramsGroupBox">
|
||||
<widget class="QGroupBox" name="colorPropertiesGroupBox">
|
||||
<property name="title">
|
||||
<string>Spectrum Parameters</string>
|
||||
<string>Color Properties</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="paramsGridLayout">
|
||||
<layout class="QGridLayout" name="colorPropertiesGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="wavelengthColumnLabel">
|
||||
<widget class="QLabel" name="openColorLabel">
|
||||
<property name="text">
|
||||
<string>Wavelength Column:</string>
|
||||
<string>Open Color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="wavelengthColumnSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="openColorLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="openColorButton">
|
||||
<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="openColorPreview">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string>background-color: rgb(0, 255, 0); border: 1px solid black;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="openColorSpacer">
|
||||
<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="1" column="0">
|
||||
<widget class="QLabel" name="intensityColumnLabel">
|
||||
<widget class="QLabel" name="closeColorLabel">
|
||||
<property name="text">
|
||||
<string>Intensity Column:</string>
|
||||
<string>Close Color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="intensityColumnSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="closeColorLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="closeColorButton">
|
||||
<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="closeColorPreview">
|
||||
<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="closeColorSpacer">
|
||||
<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="separatorLabel">
|
||||
<property name="text">
|
||||
<string>Separator:</string>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="lightGroupBox">
|
||||
<property name="title">
|
||||
<string>Light Management</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="lightVerticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="lightButtonLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="lightListLabel">
|
||||
<property name="text">
|
||||
<string>Lights:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="lightButtonSpacer">
|
||||
<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="addLightBtn">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Add Light</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeLightBtn">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="lightListWidget">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>120</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="separatorComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Comma (,)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Tab</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Space</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Semicolon (;)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="wavelengthUnitLabel">
|
||||
<property name="text">
|
||||
<string>Wavelength Unit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="wavelengthUnitComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>nm (nanometer)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>μm (micrometer)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>cm⁻¹ (wavenumber)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>eV (electron volt)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="intensityUnitLabel">
|
||||
<property name="text">
|
||||
<string>Intensity Unit:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QComboBox" name="intensityUnitComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Arbitrary Units</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Counts</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>W/m²/nm</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>μW/cm²/nm</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="hasHeaderCheckBox">
|
||||
<property name="text">
|
||||
<string>File has header row</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="normalizeCheckBox">
|
||||
<property name="text">
|
||||
<string>Normalize intensity values</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="rangeGroupBox">
|
||||
<property name="title">
|
||||
<string>Wavelength Range (Optional)</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="rangeGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="minWavelengthLabel">
|
||||
<property name="text">
|
||||
<string>Min Wavelength:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="minWavelengthSpinBox">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>380.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="maxWavelengthLabel">
|
||||
<property name="text">
|
||||
<string>Max Wavelength:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="maxWavelengthSpinBox">
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10000.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>780.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="enableRangeCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable wavelength range filtering</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="descGroupBox">
|
||||
<property name="title">
|
||||
<string>Description (Optional)</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="descVerticalLayout">
|
||||
<item>
|
||||
<widget class="QTextEdit" name="descriptionEdit">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
<widget class="QGroupBox" name="lightPropertiesGroupBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter file description...</string>
|
||||
<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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<spacer name="buttonSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
@ -347,13 +324,10 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addBtn">
|
||||
<widget class="QPushButton" name="addFileBtn">
|
||||
<property name="text">
|
||||
<string>Add File</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@ -1,140 +1,414 @@
|
||||
#include "AddSurfaceFileDlg.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QFileInfo>
|
||||
#include <QFileDialog>
|
||||
#include "app/Application.h"
|
||||
#include "ui_AddSurfaceFileDlg.h"
|
||||
#include "workspace/WorkSpaceManager.h"
|
||||
#include "workspace/WorkSpace.h"
|
||||
#include "common/SpdLogger.h"
|
||||
|
||||
#include "ui_AddSurfaceFileDlg.h"
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QColorDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QListWidgetItem>
|
||||
#include <QStandardPaths>
|
||||
#include <QDir>
|
||||
|
||||
AddSurfaceFileDlg::AddSurfaceFileDlg(QWidget* parent)
|
||||
AddSurfaceFileDlg::AddSurfaceFileDlg(QWidget *parent)
|
||||
: BaseAddFileDlg(FileEntryType::Surface, parent)
|
||||
, ui_(new Ui::AddSurfaceFileDlg) {
|
||||
|
||||
ui_->setupUi(this);
|
||||
, ui(new Ui::AddSurfaceFileDlg)
|
||||
, currentSurfaceIndex_(-1)
|
||||
, selectedColor_(Qt::blue)
|
||||
{
|
||||
SetupUI(ui);
|
||||
SetTitle(getDialogTitle());
|
||||
setupSpecificUI();
|
||||
setupConnections();
|
||||
|
||||
// Initialize chart properties with default values
|
||||
chartProperties_.xCount = 100;
|
||||
chartProperties_.yCount = 100;
|
||||
chartProperties_.zCount = 100;
|
||||
chartProperties_.xMin = 0.0;
|
||||
chartProperties_.xMax = 1.0;
|
||||
chartProperties_.yMin = 0.0;
|
||||
chartProperties_.yMax = 1.0;
|
||||
chartProperties_.zMin = 0.0;
|
||||
chartProperties_.zMax = 1.0;
|
||||
chartProperties_.timeParam = 0.0;
|
||||
chartProperties_.xTitle = "X Axis";
|
||||
chartProperties_.yTitle = "Y Axis";
|
||||
chartProperties_.zTitle = "Z Axis";
|
||||
|
||||
// Set default UI values
|
||||
ui->xCountSpinBox->setValue(chartProperties_.xCount);
|
||||
ui->yCountSpinBox->setValue(chartProperties_.yCount);
|
||||
ui->zCountSpinBox->setValue(chartProperties_.zCount);
|
||||
ui->xMinSpinBox->setValue(chartProperties_.xMin);
|
||||
ui->xMaxSpinBox->setValue(chartProperties_.xMax);
|
||||
ui->yMinSpinBox->setValue(chartProperties_.yMin);
|
||||
ui->yMaxSpinBox->setValue(chartProperties_.yMax);
|
||||
ui->zMinSpinBox->setValue(chartProperties_.zMin);
|
||||
ui->zMaxSpinBox->setValue(chartProperties_.zMax);
|
||||
ui->timeParamSpinBox->setValue(chartProperties_.timeParam);
|
||||
ui->xTitleLineEdit->setText(chartProperties_.xTitle);
|
||||
ui->yTitleLineEdit->setText(chartProperties_.yTitle);
|
||||
ui->zTitleLineEdit->setText(chartProperties_.zTitle);
|
||||
|
||||
// Initialize color preview
|
||||
updateColorPreview(ui->surfaceColorButton, selectedColor_);
|
||||
|
||||
// Clear surface properties initially
|
||||
clearSurfaceProperties();
|
||||
}
|
||||
|
||||
AddSurfaceFileDlg::~AddSurfaceFileDlg() {
|
||||
delete ui_;
|
||||
AddSurfaceFileDlg::~AddSurfaceFileDlg()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::setupSpecificUI() {
|
||||
// UI is already set up in constructor
|
||||
void AddSurfaceFileDlg::setupConnections()
|
||||
{
|
||||
// File selection connections
|
||||
connect(ui->browseButton, &QPushButton::clicked, this, &AddSurfaceFileDlg::onSelectFile);
|
||||
connect(ui->filePathLineEdit, &QLineEdit::textChanged, this, &AddSurfaceFileDlg::onFilePathChanged);
|
||||
|
||||
// Surface management connections
|
||||
connect(ui->surfaceColorButton, &QPushButton::clicked, this, &AddSurfaceFileDlg::onSurfaceColorButtonClicked);
|
||||
connect(ui->addSurfaceButton, &QPushButton::clicked, this, &AddSurfaceFileDlg::onAddSurfaceClicked);
|
||||
connect(ui->removeSurfaceButton, &QPushButton::clicked, this, &AddSurfaceFileDlg::onRemoveSurfaceClicked);
|
||||
connect(ui->surfaceListWidget, &QListWidget::itemClicked, this, &AddSurfaceFileDlg::onSurfaceListItemClicked);
|
||||
connect(ui->surfaceListWidget, &QListWidget::itemSelectionChanged, this, &AddSurfaceFileDlg::onSurfaceSelectionChanged);
|
||||
|
||||
// Surface properties connections
|
||||
connect(ui->surfaceNameLineEdit, &QLineEdit::textChanged, this, &AddSurfaceFileDlg::onSurfaceNameChanged);
|
||||
connect(ui->surfaceStartSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AddSurfaceFileDlg::onSurfaceDataChanged);
|
||||
connect(ui->surfaceStopSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), this, &AddSurfaceFileDlg::onSurfaceDataChanged);
|
||||
|
||||
// Chart properties connections (save to member variables when changed)
|
||||
connect(ui->xCountSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) { chartProperties_.xCount = value; });
|
||||
connect(ui->yCountSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) { chartProperties_.yCount = value; });
|
||||
connect(ui->zCountSpinBox, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) { chartProperties_.zCount = value; });
|
||||
connect(ui->xMinSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.xMin = value; });
|
||||
connect(ui->xMaxSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.xMax = value; });
|
||||
connect(ui->yMinSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.yMin = value; });
|
||||
connect(ui->yMaxSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.yMax = value; });
|
||||
connect(ui->zMinSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.zMin = value; });
|
||||
connect(ui->zMaxSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.zMax = value; });
|
||||
connect(ui->timeParamSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged), [this](double value) { chartProperties_.timeParam = value; });
|
||||
connect(ui->xTitleLineEdit, &QLineEdit::textChanged, [this](const QString& text) { chartProperties_.xTitle = text; });
|
||||
connect(ui->yTitleLineEdit, &QLineEdit::textChanged, [this](const QString& text) { chartProperties_.yTitle = text; });
|
||||
connect(ui->zTitleLineEdit, &QLineEdit::textChanged, [this](const QString& text) { chartProperties_.zTitle = text; });
|
||||
|
||||
// Dialog button connections
|
||||
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &AddSurfaceFileDlg::accept);
|
||||
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &AddSurfaceFileDlg::reject);
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::setupConnections() {
|
||||
connect(ui_->selectFileBtn, &QToolButton::clicked, this, &AddSurfaceFileDlg::onSelectFileClicked);
|
||||
connect(ui_->filePathEdit, &QLineEdit::textChanged, this, &AddSurfaceFileDlg::onFilePathChanged);
|
||||
connect(ui_->addBtn, &QPushButton::clicked, this, [this]() { OnSure(); });
|
||||
connect(ui_->cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
|
||||
QString AddSurfaceFileDlg::getFileFilter() const
|
||||
{
|
||||
return tr("Surface Data Files (*.txt *.dat *.csv);;All Files (*.*)");
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::onSelectFileClicked() {
|
||||
const QString workspacePath = Application::GetWorkSpacePath();
|
||||
QString filePath = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
QStringLiteral("Select Surface Data File"),
|
||||
workspacePath,
|
||||
getFileFilter()
|
||||
);
|
||||
|
||||
if (filePath.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
ui_->filePathEdit->setText(filePath);
|
||||
updateFileInfo(filePath);
|
||||
|
||||
LOG_INFO("Selected surface file: {}", filePath.toStdString());
|
||||
QString AddSurfaceFileDlg::getDialogTitle() const
|
||||
{
|
||||
return tr("Select Surface Data File");
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::onFilePathChanged() {
|
||||
QString filePath = ui_->filePathEdit->text();
|
||||
if (!filePath.isEmpty()) {
|
||||
updateFileInfo(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::updateFileInfo(const QString& filePath) {
|
||||
QFileInfo fileInfo(filePath);
|
||||
ui_->fileNameValue->setText(fileInfo.fileName());
|
||||
|
||||
qint64 size = fileInfo.size();
|
||||
QString sizeText;
|
||||
if (size < 1024) {
|
||||
sizeText = QString("%1 B").arg(size);
|
||||
} else if (size < 1024 * 1024) {
|
||||
sizeText = QString("%1 KB").arg(size / 1024.0, 0, 'f', 1);
|
||||
} else {
|
||||
sizeText = QString("%1 MB").arg(size / (1024.0 * 1024.0), 0, 'f', 1);
|
||||
}
|
||||
ui_->fileSizeValue->setText(sizeText);
|
||||
}
|
||||
|
||||
bool AddSurfaceFileDlg::validateSpecificParams() {
|
||||
if (ui_->filePathEdit->text().isEmpty()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("Please select a surface data file."));
|
||||
bool AddSurfaceFileDlg::validateSpecificParams()
|
||||
{
|
||||
if (surfaces_.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("Please add at least one surface."));
|
||||
return false;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo(ui_->filePathEdit->text());
|
||||
if (!fileInfo.exists()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("The selected file does not exist."));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ui_->xColumnSpinBox->value() == ui_->yColumnSpinBox->value() ||
|
||||
ui_->xColumnSpinBox->value() == ui_->zColumnSpinBox->value() ||
|
||||
ui_->yColumnSpinBox->value() == ui_->zColumnSpinBox->value()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("X, Y, and Z columns must be different."));
|
||||
// Validate chart properties
|
||||
if (chartProperties_.xTitle.isEmpty() || chartProperties_.yTitle.isEmpty() || chartProperties_.zTitle.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Warning"), tr("Please fill in all axis titles."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString AddSurfaceFileDlg::getFileFilter() const {
|
||||
return QStringLiteral("Surface Data Files (*.txt *.csv *.dat *.xyz);;All Files (*.*)");
|
||||
void AddSurfaceFileDlg::updateFileInfo(const QString& filePath)
|
||||
{
|
||||
ui->filePathLineEdit->setText(filePath);
|
||||
}
|
||||
|
||||
QString AddSurfaceFileDlg::getDialogTitle() const {
|
||||
return QStringLiteral("Add Surface Data File");
|
||||
}
|
||||
void AddSurfaceFileDlg::onSelectFile()
|
||||
{
|
||||
QString documentsPath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
|
||||
QString fileName = QFileDialog::getOpenFileName(this, getDialogTitle(), documentsPath, getFileFilter());
|
||||
|
||||
QString AddSurfaceFileDlg::getSelectedFilePath() const {
|
||||
return ui_->filePathEdit->text();
|
||||
}
|
||||
|
||||
QString AddSurfaceFileDlg::getDescription() const {
|
||||
return ui_->descriptionEdit->toPlainText().trimmed();
|
||||
}
|
||||
|
||||
AddSurfaceFileDlg::SurfaceParams AddSurfaceFileDlg::getSurfaceParams() const {
|
||||
SurfaceParams params;
|
||||
params.xColumn = ui_->xColumnSpinBox->value();
|
||||
params.yColumn = ui_->yColumnSpinBox->value();
|
||||
params.zColumn = ui_->zColumnSpinBox->value();
|
||||
params.xGridSize = ui_->xGridSizeSpinBox->value();
|
||||
params.yGridSize = ui_->yGridSizeSpinBox->value();
|
||||
params.hasHeader = ui_->hasHeaderCheckBox->isChecked();
|
||||
params.description = ui_->descriptionEdit->toPlainText().trimmed();
|
||||
|
||||
// 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;
|
||||
if (!fileName.isEmpty()) {
|
||||
updateFileInfo(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::onFilePathChanged()
|
||||
{
|
||||
// File path changed, could update preview or validation here
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::onSurfaceColorButtonClicked()
|
||||
{
|
||||
QColor color = QColorDialog::getColor(selectedColor_, this, tr("Select Surface Color"));
|
||||
if (color.isValid()) {
|
||||
selectedColor_ = color;
|
||||
updateColorPreview(ui->surfaceColorButton, selectedColor_);
|
||||
|
||||
// Update current surface color if one is selected
|
||||
if (currentSurfaceIndex_ >= 0 && currentSurfaceIndex_ < surfaces_.size()) {
|
||||
surfaces_[currentSurfaceIndex_].color = selectedColor_;
|
||||
|
||||
// Update list item color
|
||||
QListWidgetItem* item = ui->surfaceListWidget->item(currentSurfaceIndex_);
|
||||
if (item) {
|
||||
QPixmap pixmap(16, 16);
|
||||
pixmap.fill(selectedColor_);
|
||||
item->setIcon(QIcon(pixmap));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::onAddSurfaceClicked()
|
||||
{
|
||||
FileEntrySurface::SurfaceProperty surface;
|
||||
surface.name = generateSurfaceName();
|
||||
surface.color = generateSurfaceColor();
|
||||
surface.start = 0;
|
||||
surface.stop = 1000;
|
||||
surface.x = QString::number(ui->xColumnSpinBox->value());
|
||||
surface.y = QString::number(ui->yColumnSpinBox->value());
|
||||
surface.z = QString::number(ui->zColumnSpinBox->value());
|
||||
|
||||
surfaces_.append(surface);
|
||||
addSurfaceToList(surface);
|
||||
|
||||
// Select the newly added surface
|
||||
ui->surfaceListWidget->setCurrentRow(surfaces_.size() - 1);
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::onRemoveSurfaceClicked()
|
||||
{
|
||||
int currentRow = ui->surfaceListWidget->currentRow();
|
||||
if (currentRow >= 0 && currentRow < surfaces_.size()) {
|
||||
surfaces_.removeAt(currentRow);
|
||||
delete ui->surfaceListWidget->takeItem(currentRow);
|
||||
|
||||
// Update current surface index
|
||||
if (currentRow < surfaces_.size()) {
|
||||
ui->surfaceListWidget->setCurrentRow(currentRow);
|
||||
} else if (surfaces_.size() > 0) {
|
||||
ui->surfaceListWidget->setCurrentRow(surfaces_.size() - 1);
|
||||
} else {
|
||||
currentSurfaceIndex_ = -1;
|
||||
clearSurfaceProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::onSurfaceListItemClicked(QListWidgetItem* item)
|
||||
{
|
||||
int row = ui->surfaceListWidget->row(item);
|
||||
if (row >= 0 && row < surfaces_.size()) {
|
||||
saveSurfaceProperties(); // Save current surface properties
|
||||
currentSurfaceIndex_ = row;
|
||||
updateSurfaceProperties(); // Load new surface properties
|
||||
}
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::onSurfaceSelectionChanged()
|
||||
{
|
||||
int currentRow = ui->surfaceListWidget->currentRow();
|
||||
if (currentRow >= 0 && currentRow < surfaces_.size()) {
|
||||
saveSurfaceProperties(); // Save current surface properties
|
||||
currentSurfaceIndex_ = currentRow;
|
||||
updateSurfaceProperties(); // Load new surface properties
|
||||
} else {
|
||||
currentSurfaceIndex_ = -1;
|
||||
clearSurfaceProperties();
|
||||
}
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::onSurfaceNameChanged()
|
||||
{
|
||||
if (currentSurfaceIndex_ >= 0 && currentSurfaceIndex_ < surfaces_.size()) {
|
||||
QString newName = ui->surfaceNameLineEdit->text();
|
||||
surfaces_[currentSurfaceIndex_].name = newName;
|
||||
|
||||
// Update list item text
|
||||
QListWidgetItem* item = ui->surfaceListWidget->item(currentSurfaceIndex_);
|
||||
if (item) {
|
||||
item->setText(newName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::onSurfaceDataChanged()
|
||||
{
|
||||
if (currentSurfaceIndex_ >= 0 && currentSurfaceIndex_ < surfaces_.size()) {
|
||||
surfaces_[currentSurfaceIndex_].start = ui->surfaceStartSpinBox->value();
|
||||
surfaces_[currentSurfaceIndex_].stop = ui->surfaceStopSpinBox->value();
|
||||
}
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::updateColorPreview(QPushButton* button, const QColor& color)
|
||||
{
|
||||
if (button && color.isValid()) {
|
||||
QString styleSheet = QString("QPushButton { background-color: %1; }").arg(color.name());
|
||||
button->setStyleSheet(styleSheet);
|
||||
}
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::addSurfaceToList(const FileEntrySurface::SurfaceProperty& surface)
|
||||
{
|
||||
QListWidgetItem* item = new QListWidgetItem(surface.name);
|
||||
|
||||
// Set color icon
|
||||
QPixmap pixmap(16, 16);
|
||||
pixmap.fill(surface.color);
|
||||
item->setIcon(QIcon(pixmap));
|
||||
|
||||
ui->surfaceListWidget->addItem(item);
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::updateSurfaceProperties()
|
||||
{
|
||||
if (currentSurfaceIndex_ >= 0 && currentSurfaceIndex_ < surfaces_.size()) {
|
||||
const auto& surface = surfaces_[currentSurfaceIndex_];
|
||||
|
||||
ui->surfaceNameLineEdit->setText(surface.name);
|
||||
ui->surfaceStartSpinBox->setValue(surface.start);
|
||||
ui->surfaceStopSpinBox->setValue(surface.stop);
|
||||
|
||||
selectedColor_ = surface.color;
|
||||
updateColorPreview(ui->surfaceColorButton, selectedColor_);
|
||||
|
||||
ui->surfacePropertiesGroupBox->setEnabled(true);
|
||||
} else {
|
||||
clearSurfaceProperties();
|
||||
}
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::saveSurfaceProperties()
|
||||
{
|
||||
if (currentSurfaceIndex_ >= 0 && currentSurfaceIndex_ < surfaces_.size()) {
|
||||
surfaces_[currentSurfaceIndex_].name = ui->surfaceNameLineEdit->text();
|
||||
surfaces_[currentSurfaceIndex_].start = ui->surfaceStartSpinBox->value();
|
||||
surfaces_[currentSurfaceIndex_].stop = ui->surfaceStopSpinBox->value();
|
||||
surfaces_[currentSurfaceIndex_].color = selectedColor_;
|
||||
}
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::clearSurfaceProperties()
|
||||
{
|
||||
ui->surfaceNameLineEdit->clear();
|
||||
ui->surfaceStartSpinBox->setValue(0);
|
||||
ui->surfaceStopSpinBox->setValue(1000);
|
||||
selectedColor_ = Qt::blue;
|
||||
updateColorPreview(ui->surfaceColorButton, selectedColor_);
|
||||
ui->surfacePropertiesGroupBox->setEnabled(false);
|
||||
}
|
||||
|
||||
QString AddSurfaceFileDlg::generateSurfaceName() const
|
||||
{
|
||||
return QString("Surface %1").arg(surfaces_.size() + 1);
|
||||
}
|
||||
|
||||
QColor AddSurfaceFileDlg::generateSurfaceColor() const
|
||||
{
|
||||
// Generate different colors for each surface
|
||||
static const QColor colors[] = {
|
||||
Qt::blue, Qt::red, Qt::green, Qt::magenta, Qt::cyan, Qt::yellow,
|
||||
Qt::darkBlue, Qt::darkRed, Qt::darkGreen, Qt::darkMagenta, Qt::darkCyan, Qt::darkYellow
|
||||
};
|
||||
|
||||
int colorIndex = surfaces_.size() % (sizeof(colors) / sizeof(colors[0]));
|
||||
return colors[colorIndex];
|
||||
}
|
||||
|
||||
AddSurfaceFileDlg::SurfaceParams AddSurfaceFileDlg::GetSurfaceParams() const
|
||||
{
|
||||
SurfaceParams params;
|
||||
params.xColumn = ui->xColumnSpinBox->value();
|
||||
params.yColumn = ui->yColumnSpinBox->value();
|
||||
params.zColumn = ui->zColumnSpinBox->value();
|
||||
params.separator = ui->separatorLineEdit->text();
|
||||
params.xGridSize = ui->xGridSizeSpinBox->value();
|
||||
params.yGridSize = ui->yGridSizeSpinBox->value();
|
||||
params.hasHeader = ui->hasHeaderCheckBox->isChecked();
|
||||
return params;
|
||||
}
|
||||
|
||||
QString AddSurfaceFileDlg::GetSelectedFilePath() const
|
||||
{
|
||||
return ui->filePathLineEdit->text();
|
||||
}
|
||||
|
||||
QString AddSurfaceFileDlg::GetDescription() const
|
||||
{
|
||||
return getDescription(); // 使用基类的getDescription方法
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::accept()
|
||||
{
|
||||
if (!validateSpecificParams()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Save current surface properties before creating FileEntry
|
||||
saveSurfaceProperties();
|
||||
|
||||
// Create FileEntrySurface
|
||||
auto fileEntry = std::dynamic_pointer_cast<FileEntrySurface>(CreateFileEntrySurface(GetSelectedFilePath()));
|
||||
if (!fileEntry) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Failed to create surface file entry."));
|
||||
return;
|
||||
}
|
||||
|
||||
// Set chart properties
|
||||
fileEntry->SetChartProperties(chartProperties_);
|
||||
|
||||
// Set surface properties
|
||||
for (const auto& surface : surfaces_) {
|
||||
fileEntry->AddSurfaceProperty(surface);
|
||||
}
|
||||
|
||||
// Set description
|
||||
fileEntry->SetDescription(GetDescription());
|
||||
|
||||
// Add to workspace
|
||||
WorkSpace* workspace = WorkSpaceManager::Get().GetCurrent();
|
||||
if (!workspace) {
|
||||
QMessageBox::critical(this, tr("Error"), tr("Unable to get current workspace"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Add FileEntrySurface to workspace using SetFileEntry method
|
||||
auto result = workspace->SetFileEntry(fileEntry);
|
||||
if (result != WorkSpace::FileEntryResult::Ok) {
|
||||
QString errorMsg;
|
||||
switch (result) {
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
errorMsg = tr("Surface file count has reached the limit (9 files)");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::Duplicate:
|
||||
errorMsg = tr("File already exists");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::CopyFailed:
|
||||
errorMsg = tr("File copy failed");
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::InvalidFile:
|
||||
errorMsg = tr("Invalid file");
|
||||
break;
|
||||
default:
|
||||
errorMsg = tr("Failed to add file");
|
||||
break;
|
||||
}
|
||||
QMessageBox::warning(this, tr("Error"), errorMsg);
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_INFO("Added surface file to workspace: {}", GetSelectedFilePath().toUtf8().constData());
|
||||
QDialog::accept();
|
||||
}
|
||||
@ -1,57 +1,86 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseAddFileDlg.h"
|
||||
#include "workspace/FileEntry.h"
|
||||
#include <QWidget>
|
||||
#include <QColor>
|
||||
#include <QList>
|
||||
#include <memory>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class QComboBox;
|
||||
class QCheckBox;
|
||||
class QTextEdit;
|
||||
class QToolButton;
|
||||
class QLabel;
|
||||
QT_END_NAMESPACE
|
||||
class QComboBox;
|
||||
class QPushButton;
|
||||
class QListWidget;
|
||||
class QListWidgetItem;
|
||||
class QDoubleSpinBox;
|
||||
|
||||
namespace Ui {
|
||||
class AddSurfaceFileDlg;
|
||||
class AddSurfaceFileDlg;
|
||||
}
|
||||
|
||||
class AddSurfaceFileDlg : public BaseAddFileDlg {
|
||||
class AddSurfaceFileDlg : public BaseAddFileDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
struct SurfaceParams {
|
||||
QString delimiter;
|
||||
bool hasHeader;
|
||||
int xColumn;
|
||||
int yColumn;
|
||||
int zColumn;
|
||||
QString separator;
|
||||
int xGridSize;
|
||||
int yGridSize;
|
||||
QString description;
|
||||
bool hasHeader;
|
||||
};
|
||||
|
||||
explicit AddSurfaceFileDlg(QWidget* parent = nullptr);
|
||||
~AddSurfaceFileDlg() override;
|
||||
public:
|
||||
explicit AddSurfaceFileDlg(QWidget *parent = nullptr);
|
||||
~AddSurfaceFileDlg();
|
||||
|
||||
SurfaceParams getSurfaceParams() const;
|
||||
QString getSelectedFilePath() const;
|
||||
QString getDescription() const;
|
||||
|
||||
protected:
|
||||
// BaseAddFileDlg interface
|
||||
QString getFileFilter() const override;
|
||||
QString getDialogTitle() const override;
|
||||
void setupSpecificUI() override;
|
||||
bool validateSpecificParams() override;
|
||||
void updateFileInfo(const QString& filePath) override;
|
||||
|
||||
// Get surface parameters
|
||||
SurfaceParams GetSurfaceParams() const;
|
||||
QString GetSelectedFilePath() const;
|
||||
QString GetDescription() const;
|
||||
|
||||
private slots:
|
||||
void onSelectFileClicked();
|
||||
void onSelectFile();
|
||||
void onFilePathChanged();
|
||||
|
||||
// Surface management slots
|
||||
void onSurfaceColorButtonClicked();
|
||||
void onAddSurfaceClicked();
|
||||
void onRemoveSurfaceClicked();
|
||||
void onSurfaceListItemClicked(QListWidgetItem* item);
|
||||
void onSurfaceSelectionChanged();
|
||||
void onSurfaceNameChanged();
|
||||
void onSurfaceDataChanged();
|
||||
|
||||
public slots:
|
||||
void accept() override;
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
void updateFileInfo(const QString& filePath);
|
||||
void updateColorPreview(QPushButton* button, const QColor& color);
|
||||
void addSurfaceToList(const FileEntrySurface::SurfaceProperty& surface);
|
||||
void updateSurfaceProperties();
|
||||
void saveSurfaceProperties();
|
||||
void clearSurfaceProperties();
|
||||
QString generateSurfaceName() const;
|
||||
QColor generateSurfaceColor() const;
|
||||
|
||||
private:
|
||||
Ui::AddSurfaceFileDlg* ui_;
|
||||
Ui::AddSurfaceFileDlg *ui;
|
||||
int currentSurfaceIndex_;
|
||||
QColor selectedColor_;
|
||||
FileEntrySurface::ChartProperties chartProperties_;
|
||||
FileEntrySurface::SurfaceProperties surfaces_;
|
||||
};
|
||||
@ -6,12 +6,12 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>520</height>
|
||||
<width>800</width>
|
||||
<height>726</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add Surface Data File</string>
|
||||
<string>Add Surface File</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@ -19,56 +19,18 @@
|
||||
<property name="title">
|
||||
<string>File Selection</string>
|
||||
</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">
|
||||
<layout class="QHBoxLayout" name="fileLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="filePathLineEdit">
|
||||
<property name="placeholderText">
|
||||
<string>Select surface data file...</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="selectFileBtn">
|
||||
<item>
|
||||
<widget class="QPushButton" name="browseButton">
|
||||
<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>
|
||||
<string>Browse...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -76,11 +38,372 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="paramsGroupBox">
|
||||
<widget class="QGroupBox" name="chartPropertiesGroupBox">
|
||||
<property name="title">
|
||||
<string>Surface Parameters</string>
|
||||
<string>Chart Properties</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="paramsGridLayout">
|
||||
<layout class="QGridLayout" name="chartPropertiesLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="xTitleLabel">
|
||||
<property name="text">
|
||||
<string>X Axis Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="xTitleLineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="yTitleLabel">
|
||||
<property name="text">
|
||||
<string>Y Axis Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="yTitleLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="zTitleLabel">
|
||||
<property name="text">
|
||||
<string>Z Axis Title:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="zTitleLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="timeParamLabel">
|
||||
<property name="text">
|
||||
<string>Time Parameter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QDoubleSpinBox" name="timeParamSpinBox">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="xRangeLabel">
|
||||
<property name="text">
|
||||
<string>X Range:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="xRangeLayout">
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="xMinSpinBox">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="xToLabel">
|
||||
<property name="text">
|
||||
<string>to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="xMaxSpinBox">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="xCountLabel">
|
||||
<property name="text">
|
||||
<string>X Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QSpinBox" name="xCountSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="yRangeLabel">
|
||||
<property name="text">
|
||||
<string>Y Range:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="yRangeLayout">
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="yMinSpinBox">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="yToLabel">
|
||||
<property name="text">
|
||||
<string>to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="yMaxSpinBox">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="yCountLabel">
|
||||
<property name="text">
|
||||
<string>Y Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3">
|
||||
<widget class="QSpinBox" name="yCountSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="zRangeLabel">
|
||||
<property name="text">
|
||||
<string>Z Range:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="zRangeLayout">
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="zMinSpinBox">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="zToLabel">
|
||||
<property name="text">
|
||||
<string>to</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="zMaxSpinBox">
|
||||
<property name="decimals">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QLabel" name="zCountLabel">
|
||||
<property name="text">
|
||||
<string>Z Count:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="3">
|
||||
<widget class="QSpinBox" name="zCountSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>100</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="surfaceManagementGroupBox">
|
||||
<property name="title">
|
||||
<string>Surface Management</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="surfaceManagementLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="surfaceListLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="addSurfaceButton">
|
||||
<property name="text">
|
||||
<string>Add Surface</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="surfaceListWidget">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>150</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeSurfaceButton">
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="surfacePropertiesGroupBox">
|
||||
<property name="title">
|
||||
<string>Surface Properties</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="surfacePropertiesLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="surfaceNameLabel">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="surfaceNameLineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="surfaceColorLabel">
|
||||
<property name="text">
|
||||
<string>Color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="surfaceColorButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select Color</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="surfaceStartLabel">
|
||||
<property name="text">
|
||||
<string>Start Point:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="surfaceStartSpinBox">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="surfaceStopLabel">
|
||||
<property name="text">
|
||||
<string>End Point:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QSpinBox" name="surfaceStopSpinBox">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>999999</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="dataFormatGroupBox">
|
||||
<property name="title">
|
||||
<string>Data Format Parameters</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="dataFormatLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="xColumnLabel">
|
||||
<property name="text">
|
||||
@ -94,92 +417,75 @@
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="yColumnLabel">
|
||||
<property name="text">
|
||||
<string>Y Column:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="0" column="3">
|
||||
<widget class="QSpinBox" name="yColumnSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="zColumnLabel">
|
||||
<property name="text">
|
||||
<string>Z Column:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="zColumnSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="separatorLabel">
|
||||
<property name="text">
|
||||
<string>Separator:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="separatorComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Comma (,)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Tab</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Space</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Semicolon (;)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="separatorLineEdit">
|
||||
<property name="text">
|
||||
<string>,</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="xGridSizeLabel">
|
||||
<property name="text">
|
||||
<string>X Grid Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="xGridSizeSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
@ -192,14 +498,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="yGridSizeLabel">
|
||||
<property name="text">
|
||||
<string>Y Grid Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="2" column="3">
|
||||
<widget class="QSpinBox" name="yGridSizeSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
@ -212,13 +518,10 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="hasHeaderCheckBox">
|
||||
<property name="text">
|
||||
<string>File has header row</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
<string>Has Header Row</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -226,76 +529,50 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="descGroupBox">
|
||||
<property name="title">
|
||||
<string>Description (Optional)</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="descVerticalLayout">
|
||||
<item>
|
||||
<widget class="QTextEdit" name="descriptionEdit">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter file description...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<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="addBtn">
|
||||
<property name="text">
|
||||
<string>Add File</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="cancelBtn">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AddSurfaceFileDlg</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AddSurfaceFileDlg</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
@ -16,7 +16,6 @@ AddTableFileDlg::AddTableFileDlg(QWidget* parent)
|
||||
|
||||
ui->setupUi(this);
|
||||
SetTitle(getDialogTitle());
|
||||
setupSpecificUI();
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
@ -24,10 +23,6 @@ AddTableFileDlg::~AddTableFileDlg() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AddTableFileDlg::setupSpecificUI() {
|
||||
// UI is already set up in constructor
|
||||
}
|
||||
|
||||
void AddTableFileDlg::setupConnections() {
|
||||
// Connect file selection
|
||||
connect(ui->selectFileBtn, &QToolButton::clicked, this, &AddTableFileDlg::onSelectFileClicked);
|
||||
|
||||
@ -28,7 +28,6 @@ public:
|
||||
protected:
|
||||
QString getFileFilter() const override;
|
||||
QString getDialogTitle() const override;
|
||||
void setupSpecificUI() override;
|
||||
bool validateSpecificParams() override;
|
||||
|
||||
private slots:
|
||||
|
||||
@ -18,15 +18,8 @@
|
||||
|
||||
BaseAddFileDlg::BaseAddFileDlg(FileEntryType fileType, QWidget* parent)
|
||||
: Dialog(parent)
|
||||
, fileType_(fileType)
|
||||
, leFilePath_(nullptr)
|
||||
, tbSelectFile_(nullptr)
|
||||
, lblFileName_(nullptr)
|
||||
, lblFileSize_(nullptr)
|
||||
, teDescription_(nullptr) {
|
||||
, fileType_(fileType) {
|
||||
|
||||
//setupBaseUI();
|
||||
initBaseConnect();
|
||||
}
|
||||
|
||||
BaseAddFileDlg::~BaseAddFileDlg() {
|
||||
@ -40,67 +33,12 @@ QString BaseAddFileDlg::getSelectedFilePath() const {
|
||||
return selectedFilePath_;
|
||||
}
|
||||
|
||||
QString BaseAddFileDlg::getDescription() const {
|
||||
return teDescription_->toPlainText().trimmed();
|
||||
}
|
||||
|
||||
void BaseAddFileDlg::setupBaseUI() {
|
||||
setFixedSize(500, 400);
|
||||
|
||||
QVBoxLayout* mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->setContentsMargins(20, 20, 20, 20);
|
||||
mainLayout->setSpacing(15);
|
||||
|
||||
QGroupBox* fileGroup = new QGroupBox(QStringLiteral("File Selection"), this);
|
||||
QGridLayout* fileLayout = new QGridLayout(fileGroup);
|
||||
|
||||
QLabel* pathLabel = new QLabel(QStringLiteral("File Path:"), this);
|
||||
leFilePath_ = new QLineEdit(this);
|
||||
leFilePath_->setReadOnly(true);
|
||||
tbSelectFile_ = new QToolButton(this);
|
||||
tbSelectFile_->setText(QStringLiteral("..."));
|
||||
tbSelectFile_->setFixedSize(30, 25);
|
||||
|
||||
fileLayout->addWidget(pathLabel, 0, 0);
|
||||
fileLayout->addWidget(leFilePath_, 0, 1);
|
||||
fileLayout->addWidget(tbSelectFile_, 0, 2);
|
||||
|
||||
mainLayout->addWidget(fileGroup);
|
||||
|
||||
QGroupBox* infoGroup = new QGroupBox(QStringLiteral("File Information"), this);
|
||||
QGridLayout* infoLayout = new QGridLayout(infoGroup);
|
||||
|
||||
QLabel* nameLabel = new QLabel(QStringLiteral("File Name:"), this);
|
||||
lblFileName_ = new QLabel(QStringLiteral("No file selected"), this);
|
||||
QLabel* sizeLabel = new QLabel(QStringLiteral("File Size:"), this);
|
||||
lblFileSize_ = new QLabel(QStringLiteral("0 bytes"), this);
|
||||
|
||||
infoLayout->addWidget(nameLabel, 0, 0);
|
||||
infoLayout->addWidget(lblFileName_, 0, 1);
|
||||
infoLayout->addWidget(sizeLabel, 1, 0);
|
||||
infoLayout->addWidget(lblFileSize_, 1, 1);
|
||||
|
||||
mainLayout->addWidget(infoGroup);
|
||||
|
||||
QGroupBox* descGroup = new QGroupBox(QStringLiteral("Description"), this);
|
||||
QVBoxLayout* descLayout = new QVBoxLayout(descGroup);
|
||||
teDescription_ = new QTextEdit(this);
|
||||
teDescription_->setMaximumHeight(80);
|
||||
descLayout->addWidget(teDescription_);
|
||||
mainLayout->addWidget(descGroup);
|
||||
|
||||
}
|
||||
|
||||
void BaseAddFileDlg::initBaseConnect() {
|
||||
connect(tbSelectFile_, &QToolButton::clicked, this, &BaseAddFileDlg::OnSelectFile);
|
||||
}
|
||||
|
||||
void BaseAddFileDlg::OnSelectFile() {
|
||||
const QString workspacePath = Application::GetWorkSpacePath();
|
||||
QString filePath = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
QStringLiteral("Select File"),
|
||||
workspacePath,
|
||||
getDialogTitle(),
|
||||
QString(),
|
||||
getFileFilter()
|
||||
);
|
||||
|
||||
@ -109,7 +47,6 @@ void BaseAddFileDlg::OnSelectFile() {
|
||||
}
|
||||
|
||||
selectedFilePath_ = filePath;
|
||||
leFilePath_->setText(filePath);
|
||||
updateFileInfo(filePath);
|
||||
|
||||
LOG_INFO("Selected file: {}", filePath.toStdString());
|
||||
@ -123,22 +60,6 @@ void BaseAddFileDlg::OnSure() {
|
||||
accept();
|
||||
}
|
||||
|
||||
void BaseAddFileDlg::updateFileInfo(const QString& filePath) {
|
||||
QFileInfo fileInfo(filePath);
|
||||
lblFileName_->setText(fileInfo.fileName());
|
||||
|
||||
qint64 size = fileInfo.size();
|
||||
QString sizeText;
|
||||
if (size < 1024) {
|
||||
sizeText = QString("%1 B").arg(size);
|
||||
} else if (size < 1024 * 1024) {
|
||||
sizeText = QString("%1 KB").arg(size / 1024.0, 0, 'f', 1);
|
||||
} else {
|
||||
sizeText = QString("%1 MB").arg(size / (1024.0 * 1024.0), 0, 'f', 1);
|
||||
}
|
||||
lblFileSize_->setText(sizeText);
|
||||
}
|
||||
|
||||
bool BaseAddFileDlg::validateBaseInput() {
|
||||
if (selectedFilePath_.isEmpty()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
|
||||
@ -7,11 +7,6 @@
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
class QLineEdit;
|
||||
class QLabel;
|
||||
class QTextEdit;
|
||||
class QToolButton;
|
||||
|
||||
class BaseAddFileDlg : public Dialog {
|
||||
Q_OBJECT
|
||||
|
||||
@ -21,7 +16,7 @@ public:
|
||||
|
||||
FileEntryType getSelectedFileType() const;
|
||||
QString getSelectedFilePath() const;
|
||||
QString getDescription() const;
|
||||
QString getDescription() const { return description_; }
|
||||
|
||||
virtual bool validateSpecificParams() = 0;
|
||||
virtual QString getFileFilter() const = 0;
|
||||
@ -32,21 +27,15 @@ protected slots:
|
||||
void OnSure();
|
||||
|
||||
protected:
|
||||
QLineEdit* leFilePath_;
|
||||
QToolButton* tbSelectFile_;
|
||||
QLabel* lblFileName_;
|
||||
QLabel* lblFileSize_;
|
||||
QTextEdit* teDescription_;
|
||||
|
||||
void setupBaseUI();
|
||||
void initBaseConnect();
|
||||
void updateFileInfo(const QString& filePath);
|
||||
bool validateBaseInput();
|
||||
void SetTitle(const QString& title);
|
||||
|
||||
virtual void setupSpecificUI() = 0;
|
||||
virtual void updateFileInfo(const QString& filePath) = 0;
|
||||
|
||||
protected:
|
||||
QString selectedFilePath_;
|
||||
QString description_;
|
||||
|
||||
private:
|
||||
FileEntryType fileType_;
|
||||
QString selectedFilePath_;
|
||||
};
|
||||
126
src/workspace/FileEntry.cpp
Normal file
126
src/workspace/FileEntry.cpp
Normal file
@ -0,0 +1,126 @@
|
||||
#include "workspace/FileEntry.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "common/SpdLogger.h"
|
||||
|
||||
void FileEntry::SetPath(const QString& path) {
|
||||
QFileInfo fileInfo(path);
|
||||
if (!fileInfo.exists()) {
|
||||
LOG_WARN("file not exist: {}", path.toLocal8Bit().constData());
|
||||
return;
|
||||
}
|
||||
path_ = fileInfo.path();
|
||||
fileName_ = fileInfo.fileName();
|
||||
}
|
||||
|
||||
// Factory function implementations
|
||||
std::shared_ptr<FileEntry> CreateFileEntry(FileEntryType type, const QString& filePath) {
|
||||
switch (type) {
|
||||
case FileEntryType::Curve:
|
||||
return CreateFileEntryCurve(filePath);
|
||||
case FileEntryType::Surface:
|
||||
return CreateFileEntrySurface(filePath);
|
||||
case FileEntryType::Table:
|
||||
return CreateFileEntryTable(filePath);
|
||||
case FileEntryType::Light:
|
||||
return CreateFileEntryLight(filePath);
|
||||
default:
|
||||
LOG_ERROR("Unknown FileEntryType: {}", static_cast<int>(type));
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<FileEntryCurve> CreateFileEntryCurve(const QString& filePath) {
|
||||
QFileInfo fileInfo(filePath);
|
||||
if (!fileInfo.exists()) {
|
||||
LOG_ERROR("File does not exist: {}", filePath.toUtf8().constData());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto fileEntry = std::make_shared<FileEntryCurve>();
|
||||
fileEntry->SetPath(filePath);
|
||||
fileEntry->SetName(fileInfo.baseName()); // Use base name as default display name
|
||||
|
||||
return fileEntry;
|
||||
}
|
||||
|
||||
std::shared_ptr<FileEntry> CreateFileEntrySurface(const QString& filePath) {
|
||||
QFileInfo fileInfo(filePath);
|
||||
if (!fileInfo.exists()) {
|
||||
LOG_ERROR("File does not exist: {}", filePath.toUtf8().constData());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto fileEntry = std::make_shared<FileEntrySurface>();
|
||||
fileEntry->SetPath(filePath);
|
||||
fileEntry->SetName(fileInfo.baseName()); // Use base name as default display name
|
||||
|
||||
return fileEntry;
|
||||
}
|
||||
|
||||
std::shared_ptr<FileEntry> CreateFileEntryTable(const QString& filePath) {
|
||||
auto fileEntry = std::make_shared<FileEntry>();
|
||||
fileEntry->SetType(FileEntryType::Table);
|
||||
|
||||
if (!filePath.isEmpty()) {
|
||||
fileEntry->SetPath(filePath);
|
||||
}
|
||||
|
||||
return fileEntry;
|
||||
}
|
||||
|
||||
std::shared_ptr<FileEntryLight> CreateFileEntryLight(const QString& filePath) {
|
||||
QFileInfo fileInfo(filePath);
|
||||
if (!fileInfo.exists()) {
|
||||
LOG_ERROR("File does not exist: {}", filePath.toUtf8().constData());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto fileEntry = std::make_shared<FileEntryLight>();
|
||||
fileEntry->SetPath(filePath);
|
||||
fileEntry->SetName(fileInfo.baseName()); // Use base name as default display name
|
||||
|
||||
return fileEntry;
|
||||
}
|
||||
|
||||
// FileEntrySurface method implementations
|
||||
void FileEntrySurface::SetChartProperties(const ChartProperties& properties) {
|
||||
chartProperties_ = properties;
|
||||
}
|
||||
|
||||
const FileEntrySurface::ChartProperties& FileEntrySurface::GetChartProperties() const {
|
||||
return chartProperties_;
|
||||
}
|
||||
|
||||
void FileEntrySurface::AddSurfaceProperty(const SurfaceProperty& surface) {
|
||||
surfaceProperties_.append(surface);
|
||||
}
|
||||
|
||||
void FileEntrySurface::RemoveSurfaceProperty(int index) {
|
||||
if (index >= 0 && index < surfaceProperties_.size()) {
|
||||
surfaceProperties_.removeAt(index);
|
||||
}
|
||||
}
|
||||
|
||||
void FileEntrySurface::SetSurfaceProperty(int index, const SurfaceProperty& surface) {
|
||||
if (index >= 0 && index < surfaceProperties_.size()) {
|
||||
surfaceProperties_[index] = surface;
|
||||
}
|
||||
}
|
||||
|
||||
const FileEntrySurface::SurfaceProperties& FileEntrySurface::GetSurfaceProperties() const {
|
||||
return surfaceProperties_;
|
||||
}
|
||||
|
||||
FileEntrySurface* FileEntrySurface::AsSurface() {
|
||||
return this;
|
||||
}
|
||||
|
||||
void FileEntrySurface::SetDescription(const QString& description) {
|
||||
description_ = description;
|
||||
}
|
||||
|
||||
const QString& FileEntrySurface::GetDescription() const {
|
||||
return description_;
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
|
||||
enum class FileEntryType {
|
||||
Curve,
|
||||
@ -9,11 +10,6 @@ enum class FileEntryType {
|
||||
Light
|
||||
};
|
||||
|
||||
struct FileEntry {
|
||||
FileEntryType type;
|
||||
QString fileName; // relative file name under workspace dir; may be empty
|
||||
};
|
||||
|
||||
inline const char* FileEntryTypeToString(FileEntryType t) {
|
||||
switch (t) {
|
||||
case FileEntryType::Curve: return "curve";
|
||||
@ -32,3 +28,169 @@ inline bool FileEntryTypeFromString(const char* s, FileEntryType& out) {
|
||||
if (0 == strcmp(s, "light")) { out = FileEntryType::Light; return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
class FileEntryCurve;
|
||||
class FileEntryLight;
|
||||
class FileEntrySurface;
|
||||
|
||||
class FileEntry {
|
||||
public:
|
||||
virtual ~FileEntry() = default;
|
||||
|
||||
FileEntryType GetType() const { return type_; }
|
||||
void SetType(FileEntryType type) { type_ = type; }
|
||||
|
||||
void SetPath(const QString& path);
|
||||
QString GetPath() const { return path_; }
|
||||
|
||||
void SetFileNanme(const QString& fileNmae) { fileName_ = fileNmae; }
|
||||
const QString& GetFileName() const { return fileName_; }
|
||||
|
||||
void SetName(const QString& name) { name_ = name; }
|
||||
QString GetName() const { return name_; }
|
||||
|
||||
virtual FileEntryCurve* AsCurve() { return nullptr; }
|
||||
virtual FileEntryLight* AsLight() { return nullptr; }
|
||||
virtual FileEntrySurface* AsSurface() { return nullptr; }
|
||||
|
||||
protected:
|
||||
FileEntryType type_;
|
||||
QString path_;
|
||||
QString fileName_;
|
||||
QString name_;
|
||||
};
|
||||
|
||||
// Factory functions for creating FileEntry objects
|
||||
std::shared_ptr<FileEntry> CreateFileEntry(FileEntryType type, const QString& filePath);
|
||||
std::shared_ptr<FileEntryCurve> CreateFileEntryCurve(const QString& filePath);
|
||||
std::shared_ptr<FileEntry> CreateFileEntrySurface(const QString& filePath);
|
||||
std::shared_ptr<FileEntry> CreateFileEntryTable(const QString& filePath);
|
||||
std::shared_ptr<FileEntryLight> CreateFileEntryLight(const QString& filePath);
|
||||
|
||||
|
||||
class FileEntryCurve : public FileEntry {
|
||||
public:
|
||||
struct ChartProperties {
|
||||
int xCount;
|
||||
QString xTitle;
|
||||
QString yTitle;
|
||||
double xMin;
|
||||
double xMax;
|
||||
double yMin;
|
||||
double yMax;
|
||||
double timeParam;
|
||||
};
|
||||
|
||||
struct CurveProperty {
|
||||
QString name;
|
||||
QColor color;
|
||||
int start;
|
||||
int stop;
|
||||
};
|
||||
|
||||
using CurveProperties = QList<CurveProperty>;
|
||||
|
||||
public:
|
||||
FileEntryCurve() { type_ = FileEntryType::Curve; }
|
||||
|
||||
void SetChartProperties(const ChartProperties& props) { chartProperties_ = props; }
|
||||
const ChartProperties& GetChartProperties() const { return chartProperties_; }
|
||||
|
||||
void AddCurveProperty(const CurveProperty& prop) { curveProperties_.append(prop); }
|
||||
void RemoveCurveProperty(int index) { curveProperties_.removeAt(index); }
|
||||
const CurveProperties& GetCurveProperties() const { return curveProperties_; }
|
||||
|
||||
FileEntryCurve* AsCurve() override { return this; }
|
||||
|
||||
private:
|
||||
ChartProperties chartProperties_;
|
||||
CurveProperties curveProperties_;
|
||||
};
|
||||
|
||||
class FileEntrySurface : public FileEntry {
|
||||
public:
|
||||
struct ChartProperties {
|
||||
int xCount;
|
||||
int yCount; // Added missing yCount
|
||||
int zCount; // Added missing zCount
|
||||
QString xTitle;
|
||||
QString yTitle;
|
||||
QString zTitle;
|
||||
double xMin;
|
||||
double xMax;
|
||||
double yMin;
|
||||
double yMax;
|
||||
double zMin;
|
||||
double zMax;
|
||||
double timeParam;
|
||||
};
|
||||
|
||||
struct SurfaceProperty {
|
||||
QString name;
|
||||
QColor color;
|
||||
int start;
|
||||
int stop;
|
||||
QString x;
|
||||
QString y;
|
||||
QString z;
|
||||
};
|
||||
|
||||
using SurfaceProperties = QList<SurfaceProperty>;
|
||||
|
||||
public:
|
||||
FileEntrySurface() { type_ = FileEntryType::Surface; }
|
||||
|
||||
// Chart properties management
|
||||
void SetChartProperties(const ChartProperties& properties);
|
||||
const ChartProperties& GetChartProperties() const;
|
||||
|
||||
// Surface properties management
|
||||
void AddSurfaceProperty(const SurfaceProperty& surface);
|
||||
void RemoveSurfaceProperty(int index);
|
||||
void SetSurfaceProperty(int index, const SurfaceProperty& surface);
|
||||
const SurfaceProperties& GetSurfaceProperties() const;
|
||||
|
||||
// Type conversion
|
||||
FileEntrySurface* AsSurface() override;
|
||||
|
||||
// Description management
|
||||
void SetDescription(const QString& description);
|
||||
const QString& GetDescription() const;
|
||||
|
||||
private:
|
||||
ChartProperties chartProperties_;
|
||||
SurfaceProperties surfaceProperties_;
|
||||
QString description_;
|
||||
};
|
||||
|
||||
class FileEntryLight : public FileEntry {
|
||||
public:
|
||||
struct ColorProperties {
|
||||
QColor openColor;
|
||||
QColor closeColor;
|
||||
};
|
||||
|
||||
struct LightProperty {
|
||||
QString name;
|
||||
int index;
|
||||
};
|
||||
|
||||
using LightProperties = QList<LightProperty>;
|
||||
|
||||
public:
|
||||
FileEntryLight() { type_ = FileEntryType::Light; }
|
||||
|
||||
void SetColorProperties(const ColorProperties& props) { colorProperties_ = props; }
|
||||
const ColorProperties& GetColorProperties() const { return colorProperties_; }
|
||||
|
||||
void AddLightProperty(const LightProperty& prop) { lightProperties_.append(prop); }
|
||||
void RemoveLightProperty(int index) { lightProperties_.removeAt(index); }
|
||||
const LightProperties& GetLightProperties() const { return lightProperties_; }
|
||||
|
||||
FileEntryLight* AsLight() override { return this; }
|
||||
|
||||
private:
|
||||
ColorProperties colorProperties_;
|
||||
LightProperties lightProperties_;
|
||||
};
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#include "workspace/WorkSpaceXMLParse.h"
|
||||
#include "workspace/WorkSpaceXMLWrite.h"
|
||||
#include "workspace/CommandManager.h"
|
||||
#include "workspace/FileEntry.h"
|
||||
|
||||
#include "workspace/WorkSpaceItem.h"
|
||||
#include "workspace/Timestep.h"
|
||||
@ -118,7 +119,64 @@ void WorkSpace::SetRDPath(const QString& path)
|
||||
rdFile_ = fileInfo.fileName();
|
||||
}
|
||||
|
||||
std::vector<FileEntry> WorkSpace::GetFileEntries(FileEntryType type) const {
|
||||
WorkSpace::FileEntryResult WorkSpace::SetFileEntry(std::shared_ptr<FileEntry> fileEntry) {
|
||||
if (!fileEntry) {
|
||||
LOG_ERROR("FileEntry is null");
|
||||
return FileEntryResult::InvalidFile;
|
||||
}
|
||||
|
||||
FileEntryType type = fileEntry->GetType();
|
||||
auto& vec = files_[type];
|
||||
|
||||
// Check limit (max 9 per type)
|
||||
if (vec.size() >= 9) {
|
||||
LOG_WARN("File entry limit exceeded for type: {}", FileEntryTypeToString(type));
|
||||
return FileEntryResult::LimitExceeded;
|
||||
}
|
||||
|
||||
// Check for duplicates by file path
|
||||
QString filePath = QString("%1/%2").arg(fileEntry->GetPath(), fileEntry->GetFileName());
|
||||
for (const auto& existingEntry : vec) {
|
||||
if (existingEntry->GetPath() == filePath) {
|
||||
LOG_WARN("Duplicate file entry: {}", filePath.toUtf8().constData());
|
||||
return FileEntryResult::Duplicate;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy file to workspace directory
|
||||
QFileInfo fileInfo(filePath);
|
||||
if (!fileInfo.exists()) {
|
||||
LOG_ERROR("File does not exist: {}", filePath.toUtf8().constData());
|
||||
return FileEntryResult::InvalidFile;
|
||||
}
|
||||
|
||||
QString targetPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
|
||||
bool copySuccess = FileUtils::CopyFileToPath(filePath, targetPath, true);
|
||||
LOG_INFO("Copy file {} to {}: {}",
|
||||
filePath.toLocal8Bit().data(),
|
||||
targetPath.toLocal8Bit().data(),
|
||||
copySuccess);
|
||||
|
||||
if (!copySuccess) {
|
||||
LOG_ERROR("Failed to copy file to workspace");
|
||||
return FileEntryResult::CopyFailed;
|
||||
}
|
||||
|
||||
// Update file entry with workspace-relative path
|
||||
fileEntry->SetFileNanme(fileInfo.fileName());
|
||||
|
||||
// Add to files collection
|
||||
vec.push_back(fileEntry);
|
||||
++filesSeq_;
|
||||
|
||||
emit FilesChanged(type);
|
||||
LOG_INFO("Successfully added file entry: {} (type: {})",
|
||||
fileInfo.fileName().toUtf8().constData(),
|
||||
FileEntryTypeToString(type));
|
||||
|
||||
return FileEntryResult::Ok;
|
||||
}
|
||||
std::vector<std::shared_ptr<FileEntry>> WorkSpace::GetFileEntries(FileEntryType type) const {
|
||||
auto it = files_.find(type);
|
||||
if (it == files_.end()) {
|
||||
return {};
|
||||
@ -126,19 +184,6 @@ std::vector<FileEntry> WorkSpace::GetFileEntries(FileEntryType type) const {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
WorkSpace::FileEntryResult WorkSpace::CreateFileEntry(FileEntryType type) {
|
||||
auto& vec = files_[type];
|
||||
if (vec.size() >= 9) {
|
||||
return FileEntryResult::LimitExceeded;
|
||||
}
|
||||
// push a placeholder; actual filename may be set elsewhere via SetWavePath/SetRDPath/etc
|
||||
vec.push_back(FileEntry{ type, QString() });
|
||||
++filesSeq_;
|
||||
// Notify listeners (e.g., PropertyBrowser) to refresh workspace properties
|
||||
emit FilesChanged(type);
|
||||
return FileEntryResult::Ok;
|
||||
}
|
||||
|
||||
bool WorkSpace::SetFileEntryCount(FileEntryType type, int count) {
|
||||
if (count < 0) count = 0;
|
||||
if (count > 9) count = 9;
|
||||
@ -149,7 +194,29 @@ bool WorkSpace::SetFileEntryCount(FileEntryType type, int count) {
|
||||
if (static_cast<int>(vec.size()) < count) {
|
||||
int toAdd = count - static_cast<int>(vec.size());
|
||||
for (int i = 0; i < toAdd; ++i) {
|
||||
vec.push_back(FileEntry{ type, QString() });
|
||||
// Create the appropriate FileEntry subclass based on type
|
||||
std::shared_ptr<FileEntry> fileEntry;
|
||||
switch (type) {
|
||||
case FileEntryType::Curve:
|
||||
fileEntry = std::make_shared<FileEntryCurve>();
|
||||
break;
|
||||
case FileEntryType::Surface:
|
||||
// TODO: Create FileEntrySurface when implemented
|
||||
fileEntry = std::make_shared<FileEntry>();
|
||||
fileEntry->SetType(FileEntryType::Surface);
|
||||
break;
|
||||
case FileEntryType::Table:
|
||||
// TODO: Create FileEntryTable when implemented
|
||||
fileEntry = std::make_shared<FileEntry>();
|
||||
fileEntry->SetType(FileEntryType::Table);
|
||||
break;
|
||||
case FileEntryType::Light:
|
||||
fileEntry = std::make_shared<FileEntryLight>();
|
||||
break;
|
||||
default:
|
||||
return false; // Invalid type
|
||||
}
|
||||
vec.push_back(fileEntry);
|
||||
}
|
||||
} else {
|
||||
vec.resize(count);
|
||||
@ -159,30 +226,6 @@ bool WorkSpace::SetFileEntryCount(FileEntryType type, int count) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WorkSpace::SetFileEntryPath(FileEntryType type, int index, const QString& path) {
|
||||
auto& vec = files_[type];
|
||||
if (index < 0 || index >= static_cast<int>(vec.size())) {
|
||||
return false;
|
||||
}
|
||||
QFileInfo fileInfo(path);
|
||||
if (!fileInfo.exists()) {
|
||||
return false;
|
||||
}
|
||||
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
|
||||
bool sucess = FileUtils::CopyFileToPath(path, dirPath, true);
|
||||
LOG_INFO("copy grouped file {}: {} to {}",
|
||||
path.toLocal8Bit().data(),
|
||||
dirPath.toLocal8Bit().data(),
|
||||
sucess);
|
||||
if (!sucess) {
|
||||
return false;
|
||||
}
|
||||
vec[index].fileName = fileInfo.fileName();
|
||||
++filesSeq_;
|
||||
emit FilesChanged(type);
|
||||
return true;
|
||||
}
|
||||
|
||||
QString WorkSpace::GetFileEntryAbsPath(FileEntryType type, int index) const {
|
||||
auto it = files_.find(type);
|
||||
if (it == files_.end()) {
|
||||
@ -192,7 +235,7 @@ QString WorkSpace::GetFileEntryAbsPath(FileEntryType type, int index) const {
|
||||
if (index < 0 || index >= static_cast<int>(vec.size())) {
|
||||
return QString();
|
||||
}
|
||||
const QString& name = vec[index].fileName;
|
||||
const QString& name = vec[index]->GetFileName();
|
||||
if (name.isEmpty()) {
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -81,13 +81,15 @@ public:
|
||||
const QString GetRDPath() const;
|
||||
|
||||
// Files list API (per-type, max 9 per type)
|
||||
enum class FileEntryResult { Ok, LimitExceeded, Duplicate, CopyFailed };
|
||||
FileEntryResult CreateFileEntry(FileEntryType type);
|
||||
std::vector<FileEntry> GetFileEntries(FileEntryType type) const;
|
||||
enum class FileEntryResult { Ok, LimitExceeded, Duplicate, CopyFailed, TypeMismatch, InvalidFile };
|
||||
|
||||
// New unified file entry management
|
||||
FileEntryResult SetFileEntry(std::shared_ptr<FileEntry> fileEntry);
|
||||
|
||||
std::vector<std::shared_ptr<FileEntry>> GetFileEntries(FileEntryType type) const;
|
||||
|
||||
// Manage grouped file entries
|
||||
bool SetFileEntryCount(FileEntryType type, int count);
|
||||
bool SetFileEntryPath(FileEntryType type, int index, const QString& path);
|
||||
QString GetFileEntryAbsPath(FileEntryType type, int index) const;
|
||||
|
||||
// Chart data management
|
||||
@ -154,7 +156,6 @@ Q_SIGNALS:
|
||||
void EntityRemoved(class Entity* entity);
|
||||
void TimestepChanged(class Timestep* timestep);
|
||||
void LampStatusChanged(class LampStatus* lampStatus);
|
||||
// Emitted when grouped file entries change (count or path or creation)
|
||||
void FilesChanged(FileEntryType type);
|
||||
|
||||
protected:
|
||||
@ -184,7 +185,7 @@ private:
|
||||
class LampStatus* lampStatus_{ nullptr };
|
||||
class Entity* trackedEntity_{ nullptr };
|
||||
// Stored as file entries under workspace dir, keyed by type
|
||||
std::map<FileEntryType, std::vector<FileEntry>> files_;
|
||||
std::map<FileEntryType, std::vector<std::shared_ptr<FileEntry>>> files_;
|
||||
// Chart data storage
|
||||
QList<FileTypeData> fileTypeData_;
|
||||
// Monotonic sequence for file entries changes, used to trigger UI refresh
|
||||
|
||||
@ -388,9 +388,7 @@ bool WorkSpaceXMLParse::ParseFiles(const tinyxml2::XMLElement* element) {
|
||||
// Also create file entries for backward compatibility
|
||||
FileEntryType enumType;
|
||||
if (FileEntryTypeFromString(name, enumType)) {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
workSpace_->CreateFileEntry(enumType);
|
||||
}
|
||||
workSpace_->SetFileEntryCount(enumType, count);
|
||||
}
|
||||
}
|
||||
typeElement = typeElement->NextSiblingElement("type");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user