From b26eca13ebda7ce6a37b2b94296d480a05f0e0c8 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 28 Jan 2017 16:58:07 +0200 Subject: [PATCH 01/52] Optimized png files. --HG-- branch : feature --- .../share/resources/cursor/el_arc_cursor.png | Bin 473 -> 461 bytes .../resources/cursor/el_arc_cursor@2x.png | Bin 964 -> 946 bytes .../resources/cursor/flipping_axis_cursor.png | Bin 700 -> 615 bytes .../cursor/flipping_axis_cursor@2x.png | Bin 1610 -> 1441 bytes .../resources/cursor/flipping_line_cursor.png | Bin 618 -> 504 bytes .../cursor/flipping_line_cursor@2x.png | Bin 1279 -> 1153 bytes .../share/resources/cursor/move_cursor.png | Bin 553 -> 447 bytes .../share/resources/cursor/move_cursor@2x.png | Bin 1104 -> 963 bytes .../share/resources/cursor/path_cursor.png | Bin 572 -> 461 bytes .../share/resources/cursor/path_cursor@2x.png | Bin 1218 -> 1028 bytes .../share/resources/toolicon/32x32/el_arc.png | Bin 579 -> 565 bytes .../resources/toolicon/32x32/el_arc@2x.png | Bin 1178 -> 1152 bytes .../toolicon/32x32/flipping_axis.png | Bin 1050 -> 938 bytes .../toolicon/32x32/flipping_axis@2x.png | Bin 2310 -> 1990 bytes .../toolicon/32x32/flipping_line.png | Bin 1156 -> 1001 bytes .../toolicon/32x32/flipping_line@2x.png | Bin 2553 -> 1930 bytes .../share/resources/toolicon/32x32/move.png | Bin 619 -> 519 bytes .../resources/toolicon/32x32/move@2x.png | Bin 1152 -> 963 bytes .../share/resources/toolicon/32x32/path.png | Bin 752 -> 611 bytes .../resources/toolicon/32x32/path@2x.png | Bin 1626 -> 1334 bytes .../resources/icon/16x16/toolsectionelarc.png | Bin 305 -> 305 bytes .../icon/16x16/toolsectionelarc@2x.png | Bin 736 -> 733 bytes .../resources/icon/32x32/arrow_cursor.png | Bin 514 -> 270 bytes .../resources/icon/32x32/arrow_cursor@2x.png | Bin 668 -> 444 bytes 24 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/app/valentina/share/resources/cursor/el_arc_cursor.png b/src/app/valentina/share/resources/cursor/el_arc_cursor.png index 03b9d0ef50a234261c5fe5c51335d85e5fbd12af..fb8107db42b209cb8e645d58cb8d87690e6c2bba 100644 GIT binary patch delta 435 zcmV;k0Zjhc1I+`FB!84iL_t(o!|m6*F9bmx!13=T9y@aqk48kJ)zA=?5QPGTXe2Ze zl8Z{AlBh(jQRuW0u!+5=>UP!)ho5Pm@F2sZ$bDxwquNPi9S6Cf4DTMagjHz$Cx7clog9r!E)DgrwfM$;P zPJ#ny;)rh~I)LhqAjbhjJK`rRgZ>{*hVcJf3|{*g7+A2W`F~2L18_P5D8cxLiy`GN zC&PXq?)$^dkno?Ip%UnjeLy)bboE~-Z~%rQfCAzmi~n#iBx98MTny$_#HHy2R8tL=q8il1PX}T~XwY-~<6_ti z%o&onG+YPbD4Ml+xfnM5<`|eJKO->Mm;Yg72%@{qus9SCOmyCKw;UMUwxFW;7bk-` p-7N=}^8rB1C%|+1`002ovPDHLkV1mL8!j}L5 diff --git a/src/app/valentina/share/resources/cursor/el_arc_cursor@2x.png b/src/app/valentina/share/resources/cursor/el_arc_cursor@2x.png index 32949c8e22c18f577418fe20cafedb5ceb69dcac..f1df3d2094998b342fd4a6567052621072b69d00 100644 GIT binary patch delta 924 zcmV;N17rNe2eJo{B!78HL_t(|+U?s-h!jT@!14d;%xrhPRaOs*2LlojKMo2Jy(mf! ziMiyEvlxgs@#NKmdQnycuY!jhHX?{0XGKs@5TYbvlpvC5vPt|{b#--jXLhPydvFp~ zGdtZqJ2TxqJr5cNrlzajud1u6p$2- z$PB{kHUeY<;eS<|0aB0934l~1jCBYgwFoae2#`vIP6MP4;Y9)fEkl?tvdMWIal#MQ zaM2mgIK#m)7>s(4=LrEcjqo=ZXEB3dV;cqs1LzADv(OE2(iYhpcdl^# z919i@+=Wu3a!*qP@E^kHR*66t)- zsh|g7UVqjAuC-!=qrz3^aXGA9T!4R1lw2mpW~0+lTLsEi_%^KUKTY(|_dqet@A%eZ zw+dQ@Pg@C~5WWVd0>JQ-HQbK4vy7B{8Q7UnK8t{DQAb?`)~cY@0$)Ta|5t?MU(_0q zL>!vYj!9rk=f3_xBHL$&Uj&vX=Z6D5&t% z8h;)>0cqwQ!@%#rdNLT!@JNM;H+lT8gEiby!IoiVz3=DpCYkzS?+ibypcPn?t6m?4 z1=cX4f|mPPm8;|{CDy56)i5=Z{2rxqaRBBykNqmB74A2))MdNZ2e_evbNvkEYREf} y6Dm0Mc~JG(p0`!5uPU6jKKpVtcTw2#W#$0u4bFKwu%HZ2$-)gaw-b0tdkffIvY= zIRp?G2=f&H2n2*m0Z0#F&IJHcLzs05fV2?Y1Ry1Z8J7V_2VuGj0HlIYEdbI$_*F#! zQb71wWdOd1P=5;mzJ@SWBLKdIFj+$YzJyR~0KS7T;Q;{GAS{Nl+lb+^q2ZREz(XT} zF4A_&>!j#0#ytYy7{WIoK}KHEHB6ftOwu{p?l&57pFj-I=Zu-a9KqS+cL25^^Z{Wb zj*h(125om{LO4`pannN4@QTLh=?J!29e2!Q074KlQGXmIgHq&KokQHps5d}_#*R>W z+_W0|!v_G$LeOJ4!Coh?KBA^&m1wG%jd;NOJpn>809XQHYDY3jUo>P_qnUF1x*o<^ zyK{vR#g%LmvK$TN#*O+2z&{9M`x33$HiYPl=6PVPlL|p|#8nXh!#)GR`W$~Y8d#l{ zNCI$=Q-9zButGKf-EK5EWc*W_1Rq0-=)mf}0`1&Qi#DeujA5BYU{^?-z}_G_aMuPhH|ck?~&z zjGxF~fERMH;5zsz)?UlmKY?D#{c)?=UlhOx(tph!8NaE>^-Pv+nSmoY@5gXJ^dv)N zjPHTBFHP<&a!qNA+#fdMcm^B&!(sG$+U48wMXqw?jgqlJ|*kiOs0^UkCDfKj%GlXd8?DUdc+* z_hC<-f64WpX2vZ_d3_9MBF_)y7CO;fqoj`T9bOK3TIQyPyzfzJC*0E;F`Uoc7}fC3 zNvV_D>y7BiJqL*98Z>o;ync-hr{4ZOEhlc;RI73g+}rDMoKq^~>r!R;4HPFr2%sd0LIFibOe_LWRK#Kdb0O+ch5A56(7d6PfLufc-s2Fi z^xM-IG!FzV^|^~?W;}-_CRm3@5pe)J<2%P{B!Q%caArQhTovLSkuTylI%XugePnvb z&xV{e7fN6f{eNgilILd^PU5BPUwluE$`n5^#lfb06Bt7u_Qw6px7zR;gR!ZL{nCUa zC3MGh76gpoRqXs*0gGqQiM#Q6H^wjMJ3Vf)U)0F%B0vh&!+q&*OHS z!|7h5m$E-s4Ul|b^|84U7{d)*%I%flX#${Yx z8Z*h0XD@1-bFwLYcYz=-%U(5sGB0ZWq68J dDWQ_^;19wqCUV}#Z2ABI002ovPDHLkV1k>Y2#Wv! delta 677 zcmV;W0$Tm&1iS^1BYyw{b3#c}2nYxWdB-EU?=NClA)xM%)bfH#VpoM`! zK}4jBG}F@Wv^d|O4BE`tjI-&5f$sw6ea`QkGc)|J>H37uS^@$_Yl%oR#0ZYm5>PY5 zOh8Q#Qw4wpN6ZFTP{dq-1w%~!1+XB9Vt}e6N&!?A@w-Go)ez+Xs)8sNP;tbsc>pSk zm@i;1L<<(9C4W#Cw6Crvpb$}qH`s@ZLw2+U?ZZJwOJUR8jO$QLSfrZqAVciI)@;o2 zMoA!PB%JsgV6F<{cSNa(8#rw`(M@CV-EW)>1wD%;Fo_|wBPsE-4M*`z{E6>xRG;E2 zrr5h>Ek{1S}et{CHJ8O>ocHsFc49H(%6z|ZsX_2OZYw=6p}8-N)5Rh$$5 zACz0C(I;-W9IoMdr>4sYj3l^4u4gvD2VB4<^E;9a=*FGwKEX$9yrT8}^q9>LNp}UE z%L@TpaDQ_ijq}wmPGTUt&xxm?x6z_BJ{nIFkH$$JGtpHD_}A*e?W`#=fq;%|BLyas z%yye_rjmdqIEelk&+-X;Ymy7`6trc4H7~I$*uSz;fZcd1ZsPoy`2@bFeq`%Ek_!&k z^R5nkq{r$j1XwF3@HzwJumV4^?u%cOt(vC@uO1kkVrfdKC*1o3!Yn3o{{%0=00000 LNkvXXu0mjfxC1Sx diff --git a/src/app/valentina/share/resources/cursor/flipping_axis_cursor@2x.png b/src/app/valentina/share/resources/cursor/flipping_axis_cursor@2x.png index 2c080a51a8899033a1de945d94a97ef8240ba1c8..c3df5a641c3f0483ff2142244cc29dc8baddcd8c 100644 GIT binary patch delta 1424 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 VJB7RnlQaMT002ovPDHLkV1fxS+~xoP delta 594 zcmV-Y0ZXeL4T}l5YQ1KXaH<#(k2ow(}OMc`5F6=Mp&&8Ho5+WVtuDklg`R0h~MgC zivW0lH{w65{wU)B^2p#>{X<1-hjSU9Fx*DrTJBgoy0zr+6lX9qZp-QQhII+=a7w&S zOd?~ribvQ}mVYrIJRH_FsC|MZJjP^##WT2p8H}&W&wmdHGbn@&4U4#iv*L-DM0VpQ z9wN6aH^AVf2~YHMQa(s-D>fp zi*mDR;X!842i{kr>LhLa1W9Eprg0CG-(}yXg%fPM7{t5p-)VJmX*Uaaj+0+xUk*u~ zAesuiE=xBy>=qz}YhUfXzEkQrg>#HVk^L!(0V@GRA*G<%Vv$5HZ#TH(hwLuG0+mvH gJE%?W>N$Az3uihFuz*v%BLDyZ07*qoM6N<$f(}Oh(f|Me diff --git a/src/app/valentina/share/resources/cursor/flipping_line_cursor@2x.png b/src/app/valentina/share/resources/cursor/flipping_line_cursor@2x.png index 7468a233ccdded6d856bfc407abc043395747a05..4f25f7bab00ffbcb620b7158e045d938bad3887b 100644 GIT binary patch delta 1133 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 T(PVA_015yANkvXXu0mjfG5hW* diff --git a/src/app/valentina/share/resources/cursor/move_cursor@2x.png b/src/app/valentina/share/resources/cursor/move_cursor@2x.png index 9feb3e5d8cc17584ac35cd187ccc14e6ac568274..adc87dbb11852f8d6822cc56384bdfe9b7c6d882 100644 GIT binary patch delta 942 zcmV;f15y0Y2*U@EBYy*mNkly6S3cNF$UeSbW@o?InLstFQH^T+ANPSLKucHwbh*6dPYY9dGp+d+i078S1F#!k#LNS2ABTSS45NL#Si2#8`umTWBgp@^qz#)h-00MpI zsKWrBNBCU<0Dn&-R0_be2)`-_;7Np$3Ili!!3_Y%5p;;?5R+TP?7Kf*0&of;l7fu_ z`UH#!7!=SOhb5{Vez*u=J35$*K)ca?!yW*z z1wn_HfU^n!Jq=5Z_8amDz_bx`hzdBSY5^(e@H)V>5r5LKI0a({00TPI8SV4kV*onv zxYQmWm4rK1?TN|9Vb?e`nbiX20^9%^94yf4f%Cuv;JtiWl`@O<2*u-06@z6Y zf75g#58`MXs@zBBgJ+07+nr zi({4;unc%^a*Y~r%Ibl?l#u)ou*&5@TP<(~^A#;Q;DFTwe=d^zYhb?1$=3k8D87~< z3+%KLpbwbsa`G{tM=@&E3R=Vju-@tkJ}HvFjDMnXs&EH*1mhX(jO_4w__x$AiK5;& zi;o5eKW_C=;y^@Yv6E2z@)u-r)BwDdpAVuK@s$dYF6SO{DESQ-Puyywol(0{MYK|L#-0k#qFXhZ!+jT~?|=m4##SEy!X z9T4cK2VR*By*mj(tOlOt-3pp~^|i?Z<0p`cL_~ImUBGr=GqBL=>nyAB7XvkkA4^DV QrT_o{07*qoM6N<$f(K%xvj6}9 delta 1084 zcmV-C1jGBo2ha$RBYyw{b3#c}2nYxWdGm4r?O42^_&oeLNW3FmYtVBjTW zAz+{-{3{y)11n)pb^-=cLe>HXPQpL37cfu~X5}MbU?k)zU?3#?EnfkJm++VT1r%CB zuLKlU!k>C4ppX*I>aBpnN$7`w+$AKG62|IBsnxlEbbnEaB1$MNa94%t3TG?KR5&)r z!Dbiy-s4K=Dq)^|^-3qJj#`C}6UNF}Wt1TYFf9WK38fN8aQV8QO1O1_eK7$^w;5+Z zRuam%ve|ECwii_Z*+@u)E*+zmgcxKS4RsYSA1q3);A@@p9KTzi9uipT`qv5`WKtZMX%`V@C5WJ&og-4MN}bv@2j9 z_jOyFE*Qg2_)_yS*6?DhL^>S=f5Scato`z4P8pBl#un!!!VOKu&syL4Z*f)HL^Ea_ z58HSzLlqCDO}v$WY3%H_^j$J0#P_kc)|$0@oR)A$+6;b*B%I)NZ0)-E-LVbNh_7HT z3x5ON5i48$=C$r3QGSdh{+#$DvzL_dwD{s}4Xw zKaN`od8>F+>&g!#d+>rV2+s*`d+!VH^;0-1JlEeagq1JjW$}&LZwtZKC3w=1{(EJY z=Bv`nxIeFq`yJdgXw2}$DC3&EGA@dMs&J=cBtq*LY9{cFco#UMI5A1C+=ef#yfw(w zgoWC><=9eFO%>%#Nf_-9;R+%2{aTm+?PQ*^E&c<0MvF22)ScA;0000(IKLM-gP z0^2l#jUp%n^a8Z8F?Rw}PvZ;I%rG<0 zH_QzG^EdA?RVN_gN1cf7Z^U<8tP@Zhq8CsLVk-lv9FYg86o1hVP#NOq06-;(?Es}C zb^<6BvAIJ)X^3F}r67g{6pq-~1)xyGZUKW3$s}`Ud3K&-Wdd>$(~L~;^(gTkPd1nw z1X%w^KrW)iY?JxtTuxaC%tsCl1LzKULErVOFftODOL-a@&5oxzi)~^Jr;EDjk)*@* zz^&~70dFx@^nZu*iM=VWB76D)+E~KAvi|+R!*-^)(6jj?8C}uoaATc`EFj=65+x^a zC*?$M-y2*}K_W?Dd5!(*NSj7rF;;NWxtn)*nKE9;f~Od5arGQCIm1bd+f5!UG2Y=? z%8Qgsg;g}gnd5Y4=zL){u=1yU;Ppwi#)yk7r_6pX`YmZsbFjg}1#W)haBus_krwwG eJZ^FzZ~iYT)G5JbmR;BY00004fF delta 548 zcmV+<0^9w~1H1%~BYyw{b3#c}2nYxWdz5~Y#sp6Q^Y|5 z-4MYPa}&J2#DD1`0hx%aL>0b|lFsvdlc{cijY9%55moL^vhaqR2`^$6QbzIsw&iQk zl}=BX62;6Vyh<5ppHDJ2+rk>ociJ>>Qi3`UVrKRN#Q2D@UKMZV3&#@PryS`7s9_O9 zy)NEN%##{pVar&$bFJeku4^1p3rWhSh~r_~c!Gzxt$%SoC@cX(X`{#fAryXXvv&@h7^?v~kBOOZ^_4F_k zlsMze?8S3t_75M-!~YxR|C{f8=R5zyL`=j)OvL}=0KUciW`6}pOXH_zMM(cMe!-$< z1GszzLes5;;VS@|ZY5j|ps5fpl>ulPgrN!mO@VMNfQCo7SOq{sBMepv(69)#05l{* zQX@daA%r>r8VaFafQCVcM*z?e2m>Po$UVYn0OT5>f0O`ni_kZU0J%gMZGhY%To?m@ zTp^qvBY@l>jDICSE)dR*F+k=K&W-~>rV+*qAhQT(#t|Ts2&cyxAae-U10Yife_tnn zx)9o!7qL0wodVBpV8%!R{<@9;wIWQ4c(;v#7KYmBi+BQ)@(fTlLL1WxoLE9SjdU58 z?_=M7R-{a=7oax-097HB08TC@on8b;pJ(_izs76}EPqMsSPeZH0jLIHQp8IIdRhqu zy58p1n2!?9l*W$0;#w|?ECE~-VJ$Nw?u~dRqH_~dQf3XYCh%q8V&G8BnrZ>MGX{|2 zP@TQKg$Zv31_DO|%c_~zm9gT7@L9bZTFT^v4S{1ZKPIdgD}X(ioyCWnl*uuh0)v5_ zDK}QiKYvw6@!K&a%g^{JGXnb(`V$_gl>285g%9Jo9QFG*2F?dQNh_?@Y5`(AoTqMY z%CwkWfe=_%F7IR&#rL2+k1ss}PnPzA*UIIbxJL0mtMYb|(aWGU(3`Nk9)Qm=SB|5f z1u?$|zABeA5uPcqieBa5Xd89K*?(j(nUppE)u)TM;H;R&ca36bFos4EF06;L-4az-woE+lli zIsr8=p%?;cT0)272&h>J=M_&tO-d-XfSQwVPVoiQl!SJr5l}M{N-3ZwB%D=R0aY*I zjM59JY6;~MP_+{NQ9c1xDdDv83aB~>l@L%d38@0x{(r`_atG4K&sd3LNe@`a^b8MU zUf{rVHt&erdWmQ#uq`A#xCGpSU6M;kWq7`ab=@>Il0O|Mzr|JLaY|)MVA$obkj6HS zv=SN#v*}&M&OOWtg+JW?kuI>Uk~82Emu5neH6ayTuI1ExR^G~vhz${~p>UaBrdkD% zK*CpCOn>p}3{K7`Kb;e;tZ!z2nnzRY@8Y$H8x0|%KYyuw2_!Cu6^zTWJj>%*maHWc zXz6BI#HSG#BKGE3mQ=urDoFajV{g*n`_swHJTFIdMjVWoo#eRVRgiH1(T$HsB0zkC zbe?-7{>br7o;jrw@IEGvG|*BKNat7^(G{^JFn?jN{f`-b@*9yUT?$uEpgCe^o{l{C z54P`7$rJCvQ>6^Nm~^r_qCH}J7-Y646_CS&C6Bs@1R8U^8xcj^#mKJ%PKqyAw-qzM zQj?-P#SU@acQUejfgiCNhl(3sdFbW4H0>$oQFsOn#%?TCqsc?yXrME29m6Yutym>) znSa$RIXe4FVLZtNY`{A415`Cl3oU2}@slt^-ZEamlX$blag~iGX7(~Z#0&YLi(m&H z!H4Avt{n6*FU=JEFwj14^}V^EY*CeoBeX3GUYU{a2k`tAmw4GH^&b$>x8GjnW=$VY4qOzr=E;yziaSd))7mJwN#(QlX&ho_)vPq6x zK|_{z7IE%2qAUlWV`-lIA~r>wk2u%&b8De{F)lzTvZ_e6MEvdm6rJRwV{lm>&?482z10{Zmsu0l22jf{bmq`s=JjyHGyl#l#yU6sg=>`_}kZIz~E}nUT zuao}nsu0l4<_1nR$BWsY?Yz+%KPam-ByBv_z(Wm83+$f7x5Me7{|oX}u4TnAmzV$m N002ovPDHLkV1l+GCV&6{ diff --git a/src/app/valentina/share/resources/toolicon/32x32/el_arc.png b/src/app/valentina/share/resources/toolicon/32x32/el_arc.png index d2af0b2c424bd98ad5fcb3a319aaaaad59ce7761..5e1c5f97345bf812e1ec85499fedabc19e484699 100644 GIT binary patch delta 541 zcmV+&0^Nkly)WS(tAC{d#(5=)dv}z4|n*dgdxRit@tHXOSRvMy;PS|Tz^Y-lwv=Z zQXQvwBQsC?ld#i@tEm?0>{^G+Je%qu#Ug|AZXMT)@Nw97La9DX z)xyMSgq;-Mq&mpVOO}-0o7s}kSyno`scxpYk*NorLV9myOG0NEnL3x^uoZh@+bLym zDOC#_PAU_RrhhtWgU`dv3Q~NU-Y1rk;(CfN!^8?gm*V#n&s#?3?hYGPl(`pEwanb> z-_VM$+Tf}+*~a6TI)QW^NYyg)lr?x2LGT+Ma~mnHwBqNmVMS*V1VM1qEo9R(saocq zv<43$2!i0yEwtjt3_c5IticYB5Cp+Bf1?!_QypjSE`MwEFs|Sb?_=sOr1xB^Mdn^G zws21?e$C)g*fgdvN%2!Fz7NINQe029AMP}^HrPwG$jp7l6ebybovNjCzcGcaR{W5v zW#+6grL&uAk>Viq#u7F%cqLV9#kXP8Skl=|^+l@V^ez}v2JfUg&fvSuJz-4YOe-#? f_j1_uUl#HQg8%pK*qG+n00000NkvXXu0mjfYD)_` delta 555 zcmV+`0@VGr1j7W7BYy%4NklUX{C|)01Ltc77FP`% z=D{N#=p)yo!a&;x`(g|z$vr6%LA4ri106i@mY^wDVjsaqxc8JQO#PI#Nx%u0b=t-< ze;4}pjbc%%1%$E%kCDZ$WNx50u)l>dkq_aj5geSkBk+ZkF^rn52v``;DgXk;34AXr zJAmZx&apA?rGFsTzf%Ye?loe**Xd~dsD2!*QiYYEPDixOtPAJ$Ex4m~1#>h}5=gSo z&*_o!8z}pe7R~zEVj7dG&T|W~i5B*GgQ`6Ctt!9=GbxpJLu>R=M+qu$t|FBcFTkJe z;!E&6v`h9TT2!#F{UCt*Z*qUa`@hDGIVu8((H`Ceuz&Xj_^kX&nkZIT&~>zg$9(3q zLS)0~l%HP{-TGfeKq=W@$<_`w6>dzR!A=i$6_HOIulZ@a+`n#Pi-+?JMoO1oL z+t`-(J%UQz;Q7q=vDa!V^nzzzNh#+2mVsD0S?5yne)%wUu&?#1d8{{NhqExES8^MZ t64=H8J0x7Q?qbW4z1>2e_U`uE;|YTQ_wL(lZ1eyC002ovPDHLkV1o6}7YYCX diff --git a/src/app/valentina/share/resources/toolicon/32x32/el_arc@2x.png b/src/app/valentina/share/resources/toolicon/32x32/el_arc@2x.png index e5c97ba7b984a3182e7380e1bf39406b2932729d..ea5de62861ae996c9e9adbbc7a4382ed77d0dbc4 100644 GIT binary patch delta 1131 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 delta 1029 zcmV+g1p51`2bu_wBYyw{b3#c}2nYxWdD6ho4}e|iKL=Qgf3yA!8h8drdU4w5aq`7@ zvIgL64FEhIjDHR-B)}tBp4uTBKZ)0B0G49&LIUipnWU6F;WD^lryisifDvrOr5b=x zu`P8Mus#^QWg!5@un6zh06ZWjTovG;nBY4W0-y}#-t?cZ`gY{23>DjX0p^qYlha>t zZEBy*^nc)^_Ux^{V;vYB3R(4aA%^iKtM4PFhvM%;w2@NG6xxz9~(#cmAD)?Hr|j(?BixPfI4T@64Px;+)! z8L`kz;!}K%qZl$P0#KCCcHD+e0L!rnm+@u|z%JaE*{{U5Ho&E1+uVVn#6mNb0bLT0<&*={d1976 zYD;q+z&%(kzT@w8062jScnkZn4&S&Efyct)O*pF97AM_qKNZuL8gqVtDt7 zNto#dulOxYOcC~{Ug^6dKm*%Tdrw7IeGTCiynm4OlWwZww-`_A?ZK9TTvG*DE7te# zaI6Dt4~1y)tUF=h#7TUOTlr~2H-Iuxs;ln=a0My!TO zLKlF>UQAIu8jLQh1K2E{coX=w2B0nnUc|GRNzx6@xt14>offb4ODGW8Fb}}+LGeDZHduK_?sP1*58%H(0KOE9 zQj#L+nzaChi3@~x67*Q^^y&29Dg4yuz!;v-`bjs_?b9r6L)Z~08saC{-S}Bdz)n&Z zf!$&vmh&gwOqXMR@(6y!owQar#bXpc!+r`}#QE%rbK=2M2e4HuETwkE}^darV(DIO-9vcW;|c2mky z?JE}?&f2e<9j!wYE85*KEq+0la-QO1ra$yQ)*S|RjCt~000000NkvXXu0mjf?NHoZ diff --git a/src/app/valentina/share/resources/toolicon/32x32/flipping_axis@2x.png b/src/app/valentina/share/resources/toolicon/32x32/flipping_axis@2x.png index 939dbe116df3223d73da4c9a4a01b8968abcbdf9..8f0fac50bc48d8bddf14b47c8fd80e1ae473857b 100644 GIT binary patch delta 1977 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 VI``^tJhA`)002ovPDHLkV1m7HNHPEb diff --git a/src/app/valentina/share/resources/toolicon/32x32/flipping_line.png b/src/app/valentina/share/resources/toolicon/32x32/flipping_line.png index 6f1224ab9522ab7d1ab53d5825bf704108d69719..0e9efd8b40412a799ed83a626f3e0fbcc9820e63 100644 GIT binary patch delta 980 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 k7{e8Oly!xbasU7T07*qoM6N<$g4*TgGynhq delta 595 zcmV-Z0<8Uq1nUHlBYyw{b3#c}2nYxWdI6+sxr z;pd!~i?LBi3N`V97c4A95D^;-QA7+Df~8hsVPhj&3HJU8X@3M$i3E&6@Pgo_&`1!$ zMnO;!6(o|7Y$ArS*bN+y=WN!To%6!5?0nzwduQjH8J0F^n!beLgzpJ63HN5%+YYus zZ^GMzP}k-b*cIKt9G4ovLqeG6b~UzvD*Kzo0tccS2>i|oFGe>|;dxH@X>7hg*E|yq zYT(BlgR4sBb$??Jo3iJY3YEa21+L<7NOLA}rI$~Y6+qTuJ9cJm2exIv^$qeTu9a<|R+kGHI3Ejs6bl6m48?#S z#B2e0z`nBKdoWcH9xzZQd^0}gz{c>Z=6w;JWx+S#U4IVzmh@a1s_FYy7JMV#=fH2G zqbC1l)<0PWybo`3;CG}aWvxzSvGG>nYo)Vj1|OGRF7>M5HHKS(cjCb^@SdFU$8oV0 z13kFk1b$cJnYW~V9KlKK&idBiNgaGF2K)l1>p-K@yT4mn=Gx`79X$X5002ovPDHLkV1l|84MYF{ diff --git a/src/app/valentina/share/resources/toolicon/32x32/move@2x.png b/src/app/valentina/share/resources/toolicon/32x32/move@2x.png index 0b2eec37f492af502ec07aca7fa7041fc109dbe9..14c6badf389ec60e5153af71a064c96ad8dac76d 100644 GIT binary patch delta 942 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 LNkvXXu0mjf#9dC` diff --git a/src/app/valentina/share/resources/toolicon/32x32/path@2x.png b/src/app/valentina/share/resources/toolicon/32x32/path@2x.png index 46efce5f682bd2b8d6e05fbd579e2ec6eb911e97..cc828afba59a4cc4d9b66d1d41e44f5f72062ef1 100644 GIT binary patch delta 1316 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 delta 29 jcmdnUw2^6oCR4?&iQ3-;iUlHmG5~?6tDnm{r-UW|oDvEA diff --git a/src/libs/vmisc/share/resources/icon/16x16/toolsectionelarc@2x.png b/src/libs/vmisc/share/resources/icon/16x16/toolsectionelarc@2x.png index 2f66ae8b378e3f6a8e4bb315d556d4593c4b1958..de7bcb202ce5a5859ee9cf2774a4fd6199497079 100644 GIT binary patch delta 709 zcmV;$0y_QR1>FUZB!8qyL_t(o!|hZ_XcJ)=oo+5gs3I<^kj9^in1uJJ3C}ph}S2X(7Tf6YfL6+s#Kcj+?$5|Ph~6k z9*&|K`Z_l2=6@vO4}<)RM7*oKW^ZCLnWiYUqTwBuEjkY89;Y-r{uc1WVL^URvG#vO zlCN-36xtf4R?s~noBngyKgHrXPH@X$GsPCk@Xm(zLH&KHV0T2W&GsiT^Bc&^EYg1= znd@5-i@Y_{)6C{dree`)kiXz{uRCh(s?GLVkfL!qgMZpbXheu@y`cJek@!P%iFc1i zv#;2IIj01}I|bqyg!Sc5>+54TAQF16Y(1gFiMhE~ByZQ?CllXp1QcIo5j+m?VM{5ml zooLbX{1&X+WTM`X=6Dpq|;SVs9 r)4b~RCbrsqB2iq*)KEhW3jsd>AcxNMw_URm00000NkvXXu0mjfmgmcB!8z#L_t(|+U-_JXcJ)+PB)h#R1ufb5Yw5=Dpeu4v{`2PXB24< zdI;EJ<81$U5szLh>PI{D@aB8p_rCWsu~M-Nh0*FsCsHF?YC4)jd$-&LH?(b z>3{ ze}$8;uwWF(8YY+5Tp}6XbI3o#;2g!cA#JWQ&Gu(piAN;54^4Z0@Sf)>?p~aDQ4t?jsb!N0y#fyqrM1k$J~E zN5jciXhNTpyzZU?a0zC8`BVDF$OQ<5o-0dF=xBVt?-jv2HD@E(UP8|&QNS3hI(uSC zYe`j;2g8lyK_yP37b`Qsm?~~TH2h#k%)ofVoVKqwmfE?v>a7C?@7J6D6tB7mDs09r zDdHYM&wnSN*fhrN8lyVd$d3O_0ploO7HjteZkvBGnOs=L=ItKL_z+l+NM+XkE5V>c zOn!i?89WHA&*PZ=Z*cMiulvV370+Z;yN?gp67LRvAH#%90eBksw?w7bo#=`(CJOEd;*6* uKub<@irpXIYH{&+VQKwks~+`O5b*;bhtBkd2|geI0000) diff --git a/src/libs/vmisc/share/resources/icon/32x32/arrow_cursor.png b/src/libs/vmisc/share/resources/icon/32x32/arrow_cursor.png index 823837f4eb4a19ea4bd9faf46fa0d24966ad4fb1..232ecdf025ab519dc293500658ffe9767a5dd5d4 100644 GIT binary patch delta 253 zcmZo->0_E8SgnPb;&J@!Ra>q@4gzftH76Y^6}4_&E_m?vjO2*u zqld0#b1>RAn+IHDR#_eKBkD)<#-j2di|F%*j~krn+7jD2d86Ng=+_)&H=@+I7*rX( zn5M93a0Uo1P;u~Vn1mz{@2kD!e;z0Q!)@)78&qol`;+0EmBY A0{{R3 delta 499 zcmVMzCV_|S*E^l&Yo9;Xs0004hNkl6bA55sw2pYgV>0;13g1ki2>GLq60Zb=T3BB?SC2CsZuI91Be354L$x9sN{q)6yf&U&ML-lw6v69M zh2YIpf#7URBenph5jz1U5qklq5C;J!5V?S|5k~>aL>vt$3vm*l48+NRb0ZE88jVH_ zVDAz_gl7c=L4UxlRx6F7h?$wAC}JW?0C+_Q7jmA@{ zfbn?Dj^il&{8P`i?IaAtzZPuUP5`t^0c3^)0Hl;d-}kdE3`+qJk;3+!&?BOx=vlbR zdqD_sueH7d@SfRHwOXyMl)CQqdO}Kx<#M^2&1P3;&!yJ-GFm9w0Px#_QmWJM_cvQ`wbn0Z`2JDxh$vYs7CfC!x!di=&1Uo2)NlZR pl=2b4%5~ijB6Trkb)9YKsZ7M2t~*N!haA7fDnW~0DD3SU`?n1 z*b*uMmV_FB9ibLrMQ8xn5E=m%gcg8*LMy;Gp##7#p%cI-p(DT_p)iw&Mww^&fb07P~TiYuBp zyKmMYzod$D_stsAujvw-XW?g28JE5>YS6T#G-=SZtd5vlo{2RLtj>eF28L(i&|qlr zuNzdI2N%W-e$T`=od|Jh2}m1!=vG(S72=rMzCV_|S*E^l&Yo9;Xs0006RNklWm&hBy*yEq^oS9E@#b`C>@u$VY10f+*^98sE-rL@Yt;oyu15Xhob3FhzcDK`h z1d#D~>}?YSkj-WzlgY%(CI}!R;w{2I0ACSa0r-e;0^l3MSpc69E&}+1kPF}g!c_q6 z2!#MNBNPVEihocFKqEqF0Bs0H0Gbet0kj}g0?>d^8NhXfS^!)|s13kXgjxYyM5rCW zHH1b0Tta9Jz!ii>0bD?69H8q6tpIcxp*4W6BD4z7MTE)#i^U@QhS}u0H{JZ33WL{{ z?RH!BPyDH4AEvq5fFwy|I-SaVK9@92Pd<<1_;@FufPbFNVN8+>kR(a=?102^e6l7@ zQ;DMJxMpc}8iQN}_;2_vAW;;lYeCVMqaT1ra#}DNjht*jk=Nt>m$gekhQpy84u`xJ z`~==wnZ_X34oLJfYkMecLEaIW{+adaS|D)tkkq;1L17C7N*|M3qUakT`$(F1=d)4O zf--kL8-Fz|Fg+~Y<9RrhPlrXL?i-D%PDHLkV1jLm8Cw7V From 21e034ef715648b88d15ed463c4497b56b4d3e9a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 31 Jan 2017 14:27:13 +0200 Subject: [PATCH 02/52] QPlainTextEdit widget crash a dialog if do not disable signal when closing a dialog. --HG-- branch : feature --- src/libs/vtools/dialogs/tools/dialogpiecepath.cpp | 9 +++++++++ src/libs/vtools/dialogs/tools/dialogpiecepath.h | 1 + src/libs/vtools/dialogs/tools/dialogseamallowance.cpp | 11 +++++++++++ src/libs/vtools/dialogs/tools/dialogseamallowance.h | 1 + 4 files changed, 22 insertions(+) diff --git a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp index c4ca47744..9bd71171d 100644 --- a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp @@ -201,6 +201,15 @@ void DialogPiecePath::ShowVisualization() } } +//--------------------------------------------------------------------------------------------------------------------- +void DialogPiecePath::closeEvent(QCloseEvent *event) +{ + ui->plainTextEditFormulaWidth->blockSignals(true); + ui->plainTextEditFormulaWidthBefore->blockSignals(true); + ui->plainTextEditFormulaWidthAfter->blockSignals(true); + DialogTool::closeEvent(event); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogPiecePath::ShowContextMenu(const QPoint &pos) { diff --git a/src/libs/vtools/dialogs/tools/dialogpiecepath.h b/src/libs/vtools/dialogs/tools/dialogpiecepath.h index 4739d8ea3..a362cd886 100644 --- a/src/libs/vtools/dialogs/tools/dialogpiecepath.h +++ b/src/libs/vtools/dialogs/tools/dialogpiecepath.h @@ -65,6 +65,7 @@ protected: virtual void SaveData() Q_DECL_OVERRIDE; virtual void CheckState() Q_DECL_OVERRIDE; virtual void ShowVisualization() Q_DECL_OVERRIDE; + virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; private slots: void ShowContextMenu(const QPoint &pos); diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 7ebc6f922..eec2e4cc1 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -304,6 +304,17 @@ void DialogSeamAllowance::CheckState() } } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::closeEvent(QCloseEvent *event) +{ + ui->plainTextEditFormulaWidth->blockSignals(true); + ui->plainTextEditFormulaWidthBefore->blockSignals(true); + ui->plainTextEditFormulaWidthAfter->blockSignals(true); + ui->lineEditRotFormula->blockSignals(true); + ui->lineEditLenFormula->blockSignals(true); + DialogTool::closeEvent(event); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::UpdateList() { diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index ece3aff7a..dc04306fe 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -63,6 +63,7 @@ protected: /** @brief SaveData Put dialog data in local variables */ virtual void SaveData() Q_DECL_OVERRIDE; virtual void CheckState() Q_DECL_OVERRIDE; + virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; protected slots: void UpdateList(); From 637eaa4256ca532e9f38bdcbc65eb77d618d1cbf Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 31 Jan 2017 14:28:05 +0200 Subject: [PATCH 03/52] Refactoring and bug fix in dialog Piece path. --HG-- branch : feature --- .../vtools/dialogs/tools/dialogpiecepath.cpp | 23 +++++-------------- .../vtools/dialogs/tools/dialogpiecepath.h | 2 -- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp index 9bd71171d..7cdce8e17 100644 --- a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp @@ -175,10 +175,6 @@ void DialogPiecePath::ShowDialog(bool click) } } -//--------------------------------------------------------------------------------------------------------------------- -void DialogPiecePath::SaveData() -{} - //--------------------------------------------------------------------------------------------------------------------- void DialogPiecePath::CheckState() { @@ -841,18 +837,7 @@ void DialogPiecePath::SetFormulaSAWidth(const QString &formula) //--------------------------------------------------------------------------------------------------------------------- quint32 DialogPiecePath::GetPieceId() const { - quint32 id = NULL_ID; - - if (ui->comboBoxPiece->count() > 0) - { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - id = ui->comboBoxPiece->itemData(ui->comboBoxPiece->currentIndex()).toUInt(); -#else - id = ui->comboBoxPiece->currentData().toUInt(); -#endif - } - - return id; + return getCurrentObjectId(ui->comboBoxPiece); } //--------------------------------------------------------------------------------------------------------------------- @@ -868,7 +853,11 @@ void DialogPiecePath::SetPieceId(quint32 id) const qint32 index = ui->comboBoxPiece->findData(id); if (index != -1) { - ui->comboBoxType->setCurrentIndex(index); + ui->comboBoxPiece->setCurrentIndex(index); + } + else + { + ui->comboBoxPiece->setCurrentIndex(0); } } diff --git a/src/libs/vtools/dialogs/tools/dialogpiecepath.h b/src/libs/vtools/dialogs/tools/dialogpiecepath.h index a362cd886..19e79e4cd 100644 --- a/src/libs/vtools/dialogs/tools/dialogpiecepath.h +++ b/src/libs/vtools/dialogs/tools/dialogpiecepath.h @@ -61,8 +61,6 @@ public slots: virtual void ShowDialog(bool click) Q_DECL_OVERRIDE; protected: - /** @brief SaveData Put dialog data in local variables */ - virtual void SaveData() Q_DECL_OVERRIDE; virtual void CheckState() Q_DECL_OVERRIDE; virtual void ShowVisualization() Q_DECL_OVERRIDE; virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE; From b9d635dab2b4acb082e08f92f4618b1c38d9a9e0 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 31 Jan 2017 14:28:48 +0200 Subject: [PATCH 04/52] Dialog Pin tool. --HG-- branch : feature --- .../core/vtooloptionspropertybrowser.cpp | 6 +- src/app/valentina/dialogs/dialoghistory.cpp | 3 +- src/app/valentina/mainwindow.cpp | 38 +++- src/app/valentina/mainwindow.h | 2 + src/app/valentina/mainwindow.ui | 34 ++- src/app/valentina/share/resources/cursor.qrc | 2 + .../share/resources/cursor/pin_cursor.png | Bin 0 -> 561 bytes .../share/resources/cursor/pin_cursor@2x.png | Bin 0 -> 1190 bytes .../valentina/share/resources/toolicon.qrc | 2 + .../share/resources/toolicon/32x32/pin.png | Bin 0 -> 630 bytes .../share/resources/toolicon/32x32/pin@2x.png | Bin 0 -> 1006 bytes .../share/resources/toolicon/svg/pin.svg | 81 +++++++ src/app/valentina/xml/vpattern.cpp | 3 +- src/libs/ifc/xml/vabstractpattern.cpp | 14 +- src/libs/vmisc/def.h | 4 +- src/libs/vtools/dialogs/dialogs.pri | 9 +- src/libs/vtools/dialogs/tooldialogs.h | 1 + src/libs/vtools/dialogs/tools/dialogpin.cpp | 204 ++++++++++++++++++ src/libs/vtools/dialogs/tools/dialogpin.h | 73 +++++++ src/libs/vtools/dialogs/tools/dialogpin.ui | 91 ++++++++ .../vtools/visualization/line/vistoolpin.cpp | 65 ++++++ .../vtools/visualization/line/vistoolpin.h | 51 +++++ .../vtools/visualization/visualization.pri | 6 +- 23 files changed, 663 insertions(+), 26 deletions(-) create mode 100644 src/app/valentina/share/resources/cursor/pin_cursor.png create mode 100644 src/app/valentina/share/resources/cursor/pin_cursor@2x.png create mode 100644 src/app/valentina/share/resources/toolicon/32x32/pin.png create mode 100644 src/app/valentina/share/resources/toolicon/32x32/pin@2x.png create mode 100644 src/app/valentina/share/resources/toolicon/svg/pin.svg create mode 100644 src/libs/vtools/dialogs/tools/dialogpin.cpp create mode 100644 src/libs/vtools/dialogs/tools/dialogpin.h create mode 100644 src/libs/vtools/dialogs/tools/dialogpin.ui create mode 100644 src/libs/vtools/visualization/line/vistoolpin.cpp create mode 100644 src/libs/vtools/visualization/line/vistoolpin.h diff --git a/src/app/valentina/core/vtooloptionspropertybrowser.cpp b/src/app/valentina/core/vtooloptionspropertybrowser.cpp index 09e22849e..8e0e356bd 100644 --- a/src/app/valentina/core/vtooloptionspropertybrowser.cpp +++ b/src/app/valentina/core/vtooloptionspropertybrowser.cpp @@ -76,7 +76,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser() void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch."); switch (item->type()) { @@ -203,7 +203,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions() } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch."); switch (currentItem->type()) { @@ -348,7 +348,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VPE::VProperty *property) } // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch."); switch (currentItem->type()) { diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index a168827b8..216fec813 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -212,7 +212,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") QString DialogHistory::Record(const VToolRecord &tool) { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in history."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in history."); const QDomElement domElem = doc->elementById(tool.getId()); if (domElem.isElement() == false) @@ -405,6 +405,7 @@ QString DialogHistory::Record(const VToolRecord &tool) case Tool::FlippingByAxis: case Tool::Move: case Tool::PiecePath: + case Tool::Pin: return QString(); } } diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 25f2e1090..cb4631ef6 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -576,6 +576,7 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons dialogTool->Build(t); break; case Tool::PiecePath: + case Tool::Pin: dialogTool->SetPiecesList(doc->GetActivePPPieces()); break; default: @@ -995,6 +996,14 @@ void MainWindow::ToolPiecePath(bool checked) &MainWindow::ClosedDialogPiecePath); } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ToolPin(bool checked) +{ + ToolSelectAllDrawObjects(); + SetToolButton(checked, Tool::Pin, "://cursor/pin_cursor.png", tr("Select pin point"), + &MainWindow::ClosedDialogPin); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief ToolHeight handler tool height. @@ -1144,6 +1153,18 @@ void MainWindow::ClosedDialogPiecePath(int result) doc->LiteParseTree(Document::LiteParse); } +//--------------------------------------------------------------------------------------------------------------------- +void MainWindow::ClosedDialogPin(int result) +{ +// SCASSERT(dialogTool != nullptr); +// if (result == QDialog::Accepted) +// { +// VToolPin::Create(dialogTool, sceneDetails, doc, pattern); +// } + ArrowTool(); +// doc->LiteParseTree(Document::LiteParse); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief ToolCutArc handler tool cutArc. @@ -1760,7 +1781,7 @@ void MainWindow::InitToolButtons() } // This check helps to find missed tools - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Check if all tools were connected."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Check if all tools were connected."); connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine); connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine); @@ -1806,6 +1827,7 @@ void MainWindow::InitToolButtons() connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint); connect(ui->toolButtonLayoutExportAs, &QToolButton::clicked, this, &MainWindow::ExportLayoutAs); connect(ui->toolButtonEllipticalArc, &QToolButton::clicked, this, &MainWindow::ToolEllipticalArc); + connect(ui->toolButtonPin, &QToolButton::clicked, this, &MainWindow::ToolPin); } //--------------------------------------------------------------------------------------------------------------------- @@ -1833,7 +1855,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") void MainWindow::CancelTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled."); qCDebug(vMainWindow, "Canceling tool."); delete dialogTool; @@ -1989,6 +2011,9 @@ void MainWindow::CancelTool() case Tool::EllipticalArc: ui->toolButtonEllipticalArc->setChecked(false); break; + case Tool::Pin: + ui->toolButtonPin->setChecked(false); + break; } // Crash: using CRTL+Z while using line tool. @@ -3040,7 +3065,7 @@ void MainWindow::SetEnableTool(bool enable) } // This check helps to find missed tools - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled."); //Drawing Tools ui->toolButtonEndLine->setEnabled(drawTools); @@ -3081,6 +3106,7 @@ void MainWindow::SetEnableTool(bool enable) ui->toolButtonMove->setEnabled(drawTools); ui->toolButtonMidpoint->setEnabled(drawTools); ui->toolButtonEllipticalArc->setEnabled(drawTools); + ui->toolButtonPin->setEnabled(drawTools); ui->actionLast_tool->setEnabled(drawTools); @@ -3362,7 +3388,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") void MainWindow::LastUsedTool() { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled."); if (currentTool == lastUsedTool) { @@ -3549,6 +3575,10 @@ void MainWindow::LastUsedTool() ui->toolButtonEllipticalArc->setChecked(true); ToolEllipticalArc(true); break; + case Tool::Pin: + ui->toolButtonPin->setChecked(true); + ToolPin(true); + break; } } diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 61e5999f1..34a5ad998 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -138,6 +138,7 @@ private slots: void ToolPointOfContact(bool checked); void ToolDetail(bool checked); void ToolPiecePath(bool checked); + void ToolPin(bool checked); void ToolHeight(bool checked); void ToolTriangle(bool checked); void ToolPointOfIntersection(bool checked); @@ -171,6 +172,7 @@ private slots: void ClosedDialogUnionDetails(int result); void ClosedDialogGroup(int result); void ClosedDialogPiecePath(int result); + void ClosedDialogPin(int result); void LoadIndividual(); void LoadStandard(); diff --git a/src/app/valentina/mainwindow.ui b/src/app/valentina/mainwindow.ui index 34f5c066a..306bddd01 100644 --- a/src/app/valentina/mainwindow.ui +++ b/src/app/valentina/mainwindow.ui @@ -48,7 +48,7 @@ Tools - 5 + 6 @@ -1144,7 +1144,7 @@ 0 0 130 - 356 + 326 @@ -1449,6 +1449,32 @@ + + + + false + + + Pin tool + + + ... + + + + :/toolicon/32x32/pin.png:/toolicon/32x32/pin.png + + + + 32 + 32 + + + + true + + + @@ -1457,7 +1483,7 @@ 0 0 130 - 356 + 326 @@ -2574,8 +2600,8 @@ - + diff --git a/src/app/valentina/share/resources/cursor.qrc b/src/app/valentina/share/resources/cursor.qrc index 44323cc41..4a3771e1c 100644 --- a/src/app/valentina/share/resources/cursor.qrc +++ b/src/app/valentina/share/resources/cursor.qrc @@ -80,5 +80,7 @@ cursor/el_arc_cursor@2x.png cursor/path_cursor.png cursor/path_cursor@2x.png + cursor/pin_cursor.png + cursor/pin_cursor@2x.png diff --git a/src/app/valentina/share/resources/cursor/pin_cursor.png b/src/app/valentina/share/resources/cursor/pin_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..53e753cc13f9a1da857d83b8a8835e50012c667d GIT binary patch literal 561 zcmV-10?z%3P)I2K(gFX0_{%^#;vduzpMltUARRDZjzD(6fH>kWngi(W2y70Zt0QnZfNqZX zgU11MaRea;(A*KkIDn>(_)Vk(Xyyn~96%FCkm>-cJK`4^4xp+d$aMfgN4yBM5~H;P z@H*m!kIlSizP7=H9PpDu2Vix?D=!C$=RUT#pZVDQeCB172UNsJsssL!m_YBs41Dcp z%?q^n@N*xV{~-L>)9UvTYn?D$4)}q^Fp$Nsfmn~!1ohI-TpVcWA(-V4JT3npwbA{5 z&{F&70Sm2MVjS=th;IV16seX&eGa$$v6mIt@&lIIU<`7^eoNf|d=B^u#QT7lhgeIm zhHA3`E$e;ZV|xr}`AuY>A49VIfThmv{T4b7$1Jsl(9QUcWcgemW+pkqyluV85ld2hAP_2Pfj-}aZaLk+#F;bY(q_(NB}Xp+kEWWpYI99>00000NkvXXu0mjf_#Fy` literal 0 HcmV?d00001 diff --git a/src/app/valentina/share/resources/cursor/pin_cursor@2x.png b/src/app/valentina/share/resources/cursor/pin_cursor@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..dfcf1c8ef55464f5a21fef635ba1f0c9aae35c9e GIT binary patch literal 1190 zcmV;X1X=ruP)Z zQkr}}|EIf4Fl?>XYOU64b%mjapf_6;KuGojt0D+1dKCIIs{t&gAXsiD{F?$`xtSmZ zU@3$J834;5d`JUe34}}lrbn1p0AOl__X+__i;xX~DG}af31B*ew<-Wkg`gI|Gzf2U z05Ao@T#f*SN5}_&p%Gr^3Ba%jvv~wCBtpIc42SSa0{}xIywnK5FbG-#7y{vi#sIoU zcwPViT_Y3Z=nkP60J=h$E)sxl5S|thKsCbnS43r^&an^v!6!xs zP=%1#?{x5PYI4F&61gHw=>Q;Wgt*6fD(s|gGK=8o z>olhed6kC3$7I68?~~zeso}*QR)U}u0DXdVNYl}VHyZGIOHm8ZC_HR>uM|%E)Lw*M zfPNezYxbmj-3bNZ(NVcutKd^ES4C_;^)>Hyo`K`7g|DZ6gP%>%Ph`XIl^^*Kfj@%& zi6g6zhKTCzk=>tfOnX_KA^b4(HZ4a!=Gn0!R!_CWJ=DBZVCgk4JMI4t6E$CCa}=fn zV4*h^;4U%dL4h1x8tW z)mAmH`&c5p4^weTnU6xZxv2=5);wp&M}si(YF~3D0Q$brkzzlfSVCA{4htE>6Zi;A z;Z!bngJa3?=rh7PJv^dnYm1f*^!ENReEQfdY2MD|pHo8=Vp9Ql3 zplKgWjy%)WK6SB)8E<5mgEZU-iGLHo@p7221KLLvOE2Qzlb9*6@C?h z-FBTr2&C;KmWL<8#Sb4IJOLZtTx(Z%0S1JS*hB4dh9toolicon/32x32/el_arc@2x.png toolicon/32x32/path.png toolicon/32x32/path@2x.png + toolicon/32x32/pin.png + toolicon/32x32/pin@2x.png diff --git a/src/app/valentina/share/resources/toolicon/32x32/pin.png b/src/app/valentina/share/resources/toolicon/32x32/pin.png new file mode 100644 index 0000000000000000000000000000000000000000..baf52a929d5f3f7a51df77ed5cbd27f79d333e88 GIT binary patch literal 630 zcmV-+0*U>JP)zR*DAl)7C+}Ab%>;MS< z^UTLOnr@c=H#TN{?qj4cJ=uYlZ^vi(MMtCm2Q0Ng80ZMCXzE(-W3!D&%i)gLZ>1AM z7t7CMT238DKrF{d?ZjFRcfeIJaa#7m*V+PDniT=@QXt+9 zG<*}#@_qPIJ0Z(;Rvom|j@oCTZN1G?g&nVNpZeKa0}cIz&q9)XZlOK(KLZ0JiDkQ; z70~dHlv=*uQhN%?mct$4V`Yic5#BVm9J!7MTKINAEQdS7*VYK`2%zN`9O-B|I1B#& z&v?4GW9}1Re&qQ4y@!td?Vd5?5Xkbn?!Hox z+QozG~GfW?--{N4C77x3>hFT2QeH z3yFi4TGQ!jISc?THUxzPkWQz_^8Newvyf^z!Vx-F`)suJDRKbN@&=&g|9fZ5J`Rra zp1xwbHLIc7?I}FL(bIBpVmfr(8k)~9H}v#n(Y;qQbN+nYn$8L83?mT$08?}GczMh1 Q0ssI207*qoM6N<$f`h;}asU7T literal 0 HcmV?d00001 diff --git a/src/app/valentina/share/resources/toolicon/32x32/pin@2x.png b/src/app/valentina/share/resources/toolicon/32x32/pin@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..859002f9a605446a24a6d4c37dbe1bc8966d007b GIT binary patch literal 1006 zcmVq6dxX>6khJ|#x!B%KHZ72vqm=<)=7-RH5Fe)ap&|sG&o#_e?h!JCa zrGms)7^nX2VsOd)Y0AwpY>LU3VXBCU5S)3j)%FjIPGrYAXJLxAsh4#S-rB$7fE z3d)L0B-=zCKm01wFzJY$h858Y7+o-DnkIm--Nm2H5CB*EmHu@CPXo{OmO%wt-3t`H@yyC zn47Q>Jk#?S`g6KTaZ;4{WC*QjY^qUlhPU|7&8l($8QTn==}DdZyGvaq6V>DsjcMW& zy6U)Fh0wj^LS+iR;iovlCqr@c9h^5`2C_fDFI2AwY_!JLFO$S6JWJE?}AiVNBZ`#k6O^58FvM z0C#|o#`!ia3J`Bto$c#c<3G7oGLJ`z47-#_w_7bc?bTN8WqD7hF@US8NA!C*8(i-3 zve6KNlyJV*vzTTVnDD!t;W=6R9O0RoIi}m0lMpz<2j%kOoIl_aA?USlImOrW1kZU0 ze8i`Rz~X7o2_AWv7d-0_gn(yiv9YmiLm>zWpB92a6WAjB2vqp2L*N3hMDAI^Nfg@a zu8bjYGx@tvU$_{ayIm(JyxcHIw- z@cfv()oLvQ_*)Ji6{p+v!m&uTHO#TZKhEjdp6kgoc)O4K)!p0o+JqC!qwP%}Hi^H( zi^f<=H7lEgQvR-w_GGuNI5vOk7XNx zw-%8K0&gOS4(9U%wUs;EN*R?+08W+kh@kLHWxEL;rSuf!4?JpQqj;uX$>nA1ZUVT& z6C^&{5IjoR30~s6aQs5HU+>Sa12UfB%x@4hK6Mj3DkSjNLlBk1^Ushro2}IDC!eO_ z``F|E6GDtsskVy(&y>C9U + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 44e9d964e..5d512ea19 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -3726,7 +3726,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default") QRectF VPattern::ActiveDrawBoundingRect() const { // This check helps to find missed tools in the switch - Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used."); + Q_STATIC_ASSERT_X(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used."); QRectF rec; @@ -3860,6 +3860,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const case Tool::NodeSplinePath: case Tool::Group: case Tool::PiecePath: + case Tool::Pin: break; } } diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 122428173..aa49d48e7 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -1588,7 +1588,7 @@ QStringList VAbstractPattern::ListPointExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment a number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); QStringList expressions; const QDomNodeList list = elementsByTagName(TagPoint); @@ -1660,7 +1660,7 @@ QStringList VAbstractPattern::ListArcExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); QStringList expressions; const QDomNodeList list = elementsByTagName(TagArc); @@ -1714,7 +1714,7 @@ QStringList VAbstractPattern::ListElArcExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); QStringList expressions; const QDomNodeList list = elementsByTagName(TagElArc); @@ -1785,7 +1785,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); QStringList expressions; const QDomNodeList list = elementsByTagName(AttrPathPoint); @@ -1852,7 +1852,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); QStringList expressions; const QDomNodeList list = elementsByTagName(TagOperation); @@ -1907,7 +1907,7 @@ QStringList VAbstractPattern::ListPathExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); QStringList expressions; const QDomNodeList list = elementsByTagName(TagPath); @@ -1960,7 +1960,7 @@ QStringList VAbstractPattern::ListPieceExpressions() const // Check if new tool doesn't bring new attribute with a formula. // If no just increment number. // If new tool bring absolutely new type and has formula(s) create new method to cover it. - Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 51); + Q_STATIC_ASSERT(static_cast(Tool::LAST_ONE_DO_NOT_USE) == 52); QStringList expressions; const QDomNodeList list = elementsByTagName(TagDetail); diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 15a5ef7aa..7d09481a9 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -147,6 +147,7 @@ enum class Tool : ToolVisHolderType Move, Midpoint, EllipticalArc, + Pin, LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used }; @@ -193,7 +194,8 @@ enum class Vis : ToolVisHolderType ToolMove, ToolEllipticalArc, ToolPiece, - ToolPiecePath + ToolPiecePath, + ToolPin }; enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle, diff --git a/src/libs/vtools/dialogs/dialogs.pri b/src/libs/vtools/dialogs/dialogs.pri index d21b0a6ba..135de7182 100644 --- a/src/libs/vtools/dialogs/dialogs.pri +++ b/src/libs/vtools/dialogs/dialogs.pri @@ -43,7 +43,8 @@ HEADERS += \ $$PWD/tools/dialogmove.h \ $$PWD/tools/dialogellipticalarc.h \ $$PWD/tools/dialogseamallowance.h \ - $$PWD/tools/dialogpiecepath.h + $$PWD/tools/dialogpiecepath.h \ + $$PWD/tools/dialogpin.h SOURCES += \ $$PWD/tools/dialogalongline.cpp \ @@ -86,7 +87,8 @@ SOURCES += \ $$PWD/tools/dialogmove.cpp \ $$PWD/tools/dialogellipticalarc.cpp \ $$PWD/tools/dialogseamallowance.cpp \ - $$PWD/tools/dialogpiecepath.cpp + $$PWD/tools/dialogpiecepath.cpp \ + $$PWD/tools/dialogpin.cpp FORMS += \ $$PWD/tools/dialogalongline.ui \ @@ -128,4 +130,5 @@ FORMS += \ $$PWD/tools/dialogmove.ui \ $$PWD/tools/dialogellipticalarc.ui \ $$PWD/tools/dialogseamallowance.ui \ - $$PWD/tools/dialogpiecepath.ui + $$PWD/tools/dialogpiecepath.ui \ + $$PWD/tools/dialogpin.ui diff --git a/src/libs/vtools/dialogs/tooldialogs.h b/src/libs/vtools/dialogs/tooldialogs.h index b42272af1..a98fe7402 100644 --- a/src/libs/vtools/dialogs/tooldialogs.h +++ b/src/libs/vtools/dialogs/tooldialogs.h @@ -67,6 +67,7 @@ #include "tools/dialogmove.h" #include "tools/dialogellipticalarc.h" #include "tools/dialogpiecepath.h" +#include "tools/dialogpin.h" #include "support/dialogeditwrongformula.h" #include "support/dialogundo.h" diff --git a/src/libs/vtools/dialogs/tools/dialogpin.cpp b/src/libs/vtools/dialogs/tools/dialogpin.cpp new file mode 100644 index 000000000..1c820f7df --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogpin.cpp @@ -0,0 +1,204 @@ +/************************************************************************ + ** + ** @file dialogpin.cpp + ** @author Roman Telezhynskyi + ** @date 31 1, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#include "dialogpin.h" +#include "ui_dialogpin.h" +#include "visualization/line/vistoolpin.h" +#include "../../tools/vabstracttool.h" +#include "../../tools/vtoolseamallowance.h" + +//--------------------------------------------------------------------------------------------------------------------- +DialogPin::DialogPin(const VContainer *data, quint32 toolId, QWidget *parent) + : DialogTool(data, toolId, parent), + ui(new Ui::DialogPin), + m_showMode(false), + m_flagPoint(false) +{ + ui->setupUi(this); + InitOkCancel(ui); + + FillComboBoxPoints(ui->comboBoxPoint); + + flagError = false; + CheckState(); + + vis = new VisToolPin(data); +} + +//--------------------------------------------------------------------------------------------------------------------- +DialogPin::~DialogPin() +{ + delete ui; +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPin::EnbleShowMode(bool disable) +{ + m_showMode = disable; + ui->comboBoxPiece->setDisabled(m_showMode); +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 DialogPin::GetPieceId() const +{ + return getCurrentObjectId(ui->comboBoxPiece); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPin::SetPieceId(quint32 id) +{ + if (ui->comboBoxPiece->count() <= 0) + { + const VPiece piece = data->GetPiece(id); + ui->comboBoxPiece->addItem(piece.GetName(), id); + } + else + { + const qint32 index = ui->comboBoxPiece->findData(id); + if (index != -1) + { + ui->comboBoxPiece->setCurrentIndex(index); + } + else + { + ui->comboBoxPiece->setCurrentIndex(0); + } + } + + CheckPieces(); +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 DialogPin::GetPointId() const +{ + return getCurrentObjectId(ui->comboBoxPoint); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPin::SetPointId(quint32 id) +{ + setCurrentPointId(ui->comboBoxPoint, id); + + VisToolPin *point = qobject_cast(vis); + SCASSERT(point != nullptr) + point->setObject1Id(id); + + CheckPoint(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPin::SetPiecesList(const QVector &list) +{ + for (int i=0; i < list.size(); ++i) + { + const VPiece piece = data->GetPiece(list.at(i)); + ui->comboBoxPiece->addItem(piece.GetName(), list.at(i)); + } + + CheckPieces(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPin::ChosenObject(quint32 id, const SceneObject &type) +{ + if (not prepare) + { + if (type == SceneObject::Point) + { + if (SetObject(id, ui->comboBoxPoint, "")) + { + vis->VisualMode(id); + CheckPoint(); + prepare = true; + this->setModal(true); + this->show(); + } + } + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPin::CheckState() +{ + SCASSERT(bOk != nullptr); + bOk->setEnabled(m_flagPoint && flagError); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPin::ShowVisualization() +{ + AddVisualization(); + + if (m_showMode) + { + VToolSeamAllowance *tool = qobject_cast(VAbstractPattern::getTool(GetPieceId())); + SCASSERT(tool != nullptr); + auto visPoint = qobject_cast(vis); + SCASSERT(visPoint != nullptr); + visPoint->setParentItem(tool); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPin::CheckPieces() +{ + if (not m_showMode) + { + QColor color = okColor; + if (ui->comboBoxPiece->count() <= 0) + { + flagError = false; + color = errorColor; + } + else + { + flagError = true; + color = okColor; + } + ChangeColor(ui->labelPiece, color); + CheckState(); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogPin::CheckPoint() +{ + QColor color = okColor; + if (ui->comboBoxPoint->currentIndex() != -1) + { + m_flagPoint = true; + color = okColor; + } + else + { + m_flagPoint = false; + color = errorColor; + } + ChangeColor(ui->labelPoint, color); + CheckState(); +} diff --git a/src/libs/vtools/dialogs/tools/dialogpin.h b/src/libs/vtools/dialogs/tools/dialogpin.h new file mode 100644 index 000000000..ed13b2eb6 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogpin.h @@ -0,0 +1,73 @@ +/************************************************************************ + ** + ** @file dialogpin.h + ** @author Roman Telezhynskyi + ** @date 31 1, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef DIALOGPIN_H +#define DIALOGPIN_H + +#include "dialogtool.h" + +namespace Ui +{ + class DialogPin; +} + +class DialogPin : public DialogTool +{ + Q_OBJECT +public: + explicit DialogPin(const VContainer *data, quint32 toolId, QWidget *parent = nullptr); + virtual ~DialogPin(); + + void EnbleShowMode(bool disable); + + quint32 GetPieceId() const; + void SetPieceId(quint32 id); + + quint32 GetPointId() const; + void SetPointId(quint32 id); + + virtual void SetPiecesList(const QVector &list) Q_DECL_OVERRIDE; + +public slots: + virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; + +protected: + virtual void CheckState() Q_DECL_OVERRIDE; + virtual void ShowVisualization() Q_DECL_OVERRIDE; + +private: + Q_DISABLE_COPY(DialogPin) + Ui::DialogPin *ui; + bool m_showMode; + bool m_flagPoint; + + void CheckPieces(); + void CheckPoint(); +}; + +#endif // DIALOGPIN_H diff --git a/src/libs/vtools/dialogs/tools/dialogpin.ui b/src/libs/vtools/dialogs/tools/dialogpin.ui new file mode 100644 index 000000000..682ffb9a1 --- /dev/null +++ b/src/libs/vtools/dialogs/tools/dialogpin.ui @@ -0,0 +1,91 @@ + + + DialogPin + + + + 0 + 0 + 194 + 114 + + + + Dialog + + + Pin tool + + + + + + + + Point: + + + + + + + + + + Piece: + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + DialogPin + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogPin + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/libs/vtools/visualization/line/vistoolpin.cpp b/src/libs/vtools/visualization/line/vistoolpin.cpp new file mode 100644 index 000000000..b942795b6 --- /dev/null +++ b/src/libs/vtools/visualization/line/vistoolpin.cpp @@ -0,0 +1,65 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 31 1, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#include "vistoolpin.h" +#include "../vwidgets/vsimplepoint.h" +#include "../vgeometry/vpointf.h" + +//--------------------------------------------------------------------------------------------------------------------- +VisToolPin::VisToolPin(const VContainer *data, QGraphicsItem *parent) + : VisLine(data, parent), + m_point(nullptr) +{ + this->mainColor = Qt::red; + this->setZValue(2);// Show on top real tool + + m_point = new VSimplePoint(NULL_ID, mainColor, *Visualization::data->GetPatternUnit(), &factor); + m_point->SetPointHighlight(true); + m_point->setParentItem(this); + m_point->SetVisualizationMode(true); + m_point->setVisible(false); +} + +//--------------------------------------------------------------------------------------------------------------------- +VisToolPin::~VisToolPin() +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisToolPin::RefreshGeometry() +{ + if (object1Id > NULL_ID) + { + const QSharedPointer point = Visualization::data->GeometricObject(object1Id); + + m_point->SetOnlyPoint(mode == Mode::Creation); + m_point->RefreshGeometry(*point); + m_point->setVisible(true); + } +} + diff --git a/src/libs/vtools/visualization/line/vistoolpin.h b/src/libs/vtools/visualization/line/vistoolpin.h new file mode 100644 index 000000000..a8075c42a --- /dev/null +++ b/src/libs/vtools/visualization/line/vistoolpin.h @@ -0,0 +1,51 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 31 1, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef VISTOOLPIN_H +#define VISTOOLPIN_H + +#include "visline.h" + +class VSimplePoint; + +class VisToolPin : public VisLine +{ + Q_OBJECT +public: + explicit VisToolPin(const VContainer *data, QGraphicsItem *parent = nullptr); + virtual ~VisToolPin() Q_DECL_OVERRIDE; + + virtual void RefreshGeometry() Q_DECL_OVERRIDE; + virtual int type() const Q_DECL_OVERRIDE {return Type;} + enum { Type = UserType + static_cast(Vis::ToolPin)}; +private: + Q_DISABLE_COPY(VisToolPin) + VSimplePoint *m_point; +}; + +#endif // VISTOOLPIN_H diff --git a/src/libs/vtools/visualization/visualization.pri b/src/libs/vtools/visualization/visualization.pri index 6231eacf9..042360691 100644 --- a/src/libs/vtools/visualization/visualization.pri +++ b/src/libs/vtools/visualization/visualization.pri @@ -40,7 +40,8 @@ HEADERS += \ $$PWD/line/operation/vistoolmove.h \ $$PWD/path/vistoolellipticalarc.h \ $$PWD/path/vistoolpiece.h \ - $$PWD/path/vistoolpiecepath.h + $$PWD/path/vistoolpiecepath.h \ + $$PWD/line/vistoolpin.h SOURCES += \ $$PWD/visualization.cpp \ @@ -81,4 +82,5 @@ SOURCES += \ $$PWD/line/operation/vistoolmove.cpp \ $$PWD/path/vistoolellipticalarc.cpp \ $$PWD/path/vistoolpiece.cpp \ - $$PWD/path/vistoolpiecepath.cpp + $$PWD/path/vistoolpiecepath.cpp \ + $$PWD/line/vistoolpin.cpp From f2e88c71dae3e1be716f2bcf59618c62d586848a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 31 Jan 2017 16:04:51 +0200 Subject: [PATCH 05/52] Added class VToolPin. --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 13 +- src/app/valentina/xml/vpattern.cpp | 28 ++- src/app/valentina/xml/vpattern.h | 1 + .../vtools/tools/nodeDetails/nodedetails.h | 1 + .../vtools/tools/nodeDetails/vtoolpin.cpp | 168 ++++++++++++++++++ src/libs/vtools/tools/nodeDetails/vtoolpin.h | 68 +++++++ src/libs/vtools/tools/tools.pri | 6 +- src/libs/vtools/tools/vabstracttool.cpp | 24 +-- src/libs/vtools/tools/vabstracttool.h | 19 ++ 9 files changed, 299 insertions(+), 29 deletions(-) create mode 100644 src/libs/vtools/tools/nodeDetails/vtoolpin.cpp create mode 100644 src/libs/vtools/tools/nodeDetails/vtoolpin.h diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index cb4631ef6..15e01e201 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -53,6 +53,7 @@ #include "../vtools/dialogs/tooldialogs.h" #include "tools/vtoolseamallowance.h" #include "tools/nodeDetails/vtoolpiecepath.h" +#include "tools/nodeDetails/vtoolpin.h" #include "tools/vtooluniondetails.h" #include "dialogs/dialogs.h" #include "dialogs/vwidgetgroups.h" @@ -1156,13 +1157,13 @@ void MainWindow::ClosedDialogPiecePath(int result) //--------------------------------------------------------------------------------------------------------------------- void MainWindow::ClosedDialogPin(int result) { -// SCASSERT(dialogTool != nullptr); -// if (result == QDialog::Accepted) -// { -// VToolPin::Create(dialogTool, sceneDetails, doc, pattern); -// } + SCASSERT(dialogTool != nullptr); + if (result == QDialog::Accepted) + { + VToolPin::Create(dialogTool, doc, pattern); + } ArrowTool(); -// doc->LiteParseTree(Document::LiteParse); + doc->LiteParseTree(Document::LiteParse); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 5d512ea19..4abbb696a 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -963,7 +963,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem << VToolPointFromCircleAndTangent::ToolType /*19*/ << VToolPointFromArcAndTangent::ToolType /*20*/ << VToolTrueDarts::ToolType /*21*/ - << VToolPointOfIntersectionCurves::ToolType; /*22*/ + << VToolPointOfIntersectionCurves::ToolType /*22*/ + << VToolPin::ToolType; /*23*/ switch (points.indexOf(type)) { case 0: //VToolBasePoint::ToolType @@ -1035,6 +1036,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem case 22: //VToolPointOfIntersectionCurves::ToolType ParseToolPointOfIntersectionCurves(scene, domElement, parse); break; + case 23: //VToolPin::ToolType + ParsePinPoint(domElement, parse); + break; default: VException e(tr("Unknown point type '%1'.").arg(type)); throw e; @@ -1536,6 +1540,28 @@ void VPattern::ParseNodePoint(const QDomElement &domElement, const Document &par } } +//--------------------------------------------------------------------------------------------------------------------- +void VPattern::ParsePinPoint(const QDomElement &domElement, const Document &parse) +{ + Q_ASSERT_X(not domElement.isNull(), Q_FUNC_INFO, "domElement is null"); + + try + { + quint32 id = 0; + + ToolsCommonAttributes(domElement, id); + const quint32 idObject = GetParametrUInt(domElement, AttrIdObject, NULL_ID_STR); + const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, NULL_ID_STR); + VToolPin::Create(id, idObject, NULL_ID, this, data, parse, Source::FromFile, "", idTool); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating pin point"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } +} + //--------------------------------------------------------------------------------------------------------------------- void VPattern::ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse) { diff --git a/src/app/valentina/xml/vpattern.h b/src/app/valentina/xml/vpattern.h index 1c0fb2f3f..9b5b74342 100644 --- a/src/app/valentina/xml/vpattern.h +++ b/src/app/valentina/xml/vpattern.h @@ -167,6 +167,7 @@ private: void ParseToolLineIntersect(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse); void ParseToolPointOfContact(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse); void ParseNodePoint(const QDomElement &domElement, const Document &parse); + void ParsePinPoint(const QDomElement &domElement, const Document &parse); void ParseToolHeight(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse); void ParseToolTriangle(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse); void ParseToolPointOfIntersection(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse); diff --git a/src/libs/vtools/tools/nodeDetails/nodedetails.h b/src/libs/vtools/tools/nodeDetails/nodedetails.h index 918551ec5..60b1f6b25 100644 --- a/src/libs/vtools/tools/nodeDetails/nodedetails.h +++ b/src/libs/vtools/tools/nodeDetails/nodedetails.h @@ -35,5 +35,6 @@ #include "vnodespline.h" #include "vnodesplinepath.h" #include "vtoolpiecepath.h" +#include "vtoolpin.h" #endif // NODEDETAILS_H diff --git a/src/libs/vtools/tools/nodeDetails/vtoolpin.cpp b/src/libs/vtools/tools/nodeDetails/vtoolpin.cpp new file mode 100644 index 000000000..456a691f6 --- /dev/null +++ b/src/libs/vtools/tools/nodeDetails/vtoolpin.cpp @@ -0,0 +1,168 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 31 1, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#include "vtoolpin.h" +#include "../../dialogs/tools/dialogpin.h" +#include "../../undocommands/savepieceoptions.h" +#include "../vtoolseamallowance.h" +#include "../vgeometry/vpointf.h" + +const QString VToolPin::ToolType = QStringLiteral("pin"); + +//--------------------------------------------------------------------------------------------------------------------- +VToolPin *VToolPin::Create(DialogTool *dialog, VAbstractPattern *doc, VContainer *data) +{ + SCASSERT(dialog != nullptr); + DialogPin *dialogTool = qobject_cast(dialog); + SCASSERT(dialogTool != nullptr); + const quint32 pointId = dialogTool->GetPointId(); + const quint32 pieceId = dialogTool->GetPieceId(); + + return Create(0, pointId, pieceId, doc, data, Document::FullParse, Source::FromGui); +} + +//--------------------------------------------------------------------------------------------------------------------- +VToolPin *VToolPin::Create(quint32 _id, quint32 pointId, quint32 pieceId, VAbstractPattern *doc, VContainer *data, + const Document &parse, const Source &typeCreation, const QString &drawName, + const quint32 &idTool) +{ + quint32 id = _id; + if (typeCreation == Source::FromGui) + { + id = CreateNode(data, pointId); + } + else + { + QSharedPointer point; + try + { + point = data->GeometricObject(pointId); + } + catch (const VExceptionBadId &e) + { // Possible case. Parent was deleted, but the node object is still here. + Q_UNUSED(e) + return nullptr;// Just ignore + } + VPointF *pinPoint = new VPointF(*point); + pinPoint->setMode(Draw::Modeling); + data->UpdateGObject(id, pinPoint); + if (parse != Document::FullParse) + { + doc->UpdateToolData(id, data); + } + } + VAbstractTool::AddRecord(id, Tool::Pin, doc); + VToolPin *point = nullptr; + if (parse == Document::FullParse) + { + point = new VToolPin(doc, data, id, pointId, pieceId, typeCreation, drawName, idTool, doc); + + doc->AddTool(id, point); + if (idTool != NULL_ID) + { + //Some nodes we don't show on scene. Tool that create this nodes must free memory. + VDataTool *tool = doc->getTool(idTool); + SCASSERT(tool != nullptr) + point->setParent(tool);// Adopted by a tool + } + else + { + // Help to delete the node before each FullParse + doc->AddToolOnRemove(point); + } + } + else + { + doc->UpdateToolData(id, data); + } + return point; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VToolPin::getTagName() const +{ + return VAbstractPattern::TagPoint; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPin::AllowHover(bool enabled) +{ + Q_UNUSED(enabled) + // do nothing +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPin::AllowSelecting(bool enabled) +{ + Q_UNUSED(enabled) + // do nothing +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPin::AddToFile() +{ + QDomElement domElement = doc->createElement(getTagName()); + + doc->SetAttribute(domElement, VDomDocument::AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrIdObject, idNode); + if (idTool != NULL_ID) + { + doc->SetAttribute(domElement, AttrIdTool, idTool); + } + + AddToModeling(domElement); + + if (m_pieceId > NULL_ID) + { +// const VPiece oldDet = VAbstractTool::data.GetPiece(m_pieceId); +// VPiece newDet = oldDet; + +// newDet.GetPins().append(id); + +// SavePieceOptions *saveCommand = new SavePieceOptions(oldDet, newDet, doc, m_pieceId); +// qApp->getUndoStack()->push(saveCommand);// First push then make a connect +// VAbstractTool::data.UpdatePiece(m_pieceId, newDet);// Update piece because first save will not call lite update +// connect(saveCommand, &SavePieceOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolPin::RefreshDataInFile() +{ + // do nothing +} + +//--------------------------------------------------------------------------------------------------------------------- +VToolPin::VToolPin(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 pointId, quint32 pieceId, + const Source &typeCreation, const QString &drawName, const quint32 &idTool, QObject *qoParent) + : VAbstractNode(doc, data, id, pointId, drawName, idTool, qoParent), + m_pieceId(pieceId) +{ + ToolCreation(typeCreation); +} diff --git a/src/libs/vtools/tools/nodeDetails/vtoolpin.h b/src/libs/vtools/tools/nodeDetails/vtoolpin.h new file mode 100644 index 000000000..9b98d0489 --- /dev/null +++ b/src/libs/vtools/tools/nodeDetails/vtoolpin.h @@ -0,0 +1,68 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 31 1, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef VTOOLPIN_H +#define VTOOLPIN_H + +#include + +#include "vabstractnode.h" + +class DialogTool; + +class VToolPin : public VAbstractNode +{ + Q_OBJECT +public: + static VToolPin* Create(DialogTool *dialog, VAbstractPattern *doc, VContainer *data); + static VToolPin *Create(quint32 _id, quint32 pointId, quint32 pieceId, VAbstractPattern *doc, VContainer *data, + const Document &parse, const Source &typeCreation, const QString &drawName = QString(), + const quint32 &idTool = 0); + + static const QString ToolType; + virtual QString getTagName() const Q_DECL_OVERRIDE; +public slots: + virtual void FullUpdateFromFile () Q_DECL_OVERRIDE {} + virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE; + virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE; +protected: + virtual void AddToFile() Q_DECL_OVERRIDE; + virtual void RefreshDataInFile() Q_DECL_OVERRIDE; + virtual void ShowNode() Q_DECL_OVERRIDE {} + virtual void HideNode() Q_DECL_OVERRIDE {} +private: + Q_DISABLE_COPY(VToolPin) + + quint32 m_pieceId; + + VToolPin(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 pointId, quint32 pieceId, + const Source &typeCreation, const QString &drawName = QString(), const quint32 &idTool = 0, + QObject *qoParent = nullptr); +}; + +#endif // VTOOLPIN_H diff --git a/src/libs/vtools/tools/tools.pri b/src/libs/vtools/tools/tools.pri index 2b755c117..c0f55911e 100644 --- a/src/libs/vtools/tools/tools.pri +++ b/src/libs/vtools/tools/tools.pri @@ -58,7 +58,8 @@ HEADERS += \ $$PWD/drawTools/toolcurve/vtoolellipticalarc.h \ $$PWD/nodeDetails/vnodeellipticalarc.h \ $$PWD/vtoolseamallowance.h \ - $$PWD/nodeDetails/vtoolpiecepath.h + $$PWD/nodeDetails/vtoolpiecepath.h \ + $$PWD/nodeDetails/vtoolpin.h SOURCES += \ $$PWD/vdatatool.cpp \ @@ -114,4 +115,5 @@ SOURCES += \ $$PWD/drawTools/toolcurve/vtoolellipticalarc.cpp \ $$PWD/nodeDetails/vnodeellipticalarc.cpp \ $$PWD/vtoolseamallowance.cpp \ - $$PWD/nodeDetails/vtoolpiecepath.cpp + $$PWD/nodeDetails/vtoolpiecepath.cpp \ + $$PWD/nodeDetails/vtoolpin.cpp diff --git a/src/libs/vtools/tools/vabstracttool.cpp b/src/libs/vtools/tools/vabstracttool.cpp index 7cd873b5f..84fe7c4d1 100644 --- a/src/libs/vtools/tools/vabstracttool.cpp +++ b/src/libs/vtools/tools/vabstracttool.cpp @@ -87,32 +87,16 @@ const QString VAbstractTool::AttrInUse = QStringLiteral("inUse"); namespace { -//--------------------------------------------------------------------------------------------------------------------- -template -/** - * @brief CreateNode create new node for detail. - * @param data container. - * @param id id parent object. - * @return id for new object. - */ -quint32 CreateNode(VContainer *data, quint32 id) -{ - //We can't use exist object. Need create new. - T *node = new T(*data->GeometricObject(id).data()); - node->setMode(Draw::Modeling); - return data->AddGObject(node); -} - //--------------------------------------------------------------------------------------------------------------------- quint32 CreateNodeSpline(VContainer *data, quint32 id) { if (data->GetGObject(id)->getType() == GOType::Spline) { - return CreateNode(data, id); + return VAbstractTool::CreateNode(data, id); } else { - return CreateNode(data, id); + return VAbstractTool::CreateNode(data, id); } } @@ -121,11 +105,11 @@ quint32 CreateNodeSplinePath(VContainer *data, quint32 id) { if (data->GetGObject(id)->getType() == GOType::SplinePath) { - return CreateNode(data, id); + return VAbstractTool::CreateNode(data, id); } else { - return CreateNode(data, id); + return VAbstractTool::CreateNode(data, id); } } }//static functions diff --git a/src/libs/vtools/tools/vabstracttool.h b/src/libs/vtools/tools/vabstracttool.h index e4bec6a15..d0f66f166 100644 --- a/src/libs/vtools/tools/vabstracttool.h +++ b/src/libs/vtools/tools/vabstracttool.h @@ -92,6 +92,9 @@ public: QMap PointsList() const; virtual QString getTagName() const =0; virtual void ShowVisualization(bool show) =0; + + template + static quint32 CreateNode(VContainer *data, quint32 id); public slots: /** * @brief FullUpdateFromFile update tool data form file. @@ -197,4 +200,20 @@ inline void VAbstractTool::AddVisualization() vis = visual; } +//--------------------------------------------------------------------------------------------------------------------- +template +/** + * @brief CreateNode create new node for detail. + * @param data container. + * @param id id parent object. + * @return id for new object. + */ +quint32 VAbstractTool::CreateNode(VContainer *data, quint32 id) +{ + //We can't use exist object. Need create new. + T *node = new T(*data->GeometricObject(id).data()); + node->setMode(Draw::Modeling); + return data->AddGObject(node); +} + #endif // VABSTRACTTOOL_H From a58a479db556e20a79fe0a5e3789a59723bec146 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 31 Jan 2017 16:26:28 +0200 Subject: [PATCH 06/52] Refactor VPiece class. Instead of method AppendInternalPath() use overloaded getter. --HG-- branch : feature --- src/libs/vpatterndb/vpiece.cpp | 28 +++++++++++++++---- src/libs/vpatterndb/vpiece.h | 8 ++++-- src/libs/vpatterndb/vpiece_p.h | 3 ++ .../dialogs/tools/dialogseamallowance.cpp | 10 +++---- .../tools/nodeDetails/vtoolpiecepath.cpp | 8 ++---- src/libs/vtools/tools/vtoolseamallowance.cpp | 12 ++++---- src/libs/vtools/tools/vtooluniondetails.cpp | 28 +++++++------------ 7 files changed, 53 insertions(+), 44 deletions(-) diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 704921167..5a0896270 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -304,6 +304,12 @@ QVector VPiece::GetInternalPaths() const return d->m_internalPaths; } +//--------------------------------------------------------------------------------------------------------------------- +QVector &VPiece::GetInternalPaths() +{ + return d->m_internalPaths; +} + //--------------------------------------------------------------------------------------------------------------------- void VPiece::SetInternalPaths(const QVector &iPaths) { @@ -311,13 +317,13 @@ void VPiece::SetInternalPaths(const QVector &iPaths) } //--------------------------------------------------------------------------------------------------------------------- -void VPiece::AppendInternalPath(quint32 path) +QVector VPiece::GetCustomSARecords() const { - d->m_internalPaths.append(path); + return d->m_customSARecords; } //--------------------------------------------------------------------------------------------------------------------- -QVector VPiece::GetCustomSARecords() const +QVector &VPiece::GetCustomSARecords() { return d->m_customSARecords; } @@ -329,9 +335,21 @@ void VPiece::SetCustomSARecords(const QVector &records) } //--------------------------------------------------------------------------------------------------------------------- -void VPiece::AppendCustomSARecord(const CustomSARecord &record) +QVector VPiece::GetPins() const { - d->m_customSARecords.append(record); + return d->m_pins; +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector &VPiece::GetPins() +{ + return d->m_pins; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPiece::SetPins(const QVector &pins) +{ + d->m_pins = pins; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h index 111d368c7..c721d0a17 100644 --- a/src/libs/vpatterndb/vpiece.h +++ b/src/libs/vpatterndb/vpiece.h @@ -85,12 +85,16 @@ public: void SetFormulaSAWidth(const QString &formula, qreal value); QVector GetInternalPaths() const; + QVector &GetInternalPaths(); void SetInternalPaths(const QVector &iPaths); - void AppendInternalPath(quint32 path); QVector GetCustomSARecords() const; + QVector &GetCustomSARecords(); void SetCustomSARecords(const QVector &records); - void AppendCustomSARecord(const CustomSARecord &record); + + QVector GetPins() const; + QVector &GetPins(); + void SetPins(const QVector &pins); QVector MissingNodes(const VPiece &det) const; QVector MissingCSAPath(const VPiece &det) const; diff --git a/src/libs/vpatterndb/vpiece_p.h b/src/libs/vpatterndb/vpiece_p.h index f937e8488..cc28158eb 100644 --- a/src/libs/vpatterndb/vpiece_p.h +++ b/src/libs/vpatterndb/vpiece_p.h @@ -54,6 +54,7 @@ public: m_united(false), m_customSARecords(), m_internalPaths(), + m_pins(), m_ppData(), m_piPatternInfo(), m_glGrainline(), @@ -69,6 +70,7 @@ public: m_united(detail.m_united), m_customSARecords(detail.m_customSARecords), m_internalPaths(detail.m_internalPaths), + m_pins(detail.m_pins), m_ppData(detail.m_ppData), m_piPatternInfo(detail.m_piPatternInfo), m_glGrainline(detail.m_glGrainline), @@ -88,6 +90,7 @@ public: QVector m_customSARecords; QVector m_internalPaths; + QVector m_pins; /** @brief Pattern piece data */ VPatternPieceData m_ppData; diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index eec2e4cc1..5ff72a5dc 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -127,18 +127,16 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) ui->listWidgetCustomSA->blockSignals(true); ui->listWidgetCustomSA->clear(); - const QVector records = piece.GetCustomSARecords(); - for (int i = 0; i < records.size(); ++i) + for (int i = 0; i < piece.GetCustomSARecords().size(); ++i) { - NewCustomSA(records.at(i)); + NewCustomSA(piece.GetCustomSARecords().at(i)); } ui->listWidgetCustomSA->blockSignals(false); ui->listWidgetInternalPaths->clear(); - const QVector iPaths = piece.GetInternalPaths(); - for (int i = 0; i < iPaths.size(); ++i) + for (int i = 0; i < piece.GetInternalPaths().size(); ++i) { - NewInternalPath(iPaths.at(i)); + NewInternalPath(piece.GetInternalPaths().at(i)); } ui->comboBoxStartPoint->blockSignals(true); diff --git a/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp b/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp index 0a3cb028c..ba50869a1 100644 --- a/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp +++ b/src/libs/vtools/tools/nodeDetails/vtoolpiecepath.cpp @@ -211,18 +211,14 @@ void VToolPiecePath::AddToFile() if (path.GetType() == PiecePathType::InternalPath) { - QVector iPaths = newDet.GetInternalPaths(); - iPaths.append(id); - newDet.SetInternalPaths(iPaths); + newDet.GetInternalPaths().append(id); } else if (path.GetType() == PiecePathType::CustomSeamAllowance) { CustomSARecord record; record.path = id; - QVector records = newDet.GetCustomSARecords(); - records.append(record); - newDet.SetCustomSARecords(records); + newDet.GetCustomSARecords().append(record); } SavePieceOptions *saveCommand = new SavePieceOptions(oldDet, newDet, doc, m_pieceId); diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 7a13ae281..4aa42288f 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -1116,25 +1116,23 @@ void VToolSeamAllowance::InitNodes(const VPiece &detail, VMainGraphicsScene *sce //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::InitCSAPaths(const VPiece &detail) { - QVector records = detail.GetCustomSARecords(); - for (int i = 0; i < records.size(); ++i) + for (int i = 0; i < detail.GetCustomSARecords().size(); ++i) { - doc->IncrementReferens(records.at(i).path); + doc->IncrementReferens(detail.GetCustomSARecords().at(i).path); } } //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::InitInternalPaths(const VPiece &detail) { - QVector records = detail.GetInternalPaths(); - for (int i = 0; i < records.size(); ++i) + for (int i = 0; i < detail.GetInternalPaths().size(); ++i) { - VToolPiecePath *tool = qobject_cast(doc->getTool(records.at(i))); + VToolPiecePath *tool = qobject_cast(doc->getTool(detail.GetInternalPaths().at(i))); SCASSERT(tool != nullptr); tool->setParentItem(this); tool->SetParentType(ParentType::Item); tool->show(); - doc->IncrementReferens(records.at(i)); + doc->IncrementReferens(detail.GetInternalPaths().at(i)); } } diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 22d1c157e..ebed39f2d 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -958,12 +958,10 @@ void CreateUnitedDetailCSA(VPiece &newDetail, const VPiece &d, QVector const QString &drawName, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle) { - QVector newList = newDetail.GetCustomSARecords(); - const QVector oldList = d.GetCustomSARecords(); QVector nodeChildren; - for(int i=0; i < oldList.size(); ++i) + for(int i=0; i < d.GetCustomSARecords().size(); ++i) { - CustomSARecord record = oldList.at(i); + CustomSARecord record = d.GetCustomSARecords().at(i); const VPiecePath path = initData.data->GetPiecePath(record.path); VPiecePath newPath = path; newPath.Clear();//Clear nodes @@ -975,21 +973,19 @@ void CreateUnitedDetailCSA(VPiece &newDetail, const VPiece &d, QVector VToolPiecePath::Create(idPath, newPath, NULL_ID, initData.scene, initData.doc, initData.data, initData.parse, Source::FromTool, drawName, id); record.path = idPath; - newList.append(record); + newDetail.GetCustomSARecords().append(record); nodeChildren.prepend(idPath); } children += nodeChildren; - newDetail.SetCustomSARecords(newList); } //--------------------------------------------------------------------------------------------------------------------- void CreateUnitedCSA(VPiece &newDetail, const VPiece &d1, const VPiece &d2, quint32 id, const QString &drawName, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle) { - const QVector d1Records = d1.GetCustomSARecords(); - for (int i = 0; i < d1Records.size(); ++i) + for (int i = 0; i < d1.GetCustomSARecords().size(); ++i) { - newDetail.AppendCustomSARecord(d1Records.at(i)); + newDetail.GetCustomSARecords().append(d1.GetCustomSARecords().at(i)); } QVector children; @@ -1004,12 +1000,10 @@ void CreateUnitedDetailInternalPaths(VPiece &newDetail, const VPiece &d, QVector const QString &drawName, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle) { - QVector newList = newDetail.GetInternalPaths(); - const QVector oldList = d.GetInternalPaths(); QVector nodeChildren; - for(int i=0; i < oldList.size(); ++i) + for(int i=0; i < d.GetInternalPaths().size(); ++i) { - const VPiecePath path = initData.data->GetPiecePath(oldList.at(i)); + const VPiecePath path = initData.data->GetPiecePath(d.GetInternalPaths().at(i)); VPiecePath newPath = path; newPath.Clear();//Clear nodes @@ -1020,11 +1014,10 @@ void CreateUnitedDetailInternalPaths(VPiece &newDetail, const VPiece &d, QVector const quint32 idPath = initData.data->AddPiecePath(newPath); VToolPiecePath::Create(idPath, newPath, NULL_ID, initData.scene, initData.doc, initData.data, initData.parse, Source::FromTool, drawName, id); - newList.append(idPath); + newDetail.GetInternalPaths().append(idPath); nodeChildren.prepend(idPath); } children += nodeChildren; - newDetail.SetInternalPaths(newList); } //--------------------------------------------------------------------------------------------------------------------- @@ -1032,10 +1025,9 @@ void CreateUnitedInternalPaths(VPiece &newDetail, const VPiece &d1, const VPiece const QString &drawName, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle) { - const QVector d1Internal = d1.GetInternalPaths(); - for (int i = 0; i < d1Internal.size(); ++i) + for (int i = 0; i < d1.GetInternalPaths().size(); ++i) { - newDetail.AppendInternalPath(d1Internal.at(i)); + newDetail.GetInternalPaths().append(d1.GetInternalPaths().at(i)); } QVector children; From ad403850bc2e0e7fff6c0da52bfb584d32ff9744 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 31 Jan 2017 18:09:18 +0200 Subject: [PATCH 07/52] Save pin inside a piece. --HG-- branch : feature --- src/app/valentina/xml/vpattern.cpp | 6 +- src/libs/ifc/xml/vabstractpattern.cpp | 20 +++++ src/libs/ifc/xml/vabstractpattern.h | 1 + src/libs/vpatterndb/vpiece.cpp | 88 +++++++++---------- src/libs/vpatterndb/vpiece.h | 1 + .../vtools/tools/nodeDetails/vtoolpin.cpp | 14 +-- src/libs/vtools/tools/vtoolseamallowance.cpp | 19 ++++ src/libs/vtools/tools/vtoolseamallowance.h | 2 + src/libs/vtools/tools/vtooluniondetails.cpp | 1 + src/libs/vtools/undocommands/addpiece.cpp | 1 + src/libs/vtools/undocommands/deletepiece.cpp | 1 + .../vtools/undocommands/savepieceoptions.cpp | 4 + 12 files changed, 106 insertions(+), 52 deletions(-) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 4abbb696a..5f451a0a3 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -717,7 +717,8 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse << TagPatternInfo << TagGrainline << VToolSeamAllowance::TagCSA - << VToolSeamAllowance::TagIPaths; + << VToolSeamAllowance::TagIPaths + << VToolSeamAllowance::TagPins; const QDomNodeList nodeList = domElement.childNodes(); for (qint32 i = 0; i < nodeList.size(); ++i) @@ -757,6 +758,9 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse case 5:// VToolSeamAllowance::TagIPaths detail.SetInternalPaths(ParsePieceInternalPaths(element)); break; + case 6:// VToolSeamAllowance::TagPins + detail.SetPins(ParsePiecePins(element)); + break; default: break; } diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index aa49d48e7..b3f4539df 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -631,6 +631,26 @@ QVector VAbstractPattern::ParsePieceInternalPaths(const QDomElement &do return records; } +//--------------------------------------------------------------------------------------------------------------------- +QVector VAbstractPattern::ParsePiecePins(const QDomElement &domElement) +{ + QVector records; + const QDomNodeList nodeList = domElement.childNodes(); + for (qint32 i = 0; i < nodeList.size(); ++i) + { + const QDomElement element = nodeList.at(i).toElement(); + if (not element.isNull()) + { + const quint32 path = element.text().toUInt(); + if (path > NULL_ID) + { + records.append(path); + } + } + } + return records; +} + //--------------------------------------------------------------------------------------------------------------------- VPieceNode VAbstractPattern::ParseSANode(const QDomElement &domElement) { diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 2e590c9a1..39f09b1f0 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -99,6 +99,7 @@ public: static VPiecePath ParsePieceNodes(const QDomElement &domElement); static QVector ParsePieceCSARecords(const QDomElement &domElement); static QVector ParsePieceInternalPaths(const QDomElement &domElement); + static QVector ParsePiecePins(const QDomElement &domElement); void AddToolOnRemove(VDataTool *tool); diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 5a0896270..642a7ab56 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -36,6 +36,38 @@ #include #include +namespace +{ +QVector PieceMissingNodes(const QVector &d1Nodes, const QVector &d2Nodes) +{ + if (d1Nodes.size() == d2Nodes.size()) //-V807 + { + return QVector(); + } + + QSet set1; + for (qint32 i = 0; i < d1Nodes.size(); ++i) + { + set1.insert(d1Nodes.at(i)); + } + + QSet set2; + for (qint32 j = 0; j < d2Nodes.size(); ++j) + { + set2.insert(d2Nodes.at(j)); + } + + const QList set3 = set1.subtract(set2).toList(); + QVector r; + for (qint32 i = 0; i < set3.size(); ++i) + { + r.append(set3.at(i)); + } + + return r; +} +} + //--------------------------------------------------------------------------------------------------------------------- VPiece::VPiece() : VAbstractPiece(), d(new VPieceData(PiecePathType::PiecePath)) @@ -367,63 +399,31 @@ QVector VPiece::MissingNodes(const VPiece &det) const //--------------------------------------------------------------------------------------------------------------------- QVector VPiece::MissingCSAPath(const VPiece &det) const { - const QVector detRecords = det.GetCustomSARecords(); - if (d->m_customSARecords.size() == detRecords.size()) //-V807 - { - return QVector(); - } - - QSet set1; + QVector oldCSARecords; for (qint32 i = 0; i < d->m_customSARecords.size(); ++i) { - set1.insert(d->m_customSARecords.at(i).path); + oldCSARecords.append(d->m_customSARecords.at(i).path); } - QSet set2; - for (qint32 j = 0; j < detRecords.size(); ++j) + QVector newCSARecords; + for (qint32 i = 0; i < det.GetCustomSARecords().size(); ++i) { - set2.insert(detRecords.at(j).path); + newCSARecords.append(det.GetCustomSARecords().at(i).path); } - const QList set3 = set1.subtract(set2).toList(); - QVector r; - for (qint32 i = 0; i < set3.size(); ++i) - { - r.append(set3.at(i)); - } - - return r; + return PieceMissingNodes(oldCSARecords, newCSARecords); } //--------------------------------------------------------------------------------------------------------------------- QVector VPiece::MissingInternalPaths(const VPiece &det) const { - const QVector detRecords = det.GetInternalPaths(); - if (d->m_internalPaths.size() == detRecords.size()) //-V807 - { - return QVector(); - } + return PieceMissingNodes(d->m_internalPaths, det.GetInternalPaths()); +} - QSet set1; - for (qint32 i = 0; i < d->m_internalPaths.size(); ++i) - { - set1.insert(d->m_internalPaths.at(i)); - } - - QSet set2; - for (qint32 j = 0; j < detRecords.size(); ++j) - { - set2.insert(detRecords.at(j)); - } - - const QList set3 = set1.subtract(set2).toList(); - QVector r; - for (qint32 i = 0; i < set3.size(); ++i) - { - r.append(set3.at(i)); - } - - return r; +//--------------------------------------------------------------------------------------------------------------------- +QVector VPiece::MissingPins(const VPiece &det) const +{ + return PieceMissingNodes(d->m_pins, det.GetPins()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h index c721d0a17..881f172f6 100644 --- a/src/libs/vpatterndb/vpiece.h +++ b/src/libs/vpatterndb/vpiece.h @@ -99,6 +99,7 @@ public: QVector MissingNodes(const VPiece &det) const; QVector MissingCSAPath(const VPiece &det) const; QVector MissingInternalPaths(const VPiece &det) const; + QVector MissingPins(const VPiece &det) const; void SetPatternPieceData(const VPatternPieceData &data); VPatternPieceData& GetPatternPieceData(); diff --git a/src/libs/vtools/tools/nodeDetails/vtoolpin.cpp b/src/libs/vtools/tools/nodeDetails/vtoolpin.cpp index 456a691f6..da8000827 100644 --- a/src/libs/vtools/tools/nodeDetails/vtoolpin.cpp +++ b/src/libs/vtools/tools/nodeDetails/vtoolpin.cpp @@ -140,15 +140,15 @@ void VToolPin::AddToFile() if (m_pieceId > NULL_ID) { -// const VPiece oldDet = VAbstractTool::data.GetPiece(m_pieceId); -// VPiece newDet = oldDet; + const VPiece oldDet = VAbstractTool::data.GetPiece(m_pieceId); + VPiece newDet = oldDet; -// newDet.GetPins().append(id); + newDet.GetPins().append(id); -// SavePieceOptions *saveCommand = new SavePieceOptions(oldDet, newDet, doc, m_pieceId); -// qApp->getUndoStack()->push(saveCommand);// First push then make a connect -// VAbstractTool::data.UpdatePiece(m_pieceId, newDet);// Update piece because first save will not call lite update -// connect(saveCommand, &SavePieceOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); + SavePieceOptions *saveCommand = new SavePieceOptions(oldDet, newDet, doc, m_pieceId); + qApp->getUndoStack()->push(saveCommand);// First push then make a connect + VAbstractTool::data.UpdatePiece(m_pieceId, newDet);// Update piece because first save will not call lite update + connect(saveCommand, &SavePieceOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); } } diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 4aa42288f..039993abf 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -67,6 +67,7 @@ const quint8 VToolSeamAllowance::pieceVersion = 2; const QString VToolSeamAllowance::TagCSA = QStringLiteral("csa"); const QString VToolSeamAllowance::TagRecord = QStringLiteral("record"); const QString VToolSeamAllowance::TagIPaths = QStringLiteral("iPaths"); +const QString VToolSeamAllowance::TagPins = QStringLiteral("pins"); const QString VToolSeamAllowance::AttrVersion = QStringLiteral("version"); const QString VToolSeamAllowance::AttrForbidFlipping = QStringLiteral("forbidFlipping"); @@ -220,6 +221,22 @@ void VToolSeamAllowance::AddInternalPaths(VAbstractPattern *doc, QDomElement &do } } +//--------------------------------------------------------------------------------------------------------------------- +void VToolSeamAllowance::AddPins(VAbstractPattern *doc, QDomElement &domElement, const QVector &pins) +{ + if (pins.size() > 0) + { + QDomElement pinsElement = doc->createElement(VToolSeamAllowance::TagPins); + for (int i = 0; i < pins.size(); ++i) + { + QDomElement recordNode = doc->createElement(VToolSeamAllowance::TagRecord); + recordNode.appendChild(doc->createTextNode(QString().setNum(pins.at(i)))); + pinsElement.appendChild(recordNode); + } + domElement.appendChild(pinsElement); + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::AddPatternPieceData(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece) { @@ -728,6 +745,7 @@ void VToolSeamAllowance::AddToFile() //custom seam allowance AddCSARecords(doc, domElement, piece.GetCustomSARecords()); AddInternalPaths(doc, domElement, piece.GetInternalPaths()); + AddPins(doc, domElement, piece.GetPins()); AddPiece *addDet = new AddPiece(domElement, doc, piece, m_drawName); connect(addDet, &AddPiece::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing); @@ -760,6 +778,7 @@ void VToolSeamAllowance::RefreshDataInFile() AddNodes(doc, domElement, piece); AddCSARecords(doc, domElement, piece.GetCustomSARecords()); AddInternalPaths(doc, domElement, piece.GetInternalPaths()); + AddPins(doc, domElement, piece.GetPins()); } } } diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index 304936fd3..d8b9fb3d0 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -60,6 +60,7 @@ public: static const QString TagCSA; static const QString TagRecord; static const QString TagIPaths; + static const QString TagPins; static const QString AttrVersion; static const QString AttrForbidFlipping; @@ -74,6 +75,7 @@ public: static void AddCSARecord(VAbstractPattern *doc, QDomElement &domElement, const CustomSARecord &record); static void AddCSARecords(VAbstractPattern *doc, QDomElement &domElement, const QVector &records); static void AddInternalPaths(VAbstractPattern *doc, QDomElement &domElement, const QVector &paths); + static void AddPins(VAbstractPattern *doc, QDomElement &domElement, const QVector &pins); static void AddPatternPieceData(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece); static void AddPatternInfo(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece); static void AddGrainline(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece); diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index ebed39f2d..0a5917612 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -1422,6 +1422,7 @@ void VToolUnionDetails::AddDetail(QDomElement &domElement, const VPiece &d) cons //custom seam allowance VToolSeamAllowance::AddCSARecords(doc, det, d.GetCustomSARecords()); VToolSeamAllowance::AddInternalPaths(doc, det, d.GetInternalPaths()); + VToolSeamAllowance::AddPins(doc, det, d.GetPins()); domElement.appendChild(det); } diff --git a/src/libs/vtools/undocommands/addpiece.cpp b/src/libs/vtools/undocommands/addpiece.cpp index 9f4ccc2ff..a99b6747f 100644 --- a/src/libs/vtools/undocommands/addpiece.cpp +++ b/src/libs/vtools/undocommands/addpiece.cpp @@ -65,6 +65,7 @@ void AddPiece::undo() DecrementReferences(m_detail.GetPath().GetNodes()); DecrementReferences(m_detail.GetCustomSARecords()); DecrementReferences(m_detail.GetInternalPaths()); + DecrementReferences(m_detail.GetPins()); } else { diff --git a/src/libs/vtools/undocommands/deletepiece.cpp b/src/libs/vtools/undocommands/deletepiece.cpp index fba723c2f..aa2ce9873 100644 --- a/src/libs/vtools/undocommands/deletepiece.cpp +++ b/src/libs/vtools/undocommands/deletepiece.cpp @@ -107,6 +107,7 @@ void DeletePiece::redo() DecrementReferences(m_detail.GetPath().GetNodes()); DecrementReferences(m_detail.GetCustomSARecords()); DecrementReferences(m_detail.GetInternalPaths()); + DecrementReferences(m_detail.GetPins()); emit NeedFullParsing(); // Doesn't work when UnionDetail delete detail. } else diff --git a/src/libs/vtools/undocommands/savepieceoptions.cpp b/src/libs/vtools/undocommands/savepieceoptions.cpp index daeef8aab..466043fb7 100644 --- a/src/libs/vtools/undocommands/savepieceoptions.cpp +++ b/src/libs/vtools/undocommands/savepieceoptions.cpp @@ -78,10 +78,12 @@ void SavePieceOptions::undo() VToolSeamAllowance::AddNodes(doc, domElement, m_oldDet); VToolSeamAllowance::AddCSARecords(doc, domElement, m_oldDet.GetCustomSARecords()); VToolSeamAllowance::AddInternalPaths(doc, domElement, m_oldDet.GetInternalPaths()); + VToolSeamAllowance::AddPins(doc, domElement, m_oldDet.GetPins()); IncrementReferences(m_oldDet.MissingNodes(m_newDet)); IncrementReferences(m_oldDet.MissingCSAPath(m_newDet)); IncrementReferences(m_oldDet.MissingInternalPaths(m_newDet)); + IncrementReferences(m_oldDet.MissingPins(m_newDet)); emit NeedLiteParsing(Document::LiteParse); } else @@ -107,10 +109,12 @@ void SavePieceOptions::redo() VToolSeamAllowance::AddNodes(doc, domElement, m_newDet); VToolSeamAllowance::AddCSARecords(doc, domElement, m_newDet.GetCustomSARecords()); VToolSeamAllowance::AddInternalPaths(doc, domElement, m_newDet.GetInternalPaths()); + VToolSeamAllowance::AddPins(doc, domElement, m_newDet.GetPins()); DecrementReferences(m_oldDet.MissingNodes(m_newDet)); DecrementReferences(m_oldDet.MissingCSAPath(m_newDet)); DecrementReferences(m_oldDet.MissingInternalPaths(m_newDet)); + DecrementReferences(m_oldDet.MissingPins(m_newDet)); emit NeedLiteParsing(Document::LiteParse); } From 3f8dc54acb8ea99caef5b1f3d448cede3d5fd14d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 1 Feb 2017 13:27:38 +0200 Subject: [PATCH 08/52] Union Details tool. Small improvements and bug fixes. --HG-- branch : feature --- src/libs/vtools/tools/vtooluniondetails.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 29c743078..c61fb7e44 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -349,7 +349,7 @@ quint32 AddNodePoint(const VPieceNode &node, const VToolUnionDetailsInitData &in children.append(idObject); point1->setMode(Draw::Modeling); const quint32 id = initData.data->AddGObject(point1.take()); - VNodePoint::Create(initData.doc, initData.data, initData.scene, id, idObject, Document::FullParse, Source::FromGui, + VNodePoint::Create(initData.doc, initData.data, initData.scene, id, idObject, Document::FullParse, Source::FromTool, drawName, idTool); return id; } @@ -391,7 +391,8 @@ quint32 AddNodeArc(const VPieceNode &node, const VToolUnionDetailsInitData &init arc2->setMode(Draw::Modeling); const quint32 id = initData.data->AddGObject(arc2.take()); - VNodeArc::Create(initData.doc, initData.data, id, idObject, Document::FullParse, Source::FromGui, drawName, idTool); + VNodeArc::Create(initData.doc, initData.data, id, idObject, Document::FullParse, Source::FromTool, drawName, + idTool); return id; } @@ -434,7 +435,7 @@ quint32 AddNodeElArc(const VPieceNode &node, const VToolUnionDetailsInitData &in arc2->setMode(Draw::Modeling); const quint32 id = initData.data->AddGObject(arc2.take()); - VNodeEllipticalArc::Create(initData.doc, initData.data, id, idObject, Document::FullParse, Source::FromGui, + VNodeEllipticalArc::Create(initData.doc, initData.data, id, idObject, Document::FullParse, Source::FromTool, drawName, idTool); return id; } @@ -469,7 +470,7 @@ quint32 AddNodeSpline(const VPieceNode &node, const VToolUnionDetailsInitData &i VSpline *spl1 = new VSpline(*spl); spl1->setMode(Draw::Modeling); const quint32 id = initData.data->AddGObject(spl1); - VNodeSpline::Create(initData.doc, initData.data, id, idObject, Document::FullParse, Source::FromGui, drawName, + VNodeSpline::Create(initData.doc, initData.data, id, idObject, Document::FullParse, Source::FromTool, drawName, idTool); return id; } @@ -533,7 +534,7 @@ quint32 AddNodeSplinePath(const VPieceNode &node, const VToolUnionDetailsInitDat path1->setMode(Draw::Modeling); const quint32 id = initData.data->AddGObject(path1.take()); - VNodeSplinePath::Create(initData.doc, initData.data, id, idObject, Document::FullParse, Source::FromGui, drawName, + VNodeSplinePath::Create(initData.doc, initData.data, id, idObject, Document::FullParse, Source::FromTool, drawName, idTool); return id; } @@ -993,8 +994,6 @@ void CreateUnitedCSA(VPiece &newDetail, const VPiece &d1, const VPiece &d2, quin QVector children; CreateUnitedDetailCSA(newDetail, d2, children, id, drawName, initData, dx, dy, pRotate, angle); - - SCASSERT(not children.isEmpty()) SaveCSAChildren(initData.doc, id, children); } @@ -1036,7 +1035,6 @@ void CreateUnitedInternalPaths(VPiece &newDetail, const VPiece &d1, const VPiece QVector children; CreateUnitedDetailInternalPaths(newDetail, d2, children, id, drawName, initData, dx, dy, pRotate, angle); - SCASSERT(not children.isEmpty()) SaveInternalPathsChildren(initData.doc, id, children); } From 8549e55fecac46961f05a6396849f027c4982717 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 1 Feb 2017 13:31:14 +0200 Subject: [PATCH 09/52] Union Details tool now supports pin points. --HG-- branch : feature --- src/libs/vtools/tools/vtooluniondetails.cpp | 116 ++++++++++++++++++++ 1 file changed, 116 insertions(+) diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index c61fb7e44..300b45489 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -67,6 +67,7 @@ #include "nodeDetails/vnodespline.h" #include "nodeDetails/vnodesplinepath.h" #include "nodeDetails/vtoolpiecepath.h" +#include "nodeDetails/vtoolpin.h" #include "vdatatool.h" #include "vnodedetail.h" #include "vtoolseamallowance.h" @@ -202,6 +203,37 @@ QVector GetPiece2InternalPaths(VAbstractPattern *doc, quint32 id) return QVector(); } +//--------------------------------------------------------------------------------------------------------------------- +QVector GetPiece2Pins(VAbstractPattern *doc, quint32 id) +{ + const QDomElement tool = doc->elementById(id); + if (tool.isNull()) + { + VException e(QString("Can't get tool by id='%1'.").arg(id)); + throw e; + } + + const QDomNodeList nodesList = tool.childNodes(); + for (qint32 i = 0; i < nodesList.size(); ++i) + { + const QDomElement element = nodesList.at(i).toElement(); + if (not element.isNull() && element.tagName() == VToolUnionDetails::TagDetail && i+1 == 2) + { + const QDomNodeList detList = element.childNodes(); + for (qint32 j = 0; j < detList.size(); ++j) + { + const QDomElement element = detList.at(j).toElement(); + if (not element.isNull() && element.tagName() == VToolSeamAllowance::TagPins) + { + return VAbstractPattern::ParsePiecePins(element); + } + } + } + } + + return QVector(); +} + //--------------------------------------------------------------------------------------------------------------------- QString DrawName(VAbstractPattern *doc, quint32 d1id, quint32 d2id) { @@ -354,6 +386,29 @@ quint32 AddNodePoint(const VPieceNode &node, const VToolUnionDetailsInitData &in return id; } +//--------------------------------------------------------------------------------------------------------------------- +quint32 AddPin(quint32 id, const VToolUnionDetailsInitData &initData, quint32 idTool, QVector &children, + const QString &drawName, qreal dx, qreal dy, quint32 pRotate, qreal angle) +{ + QScopedPointer point(new VPointF(*initData.data->GeometricObject(id))); + point->setMode(Draw::Modeling); + + if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) + { + BiasRotatePoint(point.data(), dx, dy, *initData.data->GeometricObject(pRotate), angle); + } + + QScopedPointer point1(new VPointF(*point)); + + const quint32 idObject = initData.data->AddGObject(point.take()); + children.append(idObject); + point1->setMode(Draw::Modeling); + const quint32 idPin = initData.data->AddGObject(point1.take()); + VToolPin::Create(idPin, idObject, 0, initData.doc, initData.data, Document::FullParse, Source::FromTool, drawName, + idTool); + return idPin; +} + //--------------------------------------------------------------------------------------------------------------------- quint32 AddNodeArc(const VPieceNode &node, const VToolUnionDetailsInitData &initData, quint32 idTool, QVector &children, const QString &drawName, qreal dx, qreal dy, @@ -653,6 +708,12 @@ void SaveInternalPathsChildren(VAbstractPattern *doc, quint32 id, const QVector< SaveChildren(doc, id, doc->createElement(VToolSeamAllowance::TagIPaths), children); } +//--------------------------------------------------------------------------------------------------------------------- +void SavePinsChildren(VAbstractPattern *doc, quint32 id, const QVector &children) +{ + SaveChildren(doc, id, doc->createElement(VToolSeamAllowance::TagPins), children); +} + //--------------------------------------------------------------------------------------------------------------------- QVector GetChildren(VAbstractPattern *doc, quint32 id, const QString &tagName) { @@ -705,6 +766,12 @@ QVector GetInternalPathsChildren(VAbstractPattern *doc, quint32 id) return GetChildren(doc, id, VToolSeamAllowance::TagIPaths); } +//--------------------------------------------------------------------------------------------------------------------- +QVector GetPinChildren(VAbstractPattern *doc, quint32 id) +{ + return GetChildren(doc, id, VToolSeamAllowance::TagPins); +} + //--------------------------------------------------------------------------------------------------------------------- quint32 TakeNextId(QVector &children) { @@ -1038,6 +1105,35 @@ void CreateUnitedInternalPaths(VPiece &newDetail, const VPiece &d1, const VPiece SaveInternalPathsChildren(initData.doc, id, children); } +//--------------------------------------------------------------------------------------------------------------------- +void CreateUnitedDetailPins(VPiece &newDetail, const VPiece &d, QVector &children, quint32 idTool, + const QString &drawName, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, + quint32 pRotate, qreal angle) +{ + QVector nodeChildren; + for(int i=0; i < d.GetPins().size(); ++i) + { + const quint32 id = AddPin(d.GetPins().at(i), initData, idTool, children, drawName, dx, dy, pRotate, angle); + newDetail.GetPins().append(id); + nodeChildren.prepend(id); + } + children += nodeChildren; +} + +//--------------------------------------------------------------------------------------------------------------------- +void CreateUnitedPins(VPiece &newDetail, const VPiece &d1, const VPiece &d2, quint32 id, const QString &drawName, + const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle) +{ + for (int i = 0; i < d1.GetPins().size(); ++i) + { + newDetail.GetPins().append(d1.GetPins().at(i)); + } + + QVector children; + CreateUnitedDetailPins(newDetail, d2, children, id, drawName, initData, dx, dy, pRotate, angle); + SavePinsChildren(initData.doc, id, children); +} + //--------------------------------------------------------------------------------------------------------------------- void UpdateUnitedNodes(quint32 id, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle) @@ -1157,6 +1253,24 @@ void UpdateUnitedDetailInternalPaths(quint32 id, const VToolUnionDetailsInitData UpdateUnitedDetailPaths(initData, dx, dy, pRotate, angle, records, GetInternalPathsChildren(initData.doc, id)); } +//--------------------------------------------------------------------------------------------------------------------- +void UpdateUnitedDetailPins(quint32 id, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, + quint32 pRotate, qreal angle, const QVector &records) +{ + QVector children = GetPinChildren(initData.doc, id); + + for (int i = 0; i < records.size(); ++i) + { + QScopedPointer point(new VPointF(*initData.data->GeometricObject(records.at(i)))); + point->setMode(Draw::Modeling); + if (not qFuzzyIsNull(dx) || not qFuzzyIsNull(dy) || pRotate != NULL_ID) + { + BiasRotatePoint(point.data(), dx, dy, *initData.data->GeometricObject(pRotate), angle); + } + initData.data->UpdateGObject(TakeNextId(children), point.take()); + } +} + //--------------------------------------------------------------------------------------------------------------------- void CreateUnitedDetail(quint32 id, const VToolUnionDetailsInitData &initData, qreal dx, qreal dy, quint32 pRotate, qreal angle) @@ -1172,6 +1286,7 @@ void CreateUnitedDetail(quint32 id, const VToolUnionDetailsInitData &initData, q CreateUnitedNodes(newDetail, d1, d2, id, drawName, initData, dx, dy, pRotate, angle); CreateUnitedCSA(newDetail, d1, d2, id, drawName, initData, dx, dy, pRotate, angle); CreateUnitedInternalPaths(newDetail, d1, d2, id, drawName, initData, dx, dy, pRotate, angle); + CreateUnitedPins(newDetail, d1, d2, id, drawName, initData, dx, dy, pRotate, angle); newDetail.SetName(QObject::tr("United detail")); QString formulaSAWidth = d1.GetFormulaSAWidth(); @@ -1207,6 +1322,7 @@ void UpdateUnitedDetail(quint32 id, const VToolUnionDetailsInitData &initData, q UpdateUnitedNodes(id, initData, dx, dy, pRotate, angle); UpdateUnitedDetailCSA(id, initData, dx, dy, pRotate, angle, GetPiece2CSAPaths(initData.doc, id)); UpdateUnitedDetailInternalPaths(id, initData, dx, dy, pRotate, angle, GetPiece2InternalPaths(initData.doc, id)); + UpdateUnitedDetailPins(id, initData, dx, dy, pRotate, angle, GetPiece2Pins(initData.doc, id)); } //--------------------------------------------------------------------------------------------------------------------- From 85078691caa2af363eab23337c4b8fb968b27da6 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 1 Feb 2017 14:18:45 +0200 Subject: [PATCH 10/52] New version of pattern format. --HG-- branch : feature --- src/libs/ifc/schema.qrc | 1 + src/libs/ifc/schema/pattern/v0.4.1.xsd | 838 +++++++++++++++++++++++++ src/libs/ifc/xml/vpatternconverter.cpp | 22 +- src/libs/ifc/xml/vpatternconverter.h | 5 +- 4 files changed, 861 insertions(+), 5 deletions(-) create mode 100644 src/libs/ifc/schema/pattern/v0.4.1.xsd diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index aa5a46d40..cd7354cea 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -24,6 +24,7 @@ schema/pattern/v0.3.8.xsd schema/pattern/v0.3.9.xsd schema/pattern/v0.4.0.xsd + schema/pattern/v0.4.1.xsd schema/standard_measurements/v0.3.0.xsd schema/standard_measurements/v0.4.0.xsd schema/standard_measurements/v0.4.1.xsd diff --git a/src/libs/ifc/schema/pattern/v0.4.1.xsd b/src/libs/ifc/schema/pattern/v0.4.1.xsd new file mode 100644 index 000000000..b43477a90 --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.4.1.xsd @@ -0,0 +1,838 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index f3a4af8c7..7f76ab53b 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -58,8 +58,8 @@ class QDomElement; */ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0"); -const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.0"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.0.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.4.1"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.4.1.xsd"); //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! @@ -197,6 +197,8 @@ QString VPatternConverter::XSDSchema(int ver) const case (0x000309): return QStringLiteral("://schema/pattern/v0.3.9.xsd"); case (0x000400): + return QStringLiteral("://schema/pattern/v0.4.0.xsd"); + case (0x000401): return CurrentSchema; default: InvalidVersion(ver); @@ -304,7 +306,10 @@ void VPatternConverter::ApplyPatches() ValidateXML(XSDSchema(0x000400), fileName); V_FALLTHROUGH case (0x000400): - break; + ToV0_4_1(); + ValidateXML(XSDSchema(0x000401), fileName); + V_FALLTHROUGH + case (0x000401): default: break; } @@ -597,6 +602,17 @@ void VPatternConverter::ToV0_4_0() Save(); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ToV0_4_1() +{ + // TODO. Delete if minimal supported version is 0.4.1 + Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < CONVERTER_VERSION_CHECK(0, 4, 1), + "Time to refactor the code."); + + SetVersion(QStringLiteral("0.4.1")); + Save(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index 3341fecaf..8f20790be 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -55,10 +55,10 @@ public: // GCC 4.6 doesn't allow constexpr and const together #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406 static Q_DECL_CONSTEXPR int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 0); + static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 1); #else static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 0); + static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 4, 1); #endif protected: @@ -99,6 +99,7 @@ private: void ToV0_3_8(); void ToV0_3_9(); void ToV0_4_0(); + void ToV0_4_1(); void TagUnitToV0_2_0(); void TagIncrementToV0_2_0(); From fc86069f7c683f3de7a20e5571deaebb8ae1decc Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 14 Feb 2017 15:11:54 +0200 Subject: [PATCH 11/52] Dialog Seam allowance tool. Show pins in a list. --HG-- branch : feature --- .../dialogs/tools/dialogseamallowance.cpp | 58 +++++++++++++++++++ .../dialogs/tools/dialogseamallowance.h | 3 + .../dialogs/tools/dialogseamallowance.ui | 16 ++++- 3 files changed, 76 insertions(+), 1 deletion(-) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 60e895416..54074d27c 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -99,6 +99,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 & InitInternalPathsTab(); InitPatternPieceDataTab(); InitGrainlineTab(); + InitPinsTab(); flagName = true;//We have default name of piece. ChangeColor(ui->labelEditName, okColor); @@ -129,6 +130,7 @@ void DialogSeamAllowance::EnableApply(bool enable) ui->tabInternalPaths->setEnabled(applyAllowed); ui->tabPatternPieceData->setEnabled(applyAllowed); ui->tabGrainline->setEnabled(applyAllowed); + ui->tabPins->setEnabled(applyAllowed); } //--------------------------------------------------------------------------------------------------------------------- @@ -160,6 +162,12 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) NewInternalPath(piece.GetInternalPaths().at(i)); } + ui->listWidgetPins->clear(); + for (int i = 0; i < piece.GetPins().size(); ++i) + { + NewPin(piece.GetPins().at(i)); + } + ui->comboBoxStartPoint->blockSignals(true); ui->comboBoxStartPoint->clear(); ui->comboBoxStartPoint->blockSignals(false); @@ -598,6 +606,25 @@ void DialogSeamAllowance::ShowInternalPathsContextMenu(const QPoint &pos) } } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos) +{ + const int row = ui->listWidgetPins->currentRow(); + if (ui->listWidgetPins->count() == 0 || row == -1 || row >= ui->listWidgetPins->count()) + { + return; + } + + QMenu *menu = new QMenu(this); + QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete")); + + QAction *selectedAction = menu->exec(ui->listWidgetPins->viewport()->mapToGlobal(pos)); + if (selectedAction == actionDelete) + { + delete ui->listWidgetPins->item(row); + } +} + //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::ListChanged() { @@ -1271,6 +1298,14 @@ VPiece DialogSeamAllowance::CreatePiece() const } piece.SetInternalPaths(iPaths); + QVector pins; + for (qint32 i = 0; i < ui->listWidgetPins->count(); ++i) + { + QListWidgetItem *item = ui->listWidgetPins->item(i); + pins.append(qvariant_cast(item->data(Qt::UserRole))); + } + piece.SetPins(pins); + piece.SetForbidFlipping(ui->checkBoxForbidFlipping->isChecked()); piece.SetSeamAllowance(ui->checkBoxSeams->isChecked()); piece.SetName(ui->lineEditName->text()); @@ -1344,6 +1379,21 @@ void DialogSeamAllowance::NewInternalPath(quint32 path) } } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::NewPin(quint32 pinPoint) +{ + if (pinPoint > NULL_ID) + { + const QSharedPointer pin = data->GetGObject(pinPoint); + + QListWidgetItem *item = new QListWidgetItem(pin->name()); + item->setFont(QFont("Times", 12, QFont::Bold)); + item->setData(Qt::UserRole, QVariant::fromValue(pinPoint)); + ui->listWidgetPins->addItem(item); + ui->listWidgetPins->setCurrentRow(ui->listWidgetPins->count()-1); + } +} + //--------------------------------------------------------------------------------------------------------------------- QString DialogSeamAllowance::GetPathName(quint32 path, bool reverse) const { @@ -1727,6 +1777,14 @@ void DialogSeamAllowance::InitGrainlineTab() m_iLenBaseHeight = ui->lineEditLenFormula->height(); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::InitPinsTab() +{ + ui->listWidgetPins->setContextMenuPolicy(Qt::CustomContextMenu); + connect(ui->listWidgetPins, &QListWidget::customContextMenuRequested, this, + &DialogSeamAllowance::ShowPinsContextMenu); +} + //--------------------------------------------------------------------------------------------------------------------- QString DialogSeamAllowance::GetFormulaSAWidth() const { diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index 94a8b8530..04bda4583 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -77,6 +77,7 @@ private slots: void ShowMainPathContextMenu(const QPoint &pos); void ShowCustomSAContextMenu(const QPoint &pos); void ShowInternalPathsContextMenu(const QPoint &pos); + void ShowPinsContextMenu(const QPoint &pos); void ListChanged(); void EnableSeamAllowance(bool enable); @@ -150,6 +151,7 @@ private: void NewMainPathItem(const VPieceNode &node); void NewCustomSA(const CustomSARecord &record); void NewInternalPath(quint32 path); + void NewPin(quint32 pinPoint); QString GetPathName(quint32 path, bool reverse = false) const; bool MainPathIsValid() const; void ValidObjects(bool value); @@ -176,6 +178,7 @@ private: void InitInternalPathsTab(); void InitPatternPieceDataTab(); void InitGrainlineTab(); + void InitPinsTab(); void SetFormulaSAWidth(const QString &formula); }; diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui b/src/libs/vtools/dialogs/tools/dialogseamallowance.ui index 315098dc5..73d9c4118 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.ui @@ -21,7 +21,7 @@ - 1 + 0 @@ -1527,6 +1527,20 @@ + + + Pins + + + + + + QAbstractItemView::InternalMove + + + + + From 79a1caa4d76d59def3b0570e488d4cd47da8942f Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 14 Feb 2017 15:12:37 +0200 Subject: [PATCH 12/52] Translate path node names. --HG-- branch : feature --- src/libs/vtools/dialogs/tools/dialogtool.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 64463a4c7..39cd7a9b2 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -449,12 +449,18 @@ QString DialogTool::DialogWarningIcon() //--------------------------------------------------------------------------------------------------------------------- QString DialogTool::GetNodeName(const VPieceNode &node) const { - const QSharedPointer obj = data->GeometricObject(node.GetId()); + const QSharedPointer obj = data->GetGObject(node.GetId()); QString name = obj->name(); - if (node.GetTypeTool() != Tool::NodePoint && node.GetReverse()) + if (node.GetTypeTool() != Tool::NodePoint) { - name = QLatin1String("- ") + name; + int bias = 0; + qApp->TrVars()->VariablesToUser(name, 0, obj->name(), bias); + + if (node.GetReverse()) + { + name = QLatin1String("- ") + name; + } } return name; @@ -473,10 +479,8 @@ void DialogTool::NewNodeItem(QListWidget *listWidget, const VPieceNode &node) case (Tool::NodeElArc): case (Tool::NodeSpline): case (Tool::NodeSplinePath): - { name = GetNodeName(node); break; - } default: qDebug()<<"Got wrong tools. Ignore."; return; From 6597f68dad67e65847f934172c5a74cdfb272987 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 14 Feb 2017 17:33:30 +0200 Subject: [PATCH 13/52] Show all pins when tab Pins is active. --HG-- branch : feature --- src/libs/vmisc/def.h | 3 +- .../dialogs/tools/dialogseamallowance.cpp | 90 +++++++++++-------- .../dialogs/tools/dialogseamallowance.h | 9 +- .../dialogs/tools/dialogseamallowance.ui | 2 +- .../vtools/visualization/path/vispath.cpp | 21 +++++ src/libs/vtools/visualization/path/vispath.h | 3 + .../visualization/path/vispiecepins.cpp | 84 +++++++++++++++++ .../vtools/visualization/path/vispiecepins.h | 57 ++++++++++++ .../visualization/path/vistoolpiecepath.cpp | 16 +--- .../vtools/visualization/visualization.pri | 6 +- 10 files changed, 235 insertions(+), 56 deletions(-) create mode 100644 src/libs/vtools/visualization/path/vispiecepins.cpp create mode 100644 src/libs/vtools/visualization/path/vispiecepins.h diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 7234eaa95..c0903a1d9 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -195,7 +195,8 @@ enum class Vis : ToolVisHolderType ToolEllipticalArc, ToolPiece, ToolPiecePath, - ToolPin + ToolPin, + PiecePins }; enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle, diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 54074d27c..d77868741 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -32,6 +32,7 @@ #include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/calculator.h" #include "visualization/path/vistoolpiece.h" +#include "visualization/path/vispiecepins.h" #include "dialogpiecepath.h" #include "../../undocommands/savepiecepathoptions.h" #include "../support/dialogeditwrongformula.h" @@ -73,6 +74,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 & m_mx(0), m_my(0), m_dialog(), + m_visPins(), m_qslMaterials(), m_qslPlacements(), m_conMCP(), @@ -101,6 +103,8 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 & InitGrainlineTab(); InitPinsTab(); + connect(ui->tabWidget, &QTabWidget::currentChanged, this, &DialogSeamAllowance::TabChanged); + flagName = true;//We have default name of piece. ChangeColor(ui->labelEditName, okColor); flagError = MainPathIsValid(); @@ -622,6 +626,7 @@ void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos) if (selectedAction == actionDelete) { delete ui->listWidgetPins->item(row); + TabChanged(ui->tabWidget->currentIndex()); } } @@ -932,6 +937,36 @@ void DialogSeamAllowance::PathDialogClosed(int result) delete m_dialog; } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::TabChanged(int index) +{ + if (ui->tabWidget->indexOf(ui->tabPins) == index) + { + if (m_visPins.isNull()) + { + m_visPins = new VisPiecePins(data); + } + + m_visPins->SetPins(GetPieceInternals(ui->listWidgetPins)); + + if (not qApp->getCurrentScene()->items().contains(m_visPins)) + { + m_visPins->VisualMode(NULL_ID); + } + else + { + m_visPins->RefreshGeometry(); + } + } + else + { + if (not m_visPins.isNull()) + { + delete m_visPins; + } + } +} + //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::UpdateValues() { @@ -1276,47 +1311,16 @@ void DialogSeamAllowance::DeployWidthAfterFormulaTextEdit() VPiece DialogSeamAllowance::CreatePiece() const { VPiece piece; - for (qint32 i = 0; i < ui->listWidgetMainPath->count(); ++i) - { - QListWidgetItem *item = ui->listWidgetMainPath->item(i); - piece.GetPath().Append(qvariant_cast(item->data(Qt::UserRole))); - } - - QVector records; - for (qint32 i = 0; i < ui->listWidgetCustomSA->count(); ++i) - { - QListWidgetItem *item = ui->listWidgetCustomSA->item(i); - records.append(qvariant_cast(item->data(Qt::UserRole))); - } - piece.SetCustomSARecords(records); - - QVector iPaths; - for (qint32 i = 0; i < ui->listWidgetInternalPaths->count(); ++i) - { - QListWidgetItem *item = ui->listWidgetInternalPaths->item(i); - iPaths.append(qvariant_cast(item->data(Qt::UserRole))); - } - piece.SetInternalPaths(iPaths); - - QVector pins; - for (qint32 i = 0; i < ui->listWidgetPins->count(); ++i) - { - QListWidgetItem *item = ui->listWidgetPins->item(i); - pins.append(qvariant_cast(item->data(Qt::UserRole))); - } - piece.SetPins(pins); - + piece.GetPath().SetNodes(GetPieceInternals(ui->listWidgetMainPath)); + piece.SetCustomSARecords(GetPieceInternals(ui->listWidgetCustomSA)); + piece.SetInternalPaths(GetPieceInternals(ui->listWidgetInternalPaths)); + piece.SetPins(GetPieceInternals(ui->listWidgetPins)); piece.SetForbidFlipping(ui->checkBoxForbidFlipping->isChecked()); piece.SetSeamAllowance(ui->checkBoxSeams->isChecked()); piece.SetName(ui->lineEditName->text()); piece.SetMx(m_mx); piece.SetMy(m_my); - - QString width = ui->plainTextEditFormulaWidth->toPlainText(); - width.replace("\n", " "); - width = qApp->TrVars()->TryFormulaFromUser(width, qApp->Settings()->GetOsSeparator()); - piece.SetFormulaSAWidth(width, m_saWidth); - + piece.SetFormulaSAWidth(GetFormulaFromUser(ui->plainTextEditFormulaWidth), m_saWidth); piece.GetPatternPieceData().SetLetter(ui->lineEditLetter->text()); for (int i = 0; i < m_conMCP.count(); ++i) @@ -1849,3 +1853,17 @@ void DialogSeamAllowance::ClearFields() ui->spinBoxCutNumber->setValue(0); ui->comboBoxPlacement->setCurrentIndex(0); } + +//--------------------------------------------------------------------------------------------------------------------- +template +QVector DialogSeamAllowance::GetPieceInternals(const QListWidget *list) const +{ + SCASSERT(list != nullptr) + QVector internals; + for (qint32 i = 0; i < list->count(); ++i) + { + QListWidgetItem *item = list->item(i); + internals.append(qvariant_cast(item->data(Qt::UserRole))); + } + return internals; +} diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index 04bda4583..94c2e04d7 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -40,6 +40,8 @@ namespace Ui class DialogSeamAllowance; } +class VisPiecePins; + class DialogSeamAllowance : public DialogTool { Q_OBJECT @@ -90,6 +92,7 @@ private slots: void ReturnDefAfter(); void CustomSAChanged(int row); void PathDialogClosed(int result); + void TabChanged(int index); void UpdateValues(); void SetAddMode(); @@ -125,7 +128,8 @@ private: qreal m_mx; qreal m_my; - QPointer m_dialog; + QPointer m_dialog; + QPointer m_visPins; QStringList m_qslMaterials; QStringList m_qslPlacements; @@ -181,6 +185,9 @@ private: void InitPinsTab(); void SetFormulaSAWidth(const QString &formula); + + template + QVector GetPieceInternals(const QListWidget *list) const; }; #endif // DIALOGSEAMALLOWANCE_H diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui b/src/libs/vtools/dialogs/tools/dialogseamallowance.ui index 73d9c4118..c9139733a 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.ui @@ -21,7 +21,7 @@ - 0 + 3 diff --git a/src/libs/vtools/visualization/path/vispath.cpp b/src/libs/vtools/visualization/path/vispath.cpp index ff1bbdabf..9fc28c8c4 100644 --- a/src/libs/vtools/visualization/path/vispath.cpp +++ b/src/libs/vtools/visualization/path/vispath.cpp @@ -34,6 +34,7 @@ #include "../vmisc/vabstractapplication.h" #include "../vpatterndb/vcontainer.h" #include "../visualization.h" +#include "../vwidgets/vsimplepoint.h" //--------------------------------------------------------------------------------------------------------------------- VisPath::VisPath(const VContainer *data, QGraphicsItem *parent) @@ -59,3 +60,23 @@ void VisPath::AddOnScene() { AddItem(this); } + +//--------------------------------------------------------------------------------------------------------------------- +VSimplePoint *VisPath::GetPoint(QVector &points, quint32 i, const QColor &color) +{ + if (not points.isEmpty() && static_cast(points.size() - 1) >= i) + { + return points.at(static_cast(i)); + } + else + { + VSimplePoint *point = new VSimplePoint(NULL_ID, color, *Visualization::data->GetPatternUnit(), &factor); + point->SetPointHighlight(true); + point->setParentItem(this); + point->SetVisualizationMode(true); + points.append(point); + + return point; + } + return nullptr; +} diff --git a/src/libs/vtools/visualization/path/vispath.h b/src/libs/vtools/visualization/path/vispath.h index 3e42e952f..38c50462e 100644 --- a/src/libs/vtools/visualization/path/vispath.h +++ b/src/libs/vtools/visualization/path/vispath.h @@ -41,6 +41,7 @@ #include "../vmisc/def.h" class VContainer; +class VSimplePoint; class VisPath : public Visualization, public QGraphicsPathItem { @@ -54,6 +55,8 @@ public: protected: virtual void InitPen() Q_DECL_OVERRIDE; virtual void AddOnScene() Q_DECL_OVERRIDE; + + VSimplePoint *GetPoint(QVector &points, quint32 i, const QColor &color); private: Q_DISABLE_COPY(VisPath) }; diff --git a/src/libs/vtools/visualization/path/vispiecepins.cpp b/src/libs/vtools/visualization/path/vispiecepins.cpp new file mode 100644 index 000000000..7c17fff7d --- /dev/null +++ b/src/libs/vtools/visualization/path/vispiecepins.cpp @@ -0,0 +1,84 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 14 2, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#include "vispiecepins.h" +#include "../vwidgets/vsimplepoint.h" +#include "../vgeometry/vpointf.h" + +//--------------------------------------------------------------------------------------------------------------------- +VisPiecePins::VisPiecePins(const VContainer *data, QGraphicsItem *parent) + : VisPath(data, parent), + m_points(), + m_pins() +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +VisPiecePins::~VisPiecePins() +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisPiecePins::RefreshGeometry() +{ + HideAllItems(); + + for (int i = 0; i < m_pins.size(); ++i) + { + VSimplePoint *point = GetPoint(static_cast(i), supportColor); + point->SetOnlyPoint(false); + const QSharedPointer p = Visualization::data->GeometricObject(m_pins.at(i)); + point->RefreshGeometry(*p); + point->setVisible(true); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisPiecePins::SetPins(const QVector &pins) +{ + m_pins = pins; +} + +//--------------------------------------------------------------------------------------------------------------------- +VSimplePoint *VisPiecePins::GetPoint(quint32 i, const QColor &color) +{ + return VisPath::GetPoint(m_points, i, color); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VisPiecePins::HideAllItems() +{ + for (int i=0; i < m_points.size(); ++i) + { + if (QGraphicsEllipseItem *item = m_points.at(i)) + { + item->setVisible(false); + } + } +} + diff --git a/src/libs/vtools/visualization/path/vispiecepins.h b/src/libs/vtools/visualization/path/vispiecepins.h new file mode 100644 index 000000000..6e874099d --- /dev/null +++ b/src/libs/vtools/visualization/path/vispiecepins.h @@ -0,0 +1,57 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 14 2, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef VISPIECEPINS_H +#define VISPIECEPINS_H + +#include "vispath.h" + +class VSimplePoint; + +class VisPiecePins : public VisPath +{ + Q_OBJECT +public: + VisPiecePins(const VContainer *data, QGraphicsItem *parent = nullptr); + virtual ~VisPiecePins(); + + virtual void RefreshGeometry() Q_DECL_OVERRIDE; + void SetPins(const QVector &pins); + virtual int type() const Q_DECL_OVERRIDE {return Type;} + enum { Type = UserType + static_cast(Vis::PiecePins)}; +private: + Q_DISABLE_COPY(VisPiecePins) + QVector m_points; + QVector m_pins; + + VSimplePoint *GetPoint(quint32 i, const QColor &color); + + void HideAllItems(); +}; + +#endif // VISPIECEPINS_H diff --git a/src/libs/vtools/visualization/path/vistoolpiecepath.cpp b/src/libs/vtools/visualization/path/vistoolpiecepath.cpp index a5e294f2a..46bc4ea55 100644 --- a/src/libs/vtools/visualization/path/vistoolpiecepath.cpp +++ b/src/libs/vtools/visualization/path/vistoolpiecepath.cpp @@ -91,21 +91,7 @@ void VisToolPiecePath::mousePressEvent(QGraphicsSceneMouseEvent *event) //--------------------------------------------------------------------------------------------------------------------- VSimplePoint *VisToolPiecePath::GetPoint(quint32 i, const QColor &color) { - if (not m_points.isEmpty() && static_cast(m_points.size() - 1) >= i) - { - return m_points.at(static_cast(i)); - } - else - { - VSimplePoint *point = new VSimplePoint(NULL_ID, color, *Visualization::data->GetPatternUnit(), &factor); - point->SetPointHighlight(true); - point->setParentItem(this); - point->SetVisualizationMode(true); - m_points.append(point); - - return point; - } - return nullptr; + return VisPath::GetPoint(m_points, i, color); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/visualization.pri b/src/libs/vtools/visualization/visualization.pri index 042360691..1f822647e 100644 --- a/src/libs/vtools/visualization/visualization.pri +++ b/src/libs/vtools/visualization/visualization.pri @@ -41,7 +41,8 @@ HEADERS += \ $$PWD/path/vistoolellipticalarc.h \ $$PWD/path/vistoolpiece.h \ $$PWD/path/vistoolpiecepath.h \ - $$PWD/line/vistoolpin.h + $$PWD/line/vistoolpin.h \ + $$PWD/path/vispiecepins.h SOURCES += \ $$PWD/visualization.cpp \ @@ -83,4 +84,5 @@ SOURCES += \ $$PWD/path/vistoolellipticalarc.cpp \ $$PWD/path/vistoolpiece.cpp \ $$PWD/path/vistoolpiecepath.cpp \ - $$PWD/line/vistoolpin.cpp + $$PWD/line/vistoolpin.cpp \ + $$PWD/path/vispiecepins.cpp From a3d27bf9dbffd10f824b7625b86b0e0872d015ea Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 15 Feb 2017 15:23:04 +0200 Subject: [PATCH 14/52] Refacoring. Use marcos for getting current combobox data. --HG-- branch : feature --- .../configpages/tapeconfigurationpage.cpp | 24 ++------- src/app/tape/dialogs/dialogexporttocsv.cpp | 6 +-- .../tape/dialogs/dialognewmeasurements.cpp | 33 ++---------- .../dialogs/configpages/configurationpage.cpp | 25 ++------- .../dialogs/dialoglayoutsettings.cpp | 21 ++------ .../valentina/dialogs/dialogsavelayout.cpp | 6 +-- src/libs/vmisc/def.h | 5 ++ src/libs/vtools/dialogs/tools/dialogline.cpp | 12 +---- .../vtools/dialogs/tools/dialogpiecepath.cpp | 53 +++---------------- 9 files changed, 33 insertions(+), 152 deletions(-) diff --git a/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp index 6daefc9b0..0e873df21 100644 --- a/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp +++ b/src/app/tape/dialogs/configpages/tapeconfigurationpage.cpp @@ -234,18 +234,10 @@ QGroupBox *TapeConfigurationPage::PMSystemGroup() connect(systemCombo, static_cast(&QComboBox::currentIndexChanged), RECEIVER(this)[this]() { systemChanged = true; - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString()); - #else - QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString()); - #endif + QString text = qApp->TrVars()->PMSystemAuthor(CURRENT_DATA(systemCombo).toString()); systemAuthorValueLabel->setText(text); systemAuthorValueLabel->setToolTip(text); - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString()); - #else - text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString()); - #endif + text = qApp->TrVars()->PMSystemBook(CURRENT_DATA(systemCombo).toString()); systemBookValueLabel->setPlainText(text); }); @@ -337,18 +329,10 @@ void TapeConfigurationPage::RetranslateUi() systemAuthorLabel->setText(tr("Author:")); systemBookLabel->setText(tr("Book:")); -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString()); -#else - QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString()); -#endif + QString text = qApp->TrVars()->PMSystemAuthor(CURRENT_DATA(systemCombo).toString()); systemAuthorValueLabel->setText(text); systemAuthorValueLabel->setToolTip(text); -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString()); -#else - text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString()); -#endif + text = qApp->TrVars()->PMSystemBook(CURRENT_DATA(systemCombo).toString()); systemBookValueLabel->setPlainText(text); gradationGroup->setTitle(tr("Default height and size")); diff --git a/src/app/tape/dialogs/dialogexporttocsv.cpp b/src/app/tape/dialogs/dialogexporttocsv.cpp index 8164a437b..81a4b10c3 100644 --- a/src/app/tape/dialogs/dialogexporttocsv.cpp +++ b/src/app/tape/dialogs/dialogexporttocsv.cpp @@ -81,11 +81,7 @@ bool DialogExportToCSV::WithHeader() const //--------------------------------------------------------------------------------------------------------------------- int DialogExportToCSV::SelectedMib() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - return ui->comboBoxCodec->itemData(ui->comboBoxCodec->currentIndex()).toInt(); -#else - return ui->comboBoxCodec->currentData().toInt(); -#endif + return CURRENT_DATA(ui->comboBoxCodec).toInt(); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/tape/dialogs/dialognewmeasurements.cpp b/src/app/tape/dialogs/dialognewmeasurements.cpp index 11dbfa6bf..59eab4922 100644 --- a/src/app/tape/dialogs/dialognewmeasurements.cpp +++ b/src/app/tape/dialogs/dialognewmeasurements.cpp @@ -80,21 +80,13 @@ DialogNewMeasurements::~DialogNewMeasurements() //--------------------------------------------------------------------------------------------------------------------- MeasurementsType DialogNewMeasurements::Type() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - return static_cast(ui->comboBoxMType->itemData(ui->comboBoxMType->currentIndex()).toInt()); -#else - return static_cast(ui->comboBoxMType->currentData().toInt()); -#endif + return static_cast(CURRENT_DATA(ui->comboBoxMType).toInt()); } //--------------------------------------------------------------------------------------------------------------------- Unit DialogNewMeasurements::MUnit() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - return static_cast(ui->comboBoxUnit->itemData(ui->comboBoxUnit->currentIndex()).toInt()); -#else - return static_cast(ui->comboBoxUnit->currentData().toInt()); -#endif + return static_cast(CURRENT_DATA(ui->comboBoxUnit).toInt()); } //--------------------------------------------------------------------------------------------------------------------- @@ -117,14 +109,7 @@ void DialogNewMeasurements::changeEvent(QEvent *event) // retranslate designer form (single inheritance approach) ui->retranslateUi(this); InitMTypes(); - - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const MeasurementsType type = - static_cast(ui->comboBoxMType->itemData(ui->comboBoxMType->currentIndex()).toInt()); - #else - const MeasurementsType type = static_cast(ui->comboBoxMType->currentData().toInt()); - #endif - InitUnits(type); + InitUnits(static_cast(CURRENT_DATA(ui->comboBoxMType).toInt())); } // remember to call base class implementation @@ -192,11 +177,7 @@ void DialogNewMeasurements::InitMTypes() int val = static_cast(MeasurementsType::Unknown); if (ui->comboBoxMType->currentIndex() != -1) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - val = ui->comboBoxMType->itemData(ui->comboBoxMType->currentIndex()).toInt(); - #else - val = ui->comboBoxMType->currentData().toInt(); - #endif + val = CURRENT_DATA(ui->comboBoxMType).toInt(); } ui->comboBoxMType->blockSignals(true); @@ -234,11 +215,7 @@ void DialogNewMeasurements::InitUnits(const MeasurementsType &type) int val = static_cast(Unit::Cm); if (ui->comboBoxUnit->currentIndex() != -1) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - val = ui->comboBoxUnit->itemData(ui->comboBoxUnit->currentIndex()).toInt(); - #else - val = ui->comboBoxUnit->currentData().toInt(); - #endif + val = CURRENT_DATA(ui->comboBoxUnit).toInt(); } ui->comboBoxUnit->blockSignals(true); diff --git a/src/app/valentina/dialogs/configpages/configurationpage.cpp b/src/app/valentina/dialogs/configpages/configurationpage.cpp index 3290cf9a0..940ce3353 100644 --- a/src/app/valentina/dialogs/configpages/configurationpage.cpp +++ b/src/app/valentina/dialogs/configpages/configurationpage.cpp @@ -395,19 +395,11 @@ QGroupBox *ConfigurationPage::ToolBarGroup() void ConfigurationPage::SystemChanged() { systemChanged = true; -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString()); -#else - QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString()); -#endif + QString text = qApp->TrVars()->PMSystemAuthor(CURRENT_DATA(systemCombo).toString()); systemAuthorValueLabel->setText(text); systemAuthorValueLabel->setToolTip(text); -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString()); -#else - text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString()); -#endif + text = qApp->TrVars()->PMSystemBook(CURRENT_DATA(systemCombo).toString()); systemBookValueLabel->setPlainText(text); } @@ -470,18 +462,11 @@ void ConfigurationPage::RetranslateUi() systemAuthorLabel->setText(tr("Author:")); systemBookLabel->setText(tr("Book:")); -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->itemData(systemCombo->currentIndex()).toString()); -#else - QString text = qApp->TrVars()->PMSystemAuthor(systemCombo->currentData().toString()); -#endif + QString text = qApp->TrVars()->PMSystemAuthor(CURRENT_DATA(systemCombo).toString()); systemAuthorValueLabel->setText(text); systemAuthorValueLabel->setToolTip(text); -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - text = qApp->TrVars()->PMSystemBook(systemCombo->itemData(systemCombo->currentIndex()).toString()); -#else - text = qApp->TrVars()->PMSystemBook(systemCombo->currentData().toString()); -#endif + + text = qApp->TrVars()->PMSystemBook(CURRENT_DATA(systemCombo).toString()); systemBookValueLabel->setPlainText(text); sendGroup->setTitle(tr("Send crash reports")); diff --git a/src/app/valentina/dialogs/dialoglayoutsettings.cpp b/src/app/valentina/dialogs/dialoglayoutsettings.cpp index cbe13ec07..51f5ace45 100644 --- a/src/app/valentina/dialogs/dialoglayoutsettings.cpp +++ b/src/app/valentina/dialogs/dialoglayoutsettings.cpp @@ -823,12 +823,7 @@ QString DialogLayoutSettings::MakeHelpTemplateList() QSizeF DialogLayoutSettings::Template() { PaperSizeTemplate temp; -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - temp = static_cast(ui->comboBoxTemplates->itemData(ui->comboBoxTemplates->currentIndex()) - .toInt()); -#else - temp = static_cast(ui->comboBoxTemplates->currentData().toInt()); -#endif + temp = static_cast(CURRENT_DATA(ui->comboBoxTemplates).toInt()); switch (temp) { @@ -980,23 +975,13 @@ QMarginsF DialogLayoutSettings::GetDefPrinterFields() const //--------------------------------------------------------------------------------------------------------------------- Unit DialogLayoutSettings::PaperUnit() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - return VDomDocument::StrToUnits(ui->comboBoxPaperSizeUnit->itemData(ui->comboBoxPaperSizeUnit->currentIndex()) - .toString()); -#else - return VDomDocument::StrToUnits(ui->comboBoxPaperSizeUnit->currentData().toString()); -#endif + return VDomDocument::StrToUnits(CURRENT_DATA(ui->comboBoxPaperSizeUnit).toString()); } //--------------------------------------------------------------------------------------------------------------------- Unit DialogLayoutSettings::LayoutUnit() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - return VDomDocument::StrToUnits(ui->comboBoxLayoutUnit->itemData(ui->comboBoxLayoutUnit->currentIndex()) - .toString()); -#else - return VDomDocument::StrToUnits(ui->comboBoxLayoutUnit->currentData().toString()); -#endif + return VDomDocument::StrToUnits(CURRENT_DATA(ui->comboBoxLayoutUnit).toString()); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/dialogs/dialogsavelayout.cpp b/src/app/valentina/dialogs/dialogsavelayout.cpp index 8044caf97..31fe77bce 100644 --- a/src/app/valentina/dialogs/dialogsavelayout.cpp +++ b/src/app/valentina/dialogs/dialogsavelayout.cpp @@ -195,11 +195,7 @@ QString DialogSaveLayout::FileName() const //--------------------------------------------------------------------------------------------------------------------- QString DialogSaveLayout::Format() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - return ui->comboBoxFormat->itemData(ui->comboBoxFormat->currentIndex()).toString(); -#else - return ui->comboBoxFormat->currentData().toString(); -#endif + return CURRENT_DATA(ui->comboBoxFormat).toString(); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index c0903a1d9..c89d93075 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -59,6 +59,11 @@ template class QSharedPointer; #define RECEIVER(obj) #endif +#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) +#define CURRENT_DATA(box) box->itemData(box->currentIndex()) +#else +#define CURRENT_DATA(box) box->currentData() +#endif class QComboBox; class QMarginsF; diff --git a/src/libs/vtools/dialogs/tools/dialogline.cpp b/src/libs/vtools/dialogs/tools/dialogline.cpp index 923091334..121c65ddb 100644 --- a/src/libs/vtools/dialogs/tools/dialogline.cpp +++ b/src/libs/vtools/dialogs/tools/dialogline.cpp @@ -219,11 +219,7 @@ void DialogLine::ChosenObject(quint32 id, const SceneObject &type) */ quint32 DialogLine::GetFirstPoint() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - return qvariant_cast(ui->comboBoxFirstPoint->itemData(ui->comboBoxFirstPoint->currentIndex())); -#else - return qvariant_cast(ui->comboBoxFirstPoint->currentData()); -#endif + return qvariant_cast(CURRENT_DATA(ui->comboBoxFirstPoint)); } //--------------------------------------------------------------------------------------------------------------------- @@ -233,11 +229,7 @@ quint32 DialogLine::GetFirstPoint() const */ quint32 DialogLine::GetSecondPoint() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - return qvariant_cast(ui->comboBoxSecondPoint->itemData(ui->comboBoxSecondPoint->currentIndex())); -#else - return qvariant_cast(ui->comboBoxSecondPoint->currentData()); -#endif + return qvariant_cast(CURRENT_DATA(ui->comboBoxSecondPoint)); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp index d564d75dd..cd8097aac 100644 --- a/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogpiecepath.cpp @@ -298,13 +298,8 @@ void DialogPiecePath::NodeChanged(int index) if (index != -1) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 id = ui->comboBoxNodes->itemData(index).toUInt(); - #else - const quint32 id = ui->comboBoxNodes->currentData().toUInt(); - #endif const VPiecePath path = CreatePath(); - const int nodeIndex = path.indexOfNode(id); + const int nodeIndex = path.indexOfNode(CURRENT_DATA(ui->comboBoxNodes).toUInt()); if (nodeIndex != -1) { const VPieceNode &node = path.at(nodeIndex); @@ -598,11 +593,7 @@ void DialogPiecePath::InitPathTypes() //--------------------------------------------------------------------------------------------------------------------- void DialogPiecePath::InitNodesList() { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 id = ui->comboBoxNodes->itemData(ui->comboBoxNodes->currentIndex()).toUInt(); -#else - const quint32 id = ui->comboBoxNodes->currentData().toUInt(); -#endif + const quint32 id = CURRENT_DATA(ui->comboBoxNodes).toUInt(); ui->comboBoxNodes->blockSignals(true); ui->comboBoxNodes->clear(); @@ -639,21 +630,10 @@ void DialogPiecePath::NodeAngleChanged(int index) const int i = ui->comboBoxNodes->currentIndex(); if (i != -1 && index != -1) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 id = ui->comboBoxNodes->itemData(i).toUInt(); - #else - const quint32 id = ui->comboBoxNodes->currentData().toUInt(); - #endif - - QListWidgetItem *rowItem = GetItemById(id); + QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt()); if (rowItem) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const PieceNodeAngle angle = static_cast(ui->comboBoxAngle->itemData(index).toUInt()); - #else - const PieceNodeAngle angle = static_cast(ui->comboBoxAngle->currentData().toUInt()); - #endif - + const PieceNodeAngle angle = static_cast(CURRENT_DATA(ui->comboBoxAngle).toUInt()); VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); rowNode.SetAngleType(angle); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); @@ -694,14 +674,7 @@ void DialogPiecePath::SetPiecePath(const VPiecePath &path) //--------------------------------------------------------------------------------------------------------------------- PiecePathType DialogPiecePath::GetType() const { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const PiecePathType type = - static_cast(ui->comboBoxType->itemData(ui->comboBoxType->currentIndex()).toInt()); -#else - const PiecePathType type = static_cast(ui->comboBoxType->currentData().toInt()); -#endif - - return type; + return static_cast(CURRENT_DATA(ui->comboBoxType).toInt()); } //--------------------------------------------------------------------------------------------------------------------- @@ -781,13 +754,7 @@ void DialogPiecePath::UpdateNodeSABefore(const QString &formula) const int index = ui->comboBoxNodes->currentIndex(); if (index != -1) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 id = ui->comboBoxNodes->itemData(index).toUInt(); - #else - const quint32 id = ui->comboBoxNodes->currentData().toUInt(); - #endif - - QListWidgetItem *rowItem = GetItemById(id); + QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt()); if (rowItem) { VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); @@ -803,13 +770,7 @@ void DialogPiecePath::UpdateNodeSAAfter(const QString &formula) const int index = ui->comboBoxNodes->currentIndex(); if (index != -1) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 id = ui->comboBoxNodes->itemData(index).toUInt(); - #else - const quint32 id = ui->comboBoxNodes->currentData().toUInt(); - #endif - - QListWidgetItem *rowItem = GetItemById(id); + QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt()); if (rowItem) { VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); From ff2d9c28fefd79cd106b3d44bc0cc26476f87874 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 15 Feb 2017 15:32:48 +0200 Subject: [PATCH 15/52] Init all pin comboboxes. --HG-- branch : feature --- .../dialogs/tools/dialogseamallowance.cpp | 158 +++++++++--------- .../dialogs/tools/dialogseamallowance.h | 2 + .../dialogs/tools/dialogseamallowance.ui | 124 ++++++++++++-- 3 files changed, 186 insertions(+), 98 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index d77868741..35a036544 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -172,6 +172,8 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) NewPin(piece.GetPins().at(i)); } + InitAllPinComboboxes(); + ui->comboBoxStartPoint->blockSignals(true); ui->comboBoxStartPoint->clear(); ui->comboBoxStartPoint->blockSignals(false); @@ -194,8 +196,8 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) m_my = piece.GetMy(); ui->lineEditLetter->setText(piece.GetPatternPieceData().GetLetter()); - ui->checkBoxDetail->setChecked(piece.GetPatternPieceData().IsVisible()); - ui->checkBoxPattern->setChecked(piece.GetPatternInfo().IsVisible()); + ui->groupBoxDetailLabel->setChecked(piece.GetPatternPieceData().IsVisible()); + ui->groupBoxPatternLabel->setChecked(piece.GetPatternInfo().IsVisible()); m_conMCP.clear(); for (int i = 0; i < piece.GetPatternPieceData().GetMCPCount(); ++i) @@ -385,11 +387,7 @@ void DialogSeamAllowance::AddUpdate() MaterialCutPlacement mcp; QStringList qslUserMaterials = qApp->Settings()->GetUserDefinedMaterials(); -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - int i = ui->comboBoxMaterial->itemData(ui->comboBoxMaterial->currentIndex()).toInt(); -#else - int i = ui->comboBoxMaterial->currentData().toInt(); -#endif + const int i = CURRENT_DATA(ui->comboBoxMaterial).toInt(); QString qsMat = ui->comboBoxMaterial->currentText(); if (i < m_qslMaterials.count() && qsMat == m_qslMaterials[i]) { @@ -627,6 +625,7 @@ void DialogSeamAllowance::ShowPinsContextMenu(const QPoint &pos) { delete ui->listWidgetPins->item(row); TabChanged(ui->tabWidget->currentIndex()); + InitAllPinComboboxes(); } } @@ -673,13 +672,8 @@ void DialogSeamAllowance::NodeChanged(int index) if (index != -1) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 id = ui->comboBoxNodes->itemData(index).toUInt(); - #else - const quint32 id = ui->comboBoxNodes->currentData().toUInt(); - #endif const VPiece piece = CreatePiece(); - const int nodeIndex = piece.GetPath().indexOfNode(id); + const int nodeIndex = piece.GetPath().indexOfNode(CURRENT_DATA(ui->comboBoxNodes).toUInt()); if (nodeIndex != -1) { const VPieceNode &node = piece.GetPath().at(nodeIndex); @@ -733,71 +727,54 @@ void DialogSeamAllowance::NodeChanged(int index) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::CSAStartPointChanged(int index) { + Q_UNUSED(index); + const int row = ui->listWidgetCustomSA->currentRow(); if (ui->listWidgetCustomSA->count() == 0 || row == -1 || row >= ui->listWidgetCustomSA->count()) { return; } -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 startPoint = ui->comboBoxStartPoint->itemData(index).toUInt(); -#else - Q_UNUSED(index); - const quint32 startPoint = ui->comboBoxStartPoint->currentData().toUInt(); -#endif - QListWidgetItem *rowItem = ui->listWidgetCustomSA->item(row); SCASSERT(rowItem != nullptr); CustomSARecord record = qvariant_cast(rowItem->data(Qt::UserRole)); - record.startPoint = startPoint; + record.startPoint = CURRENT_DATA(ui->comboBoxStartPoint).toUInt(); rowItem->setData(Qt::UserRole, QVariant::fromValue(record)); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::CSAEndPointChanged(int index) { + Q_UNUSED(index); + const int row = ui->listWidgetCustomSA->currentRow(); if (ui->listWidgetCustomSA->count() == 0 || row == -1 || row >= ui->listWidgetCustomSA->count()) { return; } -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 endPoint = ui->comboBoxEndPoint->itemData(index).toUInt(); -#else - Q_UNUSED(index); - const quint32 endPoint = ui->comboBoxEndPoint->currentData().toUInt(); -#endif - QListWidgetItem *rowItem = ui->listWidgetCustomSA->item(row); SCASSERT(rowItem != nullptr); CustomSARecord record = qvariant_cast(rowItem->data(Qt::UserRole)); - record.endPoint = endPoint; + record.endPoint = CURRENT_DATA(ui->comboBoxEndPoint).toUInt(); rowItem->setData(Qt::UserRole, QVariant::fromValue(record)); } //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::CSAIncludeTypeChanged(int index) { + Q_UNUSED(index); + const int row = ui->listWidgetCustomSA->currentRow(); if (ui->listWidgetCustomSA->count() == 0 || row == -1 || row >= ui->listWidgetCustomSA->count()) { return; } -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const PiecePathIncludeType type = - static_cast(ui->comboBoxIncludeType->itemData(index).toUInt()); -#else - Q_UNUSED(index); - const PiecePathIncludeType type = - static_cast(ui->comboBoxIncludeType->currentData().toUInt()); -#endif - QListWidgetItem *rowItem = ui->listWidgetCustomSA->item(row); SCASSERT(rowItem != nullptr); CustomSARecord record = qvariant_cast(rowItem->data(Qt::UserRole)); - record.includeType = type; + record.includeType = static_cast(CURRENT_DATA(ui->comboBoxIncludeType).toUInt()); rowItem->setData(Qt::UserRole, QVariant::fromValue(record)); } @@ -807,23 +784,11 @@ void DialogSeamAllowance::NodeAngleChanged(int index) const int i = ui->comboBoxNodes->currentIndex(); if (i != -1 && index != -1) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 id = ui->comboBoxNodes->itemData(i).toUInt(); - #else - const quint32 id = ui->comboBoxNodes->currentData().toUInt(); - #endif - - QListWidgetItem *rowItem = GetItemById(id); + QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt()); if (rowItem) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const PieceNodeAngle angle = static_cast(ui->comboBoxAngle->itemData(index).toUInt()); - #else - const PieceNodeAngle angle = static_cast(ui->comboBoxAngle->currentData().toUInt()); - #endif - VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); - rowNode.SetAngleType(angle); + rowNode.SetAngleType(static_cast(CURRENT_DATA(ui->comboBoxAngle).toUInt())); rowItem->setData(Qt::UserRole, QVariant::fromValue(rowNode)); ListChanged(); @@ -1333,10 +1298,10 @@ VPiece DialogSeamAllowance::CreatePiece() const piece.GetPatternPieceData().SetLabelHeight(m_oldData.GetLabelHeight()); piece.GetPatternPieceData().SetFontSize(m_oldData.GetFontSize()); piece.GetPatternPieceData().SetRotation(m_oldData.GetRotation()); - piece.GetPatternPieceData().SetVisible(ui->checkBoxDetail->isChecked()); + piece.GetPatternPieceData().SetVisible(ui->groupBoxDetailLabel->isChecked()); piece.GetPatternInfo() = m_oldGeom; - piece.GetPatternInfo().SetVisible(ui->checkBoxPattern->isChecked()); + piece.GetPatternInfo().SetVisible(ui->groupBoxPatternLabel->isChecked()); piece.GetGrainlineGeometry() = m_oldGrainline; piece.GetGrainlineGeometry().SetVisible(ui->checkBoxGrainline->isChecked()); @@ -1480,20 +1445,16 @@ bool DialogSeamAllowance::MainPathIsClockwise() const //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitNodesList() { -#if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 id = ui->comboBoxNodes->itemData(ui->comboBoxNodes->currentIndex()).toUInt(); -#else - const quint32 id = ui->comboBoxNodes->currentData().toUInt(); -#endif + const quint32 id = CURRENT_DATA(ui->comboBoxNodes).toUInt(); ui->comboBoxNodes->blockSignals(true); ui->comboBoxNodes->clear(); - const VPiece piece = CreatePiece(); + const QVector nodes = GetPieceInternals(ui->listWidgetMainPath); - for (int i = 0; i < piece.GetPath().CountNodes(); ++i) + for (int i = 0; i < nodes.size(); ++i) { - const VPieceNode node = piece.GetPath().at(i); + const VPieceNode node = nodes.at(i); if (node.GetTypeTool() == Tool::NodePoint) { const QString name = GetNodeName(node); @@ -1567,13 +1528,7 @@ void DialogSeamAllowance::UpdateNodeSABefore(const QString &formula) const int index = ui->comboBoxNodes->currentIndex(); if (index != -1) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 id = ui->comboBoxNodes->itemData(index).toUInt(); - #else - const quint32 id = ui->comboBoxNodes->currentData().toUInt(); - #endif - - QListWidgetItem *rowItem = GetItemById(id); + QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt()); if (rowItem) { VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); @@ -1589,13 +1544,7 @@ void DialogSeamAllowance::UpdateNodeSAAfter(const QString &formula) const int index = ui->comboBoxNodes->currentIndex(); if (index != -1) { - #if QT_VERSION < QT_VERSION_CHECK(5, 2, 0) - const quint32 id = ui->comboBoxNodes->itemData(index).toUInt(); - #else - const quint32 id = ui->comboBoxNodes->currentData().toUInt(); - #endif - - QListWidgetItem *rowItem = GetItemById(id); + QListWidgetItem *rowItem = GetItemById(CURRENT_DATA(ui->comboBoxNodes).toUInt()); if (rowItem) { VPieceNode rowNode = qvariant_cast(rowItem->data(Qt::UserRole)); @@ -1689,11 +1638,11 @@ void DialogSeamAllowance::InitCSAPoint(QComboBox *box) box->clear(); box->addItem(tr("Empty"), NULL_ID); - const VPiece piece = CreatePiece(); + const QVector nodes = GetPieceInternals(ui->listWidgetMainPath); - for (int i = 0; i < piece.GetPath().CountNodes(); ++i) + for (int i = 0; i < nodes.size(); ++i) { - const VPieceNode &node = piece.GetPath().at(i); + const VPieceNode &node = nodes.at(i); if (node.GetTypeTool() == Tool::NodePoint) { const QString name = GetNodeName(node); @@ -1702,6 +1651,35 @@ void DialogSeamAllowance::InitCSAPoint(QComboBox *box) } } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::InitPinPoint(QComboBox *box) +{ + SCASSERT(box != nullptr); + + quint32 currentId = NULL_ID; + if (box->count() > 0) + { + currentId = CURRENT_DATA(box).toUInt(); + } + + box->clear(); + box->addItem(QLatin1String("<") + tr("no pin") + QLatin1String(">"), NULL_ID); + + const QVector pins = GetPieceInternals(ui->listWidgetPins); + + for (int i = 0; i < pins.size(); ++i) + { + const QSharedPointer pin = data->GetGObject(pins.at(i)); + box->addItem(pin->name(), pins.at(i)); + } + + const int index = ui->comboBoxNodes->findData(currentId); + if (index != -1) + { + box->setCurrentIndex(index); + } +} + //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitSAIncludeType() { @@ -1728,6 +1706,11 @@ void DialogSeamAllowance::InitPatternPieceDataTab() ui->lineEditLetter->setClearButtonEnabled(true); #endif + InitPinPoint(ui->comboBoxDetailLabelTopLeftPin); + InitPinPoint(ui->comboBoxDetailLabelBottomRightPin); + InitPinPoint(ui->comboBoxPatternLabelTopLeftPin); + InitPinPoint(ui->comboBoxPatternLabelBottomRightPin); + connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogSeamAllowance::NameDetailChanged); m_qslMaterials << QApplication::translate("Detail", "Fabric", 0) @@ -1779,6 +1762,9 @@ void DialogSeamAllowance::InitGrainlineTab() m_iRotBaseHeight = ui->lineEditRotFormula->height(); m_iLenBaseHeight = ui->lineEditLenFormula->height(); + + InitPinPoint(ui->comboBoxGrainlineTopPin); + InitPinPoint(ui->comboBoxGrainlineBottomPin); } //--------------------------------------------------------------------------------------------------------------------- @@ -1789,6 +1775,18 @@ void DialogSeamAllowance::InitPinsTab() &DialogSeamAllowance::ShowPinsContextMenu); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::InitAllPinComboboxes() +{ + InitPinPoint(ui->comboBoxGrainlineTopPin); + InitPinPoint(ui->comboBoxGrainlineBottomPin); + + InitPinPoint(ui->comboBoxDetailLabelTopLeftPin); + InitPinPoint(ui->comboBoxDetailLabelBottomRightPin); + InitPinPoint(ui->comboBoxPatternLabelTopLeftPin); + InitPinPoint(ui->comboBoxPatternLabelBottomRightPin); +} + //--------------------------------------------------------------------------------------------------------------------- QString DialogSeamAllowance::GetFormulaSAWidth() const { diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index 94c2e04d7..227c1ef9a 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -178,11 +178,13 @@ private: void InitSeamAllowanceTab(); void InitNodesList(); void InitCSAPoint(QComboBox *box); + void InitPinPoint(QComboBox *box); void InitSAIncludeType(); void InitInternalPathsTab(); void InitPatternPieceDataTab(); void InitGrainlineTab(); void InitPinsTab(); + void InitAllPinComboboxes(); void SetFormulaSAWidth(const QString &formula); diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui b/src/libs/vtools/dialogs/tools/dialogseamallowance.ui index c9139733a..b83fe7923 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.ui @@ -911,7 +911,7 @@ - QFormLayout::AllNonFixedFieldsGrow + QFormLayout::ExpandingFieldsGrow @@ -1029,17 +1029,82 @@ - - + + Detail label visible + + true + + + true + + + false + + + + QFormLayout::ExpandingFieldsGrow + + + + + Top left pin: + + + + + + + + + + Bottom right pin: + + + + + + + - - + + Pattern label visible + + true + + + false + + + + QFormLayout::ExpandingFieldsGrow + + + + + Top left pin: + + + + + + + + + + Bottom right pin: + + + + + + + @@ -1456,8 +1521,11 @@ - - + + + QFormLayout::ExpandingFieldsGrow + + @@ -1507,24 +1575,44 @@ - + - - - - Qt::Horizontal + + + + Top pin: - - - 40 - 20 - + + + + + + Bottom pin: - + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + From 18bbca7b9a12836ad3908bbd947f5bd62d92fc67 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 15 Feb 2017 16:07:52 +0200 Subject: [PATCH 16/52] Cppcheck warning. --HG-- branch : feature --- src/libs/vtools/visualization/line/vistoolpin.cpp | 5 +++-- src/libs/vtools/visualization/line/vistoolpin.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libs/vtools/visualization/line/vistoolpin.cpp b/src/libs/vtools/visualization/line/vistoolpin.cpp index b942795b6..60abb49e5 100644 --- a/src/libs/vtools/visualization/line/vistoolpin.cpp +++ b/src/libs/vtools/visualization/line/vistoolpin.cpp @@ -33,12 +33,13 @@ //--------------------------------------------------------------------------------------------------------------------- VisToolPin::VisToolPin(const VContainer *data, QGraphicsItem *parent) : VisLine(data, parent), - m_point(nullptr) + m_point() { this->mainColor = Qt::red; this->setZValue(2);// Show on top real tool - m_point = new VSimplePoint(NULL_ID, mainColor, *Visualization::data->GetPatternUnit(), &factor); + m_point = QSharedPointer(new VSimplePoint(NULL_ID, mainColor, *Visualization::data->GetPatternUnit(), + &factor)); m_point->SetPointHighlight(true); m_point->setParentItem(this); m_point->SetVisualizationMode(true); diff --git a/src/libs/vtools/visualization/line/vistoolpin.h b/src/libs/vtools/visualization/line/vistoolpin.h index a8075c42a..2e9e6122b 100644 --- a/src/libs/vtools/visualization/line/vistoolpin.h +++ b/src/libs/vtools/visualization/line/vistoolpin.h @@ -45,7 +45,7 @@ public: enum { Type = UserType + static_cast(Vis::ToolPin)}; private: Q_DISABLE_COPY(VisToolPin) - VSimplePoint *m_point; + QSharedPointer m_point; }; #endif // VISTOOLPIN_H From ca9bdbd3fbf9129902932997226a2b88b3df304d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 15 Feb 2017 16:43:12 +0200 Subject: [PATCH 17/52] QSharedPointer doesn't support deleting object from outside. --HG-- branch : feature --- src/libs/vtools/visualization/line/vistoolpin.cpp | 7 +++++-- src/libs/vtools/visualization/line/vistoolpin.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libs/vtools/visualization/line/vistoolpin.cpp b/src/libs/vtools/visualization/line/vistoolpin.cpp index 60abb49e5..edc6b2df5 100644 --- a/src/libs/vtools/visualization/line/vistoolpin.cpp +++ b/src/libs/vtools/visualization/line/vistoolpin.cpp @@ -38,8 +38,7 @@ VisToolPin::VisToolPin(const VContainer *data, QGraphicsItem *parent) this->mainColor = Qt::red; this->setZValue(2);// Show on top real tool - m_point = QSharedPointer(new VSimplePoint(NULL_ID, mainColor, *Visualization::data->GetPatternUnit(), - &factor)); + m_point = new VSimplePoint(NULL_ID, mainColor, *Visualization::data->GetPatternUnit(), &factor); m_point->SetPointHighlight(true); m_point->setParentItem(this); m_point->SetVisualizationMode(true); @@ -49,6 +48,10 @@ VisToolPin::VisToolPin(const VContainer *data, QGraphicsItem *parent) //--------------------------------------------------------------------------------------------------------------------- VisToolPin::~VisToolPin() { + if (not m_point.isNull()) + { + delete m_point; + } } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/visualization/line/vistoolpin.h b/src/libs/vtools/visualization/line/vistoolpin.h index 2e9e6122b..abb013a44 100644 --- a/src/libs/vtools/visualization/line/vistoolpin.h +++ b/src/libs/vtools/visualization/line/vistoolpin.h @@ -45,7 +45,7 @@ public: enum { Type = UserType + static_cast(Vis::ToolPin)}; private: Q_DISABLE_COPY(VisToolPin) - QSharedPointer m_point; + QPointer m_point; }; #endif // VISTOOLPIN_H From 37efefe1ecea8af35d1007161c6ee28832d1a42a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 11:19:27 +0200 Subject: [PATCH 18/52] Refactoring. Rename class VPatternPieceData to VPieceLabelData. --HG-- branch : feature --- src/app/valentina/mainwindowsnogui.cpp | 2 +- src/app/valentina/xml/vpattern.cpp | 2 +- src/libs/vlayout/vlayoutpiece.cpp | 6 +-- src/libs/vlayout/vlayoutpiece.h | 4 +- src/libs/vlayout/vlayoutpiece_p.h | 4 +- src/libs/vlayout/vtextmanager.cpp | 4 +- src/libs/vlayout/vtextmanager.h | 4 +- src/libs/vpatterndb/vpatterndb.pri | 8 ++-- src/libs/vpatterndb/vpiece.cpp | 6 +-- src/libs/vpatterndb/vpiece.h | 8 ++-- src/libs/vpatterndb/vpiece_p.h | 4 +- ...tternpiecedata.cpp => vpiecelabeldata.cpp} | 48 +++++++++---------- ...{vpatternpiecedata.h => vpiecelabeldata.h} | 8 ++-- .../dialogs/tools/dialogseamallowance.h | 4 +- src/libs/vtools/tools/vtoolseamallowance.cpp | 6 +-- .../vtools/undocommands/savepieceoptions.cpp | 2 +- src/libs/vwidgets/vtextgraphicsitem.cpp | 2 +- src/libs/vwidgets/vtextgraphicsitem.h | 2 +- 18 files changed, 62 insertions(+), 62 deletions(-) rename src/libs/vpatterndb/{vpatternpiecedata.cpp => vpiecelabeldata.cpp} (81%) rename src/libs/vpatterndb/{vpatternpiecedata.h => vpiecelabeldata.h} (96%) diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 47c2e94ff..99329026a 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -37,7 +37,7 @@ #include "dialogs/dialoglayoutprogress.h" #include "dialogs/dialogsavelayout.h" #include "../vlayout/vposter.h" -#include "../vpatterndb/vpatternpiecedata.h" +#include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vpatterninfogeometry.h" #include "../vpatterndb/vgrainlinegeometry.h" #include "../vtools/tools/vabstracttool.h" diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 5f451a0a3..4a616bb8e 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -51,7 +51,7 @@ #include "../core/vapplication.h" #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/calculator.h" -#include "../vpatterndb/vpatternpiecedata.h" +#include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vpatterninfogeometry.h" #include "../vpatterndb/vgrainlinegeometry.h" #include "../vpatterndb/vpiecepath.h" diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 4d9eeadd0..2bbbcff7e 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -44,7 +44,7 @@ #include #include "../vpatterndb/vpatterninfogeometry.h" -#include "../vpatterndb/vpatternpiecedata.h" +#include "../vpatterndb/vpiecelabeldata.h" #include "../vmisc/vmath.h" #include "../vmisc/vabstractapplication.h" #include "../vpatterndb/calculator.h" @@ -106,7 +106,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern det.SetInternalPaths(ConvertInternalPaths(piece, pattern)); det.SetName(piece.GetName()); - const VPatternPieceData& data = piece.GetPatternPieceData(); + const VPieceLabelData& data = piece.GetPatternPieceData(); if (data.IsVisible() == true) { det.SetDetail(piece.GetName(), data, qApp->font()); @@ -175,7 +175,7 @@ QVector VLayoutPiece::GetLayoutAllowancePoints() const } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::SetDetail(const QString& qsName, const VPatternPieceData& data, const QFont &font) +void VLayoutPiece::SetDetail(const QString& qsName, const VPieceLabelData& data, const QFont &font) { d->detailData = data; qreal dAng = qDegreesToRadians(data.GetRotation()); diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index 3ef6cf9ec..b1569fd5f 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -43,7 +43,7 @@ #include "../ifc/xml/vabstractpattern.h" #include "../vpatterndb/vpatterninfogeometry.h" -#include "../vpatterndb/vpatternpiecedata.h" +#include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vcontainer.h" #include "vabstractpiece.h" @@ -73,7 +73,7 @@ public: QVector GetInternalPaths() const; void SetInternalPaths(const QVector &internalPaths); - void SetDetail(const QString &qsName, const VPatternPieceData& data, const QFont& font); + void SetDetail(const QString &qsName, const VPieceLabelData& data, const QFont& font); void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont& font, qreal dSize, qreal dHeight); diff --git a/src/libs/vlayout/vlayoutpiece_p.h b/src/libs/vlayout/vlayoutpiece_p.h index bd3f504be..b6ac71a2c 100644 --- a/src/libs/vlayout/vlayoutpiece_p.h +++ b/src/libs/vlayout/vlayoutpiece_p.h @@ -34,7 +34,7 @@ #include #include -#include "../vpatterndb/vpatternpiecedata.h" +#include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vpatterninfogeometry.h" #include "../vpatterndb/vgrainlinegeometry.h" #include "../vmisc/diagnostic.h" @@ -116,7 +116,7 @@ public: /** @brief grainlineInfo line */ QVector grainlinePoints; /** @brief detailData detail data */ - VPatternPieceData detailData; + VPieceLabelData detailData; /** @brief patternGeom pattern geometry */ VPatternInfoGeometry patternGeom; /** @brief grainlineGeom grainline geometry */ diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp index 8012dd040..e245a331d 100644 --- a/src/libs/vlayout/vtextmanager.cpp +++ b/src/libs/vlayout/vtextmanager.cpp @@ -35,7 +35,7 @@ #include #include "../ifc/xml/vabstractpattern.h" -#include "../vpatterndb/vpatternpiecedata.h" +#include "../vpatterndb/vpiecelabeldata.h" #include "../vmisc/vabstractapplication.h" #include "../vmisc/vmath.h" #include "vtextmanager.h" @@ -238,7 +238,7 @@ void VTextManager::FitFontSize(qreal fW, qreal fH) * @param qsName detail name * @param data reference to the detail data */ -void VTextManager::Update(const QString& qsName, const VPatternPieceData& data) +void VTextManager::Update(const QString& qsName, const VPieceLabelData& data) { ClearSourceLines(); TextLine tl; diff --git a/src/libs/vlayout/vtextmanager.h b/src/libs/vlayout/vtextmanager.h index 4a9591b93..bb631f381 100644 --- a/src/libs/vlayout/vtextmanager.h +++ b/src/libs/vlayout/vtextmanager.h @@ -38,7 +38,7 @@ #include #include -class VPatternPieceData; +class VPieceLabelData; class VAbstractPattern; #define MIN_FONT_SIZE 5 @@ -85,7 +85,7 @@ public: int GetSourceLinesCount() const; const TextLine& GetSourceLine(int i) const; - void Update(const QString& qsName, const VPatternPieceData& data); + void Update(const QString& qsName, const VPieceLabelData& data); void Update(const VAbstractPattern* pDoc, qreal dSize, qreal dHeight); private: diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index 5a94d2ff8..f539c7859 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -17,14 +17,14 @@ SOURCES += \ $$PWD/variables/vmeasurement.cpp \ $$PWD/variables/vvariable.cpp \ $$PWD/vformula.cpp \ - $$PWD/vpatternpiecedata.cpp \ $$PWD/vpatterninfogeometry.cpp \ $$PWD/vgrainlinegeometry.cpp \ $$PWD/variables/vcurveclength.cpp \ $$PWD/variables/vellipticalarcradius.cpp \ $$PWD/vpiece.cpp \ $$PWD/vpiecenode.cpp \ - $$PWD/vpiecepath.cpp + $$PWD/vpiecepath.cpp \ + $$PWD/vpiecelabeldata.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -55,7 +55,6 @@ HEADERS += \ $$PWD/variables/vvariable.h \ $$PWD/variables/vvariable_p.h \ $$PWD/vformula.h \ - $$PWD/vpatternpiecedata.h \ $$PWD/vpatterninfogeometry.h \ $$PWD/vgrainlinegeometry.h \ $$PWD/variables/vcurveclength.h \ @@ -65,4 +64,5 @@ HEADERS += \ $$PWD/vpiecenode.h \ $$PWD/vpiecenode_p.h \ $$PWD/vpiecepath.h \ - $$PWD/vpiecepath_p.h + $$PWD/vpiecepath_p.h \ + $$PWD/vpiecelabeldata.h diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 4ec17f076..3092f4610 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -413,7 +413,7 @@ QVector VPiece::MissingPins(const VPiece &det) const } //--------------------------------------------------------------------------------------------------------------------- -void VPiece::SetPatternPieceData(const VPatternPieceData &data) +void VPiece::SetPatternPieceData(const VPieceLabelData &data) { d->m_ppData = data; } @@ -423,7 +423,7 @@ void VPiece::SetPatternPieceData(const VPatternPieceData &data) * @brief Returns full access to the pattern piece data object * @return pattern piece data object */ -VPatternPieceData &VPiece::GetPatternPieceData() +VPieceLabelData &VPiece::GetPatternPieceData() { return d->m_ppData; } @@ -433,7 +433,7 @@ VPatternPieceData &VPiece::GetPatternPieceData() * @brief Returns the read only reference to the pattern piece data object * @return pattern piece data object */ -const VPatternPieceData &VPiece::GetPatternPieceData() const +const VPieceLabelData &VPiece::GetPatternPieceData() const { return d->m_ppData; } diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h index a5a2f594e..b6edf28ad 100644 --- a/src/libs/vpatterndb/vpiece.h +++ b/src/libs/vpatterndb/vpiece.h @@ -40,7 +40,7 @@ template class QVector; template class QSharedPointer; class VPiecePath; class VPatternInfoGeometry; -class VPatternPieceData; +class VPieceLabelData; class VGrainlineGeometry; class VContainer; class QPainterPath; @@ -97,9 +97,9 @@ public: QVector MissingInternalPaths(const VPiece &det) const; QVector MissingPins(const VPiece &det) const; - void SetPatternPieceData(const VPatternPieceData &data); - VPatternPieceData& GetPatternPieceData(); - const VPatternPieceData& GetPatternPieceData() const; + void SetPatternPieceData(const VPieceLabelData &data); + VPieceLabelData& GetPatternPieceData(); + const VPieceLabelData& GetPatternPieceData() const; void SetPatternInfo(const VPatternInfoGeometry &info); VPatternInfoGeometry& GetPatternInfo(); diff --git a/src/libs/vpatterndb/vpiece_p.h b/src/libs/vpatterndb/vpiece_p.h index cc28158eb..3da1a7239 100644 --- a/src/libs/vpatterndb/vpiece_p.h +++ b/src/libs/vpatterndb/vpiece_p.h @@ -36,7 +36,7 @@ #include "../vmisc/def.h" #include "vpiecenode.h" #include "vpiecepath.h" -#include "vpatternpiecedata.h" +#include "vpiecelabeldata.h" #include "vpatterninfogeometry.h" #include "vgrainlinegeometry.h" @@ -93,7 +93,7 @@ public: QVector m_pins; /** @brief Pattern piece data */ - VPatternPieceData m_ppData; + VPieceLabelData m_ppData; /** @brief Pattern info coordinates */ VPatternInfoGeometry m_piPatternInfo; diff --git a/src/libs/vpatterndb/vpatternpiecedata.cpp b/src/libs/vpatterndb/vpiecelabeldata.cpp similarity index 81% rename from src/libs/vpatterndb/vpatternpiecedata.cpp rename to src/libs/vpatterndb/vpiecelabeldata.cpp index 830ef21e9..4adf35eb0 100644 --- a/src/libs/vpatterndb/vpatternpiecedata.cpp +++ b/src/libs/vpatterndb/vpiecelabeldata.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vpatternpiecedata.cpp + ** @file vpiecelabeldata.cpp ** @author Bojan Kverh ** @date June 16, 2016 ** @@ -26,7 +26,7 @@ ** *************************************************************************/ -#include "vpatternpiecedata.h" +#include "vpiecelabeldata.h" //--------------------------------------------------------------------------------------------------------------------- MaterialCutPlacement::MaterialCutPlacement() @@ -34,19 +34,19 @@ MaterialCutPlacement::MaterialCutPlacement() {} //--------------------------------------------------------------------------------------------------------------------- -VPatternPieceData::VPatternPieceData() +VPieceLabelData::VPieceLabelData() :m_qsLetter(), m_conMCP(), m_ptPos(0, 0), m_dLabelWidth(0), m_dLabelHeight(0), m_iFontSize(0), m_dRotation(0), m_bVisible(true) {} //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::Append(const MaterialCutPlacement& rMCP) +void VPieceLabelData::Append(const MaterialCutPlacement& rMCP) { m_conMCP.append(rMCP); } //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::Insert(int i, const MaterialCutPlacement& rMCP) +void VPieceLabelData::Insert(int i, const MaterialCutPlacement& rMCP) { Q_ASSERT(i >= 0); Q_ASSERT(i <= GetMCPCount()); @@ -54,7 +54,7 @@ void VPatternPieceData::Insert(int i, const MaterialCutPlacement& rMCP) } //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::Set(int i, const MaterialCutPlacement& rMCP) +void VPieceLabelData::Set(int i, const MaterialCutPlacement& rMCP) { Q_ASSERT(i >= 0); Q_ASSERT(i < GetMCPCount()); @@ -62,13 +62,13 @@ void VPatternPieceData::Set(int i, const MaterialCutPlacement& rMCP) } //--------------------------------------------------------------------------------------------------------------------- -int VPatternPieceData::GetMCPCount() const +int VPieceLabelData::GetMCPCount() const { return m_conMCP.count(); } //--------------------------------------------------------------------------------------------------------------------- -const MaterialCutPlacement& VPatternPieceData::GetMCP(int i) const +const MaterialCutPlacement& VPieceLabelData::GetMCP(int i) const { Q_ASSERT(i >= 0); Q_ASSERT(i < GetMCPCount()); @@ -76,7 +76,7 @@ const MaterialCutPlacement& VPatternPieceData::GetMCP(int i) const } //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::RemoveMCP(int i) +void VPieceLabelData::RemoveMCP(int i) { Q_ASSERT(i >= 0); Q_ASSERT(i < GetMCPCount()); @@ -84,92 +84,92 @@ void VPatternPieceData::RemoveMCP(int i) } //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::Clear() +void VPieceLabelData::Clear() { m_qsLetter.clear(); m_conMCP.clear(); } //--------------------------------------------------------------------------------------------------------------------- -const QString& VPatternPieceData::GetLetter() const +const QString& VPieceLabelData::GetLetter() const { return m_qsLetter; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::SetLetter(QString qsLetter) +void VPieceLabelData::SetLetter(QString qsLetter) { m_qsLetter = qsLetter.left(3); } //--------------------------------------------------------------------------------------------------------------------- -QPointF VPatternPieceData::GetPos() const +QPointF VPieceLabelData::GetPos() const { return m_ptPos; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::SetPos(const QPointF& ptPos) +void VPieceLabelData::SetPos(const QPointF& ptPos) { m_ptPos = ptPos; } //--------------------------------------------------------------------------------------------------------------------- -qreal VPatternPieceData::GetLabelWidth() const +qreal VPieceLabelData::GetLabelWidth() const { return m_dLabelWidth; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::SetLabelWidth(qreal dLabelW) +void VPieceLabelData::SetLabelWidth(qreal dLabelW) { m_dLabelWidth = dLabelW; } //--------------------------------------------------------------------------------------------------------------------- -qreal VPatternPieceData::GetLabelHeight() const +qreal VPieceLabelData::GetLabelHeight() const { return m_dLabelHeight; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::SetLabelHeight(qreal dLabelH) +void VPieceLabelData::SetLabelHeight(qreal dLabelH) { m_dLabelHeight = dLabelH; } //--------------------------------------------------------------------------------------------------------------------- -int VPatternPieceData::GetFontSize() const +int VPieceLabelData::GetFontSize() const { return m_iFontSize; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::SetFontSize(int iSize) +void VPieceLabelData::SetFontSize(int iSize) { m_iFontSize = iSize; } //--------------------------------------------------------------------------------------------------------------------- -qreal VPatternPieceData::GetRotation() const +qreal VPieceLabelData::GetRotation() const { return m_dRotation; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::SetRotation(qreal dRot) +void VPieceLabelData::SetRotation(qreal dRot) { m_dRotation = dRot; } //--------------------------------------------------------------------------------------------------------------------- -bool VPatternPieceData::IsVisible() const +bool VPieceLabelData::IsVisible() const { return m_bVisible; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternPieceData::SetVisible(bool bVal) +void VPieceLabelData::SetVisible(bool bVal) { m_bVisible = bVal; } diff --git a/src/libs/vpatterndb/vpatternpiecedata.h b/src/libs/vpatterndb/vpiecelabeldata.h similarity index 96% rename from src/libs/vpatterndb/vpatternpiecedata.h rename to src/libs/vpatterndb/vpiecelabeldata.h index 08706f8a2..52103e3d6 100644 --- a/src/libs/vpatterndb/vpatternpiecedata.h +++ b/src/libs/vpatterndb/vpiecelabeldata.h @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vpatternpiecedata.h + ** @file vpiecelabeldata.h ** @author Bojan Kverh ** @date June 16, 2016 ** @@ -67,13 +67,13 @@ struct MaterialCutPlacement typedef QList MCPContainer; /** - * @brief The VPatternPieceData class holds some information about a single + * @brief The VPieceLabelData class holds some information about a single * piece like letter, name, material type, cut number and placement. */ -class VPatternPieceData +class VPieceLabelData { public: - VPatternPieceData(); + VPieceLabelData(); // methods, which operate on MaterialCutPlacement container void Append(const MaterialCutPlacement& rMCP); diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index 227c1ef9a..7329e8386 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -32,7 +32,7 @@ #include "dialogtool.h" #include "../vpatterndb/vpiece.h" #include "../vpatterndb/vpatterninfogeometry.h" -#include "../vpatterndb/vpatternpiecedata.h" +#include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vgrainlinegeometry.h" namespace Ui @@ -136,7 +136,7 @@ private: // temporary container for Material/Cut/Placement 3-tuples MCPContainer m_conMCP; - VPatternPieceData m_oldData; + VPieceLabelData m_oldData; VPatternInfoGeometry m_oldGeom; VGrainlineGeometry m_oldGrainline; int m_iRotBaseHeight; diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 3fc70d482..79f650046 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -32,7 +32,7 @@ #include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/calculator.h" #include "../vpatterndb/vpatterninfogeometry.h" -#include "../vpatterndb/vpatternpiecedata.h" +#include "../vpatterndb/vpiecelabeldata.h" #include "nodeDetails/vnodearc.h" #include "nodeDetails/vnodeellipticalarc.h" #include "nodeDetails/vnodepoint.h" @@ -242,7 +242,7 @@ void VToolSeamAllowance::AddPins(VAbstractPattern *doc, QDomElement &domElement, void VToolSeamAllowance::AddPatternPieceData(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece) { QDomElement domData = doc->createElement(VAbstractPattern::TagData); - const VPatternPieceData& data = piece.GetPatternPieceData(); + const VPieceLabelData& data = piece.GetPatternPieceData(); doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter()); doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? trueStr : falseStr); doc->SetAttribute(domData, AttrMx, data.GetPos().x()); @@ -417,7 +417,7 @@ void VToolSeamAllowance::Highlight(quint32 id) void VToolSeamAllowance::UpdateLabel() { const VPiece detail = VAbstractTool::data.GetPiece(id); - const VPatternPieceData& data = detail.GetPatternPieceData(); + const VPieceLabelData& data = detail.GetPatternPieceData(); if (data.IsVisible() == true) { diff --git a/src/libs/vtools/undocommands/savepieceoptions.cpp b/src/libs/vtools/undocommands/savepieceoptions.cpp index bb52d0de6..3d44ddc9a 100644 --- a/src/libs/vtools/undocommands/savepieceoptions.cpp +++ b/src/libs/vtools/undocommands/savepieceoptions.cpp @@ -39,7 +39,7 @@ #include "../vmisc/def.h" #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpatterninfogeometry.h" -#include "../vpatterndb/vpatternpiecedata.h" +#include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vgrainlinegeometry.h" #include "../tools/vtoolseamallowance.h" #include "vundocommand.h" diff --git a/src/libs/vwidgets/vtextgraphicsitem.cpp b/src/libs/vwidgets/vtextgraphicsitem.cpp index 7a12002f1..842bcdeaa 100644 --- a/src/libs/vwidgets/vtextgraphicsitem.cpp +++ b/src/libs/vwidgets/vtextgraphicsitem.cpp @@ -359,7 +359,7 @@ bool VTextGraphicsItem::IsContained(QRectF rectBB, qreal dRot, qreal &dX, qreal * @param qsName name of detail * @param data reference to VPatternPieceData */ -void VTextGraphicsItem::UpdateData(const QString &qsName, const VPatternPieceData &data) +void VTextGraphicsItem::UpdateData(const QString &qsName, const VPieceLabelData &data) { m_tm.Update(qsName, data); } diff --git a/src/libs/vwidgets/vtextgraphicsitem.h b/src/libs/vwidgets/vtextgraphicsitem.h index 7d5d77ed9..7c5d99bad 100644 --- a/src/libs/vwidgets/vtextgraphicsitem.h +++ b/src/libs/vwidgets/vtextgraphicsitem.h @@ -64,7 +64,7 @@ public: void Clear(); void SetSize(qreal fW, qreal fH); bool IsContained(QRectF rectBB, qreal dRot, qreal& dX, qreal& dY) const; - void UpdateData(const QString& qsName, const VPatternPieceData& data); + void UpdateData(const QString& qsName, const VPieceLabelData& data); void UpdateData(const VAbstractPattern* pDoc, qreal dSize, qreal dHeight); int GetTextLines() const; From 4e3ee3eefdff450e51ff60c07fa3ccd2edaba6b9 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 11:26:25 +0200 Subject: [PATCH 19/52] Refactoring. Rename class VPatternInfoGeometry to VPatternLabelData. --HG-- branch : feature --- src/app/valentina/mainwindowsnogui.cpp | 2 +- src/app/valentina/xml/vpattern.cpp | 2 +- src/libs/vlayout/vlayoutpiece.cpp | 6 ++-- src/libs/vlayout/vlayoutpiece.h | 4 +-- src/libs/vlayout/vlayoutpiece_p.h | 4 +-- src/libs/vpatterndb/vpatterndb.pri | 8 ++--- ...infogeometry.cpp => vpatternlabeldata.cpp} | 30 +++++++++---------- ...terninfogeometry.h => vpatternlabeldata.h} | 8 ++--- src/libs/vpatterndb/vpiece.cpp | 6 ++-- src/libs/vpatterndb/vpiece.h | 8 ++--- src/libs/vpatterndb/vpiece_p.h | 4 +-- .../dialogs/tools/dialogseamallowance.h | 4 +-- src/libs/vtools/tools/vtoolseamallowance.cpp | 6 ++-- .../vtools/undocommands/savepieceoptions.cpp | 2 +- 14 files changed, 47 insertions(+), 47 deletions(-) rename src/libs/vpatterndb/{vpatterninfogeometry.cpp => vpatternlabeldata.cpp} (82%) rename src/libs/vpatterndb/{vpatterninfogeometry.h => vpatternlabeldata.h} (93%) diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 99329026a..8f77f123d 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -38,7 +38,7 @@ #include "dialogs/dialogsavelayout.h" #include "../vlayout/vposter.h" #include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vpatterninfogeometry.h" +#include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vgrainlinegeometry.h" #include "../vtools/tools/vabstracttool.h" diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 4a616bb8e..819c472cb 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -52,7 +52,7 @@ #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/calculator.h" #include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vpatterninfogeometry.h" +#include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vgrainlinegeometry.h" #include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/vnodedetail.h" diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 2bbbcff7e..a7e164caa 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -43,7 +43,7 @@ #include #include -#include "../vpatterndb/vpatterninfogeometry.h" +#include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vpiecelabeldata.h" #include "../vmisc/vmath.h" #include "../vmisc/vabstractapplication.h" @@ -111,7 +111,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern { det.SetDetail(piece.GetName(), data, qApp->font()); } - const VPatternInfoGeometry& geom = piece.GetPatternInfo(); + const VPatternLabelData& geom = piece.GetPatternInfo(); if (geom.IsVisible() == true) { VAbstractPattern* pDoc = qApp->getCurrentDocument(); @@ -201,7 +201,7 @@ void VLayoutPiece::SetDetail(const QString& qsName, const VPieceLabelData& data, } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont &font, +void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont &font, qreal dSize, qreal dHeight) { d->patternGeom = geom; diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index b1569fd5f..d96e0523f 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -42,7 +42,7 @@ #include #include "../ifc/xml/vabstractpattern.h" -#include "../vpatterndb/vpatterninfogeometry.h" +#include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vcontainer.h" #include "vabstractpiece.h" @@ -75,7 +75,7 @@ public: void SetDetail(const QString &qsName, const VPieceLabelData& data, const QFont& font); - void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternInfoGeometry& geom, const QFont& font, + void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont& font, qreal dSize, qreal dHeight); void SetGrainline(const VGrainlineGeometry& geom, const VContainer& rPattern); diff --git a/src/libs/vlayout/vlayoutpiece_p.h b/src/libs/vlayout/vlayoutpiece_p.h index b6ac71a2c..5997df368 100644 --- a/src/libs/vlayout/vlayoutpiece_p.h +++ b/src/libs/vlayout/vlayoutpiece_p.h @@ -35,7 +35,7 @@ #include #include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vpatterninfogeometry.h" +#include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vgrainlinegeometry.h" #include "../vmisc/diagnostic.h" #include "vlayoutpiecepath.h" @@ -118,7 +118,7 @@ public: /** @brief detailData detail data */ VPieceLabelData detailData; /** @brief patternGeom pattern geometry */ - VPatternInfoGeometry patternGeom; + VPatternLabelData patternGeom; /** @brief grainlineGeom grainline geometry */ VGrainlineGeometry grainlineGeom; /** @brief m_tmDetail text manager for laying out detail info */ diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index f539c7859..1075b6269 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -17,14 +17,14 @@ SOURCES += \ $$PWD/variables/vmeasurement.cpp \ $$PWD/variables/vvariable.cpp \ $$PWD/vformula.cpp \ - $$PWD/vpatterninfogeometry.cpp \ $$PWD/vgrainlinegeometry.cpp \ $$PWD/variables/vcurveclength.cpp \ $$PWD/variables/vellipticalarcradius.cpp \ $$PWD/vpiece.cpp \ $$PWD/vpiecenode.cpp \ $$PWD/vpiecepath.cpp \ - $$PWD/vpiecelabeldata.cpp + $$PWD/vpiecelabeldata.cpp \ + $$PWD/vpatternlabeldata.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -55,7 +55,6 @@ HEADERS += \ $$PWD/variables/vvariable.h \ $$PWD/variables/vvariable_p.h \ $$PWD/vformula.h \ - $$PWD/vpatterninfogeometry.h \ $$PWD/vgrainlinegeometry.h \ $$PWD/variables/vcurveclength.h \ $$PWD/variables/vellipticalarcradius.h \ @@ -65,4 +64,5 @@ HEADERS += \ $$PWD/vpiecenode_p.h \ $$PWD/vpiecepath.h \ $$PWD/vpiecepath_p.h \ - $$PWD/vpiecelabeldata.h + $$PWD/vpiecelabeldata.h \ + $$PWD/vpatternlabeldata.h diff --git a/src/libs/vpatterndb/vpatterninfogeometry.cpp b/src/libs/vpatterndb/vpatternlabeldata.cpp similarity index 82% rename from src/libs/vpatterndb/vpatterninfogeometry.cpp rename to src/libs/vpatterndb/vpatternlabeldata.cpp index 8ab110c1e..1f3852763 100644 --- a/src/libs/vpatterndb/vpatterninfogeometry.cpp +++ b/src/libs/vpatterndb/vpatternlabeldata.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vpatterninfogeometry.cpp + ** @file vpatternlabeldata.cpp ** @author Bojan Kverh ** @date June 16, 2016 ** @@ -26,82 +26,82 @@ ** *************************************************************************/ -#include "vpatterninfogeometry.h" +#include "vpatternlabeldata.h" //--------------------------------------------------------------------------------------------------------------------- -VPatternInfoGeometry::VPatternInfoGeometry() +VPatternLabelData::VPatternLabelData() :m_ptPos(0, 0), m_dLabelWidth(0), m_dLabelHeight(0), m_iFontSize(0), m_dRotation(0), m_bVisible(true) {} //--------------------------------------------------------------------------------------------------------------------- -QPointF VPatternInfoGeometry::GetPos() const +QPointF VPatternLabelData::GetPos() const { return m_ptPos; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternInfoGeometry::SetPos(const QPointF& ptPos) +void VPatternLabelData::SetPos(const QPointF& ptPos) { m_ptPos = ptPos; } //--------------------------------------------------------------------------------------------------------------------- -qreal VPatternInfoGeometry::GetLabelWidth() const +qreal VPatternLabelData::GetLabelWidth() const { return m_dLabelWidth; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternInfoGeometry::SetLabelWidth(qreal dLabelW) +void VPatternLabelData::SetLabelWidth(qreal dLabelW) { m_dLabelWidth = dLabelW; } //--------------------------------------------------------------------------------------------------------------------- -qreal VPatternInfoGeometry::GetLabelHeight() const +qreal VPatternLabelData::GetLabelHeight() const { return m_dLabelHeight; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternInfoGeometry::SetLabelHeight(qreal dLabelH) +void VPatternLabelData::SetLabelHeight(qreal dLabelH) { m_dLabelHeight = dLabelH; } //--------------------------------------------------------------------------------------------------------------------- -int VPatternInfoGeometry::GetFontSize() const +int VPatternLabelData::GetFontSize() const { return m_iFontSize; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternInfoGeometry::SetFontSize(int iSize) +void VPatternLabelData::SetFontSize(int iSize) { m_iFontSize = iSize; } //--------------------------------------------------------------------------------------------------------------------- -qreal VPatternInfoGeometry::GetRotation() const +qreal VPatternLabelData::GetRotation() const { return m_dRotation; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternInfoGeometry::SetRotation(qreal dRot) +void VPatternLabelData::SetRotation(qreal dRot) { m_dRotation = dRot; } //--------------------------------------------------------------------------------------------------------------------- -bool VPatternInfoGeometry::IsVisible() const +bool VPatternLabelData::IsVisible() const { return m_bVisible; } //--------------------------------------------------------------------------------------------------------------------- -void VPatternInfoGeometry::SetVisible(bool bVal) +void VPatternLabelData::SetVisible(bool bVal) { m_bVisible = bVal; } diff --git a/src/libs/vpatterndb/vpatterninfogeometry.h b/src/libs/vpatterndb/vpatternlabeldata.h similarity index 93% rename from src/libs/vpatterndb/vpatterninfogeometry.h rename to src/libs/vpatterndb/vpatternlabeldata.h index c9e976ba1..b3d818a0c 100644 --- a/src/libs/vpatterndb/vpatterninfogeometry.h +++ b/src/libs/vpatterndb/vpatternlabeldata.h @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vpatterninfogeometry.h + ** @file vpatternlabeldata.h ** @author Bojan Kverh ** @date June 16, 2016 ** @@ -33,12 +33,12 @@ #include /** - * @brief The VPatternInfoGeometry class holds the information about pattern info label geometry + * @brief The VPatternLabelData class holds the information about pattern info label geometry */ -class VPatternInfoGeometry +class VPatternLabelData { public: - VPatternInfoGeometry(); + VPatternLabelData(); // methods, which set up label parameters QPointF GetPos() const; diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 3092f4610..13abe5491 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -439,7 +439,7 @@ const VPieceLabelData &VPiece::GetPatternPieceData() const } //--------------------------------------------------------------------------------------------------------------------- -void VPiece::SetPatternInfo(const VPatternInfoGeometry &info) +void VPiece::SetPatternInfo(const VPatternLabelData &info) { d->m_piPatternInfo = info; } @@ -449,7 +449,7 @@ void VPiece::SetPatternInfo(const VPatternInfoGeometry &info) * @brief Returns full access to the pattern info geometry object * @return pattern info geometry object */ -VPatternInfoGeometry &VPiece::GetPatternInfo() +VPatternLabelData &VPiece::GetPatternInfo() { return d->m_piPatternInfo; } @@ -459,7 +459,7 @@ VPatternInfoGeometry &VPiece::GetPatternInfo() * @brief Returns the read only reference to the pattern info geometry object * @return pattern info geometry object */ -const VPatternInfoGeometry &VPiece::GetPatternInfo() const +const VPatternLabelData &VPiece::GetPatternInfo() const { return d->m_piPatternInfo; } diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h index b6edf28ad..e20b1e644 100644 --- a/src/libs/vpatterndb/vpiece.h +++ b/src/libs/vpatterndb/vpiece.h @@ -39,7 +39,7 @@ class VPieceNode; template class QVector; template class QSharedPointer; class VPiecePath; -class VPatternInfoGeometry; +class VPatternLabelData; class VPieceLabelData; class VGrainlineGeometry; class VContainer; @@ -101,9 +101,9 @@ public: VPieceLabelData& GetPatternPieceData(); const VPieceLabelData& GetPatternPieceData() const; - void SetPatternInfo(const VPatternInfoGeometry &info); - VPatternInfoGeometry& GetPatternInfo(); - const VPatternInfoGeometry& GetPatternInfo() const; + void SetPatternInfo(const VPatternLabelData &info); + VPatternLabelData& GetPatternInfo(); + const VPatternLabelData& GetPatternInfo() const; VGrainlineGeometry& GetGrainlineGeometry(); const VGrainlineGeometry& GetGrainlineGeometry() const; diff --git a/src/libs/vpatterndb/vpiece_p.h b/src/libs/vpatterndb/vpiece_p.h index 3da1a7239..2d735ee42 100644 --- a/src/libs/vpatterndb/vpiece_p.h +++ b/src/libs/vpatterndb/vpiece_p.h @@ -37,7 +37,7 @@ #include "vpiecenode.h" #include "vpiecepath.h" #include "vpiecelabeldata.h" -#include "vpatterninfogeometry.h" +#include "vpatternlabeldata.h" #include "vgrainlinegeometry.h" QT_WARNING_PUSH @@ -96,7 +96,7 @@ public: VPieceLabelData m_ppData; /** @brief Pattern info coordinates */ - VPatternInfoGeometry m_piPatternInfo; + VPatternLabelData m_piPatternInfo; /** @brief m_glGrainline grainline geometry object*/ VGrainlineGeometry m_glGrainline; diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index 7329e8386..51b93374f 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -31,7 +31,7 @@ #include "dialogtool.h" #include "../vpatterndb/vpiece.h" -#include "../vpatterndb/vpatterninfogeometry.h" +#include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vgrainlinegeometry.h" @@ -137,7 +137,7 @@ private: MCPContainer m_conMCP; VPieceLabelData m_oldData; - VPatternInfoGeometry m_oldGeom; + VPatternLabelData m_oldGeom; VGrainlineGeometry m_oldGrainline; int m_iRotBaseHeight; int m_iLenBaseHeight; diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 79f650046..fd52cb531 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -31,7 +31,7 @@ #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/calculator.h" -#include "../vpatterndb/vpatterninfogeometry.h" +#include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vpiecelabeldata.h" #include "nodeDetails/vnodearc.h" #include "nodeDetails/vnodeellipticalarc.h" @@ -272,7 +272,7 @@ void VToolSeamAllowance::AddPatternPieceData(VAbstractPattern *doc, QDomElement void VToolSeamAllowance::AddPatternInfo(VAbstractPattern *doc, QDomElement &domElement, const VPiece &piece) { QDomElement domData = doc->createElement(VAbstractPattern::TagPatternInfo); - const VPatternInfoGeometry& geom = piece.GetPatternInfo(); + const VPatternLabelData& geom = piece.GetPatternInfo(); doc->SetAttribute(domData, VAbstractPattern::AttrVisible, geom.IsVisible() == true ? trueStr : falseStr); doc->SetAttribute(domData, AttrMx, geom.GetPos().x()); doc->SetAttribute(domData, AttrMy, geom.GetPos().y()); @@ -460,7 +460,7 @@ void VToolSeamAllowance::UpdateLabel() void VToolSeamAllowance::UpdatePatternInfo() { const VPiece detail = VAbstractTool::data.GetPiece(id); - const VPatternInfoGeometry& geom = detail.GetPatternInfo(); + const VPatternLabelData& geom = detail.GetPatternInfo(); if (geom.IsVisible() == true) { diff --git a/src/libs/vtools/undocommands/savepieceoptions.cpp b/src/libs/vtools/undocommands/savepieceoptions.cpp index 3d44ddc9a..f4c059feb 100644 --- a/src/libs/vtools/undocommands/savepieceoptions.cpp +++ b/src/libs/vtools/undocommands/savepieceoptions.cpp @@ -38,7 +38,7 @@ #include "../vmisc/logging.h" #include "../vmisc/def.h" #include "../vpatterndb/vpiecenode.h" -#include "../vpatterndb/vpatterninfogeometry.h" +#include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vgrainlinegeometry.h" #include "../tools/vtoolseamallowance.h" From a287913500fcaeb80987704751fa0d57c717207d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 11:33:17 +0200 Subject: [PATCH 20/52] Refactoring. Rename class VGrainlineGeometry to VGrainlineData. --HG-- branch : feature --- src/app/valentina/mainwindowsnogui.cpp | 2 +- src/app/valentina/xml/vpattern.cpp | 6 ++--- src/libs/vlayout/vlayoutpiece.cpp | 8 +++--- src/libs/vlayout/vlayoutpiece.h | 2 +- src/libs/vlayout/vlayoutpiece_p.h | 4 +-- ...ainlinegeometry.cpp => vgrainlinedata.cpp} | 26 +++++++++---------- ...{vgrainlinegeometry.h => vgrainlinedata.h} | 9 ++++--- src/libs/vpatterndb/vpatterndb.pri | 8 +++--- src/libs/vpatterndb/vpiece.cpp | 4 +-- src/libs/vpatterndb/vpiece.h | 6 ++--- src/libs/vpatterndb/vpiece_p.h | 4 +-- .../dialogs/tools/dialogseamallowance.cpp | 2 +- .../dialogs/tools/dialogseamallowance.h | 4 +-- src/libs/vtools/tools/vtoolseamallowance.cpp | 4 +-- .../vtools/undocommands/savepieceoptions.cpp | 2 +- src/libs/vwidgets/vgrainlineitem.cpp | 8 +++--- src/libs/vwidgets/vgrainlineitem.h | 6 ++--- 17 files changed, 53 insertions(+), 52 deletions(-) rename src/libs/vpatterndb/{vgrainlinegeometry.cpp => vgrainlinedata.cpp} (82%) rename src/libs/vpatterndb/{vgrainlinegeometry.h => vgrainlinedata.h} (94%) diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 8f77f123d..a17821cbf 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -39,7 +39,7 @@ #include "../vlayout/vposter.h" #include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" #include "../vtools/tools/vabstracttool.h" #include diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 819c472cb..4d75d8627 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -53,7 +53,7 @@ #include "../vpatterndb/calculator.h" #include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" #include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/vnodedetail.h" @@ -874,8 +874,8 @@ void VPattern::ParsePieceGrainline(const QDomElement &domElement, VPiece &detail detail.GetGrainlineGeometry().SetLength(qsLength); QString qsRot = GetParametrString(domElement, AttrRotation, "90"); detail.GetGrainlineGeometry().SetRotation(qsRot); - VGrainlineGeometry::ArrowType eAT = - VGrainlineGeometry::ArrowType(GetParametrUInt(domElement, AttrArrows, "0")); + VGrainlineData::ArrowType eAT = + VGrainlineData::ArrowType(GetParametrUInt(domElement, AttrArrows, "0")); detail.GetGrainlineGeometry().SetArrowType(eAT); } diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index a7e164caa..8728d049f 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -117,7 +117,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern VAbstractPattern* pDoc = qApp->getCurrentDocument(); det.SetPatternInfo(pDoc, geom, qApp->font(), pattern->size(), pattern->height()); } - const VGrainlineGeometry& grainlineGeom = piece.GetGrainlineGeometry(); + const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry(); if (grainlineGeom.IsVisible() == true) { det.SetGrainline(grainlineGeom, *pattern); @@ -230,7 +230,7 @@ void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLa } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::SetGrainline(const VGrainlineGeometry& geom, const VContainer& rPattern) +void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer& rPattern) { d->grainlineGeom = geom; qreal dAng; @@ -267,7 +267,7 @@ void VLayoutPiece::SetGrainline(const VGrainlineGeometry& geom, const VContainer v << pt1; - if (geom.GetArrowType() != VGrainlineGeometry::atRear) { + if (geom.GetArrowType() != VGrainlineData::atRear) { pt.setX(pt1.x() + dArrowLen * qCos(dAng + dArrowAng)); pt.setY(pt1.y() - dArrowLen * qSin(dAng + dArrowAng)); v << pt; @@ -280,7 +280,7 @@ void VLayoutPiece::SetGrainline(const VGrainlineGeometry& geom, const VContainer v << pt2; - if (geom.GetArrowType() != VGrainlineGeometry::atFront) + if (geom.GetArrowType() != VGrainlineData::atFront) { dAng += M_PI; diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index d96e0523f..dcb9eb9ee 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -78,7 +78,7 @@ public: void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont& font, qreal dSize, qreal dHeight); - void SetGrainline(const VGrainlineGeometry& geom, const VContainer& rPattern); + void SetGrainline(const VGrainlineData& geom, const VContainer& rPattern); QTransform GetMatrix() const; void SetMatrix(const QTransform &matrix); diff --git a/src/libs/vlayout/vlayoutpiece_p.h b/src/libs/vlayout/vlayoutpiece_p.h index 5997df368..d35e744f0 100644 --- a/src/libs/vlayout/vlayoutpiece_p.h +++ b/src/libs/vlayout/vlayoutpiece_p.h @@ -36,7 +36,7 @@ #include "../vpatterndb/vpiecelabeldata.h" #include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" #include "../vmisc/diagnostic.h" #include "vlayoutpiecepath.h" @@ -120,7 +120,7 @@ public: /** @brief patternGeom pattern geometry */ VPatternLabelData patternGeom; /** @brief grainlineGeom grainline geometry */ - VGrainlineGeometry grainlineGeom; + VGrainlineData grainlineGeom; /** @brief m_tmDetail text manager for laying out detail info */ VTextManager m_tmDetail; /** @brief m_tmPattern text manager for laying out pattern info */ diff --git a/src/libs/vpatterndb/vgrainlinegeometry.cpp b/src/libs/vpatterndb/vgrainlinedata.cpp similarity index 82% rename from src/libs/vpatterndb/vgrainlinegeometry.cpp rename to src/libs/vpatterndb/vgrainlinedata.cpp index e1f3b6ccb..143270a53 100644 --- a/src/libs/vpatterndb/vgrainlinegeometry.cpp +++ b/src/libs/vpatterndb/vgrainlinedata.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vgrainlinegeometry.cpp + ** @file vgrainlinedata.cpp ** @author Bojan Kverh ** @date September 06, 2016 ** @@ -28,80 +28,80 @@ #include -#include "vgrainlinegeometry.h" +#include "vgrainlinedata.h" //--------------------------------------------------------------------------------------------------------------------- -VGrainlineGeometry::VGrainlineGeometry() +VGrainlineData::VGrainlineData() :m_ptPos(0, 0), m_qsLength(), m_qsRotation(), m_bVisible(false), m_eArrowType(atBoth) {} //--------------------------------------------------------------------------------------------------------------------- -QPointF VGrainlineGeometry::GetPos() const +QPointF VGrainlineData::GetPos() const { return m_ptPos; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineGeometry::SetPos(const QPointF &ptPos) +void VGrainlineData::SetPos(const QPointF &ptPos) { m_ptPos = ptPos; } //--------------------------------------------------------------------------------------------------------------------- -QString VGrainlineGeometry::GetLength() const +QString VGrainlineData::GetLength() const { return m_qsLength; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineGeometry::SetLength(const QString& qsLen) +void VGrainlineData::SetLength(const QString& qsLen) { m_qsLength = qsLen; } //--------------------------------------------------------------------------------------------------------------------- -QString VGrainlineGeometry::GetRotation() const +QString VGrainlineData::GetRotation() const { return m_qsRotation; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineGeometry::SetRotation(const QString& qsRot) +void VGrainlineData::SetRotation(const QString& qsRot) { m_qsRotation = qsRot; } //--------------------------------------------------------------------------------------------------------------------- -bool VGrainlineGeometry::IsVisible() const +bool VGrainlineData::IsVisible() const { return m_bVisible; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineGeometry::SetVisible(bool bVisible) +void VGrainlineData::SetVisible(bool bVisible) { m_bVisible = bVisible; } //--------------------------------------------------------------------------------------------------------------------- -VGrainlineGeometry::ArrowType VGrainlineGeometry::GetArrowType() const +VGrainlineData::ArrowType VGrainlineData::GetArrowType() const { return m_eArrowType; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineGeometry::SetArrowType(ArrowType eAT) +void VGrainlineData::SetArrowType(ArrowType eAT) { m_eArrowType = eAT; } diff --git a/src/libs/vpatterndb/vgrainlinegeometry.h b/src/libs/vpatterndb/vgrainlinedata.h similarity index 94% rename from src/libs/vpatterndb/vgrainlinegeometry.h rename to src/libs/vpatterndb/vgrainlinedata.h index a220680f1..698a4bcb3 100644 --- a/src/libs/vpatterndb/vgrainlinegeometry.h +++ b/src/libs/vpatterndb/vgrainlinedata.h @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vgrainlinegeometry.h + ** @file vgrainlinedata.h ** @author Bojan Kverh ** @date September 06, 2016 ** @@ -31,12 +31,13 @@ #include #include +#include /** - * @brief The VGrainlineGeometry class holds information about a grainline like + * @brief The VGrainlineData class holds information about a grainline like * position, size, rotation and visibility */ -class VGrainlineGeometry +class VGrainlineData { public: // denotes the type of arrow for the grainline @@ -47,7 +48,7 @@ public: atRear }; - VGrainlineGeometry(); + VGrainlineData(); // methods, which set and return values of different parameters QPointF GetPos() const; diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index 1075b6269..d3bf388cb 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -17,14 +17,14 @@ SOURCES += \ $$PWD/variables/vmeasurement.cpp \ $$PWD/variables/vvariable.cpp \ $$PWD/vformula.cpp \ - $$PWD/vgrainlinegeometry.cpp \ $$PWD/variables/vcurveclength.cpp \ $$PWD/variables/vellipticalarcradius.cpp \ $$PWD/vpiece.cpp \ $$PWD/vpiecenode.cpp \ $$PWD/vpiecepath.cpp \ $$PWD/vpiecelabeldata.cpp \ - $$PWD/vpatternlabeldata.cpp + $$PWD/vpatternlabeldata.cpp \ + $$PWD/vgrainlinedata.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -55,7 +55,6 @@ HEADERS += \ $$PWD/variables/vvariable.h \ $$PWD/variables/vvariable_p.h \ $$PWD/vformula.h \ - $$PWD/vgrainlinegeometry.h \ $$PWD/variables/vcurveclength.h \ $$PWD/variables/vellipticalarcradius.h \ $$PWD/vpiece.h \ @@ -65,4 +64,5 @@ HEADERS += \ $$PWD/vpiecepath.h \ $$PWD/vpiecepath_p.h \ $$PWD/vpiecelabeldata.h \ - $$PWD/vpatternlabeldata.h + $$PWD/vpatternlabeldata.h \ + $$PWD/vgrainlinedata.h diff --git a/src/libs/vpatterndb/vpiece.cpp b/src/libs/vpatterndb/vpiece.cpp index 13abe5491..ef954c760 100644 --- a/src/libs/vpatterndb/vpiece.cpp +++ b/src/libs/vpatterndb/vpiece.cpp @@ -469,7 +469,7 @@ const VPatternLabelData &VPiece::GetPatternInfo() const * @brief VDetail::GetGrainlineGeometry full access to the grainline geometry object * @return reference to grainline geometry object */ -VGrainlineGeometry &VPiece::GetGrainlineGeometry() +VGrainlineData &VPiece::GetGrainlineGeometry() { return d->m_glGrainline; } @@ -479,7 +479,7 @@ VGrainlineGeometry &VPiece::GetGrainlineGeometry() * @brief VDetail::GetGrainlineGeometry returns the read-only reference to the grainline geometry object * @return reference to grainline geometry object */ -const VGrainlineGeometry &VPiece::GetGrainlineGeometry() const +const VGrainlineData &VPiece::GetGrainlineGeometry() const { return d->m_glGrainline; } diff --git a/src/libs/vpatterndb/vpiece.h b/src/libs/vpatterndb/vpiece.h index e20b1e644..31c7fe476 100644 --- a/src/libs/vpatterndb/vpiece.h +++ b/src/libs/vpatterndb/vpiece.h @@ -41,7 +41,7 @@ template class QSharedPointer; class VPiecePath; class VPatternLabelData; class VPieceLabelData; -class VGrainlineGeometry; +class VGrainlineData; class VContainer; class QPainterPath; class VPointF; @@ -105,8 +105,8 @@ public: VPatternLabelData& GetPatternInfo(); const VPatternLabelData& GetPatternInfo() const; - VGrainlineGeometry& GetGrainlineGeometry(); - const VGrainlineGeometry& GetGrainlineGeometry() const; + VGrainlineData& GetGrainlineGeometry(); + const VGrainlineData& GetGrainlineGeometry() const; private: QSharedDataPointer d; diff --git a/src/libs/vpatterndb/vpiece_p.h b/src/libs/vpatterndb/vpiece_p.h index 2d735ee42..229e3174b 100644 --- a/src/libs/vpatterndb/vpiece_p.h +++ b/src/libs/vpatterndb/vpiece_p.h @@ -38,7 +38,7 @@ #include "vpiecepath.h" #include "vpiecelabeldata.h" #include "vpatternlabeldata.h" -#include "vgrainlinegeometry.h" +#include "vgrainlinedata.h" QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Weffc++") @@ -99,7 +99,7 @@ public: VPatternLabelData m_piPatternInfo; /** @brief m_glGrainline grainline geometry object*/ - VGrainlineGeometry m_glGrainline; + VGrainlineData m_glGrainline; QString m_formulaWidth; diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index c4a62171a..2f860f7d1 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -1307,7 +1307,7 @@ VPiece DialogSeamAllowance::CreatePiece() const piece.GetGrainlineGeometry().SetVisible(ui->checkBoxGrainline->isChecked()); piece.GetGrainlineGeometry().SetRotation(GetFormulaFromUser(ui->lineEditRotFormula)); piece.GetGrainlineGeometry().SetLength(GetFormulaFromUser(ui->lineEditLenFormula)); - piece.GetGrainlineGeometry().SetArrowType(VGrainlineGeometry::ArrowType(ui->comboBoxArrow->currentIndex())); + piece.GetGrainlineGeometry().SetArrowType(VGrainlineData::ArrowType(ui->comboBoxArrow->currentIndex())); return piece; } diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index 51b93374f..58d5f55b9 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -33,7 +33,7 @@ #include "../vpatterndb/vpiece.h" #include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" namespace Ui { @@ -138,7 +138,7 @@ private: VPieceLabelData m_oldData; VPatternLabelData m_oldGeom; - VGrainlineGeometry m_oldGrainline; + VGrainlineData m_oldGrainline; int m_iRotBaseHeight; int m_iLenBaseHeight; int m_formulaBaseWidth; diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index fd52cb531..85a40b491 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -288,7 +288,7 @@ void VToolSeamAllowance::AddGrainline(VAbstractPattern *doc, QDomElement &domEle { // grainline QDomElement domData = doc->createElement(VAbstractPattern::TagGrainline); - const VGrainlineGeometry& glGeom = piece.GetGrainlineGeometry(); + const VGrainlineData& glGeom = piece.GetGrainlineGeometry(); doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true ? trueStr : falseStr); doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x()); doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y()); @@ -506,7 +506,7 @@ void VToolSeamAllowance::UpdatePatternInfo() void VToolSeamAllowance::UpdateGrainline() { const VPiece detail = VAbstractTool::data.GetPiece(id); - const VGrainlineGeometry& geom = detail.GetGrainlineGeometry(); + const VGrainlineData& geom = detail.GetGrainlineGeometry(); if (geom.IsVisible() == true) { diff --git a/src/libs/vtools/undocommands/savepieceoptions.cpp b/src/libs/vtools/undocommands/savepieceoptions.cpp index f4c059feb..9ac8a28f2 100644 --- a/src/libs/vtools/undocommands/savepieceoptions.cpp +++ b/src/libs/vtools/undocommands/savepieceoptions.cpp @@ -40,7 +40,7 @@ #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpatternlabeldata.h" #include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" #include "../tools/vtoolseamallowance.h" #include "vundocommand.h" diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index 954216651..c0c8f90d8 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -65,7 +65,7 @@ VGrainlineItem::VGrainlineItem(QGraphicsItem* pParent) m_ptFinish(), m_ptCenter(), m_dAngle(0), - m_eArrowType(VGrainlineGeometry::atBoth) + m_eArrowType(VGrainlineData::atBoth) { m_inactiveZ = 5; Reset(); @@ -107,7 +107,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption QPolygonF poly; QPointF ptA; qreal dArrLen = ARROW_LENGTH*m_dScale; - if (m_eArrowType != VGrainlineGeometry::atRear) + if (m_eArrowType != VGrainlineData::atRear) { // first arrow poly << pt1; @@ -119,7 +119,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption poly << ptA; pP->drawPolygon(poly); } - if (m_eArrowType != VGrainlineGeometry::atFront) + if (m_eArrowType != VGrainlineData::atFront) { // second arrow poly.clear(); @@ -188,7 +188,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption * @param dLength length of the grainline in user's units */ void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, - VGrainlineGeometry::ArrowType eAT) + VGrainlineData::ArrowType eAT) { m_dRotation = qDegreesToRadians(dRotation); m_dLength = dLength; diff --git a/src/libs/vwidgets/vgrainlineitem.h b/src/libs/vwidgets/vgrainlineitem.h index 613119033..8a0180fc6 100644 --- a/src/libs/vwidgets/vgrainlineitem.h +++ b/src/libs/vwidgets/vgrainlineitem.h @@ -30,7 +30,7 @@ #define VGRAINLINEITEM_H #include "vpieceitem.h" -#include "../vpatterndb/vgrainlinegeometry.h" +#include "../vpatterndb/vgrainlinedata.h" class VGrainlineItem : public VPieceItem { @@ -41,7 +41,7 @@ public: virtual void paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption, QWidget* pWidget) Q_DECL_OVERRIDE; void UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, - VGrainlineGeometry::ArrowType eAT); + VGrainlineData::ArrowType eAT); bool IsContained(const QPointF &pt, qreal dRot, qreal &dX, qreal &dY) const; void SetScale(qreal dScale); @@ -75,7 +75,7 @@ private: QPointF m_ptFinish; QPointF m_ptCenter; qreal m_dAngle; - VGrainlineGeometry::ArrowType m_eArrowType; + VGrainlineData::ArrowType m_eArrowType; }; #endif // VGRAINLINEITEM_H From 1710e3cdb7670880425aae3129866d9af7c7e0d0 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 11:37:19 +0200 Subject: [PATCH 21/52] Refactoring. Prepare folder structure for new hierarchy. --HG-- branch : feature --- src/app/valentina/mainwindowsnogui.cpp | 6 +- src/app/valentina/xml/vpattern.cpp | 6 +- src/libs/vlayout/vlayoutpiece.cpp | 4 +- src/libs/vlayout/vlayoutpiece.h | 4 +- src/libs/vlayout/vlayoutpiece_p.h | 6 +- src/libs/vlayout/vtextmanager.cpp | 2 +- .../{ => floatItemData}/vgrainlinedata.cpp | 0 .../{ => floatItemData}/vgrainlinedata.h | 0 .../{ => floatItemData}/vpatternlabeldata.cpp | 14 ++- .../{ => floatItemData}/vpatternlabeldata.h | 34 ++++--- .../{ => floatItemData}/vpiecelabeldata.cpp | 91 +++---------------- .../{ => floatItemData}/vpiecelabeldata.h | 68 +++----------- src/libs/vpatterndb/vpatterndb.pri | 12 +-- src/libs/vpatterndb/vpiece_p.h | 6 +- .../dialogs/tools/dialogseamallowance.h | 6 +- src/libs/vtools/tools/vtoolseamallowance.cpp | 4 +- .../vtools/undocommands/savepieceoptions.cpp | 6 +- src/libs/vwidgets/vgrainlineitem.h | 2 +- 18 files changed, 87 insertions(+), 184 deletions(-) rename src/libs/vpatterndb/{ => floatItemData}/vgrainlinedata.cpp (100%) rename src/libs/vpatterndb/{ => floatItemData}/vgrainlinedata.h (100%) rename src/libs/vpatterndb/{ => floatItemData}/vpatternlabeldata.cpp (95%) rename src/libs/vpatterndb/{ => floatItemData}/vpatternlabeldata.h (74%) rename src/libs/vpatterndb/{ => floatItemData}/vpiecelabeldata.cpp (59%) rename src/libs/vpatterndb/{ => floatItemData}/vpiecelabeldata.h (58%) diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index a17821cbf..ed2928768 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -37,9 +37,9 @@ #include "dialogs/dialoglayoutprogress.h" #include "dialogs/dialogsavelayout.h" #include "../vlayout/vposter.h" -#include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vgrainlinedata.h" +#include "../vpatterndb/floatItemData/vpiecelabeldata.h" +#include "../vpatterndb/floatItemData/vpatternlabeldata.h" +#include "../vpatterndb/floatItemData/vgrainlinedata.h" #include "../vtools/tools/vabstracttool.h" #include diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 4d75d8627..deb68b924 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -51,9 +51,9 @@ #include "../core/vapplication.h" #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/calculator.h" -#include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vgrainlinedata.h" +#include "../vpatterndb/floatItemData/vpiecelabeldata.h" +#include "../vpatterndb/floatItemData/vpatternlabeldata.h" +#include "../vpatterndb/floatItemData/vgrainlinedata.h" #include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/vnodedetail.h" diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 8728d049f..30a4063a1 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -43,8 +43,8 @@ #include #include -#include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vpiecelabeldata.h" +#include "../vpatterndb/floatItemData/vpatternlabeldata.h" +#include "../vpatterndb/floatItemData/vpiecelabeldata.h" #include "../vmisc/vmath.h" #include "../vmisc/vabstractapplication.h" #include "../vpatterndb/calculator.h" diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index dcb9eb9ee..33299d450 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -42,8 +42,8 @@ #include #include "../ifc/xml/vabstractpattern.h" -#include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vpiecelabeldata.h" +#include "../vpatterndb/floatItemData/vpatternlabeldata.h" +#include "../vpatterndb/floatItemData/vpiecelabeldata.h" #include "../vpatterndb/vcontainer.h" #include "vabstractpiece.h" diff --git a/src/libs/vlayout/vlayoutpiece_p.h b/src/libs/vlayout/vlayoutpiece_p.h index d35e744f0..4e42fb3b2 100644 --- a/src/libs/vlayout/vlayoutpiece_p.h +++ b/src/libs/vlayout/vlayoutpiece_p.h @@ -34,9 +34,9 @@ #include #include -#include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vgrainlinedata.h" +#include "../vpatterndb/floatItemData/vpiecelabeldata.h" +#include "../vpatterndb/floatItemData/vpatternlabeldata.h" +#include "../vpatterndb/floatItemData/vgrainlinedata.h" #include "../vmisc/diagnostic.h" #include "vlayoutpiecepath.h" diff --git a/src/libs/vlayout/vtextmanager.cpp b/src/libs/vlayout/vtextmanager.cpp index e245a331d..41d043e7b 100644 --- a/src/libs/vlayout/vtextmanager.cpp +++ b/src/libs/vlayout/vtextmanager.cpp @@ -35,7 +35,7 @@ #include #include "../ifc/xml/vabstractpattern.h" -#include "../vpatterndb/vpiecelabeldata.h" +#include "../vpatterndb/floatItemData/vpiecelabeldata.h" #include "../vmisc/vabstractapplication.h" #include "../vmisc/vmath.h" #include "vtextmanager.h" diff --git a/src/libs/vpatterndb/vgrainlinedata.cpp b/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp similarity index 100% rename from src/libs/vpatterndb/vgrainlinedata.cpp rename to src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp diff --git a/src/libs/vpatterndb/vgrainlinedata.h b/src/libs/vpatterndb/floatItemData/vgrainlinedata.h similarity index 100% rename from src/libs/vpatterndb/vgrainlinedata.h rename to src/libs/vpatterndb/floatItemData/vgrainlinedata.h diff --git a/src/libs/vpatterndb/vpatternlabeldata.cpp b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp similarity index 95% rename from src/libs/vpatterndb/vpatternlabeldata.cpp rename to src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp index 1f3852763..d813cf0c5 100644 --- a/src/libs/vpatterndb/vpatternlabeldata.cpp +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp @@ -30,8 +30,16 @@ //--------------------------------------------------------------------------------------------------------------------- VPatternLabelData::VPatternLabelData() - :m_ptPos(0, 0), m_dLabelWidth(0), m_dLabelHeight(0), m_iFontSize(0), - m_dRotation(0), m_bVisible(true) + : m_ptPos(), + m_dLabelWidth(0), + m_dLabelHeight(0), + m_iFontSize(0), + m_dRotation(0), + m_bVisible(true) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VPatternLabelData::~VPatternLabelData() {} //--------------------------------------------------------------------------------------------------------------------- @@ -105,5 +113,3 @@ void VPatternLabelData::SetVisible(bool bVal) { m_bVisible = bVal; } - -//--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vpatterndb/vpatternlabeldata.h b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h similarity index 74% rename from src/libs/vpatterndb/vpatternlabeldata.h rename to src/libs/vpatterndb/floatItemData/vpatternlabeldata.h index b3d818a0c..1279f2283 100644 --- a/src/libs/vpatterndb/vpatternlabeldata.h +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h @@ -39,22 +39,28 @@ class VPatternLabelData { public: VPatternLabelData(); + virtual ~VPatternLabelData(); // methods, which set up label parameters - QPointF GetPos() const; - void SetPos(const QPointF& ptPos); - qreal GetLabelWidth() const; - void SetLabelWidth(qreal dLabelW); - qreal GetLabelHeight() const; - void SetLabelHeight(qreal dLabelH); - int GetFontSize() const; - void SetFontSize(int iSize); - qreal GetRotation() const; - void SetRotation(qreal dRot); - bool IsVisible() const; - void SetVisible(bool bVal); + QPointF GetPos() const; + void SetPos(const QPointF& ptPos); -private: + qreal GetLabelWidth() const; + void SetLabelWidth(qreal dLabelW); + + qreal GetLabelHeight() const; + void SetLabelHeight(qreal dLabelH); + + int GetFontSize() const; + void SetFontSize(int iSize); + + qreal GetRotation() const; + void SetRotation(qreal dRot); + + bool IsVisible() const; + void SetVisible(bool bVal); + +protected: /** * @brief m_ptPos position of label's top left corner */ @@ -72,7 +78,7 @@ private: */ int m_iFontSize; /** - * @brief m_dRotation Label rotation + * @brief m_dRotation label rotation */ qreal m_dRotation; /** diff --git a/src/libs/vpatterndb/vpiecelabeldata.cpp b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.cpp similarity index 59% rename from src/libs/vpatterndb/vpiecelabeldata.cpp rename to src/libs/vpatterndb/floatItemData/vpiecelabeldata.cpp index 4adf35eb0..ecfafc6c0 100644 --- a/src/libs/vpatterndb/vpiecelabeldata.cpp +++ b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.cpp @@ -28,15 +28,25 @@ #include "vpiecelabeldata.h" +#include + //--------------------------------------------------------------------------------------------------------------------- MaterialCutPlacement::MaterialCutPlacement() - :m_eMaterial(MaterialType::mtFabric), m_qsMaterialUserDef(), m_iCutNumber(0), m_ePlacement(PlacementType::ptNone) + : m_eMaterial(MaterialType::mtFabric), + m_qsMaterialUserDef(), + m_iCutNumber(0), + m_ePlacement(PlacementType::ptNone) {} //--------------------------------------------------------------------------------------------------------------------- VPieceLabelData::VPieceLabelData() - :m_qsLetter(), m_conMCP(), m_ptPos(0, 0), m_dLabelWidth(0), m_dLabelHeight(0), - m_iFontSize(0), m_dRotation(0), m_bVisible(true) + : VPatternLabelData(), + m_qsLetter(), + m_conMCP() +{} + +//--------------------------------------------------------------------------------------------------------------------- +VPieceLabelData::~VPieceLabelData() {} //--------------------------------------------------------------------------------------------------------------------- @@ -101,78 +111,3 @@ void VPieceLabelData::SetLetter(QString qsLetter) { m_qsLetter = qsLetter.left(3); } - -//--------------------------------------------------------------------------------------------------------------------- -QPointF VPieceLabelData::GetPos() const -{ - return m_ptPos; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VPieceLabelData::SetPos(const QPointF& ptPos) -{ - m_ptPos = ptPos; -} - -//--------------------------------------------------------------------------------------------------------------------- -qreal VPieceLabelData::GetLabelWidth() const -{ - return m_dLabelWidth; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VPieceLabelData::SetLabelWidth(qreal dLabelW) -{ - m_dLabelWidth = dLabelW; -} - -//--------------------------------------------------------------------------------------------------------------------- -qreal VPieceLabelData::GetLabelHeight() const -{ - return m_dLabelHeight; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VPieceLabelData::SetLabelHeight(qreal dLabelH) -{ - m_dLabelHeight = dLabelH; -} - -//--------------------------------------------------------------------------------------------------------------------- -int VPieceLabelData::GetFontSize() const -{ - return m_iFontSize; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VPieceLabelData::SetFontSize(int iSize) -{ - m_iFontSize = iSize; -} - -//--------------------------------------------------------------------------------------------------------------------- -qreal VPieceLabelData::GetRotation() const -{ - return m_dRotation; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VPieceLabelData::SetRotation(qreal dRot) -{ - m_dRotation = dRot; -} - -//--------------------------------------------------------------------------------------------------------------------- -bool VPieceLabelData::IsVisible() const -{ - return m_bVisible; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VPieceLabelData::SetVisible(bool bVal) -{ - m_bVisible = bVal; -} - -//--------------------------------------------------------------------------------------------------------------------- - diff --git a/src/libs/vpatterndb/vpiecelabeldata.h b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.h similarity index 58% rename from src/libs/vpatterndb/vpiecelabeldata.h rename to src/libs/vpatterndb/floatItemData/vpiecelabeldata.h index 52103e3d6..273df823c 100644 --- a/src/libs/vpatterndb/vpiecelabeldata.h +++ b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.h @@ -30,11 +30,9 @@ #define VPATTERNPIECEDATA_H #include -#include -#include #include -#include -#include + +#include "vpatternlabeldata.h" enum class MaterialType : char { @@ -56,10 +54,10 @@ enum class PlacementType : char */ struct MaterialCutPlacement { - MaterialType m_eMaterial; - QString m_qsMaterialUserDef; - int m_iCutNumber; - PlacementType m_ePlacement; + MaterialType m_eMaterial; + QString m_qsMaterialUserDef; + int m_iCutNumber; + PlacementType m_ePlacement; MaterialCutPlacement(); }; @@ -70,10 +68,11 @@ typedef QList MCPContainer; * @brief The VPieceLabelData class holds some information about a single * piece like letter, name, material type, cut number and placement. */ -class VPieceLabelData +class VPieceLabelData : public VPatternLabelData { public: VPieceLabelData(); + virtual ~VPieceLabelData(); // methods, which operate on MaterialCutPlacement container void Append(const MaterialCutPlacement& rMCP); @@ -88,54 +87,11 @@ public: const QString& GetLetter() const; void SetLetter(QString qsLetter); - // methods, which set up label parameters - QPointF GetPos() const; - void SetPos(const QPointF& ptPos); - qreal GetLabelWidth() const; - void SetLabelWidth(qreal dLabelW); - qreal GetLabelHeight() const; - void SetLabelHeight(qreal dLabelH); - int GetFontSize() const; - void SetFontSize(int iSize); - qreal GetRotation() const; - void SetRotation(qreal dRot); - bool IsVisible() const; - void SetVisible(bool bVal); - private: - /** - * @brief m_qsLetter Detail letter (should be no more than 3 characters) - */ - QString m_qsLetter; - /** - * @brief m_conMCP List of material, cut, placement tuples - */ - MCPContainer m_conMCP; - /** - * @brief m_ptPos position of label's top left corner - */ - QPointF m_ptPos; - /** - * @brief m_dLabelWidth label width - */ - qreal m_dLabelWidth; - /** - * @brief m_dLabelHeight label height - */ - qreal m_dLabelHeight; - /** - * @brief m_iFontSize label font size - */ - int m_iFontSize; - /** - * @brief m_dRotation label rotation - */ - qreal m_dRotation; - /** - * @brief m_bVisible visibility flag - */ - bool m_bVisible; - + /** @brief m_qsLetter Detail letter (should be no more than 3 characters) */ + QString m_qsLetter; + /** @brief m_conMCP List of material, cut, placement tuples */ + MCPContainer m_conMCP; }; #endif // VPATTERNPIECEDATA_H diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index d3bf388cb..7ce9e3735 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -22,9 +22,9 @@ SOURCES += \ $$PWD/vpiece.cpp \ $$PWD/vpiecenode.cpp \ $$PWD/vpiecepath.cpp \ - $$PWD/vpiecelabeldata.cpp \ - $$PWD/vpatternlabeldata.cpp \ - $$PWD/vgrainlinedata.cpp + $$PWD/floatItemData/vpiecelabeldata.cpp \ + $$PWD/floatItemData/vpatternlabeldata.cpp \ + $$PWD/floatItemData/vgrainlinedata.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -63,6 +63,6 @@ HEADERS += \ $$PWD/vpiecenode_p.h \ $$PWD/vpiecepath.h \ $$PWD/vpiecepath_p.h \ - $$PWD/vpiecelabeldata.h \ - $$PWD/vpatternlabeldata.h \ - $$PWD/vgrainlinedata.h + $$PWD/floatItemData/vpiecelabeldata.h \ + $$PWD/floatItemData/vpatternlabeldata.h \ + $$PWD/floatItemData/vgrainlinedata.h diff --git a/src/libs/vpatterndb/vpiece_p.h b/src/libs/vpatterndb/vpiece_p.h index 229e3174b..be91f663f 100644 --- a/src/libs/vpatterndb/vpiece_p.h +++ b/src/libs/vpatterndb/vpiece_p.h @@ -36,9 +36,9 @@ #include "../vmisc/def.h" #include "vpiecenode.h" #include "vpiecepath.h" -#include "vpiecelabeldata.h" -#include "vpatternlabeldata.h" -#include "vgrainlinedata.h" +#include "floatItemData/vpiecelabeldata.h" +#include "floatItemData/vpatternlabeldata.h" +#include "floatItemData/vgrainlinedata.h" QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Weffc++") diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index 58d5f55b9..3205a366a 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -31,9 +31,9 @@ #include "dialogtool.h" #include "../vpatterndb/vpiece.h" -#include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vgrainlinedata.h" +#include "../vpatterndb/floatItemData/vpatternlabeldata.h" +#include "../vpatterndb/floatItemData/vpiecelabeldata.h" +#include "../vpatterndb/floatItemData/vgrainlinedata.h" namespace Ui { diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 85a40b491..710329d51 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -31,8 +31,8 @@ #include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpiecepath.h" #include "../vpatterndb/calculator.h" -#include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vpiecelabeldata.h" +#include "../vpatterndb/floatItemData/vpatternlabeldata.h" +#include "../vpatterndb/floatItemData/vpiecelabeldata.h" #include "nodeDetails/vnodearc.h" #include "nodeDetails/vnodeellipticalarc.h" #include "nodeDetails/vnodepoint.h" diff --git a/src/libs/vtools/undocommands/savepieceoptions.cpp b/src/libs/vtools/undocommands/savepieceoptions.cpp index 9ac8a28f2..91b587586 100644 --- a/src/libs/vtools/undocommands/savepieceoptions.cpp +++ b/src/libs/vtools/undocommands/savepieceoptions.cpp @@ -38,9 +38,9 @@ #include "../vmisc/logging.h" #include "../vmisc/def.h" #include "../vpatterndb/vpiecenode.h" -#include "../vpatterndb/vpatternlabeldata.h" -#include "../vpatterndb/vpiecelabeldata.h" -#include "../vpatterndb/vgrainlinedata.h" +#include "../vpatterndb/floatItemData/vpatternlabeldata.h" +#include "../vpatterndb/floatItemData/vpiecelabeldata.h" +#include "../vpatterndb/floatItemData/vgrainlinedata.h" #include "../tools/vtoolseamallowance.h" #include "vundocommand.h" diff --git a/src/libs/vwidgets/vgrainlineitem.h b/src/libs/vwidgets/vgrainlineitem.h index 8a0180fc6..a7b9ea89e 100644 --- a/src/libs/vwidgets/vgrainlineitem.h +++ b/src/libs/vwidgets/vgrainlineitem.h @@ -30,7 +30,7 @@ #define VGRAINLINEITEM_H #include "vpieceitem.h" -#include "../vpatterndb/vgrainlinedata.h" +#include "../vpatterndb/floatItemData/vgrainlinedata.h" class VGrainlineItem : public VPieceItem { From 3cfefbe698e6eb5b6d3162d9f27dba89102868cb Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 13:26:12 +0200 Subject: [PATCH 22/52] Refactoring. New parent VAbstractFloatItemData. --HG-- branch : feature --- .../floatItemData/vabstractfloatitemdata.cpp | 63 +++++++++++++++++++ .../floatItemData/vabstractfloatitemdata.h | 54 ++++++++++++++++ .../floatItemData/vgrainlinedata.cpp | 47 +++----------- .../vpatterndb/floatItemData/vgrainlinedata.h | 50 ++++++--------- .../floatItemData/vpatternlabeldata.cpp | 29 +-------- .../floatItemData/vpatternlabeldata.h | 43 ++++--------- src/libs/vpatterndb/vpatterndb.pri | 6 +- 7 files changed, 160 insertions(+), 132 deletions(-) create mode 100644 src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp create mode 100644 src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h diff --git a/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp new file mode 100644 index 000000000..a644098fa --- /dev/null +++ b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp @@ -0,0 +1,63 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 23 2, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#include "vabstractfloatitemdata.h" + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractFloatItemData::VAbstractFloatItemData() + : m_ptPos(), + m_bVisible(false) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractFloatItemData::~VAbstractFloatItemData() +{} + +//--------------------------------------------------------------------------------------------------------------------- +QPointF VAbstractFloatItemData::GetPos() const +{ + return m_ptPos; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractFloatItemData::SetPos(const QPointF &ptPos) +{ + m_ptPos = ptPos; +} + +//--------------------------------------------------------------------------------------------------------------------- +bool VAbstractFloatItemData::IsVisible() const +{ + return m_bVisible; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractFloatItemData::SetVisible(bool bVisible) +{ + m_bVisible = bVisible; +} diff --git a/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h new file mode 100644 index 000000000..17c07a0d1 --- /dev/null +++ b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h @@ -0,0 +1,54 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 23 2, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef VABSTRACTFLOATITEMDATA_H +#define VABSTRACTFLOATITEMDATA_H + +#include + +class VAbstractFloatItemData +{ +public: + VAbstractFloatItemData(); + virtual ~VAbstractFloatItemData(); + + // methods, which set and return values of different parameters + QPointF GetPos() const; + void SetPos(const QPointF& ptPos); + + bool IsVisible() const; + void SetVisible(bool bVisible); + +protected: + /** @brief m_ptPos position of label's top left corner */ + QPointF m_ptPos; + /** @brief m_bVisible visibility flag */ + bool m_bVisible; +}; + +#endif // VABSTRACTFLOATITEMDATA_H diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp b/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp index 143270a53..2fcdd3310 100644 --- a/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp @@ -31,80 +31,49 @@ #include "vgrainlinedata.h" //--------------------------------------------------------------------------------------------------------------------- - VGrainlineData::VGrainlineData() - :m_ptPos(0, 0), m_qsLength(), m_qsRotation(), m_bVisible(false), m_eArrowType(atBoth) + : VAbstractFloatItemData(), + m_qsLength(), + m_dRotation(), + m_eArrowType(atBoth) {} //--------------------------------------------------------------------------------------------------------------------- - -QPointF VGrainlineData::GetPos() const -{ - return m_ptPos; -} +VGrainlineData::~VGrainlineData() +{} //--------------------------------------------------------------------------------------------------------------------- - -void VGrainlineData::SetPos(const QPointF &ptPos) -{ - m_ptPos = ptPos; -} - -//--------------------------------------------------------------------------------------------------------------------- - QString VGrainlineData::GetLength() const { return m_qsLength; } //--------------------------------------------------------------------------------------------------------------------- - void VGrainlineData::SetLength(const QString& qsLen) { m_qsLength = qsLen; } //--------------------------------------------------------------------------------------------------------------------- - QString VGrainlineData::GetRotation() const { - return m_qsRotation; + return m_dRotation; } //--------------------------------------------------------------------------------------------------------------------- - void VGrainlineData::SetRotation(const QString& qsRot) { - m_qsRotation = qsRot; + m_dRotation = qsRot; } //--------------------------------------------------------------------------------------------------------------------- - -bool VGrainlineData::IsVisible() const -{ - return m_bVisible; -} - -//--------------------------------------------------------------------------------------------------------------------- - -void VGrainlineData::SetVisible(bool bVisible) -{ - m_bVisible = bVisible; -} - -//--------------------------------------------------------------------------------------------------------------------- - VGrainlineData::ArrowType VGrainlineData::GetArrowType() const { return m_eArrowType; } //--------------------------------------------------------------------------------------------------------------------- - void VGrainlineData::SetArrowType(ArrowType eAT) { m_eArrowType = eAT; } - -//--------------------------------------------------------------------------------------------------------------------- - diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata.h b/src/libs/vpatterndb/floatItemData/vgrainlinedata.h index 698a4bcb3..1d79b146d 100644 --- a/src/libs/vpatterndb/floatItemData/vgrainlinedata.h +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata.h @@ -29,15 +29,16 @@ #ifndef VGRAINLINEGEOMETRY_H #define VGRAINLINEGEOMETRY_H -#include #include #include +#include "vabstractfloatitemdata.h" + /** * @brief The VGrainlineData class holds information about a grainline like * position, size, rotation and visibility */ -class VGrainlineData +class VGrainlineData : public VAbstractFloatItemData { public: // denotes the type of arrow for the grainline @@ -49,40 +50,25 @@ public: }; VGrainlineData(); + virtual ~VGrainlineData(); // methods, which set and return values of different parameters - QPointF GetPos() const; - void SetPos(const QPointF& ptPos); - QString GetLength() const; - void SetLength(const QString& qsLen); - QString GetRotation() const; - void SetRotation(const QString& qsRot); - bool IsVisible() const; - void SetVisible(bool bVisible); - ArrowType GetArrowType() const; - void SetArrowType(ArrowType eAT); + QString GetLength() const; + void SetLength(const QString& qsLen); + + QString GetRotation() const; + void SetRotation(const QString& qsRot); + + ArrowType GetArrowType() const; + void SetArrowType(ArrowType eAT); private: - /** - * @brief m_ptPos position of grainline's center - */ - QPointF m_ptPos; - /** - * @brief m_dLength formula to calculate the length of grainline - */ - QString m_qsLength; - /** - * @brief m_dRotation formula to calculate the rotation of grainline in [degrees] - */ - QString m_qsRotation; - /** - * @brief m_bVisible visibility flag - */ - bool m_bVisible; - /** - * @brief m_eArrowType type of arrow on the grainline - */ - ArrowType m_eArrowType; + /** @brief m_dLength formula to calculate the length of grainline */ + QString m_qsLength; + /** @brief m_dRotation formula to calculate the rotation of grainline in [degrees] */ + QString m_dRotation; + /** @brief m_eArrowType type of arrow on the grainline */ + ArrowType m_eArrowType; }; #endif // VGRAINLINEGEOMETRY_H diff --git a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp index d813cf0c5..ee987a639 100644 --- a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp @@ -30,30 +30,17 @@ //--------------------------------------------------------------------------------------------------------------------- VPatternLabelData::VPatternLabelData() - : m_ptPos(), + : VAbstractFloatItemData(), m_dLabelWidth(0), m_dLabelHeight(0), m_iFontSize(0), - m_dRotation(0), - m_bVisible(true) + m_dRotation(0) {} //--------------------------------------------------------------------------------------------------------------------- VPatternLabelData::~VPatternLabelData() {} -//--------------------------------------------------------------------------------------------------------------------- -QPointF VPatternLabelData::GetPos() const -{ - return m_ptPos; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VPatternLabelData::SetPos(const QPointF& ptPos) -{ - m_ptPos = ptPos; -} - //--------------------------------------------------------------------------------------------------------------------- qreal VPatternLabelData::GetLabelWidth() const { @@ -101,15 +88,3 @@ void VPatternLabelData::SetRotation(qreal dRot) { m_dRotation = dRot; } - -//--------------------------------------------------------------------------------------------------------------------- -bool VPatternLabelData::IsVisible() const -{ - return m_bVisible; -} - -//--------------------------------------------------------------------------------------------------------------------- -void VPatternLabelData::SetVisible(bool bVal) -{ - m_bVisible = bVal; -} diff --git a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h index 1279f2283..0a05dd7b8 100644 --- a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h @@ -30,21 +30,19 @@ #define VPATTERNINFOGEOMETRY_H #include -#include + +#include "vabstractfloatitemdata.h" /** * @brief The VPatternLabelData class holds the information about pattern info label geometry */ -class VPatternLabelData +class VPatternLabelData : public VAbstractFloatItemData { public: VPatternLabelData(); virtual ~VPatternLabelData(); // methods, which set up label parameters - QPointF GetPos() const; - void SetPos(const QPointF& ptPos); - qreal GetLabelWidth() const; void SetLabelWidth(qreal dLabelW); @@ -57,34 +55,15 @@ public: qreal GetRotation() const; void SetRotation(qreal dRot); - bool IsVisible() const; - void SetVisible(bool bVal); - protected: - /** - * @brief m_ptPos position of label's top left corner - */ - QPointF m_ptPos; - /** - * @brief m_dLabelWidth label width - */ - qreal m_dLabelWidth; - /** - * @brief m_dLabelHeight label height - */ - qreal m_dLabelHeight; - /** - * @brief m_iFontSize label text base font size - */ - int m_iFontSize; - /** - * @brief m_dRotation label rotation - */ - qreal m_dRotation; - /** - * @brief m_bVisible visibility flag - */ - bool m_bVisible; + /** @brief m_dLabelWidth label width */ + qreal m_dLabelWidth; + /** @brief m_dLabelHeight label height */ + qreal m_dLabelHeight; + /** @brief m_iFontSize label text base font size */ + int m_iFontSize; + /** @brief m_dRotation label rotation */ + qreal m_dRotation; }; diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index 7ce9e3735..81364677e 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -24,7 +24,8 @@ SOURCES += \ $$PWD/vpiecepath.cpp \ $$PWD/floatItemData/vpiecelabeldata.cpp \ $$PWD/floatItemData/vpatternlabeldata.cpp \ - $$PWD/floatItemData/vgrainlinedata.cpp + $$PWD/floatItemData/vgrainlinedata.cpp \ + $$PWD/floatItemData/vabstractfloatitemdata.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -65,4 +66,5 @@ HEADERS += \ $$PWD/vpiecepath_p.h \ $$PWD/floatItemData/vpiecelabeldata.h \ $$PWD/floatItemData/vpatternlabeldata.h \ - $$PWD/floatItemData/vgrainlinedata.h + $$PWD/floatItemData/vgrainlinedata.h \ + $$PWD/floatItemData/vabstractfloatitemdata.h From c5c3c73429508cc8396f69b84de222a30fe4830a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 13:36:56 +0200 Subject: [PATCH 23/52] Added pin point ids. --HG-- branch : feature --- .../floatItemData/vgrainlinedata.cpp | 29 ++++++++++++++++++- .../vpatterndb/floatItemData/vgrainlinedata.h | 10 +++++++ .../floatItemData/vpatternlabeldata.cpp | 29 ++++++++++++++++++- .../floatItemData/vpatternlabeldata.h | 19 ++++++++---- 4 files changed, 80 insertions(+), 7 deletions(-) diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp b/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp index 2fcdd3310..4650cae7e 100644 --- a/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp @@ -29,13 +29,16 @@ #include #include "vgrainlinedata.h" +#include "../ifc/ifcdef.h" //--------------------------------------------------------------------------------------------------------------------- VGrainlineData::VGrainlineData() : VAbstractFloatItemData(), m_qsLength(), m_dRotation(), - m_eArrowType(atBoth) + m_eArrowType(atBoth), + m_topPin(NULL_ID), + m_bottomPin(NULL_ID) {} //--------------------------------------------------------------------------------------------------------------------- @@ -77,3 +80,27 @@ void VGrainlineData::SetArrowType(ArrowType eAT) { m_eArrowType = eAT; } + +//--------------------------------------------------------------------------------------------------------------------- +quint32 VGrainlineData::TopPin() const +{ + return m_topPin; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VGrainlineData::SetTopPin(const quint32 &topPin) +{ + m_topPin = topPin; +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 VGrainlineData::BottomPin() const +{ + return m_bottomPin; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VGrainlineData::SetBottomPin(const quint32 &bottomPin) +{ + m_bottomPin = bottomPin; +} diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata.h b/src/libs/vpatterndb/floatItemData/vgrainlinedata.h index 1d79b146d..01218c1c5 100644 --- a/src/libs/vpatterndb/floatItemData/vgrainlinedata.h +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata.h @@ -62,6 +62,12 @@ public: ArrowType GetArrowType() const; void SetArrowType(ArrowType eAT); + quint32 TopPin() const; + void SetTopPin(const quint32 &topPin); + + quint32 BottomPin() const; + void SetBottomPin(const quint32 &bottomPin); + private: /** @brief m_dLength formula to calculate the length of grainline */ QString m_qsLength; @@ -69,6 +75,10 @@ private: QString m_dRotation; /** @brief m_eArrowType type of arrow on the grainline */ ArrowType m_eArrowType; + /** @brief m_topPin top pin id */ + quint32 m_topPin; + /** @brief m_bottomPin bottom pin id */ + quint32 m_bottomPin; }; #endif // VGRAINLINEGEOMETRY_H diff --git a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp index ee987a639..f82009563 100644 --- a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp @@ -27,6 +27,7 @@ *************************************************************************/ #include "vpatternlabeldata.h" +#include "../ifc/ifcdef.h" //--------------------------------------------------------------------------------------------------------------------- VPatternLabelData::VPatternLabelData() @@ -34,7 +35,9 @@ VPatternLabelData::VPatternLabelData() m_dLabelWidth(0), m_dLabelHeight(0), m_iFontSize(0), - m_dRotation(0) + m_dRotation(0), + m_topLeftPin(NULL_ID), + m_bottomRightPin(NULL_ID) {} //--------------------------------------------------------------------------------------------------------------------- @@ -88,3 +91,27 @@ void VPatternLabelData::SetRotation(qreal dRot) { m_dRotation = dRot; } + +//--------------------------------------------------------------------------------------------------------------------- +quint32 VPatternLabelData::TopLeftPin() const +{ + return m_topLeftPin; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPatternLabelData::SetTopLeftPin(const quint32 &topLeftPin) +{ + m_topLeftPin = topLeftPin; +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 VPatternLabelData::BottomRightPin() const +{ + return m_bottomRightPin; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPatternLabelData::SetBottomRightPin(const quint32 &bottomRightPin) +{ + m_bottomRightPin = bottomRightPin; +} diff --git a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h index 0a05dd7b8..97a79f260 100644 --- a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h @@ -55,16 +55,25 @@ public: qreal GetRotation() const; void SetRotation(qreal dRot); + quint32 TopLeftPin() const; + void SetTopLeftPin(const quint32 &topLeftPin); + + quint32 BottomRightPin() const; + void SetBottomRightPin(const quint32 &bottomRightPin); + protected: /** @brief m_dLabelWidth label width */ - qreal m_dLabelWidth; + qreal m_dLabelWidth; /** @brief m_dLabelHeight label height */ - qreal m_dLabelHeight; + qreal m_dLabelHeight; /** @brief m_iFontSize label text base font size */ - int m_iFontSize; + int m_iFontSize; /** @brief m_dRotation label rotation */ - qreal m_dRotation; - + qreal m_dRotation; + /** @brief m_topLeftPin top left corner pin id */ + quint32 m_topLeftPin; + /** @brief m_bottomRightPin bottom right corner pin id */ + quint32 m_bottomRightPin; }; #endif // VPATTERNINFOGEOMETRY_H From 9714e8cb0766df27f947eeb680dc624e2c7a1b88 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 13:50:13 +0200 Subject: [PATCH 24/52] Copy-on-write for class VAbstractFloatItemData. --HG-- branch : feature --- .../floatItemData/vabstractfloatitemdata.cpp | 28 ++++++-- .../floatItemData/vabstractfloatitemdata.h | 12 ++-- .../floatItemData/vabstractfloatitemdata_p.h | 71 +++++++++++++++++++ src/libs/vpatterndb/vpatterndb.pri | 3 +- 4 files changed, 102 insertions(+), 12 deletions(-) create mode 100644 src/libs/vpatterndb/floatItemData/vabstractfloatitemdata_p.h diff --git a/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp index a644098fa..f7870d58b 100644 --- a/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp +++ b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.cpp @@ -27,13 +27,29 @@ *************************************************************************/ #include "vabstractfloatitemdata.h" +#include "vabstractfloatitemdata_p.h" //--------------------------------------------------------------------------------------------------------------------- VAbstractFloatItemData::VAbstractFloatItemData() - : m_ptPos(), - m_bVisible(false) + : d(new VAbstractFloatItemDataPrivate()) {} +//--------------------------------------------------------------------------------------------------------------------- +VAbstractFloatItemData::VAbstractFloatItemData(const VAbstractFloatItemData &data) + : d (data.d) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractFloatItemData &VAbstractFloatItemData::operator=(const VAbstractFloatItemData &data) +{ + if ( &data == this ) + { + return *this; + } + d = data.d; + return *this; +} + //--------------------------------------------------------------------------------------------------------------------- VAbstractFloatItemData::~VAbstractFloatItemData() {} @@ -41,23 +57,23 @@ VAbstractFloatItemData::~VAbstractFloatItemData() //--------------------------------------------------------------------------------------------------------------------- QPointF VAbstractFloatItemData::GetPos() const { - return m_ptPos; + return d->m_ptPos; } //--------------------------------------------------------------------------------------------------------------------- void VAbstractFloatItemData::SetPos(const QPointF &ptPos) { - m_ptPos = ptPos; + d->m_ptPos = ptPos; } //--------------------------------------------------------------------------------------------------------------------- bool VAbstractFloatItemData::IsVisible() const { - return m_bVisible; + return d->m_bVisible; } //--------------------------------------------------------------------------------------------------------------------- void VAbstractFloatItemData::SetVisible(bool bVisible) { - m_bVisible = bVisible; + d->m_bVisible = bVisible; } diff --git a/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h index 17c07a0d1..0b3260c5b 100644 --- a/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h +++ b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata.h @@ -30,11 +30,16 @@ #define VABSTRACTFLOATITEMDATA_H #include +#include + +class VAbstractFloatItemDataPrivate; class VAbstractFloatItemData { public: VAbstractFloatItemData(); + VAbstractFloatItemData(const VAbstractFloatItemData &data); + VAbstractFloatItemData &operator=(const VAbstractFloatItemData &data); virtual ~VAbstractFloatItemData(); // methods, which set and return values of different parameters @@ -44,11 +49,8 @@ public: bool IsVisible() const; void SetVisible(bool bVisible); -protected: - /** @brief m_ptPos position of label's top left corner */ - QPointF m_ptPos; - /** @brief m_bVisible visibility flag */ - bool m_bVisible; +private: + QSharedDataPointer d; }; #endif // VABSTRACTFLOATITEMDATA_H diff --git a/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata_p.h b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata_p.h new file mode 100644 index 000000000..4e8c81010 --- /dev/null +++ b/src/libs/vpatterndb/floatItemData/vabstractfloatitemdata_p.h @@ -0,0 +1,71 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 23 2, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef VABSTRACTFLOATITEMDATA_P_H +#define VABSTRACTFLOATITEMDATA_P_H + +#include +#include + +#include "../vmisc/diagnostic.h" + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Weffc++") + +class VAbstractFloatItemDataPrivate : public QSharedData +{ +public: + VAbstractFloatItemDataPrivate() + : m_ptPos(), + m_bVisible(false) + {} + + VAbstractFloatItemDataPrivate(const VAbstractFloatItemDataPrivate &data) + : QSharedData(data), + m_ptPos(data.m_ptPos), + m_bVisible(data.m_bVisible) + {} + + ~VAbstractFloatItemDataPrivate(); + + /** @brief m_ptPos position of label's top left corner */ + QPointF m_ptPos; + /** @brief m_bVisible visibility flag */ + bool m_bVisible; + +private: + VAbstractFloatItemDataPrivate &operator=(const VAbstractFloatItemDataPrivate &) Q_DECL_EQ_DELETE; +}; + +VAbstractFloatItemDataPrivate::~VAbstractFloatItemDataPrivate() +{} + +QT_WARNING_POP + +#endif // VABSTRACTFLOATITEMDATA_P_H + diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index 81364677e..a73ab5504 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -67,4 +67,5 @@ HEADERS += \ $$PWD/floatItemData/vpiecelabeldata.h \ $$PWD/floatItemData/vpatternlabeldata.h \ $$PWD/floatItemData/vgrainlinedata.h \ - $$PWD/floatItemData/vabstractfloatitemdata.h + $$PWD/floatItemData/vabstractfloatitemdata.h \ + $$PWD/floatItemData/vabstractfloatitemdata_p.h From f36a4d66210defd1f1711090934a2fe07c59bda2 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 14:04:49 +0200 Subject: [PATCH 25/52] Copy-on-write for class VGrainlineData. --HG-- branch : feature --- src/app/valentina/xml/vpattern.cpp | 3 +- src/libs/vlayout/vlayoutpiece.cpp | 4 +- .../vpatterndb/floatItemData/floatitemdef.h | 41 +++++++++ .../floatItemData/vgrainlinedata.cpp | 52 +++++++----- .../vpatterndb/floatItemData/vgrainlinedata.h | 28 ++---- .../floatItemData/vgrainlinedata_p.h | 85 +++++++++++++++++++ src/libs/vpatterndb/vpatterndb.pri | 4 +- .../dialogs/tools/dialogseamallowance.cpp | 2 +- src/libs/vwidgets/vgrainlineitem.cpp | 9 +- src/libs/vwidgets/vgrainlineitem.h | 5 +- 10 files changed, 180 insertions(+), 53 deletions(-) create mode 100644 src/libs/vpatterndb/floatItemData/floatitemdef.h create mode 100644 src/libs/vpatterndb/floatItemData/vgrainlinedata_p.h diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index deb68b924..15a349c66 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -874,8 +874,7 @@ void VPattern::ParsePieceGrainline(const QDomElement &domElement, VPiece &detail detail.GetGrainlineGeometry().SetLength(qsLength); QString qsRot = GetParametrString(domElement, AttrRotation, "90"); detail.GetGrainlineGeometry().SetRotation(qsRot); - VGrainlineData::ArrowType eAT = - VGrainlineData::ArrowType(GetParametrUInt(domElement, AttrArrows, "0")); + ArrowType eAT = static_cast(GetParametrUInt(domElement, AttrArrows, "0")); detail.GetGrainlineGeometry().SetArrowType(eAT); } diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 30a4063a1..3102eaabb 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -267,7 +267,7 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer& rP v << pt1; - if (geom.GetArrowType() != VGrainlineData::atRear) { + if (geom.GetArrowType() != ArrowType::atRear) { pt.setX(pt1.x() + dArrowLen * qCos(dAng + dArrowAng)); pt.setY(pt1.y() - dArrowLen * qSin(dAng + dArrowAng)); v << pt; @@ -280,7 +280,7 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer& rP v << pt2; - if (geom.GetArrowType() != VGrainlineData::atFront) + if (geom.GetArrowType() != ArrowType::atFront) { dAng += M_PI; diff --git a/src/libs/vpatterndb/floatItemData/floatitemdef.h b/src/libs/vpatterndb/floatItemData/floatitemdef.h new file mode 100644 index 000000000..415d3d633 --- /dev/null +++ b/src/libs/vpatterndb/floatItemData/floatitemdef.h @@ -0,0 +1,41 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 23 2, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef FLOATITEMDEF_H +#define FLOATITEMDEF_H + +// denotes the type of arrow for the grainline +enum class ArrowType : char +{ + atBoth, + atFront, + atRear +}; + +#endif // FLOATITEMDEF_H + diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp b/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp index 4650cae7e..de189c075 100644 --- a/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata.cpp @@ -29,18 +29,32 @@ #include #include "vgrainlinedata.h" -#include "../ifc/ifcdef.h" +#include "vgrainlinedata_p.h" //--------------------------------------------------------------------------------------------------------------------- VGrainlineData::VGrainlineData() : VAbstractFloatItemData(), - m_qsLength(), - m_dRotation(), - m_eArrowType(atBoth), - m_topPin(NULL_ID), - m_bottomPin(NULL_ID) + d(new VGrainlineDataPrivate()) {} +//--------------------------------------------------------------------------------------------------------------------- +VGrainlineData::VGrainlineData(const VGrainlineData &data) + : VAbstractFloatItemData(data), + d (data.d) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VGrainlineData &VGrainlineData::operator=(const VGrainlineData &data) +{ + if ( &data == this ) + { + return *this; + } + VAbstractFloatItemData::operator=(data); + d = data.d; + return *this; +} + //--------------------------------------------------------------------------------------------------------------------- VGrainlineData::~VGrainlineData() {} @@ -48,59 +62,59 @@ VGrainlineData::~VGrainlineData() //--------------------------------------------------------------------------------------------------------------------- QString VGrainlineData::GetLength() const { - return m_qsLength; + return d->m_qsLength; } //--------------------------------------------------------------------------------------------------------------------- void VGrainlineData::SetLength(const QString& qsLen) { - m_qsLength = qsLen; + d->m_qsLength = qsLen; } //--------------------------------------------------------------------------------------------------------------------- QString VGrainlineData::GetRotation() const { - return m_dRotation; + return d->m_dRotation; } //--------------------------------------------------------------------------------------------------------------------- void VGrainlineData::SetRotation(const QString& qsRot) { - m_dRotation = qsRot; + d->m_dRotation = qsRot; } //--------------------------------------------------------------------------------------------------------------------- -VGrainlineData::ArrowType VGrainlineData::GetArrowType() const +ArrowType VGrainlineData::GetArrowType() const { - return m_eArrowType; + return d->m_eArrowType; } //--------------------------------------------------------------------------------------------------------------------- void VGrainlineData::SetArrowType(ArrowType eAT) { - m_eArrowType = eAT; + d->m_eArrowType = eAT; } //--------------------------------------------------------------------------------------------------------------------- quint32 VGrainlineData::TopPin() const { - return m_topPin; + return d->m_topPin; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineData::SetTopPin(const quint32 &topPin) +void VGrainlineData::SetTopPin(quint32 topPin) { - m_topPin = topPin; + d->m_topPin = topPin; } //--------------------------------------------------------------------------------------------------------------------- quint32 VGrainlineData::BottomPin() const { - return m_bottomPin; + return d->m_bottomPin; } //--------------------------------------------------------------------------------------------------------------------- -void VGrainlineData::SetBottomPin(const quint32 &bottomPin) +void VGrainlineData::SetBottomPin(quint32 bottomPin) { - m_bottomPin = bottomPin; + d->m_bottomPin = bottomPin; } diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata.h b/src/libs/vpatterndb/floatItemData/vgrainlinedata.h index 01218c1c5..dc259bf0e 100644 --- a/src/libs/vpatterndb/floatItemData/vgrainlinedata.h +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata.h @@ -33,6 +33,9 @@ #include #include "vabstractfloatitemdata.h" +#include "floatitemdef.h" + +class VGrainlineDataPrivate; /** * @brief The VGrainlineData class holds information about a grainline like @@ -41,15 +44,9 @@ class VGrainlineData : public VAbstractFloatItemData { public: - // denotes the type of arrow for the grainline - enum ArrowType - { - atBoth, - atFront, - atRear - }; - VGrainlineData(); + VGrainlineData(const VGrainlineData &data); + VGrainlineData &operator=(const VGrainlineData &data); virtual ~VGrainlineData(); // methods, which set and return values of different parameters @@ -63,22 +60,13 @@ public: void SetArrowType(ArrowType eAT); quint32 TopPin() const; - void SetTopPin(const quint32 &topPin); + void SetTopPin(quint32 topPin); quint32 BottomPin() const; - void SetBottomPin(const quint32 &bottomPin); + void SetBottomPin(quint32 bottomPin); private: - /** @brief m_dLength formula to calculate the length of grainline */ - QString m_qsLength; - /** @brief m_dRotation formula to calculate the rotation of grainline in [degrees] */ - QString m_dRotation; - /** @brief m_eArrowType type of arrow on the grainline */ - ArrowType m_eArrowType; - /** @brief m_topPin top pin id */ - quint32 m_topPin; - /** @brief m_bottomPin bottom pin id */ - quint32 m_bottomPin; + QSharedDataPointer d; }; #endif // VGRAINLINEGEOMETRY_H diff --git a/src/libs/vpatterndb/floatItemData/vgrainlinedata_p.h b/src/libs/vpatterndb/floatItemData/vgrainlinedata_p.h new file mode 100644 index 000000000..cb85be652 --- /dev/null +++ b/src/libs/vpatterndb/floatItemData/vgrainlinedata_p.h @@ -0,0 +1,85 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 23 2, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef VGRAINLINEDATA_P_H +#define VGRAINLINEDATA_P_H + +#include +#include + +#include "../vmisc/diagnostic.h" +#include "floatitemdef.h" +#include "../ifc/ifcdef.h" + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Weffc++") + +class VGrainlineDataPrivate : public QSharedData +{ +public: + VGrainlineDataPrivate() + : m_qsLength(), + m_dRotation(), + m_eArrowType(ArrowType::atBoth), + m_topPin(NULL_ID), + m_bottomPin(NULL_ID) + {} + + VGrainlineDataPrivate(const VGrainlineDataPrivate &data) + : QSharedData(data), + m_qsLength(data.m_qsLength), + m_dRotation(data.m_dRotation), + m_eArrowType(data.m_eArrowType), + m_topPin(data.m_topPin), + m_bottomPin(data.m_bottomPin) + {} + + ~VGrainlineDataPrivate(); + + /** @brief m_dLength formula to calculate the length of grainline */ + QString m_qsLength; + /** @brief m_dRotation formula to calculate the rotation of grainline in [degrees] */ + QString m_dRotation; + /** @brief m_eArrowType type of arrow on the grainline */ + ArrowType m_eArrowType; + /** @brief m_topPin top pin id */ + quint32 m_topPin; + /** @brief m_bottomPin bottom pin id */ + quint32 m_bottomPin; + +private: + VGrainlineDataPrivate &operator=(const VGrainlineDataPrivate &) Q_DECL_EQ_DELETE; +}; + +VGrainlineDataPrivate::~VGrainlineDataPrivate() +{} + +QT_WARNING_POP + +#endif // VGRAINLINEDATA_P_H + diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index a73ab5504..ffed4e24e 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -68,4 +68,6 @@ HEADERS += \ $$PWD/floatItemData/vpatternlabeldata.h \ $$PWD/floatItemData/vgrainlinedata.h \ $$PWD/floatItemData/vabstractfloatitemdata.h \ - $$PWD/floatItemData/vabstractfloatitemdata_p.h + $$PWD/floatItemData/vabstractfloatitemdata_p.h \ + $$PWD/floatItemData/vgrainlinedata_p.h \ + $$PWD/floatItemData/floatitemdef.h diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 2f860f7d1..99bd96674 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -1307,7 +1307,7 @@ VPiece DialogSeamAllowance::CreatePiece() const piece.GetGrainlineGeometry().SetVisible(ui->checkBoxGrainline->isChecked()); piece.GetGrainlineGeometry().SetRotation(GetFormulaFromUser(ui->lineEditRotFormula)); piece.GetGrainlineGeometry().SetLength(GetFormulaFromUser(ui->lineEditLenFormula)); - piece.GetGrainlineGeometry().SetArrowType(VGrainlineData::ArrowType(ui->comboBoxArrow->currentIndex())); + piece.GetGrainlineGeometry().SetArrowType(static_cast(ui->comboBoxArrow->currentIndex())); return piece; } diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index c0c8f90d8..d1e92f9b9 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -65,7 +65,7 @@ VGrainlineItem::VGrainlineItem(QGraphicsItem* pParent) m_ptFinish(), m_ptCenter(), m_dAngle(0), - m_eArrowType(VGrainlineData::atBoth) + m_eArrowType(ArrowType::atBoth) { m_inactiveZ = 5; Reset(); @@ -107,7 +107,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption QPolygonF poly; QPointF ptA; qreal dArrLen = ARROW_LENGTH*m_dScale; - if (m_eArrowType != VGrainlineData::atRear) + if (m_eArrowType != ArrowType::atRear) { // first arrow poly << pt1; @@ -119,7 +119,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption poly << ptA; pP->drawPolygon(poly); } - if (m_eArrowType != VGrainlineData::atFront) + if (m_eArrowType != ArrowType::atFront) { // second arrow poly.clear(); @@ -187,8 +187,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption * @param dRotation rotation of the grainline in [degrees] * @param dLength length of the grainline in user's units */ -void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, - VGrainlineData::ArrowType eAT) +void VGrainlineItem::UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, ArrowType eAT) { m_dRotation = qDegreesToRadians(dRotation); m_dLength = dLength; diff --git a/src/libs/vwidgets/vgrainlineitem.h b/src/libs/vwidgets/vgrainlineitem.h index a7b9ea89e..4a0c445b2 100644 --- a/src/libs/vwidgets/vgrainlineitem.h +++ b/src/libs/vwidgets/vgrainlineitem.h @@ -40,8 +40,7 @@ public: virtual ~VGrainlineItem(); virtual void paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption, QWidget* pWidget) Q_DECL_OVERRIDE; - void UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, - VGrainlineData::ArrowType eAT); + void UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, ArrowType eAT); bool IsContained(const QPointF &pt, qreal dRot, qreal &dX, qreal &dY) const; void SetScale(qreal dScale); @@ -75,7 +74,7 @@ private: QPointF m_ptFinish; QPointF m_ptCenter; qreal m_dAngle; - VGrainlineData::ArrowType m_eArrowType; + ArrowType m_eArrowType; }; #endif // VGRAINLINEITEM_H From 2b1cd5c96cf139efadf17c020abd114fdb9524ab Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 14:36:08 +0200 Subject: [PATCH 26/52] Copy-on-write for class VPatternLabelData. --HG-- branch : feature --- .../floatItemData/vpatternlabeldata.cpp | 50 +++++++---- .../floatItemData/vpatternlabeldata.h | 17 ++-- .../floatItemData/vpatternlabeldata_p.h | 88 +++++++++++++++++++ src/libs/vpatterndb/vpatterndb.pri | 3 +- 4 files changed, 127 insertions(+), 31 deletions(-) create mode 100644 src/libs/vpatterndb/floatItemData/vpatternlabeldata_p.h diff --git a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp index f82009563..e87f06ddd 100644 --- a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.cpp @@ -27,19 +27,33 @@ *************************************************************************/ #include "vpatternlabeldata.h" +#include "vpatternlabeldata_p.h" #include "../ifc/ifcdef.h" //--------------------------------------------------------------------------------------------------------------------- VPatternLabelData::VPatternLabelData() : VAbstractFloatItemData(), - m_dLabelWidth(0), - m_dLabelHeight(0), - m_iFontSize(0), - m_dRotation(0), - m_topLeftPin(NULL_ID), - m_bottomRightPin(NULL_ID) + d(new VPatternLabelDataPrivate()) {} +//--------------------------------------------------------------------------------------------------------------------- +VPatternLabelData::VPatternLabelData(const VPatternLabelData &data) + : VAbstractFloatItemData(data), + d (data.d) +{} + +//--------------------------------------------------------------------------------------------------------------------- +VPatternLabelData &VPatternLabelData::operator=(const VPatternLabelData &data) +{ + if ( &data == this ) + { + return *this; + } + VAbstractFloatItemData::operator=(data); + d = data.d; + return *this; +} + //--------------------------------------------------------------------------------------------------------------------- VPatternLabelData::~VPatternLabelData() {} @@ -47,71 +61,71 @@ VPatternLabelData::~VPatternLabelData() //--------------------------------------------------------------------------------------------------------------------- qreal VPatternLabelData::GetLabelWidth() const { - return m_dLabelWidth; + return d->m_dLabelWidth; } //--------------------------------------------------------------------------------------------------------------------- void VPatternLabelData::SetLabelWidth(qreal dLabelW) { - m_dLabelWidth = dLabelW; + d->m_dLabelWidth = dLabelW; } //--------------------------------------------------------------------------------------------------------------------- qreal VPatternLabelData::GetLabelHeight() const { - return m_dLabelHeight; + return d->m_dLabelHeight; } //--------------------------------------------------------------------------------------------------------------------- void VPatternLabelData::SetLabelHeight(qreal dLabelH) { - m_dLabelHeight = dLabelH; + d->m_dLabelHeight = dLabelH; } //--------------------------------------------------------------------------------------------------------------------- int VPatternLabelData::GetFontSize() const { - return m_iFontSize; + return d->m_iFontSize; } //--------------------------------------------------------------------------------------------------------------------- void VPatternLabelData::SetFontSize(int iSize) { - m_iFontSize = iSize; + d->m_iFontSize = iSize; } //--------------------------------------------------------------------------------------------------------------------- qreal VPatternLabelData::GetRotation() const { - return m_dRotation; + return d->m_dRotation; } //--------------------------------------------------------------------------------------------------------------------- void VPatternLabelData::SetRotation(qreal dRot) { - m_dRotation = dRot; + d->m_dRotation = dRot; } //--------------------------------------------------------------------------------------------------------------------- quint32 VPatternLabelData::TopLeftPin() const { - return m_topLeftPin; + return d->m_topLeftPin; } //--------------------------------------------------------------------------------------------------------------------- void VPatternLabelData::SetTopLeftPin(const quint32 &topLeftPin) { - m_topLeftPin = topLeftPin; + d->m_topLeftPin = topLeftPin; } //--------------------------------------------------------------------------------------------------------------------- quint32 VPatternLabelData::BottomRightPin() const { - return m_bottomRightPin; + return d->m_bottomRightPin; } //--------------------------------------------------------------------------------------------------------------------- void VPatternLabelData::SetBottomRightPin(const quint32 &bottomRightPin) { - m_bottomRightPin = bottomRightPin; + d->m_bottomRightPin = bottomRightPin; } diff --git a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h index 97a79f260..21381f6f7 100644 --- a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h @@ -33,6 +33,8 @@ #include "vabstractfloatitemdata.h" +class VPatternLabelDataPrivate; + /** * @brief The VPatternLabelData class holds the information about pattern info label geometry */ @@ -40,6 +42,8 @@ class VPatternLabelData : public VAbstractFloatItemData { public: VPatternLabelData(); + VPatternLabelData(const VPatternLabelData &data); + VPatternLabelData &operator=(const VPatternLabelData &data); virtual ~VPatternLabelData(); // methods, which set up label parameters @@ -62,18 +66,7 @@ public: void SetBottomRightPin(const quint32 &bottomRightPin); protected: - /** @brief m_dLabelWidth label width */ - qreal m_dLabelWidth; - /** @brief m_dLabelHeight label height */ - qreal m_dLabelHeight; - /** @brief m_iFontSize label text base font size */ - int m_iFontSize; - /** @brief m_dRotation label rotation */ - qreal m_dRotation; - /** @brief m_topLeftPin top left corner pin id */ - quint32 m_topLeftPin; - /** @brief m_bottomRightPin bottom right corner pin id */ - quint32 m_bottomRightPin; + QSharedDataPointer d; }; #endif // VPATTERNINFOGEOMETRY_H diff --git a/src/libs/vpatterndb/floatItemData/vpatternlabeldata_p.h b/src/libs/vpatterndb/floatItemData/vpatternlabeldata_p.h new file mode 100644 index 000000000..783addb83 --- /dev/null +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata_p.h @@ -0,0 +1,88 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 23 2, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef VPATTERNLABELDATA_P_H +#define VPATTERNLABELDATA_P_H + +#include +#include + +#include "../vmisc/diagnostic.h" +#include "../ifc/ifcdef.h" + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Weffc++") + +class VPatternLabelDataPrivate : public QSharedData +{ +public: + VPatternLabelDataPrivate() + : m_dLabelWidth(0), + m_dLabelHeight(0), + m_iFontSize(0), + m_dRotation(0), + m_topLeftPin(NULL_ID), + m_bottomRightPin(NULL_ID) + {} + + VPatternLabelDataPrivate(const VPatternLabelDataPrivate &data) + : QSharedData(data), + m_dLabelWidth(data.m_dLabelWidth), + m_dLabelHeight(data.m_dLabelHeight), + m_iFontSize(data.m_iFontSize), + m_dRotation(data.m_dRotation), + m_topLeftPin(data.m_topLeftPin), + m_bottomRightPin(data.m_bottomRightPin) + {} + + ~VPatternLabelDataPrivate(); + + /** @brief m_dLabelWidth label width */ + qreal m_dLabelWidth; + /** @brief m_dLabelHeight label height */ + qreal m_dLabelHeight; + /** @brief m_iFontSize label text base font size */ + int m_iFontSize; + /** @brief m_dRotation label rotation */ + qreal m_dRotation; + /** @brief m_topLeftPin top left corner pin id */ + quint32 m_topLeftPin; + /** @brief m_bottomRightPin bottom right corner pin id */ + quint32 m_bottomRightPin; + +private: + VPatternLabelDataPrivate &operator=(const VPatternLabelDataPrivate &) Q_DECL_EQ_DELETE; +}; + +VPatternLabelDataPrivate::~VPatternLabelDataPrivate() +{} + +QT_WARNING_POP + +#endif // VPATTERNLABELDATA_P_H + diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index ffed4e24e..d0006cd91 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -70,4 +70,5 @@ HEADERS += \ $$PWD/floatItemData/vabstractfloatitemdata.h \ $$PWD/floatItemData/vabstractfloatitemdata_p.h \ $$PWD/floatItemData/vgrainlinedata_p.h \ - $$PWD/floatItemData/floatitemdef.h + $$PWD/floatItemData/floatitemdef.h \ + $$PWD/floatItemData/vpatternlabeldata_p.h From 67a12ef86c081b07ba9110e44b171c64bf542a95 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 14:46:53 +0200 Subject: [PATCH 27/52] Copy-on-write for class VPieceLabelData. --HG-- branch : feature --- .../vpatterndb/floatItemData/floatitemdef.h | 38 ++++++++++ .../floatItemData/vpatternlabeldata.h | 2 +- .../floatItemData/vpiecelabeldata.cpp | 48 ++++++++----- .../floatItemData/vpiecelabeldata.h | 39 ++-------- .../floatItemData/vpiecelabeldata_p.h | 72 +++++++++++++++++++ src/libs/vpatterndb/vpatterndb.pri | 3 +- 6 files changed, 147 insertions(+), 55 deletions(-) create mode 100644 src/libs/vpatterndb/floatItemData/vpiecelabeldata_p.h diff --git a/src/libs/vpatterndb/floatItemData/floatitemdef.h b/src/libs/vpatterndb/floatItemData/floatitemdef.h index 415d3d633..6807a3379 100644 --- a/src/libs/vpatterndb/floatItemData/floatitemdef.h +++ b/src/libs/vpatterndb/floatItemData/floatitemdef.h @@ -29,6 +29,9 @@ #ifndef FLOATITEMDEF_H #define FLOATITEMDEF_H +#include +#include + // denotes the type of arrow for the grainline enum class ArrowType : char { @@ -37,5 +40,40 @@ enum class ArrowType : char atRear }; +enum class MaterialType : char +{ + mtFabric = 0, + mtLining = 1, + mtInterfacing = 2, + mtInterlining = 3, + mtUserDefined = 4 +}; + +enum class PlacementType : char +{ + ptNone = 0, + ptCutOnFold = 1 +}; + +/** + * @brief The MaterialCutPlacement struct used to hold a material, cut number and placement 3-tuple + */ +struct MaterialCutPlacement +{ + MaterialType m_eMaterial; + QString m_qsMaterialUserDef; + int m_iCutNumber; + PlacementType m_ePlacement; + + MaterialCutPlacement() + : m_eMaterial(MaterialType::mtFabric), + m_qsMaterialUserDef(), + m_iCutNumber(0), + m_ePlacement(PlacementType::ptNone) + {} +}; + +typedef QList MCPContainer; + #endif // FLOATITEMDEF_H diff --git a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h index 21381f6f7..29cdeffc3 100644 --- a/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h +++ b/src/libs/vpatterndb/floatItemData/vpatternlabeldata.h @@ -65,7 +65,7 @@ public: quint32 BottomRightPin() const; void SetBottomRightPin(const quint32 &bottomRightPin); -protected: +private: QSharedDataPointer d; }; diff --git a/src/libs/vpatterndb/floatItemData/vpiecelabeldata.cpp b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.cpp index ecfafc6c0..06d641933 100644 --- a/src/libs/vpatterndb/floatItemData/vpiecelabeldata.cpp +++ b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.cpp @@ -27,24 +27,34 @@ *************************************************************************/ #include "vpiecelabeldata.h" +#include "vpiecelabeldata_p.h" #include //--------------------------------------------------------------------------------------------------------------------- -MaterialCutPlacement::MaterialCutPlacement() - : m_eMaterial(MaterialType::mtFabric), - m_qsMaterialUserDef(), - m_iCutNumber(0), - m_ePlacement(PlacementType::ptNone) +VPieceLabelData::VPieceLabelData() + : VPatternLabelData(), + d(new VPieceLabelDataPrivate()) {} //--------------------------------------------------------------------------------------------------------------------- -VPieceLabelData::VPieceLabelData() - : VPatternLabelData(), - m_qsLetter(), - m_conMCP() +VPieceLabelData::VPieceLabelData(const VPieceLabelData &data) + : VPatternLabelData(data), + d (data.d) {} +//--------------------------------------------------------------------------------------------------------------------- +VPieceLabelData &VPieceLabelData::operator=(const VPieceLabelData &data) +{ + if ( &data == this ) + { + return *this; + } + VPatternLabelData::operator=(data); + d = data.d; + return *this; +} + //--------------------------------------------------------------------------------------------------------------------- VPieceLabelData::~VPieceLabelData() {} @@ -52,7 +62,7 @@ VPieceLabelData::~VPieceLabelData() //--------------------------------------------------------------------------------------------------------------------- void VPieceLabelData::Append(const MaterialCutPlacement& rMCP) { - m_conMCP.append(rMCP); + d->m_conMCP.append(rMCP); } //--------------------------------------------------------------------------------------------------------------------- @@ -60,7 +70,7 @@ void VPieceLabelData::Insert(int i, const MaterialCutPlacement& rMCP) { Q_ASSERT(i >= 0); Q_ASSERT(i <= GetMCPCount()); - m_conMCP.insert(i, rMCP); + d->m_conMCP.insert(i, rMCP); } //--------------------------------------------------------------------------------------------------------------------- @@ -68,13 +78,13 @@ void VPieceLabelData::Set(int i, const MaterialCutPlacement& rMCP) { Q_ASSERT(i >= 0); Q_ASSERT(i < GetMCPCount()); - m_conMCP[i] = rMCP; + d->m_conMCP[i] = rMCP; } //--------------------------------------------------------------------------------------------------------------------- int VPieceLabelData::GetMCPCount() const { - return m_conMCP.count(); + return d->m_conMCP.count(); } //--------------------------------------------------------------------------------------------------------------------- @@ -82,7 +92,7 @@ const MaterialCutPlacement& VPieceLabelData::GetMCP(int i) const { Q_ASSERT(i >= 0); Q_ASSERT(i < GetMCPCount()); - return m_conMCP.at(i); + return d->m_conMCP.at(i); } //--------------------------------------------------------------------------------------------------------------------- @@ -90,24 +100,24 @@ void VPieceLabelData::RemoveMCP(int i) { Q_ASSERT(i >= 0); Q_ASSERT(i < GetMCPCount()); - m_conMCP.removeAt(i); + d->m_conMCP.removeAt(i); } //--------------------------------------------------------------------------------------------------------------------- void VPieceLabelData::Clear() { - m_qsLetter.clear(); - m_conMCP.clear(); + d->m_qsLetter.clear(); + d->m_conMCP.clear(); } //--------------------------------------------------------------------------------------------------------------------- const QString& VPieceLabelData::GetLetter() const { - return m_qsLetter; + return d->m_qsLetter; } //--------------------------------------------------------------------------------------------------------------------- void VPieceLabelData::SetLetter(QString qsLetter) { - m_qsLetter = qsLetter.left(3); + d->m_qsLetter = qsLetter.left(3); } diff --git a/src/libs/vpatterndb/floatItemData/vpiecelabeldata.h b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.h index 273df823c..f58bb3efd 100644 --- a/src/libs/vpatterndb/floatItemData/vpiecelabeldata.h +++ b/src/libs/vpatterndb/floatItemData/vpiecelabeldata.h @@ -29,40 +29,12 @@ #ifndef VPATTERNPIECEDATA_H #define VPATTERNPIECEDATA_H -#include #include #include "vpatternlabeldata.h" +#include "floatitemdef.h" -enum class MaterialType : char -{ - mtFabric = 0, - mtLining = 1, - mtInterfacing = 2, - mtInterlining = 3, - mtUserDefined = 4 -}; - -enum class PlacementType : char -{ - ptNone = 0, - ptCutOnFold = 1 -}; - -/** - * @brief The MaterialCutPlacement struct used to hold a material, cut number and placement 3-tuple - */ -struct MaterialCutPlacement -{ - MaterialType m_eMaterial; - QString m_qsMaterialUserDef; - int m_iCutNumber; - PlacementType m_ePlacement; - - MaterialCutPlacement(); -}; - -typedef QList MCPContainer; +class VPieceLabelDataPrivate; /** * @brief The VPieceLabelData class holds some information about a single @@ -72,6 +44,8 @@ class VPieceLabelData : public VPatternLabelData { public: VPieceLabelData(); + VPieceLabelData(const VPieceLabelData &data); + VPieceLabelData &operator=(const VPieceLabelData &data); virtual ~VPieceLabelData(); // methods, which operate on MaterialCutPlacement container @@ -88,10 +62,7 @@ public: void SetLetter(QString qsLetter); private: - /** @brief m_qsLetter Detail letter (should be no more than 3 characters) */ - QString m_qsLetter; - /** @brief m_conMCP List of material, cut, placement tuples */ - MCPContainer m_conMCP; + QSharedDataPointer d; }; #endif // VPATTERNPIECEDATA_H diff --git a/src/libs/vpatterndb/floatItemData/vpiecelabeldata_p.h b/src/libs/vpatterndb/floatItemData/vpiecelabeldata_p.h new file mode 100644 index 000000000..7d02f96b6 --- /dev/null +++ b/src/libs/vpatterndb/floatItemData/vpiecelabeldata_p.h @@ -0,0 +1,72 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 23 2, 2017 + ** + ** @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) 2017 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef VPIECELABELDATA_P_H +#define VPIECELABELDATA_P_H + +#include +#include + +#include "../vmisc/diagnostic.h" +#include "floatitemdef.h" + +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Weffc++") + +class VPieceLabelDataPrivate : public QSharedData +{ +public: + VPieceLabelDataPrivate() + : m_qsLetter(), + m_conMCP() + {} + + VPieceLabelDataPrivate(const VPieceLabelDataPrivate &data) + : QSharedData(data), + m_qsLetter(data.m_qsLetter), + m_conMCP(data.m_conMCP) + {} + + ~VPieceLabelDataPrivate(); + + /** @brief m_qsLetter Detail letter (should be no more than 3 characters) */ + QString m_qsLetter; + /** @brief m_conMCP List of material, cut, placement tuples */ + MCPContainer m_conMCP; + +private: + VPieceLabelDataPrivate &operator=(const VPieceLabelDataPrivate &) Q_DECL_EQ_DELETE; +}; + +VPieceLabelDataPrivate::~VPieceLabelDataPrivate() +{} + +QT_WARNING_POP + +#endif // VPIECELABELDATA_P_H + diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index d0006cd91..45c97a250 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -71,4 +71,5 @@ HEADERS += \ $$PWD/floatItemData/vabstractfloatitemdata_p.h \ $$PWD/floatItemData/vgrainlinedata_p.h \ $$PWD/floatItemData/floatitemdef.h \ - $$PWD/floatItemData/vpatternlabeldata_p.h + $$PWD/floatItemData/vpatternlabeldata_p.h \ + $$PWD/floatItemData/vpiecelabeldata_p.h From 8721a4a5d83329a5913bbfcce61e1abecd6539b5 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 16:33:15 +0200 Subject: [PATCH 28/52] Dialog Seam allowance tool now allow select pin points. --HG-- branch : feature --- .../dialogs/tools/dialogseamallowance.cpp | 147 ++++++++++++++++-- .../dialogs/tools/dialogseamallowance.h | 8 + 2 files changed, 146 insertions(+), 9 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 99bd96674..c6a3bc209 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -70,6 +70,10 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 & : DialogTool(data, toolId, parent), ui(new Ui::DialogSeamAllowance), applyAllowed(false),// By default disabled + flagGPin(true), + flagDPin(true), + flagPPin(true), + flagGFormulas(false), m_bAddMode(true), m_mx(0), m_my(0), @@ -213,8 +217,16 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) ui->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType())); m_oldData = piece.GetPatternPieceData(); + ChangeCurrentData(ui->comboBoxDetailLabelTopLeftPin, m_oldData.TopLeftPin()); + ChangeCurrentData(ui->comboBoxDetailLabelTopLeftPin, m_oldData.BottomRightPin()); + m_oldGeom = piece.GetPatternInfo(); + ChangeCurrentData(ui->comboBoxPatternLabelTopLeftPin, m_oldGeom.TopLeftPin()); + ChangeCurrentData(ui->comboBoxPatternLabelBottomRightPin, m_oldGeom.BottomRightPin()); + m_oldGrainline = piece.GetGrainlineGeometry(); + ChangeCurrentData(ui->comboBoxGrainlineTopPin, m_oldGrainline.TopPin()); + ChangeCurrentData(ui->comboBoxGrainlineBottomPin, m_oldGrainline.BottomPin()); ValidObjects(MainPathIsValid()); EnableGrainlineRotation(); @@ -333,7 +345,7 @@ void DialogSeamAllowance::SaveData() void DialogSeamAllowance::CheckState() { SCASSERT(bOk != nullptr); - bOk->setEnabled(flagName && flagError && flagFormula); + bOk->setEnabled(flagName && flagError && flagFormula && flagGPin && flagDPin && flagPPin && flagGFormulas); // In case dialog hasn't apply button if ( bApply != nullptr && applyAllowed) { @@ -462,14 +474,13 @@ void DialogSeamAllowance::NameDetailChanged() flagName = false; ChangeColor(ui->labelEditName, Qt::red); QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); - ui->tabWidget->setTabIcon(1, icon); + ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabSeamAllowance), icon); } else { flagName = true; ChangeColor(ui->labelEditName, okColor); - QIcon icon; - ui->tabWidget->setTabIcon(1, icon); + ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabSeamAllowance), QIcon()); } } CheckState(); @@ -997,8 +1008,8 @@ void DialogSeamAllowance::UpdateValues() plbVal->setText(qsVal); } - bOk->setEnabled(bFormulasOK); - if (bFormulasOK == false) + flagGFormulas = bFormulasOK; + if (flagGFormulas == false) { QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon); @@ -1007,6 +1018,7 @@ void DialogSeamAllowance::UpdateValues() { ResetWarning(); } + CheckState(); } //--------------------------------------------------------------------------------------------------------------------- @@ -1074,7 +1086,7 @@ void DialogSeamAllowance::EnableGrainlineRotation() { ChangeColor(ui->labelEditLen, okColor); ChangeColor(ui->labelEditRot, okColor); - bOk->setEnabled(true); + flagGFormulas = true; ResetWarning(); } } @@ -1128,8 +1140,10 @@ void DialogSeamAllowance::DeployLength() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::ResetWarning() { - QIcon icon; - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon); + if (flagGFormulas && flagGPin) + { + ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), QIcon()); + } } //--------------------------------------------------------------------------------------------------------------------- @@ -1272,6 +1286,93 @@ void DialogSeamAllowance::DeployWidthAfterFormulaTextEdit() DeployFormula(ui->plainTextEditFormulaWidthAfter, ui->pushButtonGrowWidthAfter, m_formulaBaseWidthAfter); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::GrainlinePinPointChanged() +{ + QColor color = okColor; + const quint32 topPinId = getCurrentObjectId(ui->comboBoxGrainlineTopPin); + const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxGrainlineTopPin); + if ((topPinId == NULL_ID && bottomPinId == NULL_ID) + || (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId)) + { + flagGPin = true; + color = okColor; + + ResetWarning(); + } + else + { + flagGPin = false; + color = errorColor; + + QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); + ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon); + } + ChangeColor(ui->labelGrainlineTopPin, color); + ChangeColor(ui->labelGrainlineBottomPin, color); + CheckState(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::DetailPinPointChanged() +{ + QColor color = okColor; + const quint32 topPinId = getCurrentObjectId(ui->comboBoxDetailLabelTopLeftPin); + const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxDetailLabelBottomRightPin); + if ((topPinId == NULL_ID && bottomPinId == NULL_ID) + || (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId)) + { + flagDPin = true; + color = okColor; + + if (flagPPin) + { + ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabPatternPieceData), QIcon()); + } + } + else + { + flagDPin = false; + color = errorColor; + + QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); + ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabPatternPieceData), icon); + } + ChangeColor(ui->labelDetailLabelTopLeftPin, color); + ChangeColor(ui->labelDetailLabelBottomRightPin, color); + CheckState(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::PatternPinPointChanged() +{ + QColor color = okColor; + const quint32 topPinId = getCurrentObjectId(ui->comboBoxPatternLabelTopLeftPin); + const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxPatternLabelBottomRightPin); + if ((topPinId == NULL_ID && bottomPinId == NULL_ID) + || (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId)) + { + flagPPin = true; + color = okColor; + + if (flagDPin) + { + ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabPatternPieceData), QIcon()); + } + } + else + { + flagPPin = false; + color = errorColor; + + QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); + ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabPatternPieceData), icon); + } + ChangeColor(ui->labelPatternLabelTopLeftPin, color); + ChangeColor(ui->labelPatternLabelBottomRightPin, color); + CheckState(); +} + //--------------------------------------------------------------------------------------------------------------------- VPiece DialogSeamAllowance::CreatePiece() const { @@ -1299,15 +1400,21 @@ VPiece DialogSeamAllowance::CreatePiece() const piece.GetPatternPieceData().SetFontSize(m_oldData.GetFontSize()); piece.GetPatternPieceData().SetRotation(m_oldData.GetRotation()); piece.GetPatternPieceData().SetVisible(ui->groupBoxDetailLabel->isChecked()); + piece.GetPatternPieceData().SetTopLeftPin(getCurrentObjectId(ui->comboBoxDetailLabelTopLeftPin)); + piece.GetPatternPieceData().SetBottomRightPin(getCurrentObjectId(ui->comboBoxDetailLabelBottomRightPin)); piece.GetPatternInfo() = m_oldGeom; piece.GetPatternInfo().SetVisible(ui->groupBoxPatternLabel->isChecked()); + piece.GetPatternInfo().SetTopLeftPin(getCurrentObjectId(ui->comboBoxPatternLabelTopLeftPin)); + piece.GetPatternInfo().SetBottomRightPin(getCurrentObjectId(ui->comboBoxPatternLabelBottomRightPin)); piece.GetGrainlineGeometry() = m_oldGrainline; piece.GetGrainlineGeometry().SetVisible(ui->checkBoxGrainline->isChecked()); piece.GetGrainlineGeometry().SetRotation(GetFormulaFromUser(ui->lineEditRotFormula)); piece.GetGrainlineGeometry().SetLength(GetFormulaFromUser(ui->lineEditLenFormula)); piece.GetGrainlineGeometry().SetArrowType(static_cast(ui->comboBoxArrow->currentIndex())); + piece.GetGrainlineGeometry().SetTopPin(getCurrentObjectId(ui->comboBoxGrainlineTopPin)); + piece.GetGrainlineGeometry().SetBottomPin(getCurrentObjectId(ui->comboBoxGrainlineBottomPin)); return piece; } @@ -1708,9 +1815,24 @@ void DialogSeamAllowance::InitPatternPieceDataTab() InitPinPoint(ui->comboBoxDetailLabelTopLeftPin); InitPinPoint(ui->comboBoxDetailLabelBottomRightPin); + + connect(ui->comboBoxDetailLabelTopLeftPin, + static_cast(&QComboBox::currentIndexChanged), + this, &DialogSeamAllowance::DetailPinPointChanged); + connect(ui->comboBoxDetailLabelBottomRightPin, + static_cast(&QComboBox::currentIndexChanged), + this, &DialogSeamAllowance::DetailPinPointChanged); + InitPinPoint(ui->comboBoxPatternLabelTopLeftPin); InitPinPoint(ui->comboBoxPatternLabelBottomRightPin); + connect(ui->comboBoxPatternLabelTopLeftPin, + static_cast(&QComboBox::currentIndexChanged), + this, &DialogSeamAllowance::PatternPinPointChanged); + connect(ui->comboBoxPatternLabelBottomRightPin, + static_cast(&QComboBox::currentIndexChanged), + this, &DialogSeamAllowance::PatternPinPointChanged); + connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogSeamAllowance::NameDetailChanged); m_qslMaterials << QApplication::translate("Detail", "Fabric", 0) @@ -1765,6 +1887,13 @@ void DialogSeamAllowance::InitGrainlineTab() InitPinPoint(ui->comboBoxGrainlineTopPin); InitPinPoint(ui->comboBoxGrainlineBottomPin); + + connect(ui->comboBoxGrainlineTopPin, + static_cast(&QComboBox::currentIndexChanged), + this, &DialogSeamAllowance::GrainlinePinPointChanged); + connect(ui->comboBoxGrainlineTopPin, + static_cast(&QComboBox::currentIndexChanged), + this, &DialogSeamAllowance::GrainlinePinPointChanged); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index 3205a366a..267bc7c30 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -119,11 +119,19 @@ private slots: void DeployWidthBeforeFormulaTextEdit(); void DeployWidthAfterFormulaTextEdit(); + void GrainlinePinPointChanged(); + void DetailPinPointChanged(); + void PatternPinPointChanged(); + private: Q_DISABLE_COPY(DialogSeamAllowance) Ui::DialogSeamAllowance *ui; bool applyAllowed; + bool flagGPin; + bool flagDPin; + bool flagPPin; + bool flagGFormulas; bool m_bAddMode; qreal m_mx; qreal m_my; From 5f4760f06feb5719aad1ab7a5e3cf01781c932a7 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 23 Feb 2017 16:49:20 +0200 Subject: [PATCH 29/52] Read/write info about pin points. --HG-- branch : feature --- src/app/valentina/xml/vpattern.cpp | 18 ++++++ src/libs/ifc/schema/pattern/v0.4.2.xsd | 6 ++ src/libs/vtools/tools/vtoolseamallowance.cpp | 60 ++++++++++++++++++++ src/libs/vtools/tools/vtoolseamallowance.h | 4 ++ 4 files changed, 88 insertions(+) diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 15a349c66..b38fe5a81 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -828,6 +828,12 @@ void VPattern::ParsePieceDataTag(const QDomElement &domElement, VPiece &detail) qreal dRot = GetParametrDouble(domElement, AttrRotation, "0"); detail.GetPatternPieceData().SetRotation(dRot); + const quint32 topLeftPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopLeftPin, NULL_ID_STR); + detail.GetPatternPieceData().SetTopLeftPin(topLeftPin); + + const quint32 bottomRightPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomRightPin, NULL_ID_STR); + detail.GetPatternPieceData().SetBottomRightPin(bottomRightPin); + QDomNodeList nodeListMCP = domElement.childNodes(); for (int iMCP = 0; iMCP < nodeListMCP.count(); ++iMCP) { @@ -860,6 +866,12 @@ void VPattern::ParsePiecePatternInfo(const QDomElement &domElement, VPiece &deta detail.GetPatternInfo().SetFontSize(iFS); qreal dRot = GetParametrDouble(domElement, AttrRotation, "0"); detail.GetPatternInfo().SetRotation(dRot); + + const quint32 topLeftPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopLeftPin, NULL_ID_STR); + detail.GetPatternInfo().SetTopLeftPin(topLeftPin); + + const quint32 bottomRightPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomRightPin, NULL_ID_STR); + detail.GetPatternInfo().SetBottomRightPin(bottomRightPin); } //--------------------------------------------------------------------------------------------------------------------- @@ -876,6 +888,12 @@ void VPattern::ParsePieceGrainline(const QDomElement &domElement, VPiece &detail detail.GetGrainlineGeometry().SetRotation(qsRot); ArrowType eAT = static_cast(GetParametrUInt(domElement, AttrArrows, "0")); detail.GetGrainlineGeometry().SetArrowType(eAT); + + const quint32 topPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrTopPin, NULL_ID_STR); + detail.GetGrainlineGeometry().SetTopPin(topPin); + + const quint32 bottomPin = GetParametrUInt(domElement, VToolSeamAllowance::AttrBottomPin, NULL_ID_STR); + detail.GetGrainlineGeometry().SetBottomPin(bottomPin); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/ifc/schema/pattern/v0.4.2.xsd b/src/libs/ifc/schema/pattern/v0.4.2.xsd index eb2136ce1..7d9e8030e 100644 --- a/src/libs/ifc/schema/pattern/v0.4.2.xsd +++ b/src/libs/ifc/schema/pattern/v0.4.2.xsd @@ -494,6 +494,8 @@ + + @@ -505,6 +507,8 @@ + + @@ -515,6 +519,8 @@ + + diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 710329d51..7d70830db 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -75,6 +75,10 @@ const QString VToolSeamAllowance::AttrSeamAllowance = QStringLiteral("seamAllow const QString VToolSeamAllowance::AttrHeight = QStringLiteral("height"); const QString VToolSeamAllowance::AttrUnited = QStringLiteral("united"); const QString VToolSeamAllowance::AttrFont = QStringLiteral("fontSize"); +const QString VToolSeamAllowance::AttrTopLeftPin = QStringLiteral("topLeftPin"); +const QString VToolSeamAllowance::AttrBottomRightPin = QStringLiteral("bottomRightPin"); +const QString VToolSeamAllowance::AttrTopPin = QStringLiteral("topPin"); +const QString VToolSeamAllowance::AttrBottomPin = QStringLiteral("bottomPin"); //--------------------------------------------------------------------------------------------------------------------- VToolSeamAllowance::~VToolSeamAllowance() @@ -252,6 +256,24 @@ void VToolSeamAllowance::AddPatternPieceData(VAbstractPattern *doc, QDomElement doc->SetAttribute(domData, AttrFont, data.GetFontSize()); doc->SetAttribute(domData, VAbstractPattern::AttrRotation, data.GetRotation()); + if (data.TopLeftPin() > NULL_ID) + { + doc->SetAttribute(domData, AttrTopLeftPin, data.TopLeftPin()); + } + else + { + domData.removeAttribute(AttrTopLeftPin); + } + + if (data.BottomRightPin() > NULL_ID) + { + doc->SetAttribute(domData, AttrBottomRightPin, data.BottomRightPin()); + } + else + { + domData.removeAttribute(AttrBottomRightPin); + } + for (int i = 0; i < data.GetMCPCount(); ++i) { const MaterialCutPlacement mcp = data.GetMCP(i); @@ -280,6 +302,25 @@ void VToolSeamAllowance::AddPatternInfo(VAbstractPattern *doc, QDomElement &domE doc->SetAttribute(domData, AttrHeight, geom.GetLabelHeight()); doc->SetAttribute(domData, AttrFont, geom.GetFontSize()); doc->SetAttribute(domData, VAbstractPattern::AttrRotation, geom.GetRotation()); + + if (geom.TopLeftPin() > NULL_ID) + { + doc->SetAttribute(domData, AttrTopLeftPin, geom.TopLeftPin()); + } + else + { + domData.removeAttribute(AttrTopLeftPin); + } + + if (geom.BottomRightPin() > NULL_ID) + { + doc->SetAttribute(domData, AttrBottomRightPin, geom.BottomRightPin()); + } + else + { + domData.removeAttribute(AttrBottomRightPin); + } + domElement.appendChild(domData); } @@ -295,6 +336,25 @@ void VToolSeamAllowance::AddGrainline(VAbstractPattern *doc, QDomElement &domEle doc->SetAttribute(domData, AttrLength, glGeom.GetLength()); doc->SetAttribute(domData, VAbstractPattern::AttrRotation, glGeom.GetRotation()); doc->SetAttribute(domData, VAbstractPattern::AttrArrows, int(glGeom.GetArrowType())); + + if (glGeom.TopPin() > NULL_ID) + { + doc->SetAttribute(domData, AttrTopPin, glGeom.TopPin()); + } + else + { + domData.removeAttribute(AttrTopPin); + } + + if (glGeom.BottomPin() > NULL_ID) + { + doc->SetAttribute(domData, AttrBottomPin, glGeom.BottomPin()); + } + else + { + domData.removeAttribute(AttrBottomPin); + } + domElement.appendChild(domData); } diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index 68f0fdd48..b1dc83a42 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -66,6 +66,10 @@ public: static const QString AttrHeight; static const QString AttrUnited; static const QString AttrFont; + static const QString AttrTopLeftPin; + static const QString AttrBottomRightPin; + static const QString AttrTopPin; + static const QString AttrBottomPin; void Remove(bool ask); From 757a5ec5508df2cd0d4630e050304bee24b8dc57 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Feb 2017 12:11:00 +0200 Subject: [PATCH 30/52] Fix typo. --HG-- branch : feature --- src/libs/vtools/dialogs/tools/dialogseamallowance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index c6a3bc209..2ae11cd62 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -218,7 +218,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) m_oldData = piece.GetPatternPieceData(); ChangeCurrentData(ui->comboBoxDetailLabelTopLeftPin, m_oldData.TopLeftPin()); - ChangeCurrentData(ui->comboBoxDetailLabelTopLeftPin, m_oldData.BottomRightPin()); + ChangeCurrentData(ui->comboBoxDetailLabelBottomRightPin, m_oldData.BottomRightPin()); m_oldGeom = piece.GetPatternInfo(); ChangeCurrentData(ui->comboBoxPatternLabelTopLeftPin, m_oldGeom.TopLeftPin()); From 3ebbc53a01ebc0716e4e25df9f9a95d182c62497 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Feb 2017 12:14:28 +0200 Subject: [PATCH 31/52] Delete pin visualization when close Seam allowance dialog. --HG-- branch : feature --- src/libs/vtools/dialogs/tools/dialogseamallowance.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 2ae11cd62..e40cdad30 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -125,6 +125,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 & //--------------------------------------------------------------------------------------------------------------------- DialogSeamAllowance::~DialogSeamAllowance() { + delete m_visPins; delete ui; } From edf2b2e74a64976d6ed7564d39ffcd0abfd86d75 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Feb 2017 16:37:11 +0200 Subject: [PATCH 32/52] Fix typo. --HG-- branch : feature --- src/libs/vtools/dialogs/tools/dialogseamallowance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index e40cdad30..c0d69f740 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -1292,7 +1292,7 @@ void DialogSeamAllowance::GrainlinePinPointChanged() { QColor color = okColor; const quint32 topPinId = getCurrentObjectId(ui->comboBoxGrainlineTopPin); - const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxGrainlineTopPin); + const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxGrainlineBottomPin); if ((topPinId == NULL_ID && bottomPinId == NULL_ID) || (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId)) { From d9bf2d5d6cd9a5e91788163a1af8207c332d70ce Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Feb 2017 17:17:56 +0200 Subject: [PATCH 33/52] Get window text color from dialog palette. Set Ok color only for Active state. --HG-- branch : feature --- src/libs/vtools/dialogs/tools/dialogtool.cpp | 30 +++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 57eae7526..64ddd7550 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -86,18 +86,34 @@ Q_LOGGING_CATEGORY(vDialog, "v.dialog") * @param parent parent widget */ DialogTool::DialogTool(const VContainer *data, const quint32 &toolId, QWidget *parent) - :QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), flagError(true), - timerFormula(nullptr), bOk(nullptr), bApply(nullptr), spinBoxAngle(nullptr), plainTextEditFormula(nullptr), - labelResultCalculation(nullptr), labelEditNamePoint(nullptr), labelEditFormula(nullptr), - okColor(QColor(76, 76, 76)), errorColor(Qt::red), associatedTool(nullptr), - toolId(toolId), prepare(false), pointName(QString()), number(0), vis(nullptr) + : QDialog(parent), + data(data), + isInitialized(false), + flagName(true), + flagFormula(true), + flagError(true), + timerFormula(nullptr), + bOk(nullptr), + bApply(nullptr), + spinBoxAngle(nullptr), + plainTextEditFormula(nullptr), + labelResultCalculation(nullptr), + labelEditNamePoint(nullptr), + labelEditFormula(nullptr), + okColor(this->palette().color(QPalette::Active, QPalette::WindowText)), + errorColor(Qt::red), + associatedTool(nullptr), + toolId(toolId), + prepare(false), + pointName(), + number(0), + vis(nullptr) { SCASSERT(data != nullptr) timerFormula = new QTimer(this); connect(timerFormula, &QTimer::timeout, this, &DialogTool::EvalFormula); } - //--------------------------------------------------------------------------------------------------------------------- DialogTool::~DialogTool() { @@ -922,7 +938,7 @@ void DialogTool::ChangeColor(QWidget *widget, const QColor &color) { SCASSERT(widget != nullptr) QPalette palette = widget->palette(); - palette.setColor(widget->foregroundRole(), color); + palette.setColor(QPalette::Active, widget->foregroundRole(), color); widget->setPalette(palette); } From 3a2752ef37006e4378cd405f342811e4aa1092f3 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Feb 2017 17:21:17 +0200 Subject: [PATCH 34/52] Move all grainline objects inside a group box. --HG-- branch : feature --- .../dialogs/tools/dialogseamallowance.cpp | 15 +- .../dialogs/tools/dialogseamallowance.ui | 925 +++++++++--------- 2 files changed, 450 insertions(+), 490 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index c0d69f740..6a2efc463 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -212,7 +212,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) UpdateList(); - ui->checkBoxGrainline->setChecked(piece.GetGrainlineGeometry().IsVisible()); + ui->groupBoxGrainline->setChecked(piece.GetGrainlineGeometry().IsVisible()); ui->lineEditRotFormula->setPlainText(piece.GetGrainlineGeometry().GetRotation()); ui->lineEditLenFormula->setPlainText(piece.GetGrainlineGeometry().GetLength()); ui->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType())); @@ -1072,14 +1072,7 @@ void DialogSeamAllowance::SetEditMode() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::EnableGrainlineRotation() { - ui->lineEditRotFormula->setEnabled(ui->checkBoxGrainline->isChecked()); - ui->lineEditLenFormula->setEnabled(ui->checkBoxGrainline->isChecked()); - ui->pushButtonRot->setEnabled(ui->checkBoxGrainline->isChecked()); - ui->pushButtonLen->setEnabled(ui->checkBoxGrainline->isChecked()); - ui->pushButtonShowLen->setEnabled(ui->checkBoxGrainline->isChecked()); - ui->pushButtonShowRot->setEnabled(ui->checkBoxGrainline->isChecked()); - - if (ui->checkBoxGrainline->isChecked() == true) + if (ui->groupBoxGrainline->isChecked() == true) { UpdateValues(); } @@ -1410,7 +1403,7 @@ VPiece DialogSeamAllowance::CreatePiece() const piece.GetPatternInfo().SetBottomRightPin(getCurrentObjectId(ui->comboBoxPatternLabelBottomRightPin)); piece.GetGrainlineGeometry() = m_oldGrainline; - piece.GetGrainlineGeometry().SetVisible(ui->checkBoxGrainline->isChecked()); + piece.GetGrainlineGeometry().SetVisible(ui->groupBoxGrainline->isChecked()); piece.GetGrainlineGeometry().SetRotation(GetFormulaFromUser(ui->lineEditRotFormula)); piece.GetGrainlineGeometry().SetLength(GetFormulaFromUser(ui->lineEditLenFormula)); piece.GetGrainlineGeometry().SetArrowType(static_cast(ui->comboBoxArrow->currentIndex())); @@ -1867,7 +1860,7 @@ void DialogSeamAllowance::InitPatternPieceDataTab() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::InitGrainlineTab() { - connect(ui->checkBoxGrainline, &QCheckBox::toggled, this, &DialogSeamAllowance::EnableGrainlineRotation); + connect(ui->groupBoxGrainline, &QGroupBox::toggled, this, &DialogSeamAllowance::EnableGrainlineRotation); connect(ui->pushButtonRot, &QPushButton::clicked, this, &DialogSeamAllowance::EditFormula); connect(ui->pushButtonLen, &QPushButton::clicked, this, &DialogSeamAllowance::EditFormula); connect(ui->lineEditLenFormula, &QPlainTextEdit::textChanged, this, &DialogSeamAllowance::UpdateValues); diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui b/src/libs/vtools/dialogs/tools/dialogseamallowance.ui index b83fe7923..d9637e9e7 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.ui +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.ui @@ -21,7 +21,7 @@ - 3 + 4 @@ -1130,488 +1130,455 @@ Grainline - + - - - - - Grainline visible - - - - - - - - - - - - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - Rotation: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Formula wizard - - - ... - - - - :/icon/24x24/fx.png:/icon/24x24/fx.png - - - - 24 - 24 - - - - - - - - - - - :/icon/24x24/equal.png - - - - - - - - 0 - 0 - - - - - 87 - 0 - - - - - 0 - 0 - - - - Value - - - _ - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Calculation - - - true - - - - - - - - - - - 18 - 18 - - - - - 0 - 0 - - - - <html><head/><body><p>Show full calculation in message box</p></body></html> - - - - - - - .. - - - - 16 - 16 - - - - true - - - - - - - - - - - - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - Length: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Formula wizard - - - ... - - - - :/icon/24x24/fx.png:/icon/24x24/fx.png - - - - 24 - 24 - - - - - - - - - - - :/icon/24x24/equal.png - - - - - - - - 0 - 0 - - - - - 87 - 0 - - - - - 0 - 0 - - - - Value - - - _ - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Calculation - - - true - - - - - - - - - - - 18 - 18 - - - - - 0 - 0 - - - - <html><head/><body><p>Show full calculation in message box</p></body></html> - - - - - - - .. - - - - 16 - 16 - - - - true - - - - - - - - - QFormLayout::ExpandingFieldsGrow + + + Grainline visible - - - - - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 0 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - Arrows: - - - - - - - - - - Top pin: - - - - - - - Bottom pin: - - - - - - - - - - - - - - - Qt::Vertical + + true - - - 20 - 40 - + + false - + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Rotation: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + + 0 + 0 + + + + Value + + + _ + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + .. + + + + 16 + 16 + + + + true + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Length: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + + 0 + 0 + + + + Value + + + _ + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + .. + + + + 16 + 16 + + + + true + + + + + + + + + QFormLayout::ExpandingFieldsGrow + + + + + + 0 + 0 + + + + Arrows: + + + + + + + + + + Top pin: + + + + + + + Bottom pin: + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + From 86cc0fa0b0231b780c76d4ea792376f4004b15cf Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Feb 2017 17:21:43 +0200 Subject: [PATCH 35/52] Fix typo. --HG-- branch : feature --- src/libs/vtools/dialogs/tools/dialogseamallowance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 6a2efc463..35a79f8aa 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -1885,7 +1885,7 @@ void DialogSeamAllowance::InitGrainlineTab() connect(ui->comboBoxGrainlineTopPin, static_cast(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::GrainlinePinPointChanged); - connect(ui->comboBoxGrainlineTopPin, + connect(ui->comboBoxGrainlineBottomPin, static_cast(&QComboBox::currentIndexChanged), this, &DialogSeamAllowance::GrainlinePinPointChanged); } From 1e525ed788718fd23ea12a46528716472f36e2dd Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Feb 2017 17:23:02 +0200 Subject: [PATCH 36/52] User should at least has valid pins or not null lengths of grainline. --HG-- branch : feature --- src/libs/vtools/dialogs/tools/dialogseamallowance.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 35a79f8aa..8db23777e 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -346,7 +346,7 @@ void DialogSeamAllowance::SaveData() void DialogSeamAllowance::CheckState() { SCASSERT(bOk != nullptr); - bOk->setEnabled(flagName && flagError && flagFormula && flagGPin && flagDPin && flagPPin && flagGFormulas); + bOk->setEnabled(flagName && flagError && flagFormula && flagDPin && flagPPin && (flagGFormulas || flagGPin)); // In case dialog hasn't apply button if ( bApply != nullptr && applyAllowed) { @@ -1075,11 +1075,10 @@ void DialogSeamAllowance::EnableGrainlineRotation() if (ui->groupBoxGrainline->isChecked() == true) { UpdateValues(); + GrainlinePinPointChanged(); } else { - ChangeColor(ui->labelEditLen, okColor); - ChangeColor(ui->labelEditRot, okColor); flagGFormulas = true; ResetWarning(); } @@ -1134,7 +1133,7 @@ void DialogSeamAllowance::DeployLength() //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::ResetWarning() { - if (flagGFormulas && flagGPin) + if (flagGFormulas || flagGPin) { ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), QIcon()); } @@ -1286,8 +1285,7 @@ void DialogSeamAllowance::GrainlinePinPointChanged() QColor color = okColor; const quint32 topPinId = getCurrentObjectId(ui->comboBoxGrainlineTopPin); const quint32 bottomPinId = getCurrentObjectId(ui->comboBoxGrainlineBottomPin); - if ((topPinId == NULL_ID && bottomPinId == NULL_ID) - || (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId)) + if (topPinId != NULL_ID && bottomPinId != NULL_ID && topPinId != bottomPinId) { flagGPin = true; color = okColor; From 449543f203afa0eab07160a63db4480caff487c5 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Feb 2017 19:42:06 +0200 Subject: [PATCH 37/52] Show warning icon if only both requirements are false. --HG-- branch : feature --- src/libs/vtools/dialogs/tools/dialogseamallowance.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 8db23777e..01b839741 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -1010,7 +1010,7 @@ void DialogSeamAllowance::UpdateValues() } flagGFormulas = bFormulasOK; - if (flagGFormulas == false) + if (not flagGFormulas && not flagGPin) { QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon); @@ -1297,8 +1297,11 @@ void DialogSeamAllowance::GrainlinePinPointChanged() flagGPin = false; color = errorColor; - QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); - ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon); + if (not flagGFormulas && not flagGPin) + { + QIcon icon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"); + ui->tabWidget->setTabIcon(ui->tabWidget->indexOf(ui->tabGrainline), icon); + } } ChangeColor(ui->labelGrainlineTopPin, color); ChangeColor(ui->labelGrainlineBottomPin, color); From 02fde1464df7725a5af2878b5798c1d1cd9931b5 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Feb 2017 19:47:13 +0200 Subject: [PATCH 38/52] Fix infinite redrawing. --HG-- branch : feature --- src/libs/vtools/tools/vtoolseamallowance.cpp | 19 ++------- src/libs/vwidgets/vgrainlineitem.cpp | 41 +++++++++++++------- src/libs/vwidgets/vgrainlineitem.h | 3 +- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 7d70830db..e9f6e4375 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -767,22 +767,9 @@ void VToolSeamAllowance::SaveRotateGrainline(qreal dRot, const QPointF& ptPos) */ void VToolSeamAllowance::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) { - if (scene()->views().count() > 0) - { - const QPoint pt0 = scene()->views().at(0)->mapFromScene(0, 0); - const QPoint pt = scene()->views().at(0)->mapFromScene(0, 100); - - const QPoint p = pt - pt0; - -#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) - const qreal dScale = qSqrt(QPoint::dotProduct(p, p)); -#else - const qreal dScale = qSqrt(p.x() * p.x() + p.y() * p.y()); -#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) - m_grainLine->SetScale(100/dScale); - } - - if (m_dataLabel->IsIdle() == false || m_patternInfo->IsIdle() == false || m_grainLine->IsIdle() == false) + if ((m_dataLabel->IsIdle() == false + || m_patternInfo->IsIdle() == false + || m_grainLine->IsIdle() == false) && not isSelected()) { setSelected(true); } diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index d1e92f9b9..9190d5976 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -32,6 +32,8 @@ #include #include #include +#include +#include #include "../vmisc/def.h" #include "../vmisc/vmath.h" @@ -104,8 +106,10 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption pP->drawLine(pt1, pt2); pP->setBrush(clr); + QPolygonF poly; QPointF ptA; + m_dScale = GetScale(); qreal dArrLen = ARROW_LENGTH*m_dScale; if (m_eArrowType != ArrowType::atRear) { @@ -175,7 +179,6 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption pP->drawArc(iX - iR, -iY, iR, iR, 90*16, -90*16); pP->restore(); } - } pP->restore(); } @@ -270,18 +273,6 @@ bool VGrainlineItem::IsContained(const QPointF& pt, qreal dRot, qreal &dX, qreal return bInside; } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief VGrainlineItem::SetScale sets the scale for keeping the arrows of constant size - * @param dScale scale factor - */ -void VGrainlineItem::SetScale(qreal dScale) -{ - m_dScale = dScale; - UpdateRectangle(); - Update(); -} - //--------------------------------------------------------------------------------------------------------------------- /** * @brief VGrainlineItem::mousePressEvent handles left button mouse press events @@ -547,3 +538,27 @@ QPointF VGrainlineItem::GetInsideCorner(int i, qreal dDist) const return m_polyBound.at(i) + pt1 + pt2; } + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief GetScale gets the scale for keeping the arrows of constant size + */ +qreal VGrainlineItem::GetScale() const +{ + if (scene()->views().count() > 0) + { + const QPoint pt0 = scene()->views().at(0)->mapFromScene(0, 0); + const QPoint pt = scene()->views().at(0)->mapFromScene(0, 100); + + const QPoint p = pt - pt0; + +#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) + const qreal dScale = qSqrt(QPoint::dotProduct(p, p)); +#else + const qreal dScale = qSqrt(p.x() * p.x() + p.y() * p.y()); +#endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) + return 100/dScale; + } + + return 1.0; +} diff --git a/src/libs/vwidgets/vgrainlineitem.h b/src/libs/vwidgets/vgrainlineitem.h index 4a0c445b2..bad83d687 100644 --- a/src/libs/vwidgets/vgrainlineitem.h +++ b/src/libs/vwidgets/vgrainlineitem.h @@ -43,7 +43,6 @@ public: void UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, ArrowType eAT); bool IsContained(const QPointF &pt, qreal dRot, qreal &dX, qreal &dY) const; - void SetScale(qreal dScale); signals: void SignalResized(qreal dLength); @@ -75,6 +74,8 @@ private: QPointF m_ptCenter; qreal m_dAngle; ArrowType m_eArrowType; + + qreal GetScale() const; }; #endif // VGRAINLINEITEM_H From 892e5f298f2d0bb5ed5610dba96c2131870a6b95 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 24 Feb 2017 19:48:54 +0200 Subject: [PATCH 39/52] Fix bug. Piece must increase reference count for each pin. --HG-- branch : feature --- src/libs/vtools/tools/vtoolseamallowance.cpp | 10 ++++++++++ src/libs/vtools/tools/vtoolseamallowance.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index e9f6e4375..30d00a394 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -1075,6 +1075,7 @@ VToolSeamAllowance::VToolSeamAllowance(VAbstractPattern *doc, VContainer *data, InitNodes(detail, scene); InitCSAPaths(detail); InitInternalPaths(detail); + InitPins(detail); this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true); RefreshGeometry(); @@ -1203,6 +1204,15 @@ void VToolSeamAllowance::InitInternalPaths(const VPiece &detail) } } +//--------------------------------------------------------------------------------------------------------------------- +void VToolSeamAllowance::InitPins(const VPiece &detail) +{ + for (int i = 0; i < detail.GetPins().size(); ++i) + { + doc->IncrementReferens(detail.GetPins().at(i)); + } +} + //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::DeleteTool(bool ask) { diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index b1dc83a42..d0dec269a 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -155,6 +155,7 @@ private: void InitNodes(const VPiece &detail, VMainGraphicsScene *scene); void InitCSAPaths(const VPiece &detail); void InitInternalPaths(const VPiece &detail); + void InitPins(const VPiece &detail); template Tool* InitTool(VMainGraphicsScene *scene, quint32 toolId); From 2be911095541dcf673ba889b83410e99d2d56df2 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 27 Feb 2017 11:59:08 +0200 Subject: [PATCH 40/52] Override method shape() to improve selection of grainline. --HG-- branch : feature --- src/libs/vwidgets/vgrainlineitem.cpp | 125 ++++++++++++++++++++------- src/libs/vwidgets/vgrainlineitem.h | 6 ++ 2 files changed, 102 insertions(+), 29 deletions(-) diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index 9190d5976..54574cdec 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -46,6 +46,7 @@ #define RESIZE_RECT_SIZE 10 #define ROTATE_CIRC_R 7 #define ACTIVE_Z 10 +#define LINE_PEN_WIDTH 3 //--------------------------------------------------------------------------------------------------------------------- /** @@ -81,6 +82,54 @@ VGrainlineItem::VGrainlineItem(QGraphicsItem* pParent) VGrainlineItem::~VGrainlineItem() {} +//--------------------------------------------------------------------------------------------------------------------- +QPainterPath VGrainlineItem::shape() const +{ + QPainterPath path; + + if (m_eMode == mNormal) + { + QPointF pt1; + QPointF pt2(pt1.x() + m_dLength * cos(m_dRotation), pt1.y() - m_dLength * sin(m_dRotation)); + + const QLineF mainLine = MainLine(); + QPainterPath linePath; + linePath.moveTo(mainLine.p1()); + linePath.lineTo(mainLine.p2()); + linePath.closeSubpath(); + + QPainterPathStroker stroker; + stroker.setWidth(LINE_PEN_WIDTH); + path.addPath((stroker.createStroke(linePath) + linePath).simplified()); + path.closeSubpath(); + + const qreal dArrLen = ARROW_LENGTH*GetScale(); + if (m_eArrowType != ArrowType::atRear) + { + // first arrow + QPainterPath polyPath; + polyPath.addPolygon(FirstArrow(dArrLen)); + path.addPath((stroker.createStroke(polyPath) + polyPath).simplified()); + path.closeSubpath(); + } + + if (m_eArrowType != ArrowType::atFront) + { + // second arrow + QPainterPath polyPath; + polyPath.addPolygon(SecondArrow(dArrLen)); + path.addPath((stroker.createStroke(polyPath) + polyPath).simplified()); + path.closeSubpath(); + } + } + else + { + path.addPolygon(m_polyBound); + } + + return path; +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief VGrainlineItem::paint paints the item content @@ -94,47 +143,26 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption Q_UNUSED(pWidget) pP->save(); QColor clr = Qt::black; - pP->setPen(QPen(clr, 3)); - QPointF pt1(0, 0); - QPointF pt2; - - pt2.setX(pt1.x() + m_dLength * cos(m_dRotation)); - pt2.setY(pt1.y() - m_dLength * sin(m_dRotation)); + pP->setPen(QPen(clr, LINE_PEN_WIDTH, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); pP->setRenderHints(QPainter::Antialiasing); // line - pP->drawLine(pt1, pt2); + const QLineF mainLine = MainLine(); + pP->drawLine(mainLine.p1(), mainLine.p2()); pP->setBrush(clr); - QPolygonF poly; - QPointF ptA; m_dScale = GetScale(); qreal dArrLen = ARROW_LENGTH*m_dScale; if (m_eArrowType != ArrowType::atRear) { // first arrow - poly << pt1; - ptA.setX(pt1.x() + dArrLen*cos(m_dRotation + ARROW_ANGLE)); - ptA.setY(pt1.y() - dArrLen*sin(m_dRotation + ARROW_ANGLE)); - poly << ptA; - ptA.setX(pt1.x() + dArrLen*cos(m_dRotation - ARROW_ANGLE)); - ptA.setY(pt1.y() - dArrLen*sin(m_dRotation - ARROW_ANGLE)); - poly << ptA; - pP->drawPolygon(poly); + pP->drawPolygon(FirstArrow(dArrLen)); } if (m_eArrowType != ArrowType::atFront) { // second arrow - poly.clear(); - poly << pt2; - ptA.setX(pt2.x() + dArrLen*cos(M_PI + m_dRotation + ARROW_ANGLE)); - ptA.setY(pt2.y() - dArrLen*sin(M_PI + m_dRotation + ARROW_ANGLE)); - poly << ptA; - ptA.setX(pt2.x() + dArrLen*cos(M_PI + m_dRotation - ARROW_ANGLE)); - ptA.setY(pt2.y() - dArrLen*sin(M_PI + m_dRotation - ARROW_ANGLE)); - poly << ptA; - pP->drawPolygon(poly); + pP->drawPolygon(SecondArrow(dArrLen)); } if (m_eMode != mNormal) @@ -553,12 +581,51 @@ qreal VGrainlineItem::GetScale() const const QPoint p = pt - pt0; #if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) - const qreal dScale = qSqrt(QPoint::dotProduct(p, p)); + qreal dScale = qSqrt(QPoint::dotProduct(p, p)); #else - const qreal dScale = qSqrt(p.x() * p.x() + p.y() * p.y()); + qreal dScale = qSqrt(p.x() * p.x() + p.y() * p.y()); #endif //QT_VERSION >= QT_VERSION_CHECK(5, 1, 0) - return 100/dScale; + dScale = 100.0/dScale; + if (dScale < 1.0) + { + dScale = 1.0; + } + return dScale; } return 1.0; } + +//--------------------------------------------------------------------------------------------------------------------- +QLineF VGrainlineItem::MainLine() const +{ + QPointF pt1; + QPointF pt2(pt1.x() + m_dLength * cos(m_dRotation), pt1.y() - m_dLength * sin(m_dRotation)); + return QLineF(pt1, pt2); +} + +//--------------------------------------------------------------------------------------------------------------------- +QPolygonF VGrainlineItem::FirstArrow(qreal dArrLen) const +{ + const QPointF pt1 = MainLine().p1(); + QPolygonF poly; + poly << pt1; + poly << QPointF(pt1.x() + dArrLen*cos(m_dRotation + ARROW_ANGLE), + pt1.y() - dArrLen*sin(m_dRotation + ARROW_ANGLE)); + poly << QPointF(pt1.x() + dArrLen*cos(m_dRotation - ARROW_ANGLE), + pt1.y() - dArrLen*sin(m_dRotation - ARROW_ANGLE)); + return poly; +} + +//--------------------------------------------------------------------------------------------------------------------- +QPolygonF VGrainlineItem::SecondArrow(qreal dArrLen) const +{ + const QPointF pt2 = MainLine().p2(); + QPolygonF poly; + poly << pt2; + poly << QPointF(pt2.x() + dArrLen*cos(M_PI + m_dRotation + ARROW_ANGLE), + pt2.y() - dArrLen*sin(M_PI + m_dRotation + ARROW_ANGLE)); + poly << QPointF(pt2.x() + dArrLen*cos(M_PI + m_dRotation - ARROW_ANGLE), + pt2.y() - dArrLen*sin(M_PI + m_dRotation - ARROW_ANGLE)); + return poly; +} diff --git a/src/libs/vwidgets/vgrainlineitem.h b/src/libs/vwidgets/vgrainlineitem.h index bad83d687..cac4e1327 100644 --- a/src/libs/vwidgets/vgrainlineitem.h +++ b/src/libs/vwidgets/vgrainlineitem.h @@ -39,6 +39,8 @@ public: explicit VGrainlineItem(QGraphicsItem* pParent = nullptr); virtual ~VGrainlineItem(); + virtual QPainterPath shape() const Q_DECL_OVERRIDE; + virtual void paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption, QWidget* pWidget) Q_DECL_OVERRIDE; void UpdateGeometry(const QPointF& ptPos, qreal dRotation, qreal dLength, ArrowType eAT); @@ -76,6 +78,10 @@ private: ArrowType m_eArrowType; qreal GetScale() const; + + QLineF MainLine() const; + QPolygonF FirstArrow(qreal dArrLen) const; + QPolygonF SecondArrow(qreal dArrLen) const; }; #endif // VGRAINLINEITEM_H From 93a59b93712c8f259b7bc04c2cfd829d393515dc Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 27 Feb 2017 12:01:38 +0200 Subject: [PATCH 41/52] Use pin points to set size and angle. --HG-- branch : feature --- src/libs/vtools/tools/vtoolseamallowance.cpp | 157 ++++++++++++++----- src/libs/vtools/tools/vtoolseamallowance.h | 2 + 2 files changed, 123 insertions(+), 36 deletions(-) diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 30d00a394..37463f6e2 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -477,33 +477,38 @@ void VToolSeamAllowance::Highlight(quint32 id) void VToolSeamAllowance::UpdateLabel() { const VPiece detail = VAbstractTool::data.GetPiece(id); - const VPieceLabelData& data = detail.GetPatternPieceData(); + const VPieceLabelData& labelData = detail.GetPatternPieceData(); - if (data.IsVisible() == true) + if (labelData.IsVisible() == true) { + QPointF pos; + qreal labelWidth = 0; + qreal labelHeight = 0; + FindLabelGeometry(labelData, labelWidth, labelHeight, pos); + QFont fnt = qApp->font(); { - const int iFS = data.GetFontSize(); + const int iFS = labelData.GetFontSize(); iFS < MIN_FONT_SIZE ? fnt.setPixelSize(MIN_FONT_SIZE) : fnt.setPixelSize(iFS); } m_dataLabel->SetFont(fnt); - m_dataLabel->SetSize(data.GetLabelWidth(), data.GetLabelHeight()); - m_dataLabel->UpdateData(detail.GetName(), data); - QPointF pt = data.GetPos(); + m_dataLabel->SetSize(labelWidth, labelHeight); + m_dataLabel->UpdateData(detail.GetName(), labelData); + QRectF rectBB; - rectBB.setTopLeft(pt); + rectBB.setTopLeft(pos); rectBB.setWidth(m_dataLabel->boundingRect().width()); rectBB.setHeight(m_dataLabel->boundingRect().height()); qreal dX; qreal dY; - if (m_dataLabel->IsContained(rectBB, data.GetRotation(), dX, dY) == false) + if (m_dataLabel->IsContained(rectBB, labelData.GetRotation(), dX, dY) == false) { - pt.setX(pt.x() + dX); - pt.setY(pt.y() + dY); + pos.setX(pos.x() + dX); + pos.setY(pos.y() + dY); } - m_dataLabel->setPos(pt); - m_dataLabel->setRotation(data.GetRotation()); + m_dataLabel->setPos(pos); + m_dataLabel->setRotation(labelData.GetRotation()); m_dataLabel->Update(); m_dataLabel->show(); } @@ -524,6 +529,11 @@ void VToolSeamAllowance::UpdatePatternInfo() if (geom.IsVisible() == true) { + QPointF pos; + qreal labelWidth = 0; + qreal labelHeight = 0; + FindLabelGeometry(geom, labelWidth, labelHeight, pos); + QFont fnt = qApp->font(); int iFS = geom.GetFontSize(); if (iFS < MIN_FONT_SIZE) @@ -532,23 +542,22 @@ void VToolSeamAllowance::UpdatePatternInfo() } fnt.setPixelSize(iFS); m_patternInfo->SetFont(fnt); - m_patternInfo->SetSize(geom.GetLabelWidth(), geom.GetLabelHeight()); + m_patternInfo->SetSize(labelWidth, labelHeight); m_patternInfo->UpdateData(doc, getData()->size(), getData()->height()); - QPointF pt = geom.GetPos(); QRectF rectBB; - rectBB.setTopLeft(pt); + rectBB.setTopLeft(pos); rectBB.setWidth(m_patternInfo->boundingRect().width()); rectBB.setHeight(m_patternInfo->boundingRect().height()); qreal dX; qreal dY; if (m_patternInfo->IsContained(rectBB, geom.GetRotation(), dX, dY) == false) { - pt.setX(pt.x() + dX); - pt.setY(pt.y() + dY); + pos.setX(pos.x() + dX); + pos.setY(pos.y() + dY); } - m_patternInfo->setPos(pt); + m_patternInfo->setPos(pos); m_patternInfo->setRotation(geom.GetRotation()); m_patternInfo->Update(); m_patternInfo->GetTextLines() > 0 ? m_patternInfo->show() : m_patternInfo->hide(); @@ -570,30 +579,17 @@ void VToolSeamAllowance::UpdateGrainline() if (geom.IsVisible() == true) { - qreal dRotation; - qreal dLength; - try - { - QString qsFormula; - qsFormula = geom.GetRotation().replace("\n", " "); - qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); + QPointF pos; + qreal dRotation = 0; + qreal dLength = 0; - Calculator cal1; - dRotation = cal1.EvalFormula(VDataTool::data.PlainVariables(), qsFormula); - - qsFormula = geom.GetLength().replace("\n", " "); - qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); - Calculator cal2; - dLength = cal2.EvalFormula(VDataTool::data.PlainVariables(), qsFormula); - } - catch(qmu::QmuParserError &e) + if ( not FindGrainlineGeometry(geom, dLength, dRotation, pos)) { - Q_UNUSED(e); m_grainLine->hide(); return; } - m_grainLine->UpdateGeometry(geom.GetPos(), dRotation, ToPixel(dLength, *VDataTool::data.GetPatternUnit()), + m_grainLine->UpdateGeometry(pos, dRotation, ToPixel(dLength, *VDataTool::data.GetPatternUnit()), geom.GetArrowType()); m_grainLine->show(); } @@ -1155,6 +1151,95 @@ void VToolSeamAllowance::SaveDialogChange() UpdateLabel(); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData& labelData, qreal &labelWidth, qreal &labelHeight, + QPointF &pos) +{ + const quint32 topLeftPin = labelData.TopLeftPin(); + const quint32 bottomRightPin = labelData.BottomRightPin(); + + if (topLeftPin != NULL_ID && bottomRightPin != NULL_ID) + { + try + { + const auto topLeftPinPoint = VAbstractTool::data.GeometricObject(topLeftPin); + const auto bottomRightPinPoint = VAbstractTool::data.GeometricObject(bottomRightPin); + + const QRectF labelRect = QRectF(*topLeftPinPoint, *bottomRightPinPoint); + labelWidth = qAbs(labelRect.width()); + labelHeight = qAbs(labelRect.height()); + + pos = labelRect.topLeft(); + + return; + } + catch(const VExceptionBadId &) + { + // do nothing. + } + } + + labelWidth = labelData.GetLabelWidth(); + labelHeight = labelData.GetLabelHeight(); + pos = labelData.GetPos(); +} + +//--------------------------------------------------------------------------------------------------------------------- +bool VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineData& geom, qreal &length, qreal &rotationAngle, + QPointF &pos) +{ + const quint32 topPin = geom.TopPin(); + const quint32 bottomPin = geom.BottomPin(); + + if (topPin != NULL_ID && bottomPin != NULL_ID) + { + try + { + const auto topPinPoint = VAbstractTool::data.GeometricObject(topPin); + const auto bottomPinPoint = VAbstractTool::data.GeometricObject(bottomPin); + + QLineF grainline(*bottomPinPoint, *topPinPoint); + length = FromPixel(grainline.length(), *VDataTool::data.GetPatternUnit()); + rotationAngle = grainline.angle(); + + if (not VFuzzyComparePossibleNulls(rotationAngle, 0)) + { + grainline.setAngle(0); + } + + pos = grainline.p1(); + + return true; + } + catch(const VExceptionBadId &) + { + // do nothing. + } + } + + try + { + QString qsFormula = geom.GetRotation().replace("\n", " "); + qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); + + Calculator cal1; + rotationAngle = cal1.EvalFormula(VAbstractTool::data.PlainVariables(), qsFormula); + + qsFormula = geom.GetLength().replace("\n", " "); + qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); + Calculator cal2; + length = cal2.EvalFormula(VAbstractTool::data.PlainVariables(), qsFormula); + } + catch(qmu::QmuParserError &e) + { + Q_UNUSED(e); + return false; + } + + pos = geom.GetPos(); + return true; +} + //--------------------------------------------------------------------------------------------------------------------- void VToolSeamAllowance::InitNodes(const VPiece &detail, VMainGraphicsScene *scene) { diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index d0dec269a..fc948e1ae 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -151,6 +151,8 @@ private: void RefreshGeometry(); void SaveDialogChange(); + void FindLabelGeometry(const VPatternLabelData &labelData, qreal &labelWidth, qreal &labelHeight, QPointF &pos); + bool FindGrainlineGeometry(const VGrainlineData &geom, qreal &length, qreal &rotationAngle, QPointF &pos); void InitNodes(const VPiece &detail, VMainGraphicsScene *scene); void InitCSAPaths(const VPiece &detail); From 38740f7ef87d637f01696ea53235222d86a461ec Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 27 Feb 2017 14:28:22 +0200 Subject: [PATCH 42/52] Fix incorrect saving grainline angle and length. --HG-- branch : feature --- src/libs/vlayout/vlayoutpiece.cpp | 8 ++--- .../dialogs/tools/dialogseamallowance.cpp | 32 +++++++++++++++++-- .../dialogs/tools/dialogseamallowance.h | 2 ++ src/libs/vtools/dialogs/tools/dialogtool.cpp | 2 +- src/libs/vtools/dialogs/tools/dialogtool.h | 2 +- 5 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 3102eaabb..98c875149 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -238,16 +238,12 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer& rP try { - QString qsFormula = geom.GetRotation().replace("\n", " "); - qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); Calculator cal1; - dAng = cal1.EvalFormula(rPattern.PlainVariables(), qsFormula); + dAng = cal1.EvalFormula(rPattern.PlainVariables(), geom.GetRotation()); dAng = qDegreesToRadians(dAng); - qsFormula = geom.GetLength().replace("\n", " "); - qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); Calculator cal2; - dLen = cal2.EvalFormula(rPattern.PlainVariables(), qsFormula); + dLen = cal2.EvalFormula(rPattern.PlainVariables(), geom.GetLength()); dLen = ToPixel(dLen, *rPattern.GetPatternUnit()); } catch(qmu::QmuParserError &e) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 01b839741..194e23d53 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -213,8 +213,8 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece) UpdateList(); ui->groupBoxGrainline->setChecked(piece.GetGrainlineGeometry().IsVisible()); - ui->lineEditRotFormula->setPlainText(piece.GetGrainlineGeometry().GetRotation()); - ui->lineEditLenFormula->setPlainText(piece.GetGrainlineGeometry().GetLength()); + SetGrainlineAngle(piece.GetGrainlineGeometry()); + SetGrainlineLength(piece.GetGrainlineGeometry()); ui->comboBoxArrow->setCurrentIndex(int(piece.GetGrainlineGeometry().GetArrowType())); m_oldData = piece.GetPatternPieceData(); @@ -1989,3 +1989,31 @@ QVector DialogSeamAllowance::GetPieceInternals(const QListWidget *list) const } return internals; } + +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::SetGrainlineAngle(const VGrainlineData &data) +{ + const QString formula = qApp->TrVars()->FormulaToUser(data.GetRotation(), qApp->Settings()->GetOsSeparator()); + // increase height if needed. + if (formula.length() > 80) + { + this->DeployRotation(); + } + ui->lineEditRotFormula->setPlainText(formula); + + MoveCursorToEnd(ui->lineEditRotFormula); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogSeamAllowance::SetGrainlineLength(const VGrainlineData &data) +{ + const QString formula = qApp->TrVars()->FormulaToUser(data.GetLength(), qApp->Settings()->GetOsSeparator()); + // increase height if needed. + if (formula.length() > 80) + { + this->DeployLength(); + } + ui->lineEditLenFormula->setPlainText(formula); + + MoveCursorToEnd(ui->lineEditLenFormula); +} diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.h b/src/libs/vtools/dialogs/tools/dialogseamallowance.h index 267bc7c30..0bcb47371 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.h +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.h @@ -198,6 +198,8 @@ private: template QVector GetPieceInternals(const QListWidget *list) const; + void SetGrainlineAngle(const VGrainlineData &data); + void SetGrainlineLength(const VGrainlineData &data); }; #endif // DIALOGSEAMALLOWANCE_H diff --git a/src/libs/vtools/dialogs/tools/dialogtool.cpp b/src/libs/vtools/dialogs/tools/dialogtool.cpp index 64ddd7550..6216b6b20 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.cpp +++ b/src/libs/vtools/dialogs/tools/dialogtool.cpp @@ -353,7 +353,7 @@ void DialogTool::ChangeCurrentData(QComboBox *box, const QVariant &value) const } //--------------------------------------------------------------------------------------------------------------------- -void DialogTool::MoveCursorToEnd(QPlainTextEdit *plainTextEdit) +void DialogTool::MoveCursorToEnd(QPlainTextEdit *plainTextEdit) const { SCASSERT(plainTextEdit != nullptr) QTextCursor cursor = plainTextEdit->textCursor(); diff --git a/src/libs/vtools/dialogs/tools/dialogtool.h b/src/libs/vtools/dialogs/tools/dialogtool.h index 0cf0a8b90..b57bcb642 100644 --- a/src/libs/vtools/dialogs/tools/dialogtool.h +++ b/src/libs/vtools/dialogs/tools/dialogtool.h @@ -262,7 +262,7 @@ protected: * @brief SaveData Put dialog data in local variables */ virtual void SaveData() {} - void MoveCursorToEnd(QPlainTextEdit *plainTextEdit); + void MoveCursorToEnd(QPlainTextEdit *plainTextEdit) const; virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE; quint32 DNumber(const QString &baseName) const; From 1d91df5216ff1049b618da7ace9e7799484a3363 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 27 Feb 2017 14:30:02 +0200 Subject: [PATCH 43/52] Preparetions to be able to control moving actions: rotation and resizing. --HG-- branch : feature --- src/libs/vtools/tools/vtoolseamallowance.cpp | 62 ++++++++++++++------ src/libs/vtools/tools/vtoolseamallowance.h | 6 +- src/libs/vwidgets/vgrainlineitem.cpp | 2 +- src/libs/vwidgets/vpieceitem.cpp | 13 ++++ src/libs/vwidgets/vpieceitem.h | 14 +++-- src/libs/vwidgets/vtextgraphicsitem.cpp | 2 +- 6 files changed, 72 insertions(+), 27 deletions(-) diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 37463f6e2..681d9b28c 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -54,6 +54,7 @@ #include "../undocommands/togglepieceinlayout.h" #include "../vwidgets/vmaingraphicsview.h" #include "../vwidgets/vnobrushscalepathitem.h" +#include "../qmuparser/qmutokenparser.h" #include #include @@ -484,7 +485,8 @@ void VToolSeamAllowance::UpdateLabel() QPointF pos; qreal labelWidth = 0; qreal labelHeight = 0; - FindLabelGeometry(labelData, labelWidth, labelHeight, pos); + const VTextGraphicsItem::MoveType type = FindLabelGeometry(labelData, labelWidth, labelHeight, pos); + m_dataLabel->SetMoveType(type); QFont fnt = qApp->font(); { @@ -532,7 +534,8 @@ void VToolSeamAllowance::UpdatePatternInfo() QPointF pos; qreal labelWidth = 0; qreal labelHeight = 0; - FindLabelGeometry(geom, labelWidth, labelHeight, pos); + const VTextGraphicsItem::MoveType type = FindLabelGeometry(geom, labelWidth, labelHeight, pos); + m_patternInfo->SetMoveType(type); QFont fnt = qApp->font(); int iFS = geom.GetFontSize(); @@ -583,12 +586,14 @@ void VToolSeamAllowance::UpdateGrainline() qreal dRotation = 0; qreal dLength = 0; - if ( not FindGrainlineGeometry(geom, dLength, dRotation, pos)) + const VGrainlineItem::MoveType type = FindGrainlineGeometry(geom, dLength, dRotation, pos); + if (type == VGrainlineItem::Error) { m_grainLine->hide(); return; } + m_grainLine->SetMoveType(type); m_grainLine->UpdateGeometry(pos, dRotation, ToPixel(dLength, *VDataTool::data.GetPatternUnit()), geom.GetArrowType()); m_grainLine->show(); @@ -735,7 +740,7 @@ void VToolSeamAllowance::SaveResizeGrainline(qreal dLength) VPiece newDet = oldDet; dLength = FromPixel(dLength, *VDataTool::data.GetPatternUnit()); - newDet.GetGrainlineGeometry().SetLength(qApp->LocaleToString(dLength)); + newDet.GetGrainlineGeometry().SetLength(QString().setNum(dLength)); SavePieceOptions* resizeCommand = new SavePieceOptions(oldDet, newDet, doc, id); resizeCommand->setText(tr("resize grainline")); connect(resizeCommand, &SavePieceOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); @@ -749,7 +754,7 @@ void VToolSeamAllowance::SaveRotateGrainline(qreal dRot, const QPointF& ptPos) VPiece newDet = oldDet; dRot = qRadiansToDegrees(dRot); - newDet.GetGrainlineGeometry().SetRotation(qApp->LocaleToString(dRot)); + newDet.GetGrainlineGeometry().SetRotation(QString().setNum(dRot)); newDet.GetGrainlineGeometry().SetPos(ptPos); SavePieceOptions* rotateCommand = new SavePieceOptions(oldDet, newDet, doc, id); rotateCommand->setText(tr("rotate grainline")); @@ -1152,8 +1157,8 @@ void VToolSeamAllowance::SaveDialogChange() } //--------------------------------------------------------------------------------------------------------------------- -void VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData& labelData, qreal &labelWidth, qreal &labelHeight, - QPointF &pos) +VPieceItem::MoveType VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData& labelData, qreal &labelWidth, + qreal &labelHeight, QPointF &pos) { const quint32 topLeftPin = labelData.TopLeftPin(); const quint32 bottomRightPin = labelData.BottomRightPin(); @@ -1171,7 +1176,7 @@ void VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData& labelData, q pos = labelRect.topLeft(); - return; + return VTextGraphicsItem::OnlyRotatable; } catch(const VExceptionBadId &) { @@ -1182,11 +1187,12 @@ void VToolSeamAllowance::FindLabelGeometry(const VPatternLabelData& labelData, q labelWidth = labelData.GetLabelWidth(); labelHeight = labelData.GetLabelHeight(); pos = labelData.GetPos(); + return VTextGraphicsItem::Movable; } //--------------------------------------------------------------------------------------------------------------------- -bool VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineData& geom, qreal &length, qreal &rotationAngle, - QPointF &pos) +VPieceItem::MoveType VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineData& geom, qreal &length, + qreal &rotationAngle, QPointF &pos) { const quint32 topPin = geom.TopPin(); const quint32 bottomPin = geom.BottomPin(); @@ -1209,7 +1215,7 @@ bool VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineData& geom, qreal pos = grainline.p1(); - return true; + return VPieceItem::OnlyRotatable; } catch(const VExceptionBadId &) { @@ -1217,27 +1223,45 @@ bool VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineData& geom, qreal } } + bool isResizable = false; + bool isRotatable = false; try { - QString qsFormula = geom.GetRotation().replace("\n", " "); - qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); + isRotatable = qmu::QmuTokenParser::IsSingle(geom.GetRotation()); Calculator cal1; - rotationAngle = cal1.EvalFormula(VAbstractTool::data.PlainVariables(), qsFormula); + rotationAngle = cal1.EvalFormula(VAbstractTool::data.PlainVariables(), geom.GetRotation()); + + isResizable = qmu::QmuTokenParser::IsSingle(geom.GetLength()); - qsFormula = geom.GetLength().replace("\n", " "); - qsFormula = qApp->TrVars()->FormulaFromUser(qsFormula, qApp->Settings()->GetOsSeparator()); Calculator cal2; - length = cal2.EvalFormula(VAbstractTool::data.PlainVariables(), qsFormula); + length = cal2.EvalFormula(VAbstractTool::data.PlainVariables(), geom.GetLength()); } catch(qmu::QmuParserError &e) { Q_UNUSED(e); - return false; + return VPieceItem::Error; } pos = geom.GetPos(); - return true; + + if (isResizable && isRotatable) + { + return VPieceItem::Movable; + } + else + { + if (isResizable) + { + return VPieceItem::OnlyResizable; + } + + if (isRotatable) + { + return VPieceItem::OnlyRotatable; + } + } + return VPieceItem::NotMovable; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/vtoolseamallowance.h b/src/libs/vtools/tools/vtoolseamallowance.h index fc948e1ae..f402721dc 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.h +++ b/src/libs/vtools/tools/vtoolseamallowance.h @@ -151,8 +151,10 @@ private: void RefreshGeometry(); void SaveDialogChange(); - void FindLabelGeometry(const VPatternLabelData &labelData, qreal &labelWidth, qreal &labelHeight, QPointF &pos); - bool FindGrainlineGeometry(const VGrainlineData &geom, qreal &length, qreal &rotationAngle, QPointF &pos); + VPieceItem::MoveType FindLabelGeometry(const VPatternLabelData &labelData, qreal &labelWidth, qreal &labelHeight, + QPointF &pos); + VPieceItem::MoveType FindGrainlineGeometry(const VGrainlineData &geom, qreal &length, qreal &rotationAngle, + QPointF &pos); void InitNodes(const VPiece &detail, VMainGraphicsScene *scene); void InitCSAPaths(const VPiece &detail); diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index 54574cdec..c0cb1b87e 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -308,7 +308,7 @@ bool VGrainlineItem::IsContained(const QPointF& pt, qreal dRot, qreal &dX, qreal */ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME) { - if (pME->button() == Qt::LeftButton) + if (pME->button() == Qt::LeftButton && pME->type() != QEvent::GraphicsSceneMouseDoubleClick) { m_ptStartPos = pos(); m_ptStartMove = pME->scenePos(); diff --git a/src/libs/vwidgets/vpieceitem.cpp b/src/libs/vwidgets/vpieceitem.cpp index f7f969fed..7319a59a0 100644 --- a/src/libs/vwidgets/vpieceitem.cpp +++ b/src/libs/vwidgets/vpieceitem.cpp @@ -38,6 +38,7 @@ VPieceItem::VPieceItem(QGraphicsItem *pParent) m_eMode(VPieceItem::mNormal), m_bReleased(false), m_ptRotCenter(), + m_moveType(Movable), m_inactiveZ(1) { m_rectBoundingBox.setTopLeft(QPointF(0, 0)); @@ -106,3 +107,15 @@ double VPieceItem::GetAngle(const QPointF &pt) const } } +//--------------------------------------------------------------------------------------------------------------------- +VPieceItem::MoveType VPieceItem::GetMoveType() const +{ + return m_moveType; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPieceItem::SetMoveType(const MoveType &moveType) +{ + m_moveType = moveType; +} + diff --git a/src/libs/vwidgets/vpieceitem.h b/src/libs/vwidgets/vpieceitem.h index 7b3306044..32509f5f6 100644 --- a/src/libs/vwidgets/vpieceitem.h +++ b/src/libs/vwidgets/vpieceitem.h @@ -36,6 +36,8 @@ class VPieceItem : public QGraphicsObject { Q_OBJECT public: + enum MoveType {Movable, OnlyResizable, OnlyRotatable, NotMovable, Error}; + explicit VPieceItem(QGraphicsItem* pParent = nullptr); virtual ~VPieceItem(); @@ -48,6 +50,9 @@ public: double GetAngle(const QPointF &pt) const; + MoveType GetMoveType() const; + void SetMoveType(const MoveType &moveType); + signals: void SignalMoved(const QPointF &ptPos); @@ -59,10 +64,11 @@ protected: mResize, mRotate }; - QRectF m_rectBoundingBox; - Mode m_eMode; - bool m_bReleased; - QPointF m_ptRotCenter; + QRectF m_rectBoundingBox; + Mode m_eMode; + bool m_bReleased; + QPointF m_ptRotCenter; + MoveType m_moveType; qreal m_inactiveZ; diff --git a/src/libs/vwidgets/vtextgraphicsitem.cpp b/src/libs/vwidgets/vtextgraphicsitem.cpp index 842bcdeaa..463b7506f 100644 --- a/src/libs/vwidgets/vtextgraphicsitem.cpp +++ b/src/libs/vwidgets/vtextgraphicsitem.cpp @@ -401,7 +401,7 @@ int VTextGraphicsItem::GetFontSize() const */ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME) { - if (pME->button() == Qt::LeftButton) + if (pME->button() == Qt::LeftButton && pME->type() != QEvent::GraphicsSceneMouseDoubleClick) { // record the parameters of the mouse press. Specially record the position // of the press as the origin for the following operations From 83b9e3e5ff4e3974a476e2c5dcf75c26088f4783 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 27 Feb 2017 14:35:55 +0200 Subject: [PATCH 44/52] Fix grainline rotatio angle. Now it follow mouse pointer. --HG-- branch : feature --- src/libs/vwidgets/vpieceitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/vwidgets/vpieceitem.cpp b/src/libs/vwidgets/vpieceitem.cpp index 7319a59a0..f2f8e4c54 100644 --- a/src/libs/vwidgets/vpieceitem.cpp +++ b/src/libs/vwidgets/vpieceitem.cpp @@ -103,7 +103,7 @@ double VPieceItem::GetAngle(const QPointF &pt) const } else { - return qAtan2(dY, dX); + return -qAtan2(dY, dX); } } From 5fbdb4f7f006d11a8f0c0f40d980bb629efccd5d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 27 Feb 2017 22:06:48 +0200 Subject: [PATCH 45/52] Block actions with grainline depend on restrictions. --HG-- branch : feature --- src/libs/vtools/tools/vtoolseamallowance.cpp | 8 ++-- src/libs/vwidgets/vgrainlineitem.cpp | 45 +++++++++++++++----- src/libs/vwidgets/vpieceitem.cpp | 2 +- src/libs/vwidgets/vpieceitem.h | 2 +- 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/libs/vtools/tools/vtoolseamallowance.cpp b/src/libs/vtools/tools/vtoolseamallowance.cpp index 681d9b28c..f7576d5ab 100644 --- a/src/libs/vtools/tools/vtoolseamallowance.cpp +++ b/src/libs/vtools/tools/vtoolseamallowance.cpp @@ -1187,7 +1187,7 @@ VPieceItem::MoveType VToolSeamAllowance::FindLabelGeometry(const VPatternLabelDa labelWidth = labelData.GetLabelWidth(); labelHeight = labelData.GetLabelHeight(); pos = labelData.GetPos(); - return VTextGraphicsItem::Movable; + return VTextGraphicsItem::AllModifications; } //--------------------------------------------------------------------------------------------------------------------- @@ -1215,7 +1215,7 @@ VPieceItem::MoveType VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineD pos = grainline.p1(); - return VPieceItem::OnlyRotatable; + return VPieceItem::NotMovable; } catch(const VExceptionBadId &) { @@ -1247,7 +1247,7 @@ VPieceItem::MoveType VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineD if (isResizable && isRotatable) { - return VPieceItem::Movable; + return VPieceItem::AllModifications; } else { @@ -1261,7 +1261,7 @@ VPieceItem::MoveType VToolSeamAllowance::FindGrainlineGeometry(const VGrainlineD return VPieceItem::OnlyRotatable; } } - return VPieceItem::NotMovable; + return VPieceItem::OnlyMovable; } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index c0cb1b87e..30e6f6acc 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -310,6 +310,12 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME) { if (pME->button() == Qt::LeftButton && pME->type() != QEvent::GraphicsSceneMouseDoubleClick) { + if (m_moveType == NotMovable) + { + pME->ignore(); + return; + } + m_ptStartPos = pos(); m_ptStartMove = pME->scenePos(); m_dStartLength = m_dLength; @@ -317,25 +323,42 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME) m_dAngle = GetAngle(mapToParent(pME->pos())); m_ptRotCenter = m_ptCenter; - if (m_eMode != mRotate) + if (m_moveType == OnlyRotatable) { - if (m_polyResize.containsPoint(pME->pos(), Qt::OddEvenFill) == true) - { - m_eMode = mResize; - SetOverrideCursor(Qt::SizeFDiagCursor); - } - else + if (m_eMode != mRotate) { m_eMode = mMove; SetOverrideCursor(cursorArrowCloseHand, 1, 1); } } - else + else if (m_moveType == OnlyMovable) { + m_eMode = mMove; SetOverrideCursor(cursorArrowCloseHand, 1, 1); } - setZValue(ACTIVE_Z); - Update(); + else + { + if (m_eMode != mRotate) + { + if (m_polyResize.containsPoint(pME->pos(), Qt::OddEvenFill) == true) + { + m_eMode = mResize; + SetOverrideCursor(Qt::SizeFDiagCursor); + } + else + { + m_eMode = mMove; + SetOverrideCursor(cursorArrowCloseHand, 1, 1); + } + } + else + { + SetOverrideCursor(cursorArrowCloseHand, 1, 1); + } + + setZValue(ACTIVE_Z); + Update(); + } } } @@ -431,7 +454,7 @@ void VGrainlineItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME) { if (bShort == true) { - if (m_bReleased == true) + if (m_bReleased == true && m_moveType != OnlyResizable && m_moveType != OnlyMovable) { m_eMode = mRotate; Update(); diff --git a/src/libs/vwidgets/vpieceitem.cpp b/src/libs/vwidgets/vpieceitem.cpp index f2f8e4c54..40ea08864 100644 --- a/src/libs/vwidgets/vpieceitem.cpp +++ b/src/libs/vwidgets/vpieceitem.cpp @@ -38,7 +38,7 @@ VPieceItem::VPieceItem(QGraphicsItem *pParent) m_eMode(VPieceItem::mNormal), m_bReleased(false), m_ptRotCenter(), - m_moveType(Movable), + m_moveType(AllModifications), m_inactiveZ(1) { m_rectBoundingBox.setTopLeft(QPointF(0, 0)); diff --git a/src/libs/vwidgets/vpieceitem.h b/src/libs/vwidgets/vpieceitem.h index 32509f5f6..a1cb1c4bc 100644 --- a/src/libs/vwidgets/vpieceitem.h +++ b/src/libs/vwidgets/vpieceitem.h @@ -36,7 +36,7 @@ class VPieceItem : public QGraphicsObject { Q_OBJECT public: - enum MoveType {Movable, OnlyResizable, OnlyRotatable, NotMovable, Error}; + enum MoveType {AllModifications, OnlyResizable, OnlyRotatable, OnlyMovable, NotMovable, Error}; explicit VPieceItem(QGraphicsItem* pParent = nullptr); virtual ~VPieceItem(); From 04009746d502eedbe292656b7a1fcde15063f282 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 28 Feb 2017 17:33:53 +0200 Subject: [PATCH 46/52] Improve user expirience. Added grainline hover. --HG-- branch : feature --- src/libs/vwidgets/vgrainlineitem.cpp | 95 +++++++++++++++++----------- src/libs/vwidgets/vgrainlineitem.h | 5 ++ src/libs/vwidgets/vpieceitem.cpp | 2 +- 3 files changed, 63 insertions(+), 39 deletions(-) diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index 30e6f6acc..c0299ddb1 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -68,8 +68,10 @@ VGrainlineItem::VGrainlineItem(QGraphicsItem* pParent) m_ptFinish(), m_ptCenter(), m_dAngle(0), - m_eArrowType(ArrowType::atBoth) + m_eArrowType(ArrowType::atBoth), + m_penWidth(LINE_PEN_WIDTH) { + setAcceptHoverEvents(true); m_inactiveZ = 5; Reset(); UpdateRectangle(); @@ -85,49 +87,16 @@ VGrainlineItem::~VGrainlineItem() //--------------------------------------------------------------------------------------------------------------------- QPainterPath VGrainlineItem::shape() const { - QPainterPath path; - if (m_eMode == mNormal) { - QPointF pt1; - QPointF pt2(pt1.x() + m_dLength * cos(m_dRotation), pt1.y() - m_dLength * sin(m_dRotation)); - - const QLineF mainLine = MainLine(); - QPainterPath linePath; - linePath.moveTo(mainLine.p1()); - linePath.lineTo(mainLine.p2()); - linePath.closeSubpath(); - - QPainterPathStroker stroker; - stroker.setWidth(LINE_PEN_WIDTH); - path.addPath((stroker.createStroke(linePath) + linePath).simplified()); - path.closeSubpath(); - - const qreal dArrLen = ARROW_LENGTH*GetScale(); - if (m_eArrowType != ArrowType::atRear) - { - // first arrow - QPainterPath polyPath; - polyPath.addPolygon(FirstArrow(dArrLen)); - path.addPath((stroker.createStroke(polyPath) + polyPath).simplified()); - path.closeSubpath(); - } - - if (m_eArrowType != ArrowType::atFront) - { - // second arrow - QPainterPath polyPath; - polyPath.addPolygon(SecondArrow(dArrLen)); - path.addPath((stroker.createStroke(polyPath) + polyPath).simplified()); - path.closeSubpath(); - } + return MainShape(); } else { + QPainterPath path; path.addPolygon(m_polyBound); + return path; } - - return path; } //--------------------------------------------------------------------------------------------------------------------- @@ -143,7 +112,7 @@ void VGrainlineItem::paint(QPainter* pP, const QStyleOptionGraphicsItem* pOption Q_UNUSED(pWidget) pP->save(); QColor clr = Qt::black; - pP->setPen(QPen(clr, LINE_PEN_WIDTH, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + pP->setPen(QPen(clr, m_penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); pP->setRenderHints(QPainter::Antialiasing); // line @@ -489,6 +458,20 @@ void VGrainlineItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME) } } +//--------------------------------------------------------------------------------------------------------------------- +void VGrainlineItem::hoverEnterEvent(QGraphicsSceneHoverEvent *pME) +{ + m_penWidth = LINE_PEN_WIDTH + 1; + VPieceItem::hoverEnterEvent(pME); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VGrainlineItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *pME) +{ + m_penWidth = LINE_PEN_WIDTH; + VPieceItem::hoverLeaveEvent(pME); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief VGrainlineItem::UpdateBox updates the item @@ -652,3 +635,39 @@ QPolygonF VGrainlineItem::SecondArrow(qreal dArrLen) const pt2.y() - dArrLen*sin(M_PI + m_dRotation - ARROW_ANGLE)); return poly; } + +//--------------------------------------------------------------------------------------------------------------------- +QPainterPath VGrainlineItem::MainShape() const +{ + QPainterPath path; + const QLineF mainLine = MainLine(); + QPainterPath linePath; + linePath.moveTo(mainLine.p1()); + linePath.lineTo(mainLine.p2()); + linePath.closeSubpath(); + + QPainterPathStroker stroker; + stroker.setWidth(m_penWidth); + path.addPath((stroker.createStroke(linePath) + linePath).simplified()); + path.closeSubpath(); + + const qreal dArrLen = ARROW_LENGTH*GetScale(); + if (m_eArrowType != ArrowType::atRear) + { + // first arrow + QPainterPath polyPath; + polyPath.addPolygon(FirstArrow(dArrLen)); + path.addPath((stroker.createStroke(polyPath) + polyPath).simplified()); + path.closeSubpath(); + } + + if (m_eArrowType != ArrowType::atFront) + { + // second arrow + QPainterPath polyPath; + polyPath.addPolygon(SecondArrow(dArrLen)); + path.addPath((stroker.createStroke(polyPath) + polyPath).simplified()); + path.closeSubpath(); + } + return path; +} diff --git a/src/libs/vwidgets/vgrainlineitem.h b/src/libs/vwidgets/vgrainlineitem.h index cac4e1327..0c59896c9 100644 --- a/src/libs/vwidgets/vgrainlineitem.h +++ b/src/libs/vwidgets/vgrainlineitem.h @@ -54,6 +54,8 @@ protected: virtual void mousePressEvent(QGraphicsSceneMouseEvent* pME) Q_DECL_OVERRIDE; virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* pME) Q_DECL_OVERRIDE; virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* pME) Q_DECL_OVERRIDE; + virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* pME) Q_DECL_OVERRIDE; + virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* pME) Q_DECL_OVERRIDE; virtual void Update() Q_DECL_OVERRIDE; void UpdateRectangle(); @@ -76,12 +78,15 @@ private: QPointF m_ptCenter; qreal m_dAngle; ArrowType m_eArrowType; + int m_penWidth; qreal GetScale() const; QLineF MainLine() const; QPolygonF FirstArrow(qreal dArrLen) const; QPolygonF SecondArrow(qreal dArrLen) const; + + QPainterPath MainShape() const; }; #endif // VGRAINLINEITEM_H diff --git a/src/libs/vwidgets/vpieceitem.cpp b/src/libs/vwidgets/vpieceitem.cpp index 40ea08864..f11b87d77 100644 --- a/src/libs/vwidgets/vpieceitem.cpp +++ b/src/libs/vwidgets/vpieceitem.cpp @@ -117,5 +117,5 @@ VPieceItem::MoveType VPieceItem::GetMoveType() const void VPieceItem::SetMoveType(const MoveType &moveType) { m_moveType = moveType; + setAcceptHoverEvents(m_moveType != NotMovable); } - From e3fdad132139a9afff88a6b0eee536b6c0e7d699 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 1 Mar 2017 07:10:04 +0200 Subject: [PATCH 47/52] Update grainline after selecting each type. --HG-- branch : feature --- src/libs/vwidgets/vgrainlineitem.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index c0299ddb1..5efa644c9 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -299,11 +299,17 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME) m_eMode = mMove; SetOverrideCursor(cursorArrowCloseHand, 1, 1); } + + setZValue(ACTIVE_Z); + Update(); } else if (m_moveType == OnlyMovable) { m_eMode = mMove; SetOverrideCursor(cursorArrowCloseHand, 1, 1); + + setZValue(ACTIVE_Z); + Update(); } else { From 0a94c5036b347a5be84bca8f0cdcd35ad9ee011e Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 1 Mar 2017 07:38:43 +0200 Subject: [PATCH 48/52] Fix label rotation. --HG-- branch : feature --- src/libs/vwidgets/vgrainlineitem.cpp | 6 ++++++ src/libs/vwidgets/vgrainlineitem.h | 2 ++ src/libs/vwidgets/vpieceitem.cpp | 2 +- src/libs/vwidgets/vpieceitem.h | 4 ++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index 5efa644c9..ec76be497 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -541,6 +541,12 @@ void VGrainlineItem::UpdateRectangle() prepareGeometryChange(); } +//--------------------------------------------------------------------------------------------------------------------- +double VGrainlineItem::GetAngle(const QPointF &pt) const +{ + return -VPieceItem::GetAngle(pt); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief VGrainlineItem::Rotate rotates point pt around ptCenter by angle dAng [rad] diff --git a/src/libs/vwidgets/vgrainlineitem.h b/src/libs/vwidgets/vgrainlineitem.h index 0c59896c9..e0fd31fe2 100644 --- a/src/libs/vwidgets/vgrainlineitem.h +++ b/src/libs/vwidgets/vgrainlineitem.h @@ -59,6 +59,8 @@ protected: virtual void Update() Q_DECL_OVERRIDE; void UpdateRectangle(); + virtual double GetAngle(const QPointF &pt) const Q_DECL_OVERRIDE; + QPointF Rotate(const QPointF& pt, const QPointF& ptCenter, qreal dAng) const; QPointF GetInsideCorner(int i, qreal dDist) const; diff --git a/src/libs/vwidgets/vpieceitem.cpp b/src/libs/vwidgets/vpieceitem.cpp index f11b87d77..5117b8c8c 100644 --- a/src/libs/vwidgets/vpieceitem.cpp +++ b/src/libs/vwidgets/vpieceitem.cpp @@ -103,7 +103,7 @@ double VPieceItem::GetAngle(const QPointF &pt) const } else { - return -qAtan2(dY, dX); + return qAtan2(dY, dX); } } diff --git a/src/libs/vwidgets/vpieceitem.h b/src/libs/vwidgets/vpieceitem.h index a1cb1c4bc..b97a95fb3 100644 --- a/src/libs/vwidgets/vpieceitem.h +++ b/src/libs/vwidgets/vpieceitem.h @@ -48,8 +48,6 @@ public: void Reset(); bool IsIdle() const; - double GetAngle(const QPointF &pt) const; - MoveType GetMoveType() const; void SetMoveType(const MoveType &moveType); @@ -72,6 +70,8 @@ protected: qreal m_inactiveZ; + virtual double GetAngle(const QPointF &pt) const; + private: Q_DISABLE_COPY(VPieceItem) }; From 247dc910d5782dc252f918d3c3fbc4c0c673f3b7 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 1 Mar 2017 07:39:13 +0200 Subject: [PATCH 49/52] Block actions with label depend on restrictions. --HG-- branch : feature --- src/libs/vwidgets/vgrainlineitem.cpp | 6 +++- src/libs/vwidgets/vtextgraphicsitem.cpp | 48 ++++++++++++++++++------- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/src/libs/vwidgets/vgrainlineitem.cpp b/src/libs/vwidgets/vgrainlineitem.cpp index ec76be497..124093cd3 100644 --- a/src/libs/vwidgets/vgrainlineitem.cpp +++ b/src/libs/vwidgets/vgrainlineitem.cpp @@ -299,6 +299,10 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME) m_eMode = mMove; SetOverrideCursor(cursorArrowCloseHand, 1, 1); } + else + { + SetOverrideCursor(cursorArrowCloseHand, 1, 1); + } setZValue(ACTIVE_Z); Update(); @@ -311,7 +315,7 @@ void VGrainlineItem::mousePressEvent(QGraphicsSceneMouseEvent* pME) setZValue(ACTIVE_Z); Update(); } - else + else // All modifications { if (m_eMode != mRotate) { diff --git a/src/libs/vwidgets/vtextgraphicsitem.cpp b/src/libs/vwidgets/vtextgraphicsitem.cpp index 463b7506f..150562ddf 100644 --- a/src/libs/vwidgets/vtextgraphicsitem.cpp +++ b/src/libs/vwidgets/vtextgraphicsitem.cpp @@ -413,28 +413,47 @@ void VTextGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *pME) m_dRotation = rotation(); // in rotation mode, do not do any changes here, because user might want to // rotate the label more. - if (m_eMode != mRotate) + + if (m_moveType == OnlyRotatable) { - // if user pressed the button inside the resize square, switch to resize mode - if (m_rectResize.contains(pME->pos()) == true) + if (m_eMode != mRotate) { - m_eMode = mResize; - SetOverrideCursor(Qt::SizeFDiagCursor); + m_eMode = mRotate; + SetOverrideCursor(cursorArrowCloseHand, 1, 1); } else { - // if user pressed the button outside the resize square, switch to move mode - m_eMode = mMove; SetOverrideCursor(cursorArrowCloseHand, 1, 1); } + + setZValue(ACTIVE_Z); + Update(); } - else + else // All modifications { - SetOverrideCursor(cursorArrowCloseHand, 1, 1); + if (m_eMode != mRotate) + { + // if user pressed the button inside the resize square, switch to resize mode + if (m_rectResize.contains(pME->pos()) == true) + { + m_eMode = mResize; + SetOverrideCursor(Qt::SizeFDiagCursor); + } + else + { + // if user pressed the button outside the resize square, switch to move mode + m_eMode = mMove; + SetOverrideCursor(cursorArrowCloseHand, 1, 1); + } + } + else + { + SetOverrideCursor(cursorArrowCloseHand, 1, 1); + } + // raise the label and redraw it + setZValue(ACTIVE_Z); + UpdateBox(); } - // raise the label and redraw it - setZValue(ACTIVE_Z); - UpdateBox(); } } @@ -553,7 +572,10 @@ void VTextGraphicsItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* pME) { // in rotate mode, if user did just press/release, switch to move mode if (bShort == true) { - m_eMode = mMove; + if (m_moveType != OnlyRotatable) + { + m_eMode = mMove; + } UpdateBox(); } else From 98f26cd417c6daa68040b7cb80557ebad4cfb5e2 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 1 Mar 2017 07:43:51 +0200 Subject: [PATCH 50/52] Show pins if user activated Pattern Piece Data tab or Grainline tab. --HG-- branch : feature --- src/libs/vtools/dialogs/tools/dialogseamallowance.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp index 194e23d53..df1e38ac3 100644 --- a/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp +++ b/src/libs/vtools/dialogs/tools/dialogseamallowance.cpp @@ -917,7 +917,9 @@ void DialogSeamAllowance::PathDialogClosed(int result) //--------------------------------------------------------------------------------------------------------------------- void DialogSeamAllowance::TabChanged(int index) { - if (ui->tabWidget->indexOf(ui->tabPins) == index) + if (index == ui->tabWidget->indexOf(ui->tabPins) + || index == ui->tabWidget->indexOf(ui->tabGrainline) + || index == ui->tabWidget->indexOf(ui->tabPatternPieceData)) { if (m_visPins.isNull()) { From e91d037e0a3bafa168a67ec55a942c8c7659cc72 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Wed, 1 Mar 2017 11:13:36 +0200 Subject: [PATCH 51/52] Use pins to position grainline and label on layout. --HG-- branch : feature --- src/libs/vlayout/vlayoutpiece.cpp | 202 +++++++++++++++++++++--------- src/libs/vlayout/vlayoutpiece.h | 6 +- 2 files changed, 149 insertions(+), 59 deletions(-) diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index 98c875149..df7d96b77 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -48,6 +48,7 @@ #include "../vmisc/vmath.h" #include "../vmisc/vabstractapplication.h" #include "../vpatterndb/calculator.h" +#include "../vgeometry/vpointf.h" #include "vlayoutdef.h" #include "vlayoutpiece_p.h" #include "vtextmanager.h" @@ -55,8 +56,11 @@ namespace { +//--------------------------------------------------------------------------------------------------------------------- QVector ConvertInternalPaths(const VPiece &piece, const VContainer *pattern) { + SCASSERT(pattern != nullptr) + QVector paths; const QVector pathsId = piece.GetInternalPaths(); for (int i = 0; i < pathsId.size(); ++i) @@ -69,6 +73,97 @@ QVector ConvertInternalPaths(const VPiece &piece, const VConta } return paths; } + +//--------------------------------------------------------------------------------------------------------------------- +void FindLabelGeometry(const VPatternLabelData &labelData, const VContainer *pattern, qreal &labelWidth, + qreal &labelHeight, QPointF &pos) +{ + SCASSERT(pattern != nullptr) + + const quint32 topLeftPin = labelData.TopLeftPin(); + const quint32 bottomRightPin = labelData.BottomRightPin(); + + if (topLeftPin != NULL_ID && bottomRightPin != NULL_ID) + { + try + { + const auto topLeftPinPoint = pattern->GeometricObject(topLeftPin); + const auto bottomRightPinPoint = pattern->GeometricObject(bottomRightPin); + + const QRectF labelRect = QRectF(*topLeftPinPoint, *bottomRightPinPoint); + labelWidth = qAbs(labelRect.width()); + labelHeight = qAbs(labelRect.height()); + + pos = labelRect.topLeft(); + + return; + } + catch(const VExceptionBadId &) + { + // do nothing. + } + } + + labelWidth = labelData.GetLabelWidth(); + labelHeight = labelData.GetLabelHeight(); + pos = labelData.GetPos(); +} + +//--------------------------------------------------------------------------------------------------------------------- +bool FindGrainlineGeometry(const VGrainlineData& geom, const VContainer *pattern, qreal &length, qreal &rotationAngle, + QPointF &pos) +{ + SCASSERT(pattern != nullptr) + + const quint32 topPin = geom.TopPin(); + const quint32 bottomPin = geom.BottomPin(); + + if (topPin != NULL_ID && bottomPin != NULL_ID) + { + try + { + const auto topPinPoint = pattern->GeometricObject(topPin); + const auto bottomPinPoint = pattern->GeometricObject(bottomPin); + + QLineF grainline(*bottomPinPoint, *topPinPoint); + length = grainline.length(); + rotationAngle = grainline.angle(); + + if (not VFuzzyComparePossibleNulls(rotationAngle, 0)) + { + grainline.setAngle(0); + } + + pos = grainline.p1(); + rotationAngle = qDegreesToRadians(rotationAngle); + + return true; + } + catch(const VExceptionBadId &) + { + // do nothing. + } + } + + try + { + Calculator cal1; + rotationAngle = cal1.EvalFormula(pattern->PlainVariables(), geom.GetRotation()); + rotationAngle = qDegreesToRadians(rotationAngle); + + Calculator cal2; + length = cal2.EvalFormula(pattern->PlainVariables(), geom.GetLength()); + length = ToPixel(length, *pattern->GetPatternUnit()); + } + catch(qmu::QmuParserError &e) + { + Q_UNUSED(e); + return false; + } + + pos = geom.GetPos(); + return true; +} } //--------------------------------------------------------------------------------------------------------------------- @@ -109,18 +204,18 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern const VPieceLabelData& data = piece.GetPatternPieceData(); if (data.IsVisible() == true) { - det.SetDetail(piece.GetName(), data, qApp->font()); + det.SetDetail(piece.GetName(), data, qApp->font(), pattern); } const VPatternLabelData& geom = piece.GetPatternInfo(); if (geom.IsVisible() == true) { VAbstractPattern* pDoc = qApp->getCurrentDocument(); - det.SetPatternInfo(pDoc, geom, qApp->font(), pattern->size(), pattern->height()); + det.SetPatternInfo(pDoc, geom, qApp->font(), pattern->size(), pattern->height(), pattern); } const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry(); if (grainlineGeom.IsVisible() == true) { - det.SetGrainline(grainlineGeom, *pattern); + det.SetGrainline(grainlineGeom, pattern); } det.SetSAWidth(qApp->toPixel(piece.GetSAWidth())); det.CreateTextItems(); @@ -175,16 +270,24 @@ QVector VLayoutPiece::GetLayoutAllowancePoints() const } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::SetDetail(const QString& qsName, const VPieceLabelData& data, const QFont &font) +void VLayoutPiece::SetDetail(const QString& qsName, const VPieceLabelData& data, const QFont &font, + const VContainer *pattern) { d->detailData = data; - qreal dAng = qDegreesToRadians(data.GetRotation()); - QPointF ptCenter(data.GetPos().x() + data.GetLabelWidth()/2, data.GetPos().y() + data.GetLabelHeight()/2); - QPointF ptPos = data.GetPos(); + + QPointF ptPos; + qreal labelWidth = 0; + qreal labelHeight = 0; + FindLabelGeometry(data, pattern, labelWidth, labelHeight, ptPos); + QVector v; - v << ptPos << QPointF(ptPos.x() + data.GetLabelWidth(), ptPos.y()) - << QPointF(ptPos.x() + data.GetLabelWidth(), ptPos.y() + data.GetLabelHeight()) - << QPointF(ptPos.x(), ptPos.y() + data.GetLabelHeight()); + v << ptPos + << QPointF(ptPos.x() + labelWidth, ptPos.y()) + << QPointF(ptPos.x() + labelWidth, ptPos.y() + labelHeight) + << QPointF(ptPos.x(), ptPos.y() + labelHeight); + + const qreal dAng = qDegreesToRadians(data.GetRotation()); + const QPointF ptCenter(ptPos.x() + labelWidth/2, ptPos.y() + labelHeight/2); for (int i = 0; i < v.count(); ++i) { v[i] = RotatePoint(ptCenter, v.at(i), dAng); @@ -197,21 +300,28 @@ void VLayoutPiece::SetDetail(const QString& qsName, const VPieceLabelData& data, d->m_tmDetail.Update(qsName, data); // this will generate the lines of text d->m_tmDetail.SetFontSize(data.GetFontSize()); - d->m_tmDetail.FitFontSize(data.GetLabelWidth(), data.GetLabelHeight()); + d->m_tmDetail.FitFontSize(labelWidth, labelHeight); } //--------------------------------------------------------------------------------------------------------------------- void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont &font, - qreal dSize, qreal dHeight) + qreal dSize, qreal dHeight, const VContainer *pattern) { d->patternGeom = geom; - qreal dAng = qDegreesToRadians(geom.GetRotation()); - QPointF ptCenter(geom.GetPos().x() + geom.GetLabelWidth()/2, geom.GetPos().y() + geom.GetLabelHeight()/2); - QPointF ptPos = geom.GetPos(); + + QPointF ptPos; + qreal labelWidth = 0; + qreal labelHeight = 0; + FindLabelGeometry(geom, pattern, labelWidth, labelHeight, ptPos); + QVector v; - v << ptPos << QPointF(ptPos.x() + geom.GetLabelWidth(), ptPos.y()) - << QPointF(ptPos.x() + geom.GetLabelWidth(), ptPos.y() + geom.GetLabelHeight()) - << QPointF(ptPos.x(), ptPos.y() + geom.GetLabelHeight()); + v << ptPos + << QPointF(ptPos.x() + labelWidth, ptPos.y()) + << QPointF(ptPos.x() + labelWidth, ptPos.y() + labelHeight) + << QPointF(ptPos.x(), ptPos.y() + labelHeight); + + const qreal dAng = qDegreesToRadians(geom.GetRotation()); + const QPointF ptCenter(ptPos.x() + labelWidth/2, ptPos.y() + labelHeight/2); for (int i = 0; i < v.count(); ++i) { v[i] = RotatePoint(ptCenter, v.at(i), dAng); @@ -226,51 +336,36 @@ void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLa // generate lines of text d->m_tmPattern.SetFontSize(geom.GetFontSize()); - d->m_tmPattern.FitFontSize(geom.GetLabelWidth(), geom.GetLabelHeight()); + d->m_tmPattern.FitFontSize(labelWidth, labelHeight); } //--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer& rPattern) +void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer* pattern) { + SCASSERT(pattern != nullptr) + d->grainlineGeom = geom; - qreal dAng; - qreal dLen; - try + QPointF pt1; + qreal dAng = 0; + qreal dLen = 0; + if ( not FindGrainlineGeometry(geom, pattern, dLen, dAng, pt1)) { - Calculator cal1; - dAng = cal1.EvalFormula(rPattern.PlainVariables(), geom.GetRotation()); - dAng = qDegreesToRadians(dAng); - - Calculator cal2; - dLen = cal2.EvalFormula(rPattern.PlainVariables(), geom.GetLength()); - dLen = ToPixel(dLen, *rPattern.GetPatternUnit()); - } - catch(qmu::QmuParserError &e) - { - Q_UNUSED(e); return; } - QPointF pt1 = geom.GetPos(); - QPointF pt2; - pt2.setX(pt1.x() + dLen * qCos(dAng)); - pt2.setY(pt1.y() - dLen * qSin(dAng)); + QPointF pt2(pt1.x() + dLen * qCos(dAng), pt1.y() - dLen * qSin(dAng)); QVector v; - QPointF pt; - qreal dArrowLen = ToPixel(0.5, *rPattern.GetPatternUnit()); - qreal dArrowAng = M_PI/9; + + const qreal dArrowLen = ToPixel(0.5, *pattern->GetPatternUnit()); + const qreal dArrowAng = M_PI/9; v << pt1; - if (geom.GetArrowType() != ArrowType::atRear) { - pt.setX(pt1.x() + dArrowLen * qCos(dAng + dArrowAng)); - pt.setY(pt1.y() - dArrowLen * qSin(dAng + dArrowAng)); - v << pt; - pt.setX(pt1.x() + dArrowLen * qCos(dAng - dArrowAng)); - pt.setY(pt1.y() - dArrowLen * qSin(dAng - dArrowAng)); - v << pt; - + if (geom.GetArrowType() != ArrowType::atRear) + { + v << QPointF(pt1.x() + dArrowLen * qCos(dAng + dArrowAng), pt1.y() - dArrowLen * qSin(dAng + dArrowAng)); + v << QPointF(pt1.x() + dArrowLen * qCos(dAng - dArrowAng), pt1.y() - dArrowLen * qSin(dAng - dArrowAng)); v << pt1; } @@ -280,13 +375,8 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer& rP { dAng += M_PI; - pt.setX(pt2.x() + dArrowLen * qCos(dAng + dArrowAng)); - pt.setY(pt2.y() - dArrowLen * qSin(dAng + dArrowAng)); - v << pt; - pt.setX(pt2.x() + dArrowLen * qCos(dAng - dArrowAng)); - pt.setY(pt2.y() - dArrowLen * qSin(dAng - dArrowAng)); - v << pt; - + v << QPointF(pt2.x() + dArrowLen * qCos(dAng + dArrowAng), pt2.y() - dArrowLen * qSin(dAng + dArrowAng)); + v << QPointF(pt2.x() + dArrowLen * qCos(dAng - dArrowAng), pt2.y() - dArrowLen * qSin(dAng - dArrowAng)); v << pt2; } diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index 33299d450..6b20128c7 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -73,12 +73,12 @@ public: QVector GetInternalPaths() const; void SetInternalPaths(const QVector &internalPaths); - void SetDetail(const QString &qsName, const VPieceLabelData& data, const QFont& font); + void SetDetail(const QString &qsName, const VPieceLabelData& data, const QFont& font, const VContainer *pattern); void SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont& font, - qreal dSize, qreal dHeight); + qreal dSize, qreal dHeight, const VContainer *pattern); - void SetGrainline(const VGrainlineData& geom, const VContainer& rPattern); + void SetGrainline(const VGrainlineData& geom, const VContainer *pattern); QTransform GetMatrix() const; void SetMatrix(const QTransform &matrix); From 71d10dbdcb20ab27bd15482d949fbb65069a01dc Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 2 Mar 2017 09:12:48 +0200 Subject: [PATCH 52/52] Sync grainline and lable position after correcting to parent bounding rect. --HG-- branch : feature --- src/app/valentina/mainwindow.cpp | 14 +- src/libs/ifc/exception/vexception.cpp | 2 +- src/libs/vlayout/vlayoutpiece.cpp | 473 +++++++++++--------------- src/libs/vlayout/vlayoutpiece.h | 18 +- src/libs/vlayout/vlayoutpiece_p.h | 24 +- 5 files changed, 236 insertions(+), 295 deletions(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 27a3d90b6..0599d808b 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -2352,7 +2352,19 @@ void MainWindow::ActionLayout(bool checked) SaveCurrentScene(); - PrepareDetailsForLayout(&details); + try + { + PrepareDetailsForLayout(&details); + } + catch (VException &e) + { + listDetails.clear(); + QMessageBox::warning(this, tr("Layout mode"), + tr("You can't use now the Layout mode. \n%1").arg(e.ErrorMessage()), + QMessageBox::Ok, QMessageBox::Ok); + mode == Draw::Calculation ? ActionDraw(true) : ActionDetails(true); + return; + } currentScene = tempSceneLayout; ui->view->itemClicked(nullptr); diff --git a/src/libs/ifc/exception/vexception.cpp b/src/libs/ifc/exception/vexception.cpp index 019b88f4f..dceacbbe7 100644 --- a/src/libs/ifc/exception/vexception.cpp +++ b/src/libs/ifc/exception/vexception.cpp @@ -73,7 +73,7 @@ VException &VException::operator=(const VException &e) */ QString VException::ErrorMessage() const { - return QString("Exception: %1").arg(error); + return tr("Exception: %1").arg(error); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vlayout/vlayoutpiece.cpp b/src/libs/vlayout/vlayoutpiece.cpp index df7d96b77..f99f17011 100644 --- a/src/libs/vlayout/vlayoutpiece.cpp +++ b/src/libs/vlayout/vlayoutpiece.cpp @@ -164,6 +164,109 @@ bool FindGrainlineGeometry(const VGrainlineData& geom, const VContainer *pattern pos = geom.GetPos(); return true; } + +//--------------------------------------------------------------------------------------------------------------------- +bool IsItemContained(const QRectF &parentBoundingRect, const QVector &shape, qreal &dX, qreal &dY) +{ + dX = 0; + dY = 0; + // single point differences + bool bInside = true; + + for (int i = 0; i < shape.size(); ++i) + { + qreal dPtX = 0; + qreal dPtY = 0; + if (not parentBoundingRect.contains(shape.at(i))) + { + if (shape.at(i).x() < parentBoundingRect.left()) + { + dPtX = parentBoundingRect.left() - shape.at(i).x(); + } + else if (shape.at(i).x() > parentBoundingRect.right()) + { + dPtX = parentBoundingRect.right() - shape.at(i).x(); + } + + if (shape.at(i).y() < parentBoundingRect.top()) + { + dPtY = parentBoundingRect.top() - shape.at(i).y(); + } + else if (shape.at(i).y() > parentBoundingRect.bottom()) + { + dPtY = parentBoundingRect.bottom() - shape.at(i).y(); + } + + if (fabs(dPtX) > fabs(dX)) + { + dX = dPtX; + } + + if (fabs(dPtY) > fabs(dY)) + { + dY = dPtY; + } + + bInside = false; + } + } + return bInside; +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector CorrectPosition(const QRectF &parentBoundingRect, QVector points) +{ + qreal dX = 0; + qreal dY = 0; + if (not IsItemContained(parentBoundingRect, points, dX, dY)) + { + for (int i =0; i < points.size(); ++i) + { + points[i] = QPointF(points.at(i).x() + dX, points.at(i).y() + dY); + } + } + return points; +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector RoundPoints(const QVector &points) +{ + QVector p; + for (int i=0; i < points.size(); ++i) + { + p.append(QPointF(qRound(points.at(i).x()), qRound(points.at(i).y()))); + } + return p; +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector PrepareAllowance(const QVector &points) +{ + QVector allowancePoints; + for(int i = 0; i < points.size(); ++i) + { + allowancePoints.append(VSAPoint(points.at(i))); + } + return allowancePoints; +} + +//--------------------------------------------------------------------------------------------------------------------- +/** + * @brief VLayoutDetail::RotatePoint rotates a point around the center for given angle + * @param ptCenter center around which the point is rotated + * @param pt point, which is rotated around the center + * @param dAng angle of rotation + * @return position of point pt after rotating it around the center for dAng radians + */ +QPointF RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng) +{ + QPointF ptDest; + QPointF ptRel = pt - ptCenter; + ptDest.setX(cos(dAng)*ptRel.x() - sin(dAng)*ptRel.y()); + ptDest.setY(sin(dAng)*ptRel.x() + cos(dAng)*ptRel.y()); + + return ptDest + ptCenter; +} } //--------------------------------------------------------------------------------------------------------------------- @@ -201,24 +304,33 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, const VContainer *pattern det.SetInternalPaths(ConvertInternalPaths(piece, pattern)); det.SetName(piece.GetName()); + + // Very important to set main path first! + if (det.ContourPath().isEmpty()) + { + throw VException (tr("Piece %1 doesn't have shape.").arg(piece.GetName())); + } + const VPieceLabelData& data = piece.GetPatternPieceData(); if (data.IsVisible() == true) { det.SetDetail(piece.GetName(), data, qApp->font(), pattern); } + const VPatternLabelData& geom = piece.GetPatternInfo(); if (geom.IsVisible() == true) { VAbstractPattern* pDoc = qApp->getCurrentDocument(); det.SetPatternInfo(pDoc, geom, qApp->font(), pattern->size(), pattern->height(), pattern); } + const VGrainlineData& grainlineGeom = piece.GetGrainlineGeometry(); if (grainlineGeom.IsVisible() == true) { det.SetGrainline(grainlineGeom, pattern); } + det.SetSAWidth(qApp->toPixel(piece.GetSAWidth())); - det.CreateTextItems(); det.SetForbidFlipping(piece.IsForbidFlipping()); return det; @@ -273,8 +385,6 @@ QVector VLayoutPiece::GetLayoutAllowancePoints() const void VLayoutPiece::SetDetail(const QString& qsName, const VPieceLabelData& data, const QFont &font, const VContainer *pattern) { - d->detailData = data; - QPointF ptPos; qreal labelWidth = 0; qreal labelHeight = 0; @@ -292,7 +402,9 @@ void VLayoutPiece::SetDetail(const QString& qsName, const VPieceLabelData& data, { v[i] = RotatePoint(ptCenter, v.at(i), dAng); } - d->detailLabel = RoundPoints(v); + + QScopedPointer item(GetMainItem()); + d->detailLabel = CorrectPosition(item->boundingRect(), RoundPoints(v)); // generate text d->m_tmDetail.SetFont(font); @@ -307,8 +419,6 @@ void VLayoutPiece::SetDetail(const QString& qsName, const VPieceLabelData& data, void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLabelData& geom, const QFont &font, qreal dSize, qreal dHeight, const VContainer *pattern) { - d->patternGeom = geom; - QPointF ptPos; qreal labelWidth = 0; qreal labelHeight = 0; @@ -326,7 +436,8 @@ void VLayoutPiece::SetPatternInfo(const VAbstractPattern* pDoc, const VPatternLa { v[i] = RotatePoint(ptCenter, v.at(i), dAng); } - d->patternInfo = RoundPoints(v); + QScopedPointer item(GetMainItem()); + d->patternInfo = CorrectPosition(item->boundingRect(), RoundPoints(v)); // Generate text d->m_tmPattern.SetFont(font); @@ -344,8 +455,6 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer* pa { SCASSERT(pattern != nullptr) - d->grainlineGeom = geom; - QPointF pt1; qreal dAng = 0; qreal dLen = 0; @@ -380,7 +489,8 @@ void VLayoutPiece::SetGrainline(const VGrainlineData& geom, const VContainer* pa v << pt2; } - d->grainlinePoints = RoundPoints(v); + QScopedPointer item(GetMainItem()); + d->grainlinePoints = CorrectPosition(item->boundingRect(), RoundPoints(v)); } //--------------------------------------------------------------------------------------------------------------------- @@ -629,17 +739,6 @@ QVector VLayoutPiece::Map(const QVector &points) const return p; } -//--------------------------------------------------------------------------------------------------------------------- -QVector VLayoutPiece::RoundPoints(const QVector &points) -{ - QVector p; - for (int i=0; i < points.size(); ++i) - { - p.append(QPointF(qRound(points.at(i).x()), qRound(points.at(i).y()))); - } - return p; -} - //--------------------------------------------------------------------------------------------------------------------- QPainterPath VLayoutPiece::ContourPath() const { @@ -678,133 +777,6 @@ QPainterPath VLayoutPiece::ContourPath() const return path; } -//--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::ClearTextItems() -{ - d->m_liPP.clear(); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VLayoutPiece::CreateTextItems() -{ - ClearTextItems(); - // first add detail texts - if (d->detailLabel.count() > 0) - { - // get the mapped label vertices - QVector points = Map(Mirror(d->detailLabel)); - // append the first point to obtain the closed rectangle - points.push_back(points.at(0)); - // calculate the angle of rotation - qreal dAng = qAtan2(points.at(1).y() - points.at(0).y(), points.at(1).x() - points.at(0).x()); - // calculate the label width and height - qreal dW = GetDistance(points.at(0), points.at(1)); - qreal dH = GetDistance(points.at(1), points.at(2)); - qreal dY = 0; - qreal dX; - // set up the rotation around top-left corner matrix - QMatrix mat; - mat.translate(points.at(0).x(), points.at(0).y()); - mat.rotate(qRadiansToDegrees(dAng)); - - for (int i = 0; i < d->m_tmDetail.GetSourceLinesCount(); ++i) - { - const TextLine& tl = d->m_tmDetail.GetSourceLine(i); - QFont fnt = d->m_tmDetail.GetFont(); - fnt.setPixelSize(d->m_tmDetail.GetFont().pixelSize() + tl.m_iFontSize); - fnt.setWeight(tl.m_eFontWeight); - fnt.setStyle(tl.m_eStyle); - - QFontMetrics fm(fnt); - - dY += fm.height(); - // check if the next line will go out of bounds - if (dY > dH) - { - break; - } - - QString qsText = tl.m_qsText; - if (fm.width(qsText) > dW) - { - qsText = fm.elidedText(qsText, Qt::ElideMiddle, static_cast(dW)); - } - // find the correct horizontal offset, depending on the alignment flag - if ((tl.m_eAlign & Qt::AlignLeft) > 0) - { - dX = 0; - } - else if ((tl.m_eAlign & Qt::AlignHCenter) > 0) - { - dX = (dW - fm.width(qsText))/2; - } - else - { - dX = dW - fm.width(qsText); - } - // create text path and add it to the list - QPainterPath path; - path.addText(dX, dY - (fm.height() - fm.ascent())/2, fnt, qsText); - d->m_liPP << mat.map(path); - dY += d->m_tmDetail.GetSpacing(); - } - } - // and then add pattern texts - if (d->patternInfo.count() > 0) - { - // similar approach like for the detail label - QVector points = Map(Mirror(d->patternInfo)); - points.push_back(points.at(0)); - qreal dAng = qAtan2(points.at(1).y() - points.at(0).y(), points.at(1).x() - points.at(0).x()); - qreal dW = GetDistance(points.at(0), points.at(1)); - qreal dH = GetDistance(points.at(1), points.at(2)); - qreal dY = 0; - qreal dX; - QMatrix mat; - mat.translate(points.at(0).x(), points.at(0).y()); - mat.rotate(qRadiansToDegrees(dAng)); - - for (int i = 0; i < d->m_tmPattern.GetSourceLinesCount(); ++i) - { - const TextLine& tl = d->m_tmPattern.GetSourceLine(i); - QFont fnt = d->m_tmPattern.GetFont(); - fnt.setPixelSize(d->m_tmPattern.GetFont().pixelSize() + tl.m_iFontSize); - fnt.setWeight(tl.m_eFontWeight); - fnt.setStyle(tl.m_eStyle); - - QFontMetrics fm(fnt); - - dY += fm.height(); - if (dY > dH) - { - break; - } - - QString qsText = tl.m_qsText; - if (fm.width(qsText) > dW) - { - qsText = fm.elidedText(qsText, Qt::ElideMiddle, static_cast(dW)); - } - if ((tl.m_eAlign & Qt::AlignLeft) > 0) - { - dX = 0; - } - else if ((tl.m_eAlign & Qt::AlignHCenter) > 0) - { - dX = (dW - fm.width(qsText))/2; - } - else - { - dX = dW - fm.width(qsText); - } - QPainterPath path; - path.addText(dX, dY - (fm.height() - fm.ascent())/2, fnt, qsText); - d->m_liPP << mat.map(path); - dY += d->m_tmPattern.GetSpacing(); - } - } -} - //--------------------------------------------------------------------------------------------------------------------- void VLayoutPiece::CreateInternalPathItem(int i, QGraphicsItem *parent) const { @@ -818,52 +790,16 @@ void VLayoutPiece::CreateInternalPathItem(int i, QGraphicsItem *parent) const } //--------------------------------------------------------------------------------------------------------------------- -/** - * @brief CreateTextItem Creates the i-th text item - * @param i index of the requested item - * @param parent parent of this text item. Can't be null. - */ -void VLayoutPiece::CreateTextItem(int i, QGraphicsItem *parent) const +void VLayoutPiece::CreateLabel(QGraphicsItem *parent, const QPainterPath &path) const { SCASSERT(parent != nullptr) - QGraphicsPathItem* item = new QGraphicsPathItem(parent); - QPainterPath path = d->matrix.map(d->m_liPP.at(i)); - - if (d->mirror == true) + if (not path.isEmpty()) { - QVector points; - if (i < d->m_tmDetail.GetSourceLinesCount()) - { - points = Map(Mirror(d->detailLabel)); - } - else - { - points = Map(Mirror(d->patternInfo)); - } - QPointF ptCenter = (points.at(1) + points.at(3))/2; - qreal dRot = qRadiansToDegrees(qAtan2(points.at(1).y() - points.at(0).y(), - points.at(1).x() - points.at(0).x())); - - // we need to move the center back to the origin, rotate it to align it with x axis, - // then mirror it to obtain the proper text direction, rotate it and translate it back to original position. - // The operations must be added in reverse order - QTransform t; - // move the label back to its original position - t.translate(ptCenter.x(), ptCenter.y()); - // rotate the label back to original angle - t.rotate(dRot); - // mirror the label horizontally - t.scale(-1, 1); - // rotate the label to normal position - t.rotate(-dRot); - // move the label center into origin - t.translate(-ptCenter.x(), -ptCenter.y()); - path = t.map(path); + QGraphicsPathItem* item = new QGraphicsPathItem(parent); + item->setPath(path); + item->setBrush(QBrush(Qt::black)); } - - item->setPath(path); - item->setBrush(QBrush(Qt::black)); } //--------------------------------------------------------------------------------------------------------------------- @@ -886,19 +822,15 @@ QPainterPath VLayoutPiece::LayoutAllowancePath() const //--------------------------------------------------------------------------------------------------------------------- QGraphicsItem *VLayoutPiece::GetItem() const { - QGraphicsPathItem *item = new QGraphicsPathItem(); - item->setPath(ContourPath()); + QGraphicsPathItem *item = GetMainItem(); for (int i = 0; i < d->m_internalPaths.count(); ++i) { CreateInternalPathItem(i, item); } - for (int i = 0; i < d->m_liPP.count(); ++i) - { - CreateTextItem(i, item); - } - + CreateLabel(item, CreateLabelText(d->detailLabel, d->m_tmDetail)); + CreateLabel(item, CreateLabelText(d->patternInfo, d->m_tmPattern)); CreateGrainlineItem(item); return item; @@ -914,12 +846,13 @@ void VLayoutPiece::CreateGrainlineItem(QGraphicsItem *parent) const return; } VGraphicsFillItem* item = new VGraphicsFillItem(parent); + QPainterPath path; - QVector v = Map(d->grainlinePoints); - path.moveTo(v.at(0)); - for (int i = 1; i < v.count(); ++i) + QVector gPoints = Map(d->grainlinePoints); + path.moveTo(gPoints.at(0)); + for (int i = 1; i < gPoints.count(); ++i) { - path.lineTo(v.at(i)); + path.lineTo(gPoints.at(i)); } item->setPath(path); } @@ -938,14 +871,11 @@ QVector VLayoutPiece::DetailPath() const } //--------------------------------------------------------------------------------------------------------------------- -QVector VLayoutPiece::PrepareAllowance(const QVector &points) +QGraphicsPathItem *VLayoutPiece::GetMainItem() const { - QVector allowancePoints; - for(int i = 0; i < points.size(); ++i) - { - allowancePoints.append(VSAPoint(points.at(i))); - } - return allowancePoints; + QGraphicsPathItem *item = new QGraphicsPathItem(); + item->setPath(ContourPath()); + return item; } //--------------------------------------------------------------------------------------------------------------------- @@ -960,64 +890,6 @@ void VLayoutPiece::SetMirror(bool value) d->mirror = value; } -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief VLayoutDetail::RotatePoint rotates a point around the center for given angle - * @param ptCenter center around which the point is rotated - * @param pt point, which is rotated around the center - * @param dAng angle of rotation - * @return position of point pt after rotating it around the center for dAng radians - */ -QPointF VLayoutPiece::RotatePoint(const QPointF &ptCenter, const QPointF& pt, qreal dAng) -{ - QPointF ptDest; - QPointF ptRel = pt - ptCenter; - ptDest.setX(cos(dAng)*ptRel.x() - sin(dAng)*ptRel.y()); - ptDest.setY(sin(dAng)*ptRel.x() + cos(dAng)*ptRel.y()); - - return ptDest + ptCenter; -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief VLayoutDetail::Mirror if the detail layout is rotated, this method will flip the - * label points over vertical axis, which goes through the center of the label - * @param points list of 4 label vertices - * @return list of flipped points - */ -QVector VLayoutPiece::Mirror(const QVector &points) const -{ - // should only call this method with rectangular shapes - Q_ASSERT(points.count() == 4); - if (d->mirror == false) - { - return points; - } - - QVector v; - v.resize(4); - v[0] = points.at(2); - v[1] = points.at(3); - v[2] = points.at(0); - v[3] = points.at(1); - return v; -} - -//--------------------------------------------------------------------------------------------------------------------- -/** - * @brief VLayoutDetail::GetDistance calculates the Euclidian distance between the points - * @param pt1 first point - * @param pt2 second point - * @return Euclidian distance between the two points - */ -qreal VLayoutPiece::GetDistance(const QPointF &pt1, const QPointF &pt2) -{ - const qreal dX = pt1.x() - pt2.x(); - const qreal dY = pt1.y() - pt2.y(); - - return qSqrt(dX*dX + dY*dY); -} - //--------------------------------------------------------------------------------------------------------------------- QLineF VLayoutPiece::Edge(const QVector &path, int i) const { @@ -1075,3 +947,74 @@ int VLayoutPiece::EdgeByPoint(const QVector &path, const QPointF &p1) c } return 0; // Did not find edge } + +//--------------------------------------------------------------------------------------------------------------------- +QPainterPath VLayoutPiece::CreateLabelText(const QVector &labelShape, const VTextManager &tm) const +{ + QPainterPath textpath; + if (labelShape.count() > 2) + { + const qreal dW = QLineF(labelShape.at(0), labelShape.at(1)).length(); + const qreal dH = QLineF(labelShape.at(1), labelShape.at(2)).length(); + const qreal angle = QLineF(labelShape.at(0), labelShape.at(1)).angle(); + qreal dY = 0; + qreal dX; + + // set up the rotation around top-left corner matrix + QTransform mat; + mat.translate(labelShape.at(0).x(), labelShape.at(0).y()); + if (d->mirror) + { + mat.scale(-1, 1); + mat.rotate(angle); + mat.translate(-dW, 0); + } + else + { + mat.rotate(angle); + } + + mat *= d->matrix; + + for (int i = 0; i < tm.GetSourceLinesCount(); ++i) + { + const TextLine& tl = tm.GetSourceLine(i); + QFont fnt = tm.GetFont(); + fnt.setPixelSize(tm.GetFont().pixelSize() + tl.m_iFontSize); + fnt.setWeight(tl.m_eFontWeight); + fnt.setStyle(tl.m_eStyle); + + QFontMetrics fm(fnt); + + dY += fm.height(); + if (dY > dH) + { + break; + } + + QString qsText = tl.m_qsText; + if (fm.width(qsText) > dW) + { + qsText = fm.elidedText(qsText, Qt::ElideMiddle, static_cast(dW)); + } + if ((tl.m_eAlign & Qt::AlignLeft) > 0) + { + dX = 0; + } + else if ((tl.m_eAlign & Qt::AlignHCenter) > 0) + { + dX = (dW - fm.width(qsText))/2; + } + else + { + dX = dW - fm.width(qsText); + } + QPainterPath path; + path.addText(dX, dY - (fm.height() - fm.ascent())/2, fnt, qsText); + textpath.addPath(mat.map(path)); + dY += tm.GetSpacing(); + } + } + + return textpath; +} diff --git a/src/libs/vlayout/vlayoutpiece.h b/src/libs/vlayout/vlayoutpiece.h index 6b20128c7..30caf6e7f 100644 --- a/src/libs/vlayout/vlayoutpiece.h +++ b/src/libs/vlayout/vlayoutpiece.h @@ -50,9 +50,12 @@ class VLayoutPieceData; class VLayoutPiecePath; class QGraphicsItem; +class QGraphicsPathItem; +class VTextManager; class VLayoutPiece :public VAbstractPiece { + Q_DECLARE_TR_FUNCTIONS(VLayoutPiece) public: VLayoutPiece(); VLayoutPiece(const VLayoutPiece &detail); @@ -114,24 +117,19 @@ public: QGraphicsItem *GetItem() const Q_REQUIRED_RESULT; private: - QSharedDataPointer d; + QSharedDataPointer d; QVector DetailPath() const; - void ClearTextItems(); - void CreateTextItems(); + QGraphicsPathItem *GetMainItem() const Q_REQUIRED_RESULT; + + QPainterPath CreateLabelText(const QVector &labelShape, const VTextManager &tm) const; void CreateInternalPathItem(int i, QGraphicsItem *parent) const; - void CreateTextItem(int i, QGraphicsItem *parent) const; + void CreateLabel(QGraphicsItem *parent, const QPainterPath &path) const; void CreateGrainlineItem(QGraphicsItem *parent) const; - static QVector PrepareAllowance(const QVector &points); QVector Map(const QVector &points) const; - static QVector RoundPoints(const QVector &points); - - static QPointF RotatePoint(const QPointF& ptCenter, const QPointF& pt, qreal dAng); - QVector Mirror(const QVector& points) const; - static qreal GetDistance(const QPointF& pt1, const QPointF& pt2); QLineF Edge(const QVector &path, int i) const; int EdgeByPoint(const QVector &path, const QPointF &p1) const; diff --git a/src/libs/vlayout/vlayoutpiece_p.h b/src/libs/vlayout/vlayoutpiece_p.h index 4e42fb3b2..40e91832e 100644 --- a/src/libs/vlayout/vlayoutpiece_p.h +++ b/src/libs/vlayout/vlayoutpiece_p.h @@ -59,12 +59,8 @@ public: detailLabel(), patternInfo(), grainlinePoints(), - detailData(), - patternGeom(), - grainlineGeom(), m_tmDetail(), - m_tmPattern(), - m_liPP() + m_tmPattern() {} VLayoutPieceData(const VLayoutPieceData &detail) @@ -79,12 +75,8 @@ public: detailLabel(detail.detailLabel), patternInfo(detail.patternInfo), grainlinePoints(detail.grainlinePoints), - detailData(detail.detailData), - patternGeom(detail.patternGeom), - grainlineGeom(detail.grainlineGeom), m_tmDetail(detail.m_tmDetail), - m_tmPattern(detail.m_tmPattern), - m_liPP(detail.m_liPP) + m_tmPattern(detail.m_tmPattern) {} ~VLayoutPieceData() {} @@ -111,22 +103,18 @@ public: /** @brief detailLabel detail label rectangle */ QVector detailLabel; + /** @brief patternInfo pattern info rectangle */ QVector patternInfo; + /** @brief grainlineInfo line */ QVector grainlinePoints; - /** @brief detailData detail data */ - VPieceLabelData detailData; - /** @brief patternGeom pattern geometry */ - VPatternLabelData patternGeom; - /** @brief grainlineGeom grainline geometry */ - VGrainlineData grainlineGeom; + /** @brief m_tmDetail text manager for laying out detail info */ VTextManager m_tmDetail; + /** @brief m_tmPattern text manager for laying out pattern info */ VTextManager m_tmPattern; - /** @bried m_liPP list of generated text painter paths */ - QList m_liPP; private: VLayoutPieceData &operator=(const VLayoutPieceData &) Q_DECL_EQ_DELETE;