add file dialog
This commit is contained in:
parent
963fe4fa76
commit
db7e71e44a
@ -2,90 +2,294 @@
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<context>
|
||||
<name>AddFileDlg</name>
|
||||
<name>AddCurveFileDlg</name>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="14"/>
|
||||
<source>Add File to Workspace</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="14"/>
|
||||
<source>Add Curve Data File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="22"/>
|
||||
<source>File Path</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="20"/>
|
||||
<source>File Selection</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="38"/>
|
||||
<source>Select file to add...</source>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="26"/>
|
||||
<source>File Path:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="45"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="33"/>
|
||||
<source>Select curve data file...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="43"/>
|
||||
<source>...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="62"/>
|
||||
<source>File Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="76"/>
|
||||
<source>Curve Data</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="81"/>
|
||||
<source>Surface Data</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="86"/>
|
||||
<source>Table Data</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="91"/>
|
||||
<source>Light Data</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="114"/>
|
||||
<source>File Information</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="122"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="50"/>
|
||||
<source>File Name:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="129"/>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="160"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="57"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="71"/>
|
||||
<source>-</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="153"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="64"/>
|
||||
<source>File Size:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="187"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="81"/>
|
||||
<source>Curve Parameters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="87"/>
|
||||
<source>X Column:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="107"/>
|
||||
<source>Y Column:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="127"/>
|
||||
<source>Separator:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="135"/>
|
||||
<source>Comma (,)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="140"/>
|
||||
<source>Tab</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="145"/>
|
||||
<source>Space</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="150"/>
|
||||
<source>Semicolon (;)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="158"/>
|
||||
<source>File has header row</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="171"/>
|
||||
<source>Description (Optional)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="200"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="183"/>
|
||||
<source>Enter file description...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="237"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="221"/>
|
||||
<source>Add File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddFileDlg.ui" line="250"/>
|
||||
<location filename="../ui/WorkSpace/AddCurveFileDlg.ui" line="231"/>
|
||||
<source>Cancel</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>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="26"/>
|
||||
<source>File Path:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="33"/>
|
||||
<source>Select light spectrum file...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="43"/>
|
||||
<source>...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="50"/>
|
||||
<source>File Name:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="57"/>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="71"/>
|
||||
<source>-</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="64"/>
|
||||
<source>File Size:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="81"/>
|
||||
<source>Spectrum Parameters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="87"/>
|
||||
<source>Wavelength Column:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="107"/>
|
||||
<source>Intensity Column:</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>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="140"/>
|
||||
<source>Tab</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="145"/>
|
||||
<source>Space</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="150"/>
|
||||
<source>Semicolon (;)</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>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="230"/>
|
||||
<source>Normalize intensity values</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="243"/>
|
||||
<source>Wavelength Range (Optional)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="249"/>
|
||||
<source>Min Wavelength:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="269"/>
|
||||
<source>Max Wavelength:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="289"/>
|
||||
<source>Enable wavelength range filtering</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="302"/>
|
||||
<source>Description (Optional)</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"/>
|
||||
<source>Add File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddLightFileDlg.ui" line="362"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -176,6 +380,269 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</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>
|
||||
<translation type="unfinished"></translation>
|
||||
</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="43"/>
|
||||
<source>...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="50"/>
|
||||
<source>File Name:</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>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="64"/>
|
||||
<source>File Size:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="81"/>
|
||||
<source>Surface Parameters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="87"/>
|
||||
<source>X Column:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="107"/>
|
||||
<source>Y Column:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="127"/>
|
||||
<source>Z Column:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="147"/>
|
||||
<source>Separator:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="155"/>
|
||||
<source>Comma (,)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="160"/>
|
||||
<source>Tab</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"/>
|
||||
<source>X Grid Size:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="198"/>
|
||||
<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>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="231"/>
|
||||
<source>Description (Optional)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="243"/>
|
||||
<source>Enter file description...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="281"/>
|
||||
<source>Add File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddSurfaceFileDlg.ui" line="291"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>AddTableFileDlg</name>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="14"/>
|
||||
<source>Add Table Data File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="20"/>
|
||||
<source>File Selection</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="26"/>
|
||||
<source>File Path:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="33"/>
|
||||
<source>Select table data file...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="43"/>
|
||||
<source>...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="50"/>
|
||||
<source>File Name:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="57"/>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="71"/>
|
||||
<source>-</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="64"/>
|
||||
<source>File Size:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="81"/>
|
||||
<source>Table Parameters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="87"/>
|
||||
<source>Separator:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="95"/>
|
||||
<source>Comma (,)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="100"/>
|
||||
<source>Tab</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="105"/>
|
||||
<source>Space</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="110"/>
|
||||
<source>Semicolon (;)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="118"/>
|
||||
<source>Encoding:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="126"/>
|
||||
<source>UTF-8</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="131"/>
|
||||
<source>GBK</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="136"/>
|
||||
<source>ASCII</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="141"/>
|
||||
<source>ISO-8859-1</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="149"/>
|
||||
<source>Skip Rows:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="169"/>
|
||||
<source>File has header row</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="179"/>
|
||||
<source>Auto-detect parameters</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="192"/>
|
||||
<source>Preview</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="223"/>
|
||||
<source>Description (Optional)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="235"/>
|
||||
<source>Enter file description...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="273"/>
|
||||
<source>Add File</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/WorkSpace/AddTableFileDlg.ui" line="283"/>
|
||||
<source>Cancel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>ChartPlotMenuClass</name>
|
||||
<message>
|
||||
@ -978,90 +1445,88 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="53"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="54"/>
|
||||
<source>Open Workspace</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="53"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="72"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="54"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="73"/>
|
||||
<source>Dyt Files (*.dyt)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="65"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="87"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="112"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="116"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="120"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="130"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="138"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="141"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="144"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="152"/>
|
||||
<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="163"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="166"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="164"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="174"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="181"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="184"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="187"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="195"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="203"/>
|
||||
<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="209"/>
|
||||
<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="248"/>
|
||||
<source>prompt</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="65"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="87"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="130"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="152"/>
|
||||
<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="195"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="216"/>
|
||||
<source>please create workspace first</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="72"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="73"/>
|
||||
<source>Save Workspace</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="106"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="108"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="150"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="192"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="234"/>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="107"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="109"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="151"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="193"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="235"/>
|
||||
<source>Failed to set file path</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="113"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="138"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="160"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="181"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="203"/>
|
||||
<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"/>
|
||||
<source>up to 9 files allowed for this type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="117"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="141"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="163"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="184"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="206"/>
|
||||
<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"/>
|
||||
<source>file already added for this type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="121"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="144"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="166"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="187"/>
|
||||
<location filename="../ui/Menu/FileManagerMenu.cpp" line="209"/>
|
||||
<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"/>
|
||||
<source>copy file failed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
||||
@ -8,7 +8,8 @@
|
||||
|
||||
#include "ui/MainFrame.h"
|
||||
#include "ui/WorkSpace/WorkSpaceDlg.h"
|
||||
#include "ui/WorkSpace/AddFileDlg.h"
|
||||
#include "ui/WorkSpace/AddFileDialogFactory.h"
|
||||
#include "ui/WorkSpace/BaseAddFileDlg.h"
|
||||
|
||||
#include "common/SpdLogger.h"
|
||||
#include "workspace/WorkSpace.h"
|
||||
@ -81,28 +82,29 @@ void FileManagerMenu::SaveWorkSpace() {
|
||||
LOG_INFO("save workspace: {}", fileName.toLocal8Bit().constData());
|
||||
}
|
||||
|
||||
void FileManagerMenu::AddFile() {
|
||||
// Removed old AddFile method - replaced by specific type methods
|
||||
|
||||
void FileManagerMenu::AddWaveFile() {
|
||||
auto current = WorkSpaceManager::Get().GetCurrent();
|
||||
if (nullptr == current) {
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("please create workspace first"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Show file addition dialog
|
||||
AddFileDlg dlg(&MainFrame::Get());
|
||||
if (dlg.exec() == QDialog::Accepted) {
|
||||
FileEntryType selectedType = dlg.getSelectedFileType();
|
||||
QString selectedPath = dlg.getSelectedFilePath();
|
||||
// Show curve file addition dialog
|
||||
auto dialog = AddFileDialogFactory::createDialog(FileEntryType::Curve, &MainFrame::Get());
|
||||
if (dialog && dialog->exec() == QDialog::Accepted) {
|
||||
QString selectedPath = dialog->getSelectedFilePath();
|
||||
|
||||
// Create file entry
|
||||
switch (current->CreateFileEntry(selectedType)) {
|
||||
switch (current->CreateFileEntry(FileEntryType::Curve)) {
|
||||
case WorkSpace::FileEntryResult::Ok: {
|
||||
// Get the index of the newly created file entry
|
||||
auto entries = current->GetFileEntries(selectedType);
|
||||
auto entries = current->GetFileEntries(FileEntryType::Curve);
|
||||
int newIndex = static_cast<int>(entries.size()) - 1;
|
||||
|
||||
// Set file path
|
||||
if (!current->SetFileEntryPath(selectedType, newIndex, selectedPath)) {
|
||||
if (!current->SetFileEntryPath(FileEntryType::Curve, newIndex, selectedPath)) {
|
||||
QMessageBox::warning(&MainFrame::Get(), QObject::tr("Error"),
|
||||
QObject::tr("Failed to set file path"));
|
||||
}
|
||||
@ -124,28 +126,6 @@ void FileManagerMenu::AddFile() {
|
||||
}
|
||||
}
|
||||
|
||||
void FileManagerMenu::AddWaveFile() {
|
||||
auto current = WorkSpaceManager::Get().GetCurrent();
|
||||
if (nullptr == current) {
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("please create workspace first"));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (current->CreateFileEntry(FileEntryType::Curve)) {
|
||||
case WorkSpace::FileEntryResult::Ok:
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("up to 9 files allowed for this type"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::Duplicate:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("file already added for this type"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::CopyFailed:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("copy file failed"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void FileManagerMenu::AddSurfaceFile() {
|
||||
auto current = WorkSpaceManager::Get().GetCurrent();
|
||||
if (nullptr == current) {
|
||||
@ -153,20 +133,40 @@ void FileManagerMenu::AddSurfaceFile() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Show surface file addition dialog
|
||||
auto dialog = AddFileDialogFactory::createDialog(FileEntryType::Surface, &MainFrame::Get());
|
||||
if (dialog && dialog->exec() == QDialog::Accepted) {
|
||||
QString selectedPath = dialog->getSelectedFilePath();
|
||||
|
||||
// Create file entry
|
||||
switch (current->CreateFileEntry(FileEntryType::Surface)) {
|
||||
case WorkSpace::FileEntryResult::Ok:
|
||||
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;
|
||||
}
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("up to 9 files allowed for this type"));
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("up to 9 files allowed for this type"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::Duplicate:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("file already added for this type"));
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("file already added for this type"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::CopyFailed:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("copy file failed"));
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("copy file failed"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileManagerMenu::AddTableFile() {
|
||||
auto current = WorkSpaceManager::Get().GetCurrent();
|
||||
@ -174,20 +174,41 @@ void FileManagerMenu::AddTableFile() {
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("please create workspace first"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Show table file addition dialog
|
||||
auto dialog = AddFileDialogFactory::createDialog(FileEntryType::Table, &MainFrame::Get());
|
||||
if (dialog && dialog->exec() == QDialog::Accepted) {
|
||||
QString selectedPath = dialog->getSelectedFilePath();
|
||||
|
||||
// Create file entry
|
||||
switch (current->CreateFileEntry(FileEntryType::Table)) {
|
||||
case WorkSpace::FileEntryResult::Ok:
|
||||
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;
|
||||
}
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("up to 9 files allowed for this type"));
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("up to 9 files allowed for this type"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::Duplicate:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("file already added for this type"));
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("file already added for this type"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::CopyFailed:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("copy file failed"));
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("copy file failed"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileManagerMenu::AddLightFile() {
|
||||
auto current = WorkSpaceManager::Get().GetCurrent();
|
||||
@ -196,17 +217,37 @@ void FileManagerMenu::AddLightFile() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Show light file addition dialog
|
||||
auto dialog = AddFileDialogFactory::createDialog(FileEntryType::Light, &MainFrame::Get());
|
||||
if (dialog && dialog->exec() == QDialog::Accepted) {
|
||||
QString selectedPath = dialog->getSelectedFilePath();
|
||||
|
||||
// Create file entry
|
||||
switch (current->CreateFileEntry(FileEntryType::Light)) {
|
||||
case WorkSpace::FileEntryResult::Ok:
|
||||
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;
|
||||
}
|
||||
case WorkSpace::FileEntryResult::LimitExceeded:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("up to 9 files allowed for this type"));
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("up to 9 files allowed for this type"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::Duplicate:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("file already added for this type"));
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("file already added for this type"));
|
||||
break;
|
||||
case WorkSpace::FileEntryResult::CopyFailed:
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"), QObject::tr("copy file failed"));
|
||||
QMessageBox::information(&MainFrame::Get(), QObject::tr("prompt"),
|
||||
QObject::tr("copy file failed"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,10 +20,7 @@ protected:
|
||||
void OpenWorkSpace();
|
||||
void SaveWorkSpace();
|
||||
|
||||
// New unified file addition method
|
||||
void AddFile();
|
||||
|
||||
// Keep original methods for backward compatibility
|
||||
// Type-specific file addition methods
|
||||
void AddWaveFile();
|
||||
void AddSurfaceFile();
|
||||
void AddTableFile();
|
||||
|
||||
114
src/ui/WorkSpace/AddCurveFileDlg.cpp
Normal file
114
src/ui/WorkSpace/AddCurveFileDlg.cpp
Normal file
@ -0,0 +1,114 @@
|
||||
#include "AddCurveFileDlg.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "ui_AddCurveFileDlg.h"
|
||||
|
||||
AddCurveFileDlg::AddCurveFileDlg(QWidget* parent)
|
||||
: BaseAddFileDlg(FileEntryType::Curve, parent)
|
||||
, ui(new Ui::AddCurveFileDlg) {
|
||||
|
||||
ui->setupUi(this);
|
||||
SetTitle(getDialogTitle());
|
||||
setupSpecificUI();
|
||||
}
|
||||
|
||||
AddCurveFileDlg::~AddCurveFileDlg() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::setupSpecificUI() {
|
||||
ui->xColumnSpinBox->setValue(1);
|
||||
ui->yColumnSpinBox->setValue(2);
|
||||
ui->separatorComboBox->setCurrentIndex(0);
|
||||
ui->hasHeaderCheckBox->setChecked(true);
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::setupConnections() {
|
||||
connect(ui->selectFileBtn, &QToolButton::clicked, this, &AddCurveFileDlg::onSelectFileClicked);
|
||||
connect(ui->filePathEdit, &QLineEdit::textChanged, this, &AddCurveFileDlg::onFilePathChanged);
|
||||
connect(ui->addBtn, &QPushButton::clicked, this, &QDialog::accept);
|
||||
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::onFilePathChanged() {
|
||||
QString filePath = ui->filePathEdit->text();
|
||||
if (!filePath.isEmpty()) {
|
||||
updateFileInfo(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
bool AddCurveFileDlg::validateSpecificParams() {
|
||||
if (ui->filePathEdit->text().trimmed().isEmpty()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("Please select a curve data file."));
|
||||
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()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("X and Y columns must be different."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString AddCurveFileDlg::getFileFilter() const {
|
||||
return QStringLiteral("Curve Data Files (*.txt *.csv *.dat);;All Files (*.*)");
|
||||
}
|
||||
|
||||
QString AddCurveFileDlg::getDialogTitle() const {
|
||||
return QStringLiteral("Add Curve Data File");
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onDelimiterChanged() {
|
||||
// Handle delimiter change if needed
|
||||
}
|
||||
|
||||
void AddCurveFileDlg::onHeaderToggled(bool hasHeader) {
|
||||
// Handle header toggle if needed
|
||||
}
|
||||
|
||||
AddCurveFileDlg::CurveParams AddCurveFileDlg::getCurveParams() const {
|
||||
CurveParams params;
|
||||
params.xColumn = ui->xColumnSpinBox->value();
|
||||
params.yColumn = ui->yColumnSpinBox->value();
|
||||
|
||||
// Get delimiter from combo box
|
||||
int index = ui->separatorComboBox->currentIndex();
|
||||
switch (index) {
|
||||
case 0: params.delimiter = ","; break;
|
||||
case 1: params.delimiter = "\t"; break;
|
||||
case 2: params.delimiter = " "; break;
|
||||
case 3: params.delimiter = ";"; break;
|
||||
default: params.delimiter = ","; break;
|
||||
}
|
||||
|
||||
params.hasHeader = ui->hasHeaderCheckBox->isChecked();
|
||||
params.description = ui->descriptionEdit->toPlainText().trimmed();
|
||||
return params;
|
||||
}
|
||||
53
src/ui/WorkSpace/AddCurveFileDlg.h
Normal file
53
src/ui/WorkSpace/AddCurveFileDlg.h
Normal file
@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseAddFileDlg.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class QComboBox;
|
||||
class QTextEdit;
|
||||
class QToolButton;
|
||||
class QLabel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Ui {
|
||||
class AddCurveFileDlg;
|
||||
}
|
||||
|
||||
class AddCurveFileDlg : public BaseAddFileDlg {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
struct CurveParams {
|
||||
QString delimiter;
|
||||
bool hasHeader;
|
||||
int xColumn;
|
||||
int yColumn;
|
||||
QString description;
|
||||
};
|
||||
|
||||
explicit AddCurveFileDlg(QWidget* parent = nullptr);
|
||||
~AddCurveFileDlg() override;
|
||||
|
||||
CurveParams getCurveParams() const;
|
||||
|
||||
protected:
|
||||
QString getFileFilter() const override;
|
||||
QString getDialogTitle() const override;
|
||||
void setupSpecificUI() override;
|
||||
bool validateSpecificParams() override;
|
||||
|
||||
private slots:
|
||||
void onDelimiterChanged();
|
||||
void onHeaderToggled(bool hasHeader);
|
||||
void onSelectFileClicked();
|
||||
void onFilePathChanged();
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
|
||||
private:
|
||||
Ui::AddCurveFileDlg* ui;
|
||||
};
|
||||
241
src/ui/WorkSpace/AddCurveFileDlg.ui
Normal file
241
src/ui/WorkSpace/AddCurveFileDlg.ui
Normal file
@ -0,0 +1,241 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddCurveFileDlg</class>
|
||||
<widget class="QWidget" name="AddCurveFileDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>450</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add Curve Data File</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="fileGroupBox">
|
||||
<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">
|
||||
<property name="placeholderText">
|
||||
<string>Select curve data file...</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="selectFileBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="fileNameLabel">
|
||||
<property name="text">
|
||||
<string>File Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="fileNameValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="fileSizeLabel">
|
||||
<property name="text">
|
||||
<string>File Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLabel" name="fileSizeValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="paramsGroupBox">
|
||||
<property name="title">
|
||||
<string>Curve Parameters</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="paramsGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="xColumnLabel">
|
||||
<property name="text">
|
||||
<string>X Column:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="xColumnSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="yColumnLabel">
|
||||
<property name="text">
|
||||
<string>Y Column:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="yColumnSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="separatorLabel">
|
||||
<property name="text">
|
||||
<string>Separator:</string>
|
||||
</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" colspan="2">
|
||||
<widget class="QCheckBox" name="hasHeaderCheckBox">
|
||||
<property name="text">
|
||||
<string>File has header row</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</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>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter file description...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonLayout">
|
||||
<item>
|
||||
<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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
22
src/ui/WorkSpace/AddFileDialogFactory.cpp
Normal file
22
src/ui/WorkSpace/AddFileDialogFactory.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include "AddFileDialogFactory.h"
|
||||
|
||||
#include "BaseAddFileDlg.h"
|
||||
#include "AddCurveFileDlg.h"
|
||||
#include "AddSurfaceFileDlg.h"
|
||||
#include "AddTableFileDlg.h"
|
||||
#include "AddLightFileDlg.h"
|
||||
|
||||
BaseAddFileDlg* AddFileDialogFactory::createDialog(FileEntryType type, QWidget* parent) {
|
||||
switch (type) {
|
||||
case FileEntryType::Curve:
|
||||
return new AddCurveFileDlg(parent);
|
||||
case FileEntryType::Surface:
|
||||
return new AddSurfaceFileDlg(parent);
|
||||
case FileEntryType::Table:
|
||||
return new AddTableFileDlg(parent);
|
||||
case FileEntryType::Light:
|
||||
return new AddLightFileDlg(parent);
|
||||
default:
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
15
src/ui/WorkSpace/AddFileDialogFactory.h
Normal file
15
src/ui/WorkSpace/AddFileDialogFactory.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "workspace/FileEntry.h"
|
||||
#include <memory>
|
||||
|
||||
class BaseAddFileDlg;
|
||||
class QWidget;
|
||||
|
||||
class AddFileDialogFactory {
|
||||
public:
|
||||
static BaseAddFileDlg* createDialog(FileEntryType fileType, QWidget* parent = nullptr);
|
||||
|
||||
private:
|
||||
AddFileDialogFactory() = default;
|
||||
};
|
||||
@ -1,125 +0,0 @@
|
||||
#include "AddFileDlg.h"
|
||||
#include "ui_AddFileDlg.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
|
||||
#include "app/Application.h"
|
||||
#include "common/SpdLogger.h"
|
||||
|
||||
AddFileDlg::AddFileDlg(QWidget* parent)
|
||||
: Dialog(parent)
|
||||
, ui(new Ui::AddFileDlg)
|
||||
, selectedFileType_(FileEntryType::Curve) {
|
||||
ui->setupUi(this);
|
||||
|
||||
// 设置对话框标题
|
||||
SetTitle(QStringLiteral("Add File to Workspace"));
|
||||
|
||||
InitConnect();
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
AddFileDlg::~AddFileDlg() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AddFileDlg::InitConnect() {
|
||||
connect(ui->tbSelectFile, &QToolButton::clicked, this, &AddFileDlg::OnSelectFile);
|
||||
connect(ui->cbFileType, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &AddFileDlg::OnFileTypeChanged);
|
||||
connect(ui->pbAdd, &QPushButton::clicked, this, &AddFileDlg::OnSure);
|
||||
connect(ui->pbCancel, &QPushButton::clicked, this, &AddFileDlg::reject);
|
||||
}
|
||||
|
||||
void AddFileDlg::OnSelectFile() {
|
||||
const QString workspacePath = Application::GetWorkSpacePath();
|
||||
QString filePath = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
QStringLiteral("Select File"),
|
||||
workspacePath,
|
||||
QStringLiteral("Text Files (*.txt);;All Files (*.*)")
|
||||
);
|
||||
|
||||
if (filePath.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
selectedFilePath_ = filePath;
|
||||
ui->leFilePath->setText(filePath);
|
||||
|
||||
QFileInfo fileInfo(filePath);
|
||||
ui->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);
|
||||
}
|
||||
ui->lblFileSize->setText(sizeText);
|
||||
|
||||
LOG_INFO("Selected file: {}", filePath.toStdString());
|
||||
}
|
||||
|
||||
void AddFileDlg::OnFileTypeChanged() {
|
||||
int index = ui->cbFileType->currentIndex();
|
||||
switch (index) {
|
||||
case 0: selectedFileType_ = FileEntryType::Curve; break;
|
||||
case 1: selectedFileType_ = FileEntryType::Surface; break;
|
||||
case 2: selectedFileType_ = FileEntryType::Table; break;
|
||||
case 3: selectedFileType_ = FileEntryType::Light; break;
|
||||
default: selectedFileType_ = FileEntryType::Curve; break;
|
||||
}
|
||||
|
||||
LOG_INFO("File type changed to: {}", static_cast<int>(selectedFileType_));
|
||||
}
|
||||
|
||||
void AddFileDlg::OnSure() {
|
||||
if (!ValidateInput()) {
|
||||
return;
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
void AddFileDlg::UpdateUI() {
|
||||
ui->lblFileName->setText(QStringLiteral("-"));
|
||||
ui->lblFileSize->setText(QStringLiteral("-"));
|
||||
ui->cbFileType->setCurrentIndex(0);
|
||||
selectedFileType_ = FileEntryType::Curve;
|
||||
}
|
||||
|
||||
bool AddFileDlg::ValidateInput() {
|
||||
if (selectedFilePath_.isEmpty()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("Please select a file first."));
|
||||
return false;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo(selectedFilePath_);
|
||||
if (!fileInfo.exists()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("Selected file does not exist."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FileEntryType AddFileDlg::getSelectedFileType() const {
|
||||
return selectedFileType_;
|
||||
}
|
||||
|
||||
QString AddFileDlg::getSelectedFilePath() const {
|
||||
return selectedFilePath_;
|
||||
}
|
||||
|
||||
QString AddFileDlg::getDescription() const {
|
||||
return ui->teDescription->toPlainText().trimmed();
|
||||
}
|
||||
@ -1,37 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui/Dialog.h"
|
||||
#include "workspace/FileEntry.h"
|
||||
|
||||
namespace Ui {
|
||||
class AddFileDlg;
|
||||
}
|
||||
|
||||
class AddFileDlg : public Dialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AddFileDlg(QWidget* parent = nullptr);
|
||||
~AddFileDlg() override;
|
||||
|
||||
FileEntryType getSelectedFileType() const;
|
||||
|
||||
QString getSelectedFilePath() const;
|
||||
|
||||
QString getDescription() const;
|
||||
|
||||
protected:
|
||||
void InitConnect();
|
||||
void OnSure();
|
||||
void OnSelectFile();
|
||||
void OnFileTypeChanged();
|
||||
|
||||
private:
|
||||
void UpdateUI();
|
||||
bool ValidateInput();
|
||||
|
||||
private:
|
||||
Ui::AddFileDlg* ui;
|
||||
QString selectedFilePath_;
|
||||
FileEntryType selectedFileType_;
|
||||
};
|
||||
@ -1,266 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddFileDlg</class>
|
||||
<widget class="QWidget" name="AddFileDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>480</width>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add File to Workspace</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_main">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_file">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_file">
|
||||
<property name="text">
|
||||
<string>File Path</string>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leFilePath">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Select file to add...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="tbSelectFile">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_type">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_type">
|
||||
<property name="text">
|
||||
<string>File Type</string>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbFileType">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Curve Data</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Surface Data</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Table Data</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Light Data</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_type">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_preview">
|
||||
<property name="title">
|
||||
<string>File Information</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_preview">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_info">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_fileName">
|
||||
<property name="text">
|
||||
<string>File Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblFileName">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_info1">
|
||||
<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>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_size">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_fileSize">
|
||||
<property name="text">
|
||||
<string>File Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblFileSize">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_info2">
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_desc">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_desc">
|
||||
<property name="text">
|
||||
<string>Description (Optional)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="teDescription">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter file description...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</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="horizontalLayout_buttons">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_buttons">
|
||||
<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="pbAdd">
|
||||
<property name="text">
|
||||
<string>Add File</string>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbCancel">
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
70
src/ui/WorkSpace/AddLightFileDlg.cpp
Normal file
70
src/ui/WorkSpace/AddLightFileDlg.cpp
Normal file
@ -0,0 +1,70 @@
|
||||
#include "AddLightFileDlg.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QFileInfo>
|
||||
|
||||
#include "ui_AddLightFileDlg.h"
|
||||
|
||||
AddLightFileDlg::AddLightFileDlg(QWidget* parent)
|
||||
: BaseAddFileDlg(FileEntryType::Light, parent)
|
||||
, ui(new Ui::AddLightFileDlg) {
|
||||
|
||||
ui->setupUi(this);
|
||||
SetTitle(getDialogTitle());
|
||||
setupSpecificUI();
|
||||
}
|
||||
|
||||
AddLightFileDlg::~AddLightFileDlg() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AddLightFileDlg::setupSpecificUI() {
|
||||
}
|
||||
|
||||
bool AddLightFileDlg::validateSpecificParams() {
|
||||
LightParams params = getLightParams();
|
||||
|
||||
if (params.delimiter.isEmpty()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("Please specify a delimiter for light data."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString AddLightFileDlg::getFileFilter() const {
|
||||
return QStringLiteral("Light Spectrum Files (*.txt *.csv *.dat *.spe *.asc);;All Files (*.*)");
|
||||
}
|
||||
|
||||
QString AddLightFileDlg::getDialogTitle() const {
|
||||
return QStringLiteral("Add Light Spectrum 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;
|
||||
}
|
||||
|
||||
params.hasHeader = ui->hasHeaderCheckBox->isChecked();
|
||||
params.description = ui->descriptionEdit->toPlainText().trimmed();
|
||||
return params;
|
||||
}
|
||||
39
src/ui/WorkSpace/AddLightFileDlg.h
Normal file
39
src/ui/WorkSpace/AddLightFileDlg.h
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
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;
|
||||
|
||||
private slots:
|
||||
void onDelimiterChanged();
|
||||
void onHeaderToggled(bool hasHeader);
|
||||
|
||||
private:
|
||||
Ui::AddLightFileDlg* ui;
|
||||
};
|
||||
372
src/ui/WorkSpace/AddLightFileDlg.ui
Normal file
372
src/ui/WorkSpace/AddLightFileDlg.ui
Normal file
@ -0,0 +1,372 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddLightFileDlg</class>
|
||||
<widget class="QWidget" name="AddLightFileDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add Light Spectrum File</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="fileGroupBox">
|
||||
<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">
|
||||
<property name="placeholderText">
|
||||
<string>Select light spectrum file...</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="selectFileBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="fileNameLabel">
|
||||
<property name="text">
|
||||
<string>File Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="fileNameValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="fileSizeLabel">
|
||||
<property name="text">
|
||||
<string>File Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLabel" name="fileSizeValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="paramsGroupBox">
|
||||
<property name="title">
|
||||
<string>Spectrum Parameters</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="paramsGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="wavelengthColumnLabel">
|
||||
<property name="text">
|
||||
<string>Wavelength Column:</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>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="intensityColumnLabel">
|
||||
<property name="text">
|
||||
<string>Intensity Column:</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>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="separatorLabel">
|
||||
<property name="text">
|
||||
<string>Separator:</string>
|
||||
</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">
|
||||
<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>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter file description...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonLayout">
|
||||
<item>
|
||||
<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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
140
src/ui/WorkSpace/AddSurfaceFileDlg.cpp
Normal file
140
src/ui/WorkSpace/AddSurfaceFileDlg.cpp
Normal file
@ -0,0 +1,140 @@
|
||||
#include "AddSurfaceFileDlg.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QFileInfo>
|
||||
#include <QFileDialog>
|
||||
#include "app/Application.h"
|
||||
#include "common/SpdLogger.h"
|
||||
|
||||
#include "ui_AddSurfaceFileDlg.h"
|
||||
|
||||
AddSurfaceFileDlg::AddSurfaceFileDlg(QWidget* parent)
|
||||
: BaseAddFileDlg(FileEntryType::Surface, parent)
|
||||
, ui_(new Ui::AddSurfaceFileDlg) {
|
||||
|
||||
ui_->setupUi(this);
|
||||
SetTitle(getDialogTitle());
|
||||
setupSpecificUI();
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
AddSurfaceFileDlg::~AddSurfaceFileDlg() {
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
void AddSurfaceFileDlg::setupSpecificUI() {
|
||||
// UI is already set up in constructor
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
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."));
|
||||
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."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString AddSurfaceFileDlg::getFileFilter() const {
|
||||
return QStringLiteral("Surface Data Files (*.txt *.csv *.dat *.xyz);;All Files (*.*)");
|
||||
}
|
||||
|
||||
QString AddSurfaceFileDlg::getDialogTitle() const {
|
||||
return QStringLiteral("Add Surface Data File");
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
57
src/ui/WorkSpace/AddSurfaceFileDlg.h
Normal file
57
src/ui/WorkSpace/AddSurfaceFileDlg.h
Normal file
@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include "BaseAddFileDlg.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QLineEdit;
|
||||
class QCheckBox;
|
||||
class QSpinBox;
|
||||
class QComboBox;
|
||||
class QTextEdit;
|
||||
class QToolButton;
|
||||
class QLabel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Ui {
|
||||
class AddSurfaceFileDlg;
|
||||
}
|
||||
|
||||
class AddSurfaceFileDlg : public BaseAddFileDlg {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
struct SurfaceParams {
|
||||
QString delimiter;
|
||||
bool hasHeader;
|
||||
int xColumn;
|
||||
int yColumn;
|
||||
int zColumn;
|
||||
int xGridSize;
|
||||
int yGridSize;
|
||||
QString description;
|
||||
};
|
||||
|
||||
explicit AddSurfaceFileDlg(QWidget* parent = nullptr);
|
||||
~AddSurfaceFileDlg() override;
|
||||
|
||||
SurfaceParams getSurfaceParams() const;
|
||||
QString getSelectedFilePath() const;
|
||||
QString getDescription() const;
|
||||
|
||||
protected:
|
||||
QString getFileFilter() const override;
|
||||
QString getDialogTitle() const override;
|
||||
void setupSpecificUI() override;
|
||||
bool validateSpecificParams() override;
|
||||
|
||||
private slots:
|
||||
void onSelectFileClicked();
|
||||
void onFilePathChanged();
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
void updateFileInfo(const QString& filePath);
|
||||
|
||||
private:
|
||||
Ui::AddSurfaceFileDlg* ui_;
|
||||
};
|
||||
301
src/ui/WorkSpace/AddSurfaceFileDlg.ui
Normal file
301
src/ui/WorkSpace/AddSurfaceFileDlg.ui
Normal file
@ -0,0 +1,301 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddSurfaceFileDlg</class>
|
||||
<widget class="QWidget" name="AddSurfaceFileDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>520</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add Surface Data File</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="fileGroupBox">
|
||||
<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">
|
||||
<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">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="fileNameLabel">
|
||||
<property name="text">
|
||||
<string>File Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="fileNameValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="fileSizeLabel">
|
||||
<property name="text">
|
||||
<string>File Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLabel" name="fileSizeValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="paramsGroupBox">
|
||||
<property name="title">
|
||||
<string>Surface Parameters</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="paramsGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="xColumnLabel">
|
||||
<property name="text">
|
||||
<string>X Column:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="xColumnSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="yColumnLabel">
|
||||
<property name="text">
|
||||
<string>Y Column:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="yColumnSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>2</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="zColumnLabel">
|
||||
<property name="text">
|
||||
<string>Z Column:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="zColumnSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<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>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="xGridSizeLabel">
|
||||
<property name="text">
|
||||
<string>X Grid Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="xGridSizeSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="yGridSizeLabel">
|
||||
<property name="text">
|
||||
<string>Y Grid Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QSpinBox" name="yGridSizeSpinBox">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="hasHeaderCheckBox">
|
||||
<property name="text">
|
||||
<string>File has header row</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</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>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter file description...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonLayout">
|
||||
<item>
|
||||
<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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
135
src/ui/WorkSpace/AddTableFileDlg.cpp
Normal file
135
src/ui/WorkSpace/AddTableFileDlg.cpp
Normal file
@ -0,0 +1,135 @@
|
||||
#include "AddTableFileDlg.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QFileInfo>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "app/Application.h"
|
||||
#include "common/SpdLogger.h"
|
||||
|
||||
#include "ui_AddTableFileDlg.h"
|
||||
|
||||
|
||||
AddTableFileDlg::AddTableFileDlg(QWidget* parent)
|
||||
: BaseAddFileDlg(FileEntryType::Table, parent)
|
||||
, ui(new Ui::AddTableFileDlg) {
|
||||
|
||||
ui->setupUi(this);
|
||||
SetTitle(getDialogTitle());
|
||||
setupSpecificUI();
|
||||
setupConnections();
|
||||
}
|
||||
|
||||
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);
|
||||
connect(ui->filePathEdit, &QLineEdit::textChanged, this, &AddTableFileDlg::onFilePathChanged);
|
||||
connect(ui->separatorComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
this, &AddTableFileDlg::onDelimiterChanged);
|
||||
connect(ui->hasHeaderCheckBox, &QCheckBox::toggled, this, &AddTableFileDlg::onHeaderToggled);
|
||||
connect(ui->addBtn, &QPushButton::clicked, this, [this]() { OnSure(); });
|
||||
connect(ui->cancelBtn, &QPushButton::clicked, this, &QDialog::reject);
|
||||
}
|
||||
|
||||
void AddTableFileDlg::onSelectFileClicked() {
|
||||
const QString workspacePath = Application::GetWorkSpacePath();
|
||||
QString filePath = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
QStringLiteral("Select Table File"),
|
||||
workspacePath,
|
||||
getFileFilter()
|
||||
);
|
||||
|
||||
if (!filePath.isEmpty()) {
|
||||
ui->filePathEdit->setText(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
void AddTableFileDlg::onFilePathChanged(const QString& filePath) {
|
||||
updateFileInfo(filePath);
|
||||
}
|
||||
|
||||
void AddTableFileDlg::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);
|
||||
}
|
||||
|
||||
void AddTableFileDlg::onDelimiterChanged() {
|
||||
// Handle delimiter change if needed
|
||||
}
|
||||
|
||||
void AddTableFileDlg::onHeaderToggled(bool hasHeader) {
|
||||
// Handle header toggle if needed
|
||||
}
|
||||
|
||||
bool AddTableFileDlg::validateSpecificParams() {
|
||||
if (ui->filePathEdit->text().isEmpty()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("Please select a table file first."));
|
||||
return false;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo(ui->filePathEdit->text());
|
||||
if (!fileInfo.exists()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("Selected file does not exist."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QString AddTableFileDlg::getFileFilter() const {
|
||||
return QStringLiteral("Table Files (*.txt *.csv *.tsv *.dat);;All Files (*.*)");
|
||||
}
|
||||
|
||||
QString AddTableFileDlg::getDialogTitle() const {
|
||||
return QStringLiteral("Add Table Data File");
|
||||
}
|
||||
|
||||
QString AddTableFileDlg::getSelectedFilePath() const {
|
||||
return ui->filePathEdit->text();
|
||||
}
|
||||
|
||||
QString AddTableFileDlg::getDescription() const {
|
||||
return ui->descriptionEdit->toPlainText().trimmed();
|
||||
}
|
||||
|
||||
AddTableFileDlg::TableParams AddTableFileDlg::getTableParams() const {
|
||||
TableParams params;
|
||||
|
||||
// Get delimiter from combo box
|
||||
int index = ui->separatorComboBox->currentIndex();
|
||||
switch (index) {
|
||||
case 0: params.delimiter = ","; break;
|
||||
case 1: params.delimiter = "\t"; break;
|
||||
case 2: params.delimiter = " "; break;
|
||||
case 3: params.delimiter = ";"; break;
|
||||
default: params.delimiter = ","; break;
|
||||
}
|
||||
|
||||
params.hasHeader = ui->hasHeaderCheckBox->isChecked();
|
||||
params.xColumn = 1; // Default values
|
||||
params.yColumn = 2;
|
||||
params.description = ui->descriptionEdit->toPlainText().trimmed();
|
||||
return params;
|
||||
}
|
||||
45
src/ui/WorkSpace/AddTableFileDlg.h
Normal file
45
src/ui/WorkSpace/AddTableFileDlg.h
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
namespace Ui {
|
||||
class AddTableFileDlg;
|
||||
}
|
||||
|
||||
#include "BaseAddFileDlg.h"
|
||||
|
||||
class AddTableFileDlg : public BaseAddFileDlg {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
struct TableParams {
|
||||
QString delimiter;
|
||||
bool hasHeader;
|
||||
int xColumn;
|
||||
int yColumn;
|
||||
QString description;
|
||||
};
|
||||
|
||||
explicit AddTableFileDlg(QWidget* parent = nullptr);
|
||||
~AddTableFileDlg() override;
|
||||
|
||||
TableParams getTableParams() const;
|
||||
QString getSelectedFilePath() const;
|
||||
QString getDescription() const;
|
||||
|
||||
protected:
|
||||
QString getFileFilter() const override;
|
||||
QString getDialogTitle() const override;
|
||||
void setupSpecificUI() override;
|
||||
bool validateSpecificParams() override;
|
||||
|
||||
private slots:
|
||||
void onSelectFileClicked();
|
||||
void onFilePathChanged(const QString& filePath);
|
||||
void onDelimiterChanged();
|
||||
void onHeaderToggled(bool hasHeader);
|
||||
|
||||
private:
|
||||
void setupConnections();
|
||||
void updateFileInfo(const QString& filePath);
|
||||
|
||||
Ui::AddTableFileDlg* ui;
|
||||
};
|
||||
293
src/ui/WorkSpace/AddTableFileDlg.ui
Normal file
293
src/ui/WorkSpace/AddTableFileDlg.ui
Normal file
@ -0,0 +1,293 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddTableFileDlg</class>
|
||||
<widget class="QWidget" name="AddTableFileDlg">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>480</width>
|
||||
<height>450</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Add Table Data File</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="fileGroupBox">
|
||||
<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">
|
||||
<property name="placeholderText">
|
||||
<string>Select table data file...</string>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="selectFileBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="fileNameLabel">
|
||||
<property name="text">
|
||||
<string>File Name:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QLabel" name="fileNameValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="fileSizeLabel">
|
||||
<property name="text">
|
||||
<string>File Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QLabel" name="fileSizeValue">
|
||||
<property name="text">
|
||||
<string>-</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="paramsGroupBox">
|
||||
<property name="title">
|
||||
<string>Table Parameters</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="paramsGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="separatorLabel">
|
||||
<property name="text">
|
||||
<string>Separator:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" 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="1" column="0">
|
||||
<widget class="QLabel" name="encodingLabel">
|
||||
<property name="text">
|
||||
<string>Encoding:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="encodingComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>UTF-8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>GBK</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ASCII</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ISO-8859-1</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="skipRowsLabel">
|
||||
<property name="text">
|
||||
<string>Skip Rows:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QSpinBox" name="skipRowsSpinBox">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="hasHeaderCheckBox">
|
||||
<property name="text">
|
||||
<string>File has header row</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="autoDetectCheckBox">
|
||||
<property name="text">
|
||||
<string>Auto-detect parameters</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="previewGroupBox">
|
||||
<property name="title">
|
||||
<string>Preview</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="previewVerticalLayout">
|
||||
<item>
|
||||
<widget class="QTableWidget" name="previewTable">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>120</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::NoSelection</enum>
|
||||
</property>
|
||||
<property name="rowCount">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="descGroupBox">
|
||||
<property name="title">
|
||||
<string>Description (Optional)</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="descVerticalLayout">
|
||||
<item>
|
||||
<widget class="QTextEdit" name="descriptionEdit">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Enter file description...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="buttonLayout">
|
||||
<item>
|
||||
<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>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
173
src/ui/WorkSpace/BaseAddFileDlg.cpp
Normal file
173
src/ui/WorkSpace/BaseAddFileDlg.cpp
Normal file
@ -0,0 +1,173 @@
|
||||
#include "BaseAddFileDlg.h"
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QGridLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QLineEdit>
|
||||
#include <QLabel>
|
||||
#include <QTextEdit>
|
||||
#include <QPushButton>
|
||||
#include <QToolButton>
|
||||
#include <QFileDialog>
|
||||
#include <QFileInfo>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "app/Application.h"
|
||||
#include "common/SpdLogger.h"
|
||||
|
||||
BaseAddFileDlg::BaseAddFileDlg(FileEntryType fileType, QWidget* parent)
|
||||
: Dialog(parent)
|
||||
, fileType_(fileType)
|
||||
, leFilePath_(nullptr)
|
||||
, tbSelectFile_(nullptr)
|
||||
, lblFileName_(nullptr)
|
||||
, lblFileSize_(nullptr)
|
||||
, teDescription_(nullptr)
|
||||
, pbAdd_(nullptr)
|
||||
, pbCancel_(nullptr) {
|
||||
|
||||
setupBaseUI();
|
||||
initBaseConnect();
|
||||
}
|
||||
|
||||
BaseAddFileDlg::~BaseAddFileDlg() {
|
||||
}
|
||||
|
||||
FileEntryType BaseAddFileDlg::getSelectedFileType() const {
|
||||
return fileType_;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
QHBoxLayout* buttonLayout = new QHBoxLayout();
|
||||
buttonLayout->addStretch();
|
||||
pbAdd_ = new QPushButton(QStringLiteral("Add"), this);
|
||||
pbCancel_ = new QPushButton(QStringLiteral("Cancel"), this);
|
||||
buttonLayout->addWidget(pbAdd_);
|
||||
buttonLayout->addWidget(pbCancel_);
|
||||
|
||||
mainLayout->addLayout(buttonLayout);
|
||||
}
|
||||
|
||||
void BaseAddFileDlg::initBaseConnect() {
|
||||
connect(tbSelectFile_, &QToolButton::clicked, this, &BaseAddFileDlg::OnSelectFile);
|
||||
connect(pbAdd_, &QPushButton::clicked, this, &BaseAddFileDlg::OnSure);
|
||||
connect(pbCancel_, &QPushButton::clicked, this, &BaseAddFileDlg::reject);
|
||||
}
|
||||
|
||||
void BaseAddFileDlg::OnSelectFile() {
|
||||
const QString workspacePath = Application::GetWorkSpacePath();
|
||||
QString filePath = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
QStringLiteral("Select File"),
|
||||
workspacePath,
|
||||
getFileFilter()
|
||||
);
|
||||
|
||||
if (filePath.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
selectedFilePath_ = filePath;
|
||||
leFilePath_->setText(filePath);
|
||||
updateFileInfo(filePath);
|
||||
|
||||
LOG_INFO("Selected file: {}", filePath.toStdString());
|
||||
}
|
||||
|
||||
void BaseAddFileDlg::OnSure() {
|
||||
if (!validateBaseInput() || !validateSpecificParams()) {
|
||||
return;
|
||||
}
|
||||
|
||||
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"),
|
||||
QStringLiteral("Please select a file first."));
|
||||
return false;
|
||||
}
|
||||
|
||||
QFileInfo fileInfo(selectedFilePath_);
|
||||
if (!fileInfo.exists()) {
|
||||
QMessageBox::warning(this, QStringLiteral("Warning"),
|
||||
QStringLiteral("Selected file does not exist."));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BaseAddFileDlg::SetTitle(const QString& title) {
|
||||
Dialog::SetTitle(title);
|
||||
}
|
||||
55
src/ui/WorkSpace/BaseAddFileDlg.h
Normal file
55
src/ui/WorkSpace/BaseAddFileDlg.h
Normal file
@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "ui/Dialog.h"
|
||||
#include "workspace/FileEntry.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
class QLineEdit;
|
||||
class QLabel;
|
||||
class QTextEdit;
|
||||
class QPushButton;
|
||||
class QToolButton;
|
||||
|
||||
class BaseAddFileDlg : public Dialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BaseAddFileDlg(FileEntryType fileType, QWidget* parent = nullptr);
|
||||
virtual ~BaseAddFileDlg();
|
||||
|
||||
FileEntryType getSelectedFileType() const;
|
||||
QString getSelectedFilePath() const;
|
||||
QString getDescription() const;
|
||||
|
||||
virtual bool validateSpecificParams() = 0;
|
||||
virtual QString getFileFilter() const = 0;
|
||||
virtual QString getDialogTitle() const = 0;
|
||||
|
||||
protected slots:
|
||||
void OnSelectFile();
|
||||
void OnSure();
|
||||
|
||||
protected:
|
||||
QLineEdit* leFilePath_;
|
||||
QToolButton* tbSelectFile_;
|
||||
QLabel* lblFileName_;
|
||||
QLabel* lblFileSize_;
|
||||
QTextEdit* teDescription_;
|
||||
QPushButton* pbAdd_;
|
||||
QPushButton* pbCancel_;
|
||||
|
||||
void setupBaseUI();
|
||||
void initBaseConnect();
|
||||
void updateFileInfo(const QString& filePath);
|
||||
bool validateBaseInput();
|
||||
void SetTitle(const QString& title);
|
||||
|
||||
virtual void setupSpecificUI() = 0;
|
||||
|
||||
private:
|
||||
FileEntryType fileType_;
|
||||
QString selectedFilePath_;
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user