add workspace file entiry

This commit is contained in:
brige 2025-10-12 22:14:16 +08:00
parent c638cbbe19
commit 252db1fc9f
18 changed files with 1072 additions and 192 deletions

View File

@ -1,6 +1,8 @@
#include "entities/Entity.h"
#include <QUuid>
// Ensure QVariant can hold and convert Entity* in signals/slots
Q_DECLARE_METATYPE(Entity*)
#include "common/SpdLogger.h"
#include "entities/SceneComponent.h"

View File

@ -402,30 +402,82 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="45"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="52"/>
<source>Dyt (*.dyt)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="48"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="55"/>
<source>open dyt file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="49"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="56"/>
<source>Dyt (*.dyt);;All files (*.*)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="65"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="72"/>
<source>warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="65"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="72"/>
<source>workspace is nullptr</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="88"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="96"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="99"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="102"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="110"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="118"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="121"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="124"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="132"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="139"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="142"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="145"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="153"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="161"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="164"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="167"/>
<source>prompt</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="88"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="110"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="132"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="153"/>
<source>please create workspace first</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="96"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="118"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="139"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="161"/>
<source>up to 9 files allowed for this type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="99"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="121"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="142"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="164"/>
<source>file already added for this type</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="102"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="124"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="145"/>
<location filename="../ui/Menu/FileManagerMenu.cpp" line="167"/>
<source>copy file failed</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>FitCurveChartView</name>
@ -555,117 +607,117 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="117"/>
<location filename="../ui/MainWindow.cpp" line="116"/>
<source>Wave Curve</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="126"/>
<location filename="../ui/MainWindow.cpp" line="125"/>
<source>Speed Curve</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="139"/>
<location filename="../ui/MainWindow.cpp" line="138"/>
<source>3D Curve</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="155"/>
<location filename="../ui/MainWindow.cpp" line="154"/>
<source>Target number</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="155"/>
<location filename="../ui/MainWindow.cpp" line="154"/>
<source>Signal-to-noise ratio</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="156"/>
<location filename="../ui/MainWindow.cpp" line="155"/>
<source>Azimuth line of sight</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="156"/>
<location filename="../ui/MainWindow.cpp" line="155"/>
<source>Pitch gaze angle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="157"/>
<location filename="../ui/MainWindow.cpp" line="156"/>
<source>azimuth</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="157"/>
<location filename="../ui/MainWindow.cpp" line="156"/>
<source>Pitch angle</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="158"/>
<location filename="../ui/MainWindow.cpp" line="157"/>
<source>attribute</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="158"/>
<location filename="../ui/MainWindow.cpp" line="157"/>
<source>Doppler</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="159"/>
<location filename="../ui/MainWindow.cpp" line="158"/>
<source>course</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="159"/>
<location filename="../ui/MainWindow.cpp" line="158"/>
<source>Speed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="160"/>
<location filename="../ui/MainWindow.cpp" line="159"/>
<source>longitude</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="160"/>
<location filename="../ui/MainWindow.cpp" line="159"/>
<source>latitude</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="161"/>
<location filename="../ui/MainWindow.cpp" line="160"/>
<source>distance</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="161"/>
<location filename="../ui/MainWindow.cpp" line="160"/>
<source>velocity</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="162"/>
<location filename="../ui/MainWindow.cpp" line="161"/>
<source>Radial dimensions</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="162"/>
<location filename="../ui/MainWindow.cpp" line="161"/>
<source>Target RCS</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="168"/>
<location filename="../ui/MainWindow.cpp" line="167"/>
<source>Report Table</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="181"/>
<location filename="../ui/MainWindow.cpp" line="180"/>
<source>Signal Indicator Lamp</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="192"/>
<location filename="../ui/MainWindow.cpp" line="191"/>
<source>ParamSetting</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/MainWindow.cpp" line="201"/>
<location filename="../ui/MainWindow.cpp" line="200"/>
<source>bat File</source>
<translation type="unfinished"></translation>
</message>
@ -845,22 +897,23 @@
<message>
<location filename="../ui/PropertyBrowser.cpp" line="55"/>
<location filename="../ui/PropertyBrowser.cpp" line="58"/>
<location filename="../ui/PropertyBrowser.cpp" line="180"/>
<source>WorkSpace</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser.cpp" line="71"/>
<location filename="../ui/PropertyBrowser.cpp" line="74"/>
<location filename="../ui/PropertyBrowser.cpp" line="79"/>
<location filename="../ui/PropertyBrowser.cpp" line="82"/>
<source>Entity</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser.cpp" line="217"/>
<location filename="../ui/PropertyBrowser.cpp" line="237"/>
<source>ModelBase</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser.cpp" line="222"/>
<location filename="../ui/PropertyBrowser.cpp" line="242"/>
<source>color base</source>
<translation type="unfinished"></translation>
</message>
@ -918,6 +971,30 @@
<source>altitude:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8045"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8238"/>
<source>Curve[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8046"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8239"/>
<source>Surface[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8047"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8240"/>
<source>Table[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8048"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8241"/>
<source>Light[%1]</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QtBoolEdit</name>
@ -938,12 +1015,12 @@
<context>
<name>QtBoolPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2016"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2017"/>
<source>True</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2017"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="2018"/>
<source>False</source>
<translation type="unfinished"></translation>
</message>
@ -967,22 +1044,22 @@
<context>
<name>QtColorPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7016"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7017"/>
<source>Red</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7024"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7025"/>
<source>Green</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7032"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7033"/>
<source>Blue</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7040"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7041"/>
<source>Alpha</source>
<translation type="unfinished"></translation>
</message>
@ -990,48 +1067,48 @@
<context>
<name>QtConeWaveComponentManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8823"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8832"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9230"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9239"/>
<source>ConeWaveComponent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8920"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9327"/>
<source>Height</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8927"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9334"/>
<source>Radius</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8934"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9341"/>
<source>waveCount</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8944"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9351"/>
<source>waveSpeed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8951"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9358"/>
<source>baseColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8958"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9365"/>
<source>waveColor</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8965"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9372"/>
<source>ringBrightAlpha</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8972"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9379"/>
<source>ringDarkAlpha</source>
<translation type="unfinished"></translation>
</message>
@ -1137,28 +1214,28 @@
<context>
<name>QtDashedLineComponentManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9164"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9173"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9571"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9580"/>
<source>DashedLineComponent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9242"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9649"/>
<source>Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9249"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9656"/>
<source>End</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9256"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9663"/>
<source>Radius</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9263"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9670"/>
<source>Color</source>
<translation type="unfinished"></translation>
</message>
@ -1174,17 +1251,17 @@
<context>
<name>QtEntityPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8268"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8675"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8275"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8682"/>
<source>Visible</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8282"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8689"/>
<source>Transform</source>
<translation type="unfinished"></translation>
</message>
@ -1205,37 +1282,37 @@
<context>
<name>QtFontPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6675"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6676"/>
<source>Family</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6693"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6694"/>
<source>Point Size</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6701"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6702"/>
<source>Bold</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6708"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6709"/>
<source>Italic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6715"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6716"/>
<source>Underline</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6722"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6723"/>
<source>Strikeout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6729"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6730"/>
<source>Kerning</source>
<translation type="unfinished"></translation>
</message>
@ -1243,22 +1320,22 @@
<context>
<name>QtLocalePropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3108"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3109"/>
<source>&lt;Invalid&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3116"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3117"/>
<source>%1, %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3166"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3167"/>
<source>Language</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3174"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3175"/>
<source>Country</source>
<translation type="unfinished"></translation>
</message>
@ -1266,13 +1343,13 @@
<context>
<name>QtMeshComponetManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8399"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8408"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8806"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8815"/>
<source>MeshComponent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8481"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8888"/>
<source>Mesh</source>
<translation type="unfinished"></translation>
</message>
@ -1280,27 +1357,27 @@
<context>
<name>QtModelBasePropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7814"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7815"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7821"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7822"/>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7828"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7829"/>
<source>Inflow</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7835"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7836"/>
<source>InnerBottomElevation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7842"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7843"/>
<source>Visible</source>
<translation type="unfinished"></translation>
</message>
@ -1321,13 +1398,13 @@
<context>
<name>QtPathComponentManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8558"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8567"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8965"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8974"/>
<source>PathComponent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8640"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="9047"/>
<source>Path</source>
<translation type="unfinished"></translation>
</message>
@ -1335,17 +1412,17 @@
<context>
<name>QtPointFPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3594"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3595"/>
<source>(%1, %2)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3665"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3666"/>
<source>X</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3673"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3674"/>
<source>Y</source>
<translation type="unfinished"></translation>
</message>
@ -1353,17 +1430,17 @@
<context>
<name>QtPointPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3349"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3350"/>
<source>(%1, %2)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3386"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3387"/>
<source>X</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3393"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3394"/>
<source>Y</source>
<translation type="unfinished"></translation>
</message>
@ -1381,12 +1458,12 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7365"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7366"/>
<source>[%1, %2, %3]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7582"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7583"/>
<source>[%1, %2, %3] [%4, %5, %6] [%7, %8, %9]</source>
<translation type="unfinished"></translation>
</message>
@ -1394,27 +1471,27 @@
<context>
<name>QtRectFPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5127"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5128"/>
<source>[(%1, %2), %3 x %4]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5283"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5284"/>
<source>X</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5291"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5292"/>
<source>Y</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5299"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5300"/>
<source>Width</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5308"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="5309"/>
<source>Height</source>
<translation type="unfinished"></translation>
</message>
@ -1422,27 +1499,27 @@
<context>
<name>QtRectPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4688"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4689"/>
<source>[(%1, %2), %3 x %4]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4808"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4809"/>
<source>X</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4815"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4816"/>
<source>Y</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4822"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4823"/>
<source>Width</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4830"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4831"/>
<source>Height</source>
<translation type="unfinished"></translation>
</message>
@ -1450,17 +1527,17 @@
<context>
<name>QtSizeFPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4287"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4288"/>
<source>%1 x %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4417"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4418"/>
<source>Width</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4426"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4427"/>
<source>Height</source>
<translation type="unfinished"></translation>
</message>
@ -1468,33 +1545,33 @@
<context>
<name>QtSizePolicyPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6166"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6167"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6168"/>
<source>&lt;Invalid&gt;</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6168"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6169"/>
<source>[%1, %2, %3, %4]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6213"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6214"/>
<source>Horizontal Policy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6222"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6223"/>
<source>Vertical Policy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6231"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6232"/>
<source>Horizontal Stretch</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6239"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="6240"/>
<source>Vertical Stretch</source>
<translation type="unfinished"></translation>
</message>
@ -1502,17 +1579,17 @@
<context>
<name>QtSizePropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3918"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="3919"/>
<source>%1 x %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4014"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4015"/>
<source>Width</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4022"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="4023"/>
<source>Height</source>
<translation type="unfinished"></translation>
</message>
@ -1528,17 +1605,17 @@
<context>
<name>QtTransfromPropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7593"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7594"/>
<source>Location</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7600"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7601"/>
<source>Rotation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7607"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7608"/>
<source>Scale</source>
<translation type="unfinished"></translation>
</message>
@ -1559,17 +1636,17 @@
<context>
<name>QtVec3PropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7374"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7375"/>
<source>X</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7381"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7382"/>
<source>Y</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7388"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="7389"/>
<source>Z</source>
<translation type="unfinished"></translation>
</message>
@ -1577,20 +1654,90 @@
<context>
<name>QtWorkspacePropertyManager</name>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8048"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8282"/>
<source>Name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8055"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8289"/>
<source>Description</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8062"/>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8296"/>
<source>Timestep</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8303"/>
<source>SimMatlab</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8310"/>
<source>MatlabParam</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8317"/>
<source>WavePath</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8324"/>
<source>ReportPath</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8331"/>
<source>RDPath</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8354"/>
<source>Count</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8370"/>
<source>Curve[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8371"/>
<source>Surface[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8372"/>
<source>Table[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8373"/>
<source>Light[%1]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8384"/>
<source>Curves</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8387"/>
<source>Surfaces</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8390"/>
<source>Tables</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ui/PropertyBrowser/qtpropertymanager.cpp" line="8393"/>
<source>Lights</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SignalIndicatorLampUI</name>

View File

@ -86,7 +86,6 @@ void MainWindow::InitUI() {
addDockWidget(Qt::LeftDockWidgetArea, viewDock);
m_mapDockWidget.insert("MainView", viewDock);
// 左侧模型面板,并与主视图横向并排(类似 VS 左侧工具 + 中间视图)
addDockWidget(Qt::LeftDockWidgetArea, model);
splitDockWidget(model, viewDock, Qt::Horizontal);

View File

@ -12,6 +12,7 @@
#include "common/SpdLogger.h"
#include "workspace/WorkSpace.h"
#include "workspace/WorkSpaceManager.h"
#include "workspace/FileEntry.h"
#include "utils/FileUtils.h"
#include "ui_FileManagerMenu.h"
@ -32,6 +33,12 @@ void FileManagerMenu::InitConnect() {
connect(ui->menu_new_file, &QToolButton::clicked, this, &FileManagerMenu::NewWorkSpace);
connect(ui->menu_open_file, &QToolButton::clicked, this, &FileManagerMenu::OpenWorkSpace);
connect(ui->menu_save_file, &QToolButton::clicked, this, &FileManagerMenu::SaveWorkSpace);
// add file entity buttons
connect(ui->menu_wave_file, &QToolButton::clicked, this, &FileManagerMenu::AddWaveFile);
connect(ui->menu_surface_file, &QToolButton::clicked, this, &FileManagerMenu::AddSurfaceFile);
connect(ui->menu_table_file, &QToolButton::clicked, this, &FileManagerMenu::AddTableFile);
connect(ui->menu_light_file, &QToolButton::clicked, this, &FileManagerMenu::AddLightFile);
}
void FileManagerMenu::NewWorkSpace() {
@ -70,19 +77,94 @@ void FileManagerMenu::SaveWorkSpace() {
QString dytFile = workspace->GetPath();
LOG_INFO("save {} dyt file: {}", name.toLocal8Bit().constData(),
dytFile.toLocal8Bit().constData());
/* if (!FileUtils::IsExist(dytFile)) {
QString selfilter = tr("Dyt (*.dyt)");
const QString workspacePath = Application::GetWorkSpacePath();
dytFile = QFileDialog::getSaveFileName(&MainFrame::Get(), tr("save dyt file"), workspacePath,
tr("Dyt (*.dyt);;All files (*.*)"),
&selfilter);
LOG_INFO("user select file: {}", dytFile.toLocal8Bit().constData());
if (dytFile.isEmpty()) {
return;
}
}*/
bool success = workspace->Save(dytFile);
LOG_INFO("save dyt: {}", success);
}
void FileManagerMenu::AddWaveFile() {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("please create workspace first"));
return;
}
switch (current->CreateFileEntry(FileEntryType::Curve)) {
case WorkSpace::FileEntryResult::Ok:
break;
case WorkSpace::FileEntryResult::LimitExceeded:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("up to 9 files allowed for this type"));
break;
case WorkSpace::FileEntryResult::Duplicate:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("file already added for this type"));
break;
case WorkSpace::FileEntryResult::CopyFailed:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("copy file failed"));
break;
}
}
void FileManagerMenu::AddSurfaceFile() {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("please create workspace first"));
return;
}
switch (current->CreateFileEntry(FileEntryType::Surface)) {
case WorkSpace::FileEntryResult::Ok:
break;
case WorkSpace::FileEntryResult::LimitExceeded:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("up to 9 files allowed for this type"));
break;
case WorkSpace::FileEntryResult::Duplicate:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("file already added for this type"));
break;
case WorkSpace::FileEntryResult::CopyFailed:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("copy file failed"));
break;
}
}
void FileManagerMenu::AddTableFile() {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("please create workspace first"));
return;
}
switch (current->CreateFileEntry(FileEntryType::Table)) {
case WorkSpace::FileEntryResult::Ok:
break;
case WorkSpace::FileEntryResult::LimitExceeded:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("up to 9 files allowed for this type"));
break;
case WorkSpace::FileEntryResult::Duplicate:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("file already added for this type"));
break;
case WorkSpace::FileEntryResult::CopyFailed:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("copy file failed"));
break;
}
}
void FileManagerMenu::AddLightFile() {
auto current = WorkSpaceManager::Get().GetCurrent();
if (nullptr == current) {
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("please create workspace first"));
return;
}
switch (current->CreateFileEntry(FileEntryType::Light)) {
case WorkSpace::FileEntryResult::Ok:
break;
case WorkSpace::FileEntryResult::LimitExceeded:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("up to 9 files allowed for this type"));
break;
case WorkSpace::FileEntryResult::Duplicate:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("file already added for this type"));
break;
case WorkSpace::FileEntryResult::CopyFailed:
QMessageBox::information(&MainFrame::Get(), tr("prompt"), tr("copy file failed"));
break;
}
}

