Merge with develop.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-12-23 12:58:17 +02:00
commit 0419f60e0b
229 changed files with 2346 additions and 1897 deletions

View File

@ -52,6 +52,7 @@
# Version 0.4.6 # Version 0.4.6
- [#594] Broken export on Mac. - [#594] Broken export on Mac.
- Math parser allows apostrophe in variable name. - Math parser allows apostrophe in variable name.
- [#603] Wrong layout caused by wrong seam allowance.
# Version 0.4.5 October 15, 2016 # Version 0.4.5 October 15, 2016
- [#435] Valentina doesn't change the cursor. - [#435] Valentina doesn't change the cursor.

View File

@ -0,0 +1,280 @@
<?xml version='1.0' encoding='UTF-8'?>
<pattern>
<!--Pattern created with Valentina (http://www.valentina-project.org/).-->
<version>0.2.4</version>
<unit>cm</unit>
<author/>
<description/>
<notes/>
<measurements>Issue_#603.vit</measurements>
<increments>
<increment name="#Пг" description="Прибавка по линии груди&#xa;&#xa;Прибавка по линии груди распределяется между участками спинки, полочки и проймы:&#xa;Пг = Пшс + Пшп + Ппр.&#xa;" formula="3.5"/>
<increment name="#Пшс" description="Прибавка к ширине спины&#xa;&#xa;Прибавка по линии груди распределяется между участками спинки, полочки и проймы:&#xa;Пг = Пшс + Пшп + Ппр.&#xa;" formula="0.7"/>
<increment name="#Пшп" description="Прибавка к ширине полы&#xa;&#xa;Прибавка по линии груди распределяется между участками спинки, полочки и проймы:&#xa;Пг = Пшс + Пшп + Ппр." formula="0.35 "/>
<increment name="#Ппр" description="Прибавка к ширине проймы&#xa;&#xa;Прибавка по линии груди распределяется между участками спинки, полочки и проймы:&#xa;Пг = Пшс + Пшп + Ппр.&#xa;" formula="2.45 "/>
<increment name="#Пт" description="Прибавка по линии талли" formula="1"/>
<increment name="#Пб" description="Прибавка по линии бедер" formula="1.5"/>
<increment name="#Пспр" description="Прибавка на свободу проймы" formula="1.5 "/>
<increment name="#Поп" description="Прибавка к обхвату плеча" formula="3"/>
<increment name="#Пдтс" description="Прибавка к длине спины до талии" formula="0.5"/>
<increment name="#Пшгор" description="Прибавка к ширине горловины" formula="0.5"/>
<increment name="#Рплвыт" description="Величина раствора вытачки ИИ1 зависит от осанки фигуры и от структуры ткани. 1,5 - 2,5 см." formula="2"/>
<increment name="#И" description="Для типовых фигур расстояние от точки А2 до точки И равно 4 — 4,5 см. Если фигура сутулая, то вытачку располагают ближе к середине плечевого среза. " formula="4"/>
<increment name="#Дплвыт" description="Длина вытачки ИИ2 должна быть не менее 6 см и не более 9 см" formula="7"/>
<increment name="#кЦг" description="0,5 - 1 см " formula="0.5"/>
<increment name="#Срв" description="∑В(сумма вытачек) = (Сг3 + Пг) (Ст + Пт)" formula="(lowbust_arc_f+#Пг)-(waist_arc_f+#Пт)"/>
<increment name="#Пбс" description="Положение боковых срезов. ((Сг3+Пг)-(Сб+Пб))/2" formula="((lowbust_arc_f+#Пг)-(hip_with_abdomen_arc_f+#Пб))/2"/>
<increment name="#ОО2" description="Величина отрезка ОО2 зависит от размера руки в области предплечья:&#xa;для 44-46 размеров ОО2 = 2,5 см;&#xa;для 48-52 размеров ОО2 = 2 см;&#xa;для 54-58 размеров ОО2 = 1,5 см;&#xa;для 60 размера и более ОО2 = 1 см." formula="2.5"/>
<increment name="#Шрук" description="Ширина рукава&#xa;Шрук=(Оп+Поп)/2" formula="(arm_upper_circ+#Поп)/2"/>
<increment name="#О5О51" description="Биссектриса = 2 - 2,5 см" formula="2"/>
<increment name="#О6О61" description="Биссектиса = 1 - 2 см" formula="1"/>
<increment name="#лн" description="1 - 2 см" formula="1"/>
<increment name="#ЛпЛ1" description="0,5 - 1 см" formula="0.5"/>
<increment name="#М1М21" description="Ширина Рукава внизу" formula="13"/>
<increment name="#М3М21" description="1,5 - 2" formula="1.5"/>
<increment name="#рр1" description="1 - 1,5" formula="1"/>
<increment name="#тт1" description="0,5 - 1 см" formula="0.5"/>
</increments>
<draw name="Выкройка-основа">
<calculation>
<point type="single" x="-15.9655" y="-56.1909" id="1" name="А" mx="0.132292" my="-1.82518"/>
<point type="endLine" typeLine="hair" id="2" name="а1" basePoint="1" mx="0.495729" lineColor="black" angle="0" my="0.264583" length="lowbust_arc_f+#Пг"/>
<point type="endLine" typeLine="hair" id="3" name="Г" basePoint="1" mx="0.132292" lineColor="black" angle="270" my="0.264583" length="neck_back_to_highbust_b+#Пспр"/>
<point type="alongLine" typeLine="none" id="4" name="а" firstPoint="1" secondPoint="2" mx="0.132292" lineColor="black" my="0.264583" length="armfold_to_armfold_b+#Пшс"/>
<point type="alongLine" typeLine="none" id="5" name="а2" firstPoint="2" secondPoint="4" mx="0.967218" lineColor="black" my="0.416388" length="armfold_to_armfold_f+(bust_arc_f-highbust_arc_f)+#Пшп"/>
<point type="alongLine" typeLine="hair" id="6" name="Т" firstPoint="1" secondPoint="3" mx="0.214212" lineColor="black" my="0.264583" length="neck_back_to_waist_b+#Пдтс"/>
<point type="endLine" typeLine="hair" id="7" name="Б" basePoint="6" mx="0.132292" lineColor="black" angle="270" my="0.264583" length="0.5*neck_back_to_waist_b-2"/>
<point type="alongLine" typeLine="hair" id="8" name="Н" firstPoint="1" secondPoint="7" mx="0.132292" lineColor="black" my="0.264583" length="@Ди"/>
<point type="endLine" typeLine="hair" id="9" name="Г1" basePoint="3" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_А_а1"/>
<point type="endLine" typeLine="hair" id="10" name="Т1" basePoint="6" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_А_а1"/>
<point type="endLine" typeLine="hair" id="11" name="Б1" basePoint="7" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_А_а1"/>
<point type="endLine" typeLine="hair" id="12" name="Н1" basePoint="8" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_А_а1"/>
<line typeLine="hair" id="13" firstPoint="2" secondPoint="12" lineColor="black"/>
<point type="alongLine" typeLine="none" id="14" name="Г3" firstPoint="3" secondPoint="9" mx="0.132292" lineColor="black" my="0.264583" length="Line_А_а"/>
<point type="alongLine" typeLine="none" id="15" name="Г4" firstPoint="9" secondPoint="14" mx="0.132292" lineColor="black" my="0.264583" length="Line_а1_а2"/>
<line typeLine="hair" id="16" firstPoint="4" secondPoint="14" lineColor="black"/>
<line typeLine="hair" id="17" firstPoint="5" secondPoint="15" lineColor="black"/>
<point type="alongLine" typeLine="none" id="18" name="А2" firstPoint="1" secondPoint="4" mx="-0.412864" lineColor="black" my="-2.09776" length="neck_arc_f/3+#Пшгор"/>
<point type="normal" typeLine="hair" id="19" name="А1" firstPoint="18" secondPoint="1" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_А_А2/3"/>
<point type="endLine" typeLine="hair" id="20" name="А0" basePoint="19" mx="0.132292" lineColor="black" angle="180" my="0.264583" length="Line_А_А2"/>
<spline point4="18" type="simple" kAsm1="1.20481" kAsm2="0.848476" angle1="358.627" angle2="254.057" id="21" kCurve="1" color="black" point1="20"/>
<arc type="simple" angle1="320" angle2="20" id="22" radius="shoulder_length+#Рплвыт" center="18" color="black"/>
<arc type="simple" angle1="45" angle2="75" id="23" radius="shoulder_tip_to_waist_back+#Пдтс" center="6" color="black"/>
<point type="pointOfIntersectionArcs" crossPoint="1" firstArc="22" id="24" name="П1" secondArc="23" mx="0.617183" my="-1.38405"/>
<line typeLine="hair" id="25" firstPoint="18" secondPoint="24" lineColor="black"/>
<point type="alongLine" typeLine="none" id="26" name="И" firstPoint="18" secondPoint="24" mx="0.132292" lineColor="black" my="0.264583" length="#И"/>
<point type="alongLine" typeLine="none" id="27" name="И1" firstPoint="26" secondPoint="24" mx="0.132292" lineColor="black" my="0.264583" length="#Рплвыт"/>
<point type="endLine" typeLine="hair" id="28" name="И2" basePoint="26" mx="0.132292" lineColor="black" angle="270" my="0.264583" length="#Дплвыт"/>
<spline point4="27" type="simple" kAsm1="0.882463" kAsm2="0.860247" angle1="82.8015" angle2="241.265" id="29" kCurve="1" color="black" point1="28"/>
<point type="height" typeLine="hair" id="30" name="П2" basePoint="24" p2Line="14" mx="0.132292" lineColor="black" my="0.264583" p1Line="4"/>
<point type="alongLine" typeLine="none" id="31" name="П3" firstPoint="14" secondPoint="30" mx="-1.29916" lineColor="black" my="-0.175863" length="Line_Г3_П2/3+2"/>
<point type="bisector" typeLine="hair" id="32" thirdPoint="15" name="в" firstPoint="31" secondPoint="14" mx="0.132292" lineColor="black" my="0.264583" length="0.2*Line_Г4_Г3+0.5"/>
<point type="alongLine" typeLine="none" id="33" name="Г2" firstPoint="14" secondPoint="15" mx="0.132292" lineColor="black" my="0.264583" length="Line_Г4_Г3/2"/>
<spline type="path" id="34" kCurve="1" color="black">
<pathPoint kAsm1="1" kAsm2="0.906322" pSpline="24" angle="248.035"/>
<pathPoint kAsm1="0.774397" kAsm2="1" pSpline="31" angle="269.056"/>
<pathPoint kAsm1="0.631376" kAsm2="0.902245" pSpline="32" angle="312.322"/>
<pathPoint kAsm1="1.03287" kAsm2="1" pSpline="33" angle="359.273"/>
</spline>
<point type="endLine" typeLine="hair" id="35" name="Т2" basePoint="33" mx="0.132292" lineColor="black" angle="270" my="0.264583" length="Line_Т_Г"/>
<point type="endLine" typeLine="hair" id="36" name="Б2" basePoint="35" mx="0.132292" lineColor="black" angle="270" my="0.264583" length="Line_Т_Б"/>
<point type="endLine" typeLine="hair" id="37" name="Н2" basePoint="36" mx="0.132292" lineColor="black" angle="270" my="0.264583" length="Line_Н_Б"/>
<point type="alongLine" typeLine="none" id="38" name="Г6" firstPoint="9" secondPoint="15" mx="0.208194" lineColor="black" my="-1.86068" length="bustpoint_to_bustpoint+#кЦг"/>
<point type="alongLine" typeLine="hair" id="39" name="А3" firstPoint="10" secondPoint="2" mx="1.04089" lineColor="black" my="0.355442" length="@Дтп+#Пдтс"/>
<point type="endLine" typeLine="hair" id="40" name="А4" basePoint="39" mx="0.208194" lineColor="black" angle="180" my="-1.70888" length="Line_А_А2"/>
<point type="alongLine" typeLine="none" id="41" name="А5" firstPoint="39" secondPoint="2" mx="0.677448" lineColor="black" my="-0.007995" length="Line_А3_А4+1"/>
<arc type="simple" angle1="50" angle2="130" id="42" radius="Line_А3_А5" center="41" color="black"/>
<arc type="simple" angle1="330" angle2="30" id="43" radius="Line_А3_А5" center="40" color="black"/>
<point type="pointOfIntersectionArcs" crossPoint="1" firstArc="42" id="44" name="А6" secondArc="43" mx="0.359999" my="-1.70888"/>
<arc type="simple" angle1="180" angle2="270" id="45" radius="Line_А3_А5" center="44" color="black"/>
<point type="alongLine" typeLine="none" id="46" name="Т6" firstPoint="10" secondPoint="35" mx="0.132292" lineColor="black" my="0.264583" length="Line_Г1_Г6"/>
<line typeLine="hair" id="47" firstPoint="38" secondPoint="46" lineColor="black"/>
<arc type="simple" angle1="250" angle2="280" id="48" radius="bustpoint_to_neck_side" center="40" color="black"/>
<point type="curveIntersectAxis" typeLine="hair" id="49" name="Г7" curve="48" basePoint="46" mx="0.359999" lineColor="black" angle="270" my="1.25131"/>
<arc type="simple" angle1="90" angle2="120" id="50" radius="bustpoint_to_neck_side" center="49" color="black"/>
<arc type="simple" angle1="150" angle2="230" id="51" radius="2*(bust_arc_f-highbust_arc_f)+1" center="40" color="black"/>
<point type="alongLine" typeLine="none" id="52" name="П4" firstPoint="15" secondPoint="5" mx="0.132292" lineColor="black" my="0.264583" length="Line_Г3_П2-1"/>
<point type="alongLine" typeLine="none" id="53" name="П6" firstPoint="15" secondPoint="52" mx="0.132292" lineColor="black" my="0.264583" length="Line_Г4_П4/3"/>
<arc type="simple" angle1="75" angle2="150" id="54" radius="Line_П6_П4" center="53" color="black"/>
<point type="pointOfIntersectionArcs" crossPoint="1" firstArc="50" id="55" name="А9" secondArc="51" mx="0.81541" my="-2.24019"/>
<arc type="simple" angle1="180" angle2="270" id="56" radius="shoulder_length" center="55" color="black"/>
<point type="pointOfIntersectionArcs" crossPoint="1" firstArc="54" id="57" name="П5" secondArc="56" mx="1.14629" my="-0.679849"/>
<line typeLine="hair" id="58" firstPoint="57" secondPoint="55" lineColor="black"/>
<point type="alongLine" typeLine="none" id="59" name="П7" firstPoint="55" secondPoint="57" mx="-1.68936" lineColor="black" my="-1.48118" length="Line_А2_И"/>
<arc type="simple" angle1="160" angle2="240" id="60" radius="Line_А2_И" center="40" color="black"/>
<line typeLine="hair" id="61" firstPoint="49" secondPoint="59" lineColor="black"/>
<arc type="simple" angle1="80" angle2="105" id="62" radius="Line_Г7_П7" center="49" color="black"/>
<point type="pointOfIntersectionArcs" crossPoint="1" firstArc="62" id="63" name="А8" secondArc="60" mx="-2.04649" my="-1.43003"/>
<line typeLine="hair" id="64" firstPoint="63" secondPoint="40" lineColor="black"/>
<line typeLine="hair" id="65" firstPoint="49" secondPoint="63" lineColor="black"/>
<point type="bisector" typeLine="hair" id="66" thirdPoint="33" name="с" firstPoint="53" secondPoint="15" mx="0.132292" lineColor="black" my="0.264583" length="0.2*Line_Г4_Г3"/>
<line typeLine="hair" id="67" firstPoint="57" secondPoint="53" lineColor="black"/>
<point type="alongLine" typeLine="none" id="68" name="д" firstPoint="53" secondPoint="57" mx="0.132292" lineColor="black" my="0.264583" length="Line_П5_П6/2"/>
<point type="normal" typeLine="hair" id="69" name="е" firstPoint="68" secondPoint="53" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="1"/>
<spline type="path" id="70" kCurve="1" color="black">
<pathPoint kAsm1="1" kAsm2="0.845899" pSpline="57" angle="316.587"/>
<pathPoint kAsm1="1.03197" kAsm2="0.263439" pSpline="69" angle="312.153"/>
<pathPoint kAsm1="0.927185" kAsm2="1" pSpline="53" angle="272.146"/>
<pathPoint kAsm1="0.548043" kAsm2="0.54785" pSpline="66" angle="224.298"/>
<pathPoint kAsm1="1.62264" kAsm2="1" pSpline="33" angle="179.888"/>
</spline>
<point type="alongLine" typeLine="none" id="71" name="Т3" firstPoint="35" secondPoint="6" mx="0.132292" lineColor="black" my="0.264583" length="1/4*#Срв"/>
<point type="alongLine" typeLine="none" id="72" name="Т4" firstPoint="35" secondPoint="46" mx="0.132292" lineColor="black" my="0.264583" length="1/4*#Срв"/>
<point type="alongLine" typeLine="none" id="73" name="Б3" firstPoint="36" secondPoint="7" mx="0.697162" lineColor="black" my="0.425975" length="#Пбс"/>
<point type="alongLine" typeLine="none" id="74" name="Б4" firstPoint="36" secondPoint="11" mx="-1.23954" lineColor="black" my="0.425975" length="#Пбс"/>
<point type="alongLine" typeLine="none" id="75" name="Н3" firstPoint="8" secondPoint="37" mx="0.616467" lineColor="black" my="-2.15629" length="Line_Б3_Б"/>
<point type="alongLine" typeLine="none" id="76" name="Н4" firstPoint="12" secondPoint="37" mx="-1.15884" lineColor="black" my="-1.9142" length="Line_Б4_Б1"/>
<spline type="path" id="77" kCurve="1" color="black">
<pathPoint kAsm1="1" kAsm2="1.04671" pSpline="33" angle="263.309"/>
<pathPoint kAsm1="0.652538" kAsm2="0.662841" pSpline="71" angle="274.092"/>
<pathPoint kAsm1="0.970052" kAsm2="0.999998" pSpline="73" angle="269.229"/>
<pathPoint kAsm1="1.05183" kAsm2="1" pSpline="75" angle="269.806"/>
</spline>
<spline type="path" id="78" kCurve="1" color="black">
<pathPoint kAsm1="1" kAsm2="1" pSpline="33" angle="280.747"/>
<pathPoint kAsm1="0.492088" kAsm2="0.706189" pSpline="72" angle="267.444"/>
<pathPoint kAsm1="0.901032" kAsm2="0.999651" pSpline="74" angle="269.912"/>
<pathPoint kAsm1="0.552851" kAsm2="1" pSpline="76" angle="270.112"/>
</spline>
<point type="alongLine" typeLine="none" id="79" name="Т5" firstPoint="6" secondPoint="35" mx="0.132292" lineColor="black" my="0.264583" length="0.4*Line_А_а"/>
<point type="alongLine" typeLine="none" id="80" name="ж" firstPoint="3" secondPoint="14" mx="0.132292" lineColor="black" my="0.264583" length="Line_Т_Т5"/>
<point type="alongLine" typeLine="none" id="81" name="з" firstPoint="7" secondPoint="36" mx="0.132292" lineColor="black" my="0.264583" length="Line_Т_Т5"/>
<line typeLine="hair" id="82" firstPoint="80" secondPoint="81" lineColor="black"/>
<point type="alongLine" typeLine="none" id="83" name="Т51" firstPoint="79" secondPoint="6" mx="-1.41327" lineColor="black" my="0.844167" length="1/3*#Срв/2"/>
<point type="alongLine" typeLine="none" id="84" name="Т52" firstPoint="79" secondPoint="35" mx="0.132292" lineColor="black" my="0.264583" length="1/3*#Срв/2"/>
<point type="alongLine" typeLine="none" id="85" name="ж1" firstPoint="80" secondPoint="79" mx="0.132292" lineColor="black" my="0.264583" length="2.5"/>
<point type="alongLine" typeLine="none" id="86" name="з1" firstPoint="81" secondPoint="79" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
<line typeLine="hair" id="87" firstPoint="83" secondPoint="85" lineColor="black"/>
<line typeLine="hair" id="88" firstPoint="85" secondPoint="84" lineColor="black"/>
<line typeLine="hair" id="89" firstPoint="84" secondPoint="86" lineColor="black"/>
<line typeLine="hair" id="90" firstPoint="86" secondPoint="83" lineColor="black"/>
<point type="alongLine" typeLine="none" id="91" name="к" firstPoint="11" secondPoint="36" mx="0.132292" lineColor="black" my="0.264583" length="Line_Т1_Т6"/>
<line typeLine="hair" id="92" firstPoint="46" secondPoint="91" lineColor="black"/>
<point type="alongLine" typeLine="none" id="93" name="Т61" firstPoint="46" secondPoint="35" mx="-2.64333" lineColor="black" my="-1.47606" length="1/6*#Срв/2"/>
<point type="alongLine" typeLine="none" id="94" name="Т62" firstPoint="46" secondPoint="10" mx="0.367513" lineColor="black" my="-1.5231" length="1/6*#Срв/2"/>
<point type="alongLine" typeLine="none" id="95" name="л" firstPoint="49" secondPoint="46" mx="0.132292" lineColor="black" my="0.264583" length="2.5"/>
<point type="alongLine" typeLine="none" id="96" name="к1" firstPoint="91" secondPoint="46" mx="0.132292" lineColor="black" my="0.264583" length="5"/>
<line typeLine="hair" id="97" firstPoint="96" secondPoint="93" lineColor="black"/>
<line typeLine="hair" id="98" firstPoint="93" secondPoint="95" lineColor="black"/>
<line typeLine="hair" id="99" firstPoint="95" secondPoint="94" lineColor="black"/>
<line typeLine="hair" id="100" firstPoint="94" secondPoint="96" lineColor="black"/>
<line typeLine="hair" id="101" firstPoint="24" secondPoint="57" lineColor="black"/>
<point type="alongLine" typeLine="none" id="102" name="Q" firstPoint="57" secondPoint="24" mx="0.617183" lineColor="black" my="-0.753688" length="Line_П1_П5/2"/>
<point type="height" typeLine="hair" id="103" name="Q1" basePoint="102" p2Line="15" mx="0.132292" lineColor="black" my="0.264583" p1Line="14"/>
<point type="alongLine" typeLine="none" id="104" name="Q2" firstPoint="103" secondPoint="102" mx="0.132292" lineColor="black" my="0.264583" length="Line_Q_Q1-#ОО2"/>
</calculation>
<modeling>
<point type="modeling" inUse="true" id="190" idObject="10" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="191" idObject="12" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="192" idObject="76" mx="-1.15884" my="-1.9142"/>
<point type="modeling" inUse="true" id="197" idObject="59" mx="-1.68936" my="-1.48118"/>
<point type="modeling" inUse="true" id="202" idObject="41" mx="0.677448" my="-0.007995"/>
<point type="modeling" inUse="true" id="203" idObject="10" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="204" idObject="94" mx="0.367513" my="-1.5231"/>
<point type="modeling" inUse="true" id="205" idObject="96" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="206" idObject="93" mx="-2.64333" my="-1.47606"/>
<point type="modeling" inUse="true" id="207" idObject="95" mx="0.132292" my="0.264583"/>
<point type="modeling" inUse="true" id="208" idObject="94" mx="0.367513" my="-1.5231"/>
</modeling>
<details>
<detail closed="1" id="209" name="Полочка" supplement="1" width="1" mx="-205.772" my="-98.2618">
<node type="NodePoint" nodeType="Contour" idObject="190" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="191" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="192" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="197" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="202" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="203" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="204" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="205" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="206" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="207" mx="0" my="0"/>
<node type="NodePoint" nodeType="Contour" idObject="208" mx="0" my="0"/>
</detail>
</details>
</draw>
<draw name="Рукав">
<calculation>
<point type="single" x="58.4357" y="-36.6028" id="105" name="О" mx="0.132292" my="0.264583"/>
<point type="endLine" typeLine="hair" id="106" name="О2" basePoint="105" mx="0.132292" lineColor="black" angle="90" my="0.264583" length="Line_Q1_Q2"/>
<point type="alongLine" typeLine="hair" id="107" name="М" firstPoint="106" secondPoint="105" mx="0.132292" lineColor="black" my="0.264583" length="@Др"/>
<point type="endLine" typeLine="hair" id="108" name="Рп" basePoint="105" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="#Шрук/2"/>
<point type="endLine" typeLine="hair" id="109" name="Рл" basePoint="105" mx="0.132292" lineColor="black" angle="180" my="0.264583" length="#Шрук/2"/>
<point type="alongLine" typeLine="none" id="110" name="Л" firstPoint="106" secondPoint="105" mx="0.132292" lineColor="black" my="0.264583" length="Line_О2_М/2+3"/>
<point type="endLine" typeLine="hair" id="111" name="Лп" basePoint="110" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_О_Рп"/>
<point type="endLine" typeLine="hair" id="112" name="Лл" basePoint="110" mx="-1.64062" lineColor="black" angle="180" my="0.0200433" length="Line_Л_Лп"/>
<point type="endLine" typeLine="hair" id="113" name="М1" basePoint="107" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_Л_Лп"/>
<point type="endLine" typeLine="hair" id="114" name="М2" basePoint="107" mx="-1.57426" lineColor="black" angle="180" my="0.56323" length="Line_Л_Лл"/>
<point type="endLine" typeLine="hair" id="115" name="О4" basePoint="106" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_Л_Лл"/>
<point type="endLine" typeLine="hair" id="116" name="О3" basePoint="106" mx="0.132292" lineColor="black" angle="180" my="0.264583" length="Line_Л_Лп"/>
<line typeLine="hair" id="117" firstPoint="116" secondPoint="114" lineColor="black"/>
<line typeLine="hair" id="118" firstPoint="115" secondPoint="113" lineColor="black"/>
<point type="alongLine" typeLine="none" id="119" name="Р6" firstPoint="108" secondPoint="115" mx="0.132292" lineColor="black" my="0.264583" length="Line_Г4_П6"/>
<point type="endLine" typeLine="hair" id="120" name="Р62" basePoint="119" mx="0.0591098" lineColor="black" angle="0" my="-1.63815" length="0.5"/>
<point type="endLine" typeLine="hair" id="121" name="Р61" basePoint="119" mx="-1.84362" lineColor="black" angle="180" my="-1.4186" length="0.5"/>
<point type="alongLine" typeLine="none" id="122" name="Р3" firstPoint="109" secondPoint="116" mx="0.132292" lineColor="black" my="0.264583" length="Line_Г3_П3"/>
<point type="endLine" typeLine="hair" id="123" name="Р32" basePoint="122" mx="0.571383" lineColor="black" angle="0" my="-1.71133" length="0.5"/>
<point type="endLine" typeLine="hair" id="124" name="Р31" basePoint="122" mx="-1.77044" lineColor="black" angle="180" my="-1.4186" length="0.5"/>
<point type="alongLine" typeLine="none" id="125" name="О5" firstPoint="106" secondPoint="115" mx="-0.0872541" lineColor="black" my="-1.85769" length="Line_О2_О4/2+2"/>
<point type="alongLine" typeLine="none" id="126" name="О6" firstPoint="106" secondPoint="116" mx="-0.599527" lineColor="black" my="-2.36997" length="Line_О2_О3/2"/>
<line typeLine="hair" id="127" firstPoint="125" secondPoint="120" lineColor="black"/>
<line typeLine="hair" id="128" firstPoint="126" secondPoint="124" lineColor="black"/>
<point type="bisector" typeLine="hair" id="129" thirdPoint="120" name="О51" firstPoint="106" secondPoint="125" mx="0.132292" lineColor="black" my="0.264583" length="#О5О51"/>
<point type="bisector" typeLine="hair" id="130" thirdPoint="124" name="О61" firstPoint="106" secondPoint="126" mx="0.132292" lineColor="black" my="0.264583" length="#О6О61"/>
<point type="alongLine" typeLine="none" id="131" name="Г21" firstPoint="108" secondPoint="105" mx="0.132292" lineColor="black" my="0.264583" length="0.5*Line_Г4_Г3+0.5"/>
<line typeLine="hair" id="132" firstPoint="131" secondPoint="123" lineColor="black"/>
<point type="alongLine" typeLine="none" id="133" name="м" firstPoint="131" secondPoint="123" mx="0.132292" lineColor="black" my="0.264583" length="Line_Г21_Р32/2"/>
<point type="normal" typeLine="hair" id="134" name="н" firstPoint="133" secondPoint="123" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="#лн"/>
<point type="bisector" typeLine="hair" id="135" thirdPoint="119" name="п" firstPoint="131" secondPoint="108" mx="0.132292" lineColor="black" my="0.264583" length="Line_Г4_с"/>
<spline type="path" id="136" kCurve="1" color="black">
<pathPoint kAsm1="1" kAsm2="1" pSpline="123" angle="302.974"/>
<pathPoint kAsm1="1" kAsm2="0.983788" pSpline="134" angle="309.501"/>
<pathPoint kAsm1="0.693247" kAsm2="1" pSpline="131" angle="349.475"/>
<pathPoint kAsm1="0.8342" kAsm2="0.948548" pSpline="135" angle="53.2671"/>
<pathPoint kAsm1="0.852814" kAsm2="1" pSpline="121" angle="81.6825"/>
</spline>
<point type="alongLine" typeLine="none" id="137" name="Л1" firstPoint="111" secondPoint="110" mx="-1.47771" lineColor="black" my="-1.71133" length="#ЛпЛ1"/>
<line typeLine="hair" id="138" firstPoint="108" secondPoint="137" lineColor="black"/>
<line typeLine="hair" id="139" firstPoint="137" secondPoint="113" lineColor="black"/>
<point type="alongLine" typeLine="none" id="140" name="Л2" firstPoint="112" secondPoint="110" mx="0.193427" lineColor="black" my="-1.69173" length="#ЛпЛ1"/>
<point type="alongLine" typeLine="none" id="141" name="М21" firstPoint="113" secondPoint="114" mx="0.132292" lineColor="black" my="0.264583" length="#М1М21"/>
<point type="normal" typeLine="hair" id="142" name="М3" firstPoint="141" secondPoint="114" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="#М3М21"/>
<line typeLine="hair" id="143" firstPoint="109" secondPoint="140" lineColor="black"/>
<line typeLine="hair" id="144" firstPoint="140" secondPoint="142" lineColor="black"/>
<line typeLine="hair" id="145" firstPoint="142" secondPoint="113" lineColor="black"/>
<point type="endLine" typeLine="hair" id="146" name="Р2" basePoint="109" mx="0.132292" lineColor="black" angle="180" my="0.264583" length="#Шрук/2"/>
<point type="endLine" typeLine="hair" id="147" name="Р1" basePoint="108" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="#Шрук/2"/>
<point type="bisector" typeLine="hair" id="148" thirdPoint="119" name="п1" firstPoint="147" secondPoint="108" mx="0.132292" lineColor="black" my="0.264583" length="Line_Рп_п"/>
<line typeLine="hair" id="149" firstPoint="146" secondPoint="124" lineColor="black"/>
<point type="alongLine" typeLine="none" id="150" name="р" firstPoint="146" secondPoint="124" mx="0.132292" lineColor="black" my="0.264583" length="Line_Р2_Р31/2"/>
<point type="normal" typeLine="hair" id="151" name="р1" firstPoint="150" secondPoint="146" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="#рр1"/>
<spline type="path" id="152" kCurve="1" color="black">
<pathPoint kAsm1="1" kAsm2="1.13548" pSpline="146" angle="26.5279"/>
<pathPoint kAsm1="1.17687" kAsm2="0.70559" pSpline="151" angle="54.1318"/>
<pathPoint kAsm1="0.800729" kAsm2="0.772466" pSpline="124" angle="54.2353"/>
<pathPoint kAsm1="0.995064" kAsm2="1.14755" pSpline="130" angle="35.2552"/>
<pathPoint kAsm1="0.79757" kAsm2="0.863337" pSpline="106" angle="358.318"/>
<pathPoint kAsm1="0.964404" kAsm2="1" pSpline="129" angle="309.447"/>
<pathPoint kAsm1="1.19399" kAsm2="0.959102" pSpline="120" angle="282.638"/>
<pathPoint kAsm1="1.00911" kAsm2="0.689472" pSpline="148" angle="303.385"/>
<pathPoint kAsm1="1.01569" kAsm2="1" pSpline="147" angle="357.7"/>
</spline>
<point type="endLine" typeLine="hair" id="153" name="М22" basePoint="114" mx="0.132292" lineColor="black" angle="180" my="0.264583" length="Line_М3_М1/2"/>
<point type="endLine" typeLine="hair" id="154" name="М11" basePoint="113" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="Line_М3_М1/2"/>
<line typeLine="hair" id="155" firstPoint="146" secondPoint="153" lineColor="black"/>
<line typeLine="hair" id="156" firstPoint="147" secondPoint="154" lineColor="black"/>
<point type="alongLine" typeLine="none" id="157" name="т" firstPoint="107" secondPoint="153" mx="0.21762" lineColor="black" my="-1.31398" length="(Line_М2_М22+Line_М_М2)/2"/>
<point type="normal" typeLine="hair" id="158" name="т1" firstPoint="157" secondPoint="114" mx="0.132292" lineColor="black" angle="0" my="0.264583" length="#тт1"/>
<point type="alongLine" typeLine="none" id="159" name="у" firstPoint="154" secondPoint="107" mx="-0.76365" lineColor="black" my="0.221919" length="Line_М_т"/>
<point type="normal" typeLine="hair" id="160" name="у1" firstPoint="159" secondPoint="113" mx="-1.19029" lineColor="black" angle="0" my="-1.39931" length="#тт1"/>
<spline type="path" id="161" kCurve="1" color="black">
<pathPoint kAsm1="1" kAsm2="1.08198" pSpline="153" angle="352.844"/>
<pathPoint kAsm1="0.995423" kAsm2="1" pSpline="158" angle="1.15441"/>
<pathPoint kAsm1="1" kAsm2="0.863427" pSpline="107" angle="6.15599"/>
<pathPoint kAsm1="1" kAsm2="0.835679" pSpline="160" angle="359.234"/>
<pathPoint kAsm1="1.21505" kAsm2="1" pSpline="154" angle="351.945"/>
</spline>
</calculation>
<modeling/>
<details/>
</draw>
</pattern>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<vit>
<!--Measurements created with Valentina (http://www.valentina-project.org/).-->
<version>0.3.3</version>
<read-only>false</read-only>
<notes/>
<unit>cm</unit>
<pm_system>998</pm_system>
<personal>
<family-name/>
<given-name/>
<birth-date>1800-01-01</birth-date>
<gender>unknown</gender>
<email/>
</personal>
<body-measurements>
<m value="17.5" name="neck_arc_f"/>
<m value="42" name="highbust_arc_f"/>
<m value="46" name="bust_arc_f"/>
<m value="44" name="lowbust_arc_f"/>
<m value="36" name="waist_arc_f"/>
<m value="48" name="hip_with_abdomen_arc_f"/>
<m value="40" name="neck_back_to_waist_b"/>
<m value="20" name="neck_back_to_highbust_b"/>
<m value="12.5" name="shoulder_length"/>
<m value="14" name="armfold_to_armfold_f"/>
<m value="17" name="armfold_to_armfold_b"/>
<m value="8.5" name="bustpoint_to_bustpoint"/>
<m value="26" name="bustpoint_to_neck_side"/>
<m value="43" name="shoulder_tip_to_waist_back"/>
<m value="27" name="arm_upper_circ"/>
<m full_name="Длина изделия" value="80" description="Измеряется от высшей точки плечевого шва до желаемого уровня длины" name="@Ди"/>
<m full_name="Длина переда до талии" value="43" description="Измеряется от высшей точки плечевого шва до линии талии через выступающую точку грудных желез, одновременно отмечая ее положение" name="@Дтп"/>
<m full_name="Длина рукава" value="55" description="Измеряем от конечной плечевой точки по наружной поверхности руки до уровня желаемой длины рукава&#xa;" name="@Др"/>
</body-measurements>
</vit>

View File

@ -181,7 +181,7 @@ QGroupBox *TapeConfigurationPage::LangGroup()
{ {
langCombo->setCurrentIndex(index); langCombo->setCurrentIndex(index);
} }
connect(langCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this]() connect(langCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), RECEIVER(this)[this]()
{ {
langChanged = true; langChanged = true;
}); });
@ -231,7 +231,7 @@ QGroupBox *TapeConfigurationPage::PMSystemGroup()
pmSystemLayout->addRow(systemBookLabel, systemBookValueLabel); pmSystemLayout->addRow(systemBookLabel, systemBookValueLabel);
connect(systemCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [this]() connect(systemCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), RECEIVER(this)[this]()
{ {
systemChanged = true; systemChanged = true;
#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0)
@ -285,7 +285,7 @@ QGroupBox *TapeConfigurationPage::GradationGroup()
defGradationChanged = true; defGradationChanged = true;
}; };
connect(defHeightCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(defHeightCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), RECEIVER(this)
DefGradationChanged); DefGradationChanged);
gradationLayout->addRow(defHeightLabel, defHeightCombo); gradationLayout->addRow(defHeightLabel, defHeightCombo);
@ -298,7 +298,7 @@ QGroupBox *TapeConfigurationPage::GradationGroup()
{ {
defSizeCombo->setCurrentIndex(index); defSizeCombo->setCurrentIndex(index);
} }
connect(defHeightCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(defHeightCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), RECEIVER(this)
DefGradationChanged); DefGradationChanged);
gradationLayout->addRow(defSizeLabel, defSizeCombo); gradationLayout->addRow(defSizeLabel, defSizeCombo);

View File

@ -54,7 +54,7 @@ TapePathPage::TapePathPage(QWidget *parent)
pathGroup(nullptr) pathGroup(nullptr)
{ {
QGroupBox *pathGroup = PathGroup(); QGroupBox *pathGroup = PathGroup();
SCASSERT(pathGroup != nullptr); SCASSERT(pathGroup != nullptr)
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(pathGroup); mainLayout->addWidget(pathGroup);
@ -76,7 +76,7 @@ void TapePathPage::DefaultPath()
{ {
const int row = pathTable->currentRow(); const int row = pathTable->currentRow();
QTableWidgetItem *item = pathTable->item(row, 1); QTableWidgetItem *item = pathTable->item(row, 1);
SCASSERT(item != nullptr); SCASSERT(item != nullptr)
switch (row) switch (row)
{ {
@ -102,7 +102,7 @@ void TapePathPage::EditPath()
{ {
const int row = pathTable->currentRow(); const int row = pathTable->currentRow();
QTableWidgetItem *item = pathTable->item(row, 1); QTableWidgetItem *item = pathTable->item(row, 1);
SCASSERT(item != nullptr); SCASSERT(item != nullptr)
QString path; QString path;
switch (row) switch (row)

View File

@ -50,7 +50,7 @@ DialogAboutTape::DialogAboutTape(QWidget *parent)
//mApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c()); //mApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
RetranslateUi(); RetranslateUi();
connect(ui->pushButton_Web_Site, &QPushButton::clicked, [this]() connect(ui->pushButton_Web_Site, &QPushButton::clicked, RECEIVER(this)[this]()
{ {
if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false) if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false)
{ {
@ -58,7 +58,8 @@ DialogAboutTape::DialogAboutTape(QWidget *parent)
} }
}); });
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &DialogAboutTape::close); connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &DialogAboutTape::close);
connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, [](){ connect(ui->pushButtonCheckUpdate, &QPushButton::clicked, []()
{
FvUpdater::sharedUpdater()->CheckForUpdatesNotSilent(); FvUpdater::sharedUpdater()->CheckForUpdatesNotSilent();
}); });
@ -112,7 +113,7 @@ void DialogAboutTape::showEvent(QShowEvent *event)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogAboutTape::FontPointSize(QWidget *w, int pointSize) void DialogAboutTape::FontPointSize(QWidget *w, int pointSize)
{ {
SCASSERT(w != nullptr); SCASSERT(w != nullptr)
QFont font = w->font(); QFont font = w->font();
font.setPointSize(pointSize); font.setPointSize(pointSize);

View File

@ -56,8 +56,8 @@ DialogExportToCSV::DialogExportToCSV(QWidget *parent)
SetSeparator(qApp->TapeSettings()->GetCSVSeparator()); SetSeparator(qApp->TapeSettings()->GetCSVSeparator());
QPushButton *bDefaults = ui->buttonBox->button(QDialogButtonBox::RestoreDefaults); QPushButton *bDefaults = ui->buttonBox->button(QDialogButtonBox::RestoreDefaults);
SCASSERT(bDefaults != nullptr); SCASSERT(bDefaults != nullptr)
connect(bDefaults, &QPushButton::clicked, [this]() connect(bDefaults, &QPushButton::clicked, RECEIVER(this)[this]()
{ {
ui->checkBoxWithHeader->setChecked(qApp->TapeSettings()->GetDefCSVWithHeader()); ui->checkBoxWithHeader->setChecked(qApp->TapeSettings()->GetDefCSVWithHeader());
ui->comboBoxCodec->setCurrentIndex(ui->comboBoxCodec->findData(qApp->TapeSettings()->GetDefCSVCodec())); ui->comboBoxCodec->setCurrentIndex(ui->comboBoxCodec->findData(qApp->TapeSettings()->GetDefCSVCodec()));

View File

@ -172,7 +172,7 @@ void DialogNewMeasurements::CurrentTypeChanged(int index)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogNewMeasurements::CurrentUnitChanged(int index) void DialogNewMeasurements::CurrentUnitChanged(int index)
{ {
Q_UNUSED(index); Q_UNUSED(index)
if (MUnit() != Unit::Inch) if (MUnit() != Unit::Inch)
{ {

View File

@ -71,7 +71,7 @@ TapeConfigDialog::TapeConfigDialog(QWidget *parent)
createIcons(); createIcons();
connect(contentsWidget, &QListWidget::currentItemChanged, connect(contentsWidget, &QListWidget::currentItemChanged,
[this](QListWidgetItem *current, QListWidgetItem *previous) RECEIVER(this)[this](QListWidgetItem *current, QListWidgetItem *previous)
{ {
if (current == nullptr) if (current == nullptr)
{ {
@ -160,7 +160,7 @@ void TapeConfigDialog::showEvent(QShowEvent *event)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TapeConfigDialog::resizeEvent(QResizeEvent *event) void TapeConfigDialog::resizeEvent(QResizeEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event)
// remember the size for the next time this dialog is opened, but only // remember the size for the next time this dialog is opened, but only
// if widget was already initialized, which rules out the resize at // if widget was already initialized, which rules out the resize at
// dialog creating, which would // dialog creating, which would

View File

@ -45,7 +45,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(schema); Q_INIT_RESOURCE(schema);
Q_INIT_RESOURCE(flags); Q_INIT_RESOURCE(flags);
QT_REQUIRE_VERSION(argc, argv, "5.0.0"); QT_REQUIRE_VERSION(argc, argv, "5.0.0")
qt_qhash_seed.store(0); // Lock producing random attribute order in XML qt_qhash_seed.store(0); // Lock producing random attribute order in XML

View File

@ -436,18 +436,15 @@ bool MApplication::event(QEvent *e)
case QEvent::FileOpen: case QEvent::FileOpen:
{ {
QFileOpenEvent *fileOpenEvent = static_cast<QFileOpenEvent *>(e); QFileOpenEvent *fileOpenEvent = static_cast<QFileOpenEvent *>(e);
if(fileOpenEvent) const QString macFileOpen = fileOpenEvent->file();
if(not macFileOpen.isEmpty())
{ {
const QString macFileOpen = fileOpenEvent->file(); TMainWindow *mw = MainWindow();
if(not macFileOpen.isEmpty()) if (mw)
{ {
TMainWindow *mw = MainWindow(); mw->LoadFile(macFileOpen); // open file in existing window
if (mw)
{
mw->LoadFile(macFileOpen); // open file in existing window
}
return true;
} }
return true;
} }
break; break;
} }
@ -479,7 +476,7 @@ void MApplication::OpenSettings()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VTapeSettings *MApplication::TapeSettings() VTapeSettings *MApplication::TapeSettings()
{ {
SCASSERT(settings != nullptr); SCASSERT(settings != nullptr)
return qobject_cast<VTapeSettings *>(settings); return qobject_cast<VTapeSettings *>(settings);
} }

View File

@ -1344,7 +1344,7 @@ void TMainWindow::ShowMData()
} }
catch(const VExceptionBadId &e) catch(const VExceptionBadId &e)
{ {
Q_UNUSED(e); Q_UNUSED(e)
MFields(false); MFields(false);
return; return;
} }
@ -1403,7 +1403,7 @@ void TMainWindow::ShowMData()
} }
catch (qmu::QmuParserError &e) catch (qmu::QmuParserError &e)
{ {
Q_UNUSED(e); Q_UNUSED(e)
formula = meash->GetFormula(); formula = meash->GetFormula();
} }
@ -1446,8 +1446,8 @@ void TMainWindow::ShowMDiagram(const QString &name)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::DeployFormula() void TMainWindow::DeployFormula()
{ {
SCASSERT(ui->plainTextEditFormula != nullptr); SCASSERT(ui->plainTextEditFormula != nullptr)
SCASSERT(ui->pushButtonGrow != nullptr); SCASSERT(ui->pushButtonGrow != nullptr)
const QTextCursor cursor = ui->plainTextEditFormula->textCursor(); const QTextCursor cursor = ui->plainTextEditFormula->textCursor();
@ -1787,7 +1787,7 @@ void TMainWindow::SetupMenu()
{ {
QAction *action = new QAction(this); QAction *action = new QAction(this);
recentFileActs[i] = action; recentFileActs[i] = action;
connect(action, &QAction::triggered, [action, this]() connect(action, &QAction::triggered, RECEIVER(this)[action, this]()
{ {
if (action != nullptr) if (action != nullptr)
{ {
@ -1828,8 +1828,11 @@ void TMainWindow::SetupMenu()
AboutToShowWindowMenu(); AboutToShowWindowMenu();
// Help // Help
connect(ui->actionAboutQt, &QAction::triggered, [this](){QMessageBox::aboutQt(this, tr("About Qt"));}); connect(ui->actionAboutQt, &QAction::triggered, RECEIVER(this)[this]()
connect(ui->actionAboutTape, &QAction::triggered, [this]() {
QMessageBox::aboutQt(this, tr("About Qt"));
});
connect(ui->actionAboutTape, &QAction::triggered, RECEIVER(this)[this]()
{ {
DialogAboutTape *aboutDialog = new DialogAboutTape(this); DialogAboutTape *aboutDialog = new DialogAboutTape(this);
aboutDialog->setAttribute(Qt::WA_DeleteOnClose, true); aboutDialog->setAttribute(Qt::WA_DeleteOnClose, true);
@ -1844,7 +1847,7 @@ void TMainWindow::SetupMenu()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::InitWindow() void TMainWindow::InitWindow()
{ {
SCASSERT(m != nullptr); SCASSERT(m != nullptr)
ui->labelToolTip->setVisible(false); ui->labelToolTip->setVisible(false);
ui->tabWidget->setVisible(true); ui->tabWidget->setVisible(true);
ui->dockWidgetDiagram->setVisible(dockDiagramVisible); ui->dockWidgetDiagram->setVisible(dockDiagramVisible);
@ -1969,9 +1972,9 @@ void TMainWindow::InitWindow()
connect(ui->comboBoxPMSystem, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, connect(ui->comboBoxPMSystem, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&TMainWindow::SavePMSystem); &TMainWindow::SavePMSystem);
connect(ui->lineEditFind, &QLineEdit::textChanged, [=] (const QString &term){search->Find(term);}); connect(ui->lineEditFind, &QLineEdit::textChanged, [this] (const QString &term){search->Find(term);});
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, [=] (){search->FindPrevious();}); connect(ui->toolButtonFindPrevious, &QToolButton::clicked, [this] (){search->FindPrevious();});
connect(ui->toolButtonFindNext, &QToolButton::clicked, [=] (){search->FindNext();}); connect(ui->toolButtonFindNext, &QToolButton::clicked, [this] (){search->FindNext();});
connect(search.data(), &VTableSearch::HasResult, [this] (bool state) connect(search.data(), &VTableSearch::HasResult, [this] (bool state)
{ {
@ -2007,7 +2010,10 @@ void TMainWindow::InitWindow()
connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &TMainWindow::SaveMDescription); connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &TMainWindow::SaveMDescription);
connect(ui->lineEditFullName, &QLineEdit::textEdited, this, &TMainWindow::SaveMFullName); connect(ui->lineEditFullName, &QLineEdit::textEdited, this, &TMainWindow::SaveMFullName);
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, [this](){ShowInGraphicalShell(curFile);}); connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, RECEIVER(this)[this]()
{
ShowInGraphicalShell(curFile);
});
InitUnits(); InitUnits();
@ -2052,7 +2058,7 @@ void TMainWindow::ShowUnits()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::ShowHeaderUnits(QTableWidget *table, int column, const QString &unit) void TMainWindow::ShowHeaderUnits(QTableWidget *table, int column, const QString &unit)
{ {
SCASSERT(table != nullptr); SCASSERT(table != nullptr)
QString header = table->horizontalHeaderItem(column)->text(); QString header = table->horizontalHeaderItem(column)->text();
const int index = header.indexOf(QLatin1String("(")); const int index = header.indexOf(QLatin1String("("));
@ -2309,7 +2315,7 @@ void TMainWindow::RefreshTable()
} }
catch (qmu::QmuParserError &e) catch (qmu::QmuParserError &e)
{ {
Q_UNUSED(e); Q_UNUSED(e)
formula = meash->GetFormula(); formula = meash->GetFormula();
} }
@ -2819,10 +2825,10 @@ void TMainWindow::UpdateRecentFileActions()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::CreateWindowMenu(QMenu *menu) void TMainWindow::CreateWindowMenu(QMenu *menu)
{ {
SCASSERT(menu != nullptr); SCASSERT(menu != nullptr)
QAction *action = menu->addAction(tr("&New Window")); QAction *action = menu->addAction(tr("&New Window"));
connect(action, &QAction::triggered, [this]() connect(action, &QAction::triggered, RECEIVER(this)[this]()
{ {
qApp->NewMainWindow(); qApp->NewMainWindow();
qApp->MainWindow()->activateWindow(); qApp->MainWindow()->activateWindow();
@ -2919,8 +2925,8 @@ bool TMainWindow::IgnoreLocking(int error, const QString &path)
} }
return true; return true;
#else #else
Q_UNUSED(error); Q_UNUSED(error)
Q_UNUSED(path); Q_UNUSED(path)
return true;// On older Qt lock assumed always taken. Allow user to ignore warning. return true;// On older Qt lock assumed always taken. Allow user to ignore warning.
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) #endif // QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
} }
@ -2990,7 +2996,7 @@ void TMainWindow::InitUnits()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::InitComboBoxUnits() void TMainWindow::InitComboBoxUnits()
{ {
SCASSERT(comboBoxUnits != nullptr); SCASSERT(comboBoxUnits != nullptr)
comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Cm, true), QVariant(static_cast<int>(Unit::Cm))); comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Cm, true), QVariant(static_cast<int>(Unit::Cm)));
comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Mm, true), QVariant(static_cast<int>(Unit::Mm))); comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Mm, true), QVariant(static_cast<int>(Unit::Mm)));
comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Inch, true), QVariant(static_cast<int>(Unit::Inch))); comboBoxUnits->addItem(VDomDocument::UnitsToStr(Unit::Inch, true), QVariant(static_cast<int>(Unit::Inch)));
@ -2999,7 +3005,7 @@ void TMainWindow::InitComboBoxUnits()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void TMainWindow::InitGender(QComboBox *gender) void TMainWindow::InitGender(QComboBox *gender)
{ {
SCASSERT(gender != nullptr); SCASSERT(gender != nullptr)
gender->addItem(tr("unknown", "gender"), QVariant(static_cast<int>(GenderType::Unknown))); gender->addItem(tr("unknown", "gender"), QVariant(static_cast<int>(GenderType::Unknown)));
gender->addItem(tr("male", "gender"), QVariant(static_cast<int>(GenderType::Male))); gender->addItem(tr("male", "gender"), QVariant(static_cast<int>(GenderType::Male)));
gender->addItem(tr("female", "gender"), QVariant(static_cast<int>(GenderType::Female))); gender->addItem(tr("female", "gender"), QVariant(static_cast<int>(GenderType::Female)));

View File

@ -637,18 +637,15 @@ bool VApplication::event(QEvent *e)
case QEvent::FileOpen: case QEvent::FileOpen:
{ {
QFileOpenEvent *fileOpenEvent = static_cast<QFileOpenEvent *>(e); QFileOpenEvent *fileOpenEvent = static_cast<QFileOpenEvent *>(e);
if(fileOpenEvent) const QString macFileOpen = fileOpenEvent->file();
if(not macFileOpen.isEmpty())
{ {
const QString macFileOpen = fileOpenEvent->file(); MainWindow *window = qobject_cast<MainWindow*>(mainWindow);
if(not macFileOpen.isEmpty()) if (window)
{ {
MainWindow *window = qobject_cast<MainWindow*>(mainWindow); window->LoadPattern(macFileOpen); // open file in existing window
if (window)
{
window->LoadPattern(macFileOpen); // open file in existing window
}
return true;
} }
return true;
} }
break; break;
} }
@ -683,7 +680,7 @@ void VApplication::OpenSettings()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VSettings *VApplication::ValentinaSettings() VSettings *VApplication::ValentinaSettings()
{ {
SCASSERT(settings != nullptr); SCASSERT(settings != nullptr)
return qobject_cast<VSettings *>(settings); return qobject_cast<VSettings *>(settings);
} }

View File

@ -37,22 +37,20 @@
enum class ChildType : char {Invalid = 0, Value = 1, Formula = 2}; enum class ChildType : char {Invalid = 0, Value = 1, Formula = 2};
using namespace VPE;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormulaProperty::VFormulaProperty(const QString &name) VFormulaProperty::VFormulaProperty(const QString &name)
: VProperty(name, static_cast<QVariant::Type>(VFormula::FormulaTypeId())) : VProperty(name, static_cast<QVariant::Type>(VFormula::FormulaTypeId()))
{ {
d_ptr->type = Property::Complex; d_ptr->type = VPE::Property::Complex;
VStringProperty* tmpValue = new VStringProperty(tr("Value")); VPE::VStringProperty* tmpValue = new VPE::VStringProperty(tr("Value"));
addChild(tmpValue); addChild(tmpValue);
tmpValue->setUpdateBehaviour(true, false); tmpValue->setUpdateBehaviour(true, false);
tmpValue->setReadOnly(true); tmpValue->setReadOnly(true);
tmpValue->setOsSeparator(qApp->Settings()->GetOsSeparator()); tmpValue->setOsSeparator(qApp->Settings()->GetOsSeparator());
tmpValue->setTypeForParent(static_cast<int>(ChildType::Value)); tmpValue->setTypeForParent(static_cast<int>(ChildType::Value));
VStringProperty* tmpFormula = new VStringProperty(tr("Formula")); VPE::VStringProperty* tmpFormula = new VPE::VStringProperty(tr("Formula"));
addChild(tmpFormula); addChild(tmpFormula);
tmpFormula->setClearButtonEnable(true); tmpFormula->setClearButtonEnable(true);
tmpFormula->setUpdateBehaviour(true, false); tmpFormula->setUpdateBehaviour(true, false);
@ -94,8 +92,8 @@ Qt::ItemFlags VFormulaProperty::flags(int column) const
QWidget* VFormulaProperty::createEditor(QWidget* parent, const QStyleOptionViewItem& options, QWidget* VFormulaProperty::createEditor(QWidget* parent, const QStyleOptionViewItem& options,
const QAbstractItemDelegate* delegate) const QAbstractItemDelegate* delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
Q_UNUSED(delegate); Q_UNUSED(delegate)
VFormula formula = VProperty::d_ptr->VariantValue.value<VFormula>(); VFormula formula = VProperty::d_ptr->VariantValue.value<VFormula>();
VFormulaPropertyEditor* tmpEditor = new VFormulaPropertyEditor(parent); VFormulaPropertyEditor* tmpEditor = new VFormulaPropertyEditor(parent);
@ -143,7 +141,7 @@ QString VFormulaProperty::type() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VProperty *VFormulaProperty::clone(bool include_children, VProperty *container) const VPE::VProperty *VFormulaProperty::clone(bool include_children, VProperty *container) const
{ {
if (!container) if (!container)
{ {

View File

@ -39,8 +39,6 @@
#include "../vpropertyexplorer/vproperty.h" #include "../vpropertyexplorer/vproperty.h"
#include "../vtools/dialogs/support/dialogeditwrongformula.h" #include "../vtools/dialogs/support/dialogeditwrongformula.h"
using namespace VPE;
// VFormulaPropertyEditor // VFormulaPropertyEditor
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent) VFormulaPropertyEditor::VFormulaPropertyEditor(QWidget *parent)
@ -100,7 +98,7 @@ void VFormulaPropertyEditor::onToolButtonClicked()
TextLabel->setText(formula.getStringValue()); TextLabel->setText(formula.getStringValue());
delete tmpWidget; delete tmpWidget;
emit dataChangedByUser(formula, this); emit dataChangedByUser(formula, this);
UserChangeEvent *event = new UserChangeEvent(); VPE::UserChangeEvent *event = new VPE::UserChangeEvent();
QCoreApplication::postEvent ( this, event ); QCoreApplication::postEvent ( this, event );
} }
} }

View File

@ -43,16 +43,14 @@
#include <QDebug> #include <QDebug>
#include <QRegularExpression> #include <QRegularExpression>
using namespace VPE;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VToolOptionsPropertyBrowser::VToolOptionsPropertyBrowser(QDockWidget *parent) VToolOptionsPropertyBrowser::VToolOptionsPropertyBrowser(QDockWidget *parent)
:QObject(parent), PropertyModel(nullptr), formView(nullptr), currentItem(nullptr), :QObject(parent), PropertyModel(nullptr), formView(nullptr), currentItem(nullptr),
propertyToId(QMap<VProperty *, QString>()), propertyToId(QMap<VPE::VProperty *, QString>()),
idToProperty(QMap<QString, VProperty *>()) idToProperty(QMap<QString, VPE::VProperty *>())
{ {
PropertyModel = new VPropertyModel(this); PropertyModel = new VPE::VPropertyModel(this);
formView = new VPropertyFormView(PropertyModel, parent); formView = new VPE::VPropertyFormView(PropertyModel, parent);
formView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); formView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
QScrollArea *scroll = new QScrollArea(parent); QScrollArea *scroll = new QScrollArea(parent);
@ -61,7 +59,8 @@ VToolOptionsPropertyBrowser::VToolOptionsPropertyBrowser(QDockWidget *parent)
parent->setWidget(scroll); parent->setWidget(scroll);
connect(PropertyModel, &VPropertyModel::onDataChangedByEditor, this, &VToolOptionsPropertyBrowser::userChangedData); connect(PropertyModel, &VPE::VPropertyModel::onDataChangedByEditor, this,
&VToolOptionsPropertyBrowser::userChangedData);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -154,10 +153,9 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
ShowOptionsToolTriangle(item); ShowOptionsToolTriangle(item);
break; break;
case VGraphicsSimpleTextItem::Type: case VGraphicsSimpleTextItem::Type:
currentItem = item->parentItem();
ShowItemOptions(currentItem);
break;
case VControlPointSpline::Type: case VControlPointSpline::Type:
case VSimplePoint::Type:
case VSimpleCurve::Type:
currentItem = item->parentItem(); currentItem = item->parentItem();
ShowItemOptions(currentItem); ShowItemOptions(currentItem);
break; break;
@ -173,14 +171,6 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
case VToolPointFromArcAndTangent::Type: case VToolPointFromArcAndTangent::Type:
ShowOptionsToolPointFromArcAndTangent(item); ShowOptionsToolPointFromArcAndTangent(item);
break; break;
case VSimplePoint::Type:
currentItem = item->parentItem();
ShowItemOptions(currentItem);
break;
case VSimpleCurve::Type:
currentItem = item->parentItem();
ShowItemOptions(currentItem);
break;
case VToolTrueDarts::Type: case VToolTrueDarts::Type:
ShowOptionsToolTrueDarts(item); ShowOptionsToolTrueDarts(item);
break; break;
@ -290,8 +280,6 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
UpdateOptionsToolTriangle(); UpdateOptionsToolTriangle();
break; break;
case VGraphicsSimpleTextItem::Type: case VGraphicsSimpleTextItem::Type:
ShowItemOptions(currentItem->parentItem());
break;
case VControlPointSpline::Type: case VControlPointSpline::Type:
ShowItemOptions(currentItem->parentItem()); ShowItemOptions(currentItem->parentItem());
break; break;
@ -339,9 +327,9 @@ void VToolOptionsPropertyBrowser::RefreshOptions()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::userChangedData(VProperty *property) void VToolOptionsPropertyBrowser::userChangedData(VPE::VProperty *property)
{ {
VProperty *prop = property; VPE::VProperty *prop = property;
if (!propertyToId.contains(prop)) if (!propertyToId.contains(prop))
{ {
if (!propertyToId.contains(prop->getParent()))// Maybe we know parent if (!propertyToId.contains(prop->getParent()))// Maybe we know parent
@ -526,7 +514,7 @@ void VToolOptionsPropertyBrowser::AddPropertyFormula(const QString &propertyName
template<class Tool> template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyObjectName(Tool *i, const QString &propertyName, bool readOnly) void VToolOptionsPropertyBrowser::AddPropertyObjectName(Tool *i, const QString &propertyName, bool readOnly)
{ {
auto itemName = new VStringProperty(propertyName); auto itemName = new VPE::VStringProperty(propertyName);
itemName->setClearButtonEnable(true); itemName->setClearButtonEnable(true);
itemName->setValue(i->name()); itemName->setValue(i->name());
itemName->setReadOnly(readOnly); itemName->setReadOnly(readOnly);
@ -537,7 +525,7 @@ void VToolOptionsPropertyBrowser::AddPropertyObjectName(Tool *i, const QString &
template<class Tool> template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyPointName1(Tool *i, const QString &propertyName) void VToolOptionsPropertyBrowser::AddPropertyPointName1(Tool *i, const QString &propertyName)
{ {
VStringProperty *itemName = new VStringProperty(propertyName); VPE::VStringProperty *itemName = new VPE::VStringProperty(propertyName);
itemName->setClearButtonEnable(true); itemName->setClearButtonEnable(true);
itemName->setValue(i->nameP1()); itemName->setValue(i->nameP1());
AddProperty(itemName, AttrName1); AddProperty(itemName, AttrName1);
@ -547,7 +535,7 @@ void VToolOptionsPropertyBrowser::AddPropertyPointName1(Tool *i, const QString &
template<class Tool> template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyPointName2(Tool *i, const QString &propertyName) void VToolOptionsPropertyBrowser::AddPropertyPointName2(Tool *i, const QString &propertyName)
{ {
VStringProperty *itemName = new VStringProperty(propertyName); VPE::VStringProperty *itemName = new VPE::VStringProperty(propertyName);
itemName->setClearButtonEnable(true); itemName->setClearButtonEnable(true);
itemName->setValue(i->nameP2()); itemName->setValue(i->nameP2());
AddProperty(itemName, AttrName2); AddProperty(itemName, AttrName2);
@ -557,7 +545,7 @@ void VToolOptionsPropertyBrowser::AddPropertyPointName2(Tool *i, const QString &
template<class Tool> template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyOperationSuffix(Tool *i, const QString &propertyName, bool readOnly) void VToolOptionsPropertyBrowser::AddPropertyOperationSuffix(Tool *i, const QString &propertyName, bool readOnly)
{ {
auto itemSuffix = new VStringProperty(propertyName); auto itemSuffix = new VPE::VStringProperty(propertyName);
itemSuffix->setClearButtonEnable(true); itemSuffix->setClearButtonEnable(true);
itemSuffix->setValue(i->Suffix()); itemSuffix->setValue(i->Suffix());
itemSuffix->setReadOnly(readOnly); itemSuffix->setReadOnly(readOnly);
@ -568,7 +556,7 @@ void VToolOptionsPropertyBrowser::AddPropertyOperationSuffix(Tool *i, const QStr
template<class Tool> template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString &propertyName) void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString &propertyName)
{ {
VEnumProperty* itemProperty = new VEnumProperty(propertyName); VPE::VEnumProperty* itemProperty = new VPE::VEnumProperty(propertyName);
itemProperty->setLiterals(QStringList()<< tr("First point") << tr("Second point")); itemProperty->setLiterals(QStringList()<< tr("First point") << tr("Second point"));
itemProperty->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1); itemProperty->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
AddProperty(itemProperty, AttrCrossPoint); AddProperty(itemProperty, AttrCrossPoint);
@ -578,7 +566,7 @@ void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString &
template<class Tool> template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyVCrossPoint(Tool *i, const QString &propertyName) void VToolOptionsPropertyBrowser::AddPropertyVCrossPoint(Tool *i, const QString &propertyName)
{ {
auto itemProperty = new VEnumProperty(propertyName); auto itemProperty = new VPE::VEnumProperty(propertyName);
itemProperty->setLiterals(QStringList()<< tr("Highest point") << tr("Lowest point")); itemProperty->setLiterals(QStringList()<< tr("Highest point") << tr("Lowest point"));
itemProperty->setValue(static_cast<int>(i->GetVCrossPoint())-1); itemProperty->setValue(static_cast<int>(i->GetVCrossPoint())-1);
AddProperty(itemProperty, AttrVCrossPoint); AddProperty(itemProperty, AttrVCrossPoint);
@ -588,7 +576,7 @@ void VToolOptionsPropertyBrowser::AddPropertyVCrossPoint(Tool *i, const QString
template<class Tool> template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyHCrossPoint(Tool *i, const QString &propertyName) void VToolOptionsPropertyBrowser::AddPropertyHCrossPoint(Tool *i, const QString &propertyName)
{ {
auto itemProperty = new VEnumProperty(propertyName); auto itemProperty = new VPE::VEnumProperty(propertyName);
itemProperty->setLiterals(QStringList()<< tr("Leftmost point") << tr("Rightmost point")); itemProperty->setLiterals(QStringList()<< tr("Leftmost point") << tr("Rightmost point"));
itemProperty->setValue(static_cast<int>(i->GetHCrossPoint())-1); itemProperty->setValue(static_cast<int>(i->GetHCrossPoint())-1);
AddProperty(itemProperty, AttrHCrossPoint); AddProperty(itemProperty, AttrHCrossPoint);
@ -598,7 +586,7 @@ void VToolOptionsPropertyBrowser::AddPropertyHCrossPoint(Tool *i, const QString
template<class Tool> template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyAxisType(Tool *i, const QString &propertyName) void VToolOptionsPropertyBrowser::AddPropertyAxisType(Tool *i, const QString &propertyName)
{ {
auto itemProperty = new VEnumProperty(propertyName); auto itemProperty = new VPE::VEnumProperty(propertyName);
itemProperty->setLiterals(QStringList()<< tr("Vertical axis") << tr("Horizontal axis")); itemProperty->setLiterals(QStringList()<< tr("Vertical axis") << tr("Horizontal axis"));
itemProperty->setValue(static_cast<int>(i->GetAxisType())-1); itemProperty->setValue(static_cast<int>(i->GetAxisType())-1);
AddProperty(itemProperty, AttrAxisType); AddProperty(itemProperty, AttrAxisType);
@ -609,9 +597,9 @@ template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &propertyName, void VToolOptionsPropertyBrowser::AddPropertyLineType(Tool *i, const QString &propertyName,
const QMap<QString, QIcon> &styles) const QMap<QString, QIcon> &styles)
{ {
VLineTypeProperty *lineTypeProperty = new VLineTypeProperty(propertyName); VPE::VLineTypeProperty *lineTypeProperty = new VPE::VLineTypeProperty(propertyName);
lineTypeProperty->setStyles(styles); lineTypeProperty->setStyles(styles);
const qint32 index = VLineTypeProperty::IndexOfStyle(styles, i->getLineType()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(styles, i->getLineType());
if (index == -1) if (index == -1)
{ {
qWarning()<<"Can't find line style" << i->getLineType()<<"in list"; qWarning()<<"Can't find line style" << i->getLineType()<<"in list";
@ -625,9 +613,9 @@ template<class Tool>
void VToolOptionsPropertyBrowser::AddPropertyLineColor(Tool *i, const QString &propertyName, void VToolOptionsPropertyBrowser::AddPropertyLineColor(Tool *i, const QString &propertyName,
const QMap<QString, QString> &colors, const QString &id) const QMap<QString, QString> &colors, const QString &id)
{ {
VLineColorProperty *lineColorProperty = new VLineColorProperty(propertyName); VPE::VLineColorProperty *lineColorProperty = new VPE::VLineColorProperty(propertyName);
lineColorProperty->setColors(colors); lineColorProperty->setColors(colors);
const qint32 index = VLineColorProperty::IndexOfColor(colors, i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(colors, i->GetLineColor());
if (index == -1) if (index == -1)
{ {
qWarning()<<"Can't find line style" << i->GetLineColor()<<"in list"; qWarning()<<"Can't find line style" << i->GetLineColor()<<"in list";
@ -835,7 +823,7 @@ void VToolOptionsPropertyBrowser::SetAxisType(const QVariant &value)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::AddProperty(VProperty *property, const QString &id) void VToolOptionsPropertyBrowser::AddProperty(VPE::VProperty *property, const QString &id)
{ {
propertyToId[property] = id; propertyToId[property] = id;
idToProperty[id] = property; idToProperty[id] = property;
@ -843,11 +831,11 @@ void VToolOptionsPropertyBrowser::AddProperty(VProperty *property, const QString
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolSinglePoint(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolSinglePoint(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
@ -865,15 +853,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSinglePoint(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolEndLine(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolEndLine(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolEndLine *i = qgraphicsitem_cast<VToolEndLine *>(currentItem); VToolEndLine *i = qgraphicsitem_cast<VToolEndLine *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -898,15 +886,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolEndLine(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolAlongLine(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolAlongLine(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolAlongLine *i = qgraphicsitem_cast<VToolAlongLine *>(currentItem); VToolAlongLine *i = qgraphicsitem_cast<VToolAlongLine *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -928,15 +916,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolAlongLine(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolArc(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolArc(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolArc *i = qgraphicsitem_cast<VToolArc *>(currentItem); VToolArc *i = qgraphicsitem_cast<VToolArc *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 8: // AttrRadius case 8: // AttrRadius
@ -958,15 +946,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolArc(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolArcWithLength(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolArcWithLength(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolArcWithLength *i = qgraphicsitem_cast<VToolArcWithLength *>(currentItem); VToolArcWithLength *i = qgraphicsitem_cast<VToolArcWithLength *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 8: // AttrRadius case 8: // AttrRadius
@ -988,15 +976,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolArcWithLength(VProperty *propert
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolBisector(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolBisector(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolBisector *i = qgraphicsitem_cast<VToolBisector *>(currentItem); VToolBisector *i = qgraphicsitem_cast<VToolBisector *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -1018,11 +1006,11 @@ void VToolOptionsPropertyBrowser::ChangeDataToolBisector(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolTrueDarts(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolTrueDarts(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
@ -1040,15 +1028,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolTrueDarts(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolCutArc(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolCutArc(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolCutArc *i = qgraphicsitem_cast<VToolCutArc *>(currentItem); VToolCutArc *i = qgraphicsitem_cast<VToolCutArc *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -1064,15 +1052,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutArc(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolCutSpline(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolCutSpline(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolCutSpline *i = qgraphicsitem_cast<VToolCutSpline *>(currentItem); VToolCutSpline *i = qgraphicsitem_cast<VToolCutSpline *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -1088,15 +1076,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutSpline(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolCutSplinePath(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolCutSplinePath(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolCutSplinePath *i = qgraphicsitem_cast<VToolCutSplinePath *>(currentItem); VToolCutSplinePath *i = qgraphicsitem_cast<VToolCutSplinePath *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -1112,15 +1100,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCutSplinePath(VProperty *propert
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolHeight(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolHeight(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolHeight *i = qgraphicsitem_cast<VToolHeight *>(currentItem); VToolHeight *i = qgraphicsitem_cast<VToolHeight *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -1139,15 +1127,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolHeight(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolLine(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolLine(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolLine *i = qgraphicsitem_cast<VToolLine *>(currentItem); VToolLine *i = qgraphicsitem_cast<VToolLine *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 3: // AttrTypeLine case 3: // AttrTypeLine
@ -1163,11 +1151,11 @@ void VToolOptionsPropertyBrowser::ChangeDataToolLine(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolLineIntersect(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolLineIntersect(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
@ -1182,15 +1170,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolLineIntersect(VProperty *propert
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolNormal(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolNormal(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolNormal *i = qgraphicsitem_cast<VToolNormal *>(currentItem); VToolNormal *i = qgraphicsitem_cast<VToolNormal *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 4: // AttrLength case 4: // AttrLength
@ -1215,15 +1203,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolNormal(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolPointOfContact(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolPointOfContact(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolPointOfContact *i = qgraphicsitem_cast<VToolPointOfContact *>(currentItem); VToolPointOfContact *i = qgraphicsitem_cast<VToolPointOfContact *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 8: // AttrRadius case 8: // AttrRadius
@ -1239,11 +1227,11 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfContact(VProperty *proper
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersection(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersection(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
@ -1258,11 +1246,11 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersection(VProperty *p
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionArcs(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionArcs(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
@ -1272,7 +1260,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionArcs(VPropert
break; break;
case 28: // AttrCrossPoint case 28: // AttrCrossPoint
{ {
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole);
SetCrossCirclesPoint<VToolPointOfIntersectionArcs>(value); SetCrossCirclesPoint<VToolPointOfIntersectionArcs>(value);
break; break;
} }
@ -1283,15 +1271,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionArcs(VPropert
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolPointOfIntersectionCircles *i = qgraphicsitem_cast<VToolPointOfIntersectionCircles *>(currentItem); VToolPointOfIntersectionCircles *i = qgraphicsitem_cast<VToolPointOfIntersectionCircles *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -1299,7 +1287,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VProp
break; break;
case 28: // AttrCrossPoint case 28: // AttrCrossPoint
{ {
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole);
SetCrossCirclesPoint<VToolPointOfIntersectionCircles>(value); SetCrossCirclesPoint<VToolPointOfIntersectionCircles>(value);
break; break;
} }
@ -1316,11 +1304,11 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCircles(VProp
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCurves(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCurves(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
@ -1330,13 +1318,13 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCurves(VPrope
break; break;
case 34: // AttrVCrossPoint case 34: // AttrVCrossPoint
{ {
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole);
SetVCrossCurvesPoint<VToolPointOfIntersectionCurves>(value); SetVCrossCurvesPoint<VToolPointOfIntersectionCurves>(value);
break; break;
} }
case 35: // AttrHCrossPoint case 35: // AttrHCrossPoint
{ {
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole);
SetHCrossCurvesPoint<VToolPointOfIntersectionCurves>(value); SetHCrossCurvesPoint<VToolPointOfIntersectionCurves>(value);
break; break;
} }
@ -1347,15 +1335,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointOfIntersectionCurves(VPrope
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolPointFromCircleAndTangent(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolPointFromCircleAndTangent(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolPointFromCircleAndTangent *i = qgraphicsitem_cast<VToolPointFromCircleAndTangent *>(currentItem); VToolPointFromCircleAndTangent *i = qgraphicsitem_cast<VToolPointFromCircleAndTangent *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -1366,7 +1354,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointFromCircleAndTangent(VPrope
break; break;
case 28: // AttrCrossPoint case 28: // AttrCrossPoint
{ {
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole);
SetCrossCirclesPoint<VToolPointFromCircleAndTangent>(value); SetCrossCirclesPoint<VToolPointFromCircleAndTangent>(value);
break; break;
} }
@ -1377,11 +1365,11 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointFromCircleAndTangent(VPrope
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolPointFromArcAndTangent(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolPointFromArcAndTangent(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
@ -1391,7 +1379,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointFromArcAndTangent(VProperty
break; break;
case 28: // AttrCrossPoint case 28: // AttrCrossPoint
{ {
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole);
SetCrossCirclesPoint<VToolPointFromArcAndTangent>(value); SetCrossCirclesPoint<VToolPointFromArcAndTangent>(value);
break; break;
} }
@ -1402,15 +1390,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolPointFromArcAndTangent(VProperty
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolShoulderPoint(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolShoulderPoint(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolShoulderPoint *i = qgraphicsitem_cast<VToolShoulderPoint *>(currentItem); VToolShoulderPoint *i = qgraphicsitem_cast<VToolShoulderPoint *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 4: // AttrLength case 4: // AttrLength
@ -1432,15 +1420,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolShoulderPoint(VProperty *propert
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
auto i = qgraphicsitem_cast<VToolSpline *>(currentItem); auto i = qgraphicsitem_cast<VToolSpline *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
VSpline spl = i->getSpline(); VSpline spl = i->getSpline();
const VFormula f = value.value<VFormula>(); const VFormula f = value.value<VFormula>();
@ -1488,15 +1476,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSpline(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezier(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezier(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
const QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
auto i = qgraphicsitem_cast<VToolCubicBezier *>(currentItem); auto i = qgraphicsitem_cast<VToolCubicBezier *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
@ -1513,15 +1501,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezier(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolSplinePath(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolSplinePath(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolSplinePath *i = qgraphicsitem_cast<VToolSplinePath *>(currentItem); VToolSplinePath *i = qgraphicsitem_cast<VToolSplinePath *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -1537,15 +1525,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSplinePath(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezierPath(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezierPath(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolCubicBezierPath *i = qgraphicsitem_cast<VToolCubicBezierPath *>(currentItem); VToolCubicBezierPath *i = qgraphicsitem_cast<VToolCubicBezierPath *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -1561,11 +1549,11 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCubicBezierPath(VProperty *prope
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolTriangle(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolTriangle(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
@ -1580,15 +1568,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolTriangle(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolLineIntersectAxis(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolLineIntersectAxis(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolLineIntersectAxis *i = qgraphicsitem_cast<VToolLineIntersectAxis *>(currentItem); VToolLineIntersectAxis *i = qgraphicsitem_cast<VToolLineIntersectAxis *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -1610,15 +1598,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolLineIntersectAxis(VProperty *pro
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolCurveIntersectAxis(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolCurveIntersectAxis(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolCurveIntersectAxis *i = qgraphicsitem_cast<VToolCurveIntersectAxis *>(currentItem); VToolCurveIntersectAxis *i = qgraphicsitem_cast<VToolCurveIntersectAxis *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 0: // AttrName case 0: // AttrName
@ -1640,15 +1628,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCurveIntersectAxis(VProperty *pr
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolRotation(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolRotation(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolRotation *i = qgraphicsitem_cast<VToolRotation *>(currentItem); VToolRotation *i = qgraphicsitem_cast<VToolRotation *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 38: // AttrSuffix case 38: // AttrSuffix
@ -1664,15 +1652,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolRotation(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolMove(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolMove(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolMove *i = qgraphicsitem_cast<VToolMove *>(currentItem); VToolMove *i = qgraphicsitem_cast<VToolMove *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 38: // AttrSuffix case 38: // AttrSuffix
@ -1691,11 +1679,11 @@ void VToolOptionsPropertyBrowser::ChangeDataToolMove(VProperty *property)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolFlippingByLine(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolFlippingByLine(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
@ -1710,18 +1698,18 @@ void VToolOptionsPropertyBrowser::ChangeDataToolFlippingByLine(VProperty *proper
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolFlippingByAxis(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolFlippingByAxis(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 39: // AttrAxisType case 39: // AttrAxisType
{ {
const QVariant value = property->data(VProperty::DPC_Data, Qt::EditRole); const QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::EditRole);
SetAxisType<VToolFlippingByAxis>(value); SetAxisType<VToolFlippingByAxis>(value);
break; break;
} }
@ -1735,15 +1723,15 @@ void VToolOptionsPropertyBrowser::ChangeDataToolFlippingByAxis(VProperty *proper
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VToolOptionsPropertyBrowser::ChangeDataToolEllipticalArc(VProperty *property) void VToolOptionsPropertyBrowser::ChangeDataToolEllipticalArc(VPE::VProperty *property)
{ {
SCASSERT(property != nullptr) SCASSERT(property != nullptr)
QVariant value = property->data(VProperty::DPC_Data, Qt::DisplayRole); QVariant value = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole);
const QString id = propertyToId[property]; const QString id = propertyToId[property];
VToolEllipticalArc *i = qgraphicsitem_cast<VToolEllipticalArc *>(currentItem); VToolEllipticalArc *i = qgraphicsitem_cast<VToolEllipticalArc *>(currentItem);
SCASSERT(i != nullptr); SCASSERT(i != nullptr)
switch (PropertiesList().indexOf(id)) switch (PropertiesList().indexOf(id))
{ {
case 40://AttrRadius1 case 40://AttrRadius1
@ -1779,7 +1767,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolSinglePoint(QGraphicsItem *item
AddPropertyObjectName(i, tr("Point label")); AddPropertyObjectName(i, tr("Point label"));
VPointFProperty* itemPosition = new VPointFProperty(tr("Position")); VPE::VPointFProperty* itemPosition = new VPE::VPointFProperty(tr("Position"));
itemPosition->setValue(i->pos()); itemPosition->setValue(i->pos());
AddProperty(itemPosition, QLatin1String("position")); AddProperty(itemPosition, QLatin1String("position"));
} }
@ -1941,7 +1929,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolNormal(QGraphicsItem *item)
AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics()); AddPropertyLineType(i, tr("Line type"), VAbstractTool::LineStylesPics());
AddPropertyLineColor(i, tr("Line color"), VAbstractTool::ColorsList(), AttrLineColor); AddPropertyLineColor(i, tr("Line color"), VAbstractTool::ColorsList(), AttrLineColor);
VDoubleProperty* itemAngle = new VDoubleProperty(tr("Additional angle degrees")); VPE::VDoubleProperty* itemAngle = new VPE::VDoubleProperty(tr("Additional angle degrees"));
itemAngle->setValue(i->GetAngle()); itemAngle->setValue(i->GetAngle());
itemAngle->setSetting("Min", -360); itemAngle->setSetting("Min", -360);
itemAngle->setSetting("Max", 360); itemAngle->setSetting("Max", 360);
@ -2223,12 +2211,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEndLine()
idToProperty[AttrName]->setValue(i->name()); idToProperty[AttrName]->setValue(i->name());
{ {
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index); idToProperty[AttrTypeLine]->setValue(index);
} }
{ {
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrLineColor]->setValue(index); idToProperty[AttrLineColor]->setValue(index);
} }
@ -2248,12 +2236,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolAlongLine()
idToProperty[AttrName]->setValue(i->name()); idToProperty[AttrName]->setValue(i->name());
{ {
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index); idToProperty[AttrTypeLine]->setValue(index);
} }
{ {
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrLineColor]->setValue(index); idToProperty[AttrLineColor]->setValue(index);
} }
@ -2279,7 +2267,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArc()
valueSecondAngle.setValue(i->GetFormulaF2()); valueSecondAngle.setValue(i->GetFormulaF2());
idToProperty[AttrAngle2]->setValue(valueSecondAngle); idToProperty[AttrAngle2]->setValue(valueSecondAngle);
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrColor]->setValue(index); idToProperty[AttrColor]->setValue(index);
} }
@ -2300,7 +2288,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolArcWithLength()
valueLength.setValue(i->GetFormulaLength()); valueLength.setValue(i->GetFormulaLength());
idToProperty[AttrLength]->setValue(valueLength); idToProperty[AttrLength]->setValue(valueLength);
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrColor]->setValue(index); idToProperty[AttrColor]->setValue(index);
} }
@ -2316,12 +2304,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolBisector()
idToProperty[AttrLength]->setValue(valueFormula); idToProperty[AttrLength]->setValue(valueFormula);
{ {
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index); idToProperty[AttrTypeLine]->setValue(index);
} }
{ {
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrLineColor]->setValue(index); idToProperty[AttrLineColor]->setValue(index);
} }
} }
@ -2379,12 +2367,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolHeight()
idToProperty[AttrName]->setValue(i->name()); idToProperty[AttrName]->setValue(i->name());
{ {
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index); idToProperty[AttrTypeLine]->setValue(index);
} }
{ {
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrLineColor]->setValue(index); idToProperty[AttrLineColor]->setValue(index);
} }
} }
@ -2395,12 +2383,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLine()
VToolLine *i = qgraphicsitem_cast<VToolLine *>(currentItem); VToolLine *i = qgraphicsitem_cast<VToolLine *>(currentItem);
{ {
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index); idToProperty[AttrTypeLine]->setValue(index);
} }
{ {
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrLineColor]->setValue(index); idToProperty[AttrLineColor]->setValue(index);
} }
} }
@ -2427,12 +2415,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolNormal()
idToProperty[AttrAngle]->setValue( i->GetAngle()); idToProperty[AttrAngle]->setValue( i->GetAngle());
{ {
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index); idToProperty[AttrTypeLine]->setValue(index);
} }
{ {
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrLineColor]->setValue(index); idToProperty[AttrLineColor]->setValue(index);
} }
} }
@ -2527,12 +2515,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolShoulderPoint()
idToProperty[AttrName]->setValue(i->name()); idToProperty[AttrName]->setValue(i->name());
{ {
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index); idToProperty[AttrTypeLine]->setValue(index);
} }
{ {
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrLineColor]->setValue(index); idToProperty[AttrLineColor]->setValue(index);
} }
} }
@ -2577,7 +2565,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSpline()
length2.setValue(length2F); length2.setValue(length2F);
idToProperty[AttrLength2]->setValue(length2); idToProperty[AttrLength2]->setValue(length2);
idToProperty[AttrColor]->setValue(VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor())); idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
i->GetLineColor()));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -2586,7 +2575,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezier()
auto i = qgraphicsitem_cast<VToolCubicBezier *>(currentItem); auto i = qgraphicsitem_cast<VToolCubicBezier *>(currentItem);
idToProperty[AttrName]->setValue(i->name()); idToProperty[AttrName]->setValue(i->name());
idToProperty[AttrColor]->setValue(VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor())); idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
i->GetLineColor()));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -2595,7 +2585,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolSplinePath()
auto i = qgraphicsitem_cast<VToolSplinePath *>(currentItem); auto i = qgraphicsitem_cast<VToolSplinePath *>(currentItem);
idToProperty[AttrName]->setValue(i->name()); idToProperty[AttrName]->setValue(i->name());
idToProperty[AttrColor]->setValue(VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor())); idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
i->GetLineColor()));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -2604,7 +2595,8 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCubicBezierPath()
auto i = qgraphicsitem_cast<VToolCubicBezierPath *>(currentItem); auto i = qgraphicsitem_cast<VToolCubicBezierPath *>(currentItem);
idToProperty[AttrName]->setValue(i->name()); idToProperty[AttrName]->setValue(i->name());
idToProperty[AttrColor]->setValue(VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor())); idToProperty[AttrColor]->setValue(VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(),
i->GetLineColor()));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -2622,12 +2614,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolLineIntersectAxis()
idToProperty[AttrName]->setValue(i->name()); idToProperty[AttrName]->setValue(i->name());
{ {
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index); idToProperty[AttrTypeLine]->setValue(index);
} }
{ {
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrLineColor]->setValue(index); idToProperty[AttrLineColor]->setValue(index);
} }
@ -2643,12 +2635,12 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolCurveIntersectAxis()
idToProperty[AttrName]->setValue(i->name()); idToProperty[AttrName]->setValue(i->name());
{ {
const qint32 index = VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType()); const qint32 index = VPE::VLineTypeProperty::IndexOfStyle(VAbstractTool::LineStylesPics(), i->getLineType());
idToProperty[AttrTypeLine]->setValue(index); idToProperty[AttrTypeLine]->setValue(index);
} }
{ {
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrLineColor]->setValue(index); idToProperty[AttrLineColor]->setValue(index);
} }
@ -2723,7 +2715,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsToolEllipticalArc()
valueFormulaRotationAngle.setValue(i->GetFormulaRotationAngle()); valueFormulaRotationAngle.setValue(i->GetFormulaRotationAngle());
idToProperty[AttrRotationAngle]->setValue(valueFormulaRotationAngle); idToProperty[AttrRotationAngle]->setValue(valueFormulaRotationAngle);
const qint32 index = VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor()); const qint32 index = VPE::VLineColorProperty::IndexOfColor(VAbstractTool::ColorsList(), i->GetLineColor());
idToProperty[AttrColor]->setValue(index); idToProperty[AttrColor]->setValue(index);
} }

View File

@ -149,7 +149,7 @@ void ConfigDialog::showEvent(QShowEvent *event)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void ConfigDialog::resizeEvent(QResizeEvent *event) void ConfigDialog::resizeEvent(QResizeEvent *event)
{ {
Q_UNUSED(event); Q_UNUSED(event)
// remember the size for the next time this dialog is opened, but only // remember the size for the next time this dialog is opened, but only
// if widget was already initialized, which rules out the resize at // if widget was already initialized, which rules out the resize at
// dialog creating, which would // dialog creating, which would
@ -168,7 +168,7 @@ void ConfigDialog::createIcons()
createIcon("://icon/path_config.png", tr("Paths")); createIcon("://icon/path_config.png", tr("Paths"));
connect(contentsWidget, &QListWidget::currentItemChanged, connect(contentsWidget, &QListWidget::currentItemChanged,
[this](QListWidgetItem *current, QListWidgetItem *previous) RECEIVER(this)[this](QListWidgetItem *current, QListWidgetItem *previous)
{ {
if (current == nullptr) if (current == nullptr)
{ {

View File

@ -106,7 +106,7 @@ void ConfigurationPage::Apply()
settings->SetAutosaveTime(autoTime->value()); settings->SetAutosaveTime(autoTime->value());
QTimer *autoSaveTimer = qApp->getAutoSaveTimer(); QTimer *autoSaveTimer = qApp->getAutoSaveTimer();
SCASSERT(autoSaveTimer); SCASSERT(autoSaveTimer)
autoSaveCheck->isChecked() ? autoSaveTimer->start(autoTime->value()*60000) : autoSaveTimer->stop(); autoSaveCheck->isChecked() ? autoSaveTimer->start(autoTime->value()*60000) : autoSaveTimer->stop();

View File

@ -51,7 +51,7 @@ PathPage::PathPage(QWidget *parent)
: QWidget(parent), defaultButton(nullptr), editButton(nullptr), pathTable(nullptr), pathGroup(nullptr) : QWidget(parent), defaultButton(nullptr), editButton(nullptr), pathTable(nullptr), pathGroup(nullptr)
{ {
QGroupBox *pathGroup = PathGroup(); QGroupBox *pathGroup = PathGroup();
SCASSERT(pathGroup != nullptr); SCASSERT(pathGroup != nullptr)
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(pathGroup); mainLayout->addWidget(pathGroup);
@ -75,7 +75,7 @@ void PathPage::DefaultPath()
{ {
const int row = pathTable->currentRow(); const int row = pathTable->currentRow();
QTableWidgetItem *item = pathTable->item(row, 1); QTableWidgetItem *item = pathTable->item(row, 1);
SCASSERT(item != nullptr); SCASSERT(item != nullptr)
switch (row) switch (row)
{ {
@ -103,7 +103,7 @@ void PathPage::EditPath()
{ {
const int row = pathTable->currentRow(); const int row = pathTable->currentRow();
QTableWidgetItem *item = pathTable->item(row, 1); QTableWidgetItem *item = pathTable->item(row, 1);
SCASSERT(item != nullptr); SCASSERT(item != nullptr)
QString path; QString path;
switch (row) switch (row)
@ -233,7 +233,7 @@ void PathPage::InitTable()
pathTable->resizeRowsToContents(); pathTable->resizeRowsToContents();
pathTable->horizontalHeader()->setStretchLastSection(true); pathTable->horizontalHeader()->setStretchLastSection(true);
connect(pathTable, &QTableWidget::itemSelectionChanged, [this]() connect(pathTable, &QTableWidget::itemSelectionChanged, RECEIVER(this)[this]()
{ {
defaultButton->setEnabled(true); defaultButton->setEnabled(true);
defaultButton->setDefault(false); defaultButton->setDefault(false);

View File

@ -61,7 +61,7 @@ DialogAboutApp::DialogAboutApp(QWidget *parent) :
ui->pushButton_Web_Site->setText(tr("Web site : %1").arg(VER_COMPANYDOMAIN_STR)); ui->pushButton_Web_Site->setText(tr("Web site : %1").arg(VER_COMPANYDOMAIN_STR));
connect(ui->pushButton_Web_Site, &QPushButton::clicked, [this]() connect(ui->pushButton_Web_Site, &QPushButton::clicked, RECEIVER(this)[this]()
{ {
if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false) if ( QDesktopServices::openUrl(QUrl(VER_COMPANYDOMAIN_STR)) == false)
{ {
@ -110,7 +110,7 @@ void DialogAboutApp::showEvent(QShowEvent *event)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogAboutApp::FontPointSize(QWidget *w, int pointSize) void DialogAboutApp::FontPointSize(QWidget *w, int pointSize)
{ {
SCASSERT(w != nullptr); SCASSERT(w != nullptr)
QFont font = w->font(); QFont font = w->font();
font.setPointSize(pointSize); font.setPointSize(pointSize);

View File

@ -62,7 +62,10 @@ DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent)
FillTable(); FillTable();
InitialTable(); InitialTable();
connect(ui->tableWidget, &QTableWidget::cellClicked, this, &DialogHistory::cellClicked); connect(ui->tableWidget, &QTableWidget::cellClicked, this, &DialogHistory::cellClicked);
connect(this, &DialogHistory::ShowHistoryTool, [doc](quint32 id, bool enable){emit doc->ShowTool(id, enable);}); connect(this, &DialogHistory::ShowHistoryTool, RECEIVER(doc)[doc](quint32 id, bool enable)
{
emit doc->ShowTool(id, enable);
});
connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor); connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor);
connect(doc, &VPattern::patternChanged, this, &DialogHistory::UpdateHistory); connect(doc, &VPattern::patternChanged, this, &DialogHistory::UpdateHistory);
ShowPoint(); ShowPoint();
@ -190,7 +193,7 @@ void DialogHistory::FillTable()
{ {
cursorRow = CursorRow(); cursorRow = CursorRow();
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0); QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
SCASSERT(item != nullptr); SCASSERT(item != nullptr)
item->setIcon(QIcon("://icon/32x32/put_after.png")); item->setIcon(QIcon("://icon/32x32/put_after.png"));
} }
ui->tableWidget->resizeColumnsToContents(); ui->tableWidget->resizeColumnsToContents();
@ -270,25 +273,25 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::Spline: case Tool::Spline:
{ {
const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId()); const QSharedPointer<VSpline> spl = data->GeometricObject<VSpline>(tool.getId());
SCASSERT(not spl.isNull()); SCASSERT(not spl.isNull())
return spl->NameForHistory(tr("Curve")); return spl->NameForHistory(tr("Curve"));
} }
case Tool::CubicBezier: case Tool::CubicBezier:
{ {
const QSharedPointer<VCubicBezier> spl = data->GeometricObject<VCubicBezier>(tool.getId()); const QSharedPointer<VCubicBezier> spl = data->GeometricObject<VCubicBezier>(tool.getId());
SCASSERT(not spl.isNull()); SCASSERT(not spl.isNull())
return spl->NameForHistory(tr("Cubic bezier curve")); return spl->NameForHistory(tr("Cubic bezier curve"));
} }
case Tool::Arc: case Tool::Arc:
{ {
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId()); const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
SCASSERT(not arc.isNull()); SCASSERT(not arc.isNull())
return arc->NameForHistory(tr("Arc")); return arc->NameForHistory(tr("Arc"));
} }
case Tool::ArcWithLength: case Tool::ArcWithLength:
{ {
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId()); const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(tool.getId());
SCASSERT(not arc.isNull()); SCASSERT(not arc.isNull())
return tr("%1 with length %2") return tr("%1 with length %2")
.arg(arc->NameForHistory(tr("Arc"))) .arg(arc->NameForHistory(tr("Arc")))
.arg(arc->GetLength()); .arg(arc->GetLength());
@ -296,13 +299,13 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::SplinePath: case Tool::SplinePath:
{ {
const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(tool.getId()); const QSharedPointer<VSplinePath> splPath = data->GeometricObject<VSplinePath>(tool.getId());
SCASSERT(not splPath.isNull()); SCASSERT(not splPath.isNull())
return splPath->NameForHistory(tr("Spline path")); return splPath->NameForHistory(tr("Spline path"));
} }
case Tool::CubicBezierPath: case Tool::CubicBezierPath:
{ {
const QSharedPointer<VCubicBezierPath> splPath = data->GeometricObject<VCubicBezierPath>(tool.getId()); const QSharedPointer<VCubicBezierPath> splPath = data->GeometricObject<VCubicBezierPath>(tool.getId());
SCASSERT(not splPath.isNull()); SCASSERT(not splPath.isNull())
return splPath->NameForHistory(tr("Cubic bezier curve path")); return splPath->NameForHistory(tr("Cubic bezier curve path"));
} }
case Tool::PointOfContact: case Tool::PointOfContact:
@ -330,7 +333,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::CutArc: case Tool::CutArc:
{ {
const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, AttrArc)); const QSharedPointer<VArc> arc = data->GeometricObject<VArc>(AttrUInt(domElem, AttrArc));
SCASSERT(not arc.isNull()); SCASSERT(not arc.isNull())
return tr("%1 - cut %2") return tr("%1 - cut %2")
.arg(PointName(tool.getId())) .arg(PointName(tool.getId()))
.arg(arc->NameForHistory(tr("arc"))); .arg(arc->NameForHistory(tr("arc")));
@ -339,7 +342,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
{ {
const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline); const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline);
const QSharedPointer<VAbstractCubicBezier> spl = data->GeometricObject<VAbstractCubicBezier>(splineId); const QSharedPointer<VAbstractCubicBezier> spl = data->GeometricObject<VAbstractCubicBezier>(splineId);
SCASSERT(not spl.isNull()); SCASSERT(not spl.isNull())
return tr("%1 - cut %2") return tr("%1 - cut %2")
.arg(PointName(tool.getId())) .arg(PointName(tool.getId()))
.arg(spl->NameForHistory(tr("curve"))); .arg(spl->NameForHistory(tr("curve")));
@ -349,7 +352,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath); const quint32 splinePathId = AttrUInt(domElem, VToolCutSplinePath::AttrSplinePath);
const QSharedPointer<VAbstractCubicBezierPath> splPath = const QSharedPointer<VAbstractCubicBezierPath> splPath =
data->GeometricObject<VAbstractCubicBezierPath>(splinePathId); data->GeometricObject<VAbstractCubicBezierPath>(splinePathId);
SCASSERT(not splPath.isNull()); SCASSERT(not splPath.isNull())
return tr("%1 - cut %2") return tr("%1 - cut %2")
.arg(PointName(tool.getId())) .arg(PointName(tool.getId()))
.arg(splPath->NameForHistory(tr("curve path"))); .arg(splPath->NameForHistory(tr("curve path")));
@ -382,7 +385,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::EllipticalArc: case Tool::EllipticalArc:
{ {
const QSharedPointer<VEllipticalArc> elArc = data->GeometricObject<VEllipticalArc>(tool.getId()); const QSharedPointer<VEllipticalArc> elArc = data->GeometricObject<VEllipticalArc>(tool.getId());
SCASSERT(not elArc.isNull()); SCASSERT(not elArc.isNull())
return tr("%1 with length %2") return tr("%1 with length %2")
.arg(elArc->NameForHistory(tr("Elliptical arc"))) .arg(elArc->NameForHistory(tr("Elliptical arc")))
.arg(elArc->GetLength()); .arg(elArc->GetLength());
@ -499,7 +502,7 @@ void DialogHistory::RetranslateUi()
UpdateHistory(); UpdateHistory();
QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0); QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0);
SCASSERT(item != nullptr); SCASSERT(item != nullptr)
item->setIcon(QIcon("")); item->setIcon(QIcon(""));
cursorRow = currentRow; cursorRow = currentRow;

View File

@ -110,15 +110,15 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par
connect(ui->lineEditName, &QLineEdit::editingFinished, this, &DialogIncrements::SaveIncrName); connect(ui->lineEditName, &QLineEdit::editingFinished, this, &DialogIncrements::SaveIncrName);
connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &DialogIncrements::SaveIncrDescription); connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &DialogIncrements::SaveIncrDescription);
connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogIncrements::SaveIncrFormula); connect(ui->plainTextEditFormula, &QPlainTextEdit::textChanged, this, &DialogIncrements::SaveIncrFormula);
connect(ui->lineEditFind, &QLineEdit::textEdited, [=](const QString &term){search->Find(term);}); connect(ui->lineEditFind, &QLineEdit::textEdited, RECEIVER(this)[this](const QString &term){search->Find(term);});
connect(ui->toolButtonFindPrevious, &QToolButton::clicked, [=](){search->FindPrevious();}); connect(ui->toolButtonFindPrevious, &QToolButton::clicked, RECEIVER(this)[this](){search->FindPrevious();});
connect(ui->toolButtonFindNext, &QToolButton::clicked, [=](){search->FindNext();}); connect(ui->toolButtonFindNext, &QToolButton::clicked, RECEIVER(this)[this](){search->FindNext();});
connect(search.data(), &VTableSearch::HasResult, [this] (bool state) connect(search.data(), &VTableSearch::HasResult, RECEIVER(this)[this] (bool state)
{ {
ui->toolButtonFindPrevious->setEnabled(state); ui->toolButtonFindPrevious->setEnabled(state);
}); });
connect(search.data(), &VTableSearch::HasResult, [this] (bool state) connect(search.data(), &VTableSearch::HasResult, RECEIVER(this)[this] (bool state)
{ {
ui->toolButtonFindNext->setEnabled(state); ui->toolButtonFindNext->setEnabled(state);
}); });
@ -168,7 +168,7 @@ void DialogIncrements::FillIncrements()
} }
catch (qmu::QmuParserError &e) catch (qmu::QmuParserError &e)
{ {
Q_UNUSED(e); Q_UNUSED(e)
formula = incr->GetFormula(); formula = incr->GetFormula();
} }
@ -184,7 +184,7 @@ void DialogIncrements::FillIncrements()
template <typename T> template <typename T>
void DialogIncrements::FillTable(const QMap<QString, T> &varTable, QTableWidget *table) void DialogIncrements::FillTable(const QMap<QString, T> &varTable, QTableWidget *table)
{ {
SCASSERT(table != nullptr); SCASSERT(table != nullptr)
qint32 currentRow = -1; qint32 currentRow = -1;
QMapIterator<QString, T> i(varTable); QMapIterator<QString, T> i(varTable);
@ -270,7 +270,7 @@ void DialogIncrements::ShowUnits()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column, const QString &unit) void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column, const QString &unit)
{ {
SCASSERT(table != nullptr); SCASSERT(table != nullptr)
const QString header = table->horizontalHeaderItem(column)->text(); const QString header = table->horizontalHeaderItem(column)->text();
const QString unitHeader = QString("%1 (%2)").arg(header).arg(unit); const QString unitHeader = QString("%1 (%2)").arg(header).arg(unit);
@ -280,7 +280,7 @@ void DialogIncrements::ShowHeaderUnits(QTableWidget *table, int column, const QS
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::AddCell(QTableWidget *table, const QString &text, int row, int column, int aligment, bool ok) void DialogIncrements::AddCell(QTableWidget *table, const QString &text, int row, int column, int aligment, bool ok)
{ {
SCASSERT(table != nullptr); SCASSERT(table != nullptr)
QTableWidgetItem *item = new QTableWidgetItem(text); QTableWidgetItem *item = new QTableWidgetItem(text);
item->setTextAlignment(aligment); item->setTextAlignment(aligment);
@ -664,8 +664,8 @@ void DialogIncrements::SaveIncrFormula()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::DeployFormula() void DialogIncrements::DeployFormula()
{ {
SCASSERT(ui->plainTextEditFormula != nullptr); SCASSERT(ui->plainTextEditFormula != nullptr)
SCASSERT(ui->pushButtonGrow != nullptr); SCASSERT(ui->pushButtonGrow != nullptr)
const QTextCursor cursor = ui->plainTextEditFormula->textCursor(); const QTextCursor cursor = ui->plainTextEditFormula->textCursor();
@ -797,7 +797,7 @@ void DialogIncrements::ShowIncrementDetails()
} }
catch(const VExceptionBadId &e) catch(const VExceptionBadId &e)
{ {
Q_UNUSED(e); Q_UNUSED(e)
EnableDetails(false); EnableDetails(false);
return; return;
} }
@ -820,7 +820,7 @@ void DialogIncrements::ShowIncrementDetails()
} }
catch (qmu::QmuParserError &e) catch (qmu::QmuParserError &e)
{ {
Q_UNUSED(e); Q_UNUSED(e)
formula = incr->GetFormula(); formula = incr->GetFormula();
} }

View File

@ -54,8 +54,8 @@ DialogLayoutProgress::DialogLayoutProgress(int count, QWidget *parent)
movie->start (); movie->start ();
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel); QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCancel != nullptr); SCASSERT(bCancel != nullptr)
connect(bCancel, &QPushButton::clicked, [this](){emit Abort();}); connect(bCancel, &QPushButton::clicked, RECEIVER(this)[this](){emit Abort();});
setModal(true); setModal(true);
this->setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint); this->setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
@ -91,11 +91,10 @@ void DialogLayoutProgress::Error(const LayoutErrors &state)
case LayoutErrors::PrepareLayoutError: case LayoutErrors::PrepareLayoutError:
qCritical() << tr("Couldn't prepare data for creation layout"); qCritical() << tr("Couldn't prepare data for creation layout");
break; break;
case LayoutErrors::ProcessStoped:
break;
case LayoutErrors::EmptyPaperError: case LayoutErrors::EmptyPaperError:
qCritical() << tr("Several workpieces left not arranged, but none of them match for paper"); qCritical() << tr("Several workpieces left not arranged, but none of them match for paper");
break; break;
case LayoutErrors::ProcessStoped:
default: default:
break; break;
} }

View File

@ -224,8 +224,6 @@ void DialogLayoutSettings::SetGroup(const Cases &value)
ui->radioButtonTwoGroups->setChecked(true); ui->radioButtonTwoGroups->setChecked(true);
break; break;
case Cases::CaseDesc: case Cases::CaseDesc:
ui->radioButtonDescendingArea->setChecked(true);
break;
default: default:
ui->radioButtonDescendingArea->setChecked(true); ui->radioButtonDescendingArea->setChecked(true);
break; break;

View File

@ -85,7 +85,7 @@ void DialogNewPattern::CheckState()
} }
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr); SCASSERT(bOk != nullptr)
bOk->setEnabled(flagName); bOk->setEnabled(flagName);
} }

View File

@ -69,7 +69,7 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
ui->lineEditAuthor->setClearButtonEnabled(true); ui->lineEditAuthor->setClearButtonEnabled(true);
#endif #endif
SCASSERT(doc != nullptr); SCASSERT(doc != nullptr)
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c()); qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
@ -87,7 +87,10 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
} }
ui->lineEditPathToFile->setCursorPosition(0); ui->lineEditPathToFile->setCursorPosition(0);
connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, [this](){ShowInGraphicalShell(m_filePath);}); connect(ui->pushButtonShowInExplorer, &QPushButton::clicked, RECEIVER(this)[this]()
{
ShowInGraphicalShell(m_filePath);
});
#if defined(Q_OS_MAC) #if defined(Q_OS_MAC)
ui->pushButtonShowInExplorer->setText(tr("Show in Finder")); ui->pushButtonShowInExplorer->setText(tr("Show in Finder"));
#endif //defined(Q_OS_MAC) #endif //defined(Q_OS_MAC)
@ -108,7 +111,7 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
&DialogPatternProperties::Apply); &DialogPatternProperties::Apply);
QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel); QPushButton *bCancel = ui->buttonBox->button(QDialogButtonBox::Cancel);
SCASSERT(bCancel != nullptr); SCASSERT(bCancel != nullptr)
connect(bCancel, &QPushButton::clicked, this, &DialogPatternProperties::close); connect(bCancel, &QPushButton::clicked, this, &DialogPatternProperties::close);
ui->tabWidget->setCurrentIndex(0); ui->tabWidget->setCurrentIndex(0);
@ -135,7 +138,7 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
const QString size = QString().setNum(doc->GetDefCustomSize()); const QString size = QString().setNum(doc->GetDefCustomSize());
SetDefaultSize(size); SetDefaultSize(size);
connect(ui->radioButtonDefFromP, &QRadioButton::toggled, [this]() connect(ui->radioButtonDefFromP, &QRadioButton::toggled, RECEIVER(this)[this]()
{ {
ui->comboBoxHeight->setEnabled(ui->radioButtonDefFromP->isChecked()); ui->comboBoxHeight->setEnabled(ui->radioButtonDefFromP->isChecked());
ui->comboBoxSize->setEnabled(ui->radioButtonDefFromP->isChecked()); ui->comboBoxSize->setEnabled(ui->radioButtonDefFromP->isChecked());
@ -143,19 +146,20 @@ DialogPatternProperties::DialogPatternProperties(const QString &filePath, VPatte
auto DefValueChanged = [this](){defaultChanged = true;}; auto DefValueChanged = [this](){defaultChanged = true;};
connect(ui->radioButtonDefFromP, &QRadioButton::toggled, DefValueChanged); connect(ui->radioButtonDefFromP, &QRadioButton::toggled, RECEIVER(this)DefValueChanged);
ui->radioButtonDefFromP->setChecked(doc->IsDefCustom()); ui->radioButtonDefFromP->setChecked(doc->IsDefCustom());
connect(ui->comboBoxHeight, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(ui->comboBoxHeight, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
DefValueChanged); RECEIVER(this)DefValueChanged);
connect(ui->comboBoxSize, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), DefValueChanged); connect(ui->comboBoxSize, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
RECEIVER(this)DefValueChanged);
const bool readOnly = doc->IsReadOnly(); const bool readOnly = doc->IsReadOnly();
ui->checkBoxPatternReadOnly->setChecked(readOnly); ui->checkBoxPatternReadOnly->setChecked(readOnly);
if (not readOnly) if (not readOnly)
{ {
connect(ui->checkBoxPatternReadOnly, &QRadioButton::toggled, [this](){securityChanged = true;}); connect(ui->checkBoxPatternReadOnly, &QRadioButton::toggled, RECEIVER(this)[this](){securityChanged = true;});
} }
else else
{ {
@ -689,7 +693,7 @@ void DialogPatternProperties::SetOptions(const QMap<GVal, bool> &option)
template<typename GVal> template<typename GVal>
void DialogPatternProperties::InitComboBox(QComboBox *box, const QMap<GVal, bool> &option) void DialogPatternProperties::InitComboBox(QComboBox *box, const QMap<GVal, bool> &option)
{ {
SCASSERT(box != nullptr); SCASSERT(box != nullptr)
box->clear(); box->clear();
@ -725,7 +729,7 @@ void DialogPatternProperties::InitImage()
{ {
ui->imageLabel->setContextMenuPolicy(Qt::CustomContextMenu); ui->imageLabel->setContextMenuPolicy(Qt::CustomContextMenu);
ui->imageLabel->setScaledContents(true); ui->imageLabel->setScaledContents(true);
connect(ui->imageLabel, &QWidget::customContextMenuRequested, [this]() connect(ui->imageLabel, &QWidget::customContextMenuRequested, RECEIVER(this)[this]()
{ {
QMenu menu(this); QMenu menu(this);
menu.addAction(deleteAction); menu.addAction(deleteAction);
@ -741,7 +745,7 @@ void DialogPatternProperties::InitImage()
saveImageAction = new QAction(tr("Save image to file"), this); saveImageAction = new QAction(tr("Save image to file"), this);
showImageAction = new QAction(tr("Show image"), this); showImageAction = new QAction(tr("Show image"), this);
connect(deleteAction, &QAction::triggered, [this]() connect(deleteAction, &QAction::triggered, RECEIVER(this)[this]()
{ {
doc->DeleteImage(); doc->DeleteImage();
ui->imageLabel->setText(tr("Change image")); ui->imageLabel->setText(tr("Change image"));
@ -752,7 +756,7 @@ void DialogPatternProperties::InitImage()
connect(changeImageAction, &QAction::triggered, this, &DialogPatternProperties::ChangeImage); connect(changeImageAction, &QAction::triggered, this, &DialogPatternProperties::ChangeImage);
connect(saveImageAction, &QAction::triggered, this, &DialogPatternProperties::SaveImage); connect(saveImageAction, &QAction::triggered, this, &DialogPatternProperties::SaveImage);
connect(showImageAction, &QAction::triggered, [this]() connect(showImageAction, &QAction::triggered, RECEIVER(this)[this]()
{ {
QLabel *label = new QLabel(this, Qt::Window); QLabel *label = new QLabel(this, Qt::Window);
const QImage image = GetImage(); const QImage image = GetImage();

View File

@ -130,7 +130,7 @@ bool DialogPatternXmlEdit::ApplyNodeChange(QDomNode domElement, QString name, QS
bool DialogPatternXmlEdit::ApplyNodeAdd(QDomNode domElement, VXMLTreeElement* treeElement, QString name, QString value) bool DialogPatternXmlEdit::ApplyNodeAdd(QDomNode domElement, VXMLTreeElement* treeElement, QString name, QString value)
{ {
QDomElement newnode = domElement.ownerDocument().createElement(name); QDomElement newnode = domElement.ownerDocument().createElement(name);
//SCASSERT(newnode != nullptr); //SCASSERT(newnode != nullptr)
newnode.setNodeValue(value); newnode.setNodeValue(value);
domElement.appendChild(newnode); domElement.appendChild(newnode);
treeElement->SetDocNode(newnode); treeElement->SetDocNode(newnode);
@ -285,7 +285,7 @@ bool DialogPatternXmlEdit::DeleteNodeAndSons(VXMLTreeElement * currentNode, bool
} }
if (index < 0) if (index < 0)
{ {
SCASSERT(index==0); SCASSERT(index==0)
return false; return false;
} }
parent->removeRow(index); parent->removeRow(index);
@ -321,7 +321,7 @@ DialogPatternXmlEdit::ChangesStackElement* DialogPatternXmlEdit::CreateStackElem
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool DialogPatternXmlEdit::UndoChange(DialogPatternXmlEdit::ChangesStackElement* current) bool DialogPatternXmlEdit::UndoChange(DialogPatternXmlEdit::ChangesStackElement* current)
{ {
SCASSERT(current != nullptr); SCASSERT(current != nullptr)
VXMLTreeElement * currentNode = current->element; VXMLTreeElement * currentNode = current->element;
@ -374,7 +374,7 @@ bool DialogPatternXmlEdit::UndoChange(DialogPatternXmlEdit::ChangesStackElement*
} }
if (index < 0) if (index < 0)
{ {
SCASSERT(index==0); SCASSERT(index==0)
return false; return false;
} }
parent->removeRow(index); parent->removeRow(index);
@ -612,7 +612,7 @@ void DialogPatternXmlEdit::RemoveChangeStackElement(ChangesStackElement* elmt)
} }
if (index->next == nullptr) if (index->next == nullptr)
{ {
SCASSERT(index->next != nullptr); SCASSERT(index->next != nullptr)
return; return;
} }
delete index->next->newText; delete index->next->newText;
@ -813,7 +813,7 @@ void DialogPatternXmlEdit::ButtonSetClicked()
{ // If node was created or edited previously, rewrite { // If node was created or edited previously, rewrite
if (this->currentNodeEditedStatus == DialogPatternXmlEdit::ChangeTypeDelete) if (this->currentNodeEditedStatus == DialogPatternXmlEdit::ChangeTypeDelete)
{ // You shouldn't be able to edit a deleted node... { // You shouldn't be able to edit a deleted node...
SCASSERT(this->currentNodeEditedStatus != DialogPatternXmlEdit::ChangeTypeDelete); SCASSERT(this->currentNodeEditedStatus != DialogPatternXmlEdit::ChangeTypeDelete)
ClearEditData(); ClearEditData();
return; return;
} }
@ -933,7 +933,7 @@ void DialogPatternXmlEdit::BaseSelectionChanged(int value)
ui->pushButton_Apply_Changes->setEnabled(false); ui->pushButton_Apply_Changes->setEnabled(false);
index = ui->comboBox_Base_Selection->itemData(value).toInt(); //.convert(QVariant::Int); index = ui->comboBox_Base_Selection->itemData(value).toInt(); //.convert(QVariant::Int);
SCASSERT(value < rootBasesNum); SCASSERT(value < rootBasesNum)
// QMessageBox::information(this, "test", QString("%1:%2").arg(value).arg(index)); // QMessageBox::information(this, "test", QString("%1:%2").arg(value).arg(index));
// Clear all tree info and nodes // Clear all tree info and nodes
@ -1006,7 +1006,7 @@ void DialogPatternXmlEdit::ElementClicked ( const QModelIndex & index )
} }
if (item2->GetelementType() == VXMLTreeElement::TypeRoot) if (item2->GetelementType() == VXMLTreeElement::TypeRoot)
{ {
ui->label_type_value->setText(tr("Root node"));; ui->label_type_value->setText(tr("Root node"));
ui->pushButton_Add_son->setEnabled(true); ui->pushButton_Add_son->setEnabled(true);
} }
else if (item2->GetelementType() == VXMLTreeElement::TypeNode) else if (item2->GetelementType() == VXMLTreeElement::TypeNode)

View File

@ -59,7 +59,7 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c()); qApp->ValentinaSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale::c());
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr); SCASSERT(bOk != nullptr)
bOk->setEnabled(false); bOk->setEnabled(false);
#if QT_VERSION > QT_VERSION_CHECK(5, 1, 0) #if QT_VERSION > QT_VERSION_CHECK(5, 1, 0)
@ -97,9 +97,10 @@ DialogSaveLayout::DialogSaveLayout(int count, const QString &fileName, QWidget *
ui->labelExample->setText(tr("Example:") + FileName() + QLatin1String("1") + Format()); ui->labelExample->setText(tr("Example:") + FileName() + QLatin1String("1") + Format());
}; };
connect(ui->lineEditFileName, &QLineEdit::textChanged, ShowExample); connect(ui->lineEditFileName, &QLineEdit::textChanged, RECEIVER(this)ShowExample);
connect(ui->comboBoxFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), ShowExample); connect(ui->comboBoxFormat, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
connect(ui->pushButtonBrowse, &QPushButton::clicked, [this]() RECEIVER(this)ShowExample);
connect(ui->pushButtonBrowse, &QPushButton::clicked, RECEIVER(this)[this]()
{ {
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"),
qApp->ValentinaSettings()->GetPathLayout(), qApp->ValentinaSettings()->GetPathLayout(),
@ -229,7 +230,7 @@ void DialogSaveLayout::Save()
void DialogSaveLayout::PathChanged(const QString &text) void DialogSaveLayout::PathChanged(const QString &text)
{ {
QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
SCASSERT(bOk != nullptr); SCASSERT(bOk != nullptr)
QPalette palette = ui->lineEditPath->palette(); QPalette palette = ui->lineEditPath->palette();

View File

@ -103,7 +103,7 @@ void VWidgetGroups::CtxMenu(const QPoint &pos)
item = ui->tableWidget->item(row, 0); item = ui->tableWidget->item(row, 0);
const quint32 id = item->data(Qt::UserRole).toUInt(); const quint32 id = item->data(Qt::UserRole).toUInt();
QMenu *menu = new QMenu; QMenu *menu = new QMenu(this);
QAction *actionRename = menu->addAction(tr("Rename")); QAction *actionRename = menu->addAction(tr("Rename"));
QAction *actionDelete = menu->addAction(tr("Delete")); QAction *actionDelete = menu->addAction(tr("Delete"));
QAction *selectedAction = menu->exec(ui->tableWidget->viewport()->mapToGlobal(pos)); QAction *selectedAction = menu->exec(ui->tableWidget->viewport()->mapToGlobal(pos));

View File

@ -50,7 +50,7 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(icons); Q_INIT_RESOURCE(icons);
Q_INIT_RESOURCE(toolicon); Q_INIT_RESOURCE(toolicon);
QT_REQUIRE_VERSION(argc, argv, "5.0.0"); QT_REQUIRE_VERSION(argc, argv, "5.0.0")
qt_qhash_seed.store(0); // Lock producing random attribute order in XML qt_qhash_seed.store(0); // Lock producing random attribute order in XML

View File

@ -135,7 +135,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternChangesWereSaved); connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternChangesWereSaved);
connect(doc, &VPattern::UndoCommand, this, &MainWindow::FullParseFile); connect(doc, &VPattern::UndoCommand, this, &MainWindow::FullParseFile);
connect(doc, &VPattern::SetEnabledGUI, this, &MainWindow::SetEnabledGUI); connect(doc, &VPattern::SetEnabledGUI, this, &MainWindow::SetEnabledGUI);
connect(doc, &VPattern::CheckLayout, [this]() connect(doc, &VPattern::CheckLayout, RECEIVER(this)[this]()
{ {
if (pattern->DataPieces()->count() == 0) if (pattern->DataPieces()->count() == 0)
{ {
@ -174,7 +174,7 @@ MainWindow::MainWindow(QWidget *parent)
ui->dockWidgetLayoutPages->setVisible(false); ui->dockWidgetLayoutPages->setVisible(false);
connect(watcher, &QFileSystemWatcher::fileChanged, this, &MainWindow::MeasurementsChanged); connect(watcher, &QFileSystemWatcher::fileChanged, this, &MainWindow::MeasurementsChanged);
connect(qApp, &QApplication::focusChanged, [this](QWidget *old, QWidget *now) connect(qApp, &QApplication::focusChanged, RECEIVER(this)[this](QWidget *old, QWidget *now)
{ {
if (old == nullptr && isAncestorOf(now) == true) if (old == nullptr && isAncestorOf(now) == true)
{// focus IN {// focus IN
@ -575,7 +575,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
} }
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene); VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool.data(), &DialogTool::ChosenObject); connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool.data(), &DialogTool::ChosenObject);
connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool.data(), &DialogTool::SelectedObject); connect(scene, &VMainGraphicsScene::SelectedObject, dialogTool.data(), &DialogTool::SelectedObject);
@ -629,11 +629,11 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
template <typename DrawTool> template <typename DrawTool>
void MainWindow::ClosedDialog(int result) void MainWindow::ClosedDialog(int result)
{ {
SCASSERT(not dialogTool.isNull()); SCASSERT(not dialogTool.isNull())
if (result == QDialog::Accepted) if (result == QDialog::Accepted)
{ {
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene); VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(DrawTool::Create(dialogTool, scene, doc, pattern)); QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(DrawTool::Create(dialogTool, scene, doc, pattern));
ui->view->itemClicked(tool); ui->view->itemClicked(tool);
@ -649,13 +649,13 @@ void MainWindow::ClosedDialog(int result)
template <typename DrawTool> template <typename DrawTool>
void MainWindow::ClosedDialogWithApply(int result, VMainGraphicsScene *scene) void MainWindow::ClosedDialogWithApply(int result, VMainGraphicsScene *scene)
{ {
SCASSERT(not dialogTool.isNull()); SCASSERT(not dialogTool.isNull())
if (result == QDialog::Accepted) if (result == QDialog::Accepted)
{ {
// Only create tool if not already created with apply // Only create tool if not already created with apply
if (dialogTool->GetAssociatedTool() == nullptr) if (dialogTool->GetAssociatedTool() == nullptr)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
dialogTool->SetAssociatedTool( dialogTool->SetAssociatedTool(
dynamic_cast<VAbstractTool * > (DrawTool::Create(dialogTool, scene, doc, pattern))); dynamic_cast<VAbstractTool * > (DrawTool::Create(dialogTool, scene, doc, pattern)));
@ -666,7 +666,7 @@ void MainWindow::ClosedDialogWithApply(int result, VMainGraphicsScene *scene)
vtool->FullUpdateFromGuiApply(); vtool->FullUpdateFromGuiApply();
} }
} }
SCASSERT(not dialogTool.isNull()); SCASSERT(not dialogTool.isNull())
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(dialogTool->GetAssociatedTool()); QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(dialogTool->GetAssociatedTool());
ui->view->itemClicked(tool); ui->view->itemClicked(tool);
if (dialogTool->GetAssociatedTool() != nullptr) if (dialogTool->GetAssociatedTool() != nullptr)
@ -694,12 +694,12 @@ void MainWindow::ClosedDialogWithApply(int result, VMainGraphicsScene *scene)
template <typename DrawTool> template <typename DrawTool>
void MainWindow::ApplyDialog(VMainGraphicsScene *scene) void MainWindow::ApplyDialog(VMainGraphicsScene *scene)
{ {
SCASSERT(not dialogTool.isNull()); SCASSERT(not dialogTool.isNull())
// Only create tool if not already created with apply // Only create tool if not already created with apply
if (dialogTool->GetAssociatedTool() == nullptr) if (dialogTool->GetAssociatedTool() == nullptr)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
dialogTool->SetAssociatedTool( dialogTool->SetAssociatedTool(
static_cast<VAbstractTool * > (DrawTool::Create(dialogTool, scene, doc, pattern))); static_cast<VAbstractTool * > (DrawTool::Create(dialogTool, scene, doc, pattern)));
@ -707,7 +707,7 @@ void MainWindow::ApplyDialog(VMainGraphicsScene *scene)
else else
{ // Or update associated tool with data { // Or update associated tool with data
VDrawTool * vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool()); VDrawTool * vtool= static_cast<VDrawTool *>(dialogTool->GetAssociatedTool());
SCASSERT(vtool != nullptr); SCASSERT(vtool != nullptr)
vtool->FullUpdateFromGuiApply(); vtool->FullUpdateFromGuiApply();
} }
} }
@ -1123,11 +1123,11 @@ void MainWindow::ToolMove(bool checked)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogGroup(int result) void MainWindow::ClosedDialogGroup(int result)
{ {
SCASSERT(dialogTool != nullptr); SCASSERT(dialogTool != nullptr)
if (result == QDialog::Accepted) if (result == QDialog::Accepted)
{ {
DialogGroup *dialog = qobject_cast<DialogGroup*>(dialogTool); DialogGroup *dialog = qobject_cast<DialogGroup*>(dialogTool);
SCASSERT(dialog != nullptr); SCASSERT(dialog != nullptr)
const QDomElement group = doc->CreateGroup(pattern->getNextId(), dialog->GetName(), dialog->GetGroup()); const QDomElement group = doc->CreateGroup(pattern->getNextId(), dialog->GetName(), dialog->GetGroup());
if (not group.isNull()) if (not group.isNull())
{ {
@ -1705,9 +1705,9 @@ void MainWindow::ToolBarDraws()
comboBoxDraws->setSizeAdjustPolicy(QComboBox::AdjustToContents); comboBoxDraws->setSizeAdjustPolicy(QComboBox::AdjustToContents);
comboBoxDraws->setEnabled(false); comboBoxDraws->setEnabled(false);
connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(comboBoxDraws, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[this](int index){ChangePP(index);}); RECEIVER(this)[this](int index){ChangePP(index);});
connect(ui->actionOptionDraw, &QAction::triggered, [this]() connect(ui->actionOptionDraw, &QAction::triggered, RECEIVER(this)[this]()
{ {
const QString activDraw = doc->GetNameActivPP(); const QString activDraw = doc->GetNameActivPP();
const QString nameDraw = PatternPieceName(activDraw); const QString nameDraw = PatternPieceName(activDraw);
@ -2076,8 +2076,6 @@ void MainWindow::keyPressEvent ( QKeyEvent * event )
ArrowTool(); ArrowTool();
break; break;
case Qt::Key_Return: case Qt::Key_Return:
EndVisualization();
break;
case Qt::Key_Enter: case Qt::Key_Enter:
EndVisualization(); EndVisualization();
break; break;
@ -2096,7 +2094,7 @@ void MainWindow::SaveCurrentScene()
if (mode == Draw::Calculation || mode == Draw::Modeling) if (mode == Draw::Calculation || mode == Draw::Modeling)
{ {
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene); VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
/*Save transform*/ /*Save transform*/
scene->setTransform(ui->view->transform()); scene->setTransform(ui->view->transform());
@ -2115,7 +2113,7 @@ void MainWindow::SaveCurrentScene()
void MainWindow::RestoreCurrentScene() void MainWindow::RestoreCurrentScene()
{ {
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene); VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
/*Set transform for current scene*/ /*Set transform for current scene*/
ui->view->setTransform(scene->transform()); ui->view->setTransform(scene->transform());
@ -2335,7 +2333,7 @@ void MainWindow::ActionLayout(bool checked)
mode = Draw::Layout; mode = Draw::Layout;
SetEnableTool(true); SetEnableTool(true);
SetEnableWidgets(true); SetEnableWidgets(true);
ui->toolBox->setCurrentIndex(6); ui->toolBox->setCurrentIndex(ui->toolBox->indexOf(ui->layoutPage));
mouseCoordinate->setText(""); mouseCoordinate->setText("");
@ -2615,7 +2613,7 @@ void MainWindow::FullParseFile()
} }
catch (const VExceptionUndo &e) catch (const VExceptionUndo &e)
{ {
Q_UNUSED(e); Q_UNUSED(e)
/* If user want undo last operation before undo we need finish broken redo operation. For those we post event /* If user want undo last operation before undo we need finish broken redo operation. For those we post event
* myself. Later in method customEvent call undo.*/ * myself. Later in method customEvent call undo.*/
QApplication::postEvent(this, new UndoEvent()); QApplication::postEvent(this, new UndoEvent());
@ -3577,13 +3575,15 @@ void MainWindow::AddDocks()
//Add dock //Add dock
actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction(); actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction();
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetToolOptions); ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetToolOptions);
connect(ui->dockWidgetToolOptions, &QDockWidget::visibilityChanged, [this](bool visible){ connect(ui->dockWidgetToolOptions, &QDockWidget::visibilityChanged, RECEIVER(this)[this](bool visible)
{
isDockToolOptionsVisible = visible; isDockToolOptionsVisible = visible;
}); });
actionDockWidgetGroups = ui->dockWidgetGroups->toggleViewAction(); actionDockWidgetGroups = ui->dockWidgetGroups->toggleViewAction();
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetGroups); ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetGroups);
connect(ui->dockWidgetGroups, &QDockWidget::visibilityChanged, [this](bool visible){ connect(ui->dockWidgetGroups, &QDockWidget::visibilityChanged, RECEIVER(this)[this](bool visible)
{
isDockGroupsVisible = visible; isDockGroupsVisible = visible;
}); });
@ -3634,14 +3634,14 @@ void MainWindow::CreateActions()
connect(ui->actionDetails, &QAction::triggered, this, &MainWindow::ActionDetails); connect(ui->actionDetails, &QAction::triggered, this, &MainWindow::ActionDetails);
connect(ui->actionLayout, &QAction::triggered, this, &MainWindow::ActionLayout); connect(ui->actionLayout, &QAction::triggered, this, &MainWindow::ActionLayout);
connect(ui->actionHistory, &QAction::triggered, [this](bool checked) connect(ui->actionHistory, &QAction::triggered, RECEIVER(this)[this](bool checked)
{ {
if (checked) if (checked)
{ {
dialogHistory = new DialogHistory(pattern, doc, this); dialogHistory = new DialogHistory(pattern, doc, this);
dialogHistory->setWindowFlags(Qt::Window); dialogHistory->setWindowFlags(Qt::Window);
connect(this, &MainWindow::RefreshHistory, dialogHistory.data(), &DialogHistory::UpdateHistory); connect(this, &MainWindow::RefreshHistory, dialogHistory.data(), &DialogHistory::UpdateHistory);
connect(dialogHistory.data(), &DialogHistory::DialogClosed, [this]() connect(dialogHistory.data(), &DialogHistory::DialogClosed, RECEIVER(this)[this]()
{ {
ui->actionHistory->setChecked(false); ui->actionHistory->setChecked(false);
delete dialogHistory; delete dialogHistory;
@ -3657,7 +3657,7 @@ void MainWindow::CreateActions()
} }
}); });
connect(ui->actionNewDraw, &QAction::triggered, [this]() connect(ui->actionNewDraw, &QAction::triggered, RECEIVER(this)[this]()
{ {
qCDebug(vMainWindow, "New PP."); qCDebug(vMainWindow, "New PP.");
QString patternPieceName = tr("Pattern piece %1").arg(comboBoxDraws->count()+1); QString patternPieceName = tr("Pattern piece %1").arg(comboBoxDraws->count()+1);
@ -3680,12 +3680,12 @@ void MainWindow::CreateActions()
connect(ui->actionOpen, &QAction::triggered, this, &MainWindow::Open); connect(ui->actionOpen, &QAction::triggered, this, &MainWindow::Open);
connect(ui->actionNew, &QAction::triggered, this, &MainWindow::New); connect(ui->actionNew, &QAction::triggered, this, &MainWindow::New);
connect(ui->actionTable, &QAction::triggered, [this](bool checked) connect(ui->actionTable, &QAction::triggered, RECEIVER(this)[this](bool checked)
{ {
if (checked) if (checked)
{ {
dialogTable = new DialogIncrements(pattern, doc, this); dialogTable = new DialogIncrements(pattern, doc, this);
connect(dialogTable.data(), &DialogIncrements::DialogClosed, [this]() connect(dialogTable.data(), &DialogIncrements::DialogClosed, RECEIVER(this)[this]()
{ {
ui->actionTable->setChecked(false); ui->actionTable->setChecked(false);
delete dialogTable; delete dialogTable;
@ -3699,12 +3699,12 @@ void MainWindow::CreateActions()
} }
}); });
connect(ui->actionAbout_Qt, &QAction::triggered, [this]() connect(ui->actionAbout_Qt, &QAction::triggered, RECEIVER(this)[this]()
{ {
QMessageBox::aboutQt(this, tr("About Qt")); QMessageBox::aboutQt(this, tr("About Qt"));
}); });
connect(ui->actionAbout_Valentina, &QAction::triggered, [this]() connect(ui->actionAbout_Valentina, &QAction::triggered, RECEIVER(this)[this]()
{ {
DialogAboutApp *aboutDialog = new DialogAboutApp(this); DialogAboutApp *aboutDialog = new DialogAboutApp(this);
aboutDialog->setAttribute(Qt::WA_DeleteOnClose, true); aboutDialog->setAttribute(Qt::WA_DeleteOnClose, true);
@ -3714,13 +3714,13 @@ void MainWindow::CreateActions()
connect(ui->actionExit, &QAction::triggered, this, &MainWindow::close); connect(ui->actionExit, &QAction::triggered, this, &MainWindow::close);
connect(ui->actionPreferences, &QAction::triggered, this, &MainWindow::Preferences); connect(ui->actionPreferences, &QAction::triggered, this, &MainWindow::Preferences);
connect(ui->actionReportBug, &QAction::triggered, [this]() connect(ui->actionReportBug, &QAction::triggered, RECEIVER(this)[this]()
{ {
qCDebug(vMainWindow, "Reporting bug"); qCDebug(vMainWindow, "Reporting bug");
QDesktopServices::openUrl(QUrl(QStringLiteral("https://bitbucket.org/dismine/valentina/issues/new"))); QDesktopServices::openUrl(QUrl(QStringLiteral("https://bitbucket.org/dismine/valentina/issues/new")));
}); });
connect(ui->actionOnlineHelp, &QAction::triggered, [this]() connect(ui->actionOnlineHelp, &QAction::triggered, RECEIVER(this)[this]()
{ {
qCDebug(vMainWindow, "Showing online help"); qCDebug(vMainWindow, "Showing online help");
QDesktopServices::openUrl(QUrl(QStringLiteral("https://bitbucket.org/dismine/valentina/wiki/manual/Content"))); QDesktopServices::openUrl(QUrl(QStringLiteral("https://bitbucket.org/dismine/valentina/wiki/manual/Content")));
@ -3728,10 +3728,10 @@ void MainWindow::CreateActions()
connect(ui->actionLast_tool, &QAction::triggered, this, &MainWindow::LastUsedTool); connect(ui->actionLast_tool, &QAction::triggered, this, &MainWindow::LastUsedTool);
connect(ui->actionPattern_properties, &QAction::triggered, [this]() connect(ui->actionPattern_properties, &QAction::triggered, RECEIVER(this)[this]()
{ {
DialogPatternProperties proper(curFile, doc, pattern, this); DialogPatternProperties proper(curFile, doc, pattern, this);
connect(&proper, &DialogPatternProperties::UpdateGradation, [this]() connect(&proper, &DialogPatternProperties::UpdateGradation, RECEIVER(this)[this]()
{ {
UpdateHeightsList(VMeasurement::ListHeights(doc->GetGradationHeights(), qApp->patternUnit())); UpdateHeightsList(VMeasurement::ListHeights(doc->GetGradationHeights(), qApp->patternUnit()));
UpdateSizesList(VMeasurement::ListSizes(doc->GetGradationSizes(), qApp->patternUnit())); UpdateSizesList(VMeasurement::ListSizes(doc->GetGradationSizes(), qApp->patternUnit()));
@ -3740,14 +3740,14 @@ void MainWindow::CreateActions()
}); });
ui->actionPattern_properties->setEnabled(false); ui->actionPattern_properties->setEnabled(false);
connect(ui->actionEdit_pattern_code, &QAction::triggered, [this]() connect(ui->actionEdit_pattern_code, &QAction::triggered, RECEIVER(this)[this]()
{ {
DialogPatternXmlEdit *pattern = new DialogPatternXmlEdit (this, doc); DialogPatternXmlEdit *pattern = new DialogPatternXmlEdit (this, doc);
pattern->setAttribute(Qt::WA_DeleteOnClose, true); pattern->setAttribute(Qt::WA_DeleteOnClose, true);
pattern->show(); pattern->show();
}); });
connect(ui->actionClosePattern, &QAction::triggered, [this]() connect(ui->actionClosePattern, &QAction::triggered, RECEIVER(this)[this]()
{ {
if (MaybeSave()) if (MaybeSave())
{ {
@ -3756,7 +3756,7 @@ void MainWindow::CreateActions()
} }
}); });
connect(ui->actionShowCurveDetails, &QAction::triggered, [this](bool checked) connect(ui->actionShowCurveDetails, &QAction::triggered, RECEIVER(this)[this](bool checked)
{ {
ui->view->itemClicked(nullptr); ui->view->itemClicked(nullptr);
sceneDraw->EnableDetailsMode(checked); sceneDraw->EnableDetailsMode(checked);
@ -3765,7 +3765,7 @@ void MainWindow::CreateActions()
connect(ui->actionLoadIndividual, &QAction::triggered, this, &MainWindow::LoadIndividual); connect(ui->actionLoadIndividual, &QAction::triggered, this, &MainWindow::LoadIndividual);
connect(ui->actionLoadStandard, &QAction::triggered, this, &MainWindow::LoadStandard); connect(ui->actionLoadStandard, &QAction::triggered, this, &MainWindow::LoadStandard);
connect(ui->actionCreateNew, &QAction::triggered, [this]() connect(ui->actionCreateNew, &QAction::triggered, RECEIVER(this)[this]()
{ {
const QString tape = qApp->TapeFilePath(); const QString tape = qApp->TapeFilePath();
const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath(); const QString workingDirectory = QFileInfo(tape).absoluteDir().absolutePath();
@ -3787,9 +3787,8 @@ void MainWindow::CreateActions()
QAction *action = new QAction(this); QAction *action = new QAction(this);
action->setVisible(false); action->setVisible(false);
recentFileActs[i] = action; recentFileActs[i] = action;
connect(recentFileActs[i], &QAction::triggered, [action, this]() connect(recentFileActs[i], &QAction::triggered, RECEIVER(this)[action, this]()
{ {
// cppcheck-suppress nullPointerRedundantCheck
if (action != nullptr) if (action != nullptr)
{ {
const QString filePath = action->data().toString(); const QString filePath = action->data().toString();
@ -4768,8 +4767,8 @@ bool MainWindow::IgnoreLocking(int error, const QString &path)
} }
return true; return true;
#else #else
Q_UNUSED(error); Q_UNUSED(error)
Q_UNUSED(path); Q_UNUSED(path)
return true;// On older Qt lock assumed always taken. Allow user to ignore warning. return true;// On older Qt lock assumed always taken. Allow user to ignore warning.
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) #endif // QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
} }

View File

@ -1451,7 +1451,7 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="page_6"> <widget class="QWidget" name="layoutPage">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>

View File

@ -174,11 +174,10 @@ void MainWindowsNoGUI::ErrorConsoleMode(const LayoutErrors &state)
case LayoutErrors::PrepareLayoutError: case LayoutErrors::PrepareLayoutError:
qCritical() << tr("Couldn't prepare data for creation layout"); qCritical() << tr("Couldn't prepare data for creation layout");
break; break;
case LayoutErrors::ProcessStoped:
break;
case LayoutErrors::EmptyPaperError: case LayoutErrors::EmptyPaperError:
qCritical() << tr("Several workpieces left not arranged, but none of them match for paper"); qCritical() << tr("Several workpieces left not arranged, but none of them match for paper");
break; break;
case LayoutErrors::ProcessStoped:
default: default:
break; break;
} }
@ -1153,7 +1152,7 @@ bool MainWindowsNoGUI::IsPagesFit(const QSizeF &printPaper) const
// On previous stage already was checked if pages have uniform size // On previous stage already was checked if pages have uniform size
// Enough will be to check only one page // Enough will be to check only one page
QGraphicsRectItem *p = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0)); QGraphicsRectItem *p = qgraphicsitem_cast<QGraphicsRectItem *>(papers.at(0));
SCASSERT(p != nullptr); SCASSERT(p != nullptr)
const QSizeF pSize = p->rect().size(); const QSizeF pSize = p->rect().size();
if (pSize.height() <= printPaper.height() && pSize.width() <= printPaper.width()) if (pSize.height() <= printPaper.height() && pSize.width() <= printPaper.width())
{ {
@ -1182,7 +1181,7 @@ int MainWindowsNoGUI::ContinueIfLayoutStale()
msgBox.setDefaultButton(QMessageBox::No); msgBox.setDefaultButton(QMessageBox::No);
QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
QGridLayout* layout = static_cast<QGridLayout*>(msgBox.layout()); QGridLayout* layout = static_cast<QGridLayout*>(msgBox.layout());
SCASSERT(layout != nullptr); SCASSERT(layout != nullptr)
layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount());
msgBox.exec(); msgBox.exec();
return msgBox.result(); return msgBox.result();

View File

@ -70,8 +70,8 @@ VPattern::VPattern(VContainer *data, Draw *mode, VMainGraphicsScene *sceneDraw,
VMainGraphicsScene *sceneDetail, QObject *parent) VMainGraphicsScene *sceneDetail, QObject *parent)
: VAbstractPattern(parent), data(data), mode(mode), sceneDraw(sceneDraw), sceneDetail(sceneDetail) : VAbstractPattern(parent), data(data), mode(mode), sceneDraw(sceneDraw), sceneDetail(sceneDetail)
{ {
SCASSERT(sceneDraw != nullptr); SCASSERT(sceneDraw != nullptr)
SCASSERT(sceneDetail != nullptr); SCASSERT(sceneDetail != nullptr)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -137,8 +137,8 @@ void VPattern::Parse(const Document &parse)
break; break;
} }
SCASSERT(sceneDraw != nullptr); SCASSERT(sceneDraw != nullptr)
SCASSERT(sceneDetail != nullptr); SCASSERT(sceneDetail != nullptr)
QStringList tags = QStringList() << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes QStringList tags = QStringList() << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes
<< TagMeasurements << TagVersion << TagGradation << TagImage << TagUnit << TagMeasurements << TagVersion << TagGradation << TagImage << TagUnit
<< TagPatternName << TagPatternNum << TagCompanyName << TagCustomerName << TagPatternName << TagPatternNum << TagCompanyName << TagCustomerName
@ -317,10 +317,10 @@ void VPattern::setCurrentData()
void VPattern::UpdateToolData(const quint32 &id, VContainer *data) void VPattern::UpdateToolData(const quint32 &id, VContainer *data)
{ {
Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0"); //-V712 //-V654 Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0"); //-V712 //-V654
SCASSERT(data != nullptr); SCASSERT(data != nullptr)
ToolExists(id); ToolExists(id);
VDataTool *tool = tools.value(id); VDataTool *tool = tools.value(id);
SCASSERT(tool != nullptr); SCASSERT(tool != nullptr)
tool->VDataTool::setData(data); tool->VDataTool::setData(data);
} }
@ -428,7 +428,7 @@ void VPattern::LiteParseTree(const Document &parse)
} }
catch (const VExceptionUndo &e) catch (const VExceptionUndo &e)
{ {
Q_UNUSED(e); Q_UNUSED(e)
/* If user want undo last operation before undo we need finish broken redo operation. For those we post event /* If user want undo last operation before undo we need finish broken redo operation. For those we post event
* myself. Later in method customEvent call undo.*/ * myself. Later in method customEvent call undo.*/
QApplication::postEvent(this, new UndoEvent()); QApplication::postEvent(this, new UndoEvent());
@ -664,8 +664,8 @@ void VPattern::ParseDrawElement(const QDomNode &node, const Document &parse)
*/ */
void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const Draw &mode) void VPattern::ParseDrawMode(const QDomNode &node, const Document &parse, const Draw &mode)
{ {
SCASSERT(sceneDraw != nullptr); SCASSERT(sceneDraw != nullptr)
SCASSERT(sceneDetail != nullptr); SCASSERT(sceneDetail != nullptr)
VMainGraphicsScene *scene = nullptr; VMainGraphicsScene *scene = nullptr;
if (mode == Draw::Calculation) if (mode == Draw::Calculation)
{ {
@ -1021,7 +1021,7 @@ void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id
void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement, void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse, const QString &type) const Document &parse, const QString &type)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of point is empty"); Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of point is empty");
@ -1135,7 +1135,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document &parse) const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
{ {
@ -1191,11 +1191,6 @@ QString VPattern::GetLabelBase(quint32 index) const
alphabet = al.split(","); alphabet = al.split(",");
break; break;
} }
case 1: // en
{
alphabet = def.split(",");
break;
}
case 2: // fr case 2: // fr
{ {
const QString al = QStringLiteral("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z"); const QString al = QStringLiteral("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z");
@ -1232,6 +1227,7 @@ QString VPattern::GetLabelBase(quint32 index) const
alphabet = al.split(","); alphabet = al.split(",");
break; break;
} }
case 1: // en
default: // en default: // en
{ {
alphabet = def.split(","); alphabet = def.split(",");
@ -1254,7 +1250,7 @@ QString VPattern::GetLabelBase(quint32 index) const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
VToolBasePoint *spoint = nullptr; VToolBasePoint *spoint = nullptr;
@ -1285,7 +1281,7 @@ void VPattern::ParseToolBasePoint(VMainGraphicsScene *scene, const QDomElement &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1335,7 +1331,7 @@ void VPattern::ParseToolEndLine(VMainGraphicsScene *scene, QDomElement &domEleme
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1380,7 +1376,7 @@ void VPattern::ParseToolAlongLine(VMainGraphicsScene *scene, QDomElement &domEle
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1426,7 +1422,7 @@ void VPattern::ParseToolShoulderPoint(VMainGraphicsScene *scene, QDomElement &do
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1472,7 +1468,7 @@ void VPattern::ParseToolNormal(VMainGraphicsScene *scene, QDomElement &domElemen
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1518,7 +1514,7 @@ void VPattern::ParseToolBisector(VMainGraphicsScene *scene, QDomElement &domElem
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1548,7 +1544,7 @@ void VPattern::ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomEleme
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1610,7 +1606,7 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)
{ // Possible case. Parent was deleted, but the node object is still here. { // Possible case. Parent was deleted, but the node object is still here.
Q_UNUSED(e); Q_UNUSED(e)
return;// Just ignore return;// Just ignore
} }
data->UpdateGObject(id, new VPointF(*point, point->name(), mx, my, idObject, Draw::Modeling)); data->UpdateGObject(id, new VPointF(*point, point->name(), mx, my, idObject, Draw::Modeling));
@ -1627,7 +1623,7 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1658,7 +1654,7 @@ void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &dom
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) void VPattern::ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1689,7 +1685,7 @@ void VPattern::ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &d
void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDomElement &domElement, void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document &parse) const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1717,7 +1713,7 @@ void VPattern::ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDo
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1758,7 +1754,7 @@ void VPattern::ParseToolCutSpline(VMainGraphicsScene *scene, QDomElement &domEle
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1800,7 +1796,7 @@ void VPattern::ParseToolCutSplinePath(VMainGraphicsScene *scene, QDomElement &do
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1842,7 +1838,7 @@ void VPattern::ParseToolCutArc(VMainGraphicsScene *scene, QDomElement &domElemen
void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse) const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1893,7 +1889,7 @@ void VPattern::ParseToolLineIntersectAxis(VMainGraphicsScene *scene, QDomElement
void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement, void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse) const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1942,7 +1938,7 @@ void VPattern::ParseToolCurveIntersectAxis(VMainGraphicsScene *scene, QDomElemen
void VPattern::ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const QDomElement &domElement, void VPattern::ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document &parse) const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -1974,7 +1970,7 @@ void VPattern::ParseToolPointOfIntersectionArcs(VMainGraphicsScene *scene, const
void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QDomElement &domElement, void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse) const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -2017,7 +2013,7 @@ void VPattern::ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QD
void VPattern::ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDomElement &domElement, void VPattern::ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse) const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -2048,7 +2044,7 @@ void VPattern::ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDo
void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement, void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse) const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -2089,7 +2085,7 @@ void VPattern::ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDo
void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const QDomElement &domElement, void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document &parse) const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -2120,7 +2116,7 @@ void VPattern::ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -2163,7 +2159,7 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &
// TODO. Delete if minimal supported version is 0.2.7 // TODO. Delete if minimal supported version is 0.2.7
void VPattern::ParseOldToolSpline(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) void VPattern::ParseOldToolSpline(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -2203,7 +2199,7 @@ void VPattern::ParseOldToolSpline(VMainGraphicsScene *scene, const QDomElement &
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -2235,7 +2231,7 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen
if (spl != nullptr) if (spl != nullptr)
{ {
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow()); VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
SCASSERT(window != nullptr); SCASSERT(window != nullptr)
connect(spl, &VToolSpline::ToolTip, window, &VAbstractMainWindow::ShowToolTip); connect(spl, &VToolSpline::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
} }
@ -2267,7 +2263,7 @@ void VPattern::ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElemen
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) void VPattern::ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -2307,7 +2303,7 @@ void VPattern::ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -2368,7 +2364,7 @@ void VPattern::ParseOldToolSplinePath(VMainGraphicsScene *scene, const QDomEleme
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -2424,7 +2420,7 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
if (spl != nullptr) if (spl != nullptr)
{ {
VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow()); VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow());
SCASSERT(window != nullptr); SCASSERT(window != nullptr)
connect(spl, &VToolSplinePath::ToolTip, window, &VAbstractMainWindow::ShowToolTip); connect(spl, &VToolSplinePath::ToolTip, window, &VAbstractMainWindow::ShowToolTip);
} }
@ -2466,7 +2462,7 @@ void VPattern::ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolCubicBezierPath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) void VPattern::ParseToolCubicBezierPath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
try try
@ -2547,7 +2543,7 @@ void VPattern::ParseNodeSpline(const QDomElement &domElement, const Document &pa
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)
{ // Possible case. Parent was deleted, but the node object is still here. { // Possible case. Parent was deleted, but the node object is still here.
Q_UNUSED(e); Q_UNUSED(e)
return;// Just ignore return;// Just ignore
} }
@ -2593,7 +2589,7 @@ void VPattern::ParseNodeSplinePath(const QDomElement &domElement, const Document
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)
{ // Possible case. Parent was deleted, but the node object is still here. { // Possible case. Parent was deleted, but the node object is still here.
Q_UNUSED(e); Q_UNUSED(e)
return;// Just ignore return;// Just ignore
} }
VNodeSplinePath::Create(this, data, id, idObject, parse, Source::FromFile, "", idTool); VNodeSplinePath::Create(this, data, id, idObject, parse, Source::FromFile, "", idTool);
@ -2609,7 +2605,7 @@ void VPattern::ParseNodeSplinePath(const QDomElement &domElement, const Document
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
try try
@ -2654,7 +2650,7 @@ void VPattern::ParseToolArc(VMainGraphicsScene *scene, QDomElement &domElement,
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolEllipticalArc(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
try try
@ -2722,7 +2718,7 @@ void VPattern::ParseNodeEllipticalArc(const QDomElement &domElement, const Docum
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)
{ // Possible case. Parent was deleted, but the node object is still here. { // Possible case. Parent was deleted, but the node object is still here.
Q_UNUSED(e); Q_UNUSED(e)
return;// Just ignore return;// Just ignore
} }
arc->setIdObject(idObject); arc->setIdObject(idObject);
@ -2757,7 +2753,7 @@ void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse
} }
catch (const VExceptionBadId &e) catch (const VExceptionBadId &e)
{ // Possible case. Parent was deleted, but the node object is still here. { // Possible case. Parent was deleted, but the node object is still here.
Q_UNUSED(e); Q_UNUSED(e)
return;// Just ignore return;// Just ignore
} }
arc->setIdObject(idObject); arc->setIdObject(idObject);
@ -2776,7 +2772,7 @@ void VPattern::ParseNodeArc(const QDomElement &domElement, const Document &parse
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
try try
@ -2822,7 +2818,7 @@ void VPattern::ParseToolArcWithLength(VMainGraphicsScene *scene, QDomElement &do
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
try try
@ -2865,7 +2861,7 @@ void VPattern::ParseToolRotation(VMainGraphicsScene *scene, QDomElement &domElem
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolFlippingByLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolFlippingByLine(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
try try
@ -2895,7 +2891,7 @@ void VPattern::ParseToolFlippingByLine(VMainGraphicsScene *scene, QDomElement &d
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolFlippingByAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolFlippingByAxis(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
try try
@ -2925,7 +2921,7 @@ void VPattern::ParseToolFlippingByAxis(VMainGraphicsScene *scene, QDomElement &d
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::ParseToolMove(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse) void VPattern::ParseToolMove(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
try try
@ -3077,7 +3073,7 @@ void VPattern::GarbageCollector()
void VPattern::ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domElement, void VPattern::ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domElement,
const Document &parse, const QString &type) const Document &parse, const QString &type)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
@ -3140,7 +3136,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, QDomElement &domEle
void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
const QString &type) const QString &type)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of arc is empty"); Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of arc is empty");
@ -3176,7 +3172,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, QDomElement &domElemen
void VPattern::ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, void VPattern::ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
const QString &type) const QString &type)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of elliptical arc is empty"); Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of elliptical arc is empty");
@ -3208,7 +3204,7 @@ void VPattern::ParseEllipticalArcElement(VMainGraphicsScene *scene, QDomElement
void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement, void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement,
const Document &parse, const QString &type) const Document &parse, const QString &type)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
@ -3245,7 +3241,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
void VPattern::ParseOperationElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse, void VPattern::ParseOperationElement(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse,
const QString &type) const QString &type)
{ {
SCASSERT(scene != nullptr); SCASSERT(scene != nullptr)
Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of operation is empty"); Q_ASSERT_X(not type.isEmpty(), Q_FUNC_INFO, "type of operation is empty");
@ -3778,8 +3774,8 @@ void VPattern::SetReadOnly(bool rOnly)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPattern::PrepareForParse(const Document &parse) void VPattern::PrepareForParse(const Document &parse)
{ {
SCASSERT(sceneDraw != nullptr); SCASSERT(sceneDraw != nullptr)
SCASSERT(sceneDetail != nullptr); SCASSERT(sceneDetail != nullptr)
if (parse == Document::FullParse) if (parse == Document::FullParse)
{ {
TestUniqueId(); TestUniqueId();
@ -3976,7 +3972,7 @@ QRectF VPattern::ToolBoundingRect(const QRectF &rec, const quint32 &id) const
if (tools.contains(id)) if (tools.contains(id))
{ {
const T *vTool = qobject_cast<T *>(tools.value(id)); const T *vTool = qobject_cast<T *>(tools.value(id));
SCASSERT(vTool != nullptr); SCASSERT(vTool != nullptr)
QRectF childrenRect = vTool->childrenBoundingRect(); QRectF childrenRect = vTool->childrenBoundingRect();
//map to scene coordinate. //map to scene coordinate.
@ -4002,7 +3998,7 @@ void VPattern::IncrementReferens(quint32 id) const
Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0"); Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0");
ToolExists(id); ToolExists(id);
VDataTool *tool = tools.value(id); VDataTool *tool = tools.value(id);
SCASSERT(tool != nullptr); SCASSERT(tool != nullptr)
tool->incrementReferens(); tool->incrementReferens();
} }
@ -4016,6 +4012,6 @@ void VPattern::DecrementReferens(quint32 id) const
Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0"); Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0");
ToolExists(id); ToolExists(id);
VDataTool *tool = tools.value(id); VDataTool *tool = tools.value(id);
SCASSERT(tool != nullptr); SCASSERT(tool != nullptr)
tool->decrementReferens(); tool->decrementReferens();
} }

View File

@ -281,7 +281,7 @@ void FvUpdater::startDownloadFeed(const QUrl &url)
m_reply = m_qnam.get(request); m_reply = m_qnam.get(request);
connect(m_reply, &QNetworkReply::readyRead, [this]() connect(m_reply, &QNetworkReply::readyRead, RECEIVER(this)[this]()
{ {
// this slot gets called every time the QNetworkReply has new data. // this slot gets called every time the QNetworkReply has new data.
// We read all of its new data and write it into the file. // We read all of its new data and write it into the file.
@ -289,10 +289,10 @@ void FvUpdater::startDownloadFeed(const QUrl &url)
// signal of the QNetworkReply // signal of the QNetworkReply
m_xml.addData(m_reply->readAll()); m_xml.addData(m_reply->readAll());
}); });
connect(m_reply, &QNetworkReply::downloadProgress, [this](qint64 bytesRead, qint64 totalBytes) connect(m_reply, &QNetworkReply::downloadProgress, RECEIVER(this)[this](qint64 bytesRead, qint64 totalBytes)
{ {
Q_UNUSED(bytesRead); Q_UNUSED(bytesRead)
Q_UNUSED(totalBytes); Q_UNUSED(totalBytes)
if (m_httpRequestAborted) if (m_httpRequestAborted)
{ {
@ -555,18 +555,21 @@ bool FvUpdater::CurrentlyRunningOnPlatform(const QString &platform)
case 0: // Q_OS_LINUX case 0: // Q_OS_LINUX
#ifdef Q_OS_LINUX // Defined on Linux. #ifdef Q_OS_LINUX // Defined on Linux.
return true; return true;
#else
return false;
#endif #endif
break;
case 1: // Q_OS_MAC case 1: // Q_OS_MAC
#ifdef Q_OS_MAC // Defined on MAC OS (synonym for Darwin). #ifdef Q_OS_MAC // Defined on MAC OS (synonym for Darwin).
return true; return true;
#else
return false;
#endif #endif
break;
case 2: // Q_OS_WIN32 case 2: // Q_OS_WIN32
#ifdef Q_OS_WIN32 // Defined on all supported versions of Windows. #ifdef Q_OS_WIN32 // Defined on all supported versions of Windows.
return true; return true;
#else
return false;
#endif #endif
break;
default: default:
break; break;
} }

View File

@ -307,7 +307,7 @@ void VAbstractConverter::ValidateInputFile(const QString &currentSchema) const
} }
catch(const VException &exp) catch(const VException &exp)
{ // Nope, we can't. { // Nope, we can't.
Q_UNUSED(exp); Q_UNUSED(exp)
throw e; throw e;
} }
} }

View File

@ -554,14 +554,14 @@ VDataTool *VAbstractPattern::getTool(const quint32 &id)
void VAbstractPattern::AddTool(const quint32 &id, VDataTool *tool) void VAbstractPattern::AddTool(const quint32 &id, VDataTool *tool)
{ {
Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0"); Q_ASSERT_X(id != 0, Q_FUNC_INFO, "id == 0");
SCASSERT(tool != nullptr); SCASSERT(tool != nullptr)
tools.insert(id, tool); tools.insert(id, tool);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VAbstractPattern::AddToolOnRemove(VDataTool *tool) void VAbstractPattern::AddToolOnRemove(VDataTool *tool)
{ {
SCASSERT(tool != nullptr); SCASSERT(tool != nullptr)
toolsOnRemove.append(tool); toolsOnRemove.append(tool);
} }

View File

@ -105,8 +105,8 @@ inline qint64 MessageHandler::column() const
void MessageHandler::handleMessage(QtMsgType type, const QString &description, const QUrl &identifier, void MessageHandler::handleMessage(QtMsgType type, const QString &description, const QUrl &identifier,
const QSourceLocation &sourceLocation) const QSourceLocation &sourceLocation)
{ {
Q_UNUSED(type); Q_UNUSED(type)
Q_UNUSED(identifier); Q_UNUSED(identifier)
m_messageType = type; m_messageType = type;
m_description = description; m_description = description;

View File

@ -33,8 +33,6 @@
#include "qmuparsererror.h" #include "qmuparsererror.h"
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
using namespace std;
/** /**
* @file * @file
* @brief Implementation of the standard floating point QmuParser. * @brief Implementation of the standard floating point QmuParser.
@ -348,9 +346,9 @@ void QmuParser::InitOprt()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void QmuParser::OnDetectVar(const QString &pExpr, int &nStart, int &nEnd) void QmuParser::OnDetectVar(const QString &pExpr, int &nStart, int &nEnd)
{ {
Q_UNUSED(pExpr); Q_UNUSED(pExpr)
Q_UNUSED(nStart); Q_UNUSED(nStart)
Q_UNUSED(nEnd); Q_UNUSED(nEnd)
// this is just sample code to illustrate modifying variable names on the fly. // this is just sample code to illustrate modifying variable names on the fly.
// I'm not sure anyone really needs such a feature... // I'm not sure anyone really needs such a feature...
/* /*

View File

@ -36,8 +36,6 @@
#include "qmudef.h" #include "qmudef.h"
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
using namespace std;
/** /**
* @file * @file
* @brief This file contains the basic implementation of the muparser engine. * @brief This file contains the basic implementation of the muparser engine.
@ -218,9 +216,9 @@ void QmuParserBase::ReInit() const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void QmuParserBase::OnDetectVar(const QString &pExpr, int &nStart, int &nEnd) void QmuParserBase::OnDetectVar(const QString &pExpr, int &nStart, int &nEnd)
{ {
Q_UNUSED(pExpr); Q_UNUSED(pExpr)
Q_UNUSED(nStart); Q_UNUSED(nStart)
Q_UNUSED(nEnd); Q_UNUSED(nEnd)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -396,7 +394,7 @@ void QmuParserBase::SetExpr(const QString &a_sExpr)
{ {
// Check locale compatibility // Check locale compatibility
std::locale loc; std::locale loc;
if (m_pTokenReader->GetArgSep()==std::use_facet<numpunct<char_type> >(loc).decimal_point()) if (m_pTokenReader->GetArgSep()==std::use_facet<std::numpunct<char_type> >(loc).decimal_point())
{ {
Error(ecLOCALE); Error(ecLOCALE);
} }

View File

@ -41,8 +41,6 @@
#include "qmuparsererror.h" #include "qmuparsererror.h"
#include "../vmisc/vmath.h" #include "../vmisc/vmath.h"
using namespace std;
/** /**
* @file * @file
* @brief This file contains the implementation of parser test cases. * @brief This file contains the implementation of parser test cases.

View File

@ -49,6 +49,7 @@
#include "dl_creationinterface.h" #include "dl_creationinterface.h"
#include "dl_entities.h" #include "dl_entities.h"
#include "iostream" #include "iostream"
#include "strlcpy.h"
/** /**
* Default constructor. * Default constructor.
@ -1577,12 +1578,7 @@ bool DL_Dxf::handleXData(DL_CreationInterface* creationInterface)
creationInterface->addXDataReal(static_cast<int>(groupCode), toReal(groupValue)); creationInterface->addXDataReal(static_cast<int>(groupCode), toReal(groupValue));
return true; return true;
} }
else if (groupCode>=1060 && groupCode<=1070) else if (groupCode>=1060 && groupCode<=1071)
{
creationInterface->addXDataInt(static_cast<int>(groupCode), toInt(groupValue));
return true;
}
else if (groupCode==1071)
{ {
creationInterface->addXDataInt(static_cast<int>(groupCode), toInt(groupValue)); creationInterface->addXDataInt(static_cast<int>(groupCode), toInt(groupValue));
return true; return true;
@ -2554,10 +2550,7 @@ void DL_Dxf::endSequence(DL_CreationInterface* creationInterface)
DL_WriterA* DL_Dxf::out(const char* file, DL_Codes::version version) DL_WriterA* DL_Dxf::out(const char* file, DL_Codes::version version)
{ {
char* f = new char[strlen(file)+1]; char* f = new char[strlen(file)+1];
QT_WARNING_PUSH strlcpy(f, file, sizeof(f));
QT_WARNING_DISABLE_MSVC(4996)
strcpy(f, file);
QT_WARNING_POP
this->version = version; this->version = version;
DL_WriterA* dw = new DL_WriterA(f, version); DL_WriterA* dw = new DL_WriterA(f, version);
@ -2602,7 +2595,6 @@ void DL_Dxf::writeHeader(DL_WriterA& dw) const
break; break;
case DL_Codes::AC1009_MIN: case DL_Codes::AC1009_MIN:
// minimalistic DXF version is unidentified in file: // minimalistic DXF version is unidentified in file:
break;
default: default:
break; break;
} }
@ -3848,7 +3840,7 @@ void DL_Dxf::writeHatch2(DL_WriterA& dw,
const DL_Attributes& attrib) const const DL_Attributes& attrib) const
{ {
Q_UNUSED(attrib); Q_UNUSED(attrib)
dw.dxfInt(75, 0); // odd parity dw.dxfInt(75, 0); // odd parity
dw.dxfInt(76, 1); // pattern type dw.dxfInt(76, 1); // pattern type
@ -3906,7 +3898,7 @@ void DL_Dxf::writeHatchLoop1(DL_WriterA& dw,
void DL_Dxf::writeHatchLoop2(DL_WriterA& dw, void DL_Dxf::writeHatchLoop2(DL_WriterA& dw,
const DL_HatchLoopData& data) const DL_HatchLoopData& data)
{ {
Q_UNUSED(data); Q_UNUSED(data)
dw.dxfInt(97, 0); dw.dxfInt(97, 0);
} }
@ -4233,14 +4225,7 @@ void DL_Dxf::writeLinetype(DL_WriterA& dw,
dw.dxfString(2, data.name); dw.dxfString(2, data.name);
dw.dxfInt(70, data.flags); dw.dxfInt(70, data.flags);
if (nameUpper=="BYBLOCK") if (nameUpper=="BYBLOCK" || nameUpper=="BYLAYER")
{
dw.dxfString(3, "");
dw.dxfInt(72, 65);
dw.dxfInt(73, 0);
dw.dxfReal(40, 0.0);
}
else if (nameUpper=="BYLAYER")
{ {
dw.dxfString(3, ""); dw.dxfString(3, "");
dw.dxfInt(72, 65); dw.dxfInt(72, 65);
@ -5864,7 +5849,7 @@ int DL_Dxf::getLibVersion(const std::string& str)
// double ret; // double ret;
// if (strchr(value, ',') != NULL) { // if (strchr(value, ',') != NULL) {
// char* tmp = new char[strlen(value)+1]; // char* tmp = new char[strlen(value)+1];
// strcpy(tmp, value); // strlcpy(tmp, value, sizeof(tmp));
// DL_WriterA::strReplace(tmp, ',', '.'); // DL_WriterA::strReplace(tmp, ',', '.');
// ret = atof(tmp); // ret = atof(tmp);
// delete[] tmp; // delete[] tmp;
@ -5891,15 +5876,12 @@ void DL_Dxf::test()
char* buf5 = new char[10]; char* buf5 = new char[10];
char* buf6 = new char[10]; char* buf6 = new char[10];
QT_WARNING_PUSH strlcpy(buf1, " 10\n", sizeof(buf1));
QT_WARNING_DISABLE_MSVC(4996) strlcpy(buf2, "10", sizeof(buf2));
strcpy(buf1, " 10\n"); strlcpy(buf3, "10\n", sizeof(buf3));
strcpy(buf2, "10"); strlcpy(buf4, " 10 \n", sizeof(buf4));
strcpy(buf3, "10\n"); strlcpy(buf5, " 10 \r", sizeof(buf5));
strcpy(buf4, " 10 \n"); strlcpy(buf6, "\t10 \n", sizeof(buf6));
strcpy(buf5, " 10 \r");
strcpy(buf6, "\t10 \n");
QT_WARNING_POP
// Try to avoid deleting array from an offset // Try to avoid deleting array from an offset
char* buf1Copy = buf1; char* buf1Copy = buf1;

View File

@ -66,17 +66,16 @@ void DL_WriterA::dxfReal(int gc, double value) const
{ {
char str[256]; char str[256];
QT_WARNING_PUSH QT_WARNING_PUSH
QT_WARNING_DISABLE_MSVC(4996)
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 408 #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 408
QT_WARNING_DISABLE_GCC("-Wformat") QT_WARNING_DISABLE_GCC("-Wformat")
#endif #endif
if (version==DL_Codes::AC1009_MIN) if (version==DL_Codes::AC1009_MIN)
{ {
sprintf(str, "%.6lf", value); snprintf(str, sizeof(str), "%.6lf", value);
} }
else else
{ {
sprintf(str, "%.16lf", value); snprintf(str, sizeof(str), "%.16lf", value);
} }
QT_WARNING_POP QT_WARNING_POP
@ -132,10 +131,7 @@ void DL_WriterA::dxfInt(int gc, int value) const
void DL_WriterA::dxfHex(int gc, int value) const void DL_WriterA::dxfHex(int gc, int value) const
{ {
char str[12]; char str[12];
QT_WARNING_PUSH snprintf(str, sizeof(str), "%0X", value);
QT_WARNING_DISABLE_MSVC(4996)
sprintf(str, "%0X", value);
QT_WARNING_POP
dxfString(gc, str); dxfString(gc, str);
} }

View File

@ -33,6 +33,10 @@
#if (_MSC_VER > 1000) #if (_MSC_VER > 1000)
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#endif // Q_CC_MSVC #endif // Q_CC_MSVC
#include <fstream> #include <fstream>

View File

@ -0,0 +1,143 @@
/************************************************************************
**
** @file strlcpy.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date December 20, 2016
**
** @brief
** @copyright
** This source code is part of the Valentine project, a pattern making
** program, whose allow create and modeling patterns of clothing.
** Copyright (C) 2013-2016 Valentina project
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
**
** Valentina is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** Valentina is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
/*
* Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef VALENTINA_STRLCPY_H
#define VALENTINA_STRLCPY_H
/* This function comes from BSD */
#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && \
!defined(__bsdi__) && !defined(__APPLE__)
#include <sys/types.h>
#include <string.h>
/*
* Copy src to string dst of size siz. At most siz-1 characters
* will be copied. Always NUL terminates (unless siz == 0).
* Returns strlen(src); if retval >= siz, truncation occurred.
*/
inline size_t strlcpy(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
size_t n = siz;
/* Copy as many bytes as will fit */
if (n != 0)
{
while (--n != 0)
{
if ((*d++ = *s++) == '\0')
{
break;
}
}
}
/* Not enough room in dst, add NUL and traverse rest of src */
if (n == 0)
{
if (siz != 0)
{
*d = '\0'; /* NUL-terminate dst */
}
while (*s++)
;
}
return(s - src - 1); /* count does not include NUL */
}
/*
* Appends src to string dst of size siz (unlike strncat, siz is the
* full size of dst, not space left). At most siz-1 characters
* will be copied. Always NUL terminates (unless siz <= strlen(dst)).
* Returns strlen(src) + MIN(siz, strlen(initial dst)).
* If retval >= siz, truncation occurred.
*/
inline size_t strlcat(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
size_t n = siz;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
{
d++;
}
dlen = d - dst;
n = siz - dlen;
if (n == 0)
{
return(dlen + strlen(s));
}
while (*s != '\0')
{
if (n != 1)
{
*d++ = *s;
n--;
}
s++;
}
*d = '\0';
return(dlen + (s - src)); /* count does not include NUL */
}
#endif /* ! __*BSD__ */
#endif // VALENTINA_STRLCPY_H

View File

@ -32,6 +32,8 @@
/* I like to include this pragma too, so the build log indicates if pre-compiled headers were in use. */ /* I like to include this pragma too, so the build log indicates if pre-compiled headers were in use. */
#pragma message("Compiling precompiled headers for VDxf library.\n") #pragma message("Compiling precompiled headers for VDxf library.\n")
#define _CRT_SECURE_NO_WARNINGS
/* Add C includes here */ /* Add C includes here */
#if defined __cplusplus #if defined __cplusplus

View File

@ -24,4 +24,5 @@ HEADERS += \
$$PWD/dxflib/dl_writer_ascii.h \ $$PWD/dxflib/dl_writer_ascii.h \
$$PWD/vdxfengine.h \ $$PWD/vdxfengine.h \
$$PWD/vdxfpaintdevice.h \ $$PWD/vdxfpaintdevice.h \
$$PWD/dxfdef.h $$PWD/dxfdef.h \
$$PWD/dxflib/strlcpy.h

View File

@ -479,24 +479,17 @@ std::string VDxfEngine::getPenStyle()
{ {
switch (state->pen().style()) switch (state->pen().style())
{ {
case Qt::SolidLine:
return "BYLAYER";
break;
case Qt::DashLine: case Qt::DashLine:
return "DASHED"; return "DASHED";
break;
case Qt::DotLine: case Qt::DotLine:
return "DOT"; return "DOT";
break;
case Qt::DashDotLine: case Qt::DashDotLine:
return "DASHDOT"; return "DASHDOT";
break;
case Qt::DashDotDotLine: case Qt::DashDotDotLine:
return "DIVIDE"; return "DIVIDE";
break; case Qt::SolidLine:
default: default:
return "BYLAYER"; return "BYLAYER";
break;
} }
} }

View File

@ -126,10 +126,6 @@ int VDxfPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
return engine->getSize().width(); return engine->getSize().width();
case QPaintDevice::PdmHeight: case QPaintDevice::PdmHeight:
return engine->getSize().height(); return engine->getSize().height();
case QPaintDevice::PdmDpiX:
return static_cast<int>(engine->getResolution());
case QPaintDevice::PdmDpiY:
return static_cast<int>(engine->getResolution());
case QPaintDevice::PdmHeightMM: case QPaintDevice::PdmHeightMM:
return qRound(engine->getSize().height() * 25.4 / engine->getResolution()); return qRound(engine->getSize().height() * 25.4 / engine->getResolution());
case QPaintDevice::PdmWidthMM: case QPaintDevice::PdmWidthMM:
@ -137,8 +133,9 @@ int VDxfPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
case QPaintDevice::PdmNumColors: case QPaintDevice::PdmNumColors:
return static_cast<int>(0xffffffff); return static_cast<int>(0xffffffff);
case QPaintDevice::PdmPhysicalDpiX: case QPaintDevice::PdmPhysicalDpiX:
return static_cast<int>(engine->getResolution());
case QPaintDevice::PdmPhysicalDpiY: case QPaintDevice::PdmPhysicalDpiY:
case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmDpiY:
return static_cast<int>(engine->getResolution()); return static_cast<int>(engine->getResolution());
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 2) #if QT_VERSION > QT_VERSION_CHECK(5, 0, 2)
case QPaintDevice::PdmDevicePixelRatio: case QPaintDevice::PdmDevicePixelRatio:

View File

@ -101,7 +101,7 @@ VMeasurements::VMeasurements(Unit unit, VContainer *data)
data(data), data(data),
type(MeasurementsType::Individual) type(MeasurementsType::Individual)
{ {
SCASSERT(data != nullptr); SCASSERT(data != nullptr)
CreateEmptyIndividualFile(unit); CreateEmptyIndividualFile(unit);
} }
@ -112,7 +112,7 @@ VMeasurements::VMeasurements(Unit unit, int baseSize, int baseHeight, VContainer
data(data), data(data),
type(MeasurementsType::Standard) type(MeasurementsType::Standard)
{ {
SCASSERT(data != nullptr); SCASSERT(data != nullptr)
CreateEmptyStandardFile(unit, baseSize, baseHeight); CreateEmptyStandardFile(unit, baseSize, baseHeight);
} }

View File

@ -359,7 +359,7 @@ QVector<QPointF> VAbstractDetail::CorrectEquidistantPoints(const QVector<QPointF
*/ */
QVector<QPointF> VAbstractDetail::CheckLoops(const QVector<QPointF> &points) QVector<QPointF> VAbstractDetail::CheckLoops(const QVector<QPointF> &points)
{ {
const int count = points.size(); int count = points.size();
/*If we got less than 4 points no need seek loops.*/ /*If we got less than 4 points no need seek loops.*/
if (count < 4) if (count < 4)
{ {
@ -458,13 +458,32 @@ QVector<QPointF> VAbstractDetail::CheckLoops(const QVector<QPointF> &points)
switch (status) switch (status)
{ {
case ParallelIntersection: case ParallelIntersection:
{
/*We have found a loop.*/ /*We have found a loop.*/
// Theoretically there is no big difference which point j or jNext to select. // Very tricky case
// In the end we will draw a line in any case. // See the file "collection/bugs/Issue_#603.val"
ekvPoints.append(points.at(i)); const QLineF line1(points.at(i+1), points.at(j));
ekvPoints.append(points.at(jNext)); const QLineF line2(points.at(i), points.at(jNext));
i = j;
if (line1.length() <= line2.length())
{
// In this case we did not check a loop edges and can just skip them
ekvPoints.append(points.at(i));
ekvPoints.append(points.at(jNext));
i = j; // Skip a loo
}
else
{
// In this case a loop edges probably was also chacked and added to the list
ekvPoints.clear();// Previous data is wrong and belong to loop.
ekvPoints.append(points.at(j));
ekvPoints.append(points.at(i+1));
count = j+1;// All beyond this belong to loop.
}
break; break;
}
case BoundedIntersection: case BoundedIntersection:
/*We have found a loop.*/ /*We have found a loop.*/
ekvPoints.append(points.at(i)); ekvPoints.append(points.at(i));

View File

@ -40,8 +40,8 @@ VGraphicsFillItem::~VGraphicsFillItem()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VGraphicsFillItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) void VGraphicsFillItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{ {
Q_UNUSED(option); Q_UNUSED(option)
Q_UNUSED(widget); Q_UNUSED(widget)
painter->save(); painter->save();
painter->setBrush(painter->pen().color()); painter->setBrush(painter->pen().color());
painter->drawPath(path()); painter->drawPath(path());

View File

@ -244,13 +244,13 @@ int VPoster::CountColumns(int width) const
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
PosterData VPoster::Cut(int i, int j, const QRect &imageRect) const PosterData VPoster::Cut(int i, int j, const QRect &imageRect) const
{ {
Q_UNUSED(imageRect); Q_UNUSED(imageRect)
const int x = j*PageRect().width() - j*static_cast<int>(allowence); const int x = j*PageRect().width() - j*static_cast<int>(allowence);
const int y = i*PageRect().height() - i*static_cast<int>(allowence); const int y = i*PageRect().height() - i*static_cast<int>(allowence);
SCASSERT(x <= imageRect.width()); SCASSERT(x <= imageRect.width())
SCASSERT(y <= imageRect.height()); SCASSERT(y <= imageRect.height())
PosterData data; PosterData data;
data.row = static_cast<quint32>(i); data.row = static_cast<quint32>(i);

View File

@ -426,7 +426,7 @@ void QCommandLineParser::process(const QStringList &arguments)
void QCommandLineParser::process(const QCoreApplication &app) void QCommandLineParser::process(const QCoreApplication &app)
{ {
// QCoreApplication::arguments() is static, but the app instance must exist so we require it as parameter // QCoreApplication::arguments() is static, but the app instance must exist so we require it as parameter
Q_UNUSED(app); Q_UNUSED(app)
process(QCoreApplication::arguments()); process(QCoreApplication::arguments());
} }

View File

@ -355,7 +355,7 @@ QDataStream &operator<<(QDataStream &s, const QMarginsF &m)
QDataStream &operator>>(QDataStream &s, QMarginsF &m) QDataStream &operator>>(QDataStream &s, QMarginsF &m)
{ {
double left, top, right, bottom; double left = 0, top = 0, right = 0, bottom = 0;
s >> left; s >> left;
s >> top; s >> top;
s >> right; s >> right;

View File

@ -454,9 +454,9 @@ void SetOverrideCursor(const QString &pixmapPath, int hotX, int hotY)
QApplication::setOverrideCursor(QCursor(newPixmap, hotX, hotY)); QApplication::setOverrideCursor(QCursor(newPixmap, hotX, hotY));
} }
#else #else
Q_UNUSED(pixmapPath); Q_UNUSED(pixmapPath)
Q_UNUSED(hotX); Q_UNUSED(hotX)
Q_UNUSED(hotY); Q_UNUSED(hotY)
#endif #endif
} }
@ -478,7 +478,7 @@ void SetOverrideCursor(Qt::CursorShape shape)
} }
#else #else
Q_UNUSED(shape); Q_UNUSED(shape)
#endif #endif
} }
@ -501,7 +501,7 @@ void RestoreOverrideCursor(const QString &pixmapPath)
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
} }
#else #else
Q_UNUSED(pixmapPath); Q_UNUSED(pixmapPath)
#endif #endif
} }
@ -523,7 +523,7 @@ void RestoreOverrideCursor(Qt::CursorShape shape)
} }
#else #else
Q_UNUSED(shape); Q_UNUSED(shape)
#endif #endif
} }
@ -1071,7 +1071,7 @@ void InitPMSystems(QComboBox *systemCombo)
// * The default option (blank field or 'None') should appear at the top of the list. // * The default option (blank field or 'None') should appear at the top of the list.
// * The list should be sorted alphabetically so users can find their system easily. // * The list should be sorted alphabetically so users can find their system easily.
SCASSERT(systemCombo != nullptr); SCASSERT(systemCombo != nullptr)
systemCombo->addItem(qApp->TrVars()->PMSystemName(listSystems.at(listSystems.size()-1)), systemCombo->addItem(qApp->TrVars()->PMSystemName(listSystems.at(listSystems.size()-1)),
listSystems.at(listSystems.size()-1)); listSystems.at(listSystems.size()-1));
@ -1150,7 +1150,7 @@ QStringList ListPMSystems()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QStringList ListNumbers(const VTranslateMeasurements *trM, const QStringList &listMeasurements) QStringList ListNumbers(const VTranslateMeasurements *trM, const QStringList &listMeasurements)
{ {
SCASSERT(trM != nullptr); SCASSERT(trM != nullptr)
QStringList numbers; QStringList numbers;
for (int i=0; i < listMeasurements.size(); ++i) for (int i=0; i < listMeasurements.size(); ++i)

View File

@ -49,6 +49,17 @@ template <class T> class QSharedPointer;
#include <ciso646> #include <ciso646>
#endif /* Q_CC_MSVC */ #endif /* Q_CC_MSVC */
//There is no automatic disconnection when the 'receiver' is destroyed because it's a functor with no QObject. However,
//since 5.2 there is an overload which adds a "context object". When that object is destroyed, the connection is broken
//(the context is also used for the thread affinity: the lambda will be called in the thread of the event loop of the
// object used as context).
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
#define RECEIVER(obj) (obj),
#else
#define RECEIVER(obj)
#endif
class QComboBox; class QComboBox;
class QMarginsF; class QMarginsF;
class VTranslateMeasurements; class VTranslateMeasurements;

View File

@ -72,7 +72,7 @@ QT_WARNING_DISABLE_GCC("-Weffc++")
*/ */
QxtCsvModel::QxtCsvModel(QObject *parent) : QAbstractTableModel(parent) QxtCsvModel::QxtCsvModel(QObject *parent) : QAbstractTableModel(parent)
{ {
QXT_INIT_PRIVATE(QxtCsvModel); QXT_INIT_PRIVATE(QxtCsvModel)
} }
/*! /*!
@ -86,7 +86,7 @@ QxtCsvModel::QxtCsvModel(QObject *parent) : QAbstractTableModel(parent)
QxtCsvModel::QxtCsvModel(QIODevice *file, QObject *parent, bool withHeader, QChar separator) QxtCsvModel::QxtCsvModel(QIODevice *file, QObject *parent, bool withHeader, QChar separator)
: QAbstractTableModel(parent) : QAbstractTableModel(parent)
{ {
QXT_INIT_PRIVATE(QxtCsvModel); QXT_INIT_PRIVATE(QxtCsvModel)
setSource(file, withHeader, separator); setSource(file, withHeader, separator);
} }
@ -103,7 +103,7 @@ QxtCsvModel::QxtCsvModel(QIODevice *file, QObject *parent, bool withHeader, QCha
QxtCsvModel::QxtCsvModel(const QString &filename, QObject *parent, bool withHeader, QChar separator) QxtCsvModel::QxtCsvModel(const QString &filename, QObject *parent, bool withHeader, QChar separator)
: QAbstractTableModel(parent) : QAbstractTableModel(parent)
{ {
QXT_INIT_PRIVATE(QxtCsvModel); QXT_INIT_PRIVATE(QxtCsvModel)
QFile src(filename); QFile src(filename);
setSource(&src, withHeader, separator); setSource(&src, withHeader, separator);
} }

View File

@ -118,7 +118,7 @@ VAbstractApplication::VAbstractApplication(int &argc, char **argv)
setAttribute(Qt::AA_UseHighDpiPixmaps); setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif #endif
connect(this, &QApplication::aboutToQuit, [this]() connect(this, &QApplication::aboutToQuit, RECEIVER(this)[this]()
{ {
// If try to use the method QApplication::exit program can't sync settings and show warning about QApplication // If try to use the method QApplication::exit program can't sync settings and show warning about QApplication
// instance. Solution is to call sync() before quit. // instance. Solution is to call sync() before quit.
@ -283,14 +283,14 @@ void VAbstractApplication::setPatternUnit(const Unit &patternUnit)
*/ */
VCommonSettings *VAbstractApplication::Settings() VCommonSettings *VAbstractApplication::Settings()
{ {
SCASSERT(settings != nullptr); SCASSERT(settings != nullptr)
return settings; return settings;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGraphicsScene *VAbstractApplication::getCurrentScene() const QGraphicsScene *VAbstractApplication::getCurrentScene() const
{ {
SCASSERT(*currentScene != nullptr); SCASSERT(*currentScene != nullptr)
return *currentScene; return *currentScene;
} }

View File

@ -189,9 +189,9 @@ bool VLockGuard<Guarded>::TryLock(const QString &lockName, int stale, int timeou
#endif #endif
} }
#else #else
Q_UNUSED(lockName); Q_UNUSED(lockName)
Q_UNUSED(stale); Q_UNUSED(stale)
Q_UNUSED(timeout); Q_UNUSED(timeout)
#endif #endif
return res; return res;
} }

View File

@ -48,7 +48,7 @@ VTableSearch::VTableSearch(QTableWidget *table, QObject *parent)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTableSearch::Clear() void VTableSearch::Clear()
{ {
SCASSERT(table != nullptr); SCASSERT(table != nullptr)
for(int i = 0; i < table->rowCount(); ++i) for(int i = 0; i < table->rowCount(); ++i)
{ {
@ -96,7 +96,7 @@ void VTableSearch::ShowNext(int newIndex)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTableSearch::Find(const QString &term) void VTableSearch::Find(const QString &term)
{ {
SCASSERT(table != nullptr); SCASSERT(table != nullptr)
Clear(); Clear();
@ -194,7 +194,7 @@ void VTableSearch::AddRow(int row)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTableSearch::RefreshList(const QString &term) void VTableSearch::RefreshList(const QString &term)
{ {
SCASSERT(table != nullptr); SCASSERT(table != nullptr)
if (term.isEmpty()) if (term.isEmpty())
{ {

View File

@ -147,18 +147,15 @@ int VObjPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
return engine->getSize().width(); return engine->getSize().width();
case QPaintDevice::PdmHeight: case QPaintDevice::PdmHeight:
return engine->getSize().height(); return engine->getSize().height();
case QPaintDevice::PdmDpiX:
return engine->getResolution();
case QPaintDevice::PdmDpiY:
return engine->getResolution();
case QPaintDevice::PdmHeightMM: case QPaintDevice::PdmHeightMM:
return qRound(engine->getSize().height() * 25.4 / engine->getResolution()); return qRound(engine->getSize().height() * 25.4 / engine->getResolution());
case QPaintDevice::PdmWidthMM: case QPaintDevice::PdmWidthMM:
return qRound(engine->getSize().width() * 25.4 / engine->getResolution()); return qRound(engine->getSize().width() * 25.4 / engine->getResolution());
case QPaintDevice::PdmNumColors: case QPaintDevice::PdmNumColors:
return static_cast<int>(0xffffffff); return static_cast<int>(0xffffffff);
case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmDpiY:
case QPaintDevice::PdmPhysicalDpiX: case QPaintDevice::PdmPhysicalDpiX:
return engine->getResolution();
case QPaintDevice::PdmPhysicalDpiY: case QPaintDevice::PdmPhysicalDpiY:
return engine->getResolution(); return engine->getResolution();
#if QT_VERSION > QT_VERSION_CHECK(5, 0, 2) #if QT_VERSION > QT_VERSION_CHECK(5, 0, 2)

View File

@ -36,8 +36,6 @@
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "../qmuparser/qmuparsererror.h" #include "../qmuparser/qmuparsererror.h"
using namespace qmu;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief Calculator class wraper for QMuParser. Make easy initialization math parser. * @brief Calculator class wraper for QMuParser. Make easy initialization math parser.
@ -142,7 +140,7 @@ void Calculator::InitVariables(const QHash<QString, qreal *> &vars, const QMap<i
if (found == false) if (found == false)
{ {
throw qmu::QmuParserError (ecUNASSIGNABLE_TOKEN, i.value(), formula, i.key()); throw qmu::QmuParserError (qmu::ecUNASSIGNABLE_TOKEN, i.value(), formula, i.key());
} }
++i; ++i;
} }

View File

@ -46,7 +46,7 @@ VArcRadius::VArcRadius()
VArcRadius::VArcRadius(const quint32 &id, const quint32 &parentId, const VArc *arc, Unit patternUnit) VArcRadius::VArcRadius(const quint32 &id, const quint32 &parentId, const VArc *arc, Unit patternUnit)
:VCurveVariable(id, parentId) :VCurveVariable(id, parentId)
{ {
SCASSERT(arc != nullptr); SCASSERT(arc != nullptr)
SetType(VarType::ArcRadius); SetType(VarType::ArcRadius);
SetName(QString(radius_V+"%1").arg(arc->name())); SetName(QString(radius_V+"%1").arg(arc->name()));

View File

@ -49,7 +49,7 @@ VCurveAngle::VCurveAngle(const quint32 &id, const quint32 &parentId, const VAbst
:VCurveVariable(id, parentId) :VCurveVariable(id, parentId)
{ {
SetType(VarType::CurveAngle); SetType(VarType::CurveAngle);
SCASSERT(curve != nullptr); SCASSERT(curve != nullptr)
if (angle == CurveAngle::StartAngle) if (angle == CurveAngle::StartAngle)
{ {
SetValue(curve->GetStartAngle()); SetValue(curve->GetStartAngle());

View File

@ -50,7 +50,7 @@ VCurveCLength::VCurveCLength(const quint32 &id, const quint32 &parentId, const V
: VCurveVariable(id, parentId) : VCurveVariable(id, parentId)
{ {
SetType(VarType::CurveCLength); SetType(VarType::CurveCLength);
SCASSERT(curve != nullptr); SCASSERT(curve != nullptr)
if (cType == CurveCLength::C1) if (cType == CurveCLength::C1)
{ {
SetValue(FromPixel(curve->GetC1Length(), patternUnit)); SetValue(FromPixel(curve->GetC1Length(), patternUnit));

View File

@ -48,7 +48,7 @@ VCurveLength::VCurveLength(const quint32 &id, const quint32 &parentId, const VAb
:VCurveVariable(id, parentId) :VCurveVariable(id, parentId)
{ {
SetType(VarType::CurveLength); SetType(VarType::CurveLength);
SCASSERT(curve != nullptr); SCASSERT(curve != nullptr)
SetName(curve->name()); SetName(curve->name());
SetValue(FromPixel(curve->GetLength(), patternUnit)); SetValue(FromPixel(curve->GetLength(), patternUnit));
} }

View File

@ -45,7 +45,7 @@ VEllipticalArcRadius::VEllipticalArcRadius()
VEllipticalArcRadius::VEllipticalArcRadius(const quint32 &id, const quint32 &parentId, const VEllipticalArc *elArc, VEllipticalArcRadius::VEllipticalArcRadius(const quint32 &id, const quint32 &parentId, const VEllipticalArc *elArc,
const int numberRadius, Unit patternUnit) : VCurveVariable(id, parentId) const int numberRadius, Unit patternUnit) : VCurveVariable(id, parentId)
{ {
SCASSERT(elArc != nullptr); SCASSERT(elArc != nullptr)
SetType(VarType::ArcRadius); SetType(VarType::ArcRadius);
SetName(QString(radius_V+"%1"+"%2").arg(numberRadius).arg(elArc->name())); SetName(QString(radius_V+"%1"+"%2").arg(numberRadius).arg(elArc->name()));

View File

@ -57,7 +57,7 @@ VInternalVariable::~VInternalVariable()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VInternalVariable::Filter(quint32 id) bool VInternalVariable::Filter(quint32 id)
{ {
Q_UNUSED(id); Q_UNUSED(id)
return false; return false;
} }

View File

@ -53,8 +53,8 @@ VLineAngle::VLineAngle(const VPointF *p1, const quint32 &p1Id, const VPointF *p2
{ {
SetType(VarType::LineAngle); SetType(VarType::LineAngle);
SCASSERT(p1 != nullptr); SCASSERT(p1 != nullptr)
SCASSERT(p2 != nullptr); SCASSERT(p2 != nullptr)
SetName(QString(angleLine_+"%1_%2").arg(p1->name(), p2->name())); SetName(QString(angleLine_+"%1_%2").arg(p1->name(), p2->name()));
SetValue(p1, p2); SetValue(p1, p2);
@ -90,8 +90,8 @@ bool VLineAngle::Filter(quint32 id)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLineAngle::SetValue(const VPointF *p1, const VPointF *p2) void VLineAngle::SetValue(const VPointF *p1, const VPointF *p2)
{ {
SCASSERT(p1 != nullptr); SCASSERT(p1 != nullptr)
SCASSERT(p2 != nullptr); SCASSERT(p2 != nullptr)
//Correct angle. Try avoid results like 6,7563e-15. //Correct angle. Try avoid results like 6,7563e-15.
const qreal angle = qFloor(QLineF(*p1, *p2).angle() * 100000.) / 100000.; const qreal angle = qFloor(QLineF(*p1, *p2).angle() * 100000.) / 100000.;
VInternalVariable::SetValue(angle); VInternalVariable::SetValue(angle);

View File

@ -50,8 +50,8 @@ VLengthLine::VLengthLine(const VPointF *p1, const quint32 &p1Id, const VPointF *
Unit patternUnit) Unit patternUnit)
:VInternalVariable(), d(new VLengthLineData(p1Id, p2Id, patternUnit)) :VInternalVariable(), d(new VLengthLineData(p1Id, p2Id, patternUnit))
{ {
SCASSERT(p1 != nullptr); SCASSERT(p1 != nullptr)
SCASSERT(p2 != nullptr); SCASSERT(p2 != nullptr)
SetType(VarType::LineLength); SetType(VarType::LineLength);
SetName(QString(line_+"%1_%2").arg(p1->name(), p2->name())); SetName(QString(line_+"%1_%2").arg(p1->name(), p2->name()));
@ -88,8 +88,8 @@ bool VLengthLine::Filter(quint32 id)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VLengthLine::SetValue(const VPointF *p1, const VPointF *p2) void VLengthLine::SetValue(const VPointF *p1, const VPointF *p2)
{ {
SCASSERT(p1 != nullptr); SCASSERT(p1 != nullptr)
SCASSERT(p2 != nullptr); SCASSERT(p2 != nullptr)
VInternalVariable::SetValue(FromPixel(QLineF(*p1, *p2).length(), d->patternUnit)); VInternalVariable::SetValue(FromPixel(QLineF(*p1, *p2).length(), d->patternUnit));
} }

View File

@ -202,7 +202,7 @@ VPiecePath VContainer::GetPiecePath(quint32 id) const
*/ */
quint32 VContainer::AddGObject(VGObject *obj) quint32 VContainer::AddGObject(VGObject *obj)
{ {
SCASSERT(obj != nullptr); SCASSERT(obj != nullptr)
QSharedPointer<VGObject> pointer(obj); QSharedPointer<VGObject> pointer(obj);
uniqueNames.insert(obj->name()); uniqueNames.insert(obj->name());
return AddObject(d->gObjects, pointer); return AddObject(d->gObjects, pointer);
@ -285,7 +285,7 @@ template <typename val>
void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val point) void VContainer::UpdateObject(QHash<quint32, val> &obj, const quint32 &id, val point)
{ {
Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712 Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712
SCASSERT(point.isNull() == false); SCASSERT(point.isNull() == false)
point->setId(id); point->setId(id);
if (d->gObjects.contains(id)) if (d->gObjects.contains(id))
{ {
@ -527,7 +527,7 @@ void VContainer::RemoveVariable(const QString &name)
template <typename key, typename val> template <typename key, typename val>
quint32 VContainer::AddObject(QHash<key, val> &obj, val value) quint32 VContainer::AddObject(QHash<key, val> &obj, val value)
{ {
SCASSERT(value != nullptr); SCASSERT(value != nullptr)
const quint32 id = getNextId(); const quint32 id = getNextId();
value->setId(id); value->setId(id);
obj[id] = value; obj[id] = value;
@ -542,7 +542,7 @@ quint32 VContainer::AddObject(QHash<key, val> &obj, val value)
*/ */
void VContainer::UpdateGObject(quint32 id, VGObject* obj) void VContainer::UpdateGObject(quint32 id, VGObject* obj)
{ {
SCASSERT(obj != nullptr); SCASSERT(obj != nullptr)
QSharedPointer<VGObject> pointer(obj); QSharedPointer<VGObject> pointer(obj);
UpdateObject(d->gObjects, id, pointer); UpdateObject(d->gObjects, id, pointer);
uniqueNames.insert(obj->name()); uniqueNames.insert(obj->name());

View File

@ -267,7 +267,7 @@ const QSharedPointer<T> VContainer::GeometricObject(const quint32 &id) const
try try
{ {
QSharedPointer<T> obj = qSharedPointerDynamicCast<T>(gObj); QSharedPointer<T> obj = qSharedPointerDynamicCast<T>(gObj);
SCASSERT(obj.isNull() == false); SCASSERT(obj.isNull() == false)
return obj; return obj;
} }
catch (const std::bad_alloc &) catch (const std::bad_alloc &)
@ -286,13 +286,13 @@ const QSharedPointer<T> VContainer::GeometricObject(const quint32 &id) const
template <typename T> template <typename T>
QSharedPointer<T> VContainer::GetVariable(QString name) const QSharedPointer<T> VContainer::GetVariable(QString name) const
{ {
SCASSERT(name.isEmpty()==false); SCASSERT(name.isEmpty()==false)
if (d->variables.contains(name)) if (d->variables.contains(name))
{ {
try try
{ {
QSharedPointer<T> value = qSharedPointerDynamicCast<T>(d->variables.value(name)); QSharedPointer<T> value = qSharedPointerDynamicCast<T>(d->variables.value(name));
SCASSERT(value.isNull() == false); SCASSERT(value.isNull() == false)
return value; return value;
} }
catch (const std::bad_alloc &) catch (const std::bad_alloc &)

View File

@ -31,13 +31,11 @@
#include "../qmuparser/qmutranslation.h" #include "../qmuparser/qmutranslation.h"
#include "../vmisc/def.h" #include "../vmisc/def.h"
using namespace qmu;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VTranslateMeasurements::VTranslateMeasurements() VTranslateMeasurements::VTranslateMeasurements()
:measurements(QMap<QString, QmuTranslation>()), :measurements(QMap<QString, qmu::QmuTranslation>()),
guiTexts(QMap<QString, QmuTranslation>()), guiTexts(QMap<QString, qmu::QmuTranslation>()),
descriptions(QMap<QString, QmuTranslation>()), descriptions(QMap<QString, qmu::QmuTranslation>()),
numbers(QMap<QString, QString>()), numbers(QMap<QString, QString>()),
formulas(QMap<QString, QString>()) formulas(QMap<QString, QString>())
{ {
@ -60,7 +58,7 @@ VTranslateMeasurements::~VTranslateMeasurements()
bool VTranslateMeasurements::MeasurementsFromUser(QString &newFormula, int position, const QString &token, bool VTranslateMeasurements::MeasurementsFromUser(QString &newFormula, int position, const QString &token,
int &bias) const int &bias) const
{ {
QMap<QString, QmuTranslation>::const_iterator i = measurements.constBegin(); QMap<QString, qmu::QmuTranslation>::const_iterator i = measurements.constBegin();
while (i != measurements.constEnd()) while (i != measurements.constEnd())
{ {
if (token == i.value().translate()) if (token == i.value().translate())
@ -166,8 +164,9 @@ void VTranslateMeasurements::InitMeasurements()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTranslateMeasurements::InitMeasurement(const QString &name, const QmuTranslation &m, const QmuTranslation &g, void VTranslateMeasurements::InitMeasurement(const QString &name, const qmu::QmuTranslation &m,
const QmuTranslation &d, const QString &number, const QString &formula) const qmu::QmuTranslation &g, const qmu::QmuTranslation &d,
const QString &number, const QString &formula)
{ {
measurements.insert(name, m); measurements.insert(name, m);
guiTexts.insert(name, g); guiTexts.insert(name, g);
@ -176,16 +175,16 @@ void VTranslateMeasurements::InitMeasurement(const QString &name, const QmuTrans
formulas.insert(name, formula); formulas.insert(name, formula);
} }
#define translate(context, source, disambiguation) QmuTranslation::translate((context), (source), (disambiguation)) #define translate(context, source, disambiguation) qmu::QmuTranslation::translate((context), (source), (disambiguation))
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTranslateMeasurements::InitGroupA() void VTranslateMeasurements::InitGroupA()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "height", m = translate("VTranslateMeasurements", "height",
@ -357,9 +356,9 @@ void VTranslateMeasurements::InitGroupB()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "width_shoulder", m = translate("VTranslateMeasurements", "width_shoulder",
@ -404,9 +403,9 @@ void VTranslateMeasurements::InitGroupC()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "indent_neck_back", m = translate("VTranslateMeasurements", "indent_neck_back",
@ -437,9 +436,9 @@ void VTranslateMeasurements::InitGroupD()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "hand_palm_length", m = translate("VTranslateMeasurements", "hand_palm_length",
@ -482,9 +481,9 @@ void VTranslateMeasurements::InitGroupE()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "foot_width", m = translate("VTranslateMeasurements", "foot_width",
@ -521,9 +520,9 @@ void VTranslateMeasurements::InitGroupF()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "head_circ", m = translate("VTranslateMeasurements", "head_circ",
@ -576,9 +575,9 @@ void VTranslateMeasurements::InitGroupG()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "neck_mid_circ", m = translate("VTranslateMeasurements", "neck_mid_circ",
@ -928,9 +927,9 @@ void VTranslateMeasurements::InitGroupH()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "neck_front_to_waist_f", m = translate("VTranslateMeasurements", "neck_front_to_waist_f",
@ -1233,9 +1232,9 @@ void VTranslateMeasurements::InitGroupI()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "shoulder_length", m = translate("VTranslateMeasurements", "shoulder_length",
@ -1344,9 +1343,9 @@ void VTranslateMeasurements::InitGroupJ()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "bustpoint_to_bustpoint", m = translate("VTranslateMeasurements", "bustpoint_to_bustpoint",
@ -1425,9 +1424,9 @@ void VTranslateMeasurements::InitGroupK()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "shoulder_tip_to_waist_front", m = translate("VTranslateMeasurements", "shoulder_tip_to_waist_front",
@ -1529,9 +1528,9 @@ void VTranslateMeasurements::InitGroupL()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "arm_shoulder_tip_to_wrist_bent", m = translate("VTranslateMeasurements", "arm_shoulder_tip_to_wrist_bent",
@ -1697,9 +1696,9 @@ void VTranslateMeasurements::InitGroupM()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "leg_crotch_to_floor", m = translate("VTranslateMeasurements", "leg_crotch_to_floor",
@ -1808,9 +1807,9 @@ void VTranslateMeasurements::InitGroupN()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "crotch_length", m = translate("VTranslateMeasurements", "crotch_length",
@ -1880,9 +1879,9 @@ void VTranslateMeasurements::InitGroupO()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "neck_back_to_waist_front", m = translate("VTranslateMeasurements", "neck_back_to_waist_front",
@ -1996,9 +1995,9 @@ void VTranslateMeasurements::InitGroupP()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "neck_back_to_bust_front", m = translate("VTranslateMeasurements", "neck_back_to_bust_front",
@ -2098,9 +2097,9 @@ void VTranslateMeasurements::InitGroupQ()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation m; qmu::QmuTranslation m;
QmuTranslation g; qmu::QmuTranslation g;
QmuTranslation d; qmu::QmuTranslation d;
//================================================================================================================= //=================================================================================================================
m = translate("VTranslateMeasurements", "dart_width_shoulder", m = translate("VTranslateMeasurements", "dart_width_shoulder",

View File

@ -44,19 +44,17 @@
#include "../vmisc/vabstractapplication.h" #include "../vmisc/vabstractapplication.h"
#include "vtranslatemeasurements.h" #include "vtranslatemeasurements.h"
using namespace qmu;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VTranslateVars::VTranslateVars() VTranslateVars::VTranslateVars()
:VTranslateMeasurements(), :VTranslateMeasurements(),
PMSystemNames(QMap<QString, QmuTranslation>()), PMSystemNames(QMap<QString, qmu::QmuTranslation>()),
PMSystemAuthors(QMap<QString, QmuTranslation>()), PMSystemAuthors(QMap<QString, qmu::QmuTranslation>()),
PMSystemBooks(QMap<QString, QmuTranslation>()), PMSystemBooks(QMap<QString, qmu::QmuTranslation>()),
variables(QMap<QString, QmuTranslation>()), variables(QMap<QString, qmu::QmuTranslation>()),
functions(QMap<QString, QmuTranslation>()), functions(QMap<QString, qmu::QmuTranslation>()),
postfixOperators(QMap<QString, QmuTranslation>()), postfixOperators(QMap<QString, qmu::QmuTranslation>()),
placeholders(QMap<QString, QmuTranslation>()), placeholders(QMap<QString, qmu::QmuTranslation>()),
stDescriptions(QMap<QString, QmuTranslation>()) stDescriptions(QMap<QString, qmu::QmuTranslation>())
{ {
InitPatternMakingSystems(); InitPatternMakingSystems();
InitVariables(); InitVariables();
@ -69,16 +67,16 @@ VTranslateVars::VTranslateVars()
VTranslateVars::~VTranslateVars() VTranslateVars::~VTranslateVars()
{} {}
#define translate(context, source, disambiguation) QmuTranslation::translate((context), (source), (disambiguation)) #define translate(context, source, disambiguation) qmu::QmuTranslation::translate((context), (source), (disambiguation))
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTranslateVars::InitPatternMakingSystems() void VTranslateVars::InitPatternMakingSystems()
{ {
//Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't //Note. We can't use here function and variables because lupdate tool doesn't see string in variables and doesn't
//mark such string to translation. //mark such string to translation.
QmuTranslation name; qmu::QmuTranslation name;
QmuTranslation author; qmu::QmuTranslation author;
QmuTranslation book; qmu::QmuTranslation book;
//================================================================================================================= //=================================================================================================================
name = translate("VTranslateVars", "Bunka", "System name"); name = translate("VTranslateVars", "Bunka", "System name");
@ -448,8 +446,8 @@ void VTranslateVars::InitPlaceholder()
#undef translate #undef translate
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VTranslateVars::InitSystem(const QString &code, const QmuTranslation &name, const QmuTranslation &author, void VTranslateVars::InitSystem(const QString &code, const qmu::QmuTranslation &name, const qmu::QmuTranslation &author,
const QmuTranslation &book) const qmu::QmuTranslation &book)
{ {
PMSystemNames.insert(code, name); PMSystemNames.insert(code, name);
PMSystemAuthors.insert(code, author); PMSystemAuthors.insert(code, author);
@ -519,10 +517,10 @@ void VTranslateVars::BiasTokens(int position, int bias, QMap<int, QString> &toke
*/ */
bool VTranslateVars::VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const bool VTranslateVars::VariablesFromUser(QString &newFormula, int position, const QString &token, int &bias) const
{ {
QMap<QString, QmuTranslation>::const_iterator i = variables.constBegin(); QMap<QString, qmu::QmuTranslation>::const_iterator i = variables.constBegin();
while (i != variables.constEnd()) while (i != variables.constEnd())
{ {
const QmuTranslation &var = i.value(); const qmu::QmuTranslation &var = i.value();
if (token.indexOf( var.translate() ) == 0) if (token.indexOf( var.translate() ) == 0)
{ {
newFormula.replace(position, var.translate().length(), i.key()); newFormula.replace(position, var.translate().length(), i.key());
@ -547,7 +545,7 @@ bool VTranslateVars::VariablesFromUser(QString &newFormula, int position, const
*/ */
bool VTranslateVars::PostfixOperatorsFromUser(QString &newFormula, int position, const QString &token, int &bias) const bool VTranslateVars::PostfixOperatorsFromUser(QString &newFormula, int position, const QString &token, int &bias) const
{ {
QMap<QString, QmuTranslation>::const_iterator i = postfixOperators.constBegin(); QMap<QString, qmu::QmuTranslation>::const_iterator i = postfixOperators.constBegin();
while (i != postfixOperators.constEnd()) while (i != postfixOperators.constEnd())
{ {
if (token == i.value().translate()) if (token == i.value().translate())
@ -572,7 +570,7 @@ bool VTranslateVars::PostfixOperatorsFromUser(QString &newFormula, int position,
*/ */
bool VTranslateVars::FunctionsFromUser(QString &newFormula, int position, const QString &token, int &bias) const bool VTranslateVars::FunctionsFromUser(QString &newFormula, int position, const QString &token, int &bias) const
{ {
QMap<QString, QmuTranslation>::const_iterator i = functions.constBegin(); QMap<QString, qmu::QmuTranslation>::const_iterator i = functions.constBegin();
while (i != functions.constEnd()) while (i != functions.constEnd())
{ {
if (token == i.value().translate()) if (token == i.value().translate())
@ -597,7 +595,7 @@ bool VTranslateVars::FunctionsFromUser(QString &newFormula, int position, const
*/ */
bool VTranslateVars::VariablesToUser(QString &newFormula, int position, const QString &token, int &bias) const bool VTranslateVars::VariablesToUser(QString &newFormula, int position, const QString &token, int &bias) const
{ {
QMap<QString, QmuTranslation>::const_iterator i = variables.constBegin(); QMap<QString, qmu::QmuTranslation>::const_iterator i = variables.constBegin();
while (i != variables.constEnd()) while (i != variables.constEnd())
{ {
if (token.indexOf( i.key() ) == 0) if (token.indexOf( i.key() ) == 0)
@ -729,7 +727,7 @@ QString VTranslateVars::FormulaFromUser(const QString &formula, bool osSeparator
} }
QString newFormula = formula;// Local copy for making changes QString newFormula = formula;// Local copy for making changes
QmuTokenParser *cal = new QmuTokenParser(formula, osSeparator);// Eval formula qmu::QmuTokenParser *cal = new qmu::QmuTokenParser(formula, osSeparator);// Eval formula
QMap<int, QString> tokens = cal->GetTokens();// Tokens (variables, measurements) QMap<int, QString> tokens = cal->GetTokens();// Tokens (variables, measurements)
QMap<int, QString> numbers = cal->GetNumbers();// All numbers in expression for changing decimal separator QMap<int, QString> numbers = cal->GetNumbers();// All numbers in expression for changing decimal separator
delete cal; delete cal;
@ -850,7 +848,7 @@ QString VTranslateVars::FormulaToUser(const QString &formula, bool osSeparator)
QMap<int, QString> numbers; QMap<int, QString> numbers;
try try
{ {
QmuTokenParser *cal = new QmuTokenParser(formula, false);// Eval formula qmu::QmuTokenParser *cal = new qmu::QmuTokenParser(formula, false);// Eval formula
tokens = cal->GetTokens();// Tokens (variables, measurements) tokens = cal->GetTokens();// Tokens (variables, measurements)
numbers = cal->GetNumbers();// All numbers in expression for changing decimal separator numbers = cal->GetNumbers();// All numbers in expression for changing decimal separator
delete cal; delete cal;
@ -979,7 +977,7 @@ void VTranslateVars::Retranslate()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QMap<QString, QmuTranslation> VTranslateVars::GetFunctions() const QMap<QString, qmu::QmuTranslation> VTranslateVars::GetFunctions() const
{ {
return functions; return functions;
} }

View File

@ -20,8 +20,6 @@
#include "vvector3dproperty.h" #include "vvector3dproperty.h"
using namespace VPE;
#include <QFlags> #include <QFlags>
#include <QForeachContainer> #include <QForeachContainer>
#include <QList> #include <QList>
@ -30,7 +28,7 @@ using namespace VPE;
#include "../../vproperty_p.h" #include "../../vproperty_p.h"
#include "../vnumberproperty.h" #include "../vnumberproperty.h"
QVector3DProperty::QVector3DProperty(const QString& name) VPE::QVector3DProperty::QVector3DProperty(const QString& name)
: VProperty(name, QVariant::String) // todo: QVariant::Vector3D?? : VProperty(name, QVariant::String) // todo: QVariant::Vector3D??
{ {
QVariant tmpFloat(0); tmpFloat.convert(QVariant::Double); QVariant tmpFloat(0); tmpFloat.convert(QVariant::Double);
@ -42,7 +40,7 @@ QVector3DProperty::QVector3DProperty(const QString& name)
//! Get the data how it should be displayed //! Get the data how it should be displayed
QVariant QVector3DProperty::data (int column, int role) const QVariant VPE::QVector3DProperty::data (int column, int role) const
{ {
if (column == DPC_Data && Qt::DisplayRole == role) if (column == DPC_Data && Qt::DisplayRole == role)
{ {
@ -56,7 +54,7 @@ QVariant QVector3DProperty::data (int column, int role) const
} }
//! Returns item flags //! Returns item flags
Qt::ItemFlags QVector3DProperty::flags(int column) const Qt::ItemFlags VPE::QVector3DProperty::flags(int column) const
{ {
if (column == DPC_Name || column == DPC_Data) if (column == DPC_Name || column == DPC_Data)
{ {
@ -68,7 +66,7 @@ Qt::ItemFlags QVector3DProperty::flags(int column) const
//! Returns the Vector3d //! Returns the Vector3d
Vector3D QVector3DProperty::getVector() const VPE::Vector3D VPE::QVector3DProperty::getVector() const
{ {
Vector3D tmpVect; Vector3D tmpVect;
@ -85,12 +83,12 @@ Vector3D QVector3DProperty::getVector() const
} }
//! Sets the Vector3d //! Sets the Vector3d
void QVector3DProperty::setVector(const Vector3D &vect) void VPE::QVector3DProperty::setVector(const Vector3D &vect)
{ {
setVector(vect.X, vect.Y, vect.Z); setVector(vect.X, vect.Y, vect.Z);
} }
void QVector3DProperty::setVector(double x, double y, double z) void VPE::QVector3DProperty::setVector(double x, double y, double z)
{ {
if (d_ptr->Children.count() < 3) if (d_ptr->Children.count() < 3)
{ {
@ -105,12 +103,12 @@ void QVector3DProperty::setVector(double x, double y, double z)
d_ptr->Children.at(2)->setValue(tmpZ); d_ptr->Children.at(2)->setValue(tmpZ);
} }
QString QVector3DProperty::type() const QString VPE::QVector3DProperty::type() const
{ {
return "vector3d"; return "vector3d";
} }
VProperty* QVector3DProperty::clone(bool include_children, VProperty* container) const VPE::VProperty* VPE::QVector3DProperty::clone(bool include_children, VProperty* container) const
{ {
if (!container) if (!container)
{ {
@ -130,7 +128,7 @@ VProperty* QVector3DProperty::clone(bool include_children, VProperty* container)
return VProperty::clone(false, container); // Child return VProperty::clone(false, container); // Child
} }
void QVector3DProperty::setValue(const QVariant &value) void VPE::QVector3DProperty::setValue(const QVariant &value)
{ {
QStringList tmpStrings = value.toString().split(","); QStringList tmpStrings = value.toString().split(",");
if (tmpStrings.count() == 3) if (tmpStrings.count() == 3)
@ -140,7 +138,7 @@ void QVector3DProperty::setValue(const QVariant &value)
} }
QVariant QVector3DProperty::getValue() const QVariant VPE::QVector3DProperty::getValue() const
{ {
Vector3D tmpVect = getVector(); Vector3D tmpVect = getVector();
return QString("%1,%2,%3").arg(QString::number(tmpVect.X), QString::number(tmpVect.Y), QString::number(tmpVect.Z)); return QString("%1,%2,%3").arg(QString::number(tmpVect.X), QString::number(tmpVect.Y), QString::number(tmpVect.Z));

View File

@ -25,12 +25,11 @@
#include "../vproperty_p.h" #include "../vproperty_p.h"
using namespace VPE;
QVariant VBoolProperty::TrueText; QVariant VPE::VBoolProperty::TrueText;
QVariant VBoolProperty::FalseText; QVariant VPE::VBoolProperty::FalseText;
VBoolProperty::VBoolProperty(const QString& name) : VPE::VBoolProperty::VBoolProperty(const QString& name) :
VProperty(name, QVariant::Bool) VProperty(name, QVariant::Bool)
{ {
d_ptr->VariantValue.setValue(false); d_ptr->VariantValue.setValue(false);
@ -49,7 +48,7 @@ VBoolProperty::VBoolProperty(const QString& name) :
//! Get the data how it should be displayed //! Get the data how it should be displayed
QVariant VBoolProperty::data (int column, int role) const QVariant VPE::VBoolProperty::data (int column, int role) const
{ {
if (column == DPC_Data && (Qt::DisplayRole == role || Qt::EditRole == role)) if (column == DPC_Data && (Qt::DisplayRole == role || Qt::EditRole == role))
{ {
@ -63,7 +62,7 @@ QVariant VBoolProperty::data (int column, int role) const
return VProperty::data(column, role); return VProperty::data(column, role);
} }
bool VBoolProperty::setData(const QVariant &data, int role) bool VPE::VBoolProperty::setData(const QVariant &data, int role)
{ {
if (Qt::CheckStateRole == role) if (Qt::CheckStateRole == role)
{ {
@ -75,7 +74,7 @@ bool VBoolProperty::setData(const QVariant &data, int role)
} }
//! Returns item flags //! Returns item flags
Qt::ItemFlags VBoolProperty::flags(int column) const Qt::ItemFlags VPE::VBoolProperty::flags(int column) const
{ {
if (column == DPC_Data) if (column == DPC_Data)
{ {
@ -85,12 +84,12 @@ Qt::ItemFlags VBoolProperty::flags(int column) const
return VProperty::flags(column); return VProperty::flags(column);
} }
QString VBoolProperty::type() const QString VPE::VBoolProperty::type() const
{ {
return "bool"; return "bool";
} }
VProperty *VBoolProperty::clone(bool include_children, VProperty *container) const VPE::VProperty *VPE::VBoolProperty::clone(bool include_children, VProperty *container) const
{ {
return VProperty::clone(include_children, container ? container : new VBoolProperty(getName())); return VProperty::clone(include_children, container ? container : new VBoolProperty(getName()));
} }

View File

@ -31,16 +31,14 @@
class QAbstractItemDelegate; class QAbstractItemDelegate;
class QStyleOptionViewItem; class QStyleOptionViewItem;
using namespace VPE; VPE::VColorProperty::VColorProperty(const QString &name) :
VColorProperty::VColorProperty(const QString &name) :
VProperty(name, QVariant::Color) VProperty(name, QVariant::Color)
{ {
} }
//! Get the data how it should be displayed //! Get the data how it should be displayed
QVariant VColorProperty::data (int column, int role) const QVariant VPE::VColorProperty::data (int column, int role) const
{ {
if (column == DPC_Data && (Qt::DisplayRole == role)) if (column == DPC_Data && (Qt::DisplayRole == role))
{ {
@ -59,11 +57,11 @@ QVariant VColorProperty::data (int column, int role) const
} }
//! Returns an editor widget, or NULL if it doesn't supply one //! Returns an editor widget, or NULL if it doesn't supply one
QWidget* VColorProperty::createEditor(QWidget* parent, const QStyleOptionViewItem& options, QWidget* VPE::VColorProperty::createEditor(QWidget* parent, const QStyleOptionViewItem& options,
const QAbstractItemDelegate* delegate) const QAbstractItemDelegate* delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
Q_UNUSED(delegate); Q_UNUSED(delegate)
VColorPropertyEditor* tmpWidget = new VColorPropertyEditor(parent); VColorPropertyEditor* tmpWidget = new VColorPropertyEditor(parent);
tmpWidget->setLocale(parent->locale()); tmpWidget->setLocale(parent->locale());
@ -72,7 +70,7 @@ QWidget* VColorProperty::createEditor(QWidget* parent, const QStyleOptionViewIte
} }
//! Sets the property's data to the editor (returns false, if the standard delegate should do that) //! Sets the property's data to the editor (returns false, if the standard delegate should do that)
bool VColorProperty::setEditorData(QWidget* editor) bool VPE::VColorProperty::setEditorData(QWidget* editor)
{ {
VColorPropertyEditor* tmpWidget = qobject_cast<VColorPropertyEditor*>(editor); VColorPropertyEditor* tmpWidget = qobject_cast<VColorPropertyEditor*>(editor);
if (tmpWidget) if (tmpWidget)
@ -86,7 +84,7 @@ bool VColorProperty::setEditorData(QWidget* editor)
} }
//! Gets the data from the widget //! Gets the data from the widget
QVariant VColorProperty::getEditorData(const QWidget *editor) const QVariant VPE::VColorProperty::getEditorData(const QWidget *editor) const
{ {
const VColorPropertyEditor* tmpWidget = qobject_cast<const VColorPropertyEditor*>(editor); const VColorPropertyEditor* tmpWidget = qobject_cast<const VColorPropertyEditor*>(editor);
if (tmpWidget) if (tmpWidget)
@ -97,12 +95,12 @@ QVariant VColorProperty::getEditorData(const QWidget *editor) const
return QVariant(); return QVariant();
} }
QString VColorProperty::type() const QString VPE::VColorProperty::type() const
{ {
return "color"; return "color";
} }
VProperty *VColorProperty::clone(bool include_children, VProperty *container) const VPE::VProperty *VPE::VColorProperty::clone(bool include_children, VProperty *container) const
{ {
return VProperty::clone(include_children, container ? container : new VColorProperty(getName())); return VProperty::clone(include_children, container ? container : new VColorProperty(getName()));
} }

View File

@ -35,9 +35,7 @@
class QHBoxLayout; class QHBoxLayout;
using namespace VPE; VPE::VColorPropertyEditor::VColorPropertyEditor(QWidget *parent)
VColorPropertyEditor::VColorPropertyEditor(QWidget *parent)
: QWidget(parent), Color(), ToolButton(nullptr), TextLabel(nullptr), ColorLabel(nullptr), Spacer(nullptr) : QWidget(parent), Color(), ToolButton(nullptr), TextLabel(nullptr), ColorLabel(nullptr), Spacer(nullptr)
{ {
setAutoFillBackground(true); setAutoFillBackground(true);
@ -75,7 +73,7 @@ VColorPropertyEditor::VColorPropertyEditor(QWidget *parent)
//ColorLabel->hide(); // for now, we just use the standard display and only add the button //ColorLabel->hide(); // for now, we just use the standard display and only add the button
} }
void VColorPropertyEditor::SetColor(const QColor& color_) void VPE::VColorPropertyEditor::SetColor(const QColor& color_)
{ {
if (Color != color_) if (Color != color_)
{ {
@ -85,7 +83,7 @@ void VColorPropertyEditor::SetColor(const QColor& color_)
} }
} }
QPixmap VColorPropertyEditor::GetColorPixmap(const QColor& color, quint32 size) QPixmap VPE::VColorPropertyEditor::GetColorPixmap(const QColor& color, quint32 size)
{ {
QImage tmpImgage(static_cast<int>(size), static_cast<int>(size), QImage::Format_ARGB32_Premultiplied); QImage tmpImgage(static_cast<int>(size), static_cast<int>(size), QImage::Format_ARGB32_Premultiplied);
tmpImgage.fill(static_cast<quint32>(color.rgb())); tmpImgage.fill(static_cast<quint32>(color.rgb()));
@ -93,12 +91,12 @@ QPixmap VColorPropertyEditor::GetColorPixmap(const QColor& color, quint32 size)
// todo: support alpha channel // todo: support alpha channel
} }
QString VColorPropertyEditor::GetColorString(const QColor& color) QString VPE::VColorPropertyEditor::GetColorString(const QColor& color)
{ {
return QString("[%1, %2, %3] (%4)").arg(color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha()); return QString("[%1, %2, %3] (%4)").arg(color.red()).arg(color.green()).arg(color.blue()).arg(color.alpha());
} }
void VColorPropertyEditor::onToolButtonClicked() void VPE::VColorPropertyEditor::onToolButtonClicked()
{ {
bool ok = false; bool ok = false;
QRgb oldRgba = Color.rgba(); QRgb oldRgba = Color.rgba();
@ -112,7 +110,7 @@ void VColorPropertyEditor::onToolButtonClicked()
} }
} }
bool VColorPropertyEditor::eventFilter(QObject *obj, QEvent *ev) bool VPE::VColorPropertyEditor::eventFilter(QObject *obj, QEvent *ev)
{ {
if (obj == ToolButton && ev->type() == QEvent::KeyPress) if (obj == ToolButton && ev->type() == QEvent::KeyPress)
{ {
@ -125,12 +123,12 @@ bool VColorPropertyEditor::eventFilter(QObject *obj, QEvent *ev)
} }
VColorPropertyEditor::~VColorPropertyEditor() VPE::VColorPropertyEditor::~VColorPropertyEditor()
{ {
// //
} }
QColor VColorPropertyEditor::GetColor() const QColor VPE::VColorPropertyEditor::GetColor() const
{ {
return Color; return Color;
} }

View File

@ -35,27 +35,25 @@ namespace VPE {
class VPropertyPrivate; class VPropertyPrivate;
} // namespace VPE } // namespace VPE
using namespace VPE; VPE::VEmptyProperty::VEmptyProperty(const QString& name)
VEmptyProperty::VEmptyProperty(const QString& name)
: VProperty(name, QVariant::Invalid) : VProperty(name, QVariant::Invalid)
{ {
} }
VEmptyProperty::VEmptyProperty(VPropertyPrivate *d) VPE::VEmptyProperty::VEmptyProperty(VPropertyPrivate *d)
: VProperty(d) : VProperty(d)
{ {
} }
VEmptyProperty::~VEmptyProperty() VPE::VEmptyProperty::~VEmptyProperty()
{ {
// //
} }
//! Get the data how it should be displayed //! Get the data how it should be displayed
QVariant VEmptyProperty::data (int column, int role) const QVariant VPE::VEmptyProperty::data (int column, int role) const
{ {
if (column == DPC_Data && (Qt::DisplayRole == role || Qt::EditRole == role)) if (column == DPC_Data && (Qt::DisplayRole == role || Qt::EditRole == role))
{ {
@ -74,39 +72,39 @@ QVariant VEmptyProperty::data (int column, int role) const
} }
//! Returns an editor widget, or NULL if it doesn't supply one //! Returns an editor widget, or NULL if it doesn't supply one
QWidget* VEmptyProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options, QWidget* VPE::VEmptyProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
const QAbstractItemDelegate* delegate) const QAbstractItemDelegate* delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
Q_UNUSED(parent); Q_UNUSED(parent)
Q_UNUSED(delegate); Q_UNUSED(delegate)
return NULL; return NULL;
} }
//! Gets the data from the widget //! Gets the data from the widget
QVariant VEmptyProperty::getEditorData(const QWidget *editor) const QVariant VPE::VEmptyProperty::getEditorData(const QWidget *editor) const
{ {
Q_UNUSED(editor); Q_UNUSED(editor)
return QVariant(); return QVariant();
} }
//! Returns item flags //! Returns item flags
Qt::ItemFlags VEmptyProperty::flags(int column) const Qt::ItemFlags VPE::VEmptyProperty::flags(int column) const
{ {
Q_UNUSED(column); Q_UNUSED(column)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable; return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
} }
QString VEmptyProperty::type() const QString VPE::VEmptyProperty::type() const
{ {
return "empty"; return "empty";
} }
VProperty* VEmptyProperty::clone(bool include_children, VProperty* container) const VPE::VProperty* VPE::VEmptyProperty::clone(bool include_children, VProperty* container) const
{ {
return VProperty::clone(include_children, container ? container : new VEmptyProperty(getName())); return VProperty::clone(include_children, container ? container : new VEmptyProperty(getName()));
} }

View File

@ -30,9 +30,7 @@
class QAbstractItemDelegate; class QAbstractItemDelegate;
class QStyleOptionViewItem; class QStyleOptionViewItem;
using namespace VPE; VPE::VEnumProperty::VEnumProperty(const QString& name)
VEnumProperty::VEnumProperty(const QString& name)
: VProperty(name, QVariant::Int), EnumerationLiterals() : VProperty(name, QVariant::Int), EnumerationLiterals()
{ {
VProperty::d_ptr->VariantValue = 0; VProperty::d_ptr->VariantValue = 0;
@ -41,7 +39,7 @@ VEnumProperty::VEnumProperty(const QString& name)
//! Get the data how it should be displayed //! Get the data how it should be displayed
QVariant VEnumProperty::data (int column, int role) const QVariant VPE::VEnumProperty::data (int column, int role) const
{ {
if (EnumerationLiterals.empty()) if (EnumerationLiterals.empty())
{ {
@ -69,11 +67,11 @@ QVariant VEnumProperty::data (int column, int role) const
//! Returns an editor widget, or NULL if it doesn't supply one //! Returns an editor widget, or NULL if it doesn't supply one
QWidget* VEnumProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options, QWidget* VPE::VEnumProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
const QAbstractItemDelegate* delegate) const QAbstractItemDelegate* delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
Q_UNUSED(delegate); Q_UNUSED(delegate)
QComboBox* tmpEditor = new QComboBox(parent); QComboBox* tmpEditor = new QComboBox(parent);
tmpEditor->clear(); tmpEditor->clear();
tmpEditor->setLocale(parent->locale()); tmpEditor->setLocale(parent->locale());
@ -87,7 +85,7 @@ QWidget* VEnumProperty::createEditor(QWidget * parent, const QStyleOptionViewIte
} }
//! Gets the data from the widget //! Gets the data from the widget
QVariant VEnumProperty::getEditorData(const QWidget *editor) const QVariant VPE::VEnumProperty::getEditorData(const QWidget *editor) const
{ {
const QComboBox* tmpEditor = qobject_cast<const QComboBox*>(editor); const QComboBox* tmpEditor = qobject_cast<const QComboBox*>(editor);
if (tmpEditor) if (tmpEditor)
@ -99,19 +97,19 @@ QVariant VEnumProperty::getEditorData(const QWidget *editor) const
} }
//! Sets the enumeration literals //! Sets the enumeration literals
void VEnumProperty::setLiterals(const QStringList& literals) void VPE::VEnumProperty::setLiterals(const QStringList& literals)
{ {
EnumerationLiterals = literals; EnumerationLiterals = literals;
} }
//! Get the settings. This function has to be implemented in a subclass in order to have an effect //! Get the settings. This function has to be implemented in a subclass in order to have an effect
QStringList VEnumProperty::getLiterals() const QStringList VPE::VEnumProperty::getLiterals() const
{ {
return EnumerationLiterals; return EnumerationLiterals;
} }
//! Sets the value of the property //! Sets the value of the property
void VEnumProperty::setValue(const QVariant& value) void VPE::VEnumProperty::setValue(const QVariant& value)
{ {
int tmpIndex = value.toInt(); int tmpIndex = value.toInt();
@ -129,17 +127,17 @@ void VEnumProperty::setValue(const QVariant& value)
} }
} }
QString VEnumProperty::type() const QString VPE::VEnumProperty::type() const
{ {
return "enum"; return "enum";
} }
VProperty* VEnumProperty::clone(bool include_children, VProperty* container) const VPE::VProperty* VPE::VEnumProperty::clone(bool include_children, VProperty* container) const
{ {
return VProperty::clone(include_children, container ? container : new VEnumProperty(getName())); return VProperty::clone(include_children, container ? container : new VEnumProperty(getName()));
} }
void VEnumProperty::setSetting(const QString& key, const QVariant& value) void VPE::VEnumProperty::setSetting(const QString& key, const QVariant& value)
{ {
if (key == "literals") if (key == "literals")
{ {
@ -147,7 +145,7 @@ void VEnumProperty::setSetting(const QString& key, const QVariant& value)
} }
} }
QVariant VEnumProperty::getSetting(const QString& key) const QVariant VPE::VEnumProperty::getSetting(const QString& key) const
{ {
if (key == "literals") if (key == "literals")
{ {
@ -157,12 +155,12 @@ QVariant VEnumProperty::getSetting(const QString& key) const
return VProperty::getSetting(key); return VProperty::getSetting(key);
} }
QStringList VEnumProperty::getSettingKeys() const QStringList VPE::VEnumProperty::getSettingKeys() const
{ {
return QStringList("literals"); return QStringList("literals");
} }
void VEnumProperty::currentIndexChanged(int index) void VPE::VEnumProperty::currentIndexChanged(int index)
{ {
Q_UNUSED(index) Q_UNUSED(index)
UserChangeEvent *event = new UserChangeEvent(); UserChangeEvent *event = new UserChangeEvent();

View File

@ -31,45 +31,43 @@
class QStyleOptionViewItem; class QStyleOptionViewItem;
using namespace VPE; VPE::VFileProperty::VFileProperty(const QString& name)
VFileProperty::VFileProperty(const QString& name)
: VProperty(new VFilePropertyPrivate(name, QVariant::String)) : VProperty(new VFilePropertyPrivate(name, QVariant::String))
{ {
} }
VFileProperty::~VFileProperty() VPE::VFileProperty::~VFileProperty()
{ {
// //
} }
void VFileProperty::setFileFilters(const QString& filefilters) void VPE::VFileProperty::setFileFilters(const QString& filefilters)
{ {
static_cast<VFilePropertyPrivate*>(d_ptr)->FileFilters = filefilters; static_cast<VFilePropertyPrivate*>(d_ptr)->FileFilters = filefilters;
} }
QString VFileProperty::getFileFilters() const QString VPE::VFileProperty::getFileFilters() const
{ {
return static_cast<VFilePropertyPrivate*>(d_ptr)->FileFilters; return static_cast<VFilePropertyPrivate*>(d_ptr)->FileFilters;
} }
void VFileProperty::setFile(const QString& file) void VPE::VFileProperty::setFile(const QString& file)
{ {
d_ptr->VariantValue.setValue(file); d_ptr->VariantValue.setValue(file);
} }
QString VFileProperty::getFile() const QString VPE::VFileProperty::getFile() const
{ {
return d_ptr->VariantValue.toString(); return d_ptr->VariantValue.toString();
} }
QVariant VFileProperty::data (int column, int role) const QVariant VPE::VFileProperty::data (int column, int role) const
{ {
if (column == DPC_Data && (Qt::DisplayRole == role || Qt::EditRole == role)) if (column == DPC_Data && (Qt::DisplayRole == role || Qt::EditRole == role))
{ {
@ -81,10 +79,10 @@ QVariant VFileProperty::data (int column, int role) const
} }
QWidget* VFileProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options, QWidget* VPE::VFileProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
const QAbstractItemDelegate* delegate) const QAbstractItemDelegate* delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
VFileEditWidget* tmpWidget = new VFileEditWidget(parent); VFileEditWidget* tmpWidget = new VFileEditWidget(parent);
if (delegate) if (delegate)
@ -100,7 +98,7 @@ QWidget* VFileProperty::createEditor(QWidget * parent, const QStyleOptionViewIte
} }
bool VFileProperty::setEditorData(QWidget* editor) bool VPE::VFileProperty::setEditorData(QWidget* editor)
{ {
VFileEditWidget* tmpWidget = qobject_cast<VFileEditWidget*>(editor); VFileEditWidget* tmpWidget = qobject_cast<VFileEditWidget*>(editor);
if (tmpWidget) if (tmpWidget)
@ -114,7 +112,7 @@ bool VFileProperty::setEditorData(QWidget* editor)
} }
QVariant VFileProperty::getEditorData(const QWidget *editor) const QVariant VPE::VFileProperty::getEditorData(const QWidget *editor) const
{ {
const VFileEditWidget* tmpWidget = qobject_cast<const VFileEditWidget*>(editor); const VFileEditWidget* tmpWidget = qobject_cast<const VFileEditWidget*>(editor);
if (tmpWidget) if (tmpWidget)
@ -125,7 +123,7 @@ QVariant VFileProperty::getEditorData(const QWidget *editor) const
return QVariant(); return QVariant();
} }
void VFileProperty::setSetting(const QString& key, const QVariant& value) void VPE::VFileProperty::setSetting(const QString& key, const QVariant& value)
{ {
if (key == "FileFilters") if (key == "FileFilters")
{ {
@ -137,7 +135,7 @@ void VFileProperty::setSetting(const QString& key, const QVariant& value)
} }
} }
QVariant VFileProperty::getSetting(const QString& key) const QVariant VPE::VFileProperty::getSetting(const QString& key) const
{ {
if (key == "FileFilters") if (key == "FileFilters")
{ {
@ -151,28 +149,28 @@ QVariant VFileProperty::getSetting(const QString& key) const
return VProperty::getSetting(key); return VProperty::getSetting(key);
} }
QStringList VFileProperty::getSettingKeys() const QStringList VPE::VFileProperty::getSettingKeys() const
{ {
return QStringList("FileFilters") << "Directory"; return QStringList("FileFilters") << "Directory";
} }
QString VFileProperty::type() const QString VPE::VFileProperty::type() const
{ {
return "file"; return "file";
} }
VProperty* VFileProperty::clone(bool include_children, VProperty* container) const VPE::VProperty* VPE::VFileProperty::clone(bool include_children, VProperty* container) const
{ {
return VProperty::clone(include_children, container ? container : new VFileProperty(getName())); return VProperty::clone(include_children, container ? container : new VFileProperty(getName()));
} }
bool VFileProperty::isDirectory() const bool VPE::VFileProperty::isDirectory() const
{ {
return static_cast<VFilePropertyPrivate*>(d_ptr)->Directory; return static_cast<VFilePropertyPrivate*>(d_ptr)->Directory;
} }
void VFileProperty::setDirectory(bool is_directory) void VPE::VFileProperty::setDirectory(bool is_directory)
{ {
static_cast<VFilePropertyPrivate*>(d_ptr)->Directory = is_directory; static_cast<VFilePropertyPrivate*>(d_ptr)->Directory = is_directory;
} }

View File

@ -45,9 +45,7 @@ class QDragMoveEvent;
class QDropEvent; class QDropEvent;
class QHBoxLayout; class QHBoxLayout;
using namespace VPE; VPE::VFileEditWidget::VFileEditWidget(QWidget *parent, bool is_directory)
VFileEditWidget::VFileEditWidget(QWidget *parent, bool is_directory)
: QWidget(parent), CurrentFilePath(), ToolButton(nullptr), FileLineEdit(nullptr), FileDialogFilter(), FilterList(), : QWidget(parent), CurrentFilePath(), ToolButton(nullptr), FileLineEdit(nullptr), FileDialogFilter(), FilterList(),
Directory(is_directory) Directory(is_directory)
{ {
@ -79,13 +77,13 @@ VFileEditWidget::VFileEditWidget(QWidget *parent, bool is_directory)
} }
VFileEditWidget::~VFileEditWidget() VPE::VFileEditWidget::~VFileEditWidget()
{ {
// nothing needs to be done here // nothing needs to be done here
} }
void VFileEditWidget::setFile(const QString &value, bool emit_signal) void VPE::VFileEditWidget::setFile(const QString &value, bool emit_signal)
{ {
if (CurrentFilePath != value) if (CurrentFilePath != value)
{ {
@ -101,24 +99,24 @@ void VFileEditWidget::setFile(const QString &value, bool emit_signal)
} }
void VFileEditWidget::setFilter(const QString &dialog_filter, const QStringList& filter_list) void VPE::VFileEditWidget::setFilter(const QString &dialog_filter, const QStringList& filter_list)
{ {
FileDialogFilter = dialog_filter; FileDialogFilter = dialog_filter;
FilterList = filter_list; FilterList = filter_list;
} }
void VFileEditWidget::setDirectory(bool dir) void VPE::VFileEditWidget::setDirectory(bool dir)
{ {
Directory = dir; Directory = dir;
} }
QString VFileEditWidget::getFile() const QString VPE::VFileEditWidget::getFile() const
{ {
return CurrentFilePath; return CurrentFilePath;
} }
void VFileEditWidget::onToolButtonClicked() void VPE::VFileEditWidget::onToolButtonClicked()
{ {
QString filepath = (Directory ? QFileDialog::getExistingDirectory(0, tr("Directory"), CurrentFilePath) QString filepath = (Directory ? QFileDialog::getExistingDirectory(0, tr("Directory"), CurrentFilePath)
: QFileDialog::getOpenFileName(0, tr("Open File"), CurrentFilePath, : QFileDialog::getOpenFileName(0, tr("Open File"), CurrentFilePath,
@ -130,7 +128,7 @@ void VFileEditWidget::onToolButtonClicked()
} }
bool VFileEditWidget::eventFilter(QObject *obj, QEvent *ev) bool VPE::VFileEditWidget::eventFilter(QObject *obj, QEvent *ev)
{ {
if (ev->type() == QEvent::DragEnter || ev->type() == QEvent::Drop) if (ev->type() == QEvent::DragEnter || ev->type() == QEvent::Drop)
{ {
@ -170,13 +168,13 @@ bool VFileEditWidget::eventFilter(QObject *obj, QEvent *ev)
return QWidget::eventFilter(obj, ev); return QWidget::eventFilter(obj, ev);
} }
bool VFileEditWidget::isDirectory() bool VPE::VFileEditWidget::isDirectory()
{ {
return Directory; return Directory;
} }
void VFileEditWidget::dragEnterEvent(QDragEnterEvent* event) void VPE::VFileEditWidget::dragEnterEvent(QDragEnterEvent* event)
{ {
QString tmpFileName; QString tmpFileName;
if (checkMimeData(event->mimeData(), tmpFileName)) if (checkMimeData(event->mimeData(), tmpFileName))
@ -187,18 +185,18 @@ void VFileEditWidget::dragEnterEvent(QDragEnterEvent* event)
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void VFileEditWidget::dragMoveEvent(QDragMoveEvent* event) void VPE::VFileEditWidget::dragMoveEvent(QDragMoveEvent* event)
{ {
event->acceptProposedAction(); event->acceptProposedAction();
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void VFileEditWidget::dragLeaveEvent(QDragLeaveEvent* event) void VPE::VFileEditWidget::dragLeaveEvent(QDragLeaveEvent* event)
{ {
event->accept(); event->accept();
} }
void VFileEditWidget::dropEvent(QDropEvent* event) void VPE::VFileEditWidget::dropEvent(QDropEvent* event)
{ {
QString tmpFileName; QString tmpFileName;
if (checkMimeData(event->mimeData(), tmpFileName)) if (checkMimeData(event->mimeData(), tmpFileName))
@ -212,7 +210,7 @@ void VFileEditWidget::dropEvent(QDropEvent* event)
} }
bool VFileEditWidget::checkMimeData(const QMimeData* data, QString& file) const bool VPE::VFileEditWidget::checkMimeData(const QMimeData* data, QString& file) const
{ {
if (data->hasUrls()) if (data->hasUrls())
{ {
@ -235,7 +233,7 @@ bool VFileEditWidget::checkMimeData(const QMimeData* data, QString& file) const
return false; return false;
} }
bool VFileEditWidget::checkFileFilter(const QString& file) const bool VPE::VFileEditWidget::checkFileFilter(const QString& file) const
{ {
if (FilterList.isEmpty()) if (FilterList.isEmpty())
{ {

View File

@ -45,16 +45,14 @@
class QAbstractItemDelegate; class QAbstractItemDelegate;
class QStyleOptionViewItem; class QStyleOptionViewItem;
using namespace VPE; VPE::VLineColorProperty::VLineColorProperty(const QString &name)
VLineColorProperty::VLineColorProperty(const QString &name)
: VProperty(name, QVariant::Int), colors(), indexList() : VProperty(name, QVariant::Int), colors(), indexList()
{ {
VProperty::d_ptr->VariantValue = 0; VProperty::d_ptr->VariantValue = 0;
VProperty::d_ptr->VariantValue.convert(QVariant::Int); VProperty::d_ptr->VariantValue.convert(QVariant::Int);
} }
QVariant VLineColorProperty::data(int column, int role) const QVariant VPE::VLineColorProperty::data(int column, int role) const
{ {
if (colors.empty()) if (colors.empty())
{ {
@ -82,11 +80,11 @@ QVariant VLineColorProperty::data(int column, int role) const
} }
} }
QWidget *VLineColorProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options, QWidget *VPE::VLineColorProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options,
const QAbstractItemDelegate *delegate) const QAbstractItemDelegate *delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
Q_UNUSED(delegate); Q_UNUSED(delegate)
QComboBox* tmpEditor = new QComboBox(parent); QComboBox* tmpEditor = new QComboBox(parent);
int size = tmpEditor->iconSize().height(); int size = tmpEditor->iconSize().height();
@ -113,7 +111,7 @@ QWidget *VLineColorProperty::createEditor(QWidget *parent, const QStyleOptionVie
return VProperty::d_ptr->editor; return VProperty::d_ptr->editor;
} }
QVariant VLineColorProperty::getEditorData(const QWidget *editor) const QVariant VPE::VLineColorProperty::getEditorData(const QWidget *editor) const
{ {
const QComboBox* tmpEditor = qobject_cast<const QComboBox*>(editor); const QComboBox* tmpEditor = qobject_cast<const QComboBox*>(editor);
if (tmpEditor) if (tmpEditor)
@ -124,7 +122,7 @@ QVariant VLineColorProperty::getEditorData(const QWidget *editor) const
return QVariant(0); return QVariant(0);
} }
void VLineColorProperty::setColors(const QMap<QString, QString> &colors) void VPE::VLineColorProperty::setColors(const QMap<QString, QString> &colors)
{ {
this->colors = colors; this->colors = colors;
indexList.clear(); indexList.clear();
@ -137,12 +135,12 @@ void VLineColorProperty::setColors(const QMap<QString, QString> &colors)
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
QMap<QString, QString> VLineColorProperty::getColors() const QMap<QString, QString> VPE::VLineColorProperty::getColors() const
{ {
return colors; return colors;
} }
void VLineColorProperty::setValue(const QVariant &value) void VPE::VLineColorProperty::setValue(const QVariant &value)
{ {
int tmpIndex = value.toInt(); int tmpIndex = value.toInt();
@ -160,17 +158,17 @@ void VLineColorProperty::setValue(const QVariant &value)
} }
} }
QString VLineColorProperty::type() const QString VPE::VLineColorProperty::type() const
{ {
return QStringLiteral("lineColor"); return QStringLiteral("lineColor");
} }
VProperty *VLineColorProperty::clone(bool include_children, VProperty *container) const VPE::VProperty *VPE::VLineColorProperty::clone(bool include_children, VProperty *container) const
{ {
return VProperty::clone(include_children, container ? container : new VLineColorProperty(getName())); return VProperty::clone(include_children, container ? container : new VLineColorProperty(getName()));
} }
int VLineColorProperty::IndexOfColor(const QMap<QString, QString> &colors, const QString &color) int VPE::VLineColorProperty::IndexOfColor(const QMap<QString, QString> &colors, const QString &color)
{ {
QVector<QString> indexList; QVector<QString> indexList;
QMap<QString, QString>::const_iterator i = colors.constBegin(); QMap<QString, QString>::const_iterator i = colors.constBegin();
@ -182,7 +180,7 @@ int VLineColorProperty::IndexOfColor(const QMap<QString, QString> &colors, const
return indexList.indexOf(color); return indexList.indexOf(color);
} }
void VLineColorProperty::currentIndexChanged(int index) void VPE::VLineColorProperty::currentIndexChanged(int index)
{ {
Q_UNUSED(index) Q_UNUSED(index)
UserChangeEvent *event = new UserChangeEvent(); UserChangeEvent *event = new UserChangeEvent();

View File

@ -42,16 +42,14 @@
class QAbstractItemDelegate; class QAbstractItemDelegate;
class QStyleOptionViewItem; class QStyleOptionViewItem;
using namespace VPE; VPE::VLineTypeProperty::VLineTypeProperty(const QString &name)
VLineTypeProperty::VLineTypeProperty(const QString &name)
: VProperty(name, QVariant::Int), styles(), indexList() : VProperty(name, QVariant::Int), styles(), indexList()
{ {
VProperty::d_ptr->VariantValue = 0; VProperty::d_ptr->VariantValue = 0;
VProperty::d_ptr->VariantValue.convert(QVariant::Int); VProperty::d_ptr->VariantValue.convert(QVariant::Int);
} }
QVariant VLineTypeProperty::data(int column, int role) const QVariant VPE::VLineTypeProperty::data(int column, int role) const
{ {
if (styles.empty()) if (styles.empty())
{ {
@ -79,11 +77,11 @@ QVariant VLineTypeProperty::data(int column, int role) const
} }
} }
QWidget *VLineTypeProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options, QWidget *VPE::VLineTypeProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options,
const QAbstractItemDelegate *delegate) const QAbstractItemDelegate *delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
Q_UNUSED(delegate); Q_UNUSED(delegate)
QComboBox* tmpEditor = new QComboBox(parent); QComboBox* tmpEditor = new QComboBox(parent);
tmpEditor->clear(); tmpEditor->clear();
tmpEditor->setLocale(parent->locale()); tmpEditor->setLocale(parent->locale());
@ -106,7 +104,7 @@ QWidget *VLineTypeProperty::createEditor(QWidget *parent, const QStyleOptionView
return VProperty::d_ptr->editor; return VProperty::d_ptr->editor;
} }
QVariant VLineTypeProperty::getEditorData(const QWidget *editor) const QVariant VPE::VLineTypeProperty::getEditorData(const QWidget *editor) const
{ {
const QComboBox* tmpEditor = qobject_cast<const QComboBox*>(editor); const QComboBox* tmpEditor = qobject_cast<const QComboBox*>(editor);
if (tmpEditor) if (tmpEditor)
@ -117,7 +115,7 @@ QVariant VLineTypeProperty::getEditorData(const QWidget *editor) const
return QVariant(0); return QVariant(0);
} }
void VLineTypeProperty::setStyles(const QMap<QString, QIcon> &styles) void VPE::VLineTypeProperty::setStyles(const QMap<QString, QIcon> &styles)
{ {
this->styles = styles; this->styles = styles;
indexList.clear(); indexList.clear();
@ -130,12 +128,12 @@ void VLineTypeProperty::setStyles(const QMap<QString, QIcon> &styles)
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
QMap<QString, QIcon> VLineTypeProperty::getStyles() const QMap<QString, QIcon> VPE::VLineTypeProperty::getStyles() const
{ {
return styles; return styles;
} }
void VLineTypeProperty::setValue(const QVariant &value) void VPE::VLineTypeProperty::setValue(const QVariant &value)
{ {
int tmpIndex = value.toInt(); int tmpIndex = value.toInt();
@ -153,17 +151,17 @@ void VLineTypeProperty::setValue(const QVariant &value)
} }
} }
QString VLineTypeProperty::type() const QString VPE::VLineTypeProperty::type() const
{ {
return QStringLiteral("lineType"); return QStringLiteral("lineType");
} }
VProperty *VLineTypeProperty::clone(bool include_children, VProperty *container) const VPE::VProperty *VPE::VLineTypeProperty::clone(bool include_children, VProperty *container) const
{ {
return VProperty::clone(include_children, container ? container : new VLineTypeProperty(getName())); return VProperty::clone(include_children, container ? container : new VLineTypeProperty(getName()));
} }
int VLineTypeProperty::IndexOfStyle(const QMap<QString, QIcon> &styles, const QString &style) int VPE::VLineTypeProperty::IndexOfStyle(const QMap<QString, QIcon> &styles, const QString &style)
{ {
QVector<QString> indexList; QVector<QString> indexList;
QMap<QString, QIcon>::const_iterator i = styles.constBegin(); QMap<QString, QIcon>::const_iterator i = styles.constBegin();
@ -175,7 +173,7 @@ int VLineTypeProperty::IndexOfStyle(const QMap<QString, QIcon> &styles, const QS
return indexList.indexOf(style); return indexList.indexOf(style);
} }
void VLineTypeProperty::currentIndexChanged(int index) void VPE::VLineTypeProperty::currentIndexChanged(int index)
{ {
Q_UNUSED(index) Q_UNUSED(index)
UserChangeEvent *event = new UserChangeEvent(); UserChangeEvent *event = new UserChangeEvent();

View File

@ -33,13 +33,10 @@
class QAbstractItemDelegate; class QAbstractItemDelegate;
class QStyleOptionViewItem; class QStyleOptionViewItem;
using namespace VPE; const int VPE::VIntegerProperty::StandardMin = -1000000;
const int VPE::VIntegerProperty::StandardMax = 1000000;
VPE::VIntegerProperty::VIntegerProperty(const QString& name, const QMap<QString, QVariant>& settings)
const int VIntegerProperty::StandardMin = -1000000;
const int VIntegerProperty::StandardMax = 1000000;
VIntegerProperty::VIntegerProperty(const QString& name, const QMap<QString, QVariant>& settings)
: VProperty(name, QVariant::Int), minValue(StandardMin), maxValue(StandardMax), singleStep(1.0) : VProperty(name, QVariant::Int), minValue(StandardMin), maxValue(StandardMax), singleStep(1.0)
{ {
VProperty::setSettings(settings); VProperty::setSettings(settings);
@ -47,7 +44,7 @@ VIntegerProperty::VIntegerProperty(const QString& name, const QMap<QString, QVar
VProperty::d_ptr->VariantValue.convert(QVariant::Int); VProperty::d_ptr->VariantValue.convert(QVariant::Int);
} }
VIntegerProperty::VIntegerProperty(const QString &name) VPE::VIntegerProperty::VIntegerProperty(const QString &name)
: VProperty(name), minValue(StandardMin), maxValue(StandardMax), singleStep(1.0) : VProperty(name), minValue(StandardMin), maxValue(StandardMax), singleStep(1.0)
{ {
VProperty::d_ptr->VariantValue.setValue(0); VProperty::d_ptr->VariantValue.setValue(0);
@ -55,11 +52,11 @@ VIntegerProperty::VIntegerProperty(const QString &name)
} }
//! Returns an editor widget, or NULL if it doesn't supply one //! Returns an editor widget, or NULL if it doesn't supply one
QWidget* VIntegerProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options, QWidget* VPE::VIntegerProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
const QAbstractItemDelegate* delegate) const QAbstractItemDelegate* delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
Q_UNUSED(delegate); Q_UNUSED(delegate)
QSpinBox* tmpEditor = new QSpinBox(parent); QSpinBox* tmpEditor = new QSpinBox(parent);
tmpEditor->setLocale(parent->locale()); tmpEditor->setLocale(parent->locale());
@ -76,7 +73,7 @@ QWidget* VIntegerProperty::createEditor(QWidget * parent, const QStyleOptionView
} }
//! Gets the data from the widget //! Gets the data from the widget
QVariant VIntegerProperty::getEditorData(const QWidget *editor) const QVariant VPE::VIntegerProperty::getEditorData(const QWidget *editor) const
{ {
const QSpinBox* tmpEditor = qobject_cast<const QSpinBox*>(editor); const QSpinBox* tmpEditor = qobject_cast<const QSpinBox*>(editor);
if (tmpEditor) if (tmpEditor)
@ -87,7 +84,7 @@ QVariant VIntegerProperty::getEditorData(const QWidget *editor) const
return QVariant(0); return QVariant(0);
} }
void VIntegerProperty::setSetting(const QString& key, const QVariant& value) void VPE::VIntegerProperty::setSetting(const QString& key, const QVariant& value)
{ {
if (key == QLatin1String("Min")) if (key == QLatin1String("Min"))
{ {
@ -103,7 +100,7 @@ void VIntegerProperty::setSetting(const QString& key, const QVariant& value)
} }
} }
QVariant VIntegerProperty::getSetting(const QString& key) const QVariant VPE::VIntegerProperty::getSetting(const QString& key) const
{ {
if (key == QLatin1String("Min")) if (key == QLatin1String("Min"))
{ {
@ -121,31 +118,31 @@ QVariant VIntegerProperty::getSetting(const QString& key) const
return VProperty::getSetting(key); return VProperty::getSetting(key);
} }
QStringList VIntegerProperty::getSettingKeys() const QStringList VPE::VIntegerProperty::getSettingKeys() const
{ {
return (QStringList("Min") << "Max" << "Step"); return (QStringList("Min") << "Max" << "Step");
} }
QString VIntegerProperty::type() const QString VPE::VIntegerProperty::type() const
{ {
return "integer"; return "integer";
} }
VProperty* VIntegerProperty::clone(bool include_children, VProperty* container) const VPE::VProperty* VPE::VIntegerProperty::clone(bool include_children, VProperty* container) const
{ {
return VProperty::clone(include_children, container ? container : new VIntegerProperty(getName())); return VProperty::clone(include_children, container ? container : new VIntegerProperty(getName()));
} }
void VIntegerProperty::valueChanged(int i) void VPE::VIntegerProperty::valueChanged(int i)
{ {
Q_UNUSED(i) Q_UNUSED(i)
UserChangeEvent *event = new UserChangeEvent(); UserChangeEvent *event = new UserChangeEvent();
QCoreApplication::postEvent ( VProperty::d_ptr->editor, event ); QCoreApplication::postEvent ( VProperty::d_ptr->editor, event );
} }
const double VDoubleProperty::StandardPrecision = 5; const double VPE::VDoubleProperty::StandardPrecision = 5;
VDoubleProperty::VDoubleProperty(const QString& name, const QMap<QString, QVariant>& settings) VPE::VDoubleProperty::VDoubleProperty(const QString& name, const QMap<QString, QVariant>& settings)
: VIntegerProperty(name), Precision(static_cast<int>(StandardPrecision)) : VIntegerProperty(name), Precision(static_cast<int>(StandardPrecision))
{ {
VProperty::setSettings(settings); VProperty::setSettings(settings);
@ -154,7 +151,7 @@ VDoubleProperty::VDoubleProperty(const QString& name, const QMap<QString, QVaria
VProperty::d_ptr->PropertyVariantType = QVariant::Double; VProperty::d_ptr->PropertyVariantType = QVariant::Double;
} }
VDoubleProperty::VDoubleProperty(const QString &name) VPE::VDoubleProperty::VDoubleProperty(const QString &name)
: VIntegerProperty(name), Precision(static_cast<int>(StandardPrecision)) : VIntegerProperty(name), Precision(static_cast<int>(StandardPrecision))
{ {
VProperty::d_ptr->VariantValue.setValue(0); VProperty::d_ptr->VariantValue.setValue(0);
@ -163,11 +160,11 @@ VDoubleProperty::VDoubleProperty(const QString &name)
} }
//! Returns an editor widget, or NULL if it doesn't supply one //! Returns an editor widget, or NULL if it doesn't supply one
QWidget* VDoubleProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options, QWidget* VPE::VDoubleProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
const QAbstractItemDelegate* delegate) const QAbstractItemDelegate* delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
Q_UNUSED(delegate); Q_UNUSED(delegate)
QDoubleSpinBox* tmpEditor = new QDoubleSpinBox(parent); QDoubleSpinBox* tmpEditor = new QDoubleSpinBox(parent);
tmpEditor->setLocale(parent->locale()); tmpEditor->setLocale(parent->locale());
tmpEditor->setMinimum(minValue); tmpEditor->setMinimum(minValue);
@ -184,7 +181,7 @@ QWidget* VDoubleProperty::createEditor(QWidget * parent, const QStyleOptionViewI
} }
//! Gets the data from the widget //! Gets the data from the widget
QVariant VDoubleProperty::getEditorData(const QWidget *editor) const QVariant VPE::VDoubleProperty::getEditorData(const QWidget *editor) const
{ {
const QDoubleSpinBox* tmpEditor = qobject_cast<const QDoubleSpinBox*>(editor); const QDoubleSpinBox* tmpEditor = qobject_cast<const QDoubleSpinBox*>(editor);
if (tmpEditor) if (tmpEditor)
@ -195,7 +192,7 @@ QVariant VDoubleProperty::getEditorData(const QWidget *editor) const
return QVariant(0); return QVariant(0);
} }
void VDoubleProperty::setSetting(const QString& key, const QVariant& value) void VPE::VDoubleProperty::setSetting(const QString& key, const QVariant& value)
{ {
if (key == QLatin1String("Min")) if (key == QLatin1String("Min"))
{ {
@ -215,7 +212,7 @@ void VDoubleProperty::setSetting(const QString& key, const QVariant& value)
} }
} }
QVariant VDoubleProperty::getSetting(const QString& key) const QVariant VPE::VDoubleProperty::getSetting(const QString& key) const
{ {
if (key == QLatin1String("Min")) if (key == QLatin1String("Min"))
{ {
@ -237,17 +234,17 @@ QVariant VDoubleProperty::getSetting(const QString& key) const
return VProperty::getSetting(key); return VProperty::getSetting(key);
} }
QStringList VDoubleProperty::getSettingKeys() const QStringList VPE::VDoubleProperty::getSettingKeys() const
{ {
return (QStringList("Min") << "Max" << "Step" << "Precision"); return (QStringList("Min") << "Max" << "Step" << "Precision");
} }
QString VDoubleProperty::type() const QString VPE::VDoubleProperty::type() const
{ {
return "double"; return "double";
} }
VProperty* VDoubleProperty::clone(bool include_children, VProperty* container) const VPE::VProperty* VPE::VDoubleProperty::clone(bool include_children, VProperty* container) const
{ {
return VIntegerProperty::clone(include_children, container ? container : new VDoubleProperty(getName())); return VIntegerProperty::clone(include_children, container ? container : new VDoubleProperty(getName()));
} }

View File

@ -30,9 +30,7 @@
class QAbstractItemDelegate; class QAbstractItemDelegate;
class QStyleOptionViewItem; class QStyleOptionViewItem;
using namespace VPE; VPE::VObjectProperty::VObjectProperty(const QString& name)
VObjectProperty::VObjectProperty(const QString& name)
: VProperty(name, QVariant::Int), objects() : VProperty(name, QVariant::Int), objects()
{ {
VProperty::d_ptr->VariantValue = 0; VProperty::d_ptr->VariantValue = 0;
@ -40,7 +38,7 @@ VObjectProperty::VObjectProperty(const QString& name)
} }
//! Get the data how it should be displayed //! Get the data how it should be displayed
QVariant VObjectProperty::data (int column, int role) const QVariant VPE::VObjectProperty::data (int column, int role) const
{ {
if (objects.empty()) if (objects.empty())
{ {
@ -62,11 +60,11 @@ QVariant VObjectProperty::data (int column, int role) const
} }
//! Returns an editor widget, or NULL if it doesn't supply one //! Returns an editor widget, or NULL if it doesn't supply one
QWidget* VObjectProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options, QWidget* VPE::VObjectProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
const QAbstractItemDelegate* delegate) const QAbstractItemDelegate* delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
Q_UNUSED(delegate); Q_UNUSED(delegate)
QComboBox* tmpEditor = new QComboBox(parent); QComboBox* tmpEditor = new QComboBox(parent);
tmpEditor->clear(); tmpEditor->clear();
tmpEditor->setLocale(parent->locale()); tmpEditor->setLocale(parent->locale());
@ -79,7 +77,7 @@ QWidget* VObjectProperty::createEditor(QWidget * parent, const QStyleOptionViewI
return VProperty::d_ptr->editor; return VProperty::d_ptr->editor;
} }
bool VObjectProperty::setEditorData(QWidget *editor) bool VPE::VObjectProperty::setEditorData(QWidget *editor)
{ {
if (!editor) if (!editor)
{ {
@ -106,7 +104,7 @@ bool VObjectProperty::setEditorData(QWidget *editor)
} }
//! Gets the data from the widget //! Gets the data from the widget
QVariant VObjectProperty::getEditorData(const QWidget *editor) const QVariant VPE::VObjectProperty::getEditorData(const QWidget *editor) const
{ {
const QComboBox* tmpEditor = qobject_cast<const QComboBox*>(editor); const QComboBox* tmpEditor = qobject_cast<const QComboBox*>(editor);
if (tmpEditor) if (tmpEditor)
@ -119,20 +117,20 @@ QVariant VObjectProperty::getEditorData(const QWidget *editor) const
//! Sets the objects list //! Sets the objects list
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void VObjectProperty::setObjectsList(const QMap<QString, quint32> &objects) void VPE::VObjectProperty::setObjectsList(const QMap<QString, quint32> &objects)
{ {
this->objects = objects; this->objects = objects;
} }
//! Get the settings. This function has to be implemented in a subclass in order to have an effect //! Get the settings. This function has to be implemented in a subclass in order to have an effect
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
QMap<QString, quint32> VObjectProperty::getObjects() const QMap<QString, quint32> VPE::VObjectProperty::getObjects() const
{ {
return objects; return objects;
} }
//! Sets the value of the property //! Sets the value of the property
void VObjectProperty::setValue(const QVariant& value) void VPE::VObjectProperty::setValue(const QVariant& value)
{ {
VProperty::d_ptr->VariantValue = value; VProperty::d_ptr->VariantValue = value;
VProperty::d_ptr->VariantValue.convert(QVariant::UInt); VProperty::d_ptr->VariantValue.convert(QVariant::UInt);
@ -143,24 +141,24 @@ void VObjectProperty::setValue(const QVariant& value)
} }
} }
QString VObjectProperty::type() const QString VPE::VObjectProperty::type() const
{ {
return "objectList"; return "objectList";
} }
VProperty* VObjectProperty::clone(bool include_children, VProperty* container) const VPE::VProperty* VPE::VObjectProperty::clone(bool include_children, VProperty* container) const
{ {
return VProperty::clone(include_children, container ? container : new VObjectProperty(getName())); return VProperty::clone(include_children, container ? container : new VObjectProperty(getName()));
} }
void VObjectProperty::currentIndexChanged(int index) void VPE::VObjectProperty::currentIndexChanged(int index)
{ {
Q_UNUSED(index) Q_UNUSED(index)
UserChangeEvent *event = new UserChangeEvent(); UserChangeEvent *event = new UserChangeEvent();
QCoreApplication::postEvent ( VProperty::d_ptr->editor, event ); QCoreApplication::postEvent ( VProperty::d_ptr->editor, event );
} }
void VObjectProperty::FillList(QComboBox *box, const QMap<QString, quint32> &list) const void VPE::VObjectProperty::FillList(QComboBox *box, const QMap<QString, quint32> &list) const
{ {
box->clear(); box->clear();

View File

@ -20,8 +20,6 @@
#include "vpointfproperty.h" #include "vpointfproperty.h"
using namespace VPE;
#include <QFlags> #include <QFlags>
#include <QForeachContainer> #include <QForeachContainer>
#include <QList> #include <QList>
@ -49,7 +47,7 @@ VPE::VPointFProperty::VPointFProperty(const QString &name)
setValue(QPointF()); setValue(QPointF());
} }
QVariant VPointFProperty::data(int column, int role) const QVariant VPE::VPointFProperty::data(int column, int role) const
{ {
if (column == DPC_Data && Qt::DisplayRole == role) if (column == DPC_Data && Qt::DisplayRole == role)
{ {
@ -59,7 +57,7 @@ QVariant VPointFProperty::data(int column, int role) const
return VProperty::data(column, role); return VProperty::data(column, role);
} }
Qt::ItemFlags VPointFProperty::flags(int column) const Qt::ItemFlags VPE::VPointFProperty::flags(int column) const
{ {
if (column == DPC_Name || column == DPC_Data) if (column == DPC_Name || column == DPC_Data)
{ {
@ -69,7 +67,7 @@ Qt::ItemFlags VPointFProperty::flags(int column) const
return Qt::NoItemFlags; return Qt::NoItemFlags;
} }
QPointF VPointFProperty::getPointF() const QPointF VPE::VPointFProperty::getPointF() const
{ {
QPointF tmpValue; QPointF tmpValue;
@ -84,12 +82,12 @@ QPointF VPointFProperty::getPointF() const
return tmpValue; return tmpValue;
} }
void VPointFProperty::setPointF(const QPointF &point) void VPE::VPointFProperty::setPointF(const QPointF &point)
{ {
setPointF(point.x(), point.y()); setPointF(point.x(), point.y());
} }
void VPointFProperty::setPointF(qreal x, qreal y) void VPE::VPointFProperty::setPointF(qreal x, qreal y)
{ {
if (d_ptr->Children.count() < 2) if (d_ptr->Children.count() < 2)
{ {
@ -106,12 +104,12 @@ void VPointFProperty::setPointF(qreal x, qreal y)
d_ptr->Children.at(1)->setValue(tmpY); d_ptr->Children.at(1)->setValue(tmpY);
} }
QString VPointFProperty::type() const QString VPE::VPointFProperty::type() const
{ {
return "pointF"; return "pointF";
} }
VProperty *VPointFProperty::clone(bool include_children, VProperty *container) const VPE::VProperty *VPE::VPointFProperty::clone(bool include_children, VProperty *container) const
{ {
if (!container) if (!container)
{ {
@ -131,13 +129,13 @@ VProperty *VPointFProperty::clone(bool include_children, VProperty *container) c
return VProperty::clone(false, container); // Child return VProperty::clone(false, container); // Child
} }
void VPointFProperty::setValue(const QVariant &value) void VPE::VPointFProperty::setValue(const QVariant &value)
{ {
QPointF tmpPoint = value.toPointF(); QPointF tmpPoint = value.toPointF();
setPointF(tmpPoint); setPointF(tmpPoint);
} }
QVariant VPointFProperty::getValue() const QVariant VPE::VPointFProperty::getValue() const
{ {
QPointF tmpValue = getPointF(); QPointF tmpValue = getPointF();
return QString("%1,%2").arg(QString::number(tmpValue.x()), QString::number(tmpValue.y())); return QString("%1,%2").arg(QString::number(tmpValue.x()), QString::number(tmpValue.y()));

View File

@ -30,21 +30,18 @@
class QStyleOptionViewItem; class QStyleOptionViewItem;
VPE::VShortcutProperty::VShortcutProperty(const QString& name)
using namespace VPE;
VShortcutProperty::VShortcutProperty(const QString& name)
: VProperty(name, QVariant::String) : VProperty(name, QVariant::String)
{ {
} }
VShortcutProperty::~VShortcutProperty() VPE::VShortcutProperty::~VShortcutProperty()
{ {
// //
} }
QVariant VShortcutProperty::data (int column, int role) const QVariant VPE::VShortcutProperty::data (int column, int role) const
{ {
if (column == DPC_Data && (Qt::DisplayRole == role || Qt::EditRole == role)) if (column == DPC_Data && (Qt::DisplayRole == role || Qt::EditRole == role))
{ {
@ -55,10 +52,10 @@ QVariant VShortcutProperty::data (int column, int role) const
} }
QWidget* VShortcutProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options, QWidget* VPE::VShortcutProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
const QAbstractItemDelegate* delegate) const QAbstractItemDelegate* delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
VShortcutEditWidget* tmpWidget = new VShortcutEditWidget(parent); VShortcutEditWidget* tmpWidget = new VShortcutEditWidget(parent);
if (delegate) if (delegate)
@ -70,7 +67,7 @@ QWidget* VShortcutProperty::createEditor(QWidget * parent, const QStyleOptionVie
} }
bool VShortcutProperty::setEditorData(QWidget* editor) bool VPE::VShortcutProperty::setEditorData(QWidget* editor)
{ {
VShortcutEditWidget* tmpWidget = qobject_cast<VShortcutEditWidget*>(editor); VShortcutEditWidget* tmpWidget = qobject_cast<VShortcutEditWidget*>(editor);
if (tmpWidget) if (tmpWidget)
@ -84,7 +81,7 @@ bool VShortcutProperty::setEditorData(QWidget* editor)
} }
QVariant VShortcutProperty::getEditorData(const QWidget *editor) const QVariant VPE::VShortcutProperty::getEditorData(const QWidget *editor) const
{ {
const VShortcutEditWidget* tmpWidget = qobject_cast<const VShortcutEditWidget*>(editor); const VShortcutEditWidget* tmpWidget = qobject_cast<const VShortcutEditWidget*>(editor);
if (tmpWidget) if (tmpWidget)
@ -96,17 +93,17 @@ QVariant VShortcutProperty::getEditorData(const QWidget *editor) const
} }
QString VShortcutProperty::type() const QString VPE::VShortcutProperty::type() const
{ {
return "shortcut"; return "shortcut";
} }
VProperty* VShortcutProperty::clone(bool include_children, VProperty* container) const VPE::VProperty* VPE::VShortcutProperty::clone(bool include_children, VProperty* container) const
{ {
return VProperty::clone(include_children, container ? container : new VShortcutProperty(getName())); return VProperty::clone(include_children, container ? container : new VShortcutProperty(getName()));
} }
void VShortcutProperty::setValue(const QVariant &value) void VPE::VShortcutProperty::setValue(const QVariant &value)
{ {
VProperty::setValue(QKeySequence::fromString(value.toString()).toString()); VProperty::setValue(QKeySequence::fromString(value.toString()).toString());
} }

View File

@ -30,9 +30,7 @@
class QHBoxLayout; class QHBoxLayout;
class QKeyEvent; class QKeyEvent;
using namespace VPE; VPE::VShortcutEditWidget::VShortcutEditWidget(QWidget *parent)
VShortcutEditWidget::VShortcutEditWidget(QWidget *parent)
: QWidget(parent), CurrentKeySequence(), LineEdit(nullptr) : QWidget(parent), CurrentKeySequence(), LineEdit(nullptr)
{ {
// Create the line edit widget // Create the line edit widget
@ -51,12 +49,12 @@ VShortcutEditWidget::VShortcutEditWidget(QWidget *parent)
} }
VShortcutEditWidget::~VShortcutEditWidget() VPE::VShortcutEditWidget::~VShortcutEditWidget()
{ {
// nothing needs to be done here // nothing needs to be done here
} }
bool VShortcutEditWidget::eventFilter(QObject *obj, QEvent *event) bool VPE::VShortcutEditWidget::eventFilter(QObject *obj, QEvent *event)
{ {
if (obj == LineEdit) if (obj == LineEdit)
{ {
@ -82,23 +80,23 @@ bool VShortcutEditWidget::eventFilter(QObject *obj, QEvent *event)
return QWidget::eventFilter(obj, event); return QWidget::eventFilter(obj, event);
} }
QString VShortcutEditWidget::getShortcutAsString() const QString VPE::VShortcutEditWidget::getShortcutAsString() const
{ {
return CurrentKeySequence.toString(); return CurrentKeySequence.toString();
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
QKeySequence VShortcutEditWidget::getShortcut() QKeySequence VPE::VShortcutEditWidget::getShortcut()
{ {
return CurrentKeySequence; return CurrentKeySequence;
} }
void VShortcutEditWidget::setShortcut(const QString &shortcut, bool emit_signal) void VPE::VShortcutEditWidget::setShortcut(const QString &shortcut, bool emit_signal)
{ {
setShortcut(QKeySequence::fromString(shortcut), emit_signal); setShortcut(QKeySequence::fromString(shortcut), emit_signal);
} }
void VShortcutEditWidget::setShortcut(const QKeySequence &shortcut, bool emit_signal) void VPE::VShortcutEditWidget::setShortcut(const QKeySequence &shortcut, bool emit_signal)
{ {
if (shortcut != CurrentKeySequence) if (shortcut != CurrentKeySequence)
{ {
@ -111,7 +109,7 @@ void VShortcutEditWidget::setShortcut(const QKeySequence &shortcut, bool emit_si
} }
} }
void VShortcutEditWidget::onTextEdited(const QString &text) void VPE::VShortcutEditWidget::onTextEdited(const QString &text)
{ {
setShortcut(text, true); setShortcut(text, true);
} }

View File

@ -35,9 +35,6 @@
class QAbstractItemDelegate; class QAbstractItemDelegate;
class QStyleOptionViewItem; class QStyleOptionViewItem;
using namespace VPE;
VPE::VStringProperty::VStringProperty(const QString &name, const QMap<QString, QVariant> &settings) VPE::VStringProperty::VStringProperty(const QString &name, const QMap<QString, QVariant> &settings)
: VProperty(name, QVariant::String), readOnly(false), typeForParent(0), clearButton(false), m_osSeparator(false) : VProperty(name, QVariant::String), readOnly(false), typeForParent(0), clearButton(false), m_osSeparator(false)
{ {
@ -56,8 +53,8 @@ VPE::VStringProperty::VStringProperty(const QString &name)
QWidget *VPE::VStringProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options, QWidget *VPE::VStringProperty::createEditor(QWidget *parent, const QStyleOptionViewItem &options,
const QAbstractItemDelegate *delegate) const QAbstractItemDelegate *delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
Q_UNUSED(delegate); Q_UNUSED(delegate)
QLineEdit* tmpEditor = new QLineEdit(parent); QLineEdit* tmpEditor = new QLineEdit(parent);
tmpEditor->setLocale(parent->locale()); tmpEditor->setLocale(parent->locale());
@ -89,12 +86,12 @@ void VPE::VStringProperty::setReadOnly(bool readOnly)
this->readOnly = readOnly; this->readOnly = readOnly;
} }
void VStringProperty::setOsSeparator(bool separator) void VPE::VStringProperty::setOsSeparator(bool separator)
{ {
m_osSeparator = separator; m_osSeparator = separator;
} }
void VStringProperty::setClearButtonEnable(bool value) void VPE::VStringProperty::setClearButtonEnable(bool value)
{ {
this->clearButton = value; this->clearButton = value;
} }
@ -142,23 +139,23 @@ VPE::VProperty *VPE::VStringProperty::clone(bool include_children, VPE::VPropert
return VProperty::clone(include_children, container ? container : new VStringProperty(getName(), getSettings())); return VProperty::clone(include_children, container ? container : new VStringProperty(getName(), getSettings()));
} }
void VStringProperty::UpdateParent(const QVariant &value) void VPE::VStringProperty::UpdateParent(const QVariant &value)
{ {
emit childChanged(value, typeForParent); emit childChanged(value, typeForParent);
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
int VStringProperty::getTypeForParent() const int VPE::VStringProperty::getTypeForParent() const
{ {
return typeForParent; return typeForParent;
} }
void VStringProperty::setTypeForParent(int value) void VPE::VStringProperty::setTypeForParent(int value)
{ {
typeForParent = value; typeForParent = value;
} }
bool VStringProperty::eventFilter(QObject *object, QEvent *event) bool VPE::VStringProperty::eventFilter(QObject *object, QEvent *event)
{ {
if (QLineEdit *textEdit = qobject_cast<QLineEdit *>(object)) if (QLineEdit *textEdit = qobject_cast<QLineEdit *>(object))
{ {

View File

@ -28,24 +28,22 @@
#include "vemptyproperty.h" #include "vemptyproperty.h"
#include "../vproperty.h" #include "../vproperty.h"
using namespace VPE; VPE::VWidgetProperty::VWidgetProperty(const QString& name, QWidget* widget)
VWidgetProperty::VWidgetProperty(const QString& name, QWidget* widget)
: VEmptyProperty(new VWidgetPropertyPrivate(name, QVariant::Invalid, widget)) : VEmptyProperty(new VWidgetPropertyPrivate(name, QVariant::Invalid, widget))
{ {
} }
VWidgetProperty::~VWidgetProperty() VPE::VWidgetProperty::~VWidgetProperty()
{ {
// //
} }
QWidget *VWidgetProperty::getWidget() const QWidget *VPE::VWidgetProperty::getWidget() const
{ {
return static_cast<VWidgetPropertyPrivate*>(d_ptr)->Widget.data(); return static_cast<VWidgetPropertyPrivate*>(d_ptr)->Widget.data();
} }
void VWidgetProperty::setWidget(QWidget* widget) void VPE::VWidgetProperty::setWidget(QWidget* widget)
{ {
VWidgetPropertyPrivate* tmpDPtr = static_cast<VWidgetPropertyPrivate*>(d_ptr); VWidgetPropertyPrivate* tmpDPtr = static_cast<VWidgetPropertyPrivate*>(d_ptr);
QWidget* tmpOldWidget = tmpDPtr->Widget.data(); QWidget* tmpOldWidget = tmpDPtr->Widget.data();
@ -58,12 +56,12 @@ void VWidgetProperty::setWidget(QWidget* widget)
} }
QString VWidgetProperty::type() const QString VPE::VWidgetProperty::type() const
{ {
return "widget"; return "widget";
} }
VProperty* VWidgetProperty::clone(bool include_children, VProperty* container) const VPE::VProperty* VPE::VWidgetProperty::clone(bool include_children, VProperty* container) const
{ {
/* todo: This is a tricky one to clone... don't know what would be the best way to do so... Maybe serialize the /* todo: This is a tricky one to clone... don't know what would be the best way to do so... Maybe serialize the
* widget somehow? * widget somehow?

View File

@ -38,22 +38,20 @@ class QModelIndex;
class QPainter; class QPainter;
class QStyleOptionViewItem; class QStyleOptionViewItem;
using namespace VPE;
//! Standard constructor, takes a name and a parent property as argument //! Standard constructor, takes a name and a parent property as argument
VProperty::VProperty(const QString& name, QVariant::Type type) VPE::VProperty::VProperty(const QString& name, QVariant::Type type)
: QObject(), d_ptr(new VPropertyPrivate(name, type)) : QObject(), d_ptr(new VPropertyPrivate(name, type))
{ {
} }
VProperty::VProperty(VPropertyPrivate *d) VPE::VProperty::VProperty(VPropertyPrivate *d)
: d_ptr(d) : d_ptr(d)
{ {
} }
VProperty::~VProperty() VPE::VProperty::~VProperty()
{ {
setParent(nullptr); setParent(nullptr);
@ -66,13 +64,13 @@ VProperty::~VProperty()
delete d_ptr; delete d_ptr;
} }
QString VProperty::type() const QString VPE::VProperty::type() const
{ {
return "string"; return "string";
} }
//! Get the data how it should be displayed //! Get the data how it should be displayed
QVariant VProperty::data (int column, int role) const QVariant VPE::VProperty::data (int column, int role) const
{ {
if (column == DPC_Name && Qt::DisplayRole == role) if (column == DPC_Name && Qt::DisplayRole == role)
{ {
@ -90,7 +88,7 @@ QVariant VProperty::data (int column, int role) const
return QVariant(); return QVariant();
} }
bool VProperty::setData(const QVariant &data, int role) bool VPE::VProperty::setData(const QVariant &data, int role)
{ {
bool tmpResult = false; bool tmpResult = false;
if (Qt::EditRole == role) if (Qt::EditRole == role)
@ -102,23 +100,23 @@ bool VProperty::setData(const QVariant &data, int role)
return tmpResult; return tmpResult;
} }
bool VProperty::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index, bool VPE::VProperty::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index,
const QAbstractItemDelegate *delegate) const const QAbstractItemDelegate *delegate) const
{ {
Q_UNUSED(painter); Q_UNUSED(painter)
Q_UNUSED(option); Q_UNUSED(option)
Q_UNUSED(index); Q_UNUSED(index)
Q_UNUSED(delegate); Q_UNUSED(delegate)
return false; return false;
} }
//! Returns an editor widget, or NULL if it doesn't supply one //! Returns an editor widget, or NULL if it doesn't supply one
QWidget* VProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options, QWidget* VPE::VProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
const QAbstractItemDelegate* delegate) const QAbstractItemDelegate* delegate)
{ {
Q_UNUSED(options); Q_UNUSED(options)
Q_UNUSED(delegate); Q_UNUSED(delegate)
QItemEditorFactory *factory = new QItemEditorFactory; QItemEditorFactory *factory = new QItemEditorFactory;
QItemEditorCreatorBase *lineCreator = new QStandardItemEditorCreator<QLineEdit>(); QItemEditorCreatorBase *lineCreator = new QStandardItemEditorCreator<QLineEdit>();
@ -129,7 +127,7 @@ QWidget* VProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& o
return d_ptr->editor; return d_ptr->editor;
} }
bool VProperty::setEditorData(QWidget* editor) bool VPE::VProperty::setEditorData(QWidget* editor)
{ {
if (!editor) if (!editor)
{ {
@ -150,7 +148,7 @@ bool VProperty::setEditorData(QWidget* editor)
} }
//! Gets the data from the widget //! Gets the data from the widget
QVariant VProperty::getEditorData(const QWidget* editor) const QVariant VPE::VProperty::getEditorData(const QWidget* editor) const
{ {
if (!editor) if (!editor)
{ {
@ -168,7 +166,7 @@ QVariant VProperty::getEditorData(const QWidget* editor) const
} }
//! Returns item flags //! Returns item flags
Qt::ItemFlags VProperty::flags(int column) const Qt::ItemFlags VPE::VProperty::flags(int column) const
{ {
if (column == DPC_Name) if (column == DPC_Name)
{ {
@ -183,7 +181,7 @@ Qt::ItemFlags VProperty::flags(int column) const
} }
void VProperty::setValue(const QVariant &value) void VPE::VProperty::setValue(const QVariant &value)
{ {
d_ptr->VariantValue = value; d_ptr->VariantValue = value;
d_ptr->VariantValue.convert(static_cast<int>(d_ptr->PropertyVariantType)); d_ptr->VariantValue.convert(static_cast<int>(d_ptr->PropertyVariantType));
@ -193,60 +191,60 @@ void VProperty::setValue(const QVariant &value)
} }
} }
QVariant VProperty::getValue() const QVariant VPE::VProperty::getValue() const
{ {
return d_ptr->VariantValue; return d_ptr->VariantValue;
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
QString VProperty::serialize() const QString VPE::VProperty::serialize() const
{ {
return getValue().toString(); return getValue().toString();
} }
void VProperty::deserialize(const QString& value) void VPE::VProperty::deserialize(const QString& value)
{ {
setValue(QVariant(value)); setValue(QVariant(value));
} }
void VProperty::setName(const QString& name) void VPE::VProperty::setName(const QString& name)
{ {
d_ptr->Name = name; d_ptr->Name = name;
} }
QString VProperty::getName() const QString VPE::VProperty::getName() const
{ {
return d_ptr->Name; return d_ptr->Name;
} }
void VProperty::setDescription(const QString& desc) void VPE::VProperty::setDescription(const QString& desc)
{ {
d_ptr->Description = desc; d_ptr->Description = desc;
} }
QString VProperty::getDescription() const QString VPE::VProperty::getDescription() const
{ {
return d_ptr->Description; return d_ptr->Description;
} }
//! Returns a reference to the list of children //! Returns a reference to the list of children
QList<VProperty*>& VProperty::getChildren() QList<VPE::VProperty*>& VPE::VProperty::getChildren()
{ {
return d_ptr->Children; return d_ptr->Children;
} }
//! Returns a reference to the list of children //! Returns a reference to the list of children
const QList<VProperty*>& VProperty::getChildren() const const QList<VPE::VProperty*>& VPE::VProperty::getChildren() const
{ {
return d_ptr->Children; return d_ptr->Children;
} }
//! Returns the child at a certain row //! Returns the child at a certain row
VProperty* VProperty::getChild(int row) const VPE::VProperty* VPE::VProperty::getChild(int row) const
{ {
if (row >= 0 && row < getRowCount()) if (row >= 0 && row < getRowCount())
{ {
@ -257,19 +255,19 @@ VProperty* VProperty::getChild(int row) const
} }
//! Gets the number of children //! Gets the number of children
int VProperty::getRowCount() const int VPE::VProperty::getRowCount() const
{ {
return d_ptr->Children.count(); return d_ptr->Children.count();
} }
//! Gets the parent of this property //! Gets the parent of this property
VProperty* VProperty::getParent() const VPE::VProperty* VPE::VProperty::getParent() const
{ {
return d_ptr->Parent; return d_ptr->Parent;
} }
//! Sets the parent of this property //! Sets the parent of this property
void VProperty::setParent(VProperty* parent) void VPE::VProperty::setParent(VProperty* parent)
{ {
if (d_ptr->Parent == parent) if (d_ptr->Parent == parent)
{ {
@ -290,7 +288,7 @@ void VProperty::setParent(VProperty* parent)
} }
} }
int VProperty::addChild(VProperty *child) int VPE::VProperty::addChild(VProperty *child)
{ {
if (child && child->getParent() != this) if (child && child->getParent() != this)
{ {
@ -309,7 +307,7 @@ int VProperty::addChild(VProperty *child)
} }
//! Removes a child from the children list //! Removes a child from the children list
void VProperty::removeChild(VProperty* child) void VPE::VProperty::removeChild(VProperty* child)
{ {
d_ptr->Children.removeAll(child); d_ptr->Children.removeAll(child);
@ -320,32 +318,32 @@ void VProperty::removeChild(VProperty* child)
} }
//! Returns the row the child has //! Returns the row the child has
int VProperty::getChildRow(VProperty* child) const int VPE::VProperty::getChildRow(VProperty* child) const
{ {
return d_ptr->Children.indexOf(child); return d_ptr->Children.indexOf(child);
} }
//! Returns whether the views have to update the parent of this property if it changes //! Returns whether the views have to update the parent of this property if it changes
bool VProperty::getUpdateParent() const bool VPE::VProperty::getUpdateParent() const
{ {
return d_ptr->UpdateParent; return d_ptr->UpdateParent;
} }
//! Returns whether the views have to update the children of this property if it changes //! Returns whether the views have to update the children of this property if it changes
bool VProperty::getUpdateChildren() const bool VPE::VProperty::getUpdateChildren() const
{ {
return d_ptr->UpdateChildren; return d_ptr->UpdateChildren;
} }
//! Sets whether the views should update Parents or children after this property changes //! Sets whether the views should update Parents or children after this property changes
void VProperty::setUpdateBehaviour(bool update_parent, bool update_children) void VPE::VProperty::setUpdateBehaviour(bool update_parent, bool update_children)
{ {
d_ptr->UpdateParent = update_parent; d_ptr->UpdateParent = update_parent;
d_ptr->UpdateChildren = update_children; d_ptr->UpdateChildren = update_children;
} }
void VProperty::setSettings(const QMap<QString, QVariant>& settings) void VPE::VProperty::setSettings(const QMap<QString, QVariant>& settings)
{ {
QMap<QString, QVariant>::const_iterator tmpIterator = settings.constBegin(); QMap<QString, QVariant>::const_iterator tmpIterator = settings.constBegin();
for (; tmpIterator != settings.constEnd(); ++tmpIterator) for (; tmpIterator != settings.constEnd(); ++tmpIterator)
@ -354,7 +352,7 @@ void VProperty::setSettings(const QMap<QString, QVariant>& settings)
} }
} }
QMap<QString, QVariant> VProperty::getSettings() const QMap<QString, QVariant> VPE::VProperty::getSettings() const
{ {
QMap<QString, QVariant> tmpResult; QMap<QString, QVariant> tmpResult;
@ -365,26 +363,26 @@ QMap<QString, QVariant> VProperty::getSettings() const
return tmpResult; return tmpResult;
} }
void VProperty::setSetting(const QString& key, const QVariant& value) void VPE::VProperty::setSetting(const QString& key, const QVariant& value)
{ {
Q_UNUSED(key) Q_UNUSED(key)
Q_UNUSED(value) Q_UNUSED(value)
// Not needed in the Standard property // Not needed in the Standard property
} }
QVariant VProperty::getSetting(const QString& key) const QVariant VPE::VProperty::getSetting(const QString& key) const
{ {
// Not needed in the Standard property // Not needed in the Standard property
Q_UNUSED(key) Q_UNUSED(key)
return QVariant(); return QVariant();
} }
QStringList VProperty::getSettingKeys() const QStringList VPE::VProperty::getSettingKeys() const
{ {
return QStringList(); return QStringList();
} }
VProperty* VProperty::clone(bool include_children, VProperty* container) const VPE::VProperty* VPE::VProperty::clone(bool include_children, VProperty* container) const
{ {
if (!container) if (!container)
{ {
@ -407,28 +405,28 @@ VProperty* VProperty::clone(bool include_children, VProperty* container) const
return container; return container;
} }
Property VProperty::propertyType() const VPE::Property VPE::VProperty::propertyType() const
{ {
return d_ptr->type; return d_ptr->type;
} }
void VProperty::setPropertyType(const Property &type) void VPE::VProperty::setPropertyType(const Property &type)
{ {
d_ptr->type = type; d_ptr->type = type;
} }
void VProperty::UpdateParent(const QVariant &value) void VPE::VProperty::UpdateParent(const QVariant &value)
{ {
Q_UNUSED(value); Q_UNUSED(value)
} }
void VProperty::ValueChildChanged(const QVariant &value, int typeForParent) void VPE::VProperty::ValueChildChanged(const QVariant &value, int typeForParent)
{ {
Q_UNUSED(value) Q_UNUSED(value)
Q_UNUSED(typeForParent) Q_UNUSED(typeForParent)
} }
UserChangeEvent::~UserChangeEvent() VPE::UserChangeEvent::~UserChangeEvent()
{} {}
VPE::VPropertyPrivate::~VPropertyPrivate() VPE::VPropertyPrivate::~VPropertyPrivate()

View File

@ -36,20 +36,18 @@
class QStyleOptionViewItem; class QStyleOptionViewItem;
class QWidget; class QWidget;
using namespace VPE; VPE::VPropertyDelegate::VPropertyDelegate(QObject *parent) :
VPropertyDelegate::VPropertyDelegate(QObject *parent) :
QStyledItemDelegate(parent), RowHeight(0), AddRowHeight(false) QStyledItemDelegate(parent), RowHeight(0), AddRowHeight(false)
{ {
} }
VPropertyDelegate::~VPropertyDelegate() VPE::VPropertyDelegate::~VPropertyDelegate()
{ {
// //
} }
QWidget* VPropertyDelegate::createEditor (QWidget* parent, const QStyleOptionViewItem& option, QWidget* VPE::VPropertyDelegate::createEditor (QWidget* parent, const QStyleOptionViewItem& option,
const QModelIndex& index) const const QModelIndex& index) const
{ {
QWidget* tmpWidget = nullptr; QWidget* tmpWidget = nullptr;
if (index.isValid()) if (index.isValid())
@ -63,7 +61,7 @@ QWidget* VPropertyDelegate::createEditor (QWidget* parent, const QStyleOptionVie
//! Sets the index data to the editor //! Sets the index data to the editor
void VPropertyDelegate::setEditorData (QWidget * editor, const QModelIndex & index) const void VPE::VPropertyDelegate::setEditorData (QWidget * editor, const QModelIndex & index) const
{ {
bool done = false; bool done = false;
if (index.isValid() && editor) if (index.isValid() && editor)
@ -79,7 +77,8 @@ void VPropertyDelegate::setEditorData (QWidget * editor, const QModelIndex & ind
} }
//! Updates the index data //! Updates the index data
void VPropertyDelegate::setModelData (QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const void VPE::VPropertyDelegate::setModelData (QWidget * editor, QAbstractItemModel * model,
const QModelIndex & index) const
{ {
QVariant tmpData; QVariant tmpData;
if (index.isValid() && editor) if (index.isValid() && editor)
@ -96,7 +95,7 @@ void VPropertyDelegate::setModelData (QWidget * editor, QAbstractItemModel * mod
model->setData(index, tmpData); model->setData(index, tmpData);
} }
QSize VPropertyDelegate::sizeHint (const QStyleOptionViewItem& option, const QModelIndex& index) const QSize VPE::VPropertyDelegate::sizeHint (const QStyleOptionViewItem& option, const QModelIndex& index) const
{ {
QSize tmpStandardSizeHint = QStyledItemDelegate::sizeHint(option, index); QSize tmpStandardSizeHint = QStyledItemDelegate::sizeHint(option, index);
tmpStandardSizeHint.setHeight(tmpStandardSizeHint.height() + 1); tmpStandardSizeHint.setHeight(tmpStandardSizeHint.height() + 1);
@ -109,13 +108,14 @@ QSize VPropertyDelegate::sizeHint (const QStyleOptionViewItem& option, const QMo
return tmpStandardSizeHint; return tmpStandardSizeHint;
} }
void VPropertyDelegate::setRowHeight(int height, bool add_to_standard) void VPE::VPropertyDelegate::setRowHeight(int height, bool add_to_standard)
{ {
RowHeight = height; RowHeight = height;
AddRowHeight = add_to_standard; AddRowHeight = add_to_standard;
} }
void VPropertyDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const void VPE::VPropertyDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option,
const QModelIndex& index ) const
{ {
bool done = false; bool done = false;
if (index.isValid() && index.column() == 1) if (index.isValid() && index.column() == 1)

View File

@ -30,18 +30,15 @@
#include "vpropertyfactorymanager_p.h" #include "vpropertyfactorymanager_p.h"
#include "vstandardpropertyfactory.h" #include "vstandardpropertyfactory.h"
using namespace VPE; VPE::VPropertyFactoryManager* VPE::VPropertyFactoryManager::DefaultManager = NULL;
VPE::VPropertyFactoryManager::VPropertyFactoryManager(QObject *parent)
VPropertyFactoryManager* VPropertyFactoryManager::DefaultManager = NULL;
VPropertyFactoryManager::VPropertyFactoryManager(QObject *parent)
: QObject(parent), d_ptr(new VPropertyFactoryManagerPrivate()) : QObject(parent), d_ptr(new VPropertyFactoryManagerPrivate())
{ {
} }
VPropertyFactoryManager::~VPropertyFactoryManager() VPE::VPropertyFactoryManager::~VPropertyFactoryManager()
{ {
// Delete all factories // Delete all factories
QList<VAbstractPropertyFactory*> tmpFactories = d_ptr->Factories.values(); QList<VAbstractPropertyFactory*> tmpFactories = d_ptr->Factories.values();
@ -60,7 +57,7 @@ VPropertyFactoryManager::~VPropertyFactoryManager()
} }
} }
void VPropertyFactoryManager::registerFactory(const QString& type, VAbstractPropertyFactory* factory) void VPE::VPropertyFactoryManager::registerFactory(const QString& type, VAbstractPropertyFactory* factory)
{ {
if (type.isEmpty()) if (type.isEmpty())
{ {
@ -73,7 +70,7 @@ void VPropertyFactoryManager::registerFactory(const QString& type, VAbstractProp
d_ptr->Factories[type] = factory; d_ptr->Factories[type] = factory;
} }
void VPropertyFactoryManager::unregisterFactory(VAbstractPropertyFactory* factory, const QString& type, void VPE::VPropertyFactoryManager::unregisterFactory(VAbstractPropertyFactory* factory, const QString& type,
bool delete_if_unused) bool delete_if_unused)
{ {
if (!factory) if (!factory)
@ -109,19 +106,19 @@ void VPropertyFactoryManager::unregisterFactory(VAbstractPropertyFactory* factor
} }
} }
bool VPropertyFactoryManager::isRegistered(VAbstractPropertyFactory* factory) bool VPE::VPropertyFactoryManager::isRegistered(VAbstractPropertyFactory* factory)
{ {
return (!d_ptr->Factories.key(factory, QString()).isEmpty()); return (!d_ptr->Factories.key(factory, QString()).isEmpty());
} }
VAbstractPropertyFactory* VPropertyFactoryManager::getFactory(const QString& type) VPE::VAbstractPropertyFactory* VPE::VPropertyFactoryManager::getFactory(const QString& type)
{ {
return d_ptr->Factories.value(type, NULL); return d_ptr->Factories.value(type, NULL);
} }
VProperty* VPropertyFactoryManager::createProperty(const QString& type, const QString& name, const QString& description, VPE::VProperty* VPE::VPropertyFactoryManager::createProperty(const QString& type, const QString& name,
const QString &default_value) const QString& description, const QString &default_value)
{ {
VAbstractPropertyFactory* tmpFactory = getFactory(type); VAbstractPropertyFactory* tmpFactory = getFactory(type);
VProperty* tmpResult = NULL; VProperty* tmpResult = NULL;
@ -144,19 +141,19 @@ VProperty* VPropertyFactoryManager::createProperty(const QString& type, const QS
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
VPropertyFactoryManager *VPropertyFactoryManager::getDefaultManager() //VPE::VPropertyFactoryManager *VPE::VPropertyFactoryManager::getDefaultManager()
{ //{
if (!DefaultManager) // if (!DefaultManager)
{ // {
DefaultManager = new VPropertyFactoryManager(); // DefaultManager = new VPropertyFactoryManager();
/*VStandardPropertyFactory* tmpStandardProp = */new VStandardPropertyFactory(DefaultManager); // /*VStandardPropertyFactory* tmpStandardProp = */new VStandardPropertyFactory(DefaultManager);
} // }
return DefaultManager; // return DefaultManager;
} //}
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
QStringList VPropertyFactoryManager::getSupportedTypes() QStringList VPE::VPropertyFactoryManager::getSupportedTypes()
{ {
return d_ptr->Factories.keys(); return d_ptr->Factories.keys();
} }

View File

@ -80,7 +80,7 @@ public:
const QString& default_value = QString()); const QString& default_value = QString());
//! Returns the default manager. //! Returns the default manager.
static VPropertyFactoryManager* getDefaultManager(); //static VPropertyFactoryManager* getDefaultManager();
//! Returns a list of all supported property types //! Returns a list of all supported property types
QStringList getSupportedTypes(); QStringList getSupportedTypes();

View File

@ -33,32 +33,30 @@ class QModelIndex;
class QShowEvent; class QShowEvent;
class QWidget; class QWidget;
using namespace VPE; VPE::VPropertyFormView::VPropertyFormView(QWidget* parent)
VPropertyFormView::VPropertyFormView(QWidget* parent)
: VPropertyFormWidget(new VPropertyFormViewPrivate(), parent) : VPropertyFormWidget(new VPropertyFormViewPrivate(), parent)
{ {
// //
} }
VPropertyFormView::VPropertyFormView(VPropertyModel* model, QWidget *parent) VPE::VPropertyFormView::VPropertyFormView(VPropertyModel* model, QWidget *parent)
: VPropertyFormWidget(new VPropertyFormViewPrivate(), parent) : VPropertyFormWidget(new VPropertyFormViewPrivate(), parent)
{ {
setModel(model); setModel(model);
} }
VPropertyFormView::VPropertyFormView(VPropertySet* property_set, QWidget *parent) VPE::VPropertyFormView::VPropertyFormView(VPropertySet* property_set, QWidget *parent)
: VPropertyFormWidget(new VPropertyFormViewPrivate(), parent) : VPropertyFormWidget(new VPropertyFormViewPrivate(), parent)
{ {
setPropertySet(property_set); setPropertySet(property_set);
} }
VPropertyFormView::~VPropertyFormView() VPE::VPropertyFormView::~VPropertyFormView()
{ {
// Nothing to do // Nothing to do
} }
void VPropertyFormView::build() void VPE::VPropertyFormView::build()
{ {
VPropertyFormWidget::build(); VPropertyFormWidget::build();
@ -66,7 +64,7 @@ void VPropertyFormView::build()
connectPropertyFormWidget(this); connectPropertyFormWidget(this);
} }
void VPropertyFormView::setModel(VPropertyModel *model) void VPE::VPropertyFormView::setModel(VPropertyModel *model)
{ {
// Remove old model or set // Remove old model or set
removeModelAndSet(); removeModelAndSet();
@ -92,7 +90,7 @@ void VPropertyFormView::setModel(VPropertyModel *model)
updatePropertyList(); updatePropertyList();
} }
void VPropertyFormView::setPropertySet(VPropertySet* property_set) void VPE::VPropertyFormView::setPropertySet(VPropertySet* property_set)
{ {
// Remove old model or set // Remove old model or set
removeModelAndSet(); removeModelAndSet();
@ -109,7 +107,7 @@ void VPropertyFormView::setPropertySet(VPropertySet* property_set)
updatePropertyList(); updatePropertyList();
} }
void VPropertyFormView::rowsRemoved(const QModelIndex &parent, int start, int end) void VPE::VPropertyFormView::rowsRemoved(const QModelIndex &parent, int start, int end)
{ {
// todo: Only rebuild the neccessary parts // todo: Only rebuild the neccessary parts
Q_UNUSED(parent) Q_UNUSED(parent)
@ -118,7 +116,7 @@ void VPropertyFormView::rowsRemoved(const QModelIndex &parent, int start, int en
updatePropertyList(); updatePropertyList();
} }
void VPropertyFormView::rowsInserted(const QModelIndex &parent, int start, int end) //-V524 void VPE::VPropertyFormView::rowsInserted(const QModelIndex &parent, int start, int end) //-V524
{ {
// todo: Only rebuild the neccessary parts // todo: Only rebuild the neccessary parts
Q_UNUSED(parent) Q_UNUSED(parent)
@ -127,18 +125,18 @@ void VPropertyFormView::rowsInserted(const QModelIndex &parent, int start, int e
updatePropertyList(); updatePropertyList();
} }
void VPropertyFormView::modelReset() void VPE::VPropertyFormView::modelReset()
{ {
updatePropertyList(); updatePropertyList();
} }
void VPropertyFormView::modelDestroyed() void VPE::VPropertyFormView::modelDestroyed()
{ {
removeModelAndSet(); removeModelAndSet();
updatePropertyList(); updatePropertyList();
} }
void VPropertyFormView::dataChanged(const QModelIndex &top_left, const QModelIndex &bottom_right) void VPE::VPropertyFormView::dataChanged(const QModelIndex &top_left, const QModelIndex &bottom_right)
{ {
Q_UNUSED(top_left) Q_UNUSED(top_left)
Q_UNUSED(bottom_right) Q_UNUSED(bottom_right)
@ -149,7 +147,7 @@ void VPropertyFormView::dataChanged(const QModelIndex &top_left, const QModelInd
// todo: handle data changes // todo: handle data changes
} }
void VPropertyFormView::dataSubmitted(VProperty *property) void VPE::VPropertyFormView::dataSubmitted(VProperty *property)
{ {
VPropertyModel* tmpModel = static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model; VPropertyModel* tmpModel = static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model;
@ -161,7 +159,7 @@ void VPropertyFormView::dataSubmitted(VProperty *property)
} }
} }
void VPropertyFormView::showEvent(QShowEvent *event) void VPE::VPropertyFormView::showEvent(QShowEvent *event)
{ {
Q_UNUSED(event) Q_UNUSED(event)
if (static_cast<VPropertyFormViewPrivate*>(d_ptr)->NeedsRebuild) if (static_cast<VPropertyFormViewPrivate*>(d_ptr)->NeedsRebuild)
@ -171,7 +169,7 @@ void VPropertyFormView::showEvent(QShowEvent *event)
static_cast<VPropertyFormViewPrivate*>(d_ptr)->NeedsRebuild = false; static_cast<VPropertyFormViewPrivate*>(d_ptr)->NeedsRebuild = false;
} }
void VPropertyFormView::updatePropertyList() void VPE::VPropertyFormView::updatePropertyList()
{ {
VPropertyModel* tmpModel = static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model; VPropertyModel* tmpModel = static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model;
VPropertySet* tmpSet = static_cast<VPropertyFormViewPrivate*>(d_ptr)->PropertySet; VPropertySet* tmpSet = static_cast<VPropertyFormViewPrivate*>(d_ptr)->PropertySet;
@ -195,7 +193,7 @@ void VPropertyFormView::updatePropertyList()
static_cast<VPropertyFormViewPrivate*>(d_ptr)->NeedsRebuild = true; static_cast<VPropertyFormViewPrivate*>(d_ptr)->NeedsRebuild = true;
} }
void VPropertyFormView::removeModelAndSet() void VPE::VPropertyFormView::removeModelAndSet()
{ {
if (static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model) if (static_cast<VPropertyFormViewPrivate*>(d_ptr)->Model)
{ {
@ -208,7 +206,7 @@ void VPropertyFormView::removeModelAndSet()
static_cast<VPropertyFormViewPrivate*>(d_ptr)->PropertySet = nullptr; static_cast<VPropertyFormViewPrivate*>(d_ptr)->PropertySet = nullptr;
} }
void VPropertyFormView::connectPropertyFormWidget(VPropertyFormWidget *widget) void VPE::VPropertyFormView::connectPropertyFormWidget(VPropertyFormWidget *widget)
{ {
if (!widget) if (!widget)
{ {

View File

@ -38,9 +38,7 @@
class QKeyEvent; class QKeyEvent;
using namespace VPE; VPE::VPropertyFormWidget::VPropertyFormWidget(const QString &title, const QString &description,
VPropertyFormWidget::VPropertyFormWidget(const QString &title, const QString &description,
const QList<VProperty*>& properties, QWidget *parent) const QList<VProperty*>& properties, QWidget *parent)
: QGroupBox(title, parent), d_ptr(new VPropertyFormWidgetPrivate(properties)) : QGroupBox(title, parent), d_ptr(new VPropertyFormWidgetPrivate(properties))
{ {
@ -49,7 +47,7 @@ VPropertyFormWidget::VPropertyFormWidget(const QString &title, const QString &de
setWhatsThis(description); setWhatsThis(description);
} }
VPropertyFormWidget::VPropertyFormWidget(VProperty *parent_property, QWidget *parent) VPE::VPropertyFormWidget::VPropertyFormWidget(VProperty *parent_property, QWidget *parent)
: QGroupBox(parent), d_ptr(new VPropertyFormWidgetPrivate()) : QGroupBox(parent), d_ptr(new VPropertyFormWidgetPrivate())
{ {
if (parent_property) if (parent_property)
@ -62,8 +60,8 @@ VPropertyFormWidget::VPropertyFormWidget(VProperty *parent_property, QWidget *pa
} }
} }
VPropertyFormWidget::VPropertyFormWidget(VPropertyFormWidgetPrivate *d_pointer, QWidget *parent, const QString &title, VPE::VPropertyFormWidget::VPropertyFormWidget(VPropertyFormWidgetPrivate *d_pointer, QWidget *parent,
const QString &description) const QString &title, const QString &description)
: QGroupBox(title, parent), d_ptr(d_pointer) : QGroupBox(title, parent), d_ptr(d_pointer)
{ {
build(); build();
@ -71,13 +69,13 @@ VPropertyFormWidget::VPropertyFormWidget(VPropertyFormWidgetPrivate *d_pointer,
setWhatsThis(description); setWhatsThis(description);
} }
VPropertyFormWidget::~VPropertyFormWidget() VPE::VPropertyFormWidget::~VPropertyFormWidget()
{ {
delete d_ptr; delete d_ptr;
} }
void VPropertyFormWidget::build() void VPE::VPropertyFormWidget::build()
{ {
// Clear the old content, delete old widgets // Clear the old content, delete old widgets
d_ptr->EditorWidgets.clear(); d_ptr->EditorWidgets.clear();
@ -160,7 +158,7 @@ void VPropertyFormWidget::build()
} }
} }
void VPropertyFormWidget::buildEditor(VProperty* property, QFormLayout* formLayout, Property type) void VPE::VPropertyFormWidget::buildEditor(VProperty* property, QFormLayout* formLayout, Property type)
{ {
// Add property (no child properties) // Add property (no child properties)
// Create the editor (if it doesn't work, create empty widget) // Create the editor (if it doesn't work, create empty widget)
@ -194,7 +192,7 @@ void VPropertyFormWidget::buildEditor(VProperty* property, QFormLayout* formLayo
d_ptr->EditorWidgets.append(VPropertyFormWidgetPrivate::SEditorWidget(tmpEditor)); d_ptr->EditorWidgets.append(VPropertyFormWidgetPrivate::SEditorWidget(tmpEditor));
} }
void VPropertyFormWidget::commitData() void VPE::VPropertyFormWidget::commitData()
{ {
for (int i = 0; i < d_ptr->Properties.count(); ++i) for (int i = 0; i < d_ptr->Properties.count(); ++i)
{ {
@ -202,7 +200,7 @@ void VPropertyFormWidget::commitData()
} }
} }
void VPropertyFormWidget::loadData() void VPE::VPropertyFormWidget::loadData()
{ {
for (int i = 0; i < d_ptr->Properties.count(); ++i) for (int i = 0; i < d_ptr->Properties.count(); ++i)
{ {
@ -210,7 +208,7 @@ void VPropertyFormWidget::loadData()
} }
} }
void VPropertyFormWidget::commitData(int row) void VPE::VPropertyFormWidget::commitData(int row)
{ {
if (row < 0 || row >= d_ptr->EditorWidgets.count() || row >= d_ptr->Properties.count()) if (row < 0 || row >= d_ptr->EditorWidgets.count() || row >= d_ptr->Properties.count())
{ {
@ -230,7 +228,7 @@ void VPropertyFormWidget::commitData(int row)
if (oldValue != newValue) if (oldValue != newValue)
{ {
VProperty *parent = tmpProperty->getParent(); VProperty *parent = tmpProperty->getParent();
if (parent == nullptr) if (parent == nullptr || parent->propertyType() != Property::Complex)
{ {
tmpProperty->setValue(newValue); tmpProperty->setValue(newValue);
emit propertyDataSubmitted(tmpProperty); emit propertyDataSubmitted(tmpProperty);
@ -240,16 +238,11 @@ void VPropertyFormWidget::commitData(int row)
tmpProperty->UpdateParent(newValue); tmpProperty->UpdateParent(newValue);
emit propertyDataSubmitted(parent); emit propertyDataSubmitted(parent);
} }
else
{
tmpProperty->setValue(newValue);
emit propertyDataSubmitted(tmpProperty);
}
} }
} }
} }
void VPropertyFormWidget::loadData(int row) void VPE::VPropertyFormWidget::loadData(int row)
{ {
if (row < 0 || row >= d_ptr->EditorWidgets.count() || row >= d_ptr->Properties.count()) if (row < 0 || row >= d_ptr->EditorWidgets.count() || row >= d_ptr->Properties.count())
{ {
@ -268,7 +261,7 @@ void VPropertyFormWidget::loadData(int row)
} }
} }
void VPropertyFormWidget::setCommitBehaviour(bool auto_commit) void VPE::VPropertyFormWidget::setCommitBehaviour(bool auto_commit)
{ {
d_ptr->UpdateEditors = auto_commit; d_ptr->UpdateEditors = auto_commit;
@ -282,7 +275,7 @@ void VPropertyFormWidget::setCommitBehaviour(bool auto_commit)
} }
} }
QList<VPropertyFormWidget *> VPropertyFormWidget::getChildPropertyFormWidgets() const QList<VPE::VPropertyFormWidget *> VPE::VPropertyFormWidget::getChildPropertyFormWidgets() const
{ {
QList<VPropertyFormWidget *> tmpResult; QList<VPropertyFormWidget *> tmpResult;
foreach(const VPropertyFormWidgetPrivate::SEditorWidget& tmpEditorWidget, d_ptr->EditorWidgets) foreach(const VPropertyFormWidgetPrivate::SEditorWidget& tmpEditorWidget, d_ptr->EditorWidgets)
@ -296,7 +289,7 @@ QList<VPropertyFormWidget *> VPropertyFormWidget::getChildPropertyFormWidgets()
return tmpResult; return tmpResult;
} }
bool VPropertyFormWidget::eventFilter(QObject *object, QEvent *event) bool VPE::VPropertyFormWidget::eventFilter(QObject *object, QEvent *event)
{ {
if (!d_ptr->UpdateEditors) if (!d_ptr->UpdateEditors)
{ {
@ -354,7 +347,7 @@ bool VPropertyFormWidget::eventFilter(QObject *object, QEvent *event)
return false; return false;
} }
void VPropertyFormWidget::commitData(const QWidget *editor) void VPE::VPropertyFormWidget::commitData(const QWidget *editor)
{ {
if (!editor) if (!editor)
{ {

View File

@ -25,29 +25,27 @@
#include "vproperty.h" #include "vproperty.h"
#include "vpropertyset.h" #include "vpropertyset.h"
using namespace VPE;
#include "vpropertymodel_p.h" #include "vpropertymodel_p.h"
VPropertyModel::VPropertyModel(VPropertyModelPrivate *d, QObject *parent) VPE::VPropertyModel::VPropertyModel(VPropertyModelPrivate *d, QObject *parent)
: QAbstractItemModel(parent), d_ptr(d) : QAbstractItemModel(parent), d_ptr(d)
{ {
} }
VPropertyModel::VPropertyModel(QObject * parent) : VPE::VPropertyModel::VPropertyModel(QObject * parent) :
QAbstractItemModel(parent), d_ptr(new VPropertyModelPrivate()) QAbstractItemModel(parent), d_ptr(new VPropertyModelPrivate())
{ {
} }
VPropertyModel::~VPropertyModel() VPE::VPropertyModel::~VPropertyModel()
{ {
delete d_ptr->Properties; delete d_ptr->Properties;
delete d_ptr; delete d_ptr;
} }
//! Adds the property to the model and attaches it to the parentid //! Adds the property to the model and attaches it to the parentid
bool VPropertyModel::addProperty(VProperty* property, const QString& id, const QString &parentid, bool emitsignals) bool VPE::VPropertyModel::addProperty(VProperty* property, const QString& id, const QString &parentid, bool emitsignals)
{ {
if (!property) if (!property)
{ {
@ -78,8 +76,8 @@ bool VPropertyModel::addProperty(VProperty* property, const QString& id, const Q
} }
//! Creates a property and adds it to the model //! Creates a property and adds it to the model
VProperty* VPropertyModel::createProperty(const QString& id, const QString& name, const QString& parentid, VPE::VProperty* VPE::VPropertyModel::createProperty(const QString& id, const QString& name, const QString& parentid,
const QVariant& data) const QVariant& data)
{ {
VProperty* tmpProp = new VProperty(name); VProperty* tmpProp = new VProperty(name);
tmpProp->setValue(data); tmpProp->setValue(data);
@ -92,13 +90,13 @@ VProperty* VPropertyModel::createProperty(const QString& id, const QString& name
} }
//! Gets a property by it's ID //! Gets a property by it's ID
VProperty* VPropertyModel::getProperty(const QString& id) VPE::VProperty* VPE::VPropertyModel::getProperty(const QString& id)
{ {
return d_ptr->Properties != nullptr ? d_ptr->Properties->getProperty(id) : nullptr; return d_ptr->Properties != nullptr ? d_ptr->Properties->getProperty(id) : nullptr;
} }
//! Returns the model index at row/column //! Returns the model index at row/column
QModelIndex VPropertyModel::index(int row, int column, const QModelIndex& parent) const QModelIndex VPE::VPropertyModel::index(int row, int column, const QModelIndex& parent) const
{ {
if (d_ptr->Properties == nullptr || (parent.isValid() && parent.column() > 1)) if (d_ptr->Properties == nullptr || (parent.isValid() && parent.column() > 1))
{ {
@ -127,7 +125,7 @@ QModelIndex VPropertyModel::index(int row, int column, const QModelIndex& parent
} }
//! Returns the parent of one model index //! Returns the parent of one model index
QModelIndex VPropertyModel::parent ( const QModelIndex & index ) const QModelIndex VPE::VPropertyModel::parent ( const QModelIndex & index ) const
{ {
if (!index.isValid()) if (!index.isValid())
{ {
@ -155,7 +153,7 @@ QModelIndex VPropertyModel::parent ( const QModelIndex & index ) const
} }
//! Returns the item flags for the given index //! Returns the item flags for the given index
Qt::ItemFlags VPropertyModel::flags (const QModelIndex& index) const Qt::ItemFlags VPE::VPropertyModel::flags (const QModelIndex& index) const
{ {
VProperty* tmpProperty = getProperty(index); VProperty* tmpProperty = getProperty(index);
if (!tmpProperty) if (!tmpProperty)
@ -167,7 +165,7 @@ Qt::ItemFlags VPropertyModel::flags (const QModelIndex& index) const
} }
//! Sets the role data for the item at index to value //! Sets the role data for the item at index to value
bool VPropertyModel::setData (const QModelIndex& index, const QVariant& value, int role) bool VPE::VPropertyModel::setData (const QModelIndex& index, const QVariant& value, int role)
{ {
VProperty* tmpProperty = getProperty(index); VProperty* tmpProperty = getProperty(index);
if (index.column() == 1 && tmpProperty) if (index.column() == 1 && tmpProperty)
@ -191,7 +189,7 @@ bool VPropertyModel::setData (const QModelIndex& index, const QVariant& value, i
//! Returns the data of an model index //! Returns the data of an model index
QVariant VPropertyModel::data ( const QModelIndex & index, int role ) const QVariant VPE::VPropertyModel::data ( const QModelIndex & index, int role ) const
{ {
VProperty* tmpProperty = getProperty(index); VProperty* tmpProperty = getProperty(index);
if (!tmpProperty) if (!tmpProperty)
@ -203,7 +201,7 @@ QVariant VPropertyModel::data ( const QModelIndex & index, int role ) const
} }
QVariant VPropertyModel::headerData (int section, Qt::Orientation orientation, int role) const QVariant VPE::VPropertyModel::headerData (int section, Qt::Orientation orientation, int role) const
{ {
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
{ {
@ -227,7 +225,7 @@ QVariant VPropertyModel::headerData (int section, Qt::Orientation orientation, i
//! Returns the number of rows //! Returns the number of rows
int VPropertyModel::rowCount ( const QModelIndex & parent ) const int VPE::VPropertyModel::rowCount ( const QModelIndex & parent ) const
{ {
if (parent.isValid()) if (parent.isValid())
{ {
@ -249,15 +247,15 @@ int VPropertyModel::rowCount ( const QModelIndex & parent ) const
//! Returns the number of columns //! Returns the number of columns
int VPropertyModel::columnCount ( const QModelIndex & parent) const int VPE::VPropertyModel::columnCount ( const QModelIndex & parent) const
{ {
Q_UNUSED(parent); Q_UNUSED(parent)
return 2; return 2;
} }
//! Gets a property by its ModelIndex //! Gets a property by its ModelIndex
VProperty* VPropertyModel::getProperty(const QModelIndex &index) const VPE::VProperty* VPE::VPropertyModel::getProperty(const QModelIndex &index) const
{ {
if (index.isValid()) if (index.isValid())
{ {
@ -271,12 +269,12 @@ VProperty* VPropertyModel::getProperty(const QModelIndex &index) const
return nullptr; return nullptr;
} }
QString VPropertyModel::getPropertyID(const VProperty *prop) const QString VPE::VPropertyModel::getPropertyID(const VProperty *prop) const
{ {
return d_ptr->Properties != nullptr ? d_ptr->Properties->getPropertyID(prop) : QString(); return d_ptr->Properties != nullptr ? d_ptr->Properties->getPropertyID(prop) : QString();
} }
QModelIndex VPropertyModel::getIndexFromProperty(VProperty* property, int column) const QModelIndex VPE::VPropertyModel::getIndexFromProperty(VProperty* property, int column) const
{ {
if (!property || column > columnCount() || column < 0) if (!property || column > columnCount() || column < 0)
{ {
@ -295,7 +293,7 @@ QModelIndex VPropertyModel::getIndexFromProperty(VProperty* property, int column
} }
void VPropertyModel::onDataChangedByModel(VProperty* property) void VPE::VPropertyModel::onDataChangedByModel(VProperty* property)
{ {
QModelIndex tmpIndex = getIndexFromProperty(property, 1); QModelIndex tmpIndex = getIndexFromProperty(property, 1);
if (tmpIndex.isValid()) if (tmpIndex.isValid())
@ -305,17 +303,17 @@ void VPropertyModel::onDataChangedByModel(VProperty* property)
} }
} }
const VPropertySet *VPropertyModel::getPropertySet() const const VPE::VPropertySet *VPE::VPropertyModel::getPropertySet() const
{ {
return d_ptr->Properties; return d_ptr->Properties;
} }
void VPropertyModel::clear(bool emit_signals) void VPE::VPropertyModel::clear(bool emit_signals)
{ {
setPropertySet(nullptr, emit_signals); setPropertySet(nullptr, emit_signals);
} }
VPropertySet *VPropertyModel::takePropertySet(VPropertySet *new_property_set, bool emit_signals) VPE::VPropertySet *VPE::VPropertyModel::takePropertySet(VPropertySet *new_property_set, bool emit_signals)
{ {
VPropertySet* tmpOldPropertySet = d_ptr->Properties; VPropertySet* tmpOldPropertySet = d_ptr->Properties;
@ -332,13 +330,13 @@ VPropertySet *VPropertyModel::takePropertySet(VPropertySet *new_property_set, bo
return tmpOldPropertySet; return tmpOldPropertySet;
} }
void VPropertyModel::setPropertySet(VPropertySet *property_set, bool emit_signals) void VPE::VPropertyModel::setPropertySet(VPropertySet *property_set, bool emit_signals)
{ {
VPropertySet* tmpOldPropertySet = takePropertySet(property_set, emit_signals); VPropertySet* tmpOldPropertySet = takePropertySet(property_set, emit_signals);
delete tmpOldPropertySet; delete tmpOldPropertySet;
} }
VProperty *VPropertyModel::takeProperty(const QString &id) VPE::VProperty *VPE::VPropertyModel::takeProperty(const QString &id)
{ {
QModelIndex tmpIndex = getIndexFromProperty(getProperty(id)); QModelIndex tmpIndex = getIndexFromProperty(getProperty(id));
if (d_ptr->Properties && tmpIndex.isValid()) if (d_ptr->Properties && tmpIndex.isValid())
@ -352,7 +350,7 @@ VProperty *VPropertyModel::takeProperty(const QString &id)
return nullptr; return nullptr;
} }
void VPropertyModel::removeProperty(const QString &id) void VPE::VPropertyModel::removeProperty(const QString &id)
{ {
QModelIndex tmpIndex = getIndexFromProperty(getProperty(id)); QModelIndex tmpIndex = getIndexFromProperty(getProperty(id));
if (d_ptr->Properties && tmpIndex.isValid()) if (d_ptr->Properties && tmpIndex.isValid())

View File

@ -25,19 +25,17 @@
#include <QList> #include <QList>
#include <QMap> #include <QMap>
using namespace VPE;
#include "vproperty.h" #include "vproperty.h"
#include "vpropertyset_p.h" #include "vpropertyset_p.h"
VPropertySet::VPropertySet() VPE::VPropertySet::VPropertySet()
: d_ptr(new VPropertySetPrivate()) : d_ptr(new VPropertySetPrivate())
{ {
} }
VPropertySet::~VPropertySet() VPE::VPropertySet::~VPropertySet()
{ {
// Delete all the properties // Delete all the properties
clear(true); clear(true);
@ -45,7 +43,7 @@ VPropertySet::~VPropertySet()
delete d_ptr; delete d_ptr;
} }
bool VPropertySet::addProperty(VProperty *property, const QString &id, const QString &parentid) bool VPE::VPropertySet::addProperty(VProperty *property, const QString &id, const QString &parentid)
{ {
// Check if the property to add is not a null pointer // Check if the property to add is not a null pointer
if (!property) if (!property)
@ -57,7 +55,7 @@ bool VPropertySet::addProperty(VProperty *property, const QString &id, const QSt
return addProperty(property, id, tmpParent); return addProperty(property, id, tmpParent);
} }
bool VPropertySet::addProperty(VProperty *property, const QString &id, VProperty *parent_property) bool VPE::VPropertySet::addProperty(VProperty *property, const QString &id, VProperty *parent_property)
{ {
// Check if the property to add is not a null pointer // Check if the property to add is not a null pointer
if (!property) if (!property)
@ -92,7 +90,7 @@ bool VPropertySet::addProperty(VProperty *property, const QString &id, VProperty
return true; return true;
} }
bool VPropertySet::hasProperty(VProperty *property) const bool VPE::VPropertySet::hasProperty(VProperty *property) const
{ {
if (!property) if (!property)
{ {
@ -102,12 +100,12 @@ bool VPropertySet::hasProperty(VProperty *property) const
return hasProperty(property, NULL); return hasProperty(property, NULL);
} }
VProperty *VPropertySet::getProperty(const QString &id) const VPE::VProperty *VPE::VPropertySet::getProperty(const QString &id) const
{ {
return d_ptr->Properties.value(id, NULL); return d_ptr->Properties.value(id, NULL);
} }
VProperty *VPropertySet::takeProperty(const QString &id) VPE::VProperty *VPE::VPropertySet::takeProperty(const QString &id)
{ {
VProperty* tmpProp = getProperty(id); VProperty* tmpProp = getProperty(id);
removeProperty(tmpProp, false); removeProperty(tmpProp, false);
@ -116,35 +114,32 @@ VProperty *VPropertySet::takeProperty(const QString &id)
return tmpProp; return tmpProp;
} }
void VPropertySet::removeProperty(const QString &id) void VPE::VPropertySet::removeProperty(const QString &id)
{ {
VProperty* tmpProp = takeProperty(id); VProperty* tmpProp = takeProperty(id);
delete tmpProp; delete tmpProp;
} }
void VPropertySet::removeProperty(VProperty* prop, bool delete_property) void VPE::VPropertySet::removeProperty(VProperty* prop, bool delete_property)
{ {
// Remove all the children // Remove all the children
removePropertyFromSet(prop); removePropertyFromSet(prop);
// Remove from parent and optionally delete // Remove from parent and optionally delete
if (prop) prop->setParent(NULL);
{
prop->setParent(NULL);
if (delete_property) if (delete_property)
{ {
delete prop; delete prop;
}
} }
} }
int VPropertySet::count() const int VPE::VPropertySet::count() const
{ {
return d_ptr->Properties.count(); return d_ptr->Properties.count();
} }
void VPropertySet::clear(bool delete_properties) void VPE::VPropertySet::clear(bool delete_properties)
{ {
d_ptr->Properties.clear(); d_ptr->Properties.clear();
while (!d_ptr->RootProperties.isEmpty()) while (!d_ptr->RootProperties.isEmpty())
@ -157,7 +152,7 @@ void VPropertySet::clear(bool delete_properties)
} }
} }
QString VPropertySet::getPropertyID(const VProperty *prop, bool look_for_parent_id) const QString VPE::VPropertySet::getPropertyID(const VProperty *prop, bool look_for_parent_id) const
{ {
QString tmpResult; QString tmpResult;
const VProperty* tmpCurrentProp = prop; const VProperty* tmpCurrentProp = prop;
@ -185,27 +180,27 @@ QString VPropertySet::getPropertyID(const VProperty *prop, bool look_for_parent_
} }
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
const QMap<QString, VProperty *> &VPropertySet::getPropertiesMap() const const QMap<QString, VPE::VProperty *> &VPE::VPropertySet::getPropertiesMap() const
{ {
return d_ptr->Properties; return d_ptr->Properties;
} }
const QList<VProperty *> &VPropertySet::getRootProperties() const const QList<VPE::VProperty *> &VPE::VPropertySet::getRootProperties() const
{ {
return d_ptr->RootProperties; return d_ptr->RootProperties;
} }
VProperty *VPropertySet::getRootProperty(int row) const VPE::VProperty *VPE::VPropertySet::getRootProperty(int row) const
{ {
return d_ptr->RootProperties.value(row, NULL); return d_ptr->RootProperties.value(row, NULL);
} }
int VPropertySet::getRootPropertyCount() const int VPE::VPropertySet::getRootPropertyCount() const
{ {
return d_ptr->RootProperties.count(); return d_ptr->RootProperties.count();
} }
VPropertySet* VPropertySet::clone() const VPE::VPropertySet* VPE::VPropertySet::clone() const
{ {
VPropertySet* tmpResult = new VPropertySet(); VPropertySet* tmpResult = new VPropertySet();
@ -216,7 +211,7 @@ VPropertySet* VPropertySet::clone() const
return tmpResult; return tmpResult;
} }
bool VPropertySet::hasProperty(VProperty *property, VProperty *parent) const bool VPE::VPropertySet::hasProperty(VProperty *property, VProperty *parent) const
{ {
if (!property) if (!property)
{ {
@ -239,8 +234,8 @@ bool VPropertySet::hasProperty(VProperty *property, VProperty *parent) const
return false; return false;
} }
void VPropertySet::cloneProperty(VProperty* property_to_clone, VProperty *parent_property, void VPE::VPropertySet::cloneProperty(VProperty* property_to_clone, VProperty *parent_property,
VPropertySet *output_set) const VPropertySet *output_set) const
{ {
if (!output_set || !property_to_clone || !hasProperty(property_to_clone)) if (!output_set || !property_to_clone || !hasProperty(property_to_clone))
{ {
@ -259,7 +254,7 @@ void VPropertySet::cloneProperty(VProperty* property_to_clone, VProperty *parent
} }
} }
void VPropertySet::removePropertyFromSet(VProperty *prop) void VPE::VPropertySet::removePropertyFromSet(VProperty *prop)
{ {
// Remove all the children // Remove all the children
foreach(VProperty* tmpChild, prop->getChildren()) foreach(VProperty* tmpChild, prop->getChildren())

Some files were not shown because too many files have changed in this diff Show More