View File

@ -24,6 +24,11 @@ private:
void OpenWorkSpace();
void SaveWorkSpace();
void AddWaveFile();
void AddSurfaceFile();
void AddTableFile();
void AddLightFile();
private:
Ui::FileManagerMenu* ui;
};

View File

@ -56,6 +56,14 @@ void PropertyBrowser::OnWorkSpaceChange(const QVariant& value) {
QWorkspaceAttribute worksapceAttribute(workspace);
workSpaceManager_->setValue(property, worksapceAttribute);
addProperty(property, tr("WorkSpace"));
// Track and react to runtime workspace changes
if (currentWorkspace_) {
QObject::disconnect(currentWorkspace_, nullptr, this, nullptr);
}
currentWorkspace_ = workspace;
QObject::connect(currentWorkspace_, &WorkSpace::FilesChanged,
this, &PropertyBrowser::OnWorkspaceFilesChanged);
}
void PropertyBrowser::OnEntityChange(const QVariant& value) {
@ -152,6 +160,8 @@ void PropertyBrowser::InitPropertyManager() {
browser_->setFactoryForManager(sizeManager_->subIntPropertyManager(), spinBoxFactory);
browser_->setFactoryForManager(workSpaceManager_->subStringProperyManager(), lineEditFactory);
browser_->setFactoryForManager(workSpaceManager_->subFilesProperyManager(), filePathFactory);
// Enable editing for grouped file entry counts
browser_->setFactoryForManager(workSpaceManager_->subIntProperyManager(), spinBoxFactory);
browser_->setFactoryForManager(entityManager_->subStringProperyManager(), lineEditFactory);
browser_->setFactoryForManager(entityManager_->subBoolProperyManager(), checkBoxFactory);
browser_->setFactoryForManager(
@ -165,6 +175,16 @@ void PropertyBrowser::InitPropertyManager() {
doubleSpinBoxFactory);
}
void PropertyBrowser::OnWorkspaceFilesChanged(FileEntryType /*type*/) {
if (!currentWorkspace_) return;
auto it = idToProperty_.find(tr("WorkSpace"));
if (it == idToProperty_.end()) return;
QtProperty* property = it.value();
QWorkspaceAttribute worksapceAttribute(currentWorkspace_);
// Refresh the full workspace property tree to reflect new counts/paths
workSpaceManager_->setValue(property, worksapceAttribute);
}
void PropertyBrowser::InitComponentPropertyManager() {
QtDoubleSpinBoxFactory* doubleSpinBoxFactory = new QtDoubleSpinBoxFactory(this);
QtCheckBoxFactory* checkBoxFactory = new QtCheckBoxFactory(this);

View File

@ -2,6 +2,7 @@
#include <QWidget>
#include <QMap>
#include "workspace/FileEntry.h"
class QtProperty;
@ -17,6 +18,7 @@ public:
void OnWorkSpaceChange(const QVariant& value);
void OnEntityChange(const QVariant& value);
void OnWorkspaceFilesChanged(enum class FileEntryType type);
void Test();
@ -49,5 +51,8 @@ private:
QMap<QString, bool> idToExpanded_;
QMap<QString, class QtComponentPropertyManager*> componetManager_;
// Track current workspace for real-time refresh
class WorkSpace* currentWorkspace_{ nullptr };
};

View File

@ -42,6 +42,7 @@
#include <QtCore/QDateTime>
#include <QtCore/QLocale>
#include <QtCore/QMap>
#include <QtCore/QVector>
#include <QtCore/QTimer>
#include <QtCore/QRegularExpression>
#include <QtGui/QIcon>
@ -7893,35 +7894,84 @@ void QtModelBasePropertyManager::uninitializeProperty(QtProperty* property) {
#pragma region QtWorkspacePropertyManager
class QtWorkspacePropertyManagerPrivate {
QtWorkspacePropertyManager* q_ptr;
Q_DECLARE_PUBLIC(QtWorkspacePropertyManager)
QtWorkspacePropertyManager* q_ptr;
Q_DECLARE_PUBLIC(QtWorkspacePropertyManager)
public:
void slotStringChanged(QtProperty* property, QString value);
void slotStringChanged(QtProperty* property, QString value);
void slotIntChanged(QtProperty* property, int value);
void slotPropertyDestroyed(QtProperty* property);
void slotPropertyDestroyed(QtProperty* property);
typedef QMap<const QtProperty*, QWorkspaceAttribute> PropertyValueMap;
PropertyValueMap m_values;
typedef QMap<const QtProperty*, QWorkspaceAttribute> PropertyValueMap;
PropertyValueMap m_values;
QtStringPropertyManager* m_stringProperyManager;
QtFilesPropertyManager* m_filesProperyManager;
QtStringPropertyManager* m_stringProperyManager;
QtFilesPropertyManager* m_filesProperyManager;
QtIntPropertyManager* m_intProperyManager{ nullptr };
QtGroupPropertyManager* m_groupProperyManager{ nullptr };
QMap<const QtProperty*, QtProperty*> m_properyToName;
QMap<const QtProperty*, QtProperty*> m_properyToDescription;
QMap<const QtProperty*, QtProperty*> m_properyToTimestep;
QMap<const QtProperty*, QtProperty*> m_properyToName;
QMap<const QtProperty*, QtProperty*> m_properyToDescription;
QMap<const QtProperty*, QtProperty*> m_properyToTimestep;
QMap<const QtProperty*, QtProperty*> m_properyToSimMatlab;
QMap<const QtProperty*, QtProperty*> m_properyToMatlabParam;
QMap<const QtProperty*, QtProperty*> m_properyToWavePath;
QMap<const QtProperty*, QtProperty*> m_properyToReportPath;
QMap<const QtProperty*, QtProperty*> m_properyToRDPath;
QMap<const QtProperty*, QtProperty*> m_nameToPropery;
QMap<const QtProperty*, QtProperty*> m_descriptionToPropery;
QMap<const QtProperty*, QtProperty*> m_timestepToPropery;
QMap<const QtProperty*, QtProperty*> m_nameToPropery;
QMap<const QtProperty*, QtProperty*> m_descriptionToPropery;
QMap<const QtProperty*, QtProperty*> m_timestepToPropery;
QMap<const QtProperty*, QtProperty*> m_simMatlabToPropery;
QMap<const QtProperty*, QtProperty*> m_matlabParamToPropery;
QMap<const QtProperty*, QtProperty*> m_wavePathToPropery;
QMap<const QtProperty*, QtProperty*> m_reportPathToPropery;
QMap<const QtProperty*, QtProperty*> m_rdPathToPropery;
// Grouped file entries: Curve
QMap<const QtProperty*, QtProperty*> m_properyToCurveGroup;
QMap<const QtProperty*, QtProperty*> m_curveGroupToPropery;
QMap<const QtProperty*, QtProperty*> m_properyToCurveCount;
QMap<const QtProperty*, QtProperty*> m_curveCountToPropery;
QMap<const QtProperty*, QVector<QtProperty*>> m_properyToCurvePaths;
QMap<const QtProperty*, QtProperty*> m_curvePathToPropery;
QMap<const QtProperty*, int> m_curvePathIndex;
// Surface
QMap<const QtProperty*, QtProperty*> m_properyToSurfaceGroup;
QMap<const QtProperty*, QtProperty*> m_surfaceGroupToPropery;
QMap<const QtProperty*, QtProperty*> m_properyToSurfaceCount;
QMap<const QtProperty*, QtProperty*> m_surfaceCountToPropery;
QMap<const QtProperty*, QVector<QtProperty*>> m_properyToSurfacePaths;
QMap<const QtProperty*, QtProperty*> m_surfacePathToPropery;
QMap<const QtProperty*, int> m_surfacePathIndex;
// Table
QMap<const QtProperty*, QtProperty*> m_properyToTableGroup;
QMap<const QtProperty*, QtProperty*> m_tableGroupToPropery;
QMap<const QtProperty*, QtProperty*> m_properyToTableCount;
QMap<const QtProperty*, QtProperty*> m_tableCountToPropery;
QMap<const QtProperty*, QVector<QtProperty*>> m_properyToTablePaths;
QMap<const QtProperty*, QtProperty*> m_tablePathToPropery;
QMap<const QtProperty*, int> m_tablePathIndex;
// Light
QMap<const QtProperty*, QtProperty*> m_properyToLightGroup;
QMap<const QtProperty*, QtProperty*> m_lightGroupToPropery;
QMap<const QtProperty*, QtProperty*> m_properyToLightCount;
QMap<const QtProperty*, QtProperty*> m_lightCountToPropery;
QMap<const QtProperty*, QVector<QtProperty*>> m_properyToLightPaths;
QMap<const QtProperty*, QtProperty*> m_lightPathToPropery;
QMap<const QtProperty*, int> m_lightPathIndex;
};
void QtWorkspacePropertyManagerPrivate::slotStringChanged(QtProperty* property, QString value) {
if (QtProperty* prop = m_nameToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetName(value);
q_ptr->setValue(prop, c);
if (QtProperty* prop = m_nameToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetName(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_descriptionToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetDescription(value);
@ -7930,9 +7980,102 @@ void QtWorkspacePropertyManagerPrivate::slotStringChanged(QtProperty* property,
QWorkspaceAttribute c = m_values[prop];
c.SetTimeStep(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_simMatlabToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetSimMatlab(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_matlabParamToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetMatlabParam(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_wavePathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetWavePath(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_reportPathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetReportPath(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_rdPathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
c.SetRDPath(value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_curvePathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
int idx = m_curvePathIndex.value(property, 0);
c.SetFileEntryPath(FileEntryType::Curve, idx, value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_surfacePathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
int idx = m_surfacePathIndex.value(property, 0);
c.SetFileEntryPath(FileEntryType::Surface, idx, value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_tablePathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
int idx = m_tablePathIndex.value(property, 0);
c.SetFileEntryPath(FileEntryType::Table, idx, value);
q_ptr->setValue(prop, c);
} else if (QtProperty* prop = m_lightPathToPropery.value(property, 0)) {
QWorkspaceAttribute c = m_values[prop];
int idx = m_lightPathIndex.value(property, 0);
c.SetFileEntryPath(FileEntryType::Light, idx, value);
q_ptr->setValue(prop, c);
}
}
void QtWorkspacePropertyManagerPrivate::slotIntChanged(QtProperty* property, int value) {
// Determine which type this count property belongs to
auto handleType = [&](FileEntryType type,
QMap<const QtProperty*, QtProperty*>& countToProp,
QMap<const QtProperty*, QVector<QtProperty*>>& propToPaths,
QMap<const QtProperty*, QtProperty*>& pathToProp,
QMap<const QtProperty*, int>& pathIndex,
QMap<const QtProperty*, QtProperty*>& propToGroup) {
if (QtProperty* root = countToProp.value(property, nullptr)) {
// Adjust UI path properties to match new count
QVector<QtProperty*>& paths = propToPaths[root];
int current = paths.size();
// Add new path properties
if (value > current) {
QtProperty* group = propToGroup.value(root, nullptr);
for (int i = current; i < value; ++i) {
QtProperty* p = m_filesProperyManager->addProperty();
QString title;
switch (type) {
case FileEntryType::Curve: title = QObject::tr("Curve[%1]").arg(i + 1); break;
case FileEntryType::Surface: title = QObject::tr("Surface[%1]").arg(i + 1); break;
case FileEntryType::Table: title = QObject::tr("Table[%1]").arg(i + 1); break;
case FileEntryType::Light: title = QObject::tr("Light[%1]").arg(i + 1); break;
}
p->setPropertyName(title);
group->addSubProperty(p);
paths.append(p);
pathToProp[p] = root;
pathIndex[p] = i;
}
} else if (value < current) {
// Remove excess path properties
for (int i = current - 1; i >= value; --i) {
QtProperty* p = paths.at(i);
pathIndex.remove(p);
pathToProp.remove(p);
paths.remove(i);
delete p;
}
}
// Update underlying model count
QWorkspaceAttribute c = m_values[root];
c.SetFileEntryCount(type, value);
q_ptr->setValue(root, c);
}
};
handleType(FileEntryType::Curve, m_curveCountToPropery, m_properyToCurvePaths, m_curvePathToPropery, m_curvePathIndex, m_properyToCurveGroup);
handleType(FileEntryType::Surface, m_surfaceCountToPropery, m_properyToSurfacePaths, m_surfacePathToPropery, m_surfacePathIndex, m_properyToSurfaceGroup);
handleType(FileEntryType::Table, m_tableCountToPropery, m_properyToTablePaths, m_tablePathToPropery, m_tablePathIndex, m_properyToTableGroup);
handleType(FileEntryType::Light, m_lightCountToPropery, m_properyToLightPaths, m_lightPathToPropery, m_lightPathIndex, m_properyToLightGroup);
}
void QtWorkspacePropertyManagerPrivate::slotPropertyDestroyed(QtProperty* property) {
if (QtProperty* subProp = m_nameToPropery.value(property, nullptr)) {
m_nameToPropery[subProp] = 0;
@ -7944,22 +8087,47 @@ void QtWorkspacePropertyManagerPrivate::slotPropertyDestroyed(QtProperty* proper
m_descriptionToPropery.remove(property);
}
if (QtProperty* subProp = m_timestepToPropery.value(property, nullptr)) {
m_timestepToPropery[subProp] = 0;
m_timestepToPropery.remove(property);
}
if (QtProperty* subProp = m_timestepToPropery.value(property, nullptr)) {
m_timestepToPropery[subProp] = 0;
m_timestepToPropery.remove(property);
}
if (QtProperty* subProp = m_simMatlabToPropery.value(property, nullptr)) {
m_simMatlabToPropery[subProp] = 0;
m_simMatlabToPropery.remove(property);
}
if (QtProperty* subProp = m_matlabParamToPropery.value(property, nullptr)) {
m_matlabParamToPropery[subProp] = 0;
m_matlabParamToPropery.remove(property);
}
if (QtProperty* subProp = m_wavePathToPropery.value(property, nullptr)) {
m_wavePathToPropery[subProp] = 0;
m_wavePathToPropery.remove(property);
}
if (QtProperty* subProp = m_reportPathToPropery.value(property, nullptr)) {
m_reportPathToPropery[subProp] = 0;
m_reportPathToPropery.remove(property);
}
if (QtProperty* subProp = m_rdPathToPropery.value(property, nullptr)) {
m_rdPathToPropery[subProp] = 0;
m_rdPathToPropery.remove(property);
}
}
QtWorkspacePropertyManager::QtWorkspacePropertyManager(QObject* parent)
: QtAbstractPropertyManager(parent), d_ptr(new QtWorkspacePropertyManagerPrivate) {
d_ptr->q_ptr = this;
: QtAbstractPropertyManager(parent), d_ptr(new QtWorkspacePropertyManagerPrivate) {
d_ptr->q_ptr = this;
d_ptr->m_stringProperyManager = new QtStringPropertyManager(this);
connect(d_ptr->m_stringProperyManager, SIGNAL(valueChanged(QtProperty*, QString)),
this, SLOT(slotStringChanged(QtProperty*, QString)));
d_ptr->m_stringProperyManager = new QtStringPropertyManager(this);
connect(d_ptr->m_stringProperyManager, SIGNAL(valueChanged(QtProperty*, QString)),
this, SLOT(slotStringChanged(QtProperty*, QString)));
d_ptr->m_filesProperyManager = new QtFilesPropertyManager(this);
connect(d_ptr->m_filesProperyManager, SIGNAL(valueChanged(QtProperty*, QString)),
this, SLOT(slotStringChanged(QtProperty*, QString)));
d_ptr->m_intProperyManager = new QtIntPropertyManager(this);
connect(d_ptr->m_intProperyManager, SIGNAL(valueChanged(QtProperty*, int)),
this, SLOT(slotIntChanged(QtProperty*, int)));
d_ptr->m_groupProperyManager = new QtGroupPropertyManager(this);
}
/*!
@ -7982,11 +8150,19 @@ QWorkspaceAttribute QtWorkspacePropertyManager::value(const QtProperty* property
}
QtStringPropertyManager* QtWorkspacePropertyManager::subStringProperyManager() const {
return d_ptr->m_stringProperyManager;
return d_ptr->m_stringProperyManager;
}
QtFilesPropertyManager* QtWorkspacePropertyManager::subFilesProperyManager() const {
return d_ptr->m_filesProperyManager;
return d_ptr->m_filesProperyManager;
}
QtIntPropertyManager* QtWorkspacePropertyManager::subIntProperyManager() const {
return d_ptr->m_intProperyManager;
}
QtGroupPropertyManager* QtWorkspacePropertyManager::subGroupProperyManager() const {
return d_ptr->m_groupProperyManager;
}
/*!
@ -8019,30 +8195,88 @@ QIcon QtWorkspacePropertyManager::valueIcon(const QtProperty* property) const {
\sa value(), valueChanged()
*/
void QtWorkspacePropertyManager::setValue(QtProperty* property, const QWorkspaceAttribute& value) {
const QtWorkspacePropertyManagerPrivate::PropertyValueMap::iterator it = d_ptr->m_values.find(property);
if (it == d_ptr->m_values.end())
return;
const QtWorkspacePropertyManagerPrivate::PropertyValueMap::iterator it = d_ptr->m_values.find(property);
if (it == d_ptr->m_values.end())
return;
if (it.value() == value)
return;
if (it.value() == value)
return;
it.value() = value;
it.value() = value;
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToName[property], value.GetName());
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToDescription[property], value.GetDescription());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToTimestep[property], value.GetTimeStep());
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToName[property], value.GetName());
d_ptr->m_stringProperyManager->setValue(d_ptr->m_properyToDescription[property], value.GetDescription());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToTimestep[property], value.GetTimeStep());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToSimMatlab[property], value.GetSimMatlab());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToMatlabParam[property], value.GetMatlabParam());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToWavePath[property], value.GetWavePath());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToReportPath[property], value.GetReportPath());
d_ptr->m_filesProperyManager->setValue(d_ptr->m_properyToRDPath[property], value.GetRDPath());
emit propertyChanged(property);
emit valueChanged(property, value);
auto syncGroup = [&](FileEntryType type,
QMap<const QtProperty*, QtProperty*>& propToGroup,
QMap<const QtProperty*, QtProperty*>& propToCount,
QMap<const QtProperty*, QVector<QtProperty*>>& propToPaths,
QMap<const QtProperty*, QtProperty*>& pathToProp,
QMap<const QtProperty*, int>& pathIndex) {
QtProperty* group = propToGroup.value(property, nullptr);
if (!group) return;
auto entries = value.GetFileEntries(type);
int count = static_cast<int>(entries.size());
// update count without triggering slot
QtProperty* countProp = propToCount.value(property, nullptr);
if (countProp) d_ptr->m_intProperyManager->setValueOnly(countProp, count);
QVector<QtProperty*>& paths = propToPaths[property];
int current = paths.size();
// expand
if (count > current) {
for (int i = current; i < count; ++i) {
QtProperty* p = d_ptr->m_filesProperyManager->addProperty();
QString title;
switch (type) {
case FileEntryType::Curve: title = QObject::tr("Curve[%1]").arg(i + 1); break;
case FileEntryType::Surface: title = QObject::tr("Surface[%1]").arg(i + 1); break;
case FileEntryType::Table: title = QObject::tr("Table[%1]").arg(i + 1); break;
case FileEntryType::Light: title = QObject::tr("Light[%1]").arg(i + 1); break;
}
p->setPropertyName(title);
group->addSubProperty(p);
paths.append(p);
pathToProp[p] = property;
pathIndex[p] = i;
}
} else if (count < current) {
for (int i = current - 1; i >= count; --i) {
QtProperty* p = paths.at(i);
pathIndex.remove(p);
pathToProp.remove(p);
paths.remove(i);
delete p;
}
}
// set values
for (int i = 0; i < count; ++i) {
const QString absPath = value.GetFileEntryAbsPath(type, i);
d_ptr->m_filesProperyManager->setValueOnly(paths.at(i), absPath);
}
};
syncGroup(FileEntryType::Curve, d_ptr->m_properyToCurveGroup, d_ptr->m_properyToCurveCount, d_ptr->m_properyToCurvePaths, d_ptr->m_curvePathToPropery, d_ptr->m_curvePathIndex);
syncGroup(FileEntryType::Surface, d_ptr->m_properyToSurfaceGroup, d_ptr->m_properyToSurfaceCount, d_ptr->m_properyToSurfacePaths, d_ptr->m_surfacePathToPropery, d_ptr->m_surfacePathIndex);
syncGroup(FileEntryType::Table, d_ptr->m_properyToTableGroup, d_ptr->m_properyToTableCount, d_ptr->m_properyToTablePaths, d_ptr->m_tablePathToPropery, d_ptr->m_tablePathIndex);
syncGroup(FileEntryType::Light, d_ptr->m_properyToLightGroup, d_ptr->m_properyToLightCount, d_ptr->m_properyToLightPaths, d_ptr->m_lightPathToPropery, d_ptr->m_lightPathIndex);
emit propertyChanged(property);
emit valueChanged(property, value);
}
/*!
\reimp
*/
void QtWorkspacePropertyManager::initializeProperty(QtProperty* property) {
QWorkspaceAttribute val;
d_ptr->m_values[property] = val;
QWorkspaceAttribute val;
d_ptr->m_values[property] = val;
QtProperty* prop = d_ptr->m_stringProperyManager->addProperty();
prop->setPropertyName(tr("Name"));
@ -8064,18 +8298,113 @@ void QtWorkspacePropertyManager::initializeProperty(QtProperty* property) {
d_ptr->m_properyToTimestep[property] = prop;
d_ptr->m_timestepToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("SimMatlab"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetSimMatlab());
d_ptr->m_properyToSimMatlab[property] = prop;
d_ptr->m_simMatlabToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("MatlabParam"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetMatlabParam());
d_ptr->m_properyToMatlabParam[property] = prop;
d_ptr->m_matlabParamToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("WavePath"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetWavePath());
d_ptr->m_properyToWavePath[property] = prop;
d_ptr->m_wavePathToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("ReportPath"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetReportPath());
d_ptr->m_properyToReportPath[property] = prop;
d_ptr->m_reportPathToPropery[prop] = property;
property->addSubProperty(prop);
prop = d_ptr->m_filesProperyManager->addProperty();
prop->setPropertyName(tr("RDPath"));
d_ptr->m_filesProperyManager->setValueOnly(prop, val.GetRDPath());
d_ptr->m_properyToRDPath[property] = prop;
d_ptr->m_rdPathToPropery[prop] = property;
property->addSubProperty(prop);
// Add grouped file sections
auto addGroup = [&](FileEntryType type, const QString& groupName,
QMap<const QtProperty*, QtProperty*>& propToGroup,
QMap<const QtProperty*, QtProperty*>& groupToProp,
QMap<const QtProperty*, QtProperty*>& propToCount,
QMap<const QtProperty*, QtProperty*>& countToProp,
QMap<const QtProperty*, QVector<QtProperty*>>& propToPaths,
QMap<const QtProperty*, QtProperty*>& pathToProp,
QMap<const QtProperty*, int>& pathIndex) {
QtProperty* group = d_ptr->m_groupProperyManager->addProperty();
group->setPropertyName(groupName);
property->addSubProperty(group);
propToGroup[property] = group;
groupToProp[group] = property;
// Count property
QtProperty* countProp = d_ptr->m_intProperyManager->addProperty();
countProp->setPropertyName(tr("Count"));
d_ptr->m_intProperyManager->setRange(countProp, 0, 1024);
// initial count from workspace
int initialCount = static_cast<int>(val.GetFileEntries(type).size());
d_ptr->m_intProperyManager->setValueOnly(countProp, initialCount);
propToCount[property] = countProp;
countToProp[countProp] = property;
group->addSubProperty(countProp);
// initial paths
auto entries = val.GetFileEntries(type);
QVector<QtProperty*>& paths = propToPaths[property];
for (int i = 0; i < static_cast<int>(entries.size()); ++i) {
QtProperty* p = d_ptr->m_filesProperyManager->addProperty();
QString title;
switch (type) {
case FileEntryType::Curve: title = tr("Curve[%1]").arg(i + 1); break;
case FileEntryType::Surface: title = tr("Surface[%1]").arg(i + 1); break;
case FileEntryType::Table: title = tr("Table[%1]").arg(i + 1); break;
case FileEntryType::Light: title = tr("Light[%1]").arg(i + 1); break;
}
p->setPropertyName(title);
d_ptr->m_filesProperyManager->setValueOnly(p, val.GetFileEntryAbsPath(type, i));
group->addSubProperty(p);
paths.append(p);
pathToProp[p] = property;
pathIndex[p] = i;
}
};
addGroup(FileEntryType::Curve, tr("Curves"), d_ptr->m_properyToCurveGroup, d_ptr->m_curveGroupToPropery,
d_ptr->m_properyToCurveCount, d_ptr->m_curveCountToPropery,
d_ptr->m_properyToCurvePaths, d_ptr->m_curvePathToPropery, d_ptr->m_curvePathIndex);
addGroup(FileEntryType::Surface, tr("Surfaces"), d_ptr->m_properyToSurfaceGroup, d_ptr->m_surfaceGroupToPropery,
d_ptr->m_properyToSurfaceCount, d_ptr->m_surfaceCountToPropery,
d_ptr->m_properyToSurfacePaths, d_ptr->m_surfacePathToPropery, d_ptr->m_surfacePathIndex);
addGroup(FileEntryType::Table, tr("Tables"), d_ptr->m_properyToTableGroup, d_ptr->m_tableGroupToPropery,
d_ptr->m_properyToTableCount, d_ptr->m_tableCountToPropery,
d_ptr->m_properyToTablePaths, d_ptr->m_tablePathToPropery, d_ptr->m_tablePathIndex);
addGroup(FileEntryType::Light, tr("Lights"), d_ptr->m_properyToLightGroup, d_ptr->m_lightGroupToPropery,
d_ptr->m_properyToLightCount, d_ptr->m_lightCountToPropery,
d_ptr->m_properyToLightPaths, d_ptr->m_lightPathToPropery, d_ptr->m_lightPathIndex);
}
/*!
\reimp
*/
void QtWorkspacePropertyManager::uninitializeProperty(QtProperty* property) {
QtProperty* prop = d_ptr->m_nameToPropery[property];
if (prop) {
d_ptr->m_nameToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToName.remove(property);
QtProperty* prop = d_ptr->m_nameToPropery[property];
if (prop) {
d_ptr->m_nameToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToName.remove(property);
prop = d_ptr->m_descriptionToPropery[property];
if (prop) {
@ -8090,6 +8419,84 @@ void QtWorkspacePropertyManager::uninitializeProperty(QtProperty* property) {
delete prop;
}
d_ptr->m_properyToTimestep.remove(property);
prop = d_ptr->m_simMatlabToPropery[property];
if (prop) {
d_ptr->m_simMatlabToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToSimMatlab.remove(property);
prop = d_ptr->m_matlabParamToPropery[property];
if (prop) {
d_ptr->m_matlabParamToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToMatlabParam.remove(property);
prop = d_ptr->m_wavePathToPropery[property];
if (prop) {
d_ptr->m_wavePathToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToWavePath.remove(property);
prop = d_ptr->m_reportPathToPropery[property];
if (prop) {
d_ptr->m_reportPathToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToReportPath.remove(property);
prop = d_ptr->m_rdPathToPropery[property];
if (prop) {
d_ptr->m_rdPathToPropery.remove(prop);
delete prop;
}
d_ptr->m_properyToRDPath.remove(property);
// Cleanup grouped file properties
auto cleanupGroup = [&](QMap<const QtProperty*, QtProperty*>& propToGroup,
QMap<const QtProperty*, QtProperty*>& groupToProp,
QMap<const QtProperty*, QtProperty*>& propToCount,
QMap<const QtProperty*, QtProperty*>& countToProp,
QMap<const QtProperty*, QVector<QtProperty*>>& propToPaths,
QMap<const QtProperty*, QtProperty*>& pathToProp,
QMap<const QtProperty*, int>& pathIndex) {
QtProperty* group = propToGroup.value(property, nullptr);
if (group) {
propToGroup.remove(property);
groupToProp.remove(group);
}
QtProperty* countProp = propToCount.value(property, nullptr);
if (countProp) {
countToProp.remove(countProp);
propToCount.remove(property);
delete countProp;
}
QVector<QtProperty*>& paths = propToPaths[property];
for (QtProperty* p : paths) {
pathIndex.remove(p);
pathToProp.remove(p);
delete p;
}
paths.clear();
propToPaths.remove(property);
if (group) delete group;
};
cleanupGroup(d_ptr->m_properyToCurveGroup, d_ptr->m_curveGroupToPropery,
d_ptr->m_properyToCurveCount, d_ptr->m_curveCountToPropery,
d_ptr->m_properyToCurvePaths, d_ptr->m_curvePathToPropery, d_ptr->m_curvePathIndex);
cleanupGroup(d_ptr->m_properyToSurfaceGroup, d_ptr->m_surfaceGroupToPropery,
d_ptr->m_properyToSurfaceCount, d_ptr->m_surfaceCountToPropery,
d_ptr->m_properyToSurfacePaths, d_ptr->m_surfacePathToPropery, d_ptr->m_surfacePathIndex);
cleanupGroup(d_ptr->m_properyToTableGroup, d_ptr->m_tableGroupToPropery,
d_ptr->m_properyToTableCount, d_ptr->m_tableCountToPropery,
d_ptr->m_properyToTablePaths, d_ptr->m_tablePathToPropery, d_ptr->m_tablePathIndex);
cleanupGroup(d_ptr->m_properyToLightGroup, d_ptr->m_lightGroupToPropery,
d_ptr->m_properyToLightCount, d_ptr->m_lightCountToPropery,
d_ptr->m_properyToLightPaths, d_ptr->m_lightPathToPropery, d_ptr->m_lightPathIndex);
}
#pragma endregion

View File

@ -1027,6 +1027,8 @@ public:
QtStringPropertyManager* subStringProperyManager() const;
QtFilesPropertyManager* subFilesProperyManager() const;
QtIntPropertyManager* subIntProperyManager() const;
QtGroupPropertyManager* subGroupProperyManager() const;
public Q_SLOTS:
void setValue(QtProperty* property, const QWorkspaceAttribute& val);
@ -1042,6 +1044,7 @@ private:
Q_DECLARE_PRIVATE(QtWorkspacePropertyManager)
Q_DISABLE_COPY_MOVE(QtWorkspacePropertyManager)
Q_PRIVATE_SLOT(d_func(), void slotStringChanged(QtProperty*, QString))
Q_PRIVATE_SLOT(d_func(), void slotIntChanged(QtProperty*, int))
};
#pragma endregion

View File

@ -171,6 +171,34 @@ const QString QWorkspaceAttribute::GetRDPath() const
return workspace_->GetRDPath();
}
std::vector<FileEntry> QWorkspaceAttribute::GetFileEntries(FileEntryType type) const {
if (nullptr == workspace_) {
return {};
}
return workspace_->GetFileEntries(type);
}
void QWorkspaceAttribute::SetFileEntryCount(FileEntryType type, int count) {
if (nullptr == workspace_) {
return;
}
workspace_->SetFileEntryCount(type, count);
}
void QWorkspaceAttribute::SetFileEntryPath(FileEntryType type, int index, const QString& path) {
if (nullptr == workspace_) {
return;
}
workspace_->SetFileEntryPath(type, index, path);
}
QString QWorkspaceAttribute::GetFileEntryAbsPath(FileEntryType type, int index) const {
if (nullptr == workspace_) {
return QString();
}
return workspace_->GetFileEntryAbsPath(type, index);
}
QTransformAttribute::QTransformAttribute(class Transform* obj)
: object_(obj) {

View File

@ -43,6 +43,8 @@
#include <QString>
#include <QColor>
#include <osg/Vec3>
#include "workspace/FileEntry.h"
#include <vector>
class QWorkspaceAttribute {
public:
@ -76,6 +78,12 @@ public:
void SetRDPath(const QString& path);
const QString GetRDPath() const;
// Grouped files API
std::vector<FileEntry> GetFileEntries(FileEntryType type) const;
void SetFileEntryCount(FileEntryType type, int count);
void SetFileEntryPath(FileEntryType type, int index, const QString& path);
QString GetFileEntryAbsPath(FileEntryType type, int index) const;
private:
class WorkSpace* workspace_{ nullptr };
};

34
src/workspace/FileEntry.h Normal file
View File

@ -0,0 +1,34 @@
#pragma once
#include <QString>
enum class FileEntryType {
Curve,
Surface,
Table,
Light
};
struct FileEntry {
FileEntryType type;
QString fileName; // relative file name under workspace dir; may be empty
};
inline const char* FileEntryTypeToString(FileEntryType t) {
switch (t) {
case FileEntryType::Curve: return "curve";
case FileEntryType::Surface: return "surface";
case FileEntryType::Table: return "table";
case FileEntryType::Light: return "light";
}
return "unknown";
}
inline bool FileEntryTypeFromString(const char* s, FileEntryType& out) {
if (!s) return false;
if (0 == strcmp(s, "curve")) { out = FileEntryType::Curve; return true; }
if (0 == strcmp(s, "surface")) { out = FileEntryType::Surface; return true; }
if (0 == strcmp(s, "table")) { out = FileEntryType::Table; return true; }
if (0 == strcmp(s, "light")) { out = FileEntryType::Light; return true; }
return false;
}

View File

@ -119,6 +119,84 @@ void WorkSpace::SetRDPath(const QString& path)
rdFile_ = fileInfo.fileName();
}
std::vector<FileEntry> WorkSpace::GetFileEntries(FileEntryType type) const {
auto it = files_.find(type);
if (it == files_.end()) {
return {};
}
return it->second;
}
WorkSpace::FileEntryResult WorkSpace::CreateFileEntry(FileEntryType type) {
auto& vec = files_[type];
if (vec.size() >= 9) {
return FileEntryResult::LimitExceeded;
}
// push a placeholder; actual filename may be set elsewhere via SetWavePath/SetRDPath/etc
vec.push_back(FileEntry{ type, QString() });
// Notify listeners (e.g., PropertyBrowser) to refresh workspace properties
emit FilesChanged(type);
return FileEntryResult::Ok;
}
bool WorkSpace::SetFileEntryCount(FileEntryType type, int count) {
if (count < 0) count = 0;
if (count > 9) count = 9;
auto& vec = files_[type];
if (static_cast<int>(vec.size()) == count) {
return true;
}
if (static_cast<int>(vec.size()) < count) {
int toAdd = count - static_cast<int>(vec.size());
for (int i = 0; i < toAdd; ++i) {
vec.push_back(FileEntry{ type, QString() });
}
} else {
vec.resize(count);
}
emit FilesChanged(type);
return true;
}
bool WorkSpace::SetFileEntryPath(FileEntryType type, int index, const QString& path) {
auto& vec = files_[type];
if (index < 0 || index >= static_cast<int>(vec.size())) {
return false;
}
QFileInfo fileInfo(path);
if (!fileInfo.exists()) {
return false;
}
QString dirPath = QString("%1/%2").arg(GetDir(), fileInfo.fileName());
bool sucess = FileUtils::CopyFileToPath(path, dirPath, true);
LOG_INFO("copy grouped file {}: {} to {}",
path.toLocal8Bit().data(),
dirPath.toLocal8Bit().data(),
sucess);
if (!sucess) {
return false;
}
vec[index].fileName = fileInfo.fileName();
emit FilesChanged(type);
return true;
}
QString WorkSpace::GetFileEntryAbsPath(FileEntryType type, int index) const {
auto it = files_.find(type);
if (it == files_.end()) {
return QString();
}
const auto& vec = it->second;
if (index < 0 || index >= static_cast<int>(vec.size())) {
return QString();
}
const QString& name = vec[index].fileName;
if (name.isEmpty()) {
return QString();
}
return QString("%1/%2").arg(GetDir(), name);
}
const QString WorkSpace::GetRDPath() const
{
QString path = QString("%1/%2").arg(GetDir(), rdFile_);

View File

@ -9,6 +9,7 @@
#include "scene/OEScene.h"
#include "config.h"
#include "common/SpdLogger.h"
#include "workspace/FileEntry.h"
//#include "../ui/chartPlot/DYTChart.h"
@ -69,6 +70,16 @@ public:
void SetRDPath(const QString& path);
const QString GetRDPath() const;
// Files list API (per-type, max 9 per type)
enum class FileEntryResult { Ok, LimitExceeded, Duplicate, CopyFailed };
FileEntryResult CreateFileEntry(FileEntryType type);
std::vector<FileEntry> GetFileEntries(FileEntryType type) const;
// Manage grouped file entries
bool SetFileEntryCount(FileEntryType type, int count);
bool SetFileEntryPath(FileEntryType type, int index, const QString& path);
QString GetFileEntryAbsPath(FileEntryType type, int index) const;
inline void SetHomeViewpoint(const osgEarth::Viewpoint& viewpoint) {
homeViewpoint_ = viewpoint;
homeViewpoint_.setHeading(0.0); // Ensure heading is set to 0.0
@ -123,10 +134,12 @@ public:
void OnLoaded();
Q_SIGNALS:
void EntityAdded(class Entity* entity);
void EntityRemoved(class Entity* entity);
void TimestepChanged(class Timestep* timestep);
void LampStatusChanged(class LampStatus* lampStatus);
void EntityAdded(class Entity* entity);
void EntityRemoved(class Entity* entity);
void TimestepChanged(class Timestep* timestep);
void LampStatusChanged(class LampStatus* lampStatus);
// Emitted when grouped file entries change (count or path or creation)
void FilesChanged(FileEntryType type);
protected:
const QString& GetSimMatlabName() const {
@ -152,8 +165,10 @@ private:
std::vector<class Entity*> entities_;
OEScene* scene_{ nullptr };
class Timestep* timestep_{ nullptr };
class LampStatus* lampStatus_{ nullptr };
class Entity* trackedEntity_{ nullptr };
class LampStatus* lampStatus_{ nullptr };
class Entity* trackedEntity_{ nullptr };
// Stored as file entries under workspace dir, keyed by type
std::map<FileEntryType, std::vector<FileEntry>> files_;
friend class WorkSpaceXMLWrite;
};

View File

@ -84,6 +84,30 @@ bool WorkSpaceXMLParse::ParseLamp(const tinyxml2::XMLElement* element) {
return workSpace_->SetLampPath(path);
}
bool WorkSpaceXMLParse::ParseFiles(const tinyxml2::XMLElement* element) {
if (nullptr == element) {
LOG_WARN("element is nullptr");
return false;
}
const tinyxml2::XMLElement* typeElement = element->FirstChildElement("type");
while (nullptr != typeElement) {
const char* name = typeElement->Attribute("name");
int count = 0;
typeElement->QueryIntAttribute("count", &count);
if (nullptr != name && count > 0) {
FileEntryType enumType;
if (FileEntryTypeFromString(name, enumType)) {
for (int i = 0; i < count; ++i) {
workSpace_->CreateFileEntry(enumType);
}
}
}
typeElement = typeElement->NextSiblingElement("type");
}
return true;
}
bool WorkSpaceXMLParse::ParseEntities(const tinyxml2::XMLElement* element) {
if (nullptr == element) {
LOG_WARN("element is nullptr");
@ -238,6 +262,9 @@ bool WorkSpaceXMLParse::Load(const QString& dyt) {
else if (0 == strcmp(name, "SimMatlab")) {
ParseSimMatlab(xmlElement);
}
else if (0 == strcmp(name, "files")) {
ParseFiles(xmlElement);
}
xmlElement = xmlElement->NextSiblingElement();
}

View File

@ -35,6 +35,7 @@ private:
bool ParseChart(const tinyxml2::XMLElement* element);
bool ParseReport(const tinyxml2::XMLElement* element);
bool ParseSimMatlab(const tinyxml2::XMLElement* element);
bool ParseFiles(const tinyxml2::XMLElement* element);
private:
QString name_;

View File

@ -10,6 +10,7 @@
#include "utils/StringUtils.h"
#include "workspace/WorkSpaceManager.h"
#include "workspace/FileEntry.h"
WorkSpaceXMLWrite::WorkSpaceXMLWrite(WorkSpace* workspace, QObject* parent) noexcept
: QObject(parent)
@ -35,6 +36,7 @@ bool WorkSpaceXMLWrite::Save(const QString& path) {
SaveChart(scene, &doc);
SaveTimeStep(scene);
SaveLamp(scene);
SaveFiles(scene, &doc);
tinyxml2::XMLElement* entitiesXml = scene->InsertNewChildElement("entities");
std::vector<Entity*>& entities = workSpace_->GetEntities();
@ -120,3 +122,19 @@ bool WorkSpaceXMLWrite::SaveChart(tinyxml2::XMLElement* scene, tinyxml2::XMLDocu
return true;
}
bool WorkSpaceXMLWrite::SaveFiles(tinyxml2::XMLElement* scene, tinyxml2::XMLDocument* doc) {
// Persist multi-file entries per type as counts
tinyxml2::XMLElement* files = doc->NewElement("files");
scene->LinkEndChild(files);
for (const auto& kv : workSpace_->files_) {
const FileEntryType type = kv.first;
const auto& vec = kv.second;
tinyxml2::XMLElement* typeElem = doc->NewElement("type");
typeElem->SetAttribute("name", FileEntryTypeToString(type));
typeElem->SetAttribute("count", static_cast<int>(vec.size()));
files->LinkEndChild(typeElem);
}
return true;
}

View File

@ -16,11 +16,12 @@ public:
bool Save(const QString& path);
protected:
bool SaveScene(tinyxml2::XMLElement* scene);
bool SaveTimeStep(tinyxml2::XMLElement* scene);
bool SaveLamp(tinyxml2::XMLElement* scene);
bool SaveEntities(tinyxml2::XMLElement* scene, tinyxml2::XMLDocument* doc);
bool SaveChart(tinyxml2::XMLElement* scene, tinyxml2::XMLDocument* doc);
bool SaveScene(tinyxml2::XMLElement* scene);
bool SaveTimeStep(tinyxml2::XMLElement* scene);
bool SaveLamp(tinyxml2::XMLElement* scene);
bool SaveEntities(tinyxml2::XMLElement* scene, tinyxml2::XMLDocument* doc);
bool SaveChart(tinyxml2::XMLElement* scene, tinyxml2::XMLDocument* doc);
bool SaveFiles(tinyxml2::XMLElement* scene, tinyxml2::XMLDocument* doc);
private:
WorkSpace* workSpace_;