From 49a45e9d57393589626d49a7aa2835b92ca004af Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 21 Feb 2014 14:04:07 +0200 Subject: [PATCH 01/60] Dialog Measurements. --HG-- branch : feature --- share/resources/icon.qrc | 2 + share/resources/icon/Graduation.png | Bin 0 -> 4179 bytes share/resources/icon/individual.png | Bin 0 -> 16854 bytes src/dialogs/dialogmeasurements.cpp | 60 +++++++++++++ src/dialogs/dialogmeasurements.h | 63 +++++++++++++ src/dialogs/dialogmeasurements.ui | 135 ++++++++++++++++++++++++++++ src/dialogs/dialogs.pri | 9 +- 7 files changed, 266 insertions(+), 3 deletions(-) create mode 100644 share/resources/icon/Graduation.png create mode 100644 share/resources/icon/individual.png create mode 100644 src/dialogs/dialogmeasurements.cpp create mode 100644 src/dialogs/dialogmeasurements.h create mode 100644 src/dialogs/dialogmeasurements.ui diff --git a/share/resources/icon.qrc b/share/resources/icon.qrc index 504b28697..64d48ee8e 100644 --- a/share/resources/icon.qrc +++ b/share/resources/icon.qrc @@ -50,5 +50,7 @@ icon/flags/he_IL.png icon/flags/ru.png icon/flags/uk.png + icon/Graduation.png + icon/individual.png diff --git a/share/resources/icon/Graduation.png b/share/resources/icon/Graduation.png new file mode 100644 index 0000000000000000000000000000000000000000..461bc95d1d755daa2a441baeee7da11785a5fcd3 GIT binary patch literal 4179 zcmZ9Pc{J3G+s3~$j9D@hLkxqlO_8xAd)7frmV_+X$G$v;#MmcG5kiFQsl*gz$-c~F z&z>Y%vZYX2TL|;>{ND4P^Pcx}uKT*qef@j?btjsc8Xyt;2mk<(Btt#(qbxoe3XJ8* zi4kxI0070B8C&WznM?}{3u9wreSLk=0;Xs-6U$@@EHH&8nF6CsTrU$lIf)$|#Y|4} zj*jw9PV)EmVvfXM@b>od^!A=$FmTmOTq6@lV`6)g_^YciM|%7ilby|*md4%K$W>j< zO`~zqXy}3hj-({c>}=6^ruYr!Nq?reFB4m!kBN`x4husaxxYWRrzhIViqp~Y_{EDH z#>UtiBG@Y^EiElIH8n*=ML9V+0)ZeQAt5dpoRE+Z7K_DTFg!dw+}zw~ zG@65h1BF5%{rwSER!B89c11;Y35jDeGH_8*$dL;OKrtA$6DQcvXjT*oOJu{!gRv(8 zEEYf_k?id32m}HShr?hn=zn2jV`F7!XMw~26%57#g(9F}2n53VUs(PZ@c#gTfLU2V zEG!@}m>mj2L4czg^#1^Zf&bGSoulPAEAA*jLFT3wfcEkSkAD}kk%1nN01-4iTHyYM zw$}mR7}vi80&?>)McS;H!0CAj6(uVANWyMKyDkG+(p3;)7*C7Td4O<1`KH~U0e^(tjU{E>RZh9b}=_c zU-|QO{($ZNdRzE_%?;(x6P3Fzzh;;oErg~+%HR2)*2~e?Ln0&7WStJJCkr7`ku7a) z2h_zLS;svt$H0)kKi&--+TDv#4JZG7HW9)yGc(_z)h3bO9-)%@dwn)PDs1aJU)S-b z*2d=M+kDq5Q%^2U?=yKl57uV;o40!!qnU@_KONGT``^FT&8++hOY1rK$L^Z?tq$K* zC*g=Nu0{PMnriDgqpjsZle2$$)~*~b`bYkaDn9psNSN&59JemYlgs(u)p1$9eD%QA zd;OC=?x!E|neCtlGbA$n)?feVu_UBt5vs5@x@gd2IGPz=GkLjne@9Jgy#9Abb4z%5 zc$iuqYv8Y)9xmYctQx`j>rL1S*#FRr)RY<+U*J$SBJz^66c+Uj#^BmG?c z%0+AC`rpbu@5NDn_x=AwWRz}sWfHas%SEk9N(U=H#Fj?Y?^XG)HI?rzOH9j-9>~A% z`8**TDC2&;sl7>KTHxA(3?=`Dc%xrtdbg{eytchxz&q;=#>LsOp1mxaY%9ytqTpW& z+B~?XM`jn!r(W*(Sz?-Ne1Vi-j|Z1Je5$M4?s5fLUoE`yB))VItJsOJ%!^h3Fr=9J zQ*l^^W}(&k;nriLA-k>gg=5 zxJBwz@o7YQ27tYnZW&qe>!-+|H5YJ_H&`mX3iW!e48F)O!>rE#5A z8u9b#M>Ztw^x~&oj53n_(9Dow;)e#DWx z^4eC9xj#Rbm?A9fR-w~4#rfRL0^ON^qZ*>+mBlq)bXJRYhn9Akm{u$Tl*W4_EzxV` zfGbYmhNHEldty84t7WLG+Bl?3kNWJx#JRjTG*Mvn1xt+DdQI$A2dpv6pQqzQYm>6a zK__j=OtYQ-^Gd0e*-@bBCLhmO^DHOm0E`-NE!Fq3cgShFXN-{x*kR2Z;PP#@zcaJf zXNjH;HUHZAE)GA$eJTRxYwYlO(vmv-_-SAUpFT(&L!wpq1qpguyqYgO;aITN$**yu zxco}Rf}1>D5Xc?*nhV%CMf}W-02D6O6_`SOU5FKLya5RC>*M(h>CGZUEqR0yR)SZm zQ!8dY#WKBB?Gq>sPZxjYO*MG(s4vL>MAMaE;&==oAuADO=5&)awj8Lx>6B%1>3v*& zk@??$J`NSu-YLD{(Uu1xU0V0^hV43AMGDHP1x3Da=eWp*aanuR=c}2*I%A3pzJiFB zr@LExEE(g=V;d=_X|6O66-d0Rcw2IorkrKYYmt=`Z}REYfn=UU-sBzKPdTLzjZIjR z?ZOrQx%Q0oo>KbJ_1ZZjNhOXn|8%i%%pl2RB-eIjj}jKC?(phyX_}|xoj3W*KUad( z3co#?imfqiZ)R@H|1y&`JTR)qgXD+vugVlNqP94z?+)%57`~vP#M7 z(=vPk0UxY*em6!7)vtLIe^CCJdz^JvL?p7`U|=#85HQENPWLYk&TrJ5)Fq!9_m(ev zq1vpF7Gb!T*}sUJ1bLA}o<7L?!^euPt!+xXglq@C3 zrdJ@S)9GK979fIVKHUn`aaBFfppAEB)$z4-=|~&9BI(CH`?-}??s`x^gxu@=fZlhZ zDUJ5}$bf8Tm(YO*M2@RHfByJm!N05ZOorOY={bpgDy+mnokZUu_!W(%t9}7*U1aiIHj#ja7+p!&W?a%smB9a^cZCQ% z?68*UXvOmqx0~iHwT&DX@D0Ye+Hg?&g3=i^R9Gp3dNoDoD%_&-fs{ry>K>jl+3M`O zScTcwOFpp})7E%!@6lk-fFya@Th4QbIBKf-#pM=+9?z*Z-Pn*-rC;V4 zy)38UEF);}t}u2=7koeBEDr}U5TPRhwU~WkNxz#v2w<{b&$F?ANMLN=Z5Va^Dqh2g zu7v#Ir-_O4nmD(VX~J30#bJu@ql=|{*b1y5TA zn%a%4qKRJcZr>!RSeC2!A9OTJ%>lx&>(*wBifkio5iOw0;(2Vgd!c!~d!`_{u$EQD zpQ_pd;RzL|vz#!CW%g*2&O&v&Bd$*)dAf?bQ4Qe$AxA8sFxP%OAVcnjUF?pq?BrtZ z+9(xkD9)Ag&zI{e58fFz-2H$yk2Bh-`>w4XmN?U`5$>Bw)@NC=yMp7SNueZ9d4lbo zuU`7Ki2n){AERd52w8yeXKXiodR??{i%aa8aXnpBdvI~oLKia+vmwryab)LQ8E*t~ zVxz5u5s3(yo*7V#epc-7#0L*UJCBvH_VN7`074WyEjGqGvei}tGzMmbb!=p=GxpIu zab8_ZG!$L}pTou@o>rmevos4k30)2Z?0sLVuD0aTVpn4%fw+jsyI6q;xAy3toFicb z0;4m67GMtgo?p%{|5~+KPdnr>tMvz#n2SC9u$377SIV2{a1;6){>l(r;E>0@ONDL? z^O8e5$R%`?J9Dv+OWViH!kY*>bho9eol^GZy>}VMhbo4#fhI)h-24kFiH-guIdPN@ zdzHXb3&T7@cSl2jw9V#`$&JLn{_&HEq2u-=LN4RPTt`qd$tN6yn!YCb4vXW=TK!o zgIURkvS)6~8^Eo+cod?wV=${U^t$`?lwtAKgY%ALt1d!06(#V>V7-V5hCQ@)Cmesc z5VVnDZf6xlSHJyxxn&;ZLs1LV*ZSD6J6QNA)mmRk(lm80Za~u2M#F|DU4R z-fEAsL$T>W+c8kz6h|7eY0k}3QM_V1Al;2E>Po`H8@yz1$}SS%`s{!IrCBv#ewdU_ z6?jg-s6B%KN{7k-JMhwQ)TBAw5N0srv`OgNAtSBWNLYYhO*pa#+$%RL{qrrOxajWg zmf6d0*|uH6GZm?a4e!N*(okifmw_sedB5V9UG*Bki7u{EdT?-YiCvXYO((~BLDXgT zsDRAWGp^sZijbWy4G%2tZp3bLT18~d<;H)A!iq7R1K5mpV(fs-d*_PSZ+%HSi|n~3 zN)VKj6@1>MqVl>o`P*Ows~((9xOK#8{AxXyzop!U4lMl(7w2GIcyF#= z%=QJY@O`$wp4=)zy^C+8>rJFG7TUmY00a3f!l{~kI`^JeyE)t7Hv~jSH`3x8LtPQJ zS>_imXFa)e!Mmb%RB)exnX;+KeAVscnz}Nw@EYHyP5%zlp6+F|u{J$;Lb47Ja5|rq zs{B-~2&X=KO(lSW(ltn-4kUkj$#$H|*}&H(rF~Mdw}j0bqY@>!0fhvf;bD#GP&k+h zrhu51S+VBqQiX^#N>04w9aVNNfjkw?gU0^oo77Q5`1!N|{o~!6m%Ny^Q?eNQc=_Ez zS^Xl7)RO*w0*;%Dd&l}oMU*nambc%%jHXK!FDWS?F{g}J3J7~>m0-~NxOQSVMjTQ4}^53d1eHZ)^Ip#AH^j--m z#8Uwg+PpBe9$A)bAhU^hPH}moLlg#&@NBTRt#9uh3mIzc*GQFZxP4K`>#v+jTTq8b zifr_`k+3#r+c}r+Rbl?bj0EY^Z)|OS;GWX+2IF3G&Sy4U*+jlF{5NFpugnJ5t(bZ7 zM+{bSkWampyYlqR^Y14QztZ-d9O((7u~gR|v?#uY<7AMxy}e3NXOffj@|g8;(_6B1 znJ=7P4l!Y{u-)Q^jljWx)?TpLS8)4NsMf~HC6YgrAds=s9`*|1*ox>FKRsP)mu{ug zfb6oOS8h0JGGOR)Ir+1BjyJKiuqPbdz{!yw$!%i&} zO{nC?R`h1O5#*xtz{V{SCC5c>v~-`5iB2)dF4d6@v&vjP%iJ7p2W*EDWvIVhqK^Jd NfTVA#S4nh^`47faXeR&w literal 0 HcmV?d00001 diff --git a/share/resources/icon/individual.png b/share/resources/icon/individual.png new file mode 100644 index 0000000000000000000000000000000000000000..9081d75c2a53173c256cfd7b85a38ef041491aa6 GIT binary patch literal 16854 zcmV*hKu*7jP)004Lh1^@s6b)xxi00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY4#WTe4#WYKD-Ig~000McNliru-U1a15hR*u3labTAOJ~3 zK~#9!?7e%uT~&GS{e8xmbFRzYJIT)dLW1l70TdLXVAX2Xh!$I*N1;d0@p=%f_4ORv z`hvB!p7OSp>Zw+3mDFl`UhC-*ds>gyRtZpVMUZfmOHmotOWsFSPN@G02kJR04}VB^;oXt z@wljSjyvwSL+`uqK1Ad(yRL}PY&HQ%(-dROoWEOZdp~FYT~)ExlBOvl()(FG*BCSB z^QtOIl8_|Hc5Cg{G)=bxBuRpZ^j?#u>4G%eZ{U*3xV?5fK`V2F+%Zp`jsKt?+v9J;+J^np@$GLJomY0^YgEG1;&`3P=wc5TCEl$ z!qCtV5{0b#y9f*n48)t-!WiibWYlhhgF`6LY&J;KjI5E7rYX%VqtR@J_fx1|l_Uv` zW^-dBYmD}9tfIB+&N=1btA~HY4=2Km=L^!`llVOZP+^W%mZ0tto#&kdp7D&+5Tp#PtSv|ZeuJ$NY$>XD=N_W|u69*>I#eDJ{s0eI`%ew9NdbUgb7M$w}&ooxN*TekD?-n|&0 z-E6V`#FLo>rn=m+;58jV%_3OQtyXnw%L*U(zz5||{^U>eJKy;ZU-`;cxa5*cp8O`b zEK3d^IKawPt2trg2+p%*T6I{wY(AQJ#3)z)aK{b~9z2KuS*y+3jhi^+(Q=`B;0Trs z5&@@jb!L>j(5-{b2A5oN34iuyf5xs|yPg_8pomZu1t)JhnZ-+%QNZWAE=Zo&M?S>9 z^!)h#ojB*PKx1GLtDm-xgE`qkcp>+0IDk8yvxW5 zBMc7@%OOQopi>5inwl>@!*mN6ltbf(*m>W*Vbg#WYuC{*jO{ITSmt%SpTb(N3Q|1S z>K7=I2u`@PcB!oh>%?0vZJFdz5KXS2Tx&M#=d*_uxT z5{0%klwL_~@CCgprLx(l(9w_$`u#un13vxfPwV;T{~~|%M<0@7C3Ewb3!t@@Wy_bb zY}v9128WD-dhjBY-qUfyY!Otzs4y|n>6r{wWq8wx9Gp}{Wq!;36kbN4Z6NnxjZgrI zD9(Tr!NHd5%)a{77jgS--{WH+`xCZod6`~t!3FZ96~LuSmohv&j0z(@LIf^aUZ+r~ zP`Ge{D>+mRCS=d@@+@Z{8h#u%0@UB=*|Ask%lJg5j>LA`9kUX+-Xk;RY8nr z-vjscG~$Z&CoVsg;Ir5p@_kV@k$o=ty{R> zmgfrV)~=JaYuD&~_ucp8^Z`YLMMFa*X?jJWTn(T;;!vt|r^e}eWxA{61lT|#RY{V9 zvO7H^%*)3oDW(c~{G^`H^wTOm7FLgn)qk#tMNH&ARllpWt}$Q?B7G?rBZ#pPxQ*OE zBZ#5*FlN^K>C6WT-i7b|n4T30=dtU-TA|~@M@)=Rct}uE5rW$jgs#)=_TVw^Ve#U{ ztX;c~{rmSnc?EEIcvwuciG!_@%Kpi59k$kR*SEgL-+yW=ozhWwrI46{^MMbCz^*&L z-4m$$zw-_L?wyz7y_;WcX&>lT1m9C zBxy7;%_fO$khPbRW(m4z5R;}fT5YmcgRI>O+EN9{ELn2}NqZ4lqd_vfl*F3AUS2eW zq#4cT0F5jKk-Fmj$%W5?O(GcYp=gBP52}HPGDO9T_lnx+d#jK|z`5@33=a<Mc$eJw> z%Z_hf&+hMk4+Tzm-b>kZ?nU?_CrcBOEThqEAdNOj)}q;NVj2xv?G|Dzvd1o0A7Nc_7ZsEMXkKrn~~ZEt#zWyo_o34&VvUS?^r zN`Gq~>YN`>)$kEa6DA(q&D~%73Zq~DGW&LpGBmW9waTtZUWC z{8mWjq2p&+#<4=ve>{Nbu_Q@`yV3V}`719(6^7T3@H>C~dB$>>DBz$8`CSu&UsSS*?vG$|( z{CIJ75`|Uzfs@Yk#j0PZ#@9s0LDb{D!PndX@B40odhjS-gsz`I2oj()U^BS;`oHHZ z?|CN=J#csM_p%myjBxi&-{2cp{}C^F{jYGryWUH>WGRZ^=-0G(g;v&x?sQ-KH=9jX ztXT2n6u>l1FJ8B9-L-e!6-?&|r=3EXgK;o1p>#^fOJUL})1_c*wGWzC7fz&Eul>uvluhUyKPu~QsBoc!L1$7DI2ljAi-$Qi953u*ahZ)X##U?3YEJ?FXb7+`m ztBsLh1|8taAZKNzCsmj%m1$9o&aI5~0;U1?{==8~?Au<2b6t)*^;v8>_mzzN-1#hB zaU9e8c5~-HT*Eg$_m>}wUNf;O$pxJ7&c=-y}p0J6b6)PEDwU!f~^=vjg{S20_Uc$sgfJxLV zr9f^3+FQJ{QS?H#f$#qoA_V< z_1C%KGk?J^z2og99Wd5Z`n&JzdF}1}!w)~i&;8s>p0pZ}N&p9khG=J&=?JM9A55+> zU{&Vvj|{D)D|^4o$M;vR8JU5G2u&Lj@C_Sya7Lt;CvLak2e*Bn&wTtN+;qeB+`Hq4 zEL%Rz3$~ocD=&N%%T}zQJvcz4*_xLOp<+mrr04sIM1EuGVl`bTx|*Ii#N@;{lM~~N zA3DhR{xNpne;+&Ux`XSs-`qn3mabgG@uxk5=fCQ;od2dbaA*p;g`i$A28=WFlDyR` zw}1I>IrQ+ooO#}BIrqK)jil9JdaMTf#1}5#bTV)L@Sk(tNB)R|4?M)s>Xm_{8vKG8 zQMif!+`01sHg7)b$ti%w7>0+30a&tV5h}r3re}z2{?qqOy2_OIOf5r1({89!72eD}bj36qQ8g@8? zny58rzJ{C6#^NNF4~v8Ym6x9J$!VshCK(?a5p zANifn{tuiA0RTN5j0O3DG4|YcD_(>b|JGGBY=gY$lQ&Egngx7++gI6m#({6+3cbrT0@JN9zVps2S;f*$gM{ZtQguh)IKy2S}3iAYciu3U-u7R);Iss zFJg@0mA`lapZV**-nh8k9PK<(C6mq$QKJtP|L>fq+wI;`7RBaHw_ti|lKb!5$^QNO z*tc&Vlig_s1_wFu+akVq`sOOfMy(q((^$q(&IdxcDFb;j8-Z&i@4# zEgIro@A`lF&EI^tAcnFm$ztn_BLTu*6|X)-(V`*W8l&RL?j&Qoc5mMM@WVXt-~${u za1d(^-8^S{VuAzv_Obn*d-&)dT**Uw_pxr>aa?%OFK@o+^>5%efAiPnXJ2uizWc5J ziQB$&BR5?0S3K+G=kv64eikZ?rt|M1-m~HK=h96w_HN(KkG}a8?)j%Lvw!za&VJ1$ z{Ko&jmZF5Bqoh_C7#N@>9`ETn+Nyyb7tsj>7@wHn?6c1~W>Slfy#_RfU0zrN^AzwqsS9b z$8UZfh@IcW1L@FGR;)h}-^ge*47YslYHs--pXAxEdILZId!Jz4>8CR>0Zkl|+MeY> zO!zJ;h=k0KvDKLm-+$@Sr8FCjjmL@rJ}%v{hL;Z0YPacjrbEzC31Rd@QjutaXM(eZ zK(oDwMXT5KuJynjw~=NbMz8|bKw=D;5nSQ;-xQrseJBppBp>-oOAfbH*VlFfBxr8OcfVxIAH_t z`_RV#xZ|I{&Y_1MoYR`4E`hC~Hc$JxpXJbx?!w_X`FXG4wIBH`zxcbKVA(0BlTQak zK_b-BJ4Gf~8$(1G;z1P?TnpzM!^6X}Xz}9FC$#_$3=FV*`7#b3JcOu6Ovnsa4G*J` zA|%KR0TfkeG#FUDzPG1iJAX`;fDw(=UyzE@Fl@Z*_V4MnU;Qd)oply}`lo*?$3o@T z%9SgZe(KYo0^r84eUn3bcOwqgoU(~kYu0i1tv7S%p`FMPN>uX#&bs(AI^8Z4KNw}x zFZ>cG{Nlf-Xf}J8qEJHsdip))d!rDx6xtXXX#-;|)>^VGJEkh+9v1;@x7(~*wVLUv zNt_S;KN10JmBfZOH3m%LNe%sn2&sW}&p4BT;pHgs^cTGhKNVhY;z>>nSj*_P>$kD% z!3X*5XFtoav^JhFA}`yrh5PT@!PLPC5NI@7JZyB_H|(L#tL%7SJ$)5gURJgbc3Q z`J)||@3`k4-tqQd?e*$AW=^#+oP6@hIPb`dK(I}+lqIV|{&nyDI}mZfIn%?#SvY7d zUrlTIYWzH{HA3*DG!h{b#fnhk@Rjc>AlA@ow~owwc(Q3g5$R<^{^gE4$PzBY1XG;h zX>46$VpfFd;lF45kE)D6nenDw@Dzs|;Ep6(NaOVQTb>eS7z@V%ajD`OGt}IujWObJ9{am~D-@;8X+~pMCd^9h~#r zb6C1`*%imCc`-&vB7Ir}TCHFTC&tI;@)nOI%#T8Lq}MP;QDsCVH2zecVgk5v<3^UR zSjNBHemjmp8&8bVvL-N+0Vm+&t*8XBs-Tm&>z2rDi61r|#%yo52R0w88}+!2X&4+FWW|aV z?7aUzZvNIcSZZpbJ@MpM{d+xrI@BGQm-AEDwA%x$T(N?ct5&jh?OK)$4{shE z805I)*0FTiGSXIiEKO51);=7IYr4~6aBz?`&G5arA>f=@9JX_~ayb{twcq^ERs7=z zt{`o+*!+uc;LJC?nMKE)#9(^}iVovHxRoz|`2XXoH(bbvzj!??Ueap-syz*8Xt&zO z99H_TB7gv!Hf@qkkH93UukrD5#>U2U<;s=PY&MyioD6juPq0Zu)>>NaP!8Iy#zB+? z&UpsfO?)KB&bQJG?)&Gj^Yu@DkSuF(-fw=8vo3iXqTq^9N8L&WId0v#{LH!M@|oXx zH=qCbNBNca{WelWRH2q^ZZ;bv_SlSqkGWZK_uhN2zVVH3l~?L-|MqX| z?%lheP)#(_G-YUTh%{^TEMlG)IOk~1QxY&k0~X4^Z2Lzh#`f}pH~t!DzU6In_8sD( zJMRjyiw7K(9nW+Qmt6V#6s7Rc{ksq=(SM{@a@uS*Iaa479diPB(n%-D`t|F%{r1}d z_|S(w#I@I6d(5_&J(2(}TC|8X%`S6M*j$mLC|TA9WZv&20^NiAdFamDXbmmn?6IAErM&&CxA5;j_!(~c)JOR1UwIqNq6|=$5{DVK=U&h&?N*yC7N{=>;8CpM;bBfW z&DPBR-SkoF7E_) z&nN@ao~e%K%s2iAe(l@$vi9_6aQ$C>f{BNB;X~fH$9Rd!kzj&Ff(cF*f{>$L0|NtW z+O&zAZn}vjOP27gXFcl)*CKUzcqzw^Y@}31RKTe+Jv9}+-?9}k2${bqBx^T#`uVS7 z=l8agnNX$Y#bDJixj(ey{nyrnE#w)CnKHl9f7dB3VsDzD_2vBMGw8JDKuiZeJ z2`;AYq-yj&r8Jf!jnj$SV}xg0ZnZK>$~8An>});Vyvh!b^VRD)v3FlZgi&>=hY7zyVbRap4A5 zHPtn#tGZ*22uiCxKx07zKJw~xI$U|>m3r^J_XaLzS@P^>Kl=$NfPpA#lZ3)Si7++Y zWzUa8Tin6btHZPaIdZ9}H`x_5uuZR4dPO-uvG7 za_Xt4a>ETbXrAXh=Q+=L!U>?LQn-TL`Aa*cr(3{uQL_8qD1gfrhh~%FAK^NXVo8@T zBP}1rt*TEY0GiD<>4FJ9I_To;v(M%uANdF`e({UNImgqV{`4nY03sqxPE5Z4x^Lci z^`UM-0ZdF!GcmpogOH>RLUU7l#0j(-P!v)(yP>(>?W33HV_|?{LDL zT1(b=iur)5`l!=q)><}f*w8C5e?W#;sNn#xR)OQU;mAF z$rr!)CEc}qH`Z8eVlmdnvPBy@LB&~dLjwbdSn@I_OVhv{X*Ec*M!fNcBuz+@J{K@a z5}M5>VydZ}o;1t)rdyRHP06xsPGOFqBuV&Nnx(Oqvyx^FtTD9_5S2eB7;9-npQ`kV zb3!g~O0&U*zp|2bBPa6A=bX+%<1o?n*tX&3ZPyc;^}>qdpGMjqqFaI*MIMI7%tt>4cv*YN@Yb$}+}m4DKj*n)9)?Q?rSxxf zy)tpYD~o@44{v$Xe`3|j<(#Y7>sCoT}D*FRjW)!*k0LoG67Vr58#ON>vJ{WNpK(|M+e0xaprT z0;j$3TuwaaMda1=&!2Dr^5J6O-o%NTbyrnvlF)9qpIx~@#}bSDF%iJefBy6OsZaem zAN!M!aoMGpNk?J2WJ}@sTp$<>#rkC zQ#L;HIb8a_53uRXGdbWSv=o(}-bBraD7DtEw?^~V$}g0@9afEO<7yB$g4Zx#MAcI` z#Vh#4@X($EeD1@)&(ywstl4xr7rpyRvcV?PQyxR;4lANPV!~{BRAy>Pso{)TIS76K z0JTyp8CFDPR3-SvC`@+?AoQoU*2X4L=HIklNq$}7%3k#hQ^Vjadd0i2se4}-o03xuyV~X(^Emy9Kp|? zUqu|@&pHbSk;A-Rg_#OUNY*(#t(K^>iKNnBH{9(uX3PQUkNsN3Dnr-#;(s`ZPa9Ksax< zp)y-K3uDtd=qB@P(w@(yVYrN&IK=KdxAWJ(^KSO++{yXxco#2tB`JJLGwZ&vTsXP~e+Lt=#XK!er8OE~%D6FK+7SJPO$JTz7}iZw!_a+QIeZ!F%AdhfTS;^f2b#pjPUw5yg|BUFsr%amVz+RF^?nVOB;pE8%i4ltWfAGbPMPx zlp;vdi{AR@J*nHHxvH#QSFE#4?2HZ;p5FK@UwfYMwF#FxQ~G)nk)-+&^-yTQg7Zpu z`~ZGxn*87a_S}6t_uqC4dwzT`BQHLWS6}$ctlYGThr5tXdOCSd=iolNV|(cy7^8D& zABV=rm^yfX&i=hj?%&7s_yp63#+W*^AMzY^1N|G7MRCC9W(F z3q&tkw3xvaYdQNRFK2M5$#mCY#9+|Njp1?|&2lPom9fb-M?&fR2p$sA(W;xRH8QK; z_D`=Ne<}@l_uY5v)1G#`U^8+LzBb<10b`(h4>=AVoM7z01P3N2I50WE#Yjb@WHZICn?*et=cppk_sMO7eD7s|3embHX^dnS>w-Ao-g!1QE?vMd=`x|k)$ z9Ymr_~{O&=wS0{ zQr|_oUFc3yPESDIrJR~z>fjht<715PA0rdXD_;2u{^?ua=0Cjszi{dqr%_DxJJ%)z z@`SUVM1@QhYuIj#*=7vetk-R#J`_8}R>_HxV6OiyO>no{iS+VtkN)|)cj~vkek0%6 zeiJ|V{+*2NAH&nZbv(XQN)0Df%RKmC-r#%@@Hf>sUoGB@I2Z=6y>{}w#zmFSWCD0n znFwPnhzX-1;)qtUabB?W2NEI{VRlww3if$f^rxsz(uR6fvodz=& z=Mjr5ab7XFVA51k7fhY^9@ODHfk^tO_f2RHEv3=Oz$CQWElgsOfyFe3251Z}rrjRK zBnft~jmZ+SG{vNg$(l{9H8cm?(9F;zV{v?7(i&HLOV?u${Gv} z4X}J@h;_?`CCh}ht5@o!?|DDJ@YXjYotf?0H4eN^)sq;(s^E-^^PC||45^XriExF1 zZPtUwA+Ds6CV}=Zk1oIa6AR$|_usFtd)@2!+Sk4|Cq>?DwHRK$f@Le$u;%y?hSsd1 zHN1@GqNNP3UQf1S17^umWMGg+vyDv>vX&qXXf|g~9(OfrTTgRTk*Ca@GgD13s_kfR zJXM)P-U-^H?0_u`^1Mq?PE(Wx#dHVC4tcjgi=4dMp(qOIOi^~bxT3)2UGhAq>`YVU zIqH27+OotuhxQ&h-aE>&M9UKIN{T!O-@%s-4a0B3XLpVw??$cfqh*M&N^DxEarCP3 z9!U+@6e|g0EvYqRjf{4CfPsM)tyachqsj86!>n1ij*S~n;`Gx_;ly?8q?y2f`Op84 ze(Uxh@kf96B}}QYvwrXalW2~;1Pz!7q_LqqM)4@dhpAMV5mJ$>63Z3Fhwq`HSZiro z4Tk0@rVKpFAf)efUiF86$k)F1H6*HUr^?FJYdQB9F5r~2Hgo)Gr?Yg`dd%WswArMv zVM5h-2?skN0GTTK8HTATkV%-V`Tc^1nZ7lMf>`yh^F*`4tUP>$$ks*~2%&1RY^2ym zij_fHQDC(Oe^gDUr1m>gyH3wH^r5LzFCvcS()WU!Fulk-han6LEehQ%#dn!#WO?RaxraFsYl%jnY{ciejJ`@1jG z@lo&yZh?46QHq+6=e$yi(g6~MR168=oHFGVYy9P@n#-Fam!;Nj1@KOpb}qm=38c24 z(wr|~c~k=EywY`wdf{*W=5KlzbgEqRAO0h6edn*U=A_fmMn>1cbPiJrlO;?}dvY~& z6?_rF+;Sd}b%wY{pJbLPlSiO3^}$=2H+Asn*mOS~CqTr;2-5ykaM29c#spu`m@tS& zB#ea3J1|{*nXNf%98X5JP1f-)>N>|cK?P0<0qZYujESV|+laLsgnw-Lj z;MMc2v(Dk&?|UDsj^D^c*He@l+V84{=9ATQajiwQamdOOtl`0<%at9CkUx4?GUSot z{GHwa!>A~|4;bnkof9Qs*RBUyx^flXfOD2oJ-PQ3DkKJ)NHxxzBF@=sijZo^)^s9- z)=(kCBH}46OsWp&h3se~y1gMhyHew&S|&OLt<1)#SstALs(Pk!Pf3g{1*Sdk7h`%@ z#aU->X3g4lJ(8vLI)5tGhuOY~5pvZqq$Uwu864hjFWW%v^*`a=o=;mm!n0(a)SP3M z8P=ad1wKa7JY%wF{9M)x##B?0!t^97p*M`FtVh_>(Mtb*_q*R^`MTqoD8e<;h%gl1 zlY2uc(6oXj_;Kolj)pW}W-9kPnB@{^tLgcNxk6E}*(GQrk(Y_;sHlu$Gp34?%#}2= z^ymf9t1{hnIFq2rNGXhTORjYS8#kT8tvB5m{fe~=w3;$eplYPg_Laa^5w9Vta?zJC zLMdSgw9XKK(Amk8|iA=Uib*$GmaR|Z7q3eVw8fy|TC4_ZYJ%RrVR35`BBCY%~^ z!&UyEcq~F9v28KIKkSW=jS8S9ucH$E_dD;ngO~iLSKtI(NAal!fs1=psN%iS%7m0S z!w;cTD&7i>IF(*e@_1O=YRGzQAz`{yoOjnYGkaA6SA@VZAy8%qr5OM^twFfxCZ1Zvl+w1kzz3ta_pYyIZQBS@dl_%wmvs6UYotj29= zZ0ANzkW>X{qnV8uCupxlZx8B$jfk8T8Zg_ z-wt6q_mCR0UI$DwJIhQceh^kj*d zUjV1`g2G$Wm=Ob`9k2VRv_FWpaB$*T=WyJKC$aOMyP2HsR8x$uDLofexRN0Z7IXrI zQ`C6UETO40#oaK|*{aN*XzbWK%Nm==NI|7Hz1&AT6$ZCNR!I#KL~4wdisw|BbDha{ zsYbWf0ffVOlD#IArk}I3kD~j16}5XpZ|Hs!JKV+@0;oaLxmrPqs_9X)vUoA6=BXGE zWvn`+U;M(~v3U7v7Oh;}<3Lt$RhTm@HCY#&htez7&a?u~hv`;k7BQo%VVY^(>U7m% zRkUr4^!T5~GF_I4oyP=wA0k*aW+XJXVYFMi;nE06G_BKxW9 zKVW=nnlx=)TsSl_f&D@}Rf$5|f{7nlq=zM=Dj`*-eX>BMR6KocSEom%rY<|$dyO$Q zP`W0uA~T)8*o~dDB-pyRX!My#|1w4wcyHFuf zO2>OzwdzI>BVz1mr*Jg^RNn_dO@hFvfzeX+(gH}m^xo5pp*sn0eA_$u>?g10pTGGv zesJga_0(rQOQbRd8dSF=FsPLu*dJigH($~No~_K)Gb%H0fJja2$V~Z=*mTbrnX9kj zds>;v=rA%fmND@J8yFK|G!{gS*7kWcUVFsBMaHq+c{XbVpG89O7V1+JRgd?+S0(5* z7*Ov++e+vALkP{0ZgBk&nkwK3&W$xDg7Y@wq+#x{QG+$QHOo@A-~1gOxc`2h`HJV$ zTx6I$)OR;h8|E)-y#~fam&%&n5Ft}{Yi5h9&T!*vA3yLv3+4R@T+!P@BNWbDI!6PV zYAjJdSw1p{%n7JdmY;AO@BVLp%!)?BK)Z<+C0UYQ=9H@&2C^!_9yNoh7hOmn=BQgl zGt=E8sUP*w^cIkGe z$-6n7PKTn~q0IB)&h*sgq9`be?&h*Aan4cX1!Yl?J4e@fTwZR@yE$GxMNuGx%0TZu z&Uwl*P^p}Ecpv`neMwmqsA_nw>I@(DNS(9lQF>xSfma&YKsHS<){@x35HbeNKI=JG zU;5_PZN26H+`^%W2}aI-4rS55U?UM4Rxs*&StpeMbhk{@rt>8O4l{-RaPgY=x@Gpw zwZ?3HL>$n-w$yWZS$mp!O?bsWKa|#f9re{C|6RJC9VwlTjxrg^L@c_L3pZ^+Oax! zZN7EdAAOjq@k4y`>)%3wQ_gxWMFFV^(QIH;MRTrI&q7aTg_dPTwR;sPr6@@~;og&# zDy1khu*(n#vGvGggvtb~VIq=CtILn)r53e8@VS9$7od@9Wa#>=+}PA|v{U+#qHv#c zMX|XvJxw>yajw95CC|I$Wx@EwB-2wJ4jw$n#Ka^A4jyEDa)OD8Nv0;J7#}~x`1k}9 z;}cAbk8@~ZoWl7YzF=$uaVn&!^ypb$T$E(nSDVUAbALGePCQ-tcXi?A$JT+)vQAZ=R-NNRM zvdGEvJoud6(V3c}=yXG2RCkK*)C6Tw;#X|omK$&4tn*&QNzZyV&1O5&&f~;(BR!2} zji)V^ro`aR^!@D+Br5|+5I#T0bqfgw<7bw);+53K-_OFPob#8?p<{XPm?$O8o%O*X zFDzTei}Kn+12AE|!C7GnPwxA{MRiK@GStbc?fY=V8jz{@#EO7fam_q&dZr7{a~dM@ zvSPz%Ke{?xUz9wCgk{9f>TG6TZCZ_ST~BZI#ve!>BYX@JX{LX@3PP$M5Hr&)4lqX4 z;YJ{>XEbIfcy*p+Q4B0hh$WFy!-RShFo>c6Zxj=b1{y-iY8X^lAH(#fv7yb!Pz_9W2J zkOTC!8h-@}uM`U2$&8KhQWYcl$gYSLW^r_DU*&5b5+eADUh9#X%u#mrLh_#TJEJ~C z`}HQmj2XomA%l8mW2OZ@+=Snme$Z^et;0xG<~~2I_D$xX8Z*Aj975bomKli&EEbU< z#8!fXRMyaV@S_m8W)+^Gqne%zpfz>;vzCUTRZxy^kqCQfwz*;aGvs2W{L{-T|X!I_2pQ^|gJhuuat-Q>h_>wE_1ul_2Z<8rH;_%*{$s)Q*_eFf)q=&8hXyHnBK5 zV!rLvj5Q2P=c;ferKA;e!AGRzmrj{3JSwK1nx`~unas;;yJ8V9b<~}%f!uriECH-6 zf%i(s2OLo)p!&T;e$8J~3C!EB_Yv3?ybmC5L)#RK5y_}SWPC)`wtgw&YrsV5ikG*oCc%**1nM@7wO{W_`3X=Dku z;sPAGCPc}dQWT+n-o?767S8}0ej=cshS`aGB?DBG%4W&dBx35j>C7(LijMfMYdc zFRY5DDl&%7BC+;^qgv~XXv%CYotaem*Qhy7tx1vhO1;0QMr&p@Fo=S%YOf}wiXB`n zP!prQtX3M+s-iv)L=3Q9mBnfprD4rR1Ebp8$jD&VP?FHfY^|>ND2tN3_ms}j^#&(q zBx=G@0ZQT0-09W1i$JZ=O9yHEGDYNyIqf&D>{r@LkMCAS^XwxR(R;;<>0x>Gn&TNo z=kXsdMi^yv6MU#~sD?xLOChC}gVhOUe;Arcm34iT)5-35%!N_gLy z-NStUU|VRap=o5JF;Vd9DLd~m-qT2h)JQC)<r~0PXkh3y0~E1<+J|3hA@M`y`1PJP}zt$t+UD%)B;;t!X1U0vl%r0X0A` z#t2D779{cNl4ja5i9YqSzi7VtcfnT%^K9`!_hAIGsZ% z2-1_IIPKS*RFRkK6Ncwj$knc8W;_4$r#l}N(Ow_LALip2)O|FWC#tSAsMZ3H5DEKW zek0+xo?oxhW3$D-`kjeEj*0a;S-rJe%^x?tv}iamnaK9kau!bx# zk3dEHiK>D$_JL8lWkdjt?N8~hut4h=&H6xH& zLuw60QBwFaYQxwoPe72-wn5q=6!89OrY3o|O3PzGDor;j@3_ewWsZ5{yWn$#h^BWDcjkzopwrZ`!A!_T9sKG{!Rs;q} zQ_BqIACHR$oF`CGC|oGQE`=F2g6NzCd_Q|~GHu+gPFwv)(XMk4kC^iC<&;G7FIt6Fh(AN|)6RYnTz?&4nxA}CvtL~FU``M^Gz6$j2q@AVYgQIqUvw)H)XW2lFx!1be4t-4qV ziLVKuRN#Dnh@q)}izwv2#!RVxCgMp<2slz@%ow&=VXO7BO=bT2F7<9i)Q={{^nw&) zLPXuq3z~mx0i0hmqMp3;bbZVRC&`Gaj)=&pshzMYPW7+_5uDRYJ8+S@P?7H<9Ab5z z?gul$kJ`0Nl?9r4BVzilsI~d%X;t56<9g~nl^@MsNl$~)OO?qC_#>EJAAg#;B#2pc z(xw(h%6H+Xp@nvf9>TT16IcP=>W8nYh0*Ellzg6ew$ z>Y2YKM&%Beng;B(VbNI>mB-3HMDt#UL;S29wH_gyt^}}*xK6!j-l}3_8dQX81jbkj z7aJ3VZr+Gobyn6TLSfEhQ$x#2Ebn}LBDH^20i1&?mL*Q5=VO(zv@dS;NW{xVdth-* z+gEKUJi5huws_c5h;Eh`q-gBB`+wWJg5x$~7`O|b3rGvBMYXt=)Sz0fg|xsHQh-Sy z4}v_Bu`_Z;julya>7kjEcuN3W0E=QWN0m0(M-Eoy0N~2+U1RH)tkvXjTb0mw)#0cc z?LJj}AA*zDq#&665ONpRm`#>Z6l#bh(iCo*MuKTfmJ)_1&kAkAo+_KkA>J1Nr`WL- z4478kXcqx5rrx}RXc8ht5)Da4>2A)aS;6QYG&&BW!J+~uGeiZxmHvX*Q)6AKcNlT7 z1m72H*)*zWC^&JxlHGE#(JOYuxO9<70e(8Abry0TufU##N~2;J$fL+%D9p&<$;_fy z*#(-aSdv%JNG&dHO$ZK@VzJ@U34w2)KhxdL_r zB7t;h4N3);Eui_>e-; + ** @date 21 2, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 "dialogmeasurements.h" +#include "ui_dialogmeasurements.h" + +DialogMeasurements::DialogMeasurements(QWidget *parent) : + QDialog(parent), ui(new Ui::DialogMeasurements), result(Measurements::Individual) +{ + ui->setupUi(this); + connect(ui->toolButtonStandard, &QToolButton::clicked, this, &DialogMeasurements::StandardMeasurements); + connect(ui->toolButtonIndividual, &QToolButton::clicked, this, &DialogMeasurements::IndividualMeasurements); +} + +DialogMeasurements::~DialogMeasurements() +{ + delete ui; +} + +Measurements::Type DialogMeasurements::type() const +{ + return result; +} + +void DialogMeasurements::StandardMeasurements() +{ + result = Measurements::Standard; + accept(); +} + +void DialogMeasurements::IndividualMeasurements() +{ + result = Measurements::Individual; + accept(); +} diff --git a/src/dialogs/dialogmeasurements.h b/src/dialogs/dialogmeasurements.h new file mode 100644 index 000000000..73945dda9 --- /dev/null +++ b/src/dialogs/dialogmeasurements.h @@ -0,0 +1,63 @@ +/************************************************************************ + ** + ** @file dialogpatterntype.h + ** @author Roman Telezhinsky + ** @date 21 2, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 DIALOGMEASUREMENTS_H +#define DIALOGMEASUREMENTS_H + +#include + +namespace Ui { +class DialogMeasurements; +} + +namespace Measurements +{ + /** + * @brief The Type enum pattern measurements. + */ + enum Type { Standard, Individual }; + Q_DECLARE_FLAGS(Types, Type) +} +Q_DECLARE_OPERATORS_FOR_FLAGS( Measurements::Types ) + +class DialogMeasurements : public QDialog +{ + Q_OBJECT +public: + explicit DialogMeasurements(QWidget *parent = 0); + ~DialogMeasurements(); + Measurements::Type type() const; +private: + Q_DISABLE_COPY(DialogMeasurements) + Ui::DialogMeasurements *ui; + Measurements::Type result; + void StandardMeasurements(); + void IndividualMeasurements(); +}; + +#endif // DIALOGMEASUREMENTS_H diff --git a/src/dialogs/dialogmeasurements.ui b/src/dialogs/dialogmeasurements.ui new file mode 100644 index 000000000..bf5a53bab --- /dev/null +++ b/src/dialogs/dialogmeasurements.ui @@ -0,0 +1,135 @@ + + + DialogMeasurements + + + + 0 + 0 + 385 + 244 + + + + Measurements + + + + + + + 0 + 0 + + + + <html><head/><body><p><span style=" font-size:18pt;">Please, choose pattern type.</span></p></body></html> + + + Qt::AlignCenter + + + + + + + 13 + + + + + 5 + + + 5 + + + 5 + + + 5 + + + + + Graduation + + + + :/icon/Graduation.png:/icon/Graduation.png + + + + 160 + 120 + + + + + + + + Use for creation pattern standard measurement table + + + true + + + + + + + + + 6 + + + 5 + + + 5 + + + 5 + + + 5 + + + + + Individual + + + + :/icon/individual.png:/icon/individual.png + + + + 160 + 120 + + + + + + + + Use for creation pattern individual measurements + + + true + + + + + + + + + + + + + + diff --git a/src/dialogs/dialogs.pri b/src/dialogs/dialogs.pri index 8796a0c47..58829f139 100644 --- a/src/dialogs/dialogs.pri +++ b/src/dialogs/dialogs.pri @@ -25,7 +25,8 @@ HEADERS += \ src/dialogs/dialogcutarc.h \ src/dialogs/configdialog.h \ src/dialogs/pages.h \ - src/dialogs/dialogpatternproperties.h + src/dialogs/dialogpatternproperties.h \ + src/dialogs/dialogmeasurements.h SOURCES += \ src/dialogs/dialogtriangle.cpp \ @@ -53,7 +54,8 @@ SOURCES += \ src/dialogs/dialogcutarc.cpp \ src/dialogs/configdialog.cpp \ src/dialogs/pages.cpp \ - src/dialogs/dialogpatternproperties.cpp + src/dialogs/dialogpatternproperties.cpp \ + src/dialogs/dialogmeasurements.cpp FORMS += \ src/dialogs/dialogtriangle.ui \ @@ -78,4 +80,5 @@ FORMS += \ src/dialogs/dialogcutsplinepath.ui \ src/dialogs/dialoguniondetails.ui \ src/dialogs/dialogcutarc.ui \ - src/dialogs/dialogpatternproperties.ui + src/dialogs/dialogpatternproperties.ui \ + src/dialogs/dialogmeasurements.ui From 93d14e979852f31d19fac49ebb88cab4e5d1b6c2 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 21 Feb 2014 14:25:27 +0200 Subject: [PATCH 02/60] Dialog Standard Measurements. --HG-- branch : feature --- src/dialogs/dialogs.pri | 9 +- src/dialogs/dialogstandardmeasurements.cpp | 42 ++++++++ src/dialogs/dialogstandardmeasurements.h | 50 ++++++++++ src/dialogs/dialogstandardmeasurements.ui | 107 +++++++++++++++++++++ 4 files changed, 205 insertions(+), 3 deletions(-) create mode 100644 src/dialogs/dialogstandardmeasurements.cpp create mode 100644 src/dialogs/dialogstandardmeasurements.h create mode 100644 src/dialogs/dialogstandardmeasurements.ui diff --git a/src/dialogs/dialogs.pri b/src/dialogs/dialogs.pri index 58829f139..36ad18cd7 100644 --- a/src/dialogs/dialogs.pri +++ b/src/dialogs/dialogs.pri @@ -26,7 +26,8 @@ HEADERS += \ src/dialogs/configdialog.h \ src/dialogs/pages.h \ src/dialogs/dialogpatternproperties.h \ - src/dialogs/dialogmeasurements.h + src/dialogs/dialogmeasurements.h \ + src/dialogs/dialogstandardmeasurements.h SOURCES += \ src/dialogs/dialogtriangle.cpp \ @@ -55,7 +56,8 @@ SOURCES += \ src/dialogs/configdialog.cpp \ src/dialogs/pages.cpp \ src/dialogs/dialogpatternproperties.cpp \ - src/dialogs/dialogmeasurements.cpp + src/dialogs/dialogmeasurements.cpp \ + src/dialogs/dialogstandardmeasurements.cpp FORMS += \ src/dialogs/dialogtriangle.ui \ @@ -81,4 +83,5 @@ FORMS += \ src/dialogs/dialoguniondetails.ui \ src/dialogs/dialogcutarc.ui \ src/dialogs/dialogpatternproperties.ui \ - src/dialogs/dialogmeasurements.ui + src/dialogs/dialogmeasurements.ui \ + src/dialogs/dialogstandardmeasurements.ui diff --git a/src/dialogs/dialogstandardmeasurements.cpp b/src/dialogs/dialogstandardmeasurements.cpp new file mode 100644 index 000000000..c5d7c5091 --- /dev/null +++ b/src/dialogs/dialogstandardmeasurements.cpp @@ -0,0 +1,42 @@ +/************************************************************************ + ** + ** @file dialogstandardmeasurements.cpp + ** @author Roman Telezhinsky + ** @date 21 2, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 "dialogstandardmeasurements.h" +#include "ui_dialogstandardmeasurements.h" + +DialogStandardMeasurements::DialogStandardMeasurements(QWidget *parent) : + QDialog(parent), + ui(new Ui::DialogStandardMeasurements) +{ + ui->setupUi(this); +} + +DialogStandardMeasurements::~DialogStandardMeasurements() +{ + delete ui; +} diff --git a/src/dialogs/dialogstandardmeasurements.h b/src/dialogs/dialogstandardmeasurements.h new file mode 100644 index 000000000..deb50e5b4 --- /dev/null +++ b/src/dialogs/dialogstandardmeasurements.h @@ -0,0 +1,50 @@ +/************************************************************************ + ** + ** @file dialogstandardmeasurements.h + ** @author Roman Telezhinsky + ** @date 21 2, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 DIALOGSTANDARDMEASUREMENTS_H +#define DIALOGSTANDARDMEASUREMENTS_H + +#include + +namespace Ui { +class DialogStandardMeasurements; +} + +class DialogStandardMeasurements : public QDialog +{ + Q_OBJECT + +public: + explicit DialogStandardMeasurements(QWidget *parent = 0); + ~DialogStandardMeasurements(); + +private: + Ui::DialogStandardMeasurements *ui; +}; + +#endif // DIALOGSTANDARDMEASUREMENTS_H diff --git a/src/dialogs/dialogstandardmeasurements.ui b/src/dialogs/dialogstandardmeasurements.ui new file mode 100644 index 000000000..e424e6311 --- /dev/null +++ b/src/dialogs/dialogstandardmeasurements.ui @@ -0,0 +1,107 @@ + + + DialogStandardMeasurements + + + + 0 + 0 + 439 + 247 + + + + Standard table + + + + + + + + + 0 + 0 + + + + Pattern peace name + + + 0 + + + + + + + + + + + + + + + 0 + 0 + + + + Standard measurements table + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + DialogStandardMeasurements + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogStandardMeasurements + reject() + + + 316 + 260 + + + 286 + 274 + + + + + From fc427a04c4d8e120782d32ba952d531ebdcda21a Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 21 Feb 2014 15:04:39 +0200 Subject: [PATCH 03/60] Change in project structure. --HG-- branch : feature --- src/dialogs/{ => app}/configdialog.cpp | 0 src/dialogs/{ => app}/configdialog.h | 0 src/dialogs/{ => app}/dialoghistory.cpp | 14 +- src/dialogs/{ => app}/dialoghistory.h | 4 +- src/dialogs/{ => app}/dialoghistory.ui | 0 src/dialogs/{ => app}/dialogincrements.cpp | 6 +- src/dialogs/{ => app}/dialogincrements.h | 4 +- src/dialogs/{ => app}/dialogincrements.ui | 0 src/dialogs/{ => app}/dialogmeasurements.cpp | 0 src/dialogs/{ => app}/dialogmeasurements.h | 0 src/dialogs/{ => app}/dialogmeasurements.ui | 0 .../{ => app}/dialogpatternproperties.cpp | 0 .../{ => app}/dialogpatternproperties.h | 2 +- .../{ => app}/dialogpatternproperties.ui | 0 .../{ => app}/dialogstandardmeasurements.cpp | 0 .../{ => app}/dialogstandardmeasurements.h | 0 .../{ => app}/dialogstandardmeasurements.ui | 0 src/dialogs/{ => app}/pages.cpp | 2 +- src/dialogs/{ => app}/pages.h | 0 src/dialogs/dialogs.h | 49 +++--- src/dialogs/dialogs.pri | 162 +++++++++--------- src/dialogs/{ => tools}/dialogalongline.cpp | 0 src/dialogs/{ => tools}/dialogalongline.h | 0 src/dialogs/{ => tools}/dialogalongline.ui | 0 src/dialogs/{ => tools}/dialogarc.cpp | 0 src/dialogs/{ => tools}/dialogarc.h | 0 src/dialogs/{ => tools}/dialogarc.ui | 0 src/dialogs/{ => tools}/dialogbisector.cpp | 0 src/dialogs/{ => tools}/dialogbisector.h | 0 src/dialogs/{ => tools}/dialogbisector.ui | 0 src/dialogs/{ => tools}/dialogcutarc.cpp | 0 src/dialogs/{ => tools}/dialogcutarc.h | 0 src/dialogs/{ => tools}/dialogcutarc.ui | 0 src/dialogs/{ => tools}/dialogcutspline.cpp | 0 src/dialogs/{ => tools}/dialogcutspline.h | 0 src/dialogs/{ => tools}/dialogcutspline.ui | 0 .../{ => tools}/dialogcutsplinepath.cpp | 0 src/dialogs/{ => tools}/dialogcutsplinepath.h | 0 .../{ => tools}/dialogcutsplinepath.ui | 0 src/dialogs/{ => tools}/dialogdetail.cpp | 0 src/dialogs/{ => tools}/dialogdetail.h | 0 src/dialogs/{ => tools}/dialogdetail.ui | 0 src/dialogs/{ => tools}/dialogendline.cpp | 0 src/dialogs/{ => tools}/dialogendline.h | 0 src/dialogs/{ => tools}/dialogendline.ui | 0 src/dialogs/{ => tools}/dialogheight.cpp | 0 src/dialogs/{ => tools}/dialogheight.h | 0 src/dialogs/{ => tools}/dialogheight.ui | 0 src/dialogs/{ => tools}/dialogline.cpp | 0 src/dialogs/{ => tools}/dialogline.h | 0 src/dialogs/{ => tools}/dialogline.ui | 0 .../{ => tools}/dialoglineintersect.cpp | 0 src/dialogs/{ => tools}/dialoglineintersect.h | 0 .../{ => tools}/dialoglineintersect.ui | 0 src/dialogs/{ => tools}/dialognormal.cpp | 0 src/dialogs/{ => tools}/dialognormal.h | 0 src/dialogs/{ => tools}/dialognormal.ui | 0 .../{ => tools}/dialogpointofcontact.cpp | 0 .../{ => tools}/dialogpointofcontact.h | 0 .../{ => tools}/dialogpointofcontact.ui | 0 .../{ => tools}/dialogpointofintersection.cpp | 0 .../{ => tools}/dialogpointofintersection.h | 0 .../{ => tools}/dialogpointofintersection.ui | 0 .../{ => tools}/dialogshoulderpoint.cpp | 0 src/dialogs/{ => tools}/dialogshoulderpoint.h | 0 .../{ => tools}/dialogshoulderpoint.ui | 0 src/dialogs/{ => tools}/dialogsinglepoint.cpp | 0 src/dialogs/{ => tools}/dialogsinglepoint.h | 0 src/dialogs/{ => tools}/dialogsinglepoint.ui | 0 src/dialogs/{ => tools}/dialogspline.cpp | 0 src/dialogs/{ => tools}/dialogspline.h | 0 src/dialogs/{ => tools}/dialogspline.ui | 0 src/dialogs/{ => tools}/dialogsplinepath.cpp | 2 +- src/dialogs/{ => tools}/dialogsplinepath.h | 2 +- src/dialogs/{ => tools}/dialogsplinepath.ui | 0 src/dialogs/{ => tools}/dialogtool.cpp | 6 +- src/dialogs/{ => tools}/dialogtool.h | 2 +- src/dialogs/{ => tools}/dialogtriangle.cpp | 0 src/dialogs/{ => tools}/dialogtriangle.h | 0 src/dialogs/{ => tools}/dialogtriangle.ui | 0 .../{ => tools}/dialoguniondetails.cpp | 0 src/dialogs/{ => tools}/dialoguniondetails.h | 0 src/dialogs/{ => tools}/dialoguniondetails.ui | 0 src/tools/drawTools/vdrawtool.h | 2 +- src/tools/drawTools/vtoolalongline.cpp | 2 +- src/tools/drawTools/vtoolarc.cpp | 2 +- src/tools/drawTools/vtoolbisector.cpp | 2 +- src/tools/drawTools/vtoolcutarc.cpp | 2 +- src/tools/drawTools/vtoolcutspline.cpp | 2 +- src/tools/drawTools/vtoolcutsplinepath.cpp | 2 +- src/tools/drawTools/vtoolendline.cpp | 2 +- src/tools/drawTools/vtoolheight.cpp | 2 +- src/tools/drawTools/vtoolline.cpp | 2 +- src/tools/drawTools/vtoolline.h | 2 +- src/tools/drawTools/vtoollineintersect.cpp | 2 +- src/tools/drawTools/vtoolnormal.cpp | 2 +- src/tools/drawTools/vtoolpointofcontact.cpp | 2 +- .../drawTools/vtoolpointofintersection.cpp | 2 +- src/tools/drawTools/vtoolshoulderpoint.cpp | 2 +- src/tools/drawTools/vtoolsinglepoint.cpp | 2 +- src/tools/drawTools/vtoolspline.cpp | 2 +- src/tools/drawTools/vtoolsplinepath.cpp | 2 +- src/tools/drawTools/vtooltriangle.cpp | 2 +- src/tools/vtooldetail.h | 2 +- src/tools/vtooluniondetails.h | 2 +- 105 files changed, 150 insertions(+), 149 deletions(-) rename src/dialogs/{ => app}/configdialog.cpp (100%) rename src/dialogs/{ => app}/configdialog.h (100%) rename src/dialogs/{ => app}/dialoghistory.cpp (98%) rename src/dialogs/{ => app}/dialoghistory.h (98%) rename src/dialogs/{ => app}/dialoghistory.ui (100%) rename src/dialogs/{ => app}/dialogincrements.cpp (99%) rename src/dialogs/{ => app}/dialogincrements.h (98%) rename src/dialogs/{ => app}/dialogincrements.ui (100%) rename src/dialogs/{ => app}/dialogmeasurements.cpp (100%) rename src/dialogs/{ => app}/dialogmeasurements.h (100%) rename src/dialogs/{ => app}/dialogmeasurements.ui (100%) rename src/dialogs/{ => app}/dialogpatternproperties.cpp (100%) rename src/dialogs/{ => app}/dialogpatternproperties.h (98%) rename src/dialogs/{ => app}/dialogpatternproperties.ui (100%) rename src/dialogs/{ => app}/dialogstandardmeasurements.cpp (100%) rename src/dialogs/{ => app}/dialogstandardmeasurements.h (100%) rename src/dialogs/{ => app}/dialogstandardmeasurements.ui (100%) rename src/dialogs/{ => app}/pages.cpp (99%) rename src/dialogs/{ => app}/pages.h (100%) rename src/dialogs/{ => tools}/dialogalongline.cpp (100%) rename src/dialogs/{ => tools}/dialogalongline.h (100%) rename src/dialogs/{ => tools}/dialogalongline.ui (100%) rename src/dialogs/{ => tools}/dialogarc.cpp (100%) rename src/dialogs/{ => tools}/dialogarc.h (100%) rename src/dialogs/{ => tools}/dialogarc.ui (100%) rename src/dialogs/{ => tools}/dialogbisector.cpp (100%) rename src/dialogs/{ => tools}/dialogbisector.h (100%) rename src/dialogs/{ => tools}/dialogbisector.ui (100%) rename src/dialogs/{ => tools}/dialogcutarc.cpp (100%) rename src/dialogs/{ => tools}/dialogcutarc.h (100%) rename src/dialogs/{ => tools}/dialogcutarc.ui (100%) rename src/dialogs/{ => tools}/dialogcutspline.cpp (100%) rename src/dialogs/{ => tools}/dialogcutspline.h (100%) rename src/dialogs/{ => tools}/dialogcutspline.ui (100%) rename src/dialogs/{ => tools}/dialogcutsplinepath.cpp (100%) rename src/dialogs/{ => tools}/dialogcutsplinepath.h (100%) rename src/dialogs/{ => tools}/dialogcutsplinepath.ui (100%) rename src/dialogs/{ => tools}/dialogdetail.cpp (100%) rename src/dialogs/{ => tools}/dialogdetail.h (100%) rename src/dialogs/{ => tools}/dialogdetail.ui (100%) rename src/dialogs/{ => tools}/dialogendline.cpp (100%) rename src/dialogs/{ => tools}/dialogendline.h (100%) rename src/dialogs/{ => tools}/dialogendline.ui (100%) rename src/dialogs/{ => tools}/dialogheight.cpp (100%) rename src/dialogs/{ => tools}/dialogheight.h (100%) rename src/dialogs/{ => tools}/dialogheight.ui (100%) rename src/dialogs/{ => tools}/dialogline.cpp (100%) rename src/dialogs/{ => tools}/dialogline.h (100%) rename src/dialogs/{ => tools}/dialogline.ui (100%) rename src/dialogs/{ => tools}/dialoglineintersect.cpp (100%) rename src/dialogs/{ => tools}/dialoglineintersect.h (100%) rename src/dialogs/{ => tools}/dialoglineintersect.ui (100%) rename src/dialogs/{ => tools}/dialognormal.cpp (100%) rename src/dialogs/{ => tools}/dialognormal.h (100%) rename src/dialogs/{ => tools}/dialognormal.ui (100%) rename src/dialogs/{ => tools}/dialogpointofcontact.cpp (100%) rename src/dialogs/{ => tools}/dialogpointofcontact.h (100%) rename src/dialogs/{ => tools}/dialogpointofcontact.ui (100%) rename src/dialogs/{ => tools}/dialogpointofintersection.cpp (100%) rename src/dialogs/{ => tools}/dialogpointofintersection.h (100%) rename src/dialogs/{ => tools}/dialogpointofintersection.ui (100%) rename src/dialogs/{ => tools}/dialogshoulderpoint.cpp (100%) rename src/dialogs/{ => tools}/dialogshoulderpoint.h (100%) rename src/dialogs/{ => tools}/dialogshoulderpoint.ui (100%) rename src/dialogs/{ => tools}/dialogsinglepoint.cpp (100%) rename src/dialogs/{ => tools}/dialogsinglepoint.h (100%) rename src/dialogs/{ => tools}/dialogsinglepoint.ui (100%) rename src/dialogs/{ => tools}/dialogspline.cpp (100%) rename src/dialogs/{ => tools}/dialogspline.h (100%) rename src/dialogs/{ => tools}/dialogspline.ui (100%) rename src/dialogs/{ => tools}/dialogsplinepath.cpp (99%) rename src/dialogs/{ => tools}/dialogsplinepath.h (99%) rename src/dialogs/{ => tools}/dialogsplinepath.ui (100%) rename src/dialogs/{ => tools}/dialogtool.cpp (99%) rename src/dialogs/{ => tools}/dialogtool.h (99%) rename src/dialogs/{ => tools}/dialogtriangle.cpp (100%) rename src/dialogs/{ => tools}/dialogtriangle.h (100%) rename src/dialogs/{ => tools}/dialogtriangle.ui (100%) rename src/dialogs/{ => tools}/dialoguniondetails.cpp (100%) rename src/dialogs/{ => tools}/dialoguniondetails.h (100%) rename src/dialogs/{ => tools}/dialoguniondetails.ui (100%) diff --git a/src/dialogs/configdialog.cpp b/src/dialogs/app/configdialog.cpp similarity index 100% rename from src/dialogs/configdialog.cpp rename to src/dialogs/app/configdialog.cpp diff --git a/src/dialogs/configdialog.h b/src/dialogs/app/configdialog.h similarity index 100% rename from src/dialogs/configdialog.h rename to src/dialogs/app/configdialog.h diff --git a/src/dialogs/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp similarity index 98% rename from src/dialogs/dialoghistory.cpp rename to src/dialogs/app/dialoghistory.cpp index 2a6794364..ac3e83325 100644 --- a/src/dialogs/dialoghistory.cpp +++ b/src/dialogs/app/dialoghistory.cpp @@ -28,13 +28,13 @@ #include "dialoghistory.h" #include "ui_dialoghistory.h" -#include "../geometry/varc.h" -#include "../geometry/vspline.h" -#include "../geometry/vsplinepath.h" -#include "../tools/vabstracttool.h" -#include "../tools/drawTools/vtoolcutspline.h" -#include "../tools/drawTools/vtoolcutsplinepath.h" -#include "../tools/drawTools/vtoolcutarc.h" +#include "../../geometry/varc.h" +#include "../../geometry/vspline.h" +#include "../../geometry/vsplinepath.h" +#include "../../tools/vabstracttool.h" +#include "../../tools/drawTools/vtoolcutspline.h" +#include "../../tools/drawTools/vtoolcutsplinepath.h" +#include "../../tools/drawTools/vtoolcutarc.h" #include #include diff --git a/src/dialogs/dialoghistory.h b/src/dialogs/app/dialoghistory.h similarity index 98% rename from src/dialogs/dialoghistory.h rename to src/dialogs/app/dialoghistory.h index 120fff0ee..5670c498c 100644 --- a/src/dialogs/dialoghistory.h +++ b/src/dialogs/app/dialoghistory.h @@ -29,8 +29,8 @@ #ifndef DIALOGHISTORY_H #define DIALOGHISTORY_H -#include "dialogtool.h" -#include "../xml/vdomdocument.h" +#include "../tools/dialogtool.h" +#include "../../xml/vdomdocument.h" namespace Ui { diff --git a/src/dialogs/dialoghistory.ui b/src/dialogs/app/dialoghistory.ui similarity index 100% rename from src/dialogs/dialoghistory.ui rename to src/dialogs/app/dialoghistory.ui diff --git a/src/dialogs/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp similarity index 99% rename from src/dialogs/dialogincrements.cpp rename to src/dialogs/app/dialogincrements.cpp index f33dda500..daf940cc1 100644 --- a/src/dialogs/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -28,9 +28,9 @@ #include "dialogincrements.h" #include "ui_dialogincrements.h" -#include "../widgets/doubledelegate.h" -#include "../widgets/textdelegate.h" -#include "../exception/vexception.h" +#include "../../widgets/doubledelegate.h" +#include "../../widgets/textdelegate.h" +#include "../../exception/vexception.h" #include diff --git a/src/dialogs/dialogincrements.h b/src/dialogs/app/dialogincrements.h similarity index 98% rename from src/dialogs/dialogincrements.h rename to src/dialogs/app/dialogincrements.h index 156e0c78f..5f42b9b08 100644 --- a/src/dialogs/dialogincrements.h +++ b/src/dialogs/app/dialogincrements.h @@ -29,8 +29,8 @@ #ifndef DIALOGINCREMENTS_H #define DIALOGINCREMENTS_H -#include "dialogtool.h" -#include "../xml/vdomdocument.h" +#include "../tools/dialogtool.h" +#include "../../xml/vdomdocument.h" namespace Ui { diff --git a/src/dialogs/dialogincrements.ui b/src/dialogs/app/dialogincrements.ui similarity index 100% rename from src/dialogs/dialogincrements.ui rename to src/dialogs/app/dialogincrements.ui diff --git a/src/dialogs/dialogmeasurements.cpp b/src/dialogs/app/dialogmeasurements.cpp similarity index 100% rename from src/dialogs/dialogmeasurements.cpp rename to src/dialogs/app/dialogmeasurements.cpp diff --git a/src/dialogs/dialogmeasurements.h b/src/dialogs/app/dialogmeasurements.h similarity index 100% rename from src/dialogs/dialogmeasurements.h rename to src/dialogs/app/dialogmeasurements.h diff --git a/src/dialogs/dialogmeasurements.ui b/src/dialogs/app/dialogmeasurements.ui similarity index 100% rename from src/dialogs/dialogmeasurements.ui rename to src/dialogs/app/dialogmeasurements.ui diff --git a/src/dialogs/dialogpatternproperties.cpp b/src/dialogs/app/dialogpatternproperties.cpp similarity index 100% rename from src/dialogs/dialogpatternproperties.cpp rename to src/dialogs/app/dialogpatternproperties.cpp diff --git a/src/dialogs/dialogpatternproperties.h b/src/dialogs/app/dialogpatternproperties.h similarity index 98% rename from src/dialogs/dialogpatternproperties.h rename to src/dialogs/app/dialogpatternproperties.h index d65c834d8..10f47fe07 100644 --- a/src/dialogs/dialogpatternproperties.h +++ b/src/dialogs/app/dialogpatternproperties.h @@ -30,7 +30,7 @@ #define DIALOGPATTERNPROPERTIES_H #include -#include "../xml/vdomdocument.h" +#include "../../xml/vdomdocument.h" namespace Ui { class DialogPatternProperties; diff --git a/src/dialogs/dialogpatternproperties.ui b/src/dialogs/app/dialogpatternproperties.ui similarity index 100% rename from src/dialogs/dialogpatternproperties.ui rename to src/dialogs/app/dialogpatternproperties.ui diff --git a/src/dialogs/dialogstandardmeasurements.cpp b/src/dialogs/app/dialogstandardmeasurements.cpp similarity index 100% rename from src/dialogs/dialogstandardmeasurements.cpp rename to src/dialogs/app/dialogstandardmeasurements.cpp diff --git a/src/dialogs/dialogstandardmeasurements.h b/src/dialogs/app/dialogstandardmeasurements.h similarity index 100% rename from src/dialogs/dialogstandardmeasurements.h rename to src/dialogs/app/dialogstandardmeasurements.h diff --git a/src/dialogs/dialogstandardmeasurements.ui b/src/dialogs/app/dialogstandardmeasurements.ui similarity index 100% rename from src/dialogs/dialogstandardmeasurements.ui rename to src/dialogs/app/dialogstandardmeasurements.ui diff --git a/src/dialogs/pages.cpp b/src/dialogs/app/pages.cpp similarity index 99% rename from src/dialogs/pages.cpp rename to src/dialogs/app/pages.cpp index eecaf4e58..f1772d289 100644 --- a/src/dialogs/pages.cpp +++ b/src/dialogs/app/pages.cpp @@ -27,7 +27,7 @@ *************************************************************************/ #include "pages.h" -#include "../options.h" +#include "../../options.h" ConfigurationPage::ConfigurationPage(QWidget *parent): QWidget(parent), autoSaveCheck(0), autoTime(0), langCombo(0), osOptionCheck(0), langChanged(false) diff --git a/src/dialogs/pages.h b/src/dialogs/app/pages.h similarity index 100% rename from src/dialogs/pages.h rename to src/dialogs/app/pages.h diff --git a/src/dialogs/dialogs.h b/src/dialogs/dialogs.h index 42bc0aa48..99f4ec34e 100644 --- a/src/dialogs/dialogs.h +++ b/src/dialogs/dialogs.h @@ -29,29 +29,30 @@ #ifndef DIALOGS_H #define DIALOGS_H -#include "dialogalongline.h" -#include "dialogarc.h" -#include "dialogbisector.h" -#include "dialogdetail.h" -#include "dialogendline.h" -#include "dialoghistory.h" -#include "dialogincrements.h" -#include "dialogline.h" -#include "dialoglineintersect.h" -#include "dialognormal.h" -#include "dialogpointofcontact.h" -#include "dialogshoulderpoint.h" -#include "dialogsinglepoint.h" -#include "dialogspline.h" -#include "dialogsplinepath.h" -#include "dialogheight.h" -#include "dialogcutarc.h" -#include "dialogcutspline.h" -#include "dialogcutsplinepath.h" -#include "dialoguniondetails.h" -#include "dialogtriangle.h" -#include "dialogpointofintersection.h" -#include "configdialog.h" -#include "dialogpatternproperties.h" +#include "tools/dialogalongline.h" +#include "tools/dialogarc.h" +#include "tools/dialogbisector.h" +#include "tools/dialogdetail.h" +#include "tools/dialogendline.h" +#include "tools/dialogline.h" +#include "tools/dialoglineintersect.h" +#include "tools/dialognormal.h" +#include "tools/dialogpointofcontact.h" +#include "tools/dialogshoulderpoint.h" +#include "tools/dialogsinglepoint.h" +#include "tools/dialogspline.h" +#include "tools/dialogsplinepath.h" +#include "tools/dialogheight.h" +#include "tools/dialogcutarc.h" +#include "tools/dialogcutspline.h" +#include "tools/dialogcutsplinepath.h" +#include "tools/dialoguniondetails.h" +#include "tools/dialogtriangle.h" +#include "tools/dialogpointofintersection.h" + +#include "app/dialoghistory.h" +#include "app/dialogincrements.h" +#include "app/configdialog.h" +#include "app/dialogpatternproperties.h" #endif // DIALOGS_H diff --git a/src/dialogs/dialogs.pri b/src/dialogs/dialogs.pri index 36ad18cd7..d4267b31c 100644 --- a/src/dialogs/dialogs.pri +++ b/src/dialogs/dialogs.pri @@ -1,87 +1,87 @@ HEADERS += \ - src/dialogs/dialogtriangle.h \ - src/dialogs/dialogtool.h \ - src/dialogs/dialogsplinepath.h \ - src/dialogs/dialogspline.h \ - src/dialogs/dialogsinglepoint.h \ - src/dialogs/dialogshoulderpoint.h \ src/dialogs/dialogs.h \ - src/dialogs/dialogpointofintersection.h \ - src/dialogs/dialogpointofcontact.h \ - src/dialogs/dialognormal.h \ - src/dialogs/dialoglineintersect.h \ - src/dialogs/dialogline.h \ - src/dialogs/dialogincrements.h \ - src/dialogs/dialoghistory.h \ - src/dialogs/dialogheight.h \ - src/dialogs/dialogendline.h \ - src/dialogs/dialogdetail.h \ - src/dialogs/dialogbisector.h \ - src/dialogs/dialogarc.h \ - src/dialogs/dialogalongline.h \ - src/dialogs/dialogcutspline.h \ - src/dialogs/dialogcutsplinepath.h \ - src/dialogs/dialoguniondetails.h \ - src/dialogs/dialogcutarc.h \ - src/dialogs/configdialog.h \ - src/dialogs/pages.h \ - src/dialogs/dialogpatternproperties.h \ - src/dialogs/dialogmeasurements.h \ - src/dialogs/dialogstandardmeasurements.h + src/dialogs/tools/dialogtriangle.h \ + src/dialogs/tools/dialogtool.h \ + src/dialogs/tools/dialogsplinepath.h \ + src/dialogs/tools/dialogspline.h \ + src/dialogs/tools/dialogsinglepoint.h \ + src/dialogs/tools/dialogshoulderpoint.h \ + src/dialogs/tools/dialogpointofintersection.h \ + src/dialogs/tools/dialogpointofcontact.h \ + src/dialogs/tools/dialognormal.h \ + src/dialogs/tools/dialoglineintersect.h \ + src/dialogs/tools/dialogline.h \ + src/dialogs/tools/dialogheight.h \ + src/dialogs/tools/dialogendline.h \ + src/dialogs/tools/dialogdetail.h \ + src/dialogs/tools/dialogbisector.h \ + src/dialogs/tools/dialogarc.h \ + src/dialogs/tools/dialogalongline.h \ + src/dialogs/tools/dialogcutspline.h \ + src/dialogs/tools/dialogcutsplinepath.h \ + src/dialogs/tools/dialoguniondetails.h \ + src/dialogs/tools/dialogcutarc.h \ + src/dialogs/app/dialogincrements.h \ + src/dialogs/app/dialoghistory.h \ + src/dialogs/app/configdialog.h \ + src/dialogs/app/pages.h \ + src/dialogs/app/dialogpatternproperties.h \ + src/dialogs/app/dialogmeasurements.h \ + src/dialogs/app/dialogstandardmeasurements.h SOURCES += \ - src/dialogs/dialogtriangle.cpp \ - src/dialogs/dialogtool.cpp \ - src/dialogs/dialogsplinepath.cpp \ - src/dialogs/dialogspline.cpp \ - src/dialogs/dialogsinglepoint.cpp \ - src/dialogs/dialogshoulderpoint.cpp \ - src/dialogs/dialogpointofintersection.cpp \ - src/dialogs/dialogpointofcontact.cpp \ - src/dialogs/dialognormal.cpp \ - src/dialogs/dialoglineintersect.cpp \ - src/dialogs/dialogline.cpp \ - src/dialogs/dialogincrements.cpp \ - src/dialogs/dialoghistory.cpp \ - src/dialogs/dialogheight.cpp \ - src/dialogs/dialogendline.cpp \ - src/dialogs/dialogdetail.cpp \ - src/dialogs/dialogbisector.cpp \ - src/dialogs/dialogarc.cpp \ - src/dialogs/dialogalongline.cpp \ - src/dialogs/dialogcutspline.cpp \ - src/dialogs/dialogcutsplinepath.cpp \ - src/dialogs/dialoguniondetails.cpp \ - src/dialogs/dialogcutarc.cpp \ - src/dialogs/configdialog.cpp \ - src/dialogs/pages.cpp \ - src/dialogs/dialogpatternproperties.cpp \ - src/dialogs/dialogmeasurements.cpp \ - src/dialogs/dialogstandardmeasurements.cpp + src/dialogs/tools/dialogtriangle.cpp \ + src/dialogs/tools/dialogtool.cpp \ + src/dialogs/tools/dialogsplinepath.cpp \ + src/dialogs/tools/dialogspline.cpp \ + src/dialogs/tools/dialogsinglepoint.cpp \ + src/dialogs/tools/dialogshoulderpoint.cpp \ + src/dialogs/tools/dialogpointofintersection.cpp \ + src/dialogs/tools/dialogpointofcontact.cpp \ + src/dialogs/tools/dialognormal.cpp \ + src/dialogs/tools/dialoglineintersect.cpp \ + src/dialogs/tools/dialogline.cpp \ + src/dialogs/tools/dialogheight.cpp \ + src/dialogs/tools/dialogendline.cpp \ + src/dialogs/tools/dialogdetail.cpp \ + src/dialogs/tools/dialogbisector.cpp \ + src/dialogs/tools/dialogarc.cpp \ + src/dialogs/tools/dialogalongline.cpp \ + src/dialogs/tools/dialogcutspline.cpp \ + src/dialogs/tools/dialogcutsplinepath.cpp \ + src/dialogs/tools/dialoguniondetails.cpp \ + src/dialogs/tools/dialogcutarc.cpp \ + src/dialogs/app/dialogincrements.cpp \ + src/dialogs/app/dialoghistory.cpp \ + src/dialogs/app/configdialog.cpp \ + src/dialogs/app/pages.cpp \ + src/dialogs/app/dialogpatternproperties.cpp \ + src/dialogs/app/dialogmeasurements.cpp \ + src/dialogs/app/dialogstandardmeasurements.cpp FORMS += \ - src/dialogs/dialogtriangle.ui \ - src/dialogs/dialogsplinepath.ui \ - src/dialogs/dialogspline.ui \ - src/dialogs/dialogsinglepoint.ui \ - src/dialogs/dialogshoulderpoint.ui \ - src/dialogs/dialogpointofintersection.ui \ - src/dialogs/dialogpointofcontact.ui \ - src/dialogs/dialognormal.ui \ - src/dialogs/dialoglineintersect.ui \ - src/dialogs/dialogline.ui \ - src/dialogs/dialogincrements.ui \ - src/dialogs/dialoghistory.ui \ - src/dialogs/dialogheight.ui \ - src/dialogs/dialogendline.ui \ - src/dialogs/dialogdetail.ui \ - src/dialogs/dialogbisector.ui \ - src/dialogs/dialogarc.ui \ - src/dialogs/dialogalongline.ui \ - src/dialogs/dialogcutspline.ui \ - src/dialogs/dialogcutsplinepath.ui \ - src/dialogs/dialoguniondetails.ui \ - src/dialogs/dialogcutarc.ui \ - src/dialogs/dialogpatternproperties.ui \ - src/dialogs/dialogmeasurements.ui \ - src/dialogs/dialogstandardmeasurements.ui + src/dialogs/tools/dialogtriangle.ui \ + src/dialogs/tools/dialogsplinepath.ui \ + src/dialogs/tools/dialogspline.ui \ + src/dialogs/tools/dialogsinglepoint.ui \ + src/dialogs/tools/dialogshoulderpoint.ui \ + src/dialogs/tools/dialogpointofintersection.ui \ + src/dialogs/tools/dialogpointofcontact.ui \ + src/dialogs/tools/dialognormal.ui \ + src/dialogs/tools/dialoglineintersect.ui \ + src/dialogs/tools/dialogline.ui \ + src/dialogs/tools/dialogheight.ui \ + src/dialogs/tools/dialogendline.ui \ + src/dialogs/tools/dialogdetail.ui \ + src/dialogs/tools/dialogbisector.ui \ + src/dialogs/tools/dialogarc.ui \ + src/dialogs/tools/dialogalongline.ui \ + src/dialogs/tools/dialogcutspline.ui \ + src/dialogs/tools/dialogcutsplinepath.ui \ + src/dialogs/tools/dialoguniondetails.ui \ + src/dialogs/tools/dialogcutarc.ui \ + src/dialogs/app/dialogincrements.ui \ + src/dialogs/app/dialoghistory.ui \ + src/dialogs/app/dialogpatternproperties.ui \ + src/dialogs/app/dialogmeasurements.ui \ + src/dialogs/app/dialogstandardmeasurements.ui diff --git a/src/dialogs/dialogalongline.cpp b/src/dialogs/tools/dialogalongline.cpp similarity index 100% rename from src/dialogs/dialogalongline.cpp rename to src/dialogs/tools/dialogalongline.cpp diff --git a/src/dialogs/dialogalongline.h b/src/dialogs/tools/dialogalongline.h similarity index 100% rename from src/dialogs/dialogalongline.h rename to src/dialogs/tools/dialogalongline.h diff --git a/src/dialogs/dialogalongline.ui b/src/dialogs/tools/dialogalongline.ui similarity index 100% rename from src/dialogs/dialogalongline.ui rename to src/dialogs/tools/dialogalongline.ui diff --git a/src/dialogs/dialogarc.cpp b/src/dialogs/tools/dialogarc.cpp similarity index 100% rename from src/dialogs/dialogarc.cpp rename to src/dialogs/tools/dialogarc.cpp diff --git a/src/dialogs/dialogarc.h b/src/dialogs/tools/dialogarc.h similarity index 100% rename from src/dialogs/dialogarc.h rename to src/dialogs/tools/dialogarc.h diff --git a/src/dialogs/dialogarc.ui b/src/dialogs/tools/dialogarc.ui similarity index 100% rename from src/dialogs/dialogarc.ui rename to src/dialogs/tools/dialogarc.ui diff --git a/src/dialogs/dialogbisector.cpp b/src/dialogs/tools/dialogbisector.cpp similarity index 100% rename from src/dialogs/dialogbisector.cpp rename to src/dialogs/tools/dialogbisector.cpp diff --git a/src/dialogs/dialogbisector.h b/src/dialogs/tools/dialogbisector.h similarity index 100% rename from src/dialogs/dialogbisector.h rename to src/dialogs/tools/dialogbisector.h diff --git a/src/dialogs/dialogbisector.ui b/src/dialogs/tools/dialogbisector.ui similarity index 100% rename from src/dialogs/dialogbisector.ui rename to src/dialogs/tools/dialogbisector.ui diff --git a/src/dialogs/dialogcutarc.cpp b/src/dialogs/tools/dialogcutarc.cpp similarity index 100% rename from src/dialogs/dialogcutarc.cpp rename to src/dialogs/tools/dialogcutarc.cpp diff --git a/src/dialogs/dialogcutarc.h b/src/dialogs/tools/dialogcutarc.h similarity index 100% rename from src/dialogs/dialogcutarc.h rename to src/dialogs/tools/dialogcutarc.h diff --git a/src/dialogs/dialogcutarc.ui b/src/dialogs/tools/dialogcutarc.ui similarity index 100% rename from src/dialogs/dialogcutarc.ui rename to src/dialogs/tools/dialogcutarc.ui diff --git a/src/dialogs/dialogcutspline.cpp b/src/dialogs/tools/dialogcutspline.cpp similarity index 100% rename from src/dialogs/dialogcutspline.cpp rename to src/dialogs/tools/dialogcutspline.cpp diff --git a/src/dialogs/dialogcutspline.h b/src/dialogs/tools/dialogcutspline.h similarity index 100% rename from src/dialogs/dialogcutspline.h rename to src/dialogs/tools/dialogcutspline.h diff --git a/src/dialogs/dialogcutspline.ui b/src/dialogs/tools/dialogcutspline.ui similarity index 100% rename from src/dialogs/dialogcutspline.ui rename to src/dialogs/tools/dialogcutspline.ui diff --git a/src/dialogs/dialogcutsplinepath.cpp b/src/dialogs/tools/dialogcutsplinepath.cpp similarity index 100% rename from src/dialogs/dialogcutsplinepath.cpp rename to src/dialogs/tools/dialogcutsplinepath.cpp diff --git a/src/dialogs/dialogcutsplinepath.h b/src/dialogs/tools/dialogcutsplinepath.h similarity index 100% rename from src/dialogs/dialogcutsplinepath.h rename to src/dialogs/tools/dialogcutsplinepath.h diff --git a/src/dialogs/dialogcutsplinepath.ui b/src/dialogs/tools/dialogcutsplinepath.ui similarity index 100% rename from src/dialogs/dialogcutsplinepath.ui rename to src/dialogs/tools/dialogcutsplinepath.ui diff --git a/src/dialogs/dialogdetail.cpp b/src/dialogs/tools/dialogdetail.cpp similarity index 100% rename from src/dialogs/dialogdetail.cpp rename to src/dialogs/tools/dialogdetail.cpp diff --git a/src/dialogs/dialogdetail.h b/src/dialogs/tools/dialogdetail.h similarity index 100% rename from src/dialogs/dialogdetail.h rename to src/dialogs/tools/dialogdetail.h diff --git a/src/dialogs/dialogdetail.ui b/src/dialogs/tools/dialogdetail.ui similarity index 100% rename from src/dialogs/dialogdetail.ui rename to src/dialogs/tools/dialogdetail.ui diff --git a/src/dialogs/dialogendline.cpp b/src/dialogs/tools/dialogendline.cpp similarity index 100% rename from src/dialogs/dialogendline.cpp rename to src/dialogs/tools/dialogendline.cpp diff --git a/src/dialogs/dialogendline.h b/src/dialogs/tools/dialogendline.h similarity index 100% rename from src/dialogs/dialogendline.h rename to src/dialogs/tools/dialogendline.h diff --git a/src/dialogs/dialogendline.ui b/src/dialogs/tools/dialogendline.ui similarity index 100% rename from src/dialogs/dialogendline.ui rename to src/dialogs/tools/dialogendline.ui diff --git a/src/dialogs/dialogheight.cpp b/src/dialogs/tools/dialogheight.cpp similarity index 100% rename from src/dialogs/dialogheight.cpp rename to src/dialogs/tools/dialogheight.cpp diff --git a/src/dialogs/dialogheight.h b/src/dialogs/tools/dialogheight.h similarity index 100% rename from src/dialogs/dialogheight.h rename to src/dialogs/tools/dialogheight.h diff --git a/src/dialogs/dialogheight.ui b/src/dialogs/tools/dialogheight.ui similarity index 100% rename from src/dialogs/dialogheight.ui rename to src/dialogs/tools/dialogheight.ui diff --git a/src/dialogs/dialogline.cpp b/src/dialogs/tools/dialogline.cpp similarity index 100% rename from src/dialogs/dialogline.cpp rename to src/dialogs/tools/dialogline.cpp diff --git a/src/dialogs/dialogline.h b/src/dialogs/tools/dialogline.h similarity index 100% rename from src/dialogs/dialogline.h rename to src/dialogs/tools/dialogline.h diff --git a/src/dialogs/dialogline.ui b/src/dialogs/tools/dialogline.ui similarity index 100% rename from src/dialogs/dialogline.ui rename to src/dialogs/tools/dialogline.ui diff --git a/src/dialogs/dialoglineintersect.cpp b/src/dialogs/tools/dialoglineintersect.cpp similarity index 100% rename from src/dialogs/dialoglineintersect.cpp rename to src/dialogs/tools/dialoglineintersect.cpp diff --git a/src/dialogs/dialoglineintersect.h b/src/dialogs/tools/dialoglineintersect.h similarity index 100% rename from src/dialogs/dialoglineintersect.h rename to src/dialogs/tools/dialoglineintersect.h diff --git a/src/dialogs/dialoglineintersect.ui b/src/dialogs/tools/dialoglineintersect.ui similarity index 100% rename from src/dialogs/dialoglineintersect.ui rename to src/dialogs/tools/dialoglineintersect.ui diff --git a/src/dialogs/dialognormal.cpp b/src/dialogs/tools/dialognormal.cpp similarity index 100% rename from src/dialogs/dialognormal.cpp rename to src/dialogs/tools/dialognormal.cpp diff --git a/src/dialogs/dialognormal.h b/src/dialogs/tools/dialognormal.h similarity index 100% rename from src/dialogs/dialognormal.h rename to src/dialogs/tools/dialognormal.h diff --git a/src/dialogs/dialognormal.ui b/src/dialogs/tools/dialognormal.ui similarity index 100% rename from src/dialogs/dialognormal.ui rename to src/dialogs/tools/dialognormal.ui diff --git a/src/dialogs/dialogpointofcontact.cpp b/src/dialogs/tools/dialogpointofcontact.cpp similarity index 100% rename from src/dialogs/dialogpointofcontact.cpp rename to src/dialogs/tools/dialogpointofcontact.cpp diff --git a/src/dialogs/dialogpointofcontact.h b/src/dialogs/tools/dialogpointofcontact.h similarity index 100% rename from src/dialogs/dialogpointofcontact.h rename to src/dialogs/tools/dialogpointofcontact.h diff --git a/src/dialogs/dialogpointofcontact.ui b/src/dialogs/tools/dialogpointofcontact.ui similarity index 100% rename from src/dialogs/dialogpointofcontact.ui rename to src/dialogs/tools/dialogpointofcontact.ui diff --git a/src/dialogs/dialogpointofintersection.cpp b/src/dialogs/tools/dialogpointofintersection.cpp similarity index 100% rename from src/dialogs/dialogpointofintersection.cpp rename to src/dialogs/tools/dialogpointofintersection.cpp diff --git a/src/dialogs/dialogpointofintersection.h b/src/dialogs/tools/dialogpointofintersection.h similarity index 100% rename from src/dialogs/dialogpointofintersection.h rename to src/dialogs/tools/dialogpointofintersection.h diff --git a/src/dialogs/dialogpointofintersection.ui b/src/dialogs/tools/dialogpointofintersection.ui similarity index 100% rename from src/dialogs/dialogpointofintersection.ui rename to src/dialogs/tools/dialogpointofintersection.ui diff --git a/src/dialogs/dialogshoulderpoint.cpp b/src/dialogs/tools/dialogshoulderpoint.cpp similarity index 100% rename from src/dialogs/dialogshoulderpoint.cpp rename to src/dialogs/tools/dialogshoulderpoint.cpp diff --git a/src/dialogs/dialogshoulderpoint.h b/src/dialogs/tools/dialogshoulderpoint.h similarity index 100% rename from src/dialogs/dialogshoulderpoint.h rename to src/dialogs/tools/dialogshoulderpoint.h diff --git a/src/dialogs/dialogshoulderpoint.ui b/src/dialogs/tools/dialogshoulderpoint.ui similarity index 100% rename from src/dialogs/dialogshoulderpoint.ui rename to src/dialogs/tools/dialogshoulderpoint.ui diff --git a/src/dialogs/dialogsinglepoint.cpp b/src/dialogs/tools/dialogsinglepoint.cpp similarity index 100% rename from src/dialogs/dialogsinglepoint.cpp rename to src/dialogs/tools/dialogsinglepoint.cpp diff --git a/src/dialogs/dialogsinglepoint.h b/src/dialogs/tools/dialogsinglepoint.h similarity index 100% rename from src/dialogs/dialogsinglepoint.h rename to src/dialogs/tools/dialogsinglepoint.h diff --git a/src/dialogs/dialogsinglepoint.ui b/src/dialogs/tools/dialogsinglepoint.ui similarity index 100% rename from src/dialogs/dialogsinglepoint.ui rename to src/dialogs/tools/dialogsinglepoint.ui diff --git a/src/dialogs/dialogspline.cpp b/src/dialogs/tools/dialogspline.cpp similarity index 100% rename from src/dialogs/dialogspline.cpp rename to src/dialogs/tools/dialogspline.cpp diff --git a/src/dialogs/dialogspline.h b/src/dialogs/tools/dialogspline.h similarity index 100% rename from src/dialogs/dialogspline.h rename to src/dialogs/tools/dialogspline.h diff --git a/src/dialogs/dialogspline.ui b/src/dialogs/tools/dialogspline.ui similarity index 100% rename from src/dialogs/dialogspline.ui rename to src/dialogs/tools/dialogspline.ui diff --git a/src/dialogs/dialogsplinepath.cpp b/src/dialogs/tools/dialogsplinepath.cpp similarity index 99% rename from src/dialogs/dialogsplinepath.cpp rename to src/dialogs/tools/dialogsplinepath.cpp index 058dc5a9a..7f80afc83 100644 --- a/src/dialogs/dialogsplinepath.cpp +++ b/src/dialogs/tools/dialogsplinepath.cpp @@ -28,7 +28,7 @@ #include "dialogsplinepath.h" #include "ui_dialogsplinepath.h" -#include "../geometry/vsplinepoint.h" +#include "../../geometry/vsplinepoint.h" #include diff --git a/src/dialogs/dialogsplinepath.h b/src/dialogs/tools/dialogsplinepath.h similarity index 99% rename from src/dialogs/dialogsplinepath.h rename to src/dialogs/tools/dialogsplinepath.h index c88713f55..fe33e24d6 100644 --- a/src/dialogs/dialogsplinepath.h +++ b/src/dialogs/tools/dialogsplinepath.h @@ -30,7 +30,7 @@ #define DIALOGSPLINEPATH_H #include "dialogtool.h" -#include "../geometry/vsplinepath.h" +#include "../../geometry/vsplinepath.h" namespace Ui { diff --git a/src/dialogs/dialogsplinepath.ui b/src/dialogs/tools/dialogsplinepath.ui similarity index 100% rename from src/dialogs/dialogsplinepath.ui rename to src/dialogs/tools/dialogsplinepath.ui diff --git a/src/dialogs/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp similarity index 99% rename from src/dialogs/dialogtool.cpp rename to src/dialogs/tools/dialogtool.cpp index 18f1cfdf5..1e721d7e5 100644 --- a/src/dialogs/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -27,9 +27,9 @@ *************************************************************************/ #include "dialogtool.h" -#include "../container/calculator.h" -#include "../geometry/vgobject.h" -#include "../tools/vabstracttool.h" +#include "../../container/calculator.h" +#include "../../geometry/vgobject.h" +#include "../../tools/vabstracttool.h" #include diff --git a/src/dialogs/dialogtool.h b/src/dialogs/tools/dialogtool.h similarity index 99% rename from src/dialogs/dialogtool.h rename to src/dialogs/tools/dialogtool.h index ef8346c0d..613dcdbac 100644 --- a/src/dialogs/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -35,7 +35,7 @@ #include #include #include -#include "../container/vcontainer.h" +#include "../../container/vcontainer.h" namespace ComboMode { diff --git a/src/dialogs/dialogtriangle.cpp b/src/dialogs/tools/dialogtriangle.cpp similarity index 100% rename from src/dialogs/dialogtriangle.cpp rename to src/dialogs/tools/dialogtriangle.cpp diff --git a/src/dialogs/dialogtriangle.h b/src/dialogs/tools/dialogtriangle.h similarity index 100% rename from src/dialogs/dialogtriangle.h rename to src/dialogs/tools/dialogtriangle.h diff --git a/src/dialogs/dialogtriangle.ui b/src/dialogs/tools/dialogtriangle.ui similarity index 100% rename from src/dialogs/dialogtriangle.ui rename to src/dialogs/tools/dialogtriangle.ui diff --git a/src/dialogs/dialoguniondetails.cpp b/src/dialogs/tools/dialoguniondetails.cpp similarity index 100% rename from src/dialogs/dialoguniondetails.cpp rename to src/dialogs/tools/dialoguniondetails.cpp diff --git a/src/dialogs/dialoguniondetails.h b/src/dialogs/tools/dialoguniondetails.h similarity index 100% rename from src/dialogs/dialoguniondetails.h rename to src/dialogs/tools/dialoguniondetails.h diff --git a/src/dialogs/dialoguniondetails.ui b/src/dialogs/tools/dialoguniondetails.ui similarity index 100% rename from src/dialogs/dialoguniondetails.ui rename to src/dialogs/tools/dialoguniondetails.ui diff --git a/src/tools/drawTools/vdrawtool.h b/src/tools/drawTools/vdrawtool.h index 3e24c9b59..4b5ec40e4 100644 --- a/src/tools/drawTools/vdrawtool.h +++ b/src/tools/drawTools/vdrawtool.h @@ -33,7 +33,7 @@ #include #include -#include "../../dialogs/dialogtool.h" +#include "../../dialogs/tools/dialogtool.h" /** * @brief The VDrawTool abstract class for all draw tool. diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index 1b75c1ed7..dbdc36561 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -28,7 +28,7 @@ #include "vtoolalongline.h" #include "../../container/calculator.h" -#include "../../dialogs/dialogalongline.h" +#include "../../dialogs/tools/dialogalongline.h" const QString VToolAlongLine::ToolType = QStringLiteral("alongLine"); diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index 1bfdc066b..c5c6b0aa1 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -28,7 +28,7 @@ #include "vtoolarc.h" #include "../../container/calculator.h" -#include "../../dialogs/dialogarc.h" +#include "../../dialogs/tools/dialogarc.h" const QString VToolArc::TagName = QStringLiteral("arc"); const QString VToolArc::ToolType = QStringLiteral("simple"); diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index 44b28bac6..ad169ae5b 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -28,7 +28,7 @@ #include "vtoolbisector.h" #include "../../container/calculator.h" -#include "../../dialogs/dialogbisector.h" +#include "../../dialogs/tools/dialogbisector.h" const QString VToolBisector::ToolType = QStringLiteral("bisector"); diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index bd75d9152..52772a577 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -28,7 +28,7 @@ #include "vtoolcutarc.h" #include "../../container/calculator.h" -#include "../../dialogs/dialogcutarc.h" +#include "../../dialogs/tools/dialogcutarc.h" const QString VToolCutArc::ToolType = QStringLiteral("cutArc"); const QString VToolCutArc::AttrArc = QStringLiteral("arc"); diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index efa9ca3c6..1783a4e19 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -28,7 +28,7 @@ #include "vtoolcutspline.h" #include "../../container/calculator.h" -#include "../../dialogs/dialogcutspline.h" +#include "../../dialogs/tools/dialogcutspline.h" const QString VToolCutSpline::ToolType = QStringLiteral("cutSpline"); const QString VToolCutSpline::AttrSpline = QStringLiteral("spline"); diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index ae49c70c7..0f401b42f 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -28,7 +28,7 @@ #include "vtoolcutsplinepath.h" #include "../../container/calculator.h" -#include "../../dialogs/dialogcutsplinepath.h" +#include "../../dialogs/tools/dialogcutsplinepath.h" const QString VToolCutSplinePath::ToolType = QStringLiteral("cutSplinePath"); const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath"); diff --git a/src/tools/drawTools/vtoolendline.cpp b/src/tools/drawTools/vtoolendline.cpp index efe9c6a9b..1f3d4d97c 100644 --- a/src/tools/drawTools/vtoolendline.cpp +++ b/src/tools/drawTools/vtoolendline.cpp @@ -29,7 +29,7 @@ #include "vtoolendline.h" #include "../../widgets/vmaingraphicsscene.h" #include "../../container/calculator.h" -#include "../../dialogs/dialogendline.h" +#include "../../dialogs/tools/dialogendline.h" const QString VToolEndLine::ToolType = QStringLiteral("endLine"); diff --git a/src/tools/drawTools/vtoolheight.cpp b/src/tools/drawTools/vtoolheight.cpp index 089218d64..d81505585 100644 --- a/src/tools/drawTools/vtoolheight.cpp +++ b/src/tools/drawTools/vtoolheight.cpp @@ -27,7 +27,7 @@ *************************************************************************/ #include "vtoolheight.h" -#include "../../dialogs/dialogheight.h" +#include "../../dialogs/tools/dialogheight.h" const QString VToolHeight::ToolType = QStringLiteral("height"); diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index c9fece4ca..47cb56a2a 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -27,7 +27,7 @@ *************************************************************************/ #include "vtoolline.h" -#include "../../dialogs/dialogline.h" +#include "../../dialogs/tools/dialogline.h" const QString VToolLine::TagName = QStringLiteral("line"); diff --git a/src/tools/drawTools/vtoolline.h b/src/tools/drawTools/vtoolline.h index 169cc77f0..1b8534c5c 100644 --- a/src/tools/drawTools/vtoolline.h +++ b/src/tools/drawTools/vtoolline.h @@ -31,7 +31,7 @@ #include "vdrawtool.h" #include -#include "../../dialogs/dialogline.h" +#include "../../dialogs/tools/dialogline.h" /** * @brief The VToolLine class tool for creation line. diff --git a/src/tools/drawTools/vtoollineintersect.cpp b/src/tools/drawTools/vtoollineintersect.cpp index a947d08ef..716b19386 100644 --- a/src/tools/drawTools/vtoollineintersect.cpp +++ b/src/tools/drawTools/vtoollineintersect.cpp @@ -27,7 +27,7 @@ *************************************************************************/ #include "vtoollineintersect.h" -#include "../../dialogs/dialoglineintersect.h" +#include "../../dialogs/tools/dialoglineintersect.h" const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect"); diff --git a/src/tools/drawTools/vtoolnormal.cpp b/src/tools/drawTools/vtoolnormal.cpp index 38b84591e..af31122f0 100644 --- a/src/tools/drawTools/vtoolnormal.cpp +++ b/src/tools/drawTools/vtoolnormal.cpp @@ -28,7 +28,7 @@ #include "vtoolnormal.h" #include "../../container/calculator.h" -#include "../../dialogs/dialognormal.h" +#include "../../dialogs/tools/dialognormal.h" const QString VToolNormal::ToolType = QStringLiteral("normal"); diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index 3516678a3..5fe5dba03 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -28,7 +28,7 @@ #include "vtoolpointofcontact.h" #include "../../container/calculator.h" -#include "../../dialogs/dialogpointofcontact.h" +#include "../../dialogs/tools/dialogpointofcontact.h" const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact"); diff --git a/src/tools/drawTools/vtoolpointofintersection.cpp b/src/tools/drawTools/vtoolpointofintersection.cpp index c9e84e23e..7f374a654 100644 --- a/src/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/tools/drawTools/vtoolpointofintersection.cpp @@ -27,7 +27,7 @@ *************************************************************************/ #include "vtoolpointofintersection.h" -#include "../../dialogs/dialogpointofintersection.h" +#include "../../dialogs/tools/dialogpointofintersection.h" const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection"); diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 9de69427e..98ca0ce68 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -28,7 +28,7 @@ #include "vtoolshoulderpoint.h" #include "../../container/calculator.h" -#include "../../dialogs/dialogshoulderpoint.h" +#include "../../dialogs/tools/dialogshoulderpoint.h" const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder"); diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index e56d7c3f8..38922455b 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -27,7 +27,7 @@ *************************************************************************/ #include "vtoolsinglepoint.h" -#include "../../dialogs/dialogsinglepoint.h" +#include "../../dialogs/tools/dialogsinglepoint.h" const QString VToolSinglePoint::ToolType = QStringLiteral("single"); diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index a8392d7ca..02760da64 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -28,7 +28,7 @@ #include "vtoolspline.h" #include "../../geometry/vspline.h" -#include "../../dialogs/dialogspline.h" +#include "../../dialogs/tools/dialogspline.h" const QString VToolSpline::TagName = QStringLiteral("spline"); const QString VToolSpline::ToolType = QStringLiteral("simple"); diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index d7f2dac6b..4316905f5 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -27,7 +27,7 @@ *************************************************************************/ #include "vtoolsplinepath.h" -#include "../../dialogs/dialogsplinepath.h" +#include "../../dialogs/tools/dialogsplinepath.h" const QString VToolSplinePath::TagName = QStringLiteral("spline"); const QString VToolSplinePath::ToolType = QStringLiteral("path"); diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index b980b8d8d..c0be5dd83 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -27,7 +27,7 @@ *************************************************************************/ #include "vtooltriangle.h" -#include "../../dialogs/dialogtriangle.h" +#include "../../dialogs/tools/dialogtriangle.h" const QString VToolTriangle::ToolType = QStringLiteral("triangle"); diff --git a/src/tools/vtooldetail.h b/src/tools/vtooldetail.h index 2ae074f72..c600aeb96 100644 --- a/src/tools/vtooldetail.h +++ b/src/tools/vtooldetail.h @@ -31,7 +31,7 @@ #include "vabstracttool.h" #include -#include "../dialogs/dialogdetail.h" +#include "../dialogs/tools/dialogdetail.h" /** * @brief The VToolDetail class for working with detail. diff --git a/src/tools/vtooluniondetails.h b/src/tools/vtooluniondetails.h index 98c4b3eac..5a7c68f8b 100644 --- a/src/tools/vtooluniondetails.h +++ b/src/tools/vtooluniondetails.h @@ -30,7 +30,7 @@ #define VTOOLUNIONDETAILS_H #include "vabstracttool.h" -#include "../dialogs/dialoguniondetails.h" +#include "../dialogs/tools/dialoguniondetails.h" /** * @brief The VToolUnionDetails class tool union details. From 41c80d040f200856fe9efce4ba5209605e6825f3 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 21 Feb 2014 16:55:48 +0200 Subject: [PATCH 04/60] Almost implemented dialog standard measurements. --HG-- branch : feature --- .../app/dialogstandardmeasurements.cpp | 97 ++++++++++++++++++- src/dialogs/app/dialogstandardmeasurements.h | 11 ++- src/dialogs/app/dialogstandardmeasurements.ui | 4 +- 3 files changed, 106 insertions(+), 6 deletions(-) diff --git a/src/dialogs/app/dialogstandardmeasurements.cpp b/src/dialogs/app/dialogstandardmeasurements.cpp index c5d7c5091..d42aa12d9 100644 --- a/src/dialogs/app/dialogstandardmeasurements.cpp +++ b/src/dialogs/app/dialogstandardmeasurements.cpp @@ -28,15 +28,108 @@ #include "dialogstandardmeasurements.h" #include "ui_dialogstandardmeasurements.h" +#include DialogStandardMeasurements::DialogStandardMeasurements(QWidget *parent) : - QDialog(parent), - ui(new Ui::DialogStandardMeasurements) + QDialog(parent), ui(new Ui::DialogStandardMeasurements), _name(QString()), _tablePath(QString()) { ui->setupUi(this); + + { + const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); + Q_CHECK_PTR(bOk); + connect(bOk, &QPushButton::clicked, this, &DialogStandardMeasurements::Accepted); + } + { + const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); + Q_CHECK_PTR(bCansel); + connect(bCansel, &QPushButton::clicked, this, &DialogStandardMeasurements::Rejected); + } + + LoadStandardTables(); + + CheckState(); } DialogStandardMeasurements::~DialogStandardMeasurements() { delete ui; } + +QString DialogStandardMeasurements::name() const +{ + return _name; +} + +QString DialogStandardMeasurements::tablePath() const +{ + return _tablePath; +} + +void DialogStandardMeasurements::Accepted() +{ + _name = ui->lineEditName->text(); + _tablePath = "path"; + accept(); +} + +void DialogStandardMeasurements::Rejected() +{ + _name = ""; + _tablePath = ""; + reject(); +} + +void DialogStandardMeasurements::CheckState() +{ + bool flagName = false; + if (ui->lineEditName->text().isEmpty() == false) + { + flagName = true; + } + + bool flagTable = false; + { + const QComboBox *box = ui->comboBoxTables; + Q_CHECK_PTR(box); + if (box->count() > 0 && box->currentIndex() != -1) + { + flagTable = true; + } + } + + QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); + Q_CHECK_PTR(bOk); + bOk->setEnabled(flagTable && flagName); +} + +void DialogStandardMeasurements::LoadStandardTables() +{ +#ifdef Q_OS_WIN32 + const QString pathToTables = QString("/standard_tables"); +#else + #ifdef QT_DEBUG + const QString pathToTables = QString("/standard_tables"); + #else + const QString pathToTables = QString("/usr/share/valentina/standard_tables"); + #endif +#endif + QDir tablesDir(pathToTables); + { + QStringList filters; + filters << "*.cpp"; + tablesDir.setNameFilters(filters); + } + const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files); + if (allFiles.isEmpty() == true) + { + ui->comboBoxTables->clear(); + CheckState(); + return; + } + + for (int i = 0; i < allFiles.size(); ++i) + { + + } +} diff --git a/src/dialogs/app/dialogstandardmeasurements.h b/src/dialogs/app/dialogstandardmeasurements.h index deb50e5b4..357ca732e 100644 --- a/src/dialogs/app/dialogstandardmeasurements.h +++ b/src/dialogs/app/dialogstandardmeasurements.h @@ -38,13 +38,20 @@ class DialogStandardMeasurements; class DialogStandardMeasurements : public QDialog { Q_OBJECT - public: explicit DialogStandardMeasurements(QWidget *parent = 0); ~DialogStandardMeasurements(); - + QString name() const; + QString tablePath() const; private: + Q_DISABLE_COPY(DialogStandardMeasurements) Ui::DialogStandardMeasurements *ui; + QString _name; + QString _tablePath; + void Accepted(); + void Rejected(); + void CheckState(); + void LoadStandardTables(); }; #endif // DIALOGSTANDARDMEASUREMENTS_H diff --git a/src/dialogs/app/dialogstandardmeasurements.ui b/src/dialogs/app/dialogstandardmeasurements.ui index e424e6311..241c84fb2 100644 --- a/src/dialogs/app/dialogstandardmeasurements.ui +++ b/src/dialogs/app/dialogstandardmeasurements.ui @@ -33,7 +33,7 @@ - + @@ -53,7 +53,7 @@ - + From ccbd9415f0adb66147c319af8d2a82b375fbc934 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 21 Feb 2014 16:58:07 +0200 Subject: [PATCH 05/60] Replaced Q_WS_WIN32 with Q_OS_WIN. --HG-- branch : feature --- src/dialogs/app/dialogpatternproperties.cpp | 2 +- src/dialogs/app/dialogstandardmeasurements.cpp | 2 +- src/dialogs/app/pages.cpp | 2 +- src/main.cpp | 4 ++-- src/tablewindow.cpp | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dialogs/app/dialogpatternproperties.cpp b/src/dialogs/app/dialogpatternproperties.cpp index 82527f731..45deeecd4 100644 --- a/src/dialogs/app/dialogpatternproperties.cpp +++ b/src/dialogs/app/dialogpatternproperties.cpp @@ -39,7 +39,7 @@ DialogPatternProperties::DialogPatternProperties(VDomDocument *doc, QWidget *par QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QApplication::applicationName()); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString(); #else QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USER").constData())).toString(); diff --git a/src/dialogs/app/dialogstandardmeasurements.cpp b/src/dialogs/app/dialogstandardmeasurements.cpp index d42aa12d9..65a40ea55 100644 --- a/src/dialogs/app/dialogstandardmeasurements.cpp +++ b/src/dialogs/app/dialogstandardmeasurements.cpp @@ -105,7 +105,7 @@ void DialogStandardMeasurements::CheckState() void DialogStandardMeasurements::LoadStandardTables() { -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN const QString pathToTables = QString("/standard_tables"); #else #ifdef QT_DEBUG diff --git a/src/dialogs/app/pages.cpp b/src/dialogs/app/pages.cpp index f1772d289..3d12cbe90 100644 --- a/src/dialogs/app/pages.cpp +++ b/src/dialogs/app/pages.cpp @@ -222,7 +222,7 @@ QGroupBox *PatternPage::UserGroup() userName = new QLineEdit; Q_CHECK_PTR(userName); -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString(); #else QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USER").constData())).toString(); diff --git a/src/main.cpp b/src/main.cpp index f64c4174b..5bb95aa51 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,7 +33,7 @@ #include "tablewindow.h" #include "options.h" -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN const QString translationsPath = QString("/translations"); #else #ifdef QT_DEBUG @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) app.installTranslator(&qtTranslator); QTranslator appTranslator; -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN appTranslator.load("valentina_" + checkedLocale, "."+translationsPath); #else #ifdef QT_DEBUG diff --git a/src/tablewindow.cpp b/src/tablewindow.cpp index 3af48a8e4..755050913 100644 --- a/src/tablewindow.cpp +++ b/src/tablewindow.cpp @@ -513,7 +513,7 @@ void TableWindow::PdfToPs(const QString &name, const QStringList ¶ms) const QProcess proc; QString program; -#ifdef Q_OS_WIN32 +#ifdef Q_OS_WIN program = "pdftops.exe"; #else program = "pdftops"; From 02ef7c0e090c289955375a050e5cd9165dcdde13 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 22 Feb 2014 17:16:33 +0200 Subject: [PATCH 06/60] Initial implamentation dialog individual measurement. --HG-- branch : feature --- .../app/dialogindividualmeasurements.cpp | 109 +++++++++++++ .../app/dialogindividualmeasurements.h | 57 +++++++ .../app/dialogindividualmeasurements.ui | 149 ++++++++++++++++++ .../app/dialogstandardmeasurements.cpp | 9 +- src/dialogs/app/dialogstandardmeasurements.h | 4 +- src/dialogs/dialogs.pri | 9 +- 6 files changed, 328 insertions(+), 9 deletions(-) create mode 100644 src/dialogs/app/dialogindividualmeasurements.cpp create mode 100644 src/dialogs/app/dialogindividualmeasurements.h create mode 100644 src/dialogs/app/dialogindividualmeasurements.ui diff --git a/src/dialogs/app/dialogindividualmeasurements.cpp b/src/dialogs/app/dialogindividualmeasurements.cpp new file mode 100644 index 000000000..e24a13593 --- /dev/null +++ b/src/dialogs/app/dialogindividualmeasurements.cpp @@ -0,0 +1,109 @@ +/************************************************************************ + ** + ** @file dialogindividualmeasurements.cpp + ** @author Roman Telezhinsky + ** @date 22 2, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 "dialogindividualmeasurements.h" +#include "ui_dialogindividualmeasurements.h" + +DialogIndividualMeasurements::DialogIndividualMeasurements(QWidget *parent) : + QDialog(parent), ui(new Ui::DialogIndividualMeasurements), _name(QString()), _tablePath(QString()) +{ + ui->setupUi(this); + + { + const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); + Q_CHECK_PTR(bOk); + connect(bOk, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogAccepted); + } + { + const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); + Q_CHECK_PTR(bCansel); + connect(bCansel, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogRejected); + } + + CheckState(); + connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogIndividualMeasurements::CheckState); + connect(ui->buttonGroupPath, &QButtonGroup::buttonClicked, this, &DialogIndividualMeasurements::CheckState); +} + +DialogIndividualMeasurements::~DialogIndividualMeasurements() +{ + delete ui; +} + +void DialogIndividualMeasurements::DialogAccepted() +{ + _name = ui->lineEditName->text(); + if (ui->radioButtonExistM->isChecked()) + { + _tablePath = ui->lineEditPathExistM->text(); + } + else + { + _tablePath = ui->lineEditPathNewM->text(); + } + accept(); +} + +void DialogIndividualMeasurements::DialogRejected() +{ + _name = ""; + _tablePath = ""; + reject(); +} + +void DialogIndividualMeasurements::CheckState() +{ + bool flagName = false; + if (ui->lineEditName->text().isEmpty() == false) + { + flagName = true; + } + + bool flagPath = false; + if (ui->radioButtonExistM->isChecked()) + { + ui->lineEditPathExistM->setEnabled(true); + ui->toolButtonOpenExist->setEnabled(true); + + ui->lineEditPathNewM->setEnabled(false); + ui->toolButtonOpenNew->setEnabled(false); + } + else + { + ui->lineEditPathNewM->setEnabled(true); + ui->toolButtonOpenNew->setEnabled(true); + + ui->toolButtonOpenExist->setEnabled(false); + ui->lineEditPathExistM->setEnabled(false); + + } + + QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); + Q_CHECK_PTR(bOk); + bOk->setEnabled(flagName && flagPath); +} diff --git a/src/dialogs/app/dialogindividualmeasurements.h b/src/dialogs/app/dialogindividualmeasurements.h new file mode 100644 index 000000000..2f122c8e4 --- /dev/null +++ b/src/dialogs/app/dialogindividualmeasurements.h @@ -0,0 +1,57 @@ +/************************************************************************ + ** + ** @file dialogindividualmeasurements.h + ** @author Roman Telezhinsky + ** @date 22 2, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 DIALOGINDIVIDUALMEASUREMENTS_H +#define DIALOGINDIVIDUALMEASUREMENTS_H + +#include + +namespace Ui { +class DialogIndividualMeasurements; +} + +class DialogIndividualMeasurements : public QDialog +{ + Q_OBJECT + +public: + explicit DialogIndividualMeasurements(QWidget *parent = 0); + ~DialogIndividualMeasurements(); + inline QString name() const {return _name;} + inline QString tablePath() const{return _tablePath;} +private: + Q_DISABLE_COPY(DialogIndividualMeasurements) + Ui::DialogIndividualMeasurements *ui; + QString _name; + QString _tablePath; + void DialogAccepted(); + void DialogRejected(); + void CheckState(); +}; + +#endif // DIALOGINDIVIDUALMEASUREMENTS_H diff --git a/src/dialogs/app/dialogindividualmeasurements.ui b/src/dialogs/app/dialogindividualmeasurements.ui new file mode 100644 index 000000000..d2fc3ea04 --- /dev/null +++ b/src/dialogs/app/dialogindividualmeasurements.ui @@ -0,0 +1,149 @@ + + + DialogIndividualMeasurements + + + + 0 + 0 + 398 + 210 + + + + Dialog + + + + + + + + Pattern peace name + + + + + + + + + + + + + + Exist measurements + + + false + + + buttonGroupPath + + + + + + + + + + + + ... + + + + + + + + + + + + + + + + New measurements + + + true + + + buttonGroupPath + + + + + + + + + + + + ... + + + + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + DialogIndividualMeasurements + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogIndividualMeasurements + reject() + + + 316 + 260 + + + 286 + 274 + + + + + + + + diff --git a/src/dialogs/app/dialogstandardmeasurements.cpp b/src/dialogs/app/dialogstandardmeasurements.cpp index 65a40ea55..9d84b4d1c 100644 --- a/src/dialogs/app/dialogstandardmeasurements.cpp +++ b/src/dialogs/app/dialogstandardmeasurements.cpp @@ -38,17 +38,18 @@ DialogStandardMeasurements::DialogStandardMeasurements(QWidget *parent) : { const QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); Q_CHECK_PTR(bOk); - connect(bOk, &QPushButton::clicked, this, &DialogStandardMeasurements::Accepted); + connect(bOk, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogAccepted); } { const QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); Q_CHECK_PTR(bCansel); - connect(bCansel, &QPushButton::clicked, this, &DialogStandardMeasurements::Rejected); + connect(bCansel, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogRejected); } LoadStandardTables(); CheckState(); + connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogStandardMeasurements::CheckState); } DialogStandardMeasurements::~DialogStandardMeasurements() @@ -66,14 +67,14 @@ QString DialogStandardMeasurements::tablePath() const return _tablePath; } -void DialogStandardMeasurements::Accepted() +void DialogStandardMeasurements::DialogAccepted() { _name = ui->lineEditName->text(); _tablePath = "path"; accept(); } -void DialogStandardMeasurements::Rejected() +void DialogStandardMeasurements::DialogRejected() { _name = ""; _tablePath = ""; diff --git a/src/dialogs/app/dialogstandardmeasurements.h b/src/dialogs/app/dialogstandardmeasurements.h index 357ca732e..2a7156f50 100644 --- a/src/dialogs/app/dialogstandardmeasurements.h +++ b/src/dialogs/app/dialogstandardmeasurements.h @@ -48,8 +48,8 @@ private: Ui::DialogStandardMeasurements *ui; QString _name; QString _tablePath; - void Accepted(); - void Rejected(); + void DialogAccepted(); + void DialogRejected(); void CheckState(); void LoadStandardTables(); }; diff --git a/src/dialogs/dialogs.pri b/src/dialogs/dialogs.pri index d4267b31c..99388667c 100644 --- a/src/dialogs/dialogs.pri +++ b/src/dialogs/dialogs.pri @@ -27,7 +27,8 @@ HEADERS += \ src/dialogs/app/pages.h \ src/dialogs/app/dialogpatternproperties.h \ src/dialogs/app/dialogmeasurements.h \ - src/dialogs/app/dialogstandardmeasurements.h + src/dialogs/app/dialogstandardmeasurements.h \ + src/dialogs/app/dialogindividualmeasurements.h SOURCES += \ src/dialogs/tools/dialogtriangle.cpp \ @@ -57,7 +58,8 @@ SOURCES += \ src/dialogs/app/pages.cpp \ src/dialogs/app/dialogpatternproperties.cpp \ src/dialogs/app/dialogmeasurements.cpp \ - src/dialogs/app/dialogstandardmeasurements.cpp + src/dialogs/app/dialogstandardmeasurements.cpp \ + src/dialogs/app/dialogindividualmeasurements.cpp FORMS += \ src/dialogs/tools/dialogtriangle.ui \ @@ -84,4 +86,5 @@ FORMS += \ src/dialogs/app/dialoghistory.ui \ src/dialogs/app/dialogpatternproperties.ui \ src/dialogs/app/dialogmeasurements.ui \ - src/dialogs/app/dialogstandardmeasurements.ui + src/dialogs/app/dialogstandardmeasurements.ui \ + src/dialogs/app/dialogindividualmeasurements.ui From 0389e29716ae8d39157b392e2e809c15e8660e41 Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 22 Feb 2014 18:30:37 +0200 Subject: [PATCH 07/60] GCC warning options. --HG-- branch : feature --- Valentina.pro | 10 +++++----- src/dialogs/app/dialogindividualmeasurements.cpp | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Valentina.pro b/Valentina.pro index f13d13f7b..9f3855da4 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -78,13 +78,13 @@ CONFIG(debug, debug|release){ -isystem "/usr/include/qt5/QtCore" -isystem "$${UI_DIR}" -isystem "$${MOC_DIR}" \ -isystem "$${RCC_DIR}" \ -O0 -Wall -Wextra -pedantic -Weffc++ -Woverloaded-virtual -Wctor-dtor-privacy \ - -Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self \ + -Wnon-virtual-dtor -Wold-style-cast -Wconversion -Winit-self -Wstack-protector \ -Wunreachable-code -Wcast-align -Wcast-qual -Wdisabled-optimization -Wfloat-equal \ - -Wformat -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k \ + -Wformat=2 -Wimport \ -Winvalid-pch -Wunsafe-loop-optimizations -Wlong-long -Wmissing-format-attribute \ - -Wmissing-include-dirs -Wpacked -Wredundant-decls \ - -Wswitch-default -Wswitch-enum -Wuninitialized -Wunused-parameter -Wvariadic-macros \ - -Wlogical-op -Wnoexcept \ + -Wmissing-include-dirs -Wpacked -Wredundant-decls -Winline \ + -Wswitch-default -Wswitch-enum -Wuninitialized -Wvariadic-macros \ + -Wlogical-op -Wnoexcept -Wmissing-noreturn -Wpointer-arith\ -Wstrict-null-sentinel -Wstrict-overflow=5 -Wundef -Wno-unused -gdwarf-3 } } else { diff --git a/src/dialogs/app/dialogindividualmeasurements.cpp b/src/dialogs/app/dialogindividualmeasurements.cpp index e24a13593..586d588b3 100644 --- a/src/dialogs/app/dialogindividualmeasurements.cpp +++ b/src/dialogs/app/dialogindividualmeasurements.cpp @@ -28,6 +28,7 @@ #include "dialogindividualmeasurements.h" #include "ui_dialogindividualmeasurements.h" +#include DialogIndividualMeasurements::DialogIndividualMeasurements(QWidget *parent) : QDialog(parent), ui(new Ui::DialogIndividualMeasurements), _name(QString()), _tablePath(QString()) @@ -47,7 +48,8 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(QWidget *parent) : CheckState(); connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogIndividualMeasurements::CheckState); - connect(ui->buttonGroupPath, &QButtonGroup::buttonClicked, this, &DialogIndividualMeasurements::CheckState); + connect(ui->buttonGroupPath, static_cast(&QButtonGroup::buttonClicked), this, + &DialogIndividualMeasurements::CheckState); } DialogIndividualMeasurements::~DialogIndividualMeasurements() From bffa81d36e0d340bf0ec95278f1773bb257f61f6 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 24 Feb 2014 17:24:13 +0200 Subject: [PATCH 08/60] Schemas for measurement tables. --HG-- branch : feature --- share/resources/schema.qrc | 2 + .../schema/individual_measurements.xsd | 589 ++++++++++++++++++ .../schema/standard_measurements.xsd | 27 + 3 files changed, 618 insertions(+) create mode 100644 share/resources/schema/individual_measurements.xsd create mode 100644 share/resources/schema/standard_measurements.xsd diff --git a/share/resources/schema.qrc b/share/resources/schema.qrc index ddc4b4e88..9209df5ca 100644 --- a/share/resources/schema.qrc +++ b/share/resources/schema.qrc @@ -1,5 +1,7 @@ schema/pattern.xsd + schema/individual_measurements.xsd + schema/standard_measurements.xsd diff --git a/share/resources/schema/individual_measurements.xsd b/share/resources/schema/individual_measurements.xsd new file mode 100644 index 000000000..0a267d53c --- /dev/null +++ b/share/resources/schema/individual_measurements.xsd @@ -0,0 +1,589 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/resources/schema/standard_measurements.xsd b/share/resources/schema/standard_measurements.xsd new file mode 100644 index 000000000..37a4e4e63 --- /dev/null +++ b/share/resources/schema/standard_measurements.xsd @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + From de0200ca2a154ba6e96f14924bc55f53eceedb3b Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 25 Feb 2014 16:02:09 +0200 Subject: [PATCH 09/60] Refactoring VDomDocument, creation VPattern class. --HG-- branch : feature --- src/container/vcontainer.cpp | 1 + src/dialogs/app/dialoghistory.cpp | 14 +- src/dialogs/app/dialoghistory.h | 6 +- src/dialogs/app/dialogincrements.cpp | 8 +- src/dialogs/app/dialogincrements.h | 6 +- src/dialogs/app/dialogpatternproperties.cpp | 4 +- src/dialogs/app/dialogpatternproperties.h | 6 +- src/mainwindow.cpp | 8 +- src/mainwindow.h | 2 +- src/tools/drawTools/vdrawtool.cpp | 10 +- src/tools/drawTools/vdrawtool.h | 4 +- src/tools/drawTools/vtoolalongline.cpp | 48 +- src/tools/drawTools/vtoolalongline.h | 6 +- src/tools/drawTools/vtoolarc.cpp | 34 +- src/tools/drawTools/vtoolarc.h | 6 +- src/tools/drawTools/vtoolbisector.cpp | 54 +- src/tools/drawTools/vtoolbisector.h | 6 +- src/tools/drawTools/vtoolcutarc.cpp | 36 +- src/tools/drawTools/vtoolcutarc.h | 6 +- src/tools/drawTools/vtoolcutspline.cpp | 36 +- src/tools/drawTools/vtoolcutspline.h | 6 +- src/tools/drawTools/vtoolcutsplinepath.cpp | 36 +- src/tools/drawTools/vtoolcutsplinepath.h | 6 +- src/tools/drawTools/vtoolendline.cpp | 48 +- src/tools/drawTools/vtoolendline.h | 6 +- src/tools/drawTools/vtoolheight.cpp | 50 +- src/tools/drawTools/vtoolheight.h | 6 +- src/tools/drawTools/vtoolline.cpp | 26 +- src/tools/drawTools/vtoolline.h | 6 +- src/tools/drawTools/vtoollineintersect.cpp | 48 +- src/tools/drawTools/vtoollineintersect.h | 6 +- src/tools/drawTools/vtoollinepoint.cpp | 2 +- src/tools/drawTools/vtoollinepoint.h | 2 +- src/tools/drawTools/vtoolnormal.cpp | 54 +- src/tools/drawTools/vtoolnormal.h | 6 +- src/tools/drawTools/vtoolpoint.cpp | 6 +- src/tools/drawTools/vtoolpoint.h | 2 +- src/tools/drawTools/vtoolpointofcontact.cpp | 48 +- src/tools/drawTools/vtoolpointofcontact.h | 6 +- .../drawTools/vtoolpointofintersection.cpp | 36 +- .../drawTools/vtoolpointofintersection.h | 6 +- src/tools/drawTools/vtoolshoulderpoint.cpp | 54 +- src/tools/drawTools/vtoolshoulderpoint.h | 6 +- src/tools/drawTools/vtoolsinglepoint.cpp | 36 +- src/tools/drawTools/vtoolsinglepoint.h | 2 +- src/tools/drawTools/vtoolspline.cpp | 62 +- src/tools/drawTools/vtoolspline.h | 6 +- src/tools/drawTools/vtoolsplinepath.cpp | 34 +- src/tools/drawTools/vtoolsplinepath.h | 6 +- src/tools/drawTools/vtooltriangle.cpp | 48 +- src/tools/drawTools/vtooltriangle.h | 6 +- src/tools/nodeDetails/vabstractnode.cpp | 4 +- src/tools/nodeDetails/vabstractnode.h | 2 +- src/tools/nodeDetails/vnodearc.cpp | 16 +- src/tools/nodeDetails/vnodearc.h | 4 +- src/tools/nodeDetails/vnodepoint.cpp | 28 +- src/tools/nodeDetails/vnodepoint.h | 4 +- src/tools/nodeDetails/vnodespline.cpp | 16 +- src/tools/nodeDetails/vnodespline.h | 4 +- src/tools/nodeDetails/vnodesplinepath.cpp | 16 +- src/tools/nodeDetails/vnodesplinepath.h | 4 +- src/tools/vabstracttool.cpp | 10 +- src/tools/vabstracttool.h | 27 +- src/tools/vtooldetail.cpp | 60 +- src/tools/vtooldetail.h | 6 +- src/tools/vtooluniondetails.cpp | 42 +- src/tools/vtooluniondetails.h | 10 +- src/widgets/vsimplesplinepath.cpp | 2 +- src/widgets/vsimplesplinepath.h | 2 +- src/xml/vdomdocument.cpp | 1342 +---------------- src/xml/vdomdocument.h | 395 +---- src/xml/vpattern.cpp | 1265 ++++++++++++++++ src/xml/vpattern.h | 367 +++++ src/xml/xml.pri | 6 +- 74 files changed, 2291 insertions(+), 2314 deletions(-) create mode 100644 src/xml/vpattern.cpp create mode 100644 src/xml/vpattern.h diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index ddac8b87a..bcda3190d 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -275,6 +275,7 @@ void VContainer::Clear() lengthArcs.clear(); lineAngles.clear(); details.clear(); + lengthSplines.clear(); ClearGObjects(); } diff --git a/src/dialogs/app/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp index ac3e83325..fa920848c 100644 --- a/src/dialogs/app/dialoghistory.cpp +++ b/src/dialogs/app/dialoghistory.cpp @@ -38,7 +38,7 @@ #include #include -DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent) +DialogHistory::DialogHistory(VContainer *data, VPattern *doc, QWidget *parent) :DialogTool(data, parent), ui(new Ui::DialogHistory), doc(doc), cursorRow(0), cursorToolRecordRow(0) { @@ -48,10 +48,10 @@ DialogHistory::DialogHistory(VContainer *data, VDomDocument *doc, QWidget *paren FillTable(); InitialTable(); connect(ui->tableWidget, &QTableWidget::cellClicked, this, &DialogHistory::cellClicked); - connect(this, &DialogHistory::ShowHistoryTool, doc, &VDomDocument::ShowHistoryTool); - connect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor); - connect(doc, &VDomDocument::patternChanged, this, &DialogHistory::UpdateHistory); - connect(doc, &VDomDocument::ChangedActivDraw, this, &DialogHistory::UpdateHistory); + connect(this, &DialogHistory::ShowHistoryTool, doc, &VPattern::ShowHistoryTool); + connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor); + connect(doc, &VPattern::patternChanged, this, &DialogHistory::UpdateHistory); + connect(doc, &VPattern::ChangedActivDraw, this, &DialogHistory::UpdateHistory); ShowPoint(); } @@ -79,9 +79,9 @@ void DialogHistory::cellClicked(int row, int column) cursorRow = row; item->setIcon(QIcon("://icon/32x32/put_after.png")); qint64 id = qvariant_cast(item->data(Qt::UserRole)); - disconnect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor); + disconnect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor); doc->setCursor(id); - connect(doc, &VDomDocument::ChangedCursor, this, &DialogHistory::ChangedCursor); + connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor); } else { diff --git a/src/dialogs/app/dialoghistory.h b/src/dialogs/app/dialoghistory.h index 5670c498c..526f6f46f 100644 --- a/src/dialogs/app/dialoghistory.h +++ b/src/dialogs/app/dialoghistory.h @@ -30,7 +30,7 @@ #define DIALOGHISTORY_H #include "../tools/dialogtool.h" -#include "../../xml/vdomdocument.h" +#include "../../xml/vpattern.h" namespace Ui { @@ -50,7 +50,7 @@ public: * @param doc dom document container * @param parent parent widget */ - DialogHistory(VContainer *data, VDomDocument *doc, QWidget *parent = 0); + DialogHistory(VContainer *data, VPattern *doc, QWidget *parent = 0); virtual ~DialogHistory(); public slots: /** @@ -95,7 +95,7 @@ private: /** * @brief doc dom document container */ - VDomDocument *doc; + VPattern *doc; /** * @brief cursorRow save number of row where is cursor */ diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index daf940cc1..7bd2c87df 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -34,7 +34,7 @@ #include -DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent) +DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent) :DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0) { ui->setupUi(this); @@ -57,9 +57,9 @@ DialogIncrements::DialogIncrements(VContainer *data, VDomDocument *doc, QWidget connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd); connect(ui->toolButtonRemove, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonRemove); - connect(this, &DialogIncrements::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree); - connect(this, &DialogIncrements::haveLiteChange, this->doc, &VDomDocument::haveLiteChange); - connect(this->doc, &VDomDocument::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile); + connect(this, &DialogIncrements::FullUpdateTree, this->doc, &VPattern::FullUpdateTree); + connect(this, &DialogIncrements::haveLiteChange, this->doc, &VPattern::haveLiteChange); + connect(this->doc, &VPattern::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile); ui->tabWidget->setCurrentIndex(0); } diff --git a/src/dialogs/app/dialogincrements.h b/src/dialogs/app/dialogincrements.h index 5f42b9b08..85e13eba7 100644 --- a/src/dialogs/app/dialogincrements.h +++ b/src/dialogs/app/dialogincrements.h @@ -30,7 +30,7 @@ #define DIALOGINCREMENTS_H #include "../tools/dialogtool.h" -#include "../../xml/vdomdocument.h" +#include "../../xml/vpattern.h" namespace Ui { @@ -50,7 +50,7 @@ public: * @param doc dom document container * @param parent parent widget */ - DialogIncrements(VContainer *data, VDomDocument *doc, QWidget *parent = 0); + DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = 0); ~DialogIncrements(); public slots: /** @@ -95,7 +95,7 @@ private: /** * @brief doc dom document container */ - VDomDocument *doc; + VPattern *doc; /** * @brief row save number of row current selected cell */ diff --git a/src/dialogs/app/dialogpatternproperties.cpp b/src/dialogs/app/dialogpatternproperties.cpp index 45deeecd4..6d7f922aa 100644 --- a/src/dialogs/app/dialogpatternproperties.cpp +++ b/src/dialogs/app/dialogpatternproperties.cpp @@ -30,7 +30,7 @@ #include "ui_dialogpatternproperties.h" #include -DialogPatternProperties::DialogPatternProperties(VDomDocument *doc, QWidget *parent) : +DialogPatternProperties::DialogPatternProperties(VPattern *doc, QWidget *parent) : QDialog(parent), ui(new Ui::DialogPatternProperties), doc(doc) { ui->setupUi(this); @@ -57,7 +57,7 @@ DialogPatternProperties::DialogPatternProperties(VDomDocument *doc, QWidget *par Q_CHECK_PTR(bCansel); connect(bCansel, &QPushButton::clicked, this, &DialogPatternProperties::close); - connect(this, &DialogPatternProperties::haveChange, this->doc, &VDomDocument::haveLiteChange); + connect(this, &DialogPatternProperties::haveChange, this->doc, &VPattern::haveLiteChange); } DialogPatternProperties::~DialogPatternProperties() diff --git a/src/dialogs/app/dialogpatternproperties.h b/src/dialogs/app/dialogpatternproperties.h index 10f47fe07..5efd8a28a 100644 --- a/src/dialogs/app/dialogpatternproperties.h +++ b/src/dialogs/app/dialogpatternproperties.h @@ -30,7 +30,7 @@ #define DIALOGPATTERNPROPERTIES_H #include -#include "../../xml/vdomdocument.h" +#include "../../xml/vpattern.h" namespace Ui { class DialogPatternProperties; @@ -40,7 +40,7 @@ class DialogPatternProperties : public QDialog { Q_OBJECT public: - DialogPatternProperties(VDomDocument *doc, QWidget *parent = 0); + DialogPatternProperties(VPattern *doc, QWidget *parent = 0); virtual ~DialogPatternProperties(); signals: void haveChange(); @@ -49,7 +49,7 @@ public slots: private: Q_DISABLE_COPY(DialogPatternProperties) Ui::DialogPatternProperties *ui; - VDomDocument *doc; + VPattern *doc; void Write(const QString &tagName, const QString &text) const; }; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4bdadaddb..6761c6873 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -128,9 +128,9 @@ MainWindow::MainWindow(QWidget *parent) pattern = new VContainer(); - doc = new VDomDocument(pattern, comboBoxDraws, &mode); + doc = new VPattern(pattern, comboBoxDraws, &mode); doc->CreateEmptyFile(); - connect(doc, &VDomDocument::patternChanged, this, &MainWindow::PatternWasModified); + connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified); InitAutoSave(); @@ -268,7 +268,7 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChoosedObject); connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); - connect(doc, &VDomDocument::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList); + connect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList); } else { @@ -488,7 +488,7 @@ void MainWindow::ToolUnionDetails(bool checked) SetToolButton(checked, Tool::UnionDetails, ":/cursor/union_cursor.png", tr("Select detail"), &MainWindow::ClosedDialogUnionDetails); //Must disconnect this signal here. - disconnect(doc, &VDomDocument::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList); + disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList); } void MainWindow::ClosedDialogUnionDetails(int result) diff --git a/src/mainwindow.h b/src/mainwindow.h index 75c4f7f81..04c6625b4 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -403,7 +403,7 @@ private: /** * @brief doc dom document container */ - VDomDocument *doc; + VPattern *doc; /** * @brief tool current tool */ diff --git a/src/tools/drawTools/vdrawtool.cpp b/src/tools/drawTools/vdrawtool.cpp index e4ad8d170..a588da3da 100644 --- a/src/tools/drawTools/vdrawtool.cpp +++ b/src/tools/drawTools/vdrawtool.cpp @@ -30,13 +30,13 @@ qreal VDrawTool::factor = 1; -VDrawTool::VDrawTool(VDomDocument *doc, VContainer *data, qint64 id) +VDrawTool::VDrawTool(VPattern *doc, VContainer *data, qint64 id) :VAbstractTool(doc, data, id), ignoreContextMenuEvent(false), ignoreFullUpdate(false), nameActivDraw(doc->GetNameActivDraw()), dialog(0) { - connect(this->doc, &VDomDocument::ChangedActivDraw, this, &VDrawTool::ChangedActivDraw); - connect(this->doc, &VDomDocument::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw); - connect(this->doc, &VDomDocument::ShowTool, this, &VDrawTool::ShowTool); + connect(this->doc, &VPattern::ChangedActivDraw, this, &VDrawTool::ChangedActivDraw); + connect(this->doc, &VPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw); + connect(this->doc, &VPattern::ShowTool, this, &VDrawTool::ShowTool); } VDrawTool::~VDrawTool() @@ -99,7 +99,7 @@ void VDrawTool::SetFactor(qreal factor) void VDrawTool::AddToCalculation(const QDomElement &domElement) { QDomElement calcElement; - bool ok = doc->GetActivCalculationElement(calcElement); + bool ok = doc->GetActivNodeElement(VPattern::TagCalculation, calcElement); if (ok) { qint64 id = doc->getCursor(); diff --git a/src/tools/drawTools/vdrawtool.h b/src/tools/drawTools/vdrawtool.h index 4b5ec40e4..e44cbc54f 100644 --- a/src/tools/drawTools/vdrawtool.h +++ b/src/tools/drawTools/vdrawtool.h @@ -49,7 +49,7 @@ public: * @param id object id in container. * @param parent parent object. */ - VDrawTool(VDomDocument *doc, VContainer *data, qint64 id); + VDrawTool(VPattern *doc, VContainer *data, qint64 id); virtual ~VDrawTool(); /** * @brief setDialog set dialog when user want change tool option. @@ -159,7 +159,7 @@ protected: connect(dialog, &DialogTool::DialogClosed, tool, &Tool::FullUpdateFromGui); if (ignoreFullUpdate == false) { - connect(doc, &VDomDocument::FullUpdateFromFile, dialog, &DialogTool::UpdateList); + connect(doc, &VPattern::FullUpdateFromFile, dialog, &DialogTool::UpdateList); } tool->setDialog(); diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index dbdc36561..88b8d1149 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -32,7 +32,7 @@ const QString VToolAlongLine::ToolType = QStringLiteral("alongLine"); -VToolAlongLine::VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, +VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, qint64 id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, const Tool::Sources &typeCreation, QGraphicsItem *parent) @@ -84,16 +84,16 @@ void VToolAlongLine::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrFirstPoint, basePointId); - SetAttribute(domElement, AttrSecondPoint, secondPointId); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrFirstPoint, basePointId); + doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } @@ -104,13 +104,13 @@ void VToolAlongLine::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrFirstPoint, basePointId); - SetAttribute(domElement, AttrSecondPoint, secondPointId); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrFirstPoint, basePointId); + doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); } } @@ -125,11 +125,11 @@ void VToolAlongLine::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogAlongLine *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); - SetAttribute(domElement, AttrLength, dialogTool->getFormula()); - SetAttribute(domElement, AttrFirstPoint, dialogTool->getFirstPointId()); - SetAttribute(domElement, AttrSecondPoint, dialogTool->getSecondPointId()); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); + doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); + doc->SetAttribute(domElement, AttrFirstPoint, dialogTool->getFirstPointId()); + doc->SetAttribute(domElement, AttrSecondPoint, dialogTool->getSecondPointId()); } void VToolAlongLine::setDialog() @@ -145,7 +145,7 @@ void VToolAlongLine::setDialog() dialogTool->setPointName(p->name()); } -void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data) +void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogAlongLine *dialogTool = qobject_cast(dialog); @@ -161,7 +161,7 @@ void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomD void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VPointF *firstPoint = data->GeometricObject(firstPointId); diff --git a/src/tools/drawTools/vtoolalongline.h b/src/tools/drawTools/vtoolalongline.h index 21c9f7bbd..d1a325dec 100644 --- a/src/tools/drawTools/vtoolalongline.h +++ b/src/tools/drawTools/vtoolalongline.h @@ -50,7 +50,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolAlongLine(VDomDocument *doc, VContainer *data, qint64 id, const QString &formula, + VToolAlongLine(VPattern *doc, VContainer *data, qint64 id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** @@ -64,7 +64,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -83,7 +83,7 @@ public: */ static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; public slots: diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index c5c6b0aa1..8eed179f8 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -33,7 +33,7 @@ const QString VToolArc::TagName = QStringLiteral("arc"); const QString VToolArc::ToolType = QStringLiteral("simple"); -VToolArc::VToolArc(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, +VToolArc::VToolArc(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VDrawTool(doc, data, id), QGraphicsPathItem(parent) { @@ -69,7 +69,7 @@ void VToolArc::setDialog() dialogTool->SetRadius(arc->GetFormulaRadius()); } -void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, +void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); @@ -83,7 +83,7 @@ void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocumen } void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, - const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const QString &f2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { qreal calcRadius = 0, calcF1 = 0, calcF2 = 0; @@ -183,12 +183,12 @@ void VToolArc::AddToFile() const VArc *arc = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrCenter, arc->GetCenter().id()); - SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius()); - SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1()); - SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2()); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrCenter, arc->GetCenter().id()); + doc->SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius()); + doc->SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1()); + doc->SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2()); AddToCalculation(domElement); } @@ -199,10 +199,10 @@ void VToolArc::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrCenter, arc->GetCenter().id()); - SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius()); - SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1()); - SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2()); + doc->SetAttribute(domElement, AttrCenter, arc->GetCenter().id()); + doc->SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius()); + doc->SetAttribute(domElement, AttrAngle1, arc->GetFormulaF1()); + doc->SetAttribute(domElement, AttrAngle2, arc->GetFormulaF2()); } } @@ -271,10 +271,10 @@ void VToolArc::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogArc *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter())); - SetAttribute(domElement, AttrRadius, dialogTool->GetRadius()); - SetAttribute(domElement, AttrAngle1, dialogTool->GetF1()); - SetAttribute(domElement, AttrAngle2, dialogTool->GetF2()); + doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->GetCenter())); + doc->SetAttribute(domElement, AttrRadius, dialogTool->GetRadius()); + doc->SetAttribute(domElement, AttrAngle1, dialogTool->GetF1()); + doc->SetAttribute(domElement, AttrAngle2, dialogTool->GetF2()); } void VToolArc::RefreshGeometry() diff --git a/src/tools/drawTools/vtoolarc.h b/src/tools/drawTools/vtoolarc.h index 1455db910..b81a4cfad 100644 --- a/src/tools/drawTools/vtoolarc.h +++ b/src/tools/drawTools/vtoolarc.h @@ -48,7 +48,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object */ - VToolArc(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, + VToolArc(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -61,7 +61,7 @@ public: * @param doc dom document container * @param data container with variables */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool form GUI. * @param _id tool id, 0 if tool doesn't exist yet. @@ -76,7 +76,7 @@ public: * @param typeCreation way we create this tool. */ static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, - const QString &f2, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const QString &f2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; static const QString ToolType; diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index ad169ae5b..63a0a63e5 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -32,7 +32,7 @@ const QString VToolBisector::ToolType = QStringLiteral("bisector"); -VToolBisector::VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, +VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &thirdPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) @@ -84,7 +84,7 @@ void VToolBisector::setDialog() dialogTool->setPointName(p->name()); } -void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, +void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); @@ -103,7 +103,7 @@ void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDo void VToolBisector::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VPointF *firstPoint = data->GeometricObject(firstPointId); @@ -183,17 +183,17 @@ void VToolBisector::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrFirstPoint, firstPointId); - SetAttribute(domElement, AttrSecondPoint, basePointId); - SetAttribute(domElement, AttrThirdPoint, thirdPointId); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); + doc->SetAttribute(domElement, AttrSecondPoint, basePointId); + doc->SetAttribute(domElement, AttrThirdPoint, thirdPointId); AddToCalculation(domElement); } @@ -204,14 +204,14 @@ void VToolBisector::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrFirstPoint, firstPointId); - SetAttribute(domElement, AttrSecondPoint, basePointId); - SetAttribute(domElement, AttrThirdPoint, thirdPointId); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); + doc->SetAttribute(domElement, AttrSecondPoint, basePointId); + doc->SetAttribute(domElement, AttrThirdPoint, thirdPointId); } } @@ -227,10 +227,10 @@ void VToolBisector::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogBisector *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); - SetAttribute(domElement, AttrLength, dialogTool->getFormula()); - SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId())); - SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId())); - SetAttribute(domElement, AttrThirdPoint, QString().setNum(dialogTool->getThirdPointId())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); + doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); + doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId())); + doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId())); + doc->SetAttribute(domElement, AttrThirdPoint, QString().setNum(dialogTool->getThirdPointId())); } diff --git a/src/tools/drawTools/vtoolbisector.h b/src/tools/drawTools/vtoolbisector.h index f019bd35e..b88e284c1 100644 --- a/src/tools/drawTools/vtoolbisector.h +++ b/src/tools/drawTools/vtoolbisector.h @@ -50,7 +50,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolBisector(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + VToolBisector(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &thirdPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); @@ -75,7 +75,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -96,7 +96,7 @@ public: static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, + VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; public slots: diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index 52772a577..426ff7094 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -33,7 +33,7 @@ const QString VToolCutArc::ToolType = QStringLiteral("cutArc"); const QString VToolCutArc::AttrArc = QStringLiteral("arc"); -VToolCutArc::VToolCutArc(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula, +VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula, const qint64 &arcId, const qint64 &arc1id, const qint64 &arc2id, const Tool::Sources &typeCreation, QGraphicsItem * parent) :VToolPoint(doc, data, id, parent), formula(formula), arcId(arcId), firstArc(), secondArc(), arc1id(arc1id), @@ -76,7 +76,7 @@ void VToolCutArc::setDialog() dialogTool->setPointName(point->name()); } -void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, +void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); @@ -89,7 +89,7 @@ void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocu } void VToolCutArc::Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &arcId, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VArc *arc = data->GeometricObject(arcId); @@ -213,14 +213,14 @@ void VToolCutArc::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrArc, arcId); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrArc, arcId); AddToCalculation(domElement); } @@ -231,11 +231,11 @@ void VToolCutArc::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrArc, arcId); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrArc, arcId); } } @@ -251,9 +251,9 @@ void VToolCutArc::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogCutArc *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrLength, dialogTool->getFormula()); - SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); + doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId())); } void VToolCutArc::RefreshArc(VSimpleArc *sArc, qint64 arcid, SimpleArc::Translation tr) diff --git a/src/tools/drawTools/vtoolcutarc.h b/src/tools/drawTools/vtoolcutarc.h index 9d10bcf0a..1cf876fa1 100644 --- a/src/tools/drawTools/vtoolcutarc.h +++ b/src/tools/drawTools/vtoolcutarc.h @@ -51,7 +51,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolCutArc(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula, + VToolCutArc(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula, const qint64 &arcId, const qint64 &arc1id, const qint64 &arc2id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** @@ -65,7 +65,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -81,7 +81,7 @@ public: * @param typeCreation way we create this tool. */ static void Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &arcId, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; static const QString AttrArc; diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index 1783a4e19..0c2c01ca7 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -33,7 +33,7 @@ const QString VToolCutSpline::ToolType = QStringLiteral("cutSpline"); const QString VToolCutSpline::AttrSpline = QStringLiteral("spline"); -VToolCutSpline::VToolCutSpline(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula, +VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula, const qint64 &splineId, const qint64 &spl1id, const qint64 &spl2id, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), formula(formula), splineId(splineId), firstSpline(), secondSpline(), @@ -77,7 +77,7 @@ void VToolCutSpline::setDialog() } void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data) + VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogCutSpline *dialogTool = qobject_cast(dialog); @@ -90,7 +90,7 @@ void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, void VToolCutSpline::Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &splineId, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VSpline *spl = data->GeometricObject(splineId); @@ -214,14 +214,14 @@ void VToolCutSpline::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrSpline, splineId); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrSpline, splineId); AddToCalculation(domElement); } @@ -232,11 +232,11 @@ void VToolCutSpline::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrSpline, splineId); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrSpline, splineId); } } @@ -257,9 +257,9 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogCutSpline *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrLength, dialogTool->getFormula()); - SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); + doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId())); } void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr) diff --git a/src/tools/drawTools/vtoolcutspline.h b/src/tools/drawTools/vtoolcutspline.h index bdf971598..d9b0e7634 100644 --- a/src/tools/drawTools/vtoolcutspline.h +++ b/src/tools/drawTools/vtoolcutspline.h @@ -49,7 +49,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolCutSpline(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula, + VToolCutSpline(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula, const qint64 &splineId, const qint64 &spl1id, const qint64 &spl2id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** @@ -63,7 +63,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -80,7 +80,7 @@ public: */ static void Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &splineId, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; static const QString AttrSpline; diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index 0f401b42f..495d4897d 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -33,7 +33,7 @@ const QString VToolCutSplinePath::ToolType = QStringLiteral("cutSplinePath"); const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath"); -VToolCutSplinePath::VToolCutSplinePath(VDomDocument *doc, VContainer *data, const qint64 &id, +VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula, const qint64 &splinePathId, const qint64 &splPath1id, const qint64 &splPath2id, const Tool::Sources &typeCreation, QGraphicsItem *parent) @@ -77,7 +77,7 @@ void VToolCutSplinePath::setDialog() dialogTool->setPointName(point->name()); } -void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data) +void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogCutSplinePath *dialogTool = qobject_cast(dialog); @@ -90,7 +90,7 @@ void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, V void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &splinePathId, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VSplinePath *splPath = data->GeometricObject(splinePathId); @@ -295,14 +295,14 @@ void VToolCutSplinePath::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrSplinePath, splinePathId); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrSplinePath, splinePathId); AddToCalculation(domElement); } @@ -313,11 +313,11 @@ void VToolCutSplinePath::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrSplinePath, splinePathId); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrSplinePath, splinePathId); } } @@ -338,9 +338,9 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogCutSplinePath *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrLength, dialogTool->getFormula()); - SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); + doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId())); } void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr) diff --git a/src/tools/drawTools/vtoolcutsplinepath.h b/src/tools/drawTools/vtoolcutsplinepath.h index 7a13d2e5e..f29d8a999 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.h +++ b/src/tools/drawTools/vtoolcutsplinepath.h @@ -52,7 +52,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolCutSplinePath(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &formula, + VToolCutSplinePath(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula, const qint64 &splinePathId, const qint64 &splPath1id, const qint64 &splPath2id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** @@ -66,7 +66,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -83,7 +83,7 @@ public: */ static void Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &splinePathId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, + VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; static const QString AttrSplinePath; diff --git a/src/tools/drawTools/vtoolendline.cpp b/src/tools/drawTools/vtoolendline.cpp index 1f3d4d97c..4178689fe 100644 --- a/src/tools/drawTools/vtoolendline.cpp +++ b/src/tools/drawTools/vtoolendline.cpp @@ -33,7 +33,7 @@ const QString VToolEndLine::ToolType = QStringLiteral("endLine"); -VToolEndLine::VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, +VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent) @@ -62,7 +62,7 @@ void VToolEndLine::setDialog() dialogTool->setPointName(p->name()); } -void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, +void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); @@ -79,7 +79,7 @@ void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDoc void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VPointF *basePoint = data->GeometricObject(basePointId); @@ -148,16 +148,16 @@ void VToolEndLine::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrAngle, angle); - SetAttribute(domElement, AttrBasePoint, basePointId); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrAngle, angle); + doc->SetAttribute(domElement, AttrBasePoint, basePointId); AddToCalculation(domElement); } @@ -168,13 +168,13 @@ void VToolEndLine::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrAngle, angle); - SetAttribute(domElement, AttrBasePoint, basePointId); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrAngle, angle); + doc->SetAttribute(domElement, AttrBasePoint, basePointId); } } @@ -183,9 +183,9 @@ void VToolEndLine::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogEndLine *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); - SetAttribute(domElement, AttrLength, dialogTool->getFormula()); - SetAttribute(domElement, AttrAngle, QString().setNum(dialogTool->getAngle())); - SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); + doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); + doc->SetAttribute(domElement, AttrAngle, QString().setNum(dialogTool->getAngle())); + doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId())); } diff --git a/src/tools/drawTools/vtoolendline.h b/src/tools/drawTools/vtoolendline.h index a8b3c4992..938beb98e 100644 --- a/src/tools/drawTools/vtoolendline.h +++ b/src/tools/drawTools/vtoolendline.h @@ -50,7 +50,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolEndLine(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + VToolEndLine(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** @@ -64,7 +64,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -83,7 +83,7 @@ public: */ static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, - const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; public slots: diff --git a/src/tools/drawTools/vtoolheight.cpp b/src/tools/drawTools/vtoolheight.cpp index d81505585..893e99459 100644 --- a/src/tools/drawTools/vtoolheight.cpp +++ b/src/tools/drawTools/vtoolheight.cpp @@ -31,7 +31,7 @@ const QString VToolHeight::ToolType = QStringLiteral("height"); -VToolHeight::VToolHeight(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, +VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, const Tool::Sources &typeCreation, QGraphicsItem * parent) :VToolLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), p1LineId(p1LineId), p2LineId(p2LineId) @@ -60,13 +60,13 @@ void VToolHeight::setDialog() dialogTool->setPointName(p->name()); } -void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, +void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogHeight *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - disconnect(doc, &VDomDocument::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList); + disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList); QString pointName = dialogTool->getPointName(); QString typeLine = dialogTool->getTypeLine(); qint64 basePointId = dialogTool->getBasePointId(); @@ -78,7 +78,7 @@ void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocu void VToolHeight::Create(const qint64 _id, const QString &pointName, const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VPointF *basePoint = data->GeometricObject(basePointId); @@ -154,16 +154,16 @@ void VToolHeight::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrBasePoint, basePointId); - SetAttribute(domElement, AttrP1Line, p1LineId); - SetAttribute(domElement, AttrP2Line, p2LineId); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrBasePoint, basePointId); + doc->SetAttribute(domElement, AttrP1Line, p1LineId); + doc->SetAttribute(domElement, AttrP2Line, p2LineId); AddToCalculation(domElement); @@ -175,13 +175,13 @@ void VToolHeight::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrBasePoint, basePointId); - SetAttribute(domElement, AttrP1Line, p1LineId); - SetAttribute(domElement, AttrP2Line, p2LineId); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrBasePoint, basePointId); + doc->SetAttribute(domElement, AttrP1Line, p1LineId); + doc->SetAttribute(domElement, AttrP2Line, p2LineId); } } @@ -190,9 +190,9 @@ void VToolHeight::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogHeight *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); - SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId())); - SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->getP1LineId())); - SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->getP2LineId())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); + doc->SetAttribute(domElement, AttrBasePoint, QString().setNum(dialogTool->getBasePointId())); + doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->getP1LineId())); + doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->getP2LineId())); } diff --git a/src/tools/drawTools/vtoolheight.h b/src/tools/drawTools/vtoolheight.h index 085407efb..f1117041a 100644 --- a/src/tools/drawTools/vtoolheight.h +++ b/src/tools/drawTools/vtoolheight.h @@ -50,7 +50,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolHeight(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + VToolHeight(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** @@ -64,7 +64,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool * @param _id tool id, 0 if tool doesn't exist yet. @@ -83,7 +83,7 @@ public: */ static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); /** * @brief FindPoint find projection base point onto line. diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index 47cb56a2a..36aa631ce 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -31,7 +31,7 @@ const QString VToolLine::TagName = QStringLiteral("line"); -VToolLine::VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, +VToolLine::VToolLine(VPattern *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, const QString &typeLine, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint) { @@ -67,7 +67,7 @@ void VToolLine::setDialog() dialogTool->setTypeLine(typeLine); } -void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data) +void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogLine *dialogTool = qobject_cast(dialog); @@ -79,7 +79,7 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocume } void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, const QString &typeLine, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { Q_CHECK_PTR(scene); @@ -156,10 +156,10 @@ void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolLine::AddToFile() { QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrFirstPoint, firstPoint); - SetAttribute(domElement, AttrSecondPoint, secondPoint); - SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrFirstPoint, firstPoint); + doc->SetAttribute(domElement, AttrSecondPoint, secondPoint); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); AddToCalculation(domElement); } @@ -169,9 +169,9 @@ void VToolLine::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrFirstPoint, firstPoint); - SetAttribute(domElement, AttrSecondPoint, secondPoint); - SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrFirstPoint, firstPoint); + doc->SetAttribute(domElement, AttrSecondPoint, secondPoint); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); } } @@ -229,9 +229,9 @@ void VToolLine::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogLine *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint())); - SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint())); - SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); + doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint())); + doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint())); + doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); } void VToolLine::RefreshGeometry() diff --git a/src/tools/drawTools/vtoolline.h b/src/tools/drawTools/vtoolline.h index 1b8534c5c..4ca4ffcf9 100644 --- a/src/tools/drawTools/vtoolline.h +++ b/src/tools/drawTools/vtoolline.h @@ -51,7 +51,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolLine(VDomDocument *doc, VContainer *data, qint64 id, qint64 firstPoint, + VToolLine(VPattern *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, const QString &typeLine, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** @@ -65,7 +65,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -79,7 +79,7 @@ public: * @param typeCreation way we create this tool. */ static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, const QString &typeLine, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; public slots: diff --git a/src/tools/drawTools/vtoollineintersect.cpp b/src/tools/drawTools/vtoollineintersect.cpp index 716b19386..132d6fff2 100644 --- a/src/tools/drawTools/vtoollineintersect.cpp +++ b/src/tools/drawTools/vtoollineintersect.cpp @@ -31,7 +31,7 @@ const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect"); -VToolLineIntersect::VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, +VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p2Line2, const Tool::Sources &typeCreation, QGraphicsItem *parent) @@ -62,7 +62,7 @@ void VToolLineIntersect::setDialog() dialogTool->setPointName(p->name()); } -void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data) +void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogLineIntersect *dialogTool = qobject_cast(dialog); @@ -79,7 +79,7 @@ void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, V void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, + VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VPointF *p1Line1 = data->GeometricObject(p1Line1Id); @@ -165,16 +165,16 @@ void VToolLineIntersect::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrP1Line1, p1Line1); - SetAttribute(domElement, AttrP2Line1, p2Line1); - SetAttribute(domElement, AttrP1Line2, p1Line2); - SetAttribute(domElement, AttrP2Line2, p2Line2); + doc->SetAttribute(domElement, AttrP1Line1, p1Line1); + doc->SetAttribute(domElement, AttrP2Line1, p2Line1); + doc->SetAttribute(domElement, AttrP1Line2, p1Line2); + doc->SetAttribute(domElement, AttrP2Line2, p2Line2); AddToCalculation(domElement); } @@ -185,13 +185,13 @@ void VToolLineIntersect::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrP1Line1, p1Line1); - SetAttribute(domElement, AttrP2Line1, p2Line1); - SetAttribute(domElement, AttrP1Line2, p1Line2); - SetAttribute(domElement, AttrP2Line2, p2Line2); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrP1Line1, p1Line1); + doc->SetAttribute(domElement, AttrP2Line1, p2Line1); + doc->SetAttribute(domElement, AttrP1Line2, p1Line2); + doc->SetAttribute(domElement, AttrP2Line2, p2Line2); } } @@ -208,9 +208,9 @@ void VToolLineIntersect::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogLineIntersect *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogTool->getP1Line1())); - SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogTool->getP2Line1())); - SetAttribute(domElement, AttrP1Line2, QString().setNum(dialogTool->getP1Line2())); - SetAttribute(domElement, AttrP2Line2, QString().setNum(dialogTool->getP2Line2())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrP1Line1, QString().setNum(dialogTool->getP1Line1())); + doc->SetAttribute(domElement, AttrP2Line1, QString().setNum(dialogTool->getP2Line1())); + doc->SetAttribute(domElement, AttrP1Line2, QString().setNum(dialogTool->getP1Line2())); + doc->SetAttribute(domElement, AttrP2Line2, QString().setNum(dialogTool->getP2Line2())); } diff --git a/src/tools/drawTools/vtoollineintersect.h b/src/tools/drawTools/vtoollineintersect.h index f39dc0b6e..14125de25 100644 --- a/src/tools/drawTools/vtoollineintersect.h +++ b/src/tools/drawTools/vtoollineintersect.h @@ -50,7 +50,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolLineIntersect(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, + VToolLineIntersect(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p2Line2, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** @@ -64,7 +64,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -83,7 +83,7 @@ public: */ static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; public slots: diff --git a/src/tools/drawTools/vtoollinepoint.cpp b/src/tools/drawTools/vtoollinepoint.cpp index ff7d53dc4..e3dfab958 100644 --- a/src/tools/drawTools/vtoollinepoint.cpp +++ b/src/tools/drawTools/vtoollinepoint.cpp @@ -28,7 +28,7 @@ #include "vtoollinepoint.h" -VToolLinePoint::VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, +VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &basePointId, const qreal &angle, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), formula(formula), angle(angle), basePointId(basePointId), diff --git a/src/tools/drawTools/vtoollinepoint.h b/src/tools/drawTools/vtoollinepoint.h index 2ba9bd9ab..c15dd18b9 100644 --- a/src/tools/drawTools/vtoollinepoint.h +++ b/src/tools/drawTools/vtoollinepoint.h @@ -49,7 +49,7 @@ public: * @param angle line angle. * @param parent parent object. */ - VToolLinePoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + VToolLinePoint(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &basePointId, const qreal &angle, QGraphicsItem * parent = 0); public slots: diff --git a/src/tools/drawTools/vtoolnormal.cpp b/src/tools/drawTools/vtoolnormal.cpp index af31122f0..b34e84c12 100644 --- a/src/tools/drawTools/vtoolnormal.cpp +++ b/src/tools/drawTools/vtoolnormal.cpp @@ -32,7 +32,7 @@ const QString VToolNormal::ToolType = QStringLiteral("normal"); -VToolNormal::VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, +VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent), @@ -63,7 +63,7 @@ void VToolNormal::setDialog() dialogTool->setPointName(p->name()); } -void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data) +void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogNormal *dialogTool = qobject_cast(dialog); @@ -81,7 +81,7 @@ void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocu void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, const QString &pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, + VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VPointF *firstPoint = data->GeometricObject(firstPointId); @@ -168,17 +168,17 @@ void VToolNormal::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrAngle, angle); - SetAttribute(domElement, AttrFirstPoint, basePointId); - SetAttribute(domElement, AttrSecondPoint, secondPointId); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrAngle, angle); + doc->SetAttribute(domElement, AttrFirstPoint, basePointId); + doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } @@ -189,14 +189,14 @@ void VToolNormal::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrAngle, angle); - SetAttribute(domElement, AttrFirstPoint, basePointId); - SetAttribute(domElement, AttrSecondPoint, secondPointId); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrAngle, angle); + doc->SetAttribute(domElement, AttrFirstPoint, basePointId); + doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); } } @@ -211,10 +211,10 @@ void VToolNormal::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogNormal *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); - SetAttribute(domElement, AttrLength, dialogTool->getFormula()); - SetAttribute(domElement, AttrAngle, QString().setNum(dialogTool->getAngle())); - SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId())); - SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); + doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); + doc->SetAttribute(domElement, AttrAngle, QString().setNum(dialogTool->getAngle())); + doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId())); + doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId())); } diff --git a/src/tools/drawTools/vtoolnormal.h b/src/tools/drawTools/vtoolnormal.h index 018374b8d..ae79635c9 100644 --- a/src/tools/drawTools/vtoolnormal.h +++ b/src/tools/drawTools/vtoolnormal.h @@ -51,7 +51,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolNormal(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + VToolNormal(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qreal &angle, const qint64 &firstPointId, const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); @@ -66,7 +66,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -87,7 +87,7 @@ public: static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, const QString &pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, + VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); /** * @brief FindPoint return normal point. diff --git a/src/tools/drawTools/vtoolpoint.cpp b/src/tools/drawTools/vtoolpoint.cpp index 4baf9a1d6..c906561b1 100644 --- a/src/tools/drawTools/vtoolpoint.cpp +++ b/src/tools/drawTools/vtoolpoint.cpp @@ -30,7 +30,7 @@ const QString VToolPoint::TagName = QStringLiteral("point"); -VToolPoint::VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem *parent):VDrawTool(doc, data, id), +VToolPoint::VToolPoint(VPattern *doc, VContainer *data, qint64 id, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0) { namePoint = new VGraphicsSimpleTextItem(this); @@ -65,8 +65,8 @@ void VToolPoint::UpdateNamePosition(qreal mx, qreal my) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrMx, toMM(mx)); - SetAttribute(domElement, AttrMy, toMM(my)); + doc->SetAttribute(domElement, AttrMx, toMM(mx)); + doc->SetAttribute(domElement, AttrMy, toMM(my)); emit toolhaveChange(); } } diff --git a/src/tools/drawTools/vtoolpoint.h b/src/tools/drawTools/vtoolpoint.h index 23c4ae4f2..22a48c9be 100644 --- a/src/tools/drawTools/vtoolpoint.h +++ b/src/tools/drawTools/vtoolpoint.h @@ -46,7 +46,7 @@ public: * @param id object id in container. * @param parent parent object. */ - VToolPoint(VDomDocument *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0); + VToolPoint(VPattern *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0); virtual ~VToolPoint(){} static const QString TagName; public slots: diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index 5fe5dba03..261716c9a 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -32,7 +32,7 @@ const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact"); -VToolPointOfContact::VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, +VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const qint64 &id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) @@ -88,7 +88,7 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF ¢e return pArc; } -void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data) +void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogPointOfContact *dialogTool = qobject_cast(dialog); @@ -105,7 +105,7 @@ void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VPointF *centerP = data->GeometricObject(center); @@ -188,16 +188,16 @@ void VToolPointOfContact::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrRadius, arcRadius); - SetAttribute(domElement, AttrCenter, center); - SetAttribute(domElement, AttrFirstPoint, firstPointId); - SetAttribute(domElement, AttrSecondPoint, secondPointId); + doc->SetAttribute(domElement, AttrRadius, arcRadius); + doc->SetAttribute(domElement, AttrCenter, center); + doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); + doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } @@ -208,13 +208,13 @@ void VToolPointOfContact::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrRadius, arcRadius); - SetAttribute(domElement, AttrCenter, center); - SetAttribute(domElement, AttrFirstPoint, firstPointId); - SetAttribute(domElement, AttrSecondPoint, secondPointId); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrRadius, arcRadius); + doc->SetAttribute(domElement, AttrCenter, center); + doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); + doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); } } @@ -230,9 +230,9 @@ void VToolPointOfContact::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogPointOfContact *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrRadius, dialogTool->getRadius()); - SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->getCenter())); - SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint())); - SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrRadius, dialogTool->getRadius()); + doc->SetAttribute(domElement, AttrCenter, QString().setNum(dialogTool->getCenter())); + doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPoint())); + doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPoint())); } diff --git a/src/tools/drawTools/vtoolpointofcontact.h b/src/tools/drawTools/vtoolpointofcontact.h index 0855537c8..6dd7b5482 100644 --- a/src/tools/drawTools/vtoolpointofcontact.h +++ b/src/tools/drawTools/vtoolpointofcontact.h @@ -49,7 +49,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolPointOfContact(VDomDocument *doc, VContainer *data, const qint64 &id, + VToolPointOfContact(VPattern *doc, VContainer *data, const qint64 &id, const QString &arcRadius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); @@ -74,7 +74,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -93,7 +93,7 @@ public: */ static void Create(const qint64 _id, const QString &arcRadius, const qint64 ¢er, const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; public slots: diff --git a/src/tools/drawTools/vtoolpointofintersection.cpp b/src/tools/drawTools/vtoolpointofintersection.cpp index 7f374a654..5775196dc 100644 --- a/src/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/tools/drawTools/vtoolpointofintersection.cpp @@ -31,7 +31,7 @@ const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection"); -VToolPointOfIntersection::VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, +VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &firstPointId, const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), firstPointId(firstPointId), secondPointId(secondPointId) @@ -58,7 +58,7 @@ void VToolPointOfIntersection::setDialog() dialogTool->setPointName(p->name()); } -void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, +void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); @@ -72,7 +72,7 @@ void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *sc void VToolPointOfIntersection::Create(const qint64 _id, const QString &pointName, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VPointF *firstPoint = data->GeometricObject(firstPointId); @@ -138,14 +138,14 @@ void VToolPointOfIntersection::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrFirstPoint, firstPointId); - SetAttribute(domElement, AttrSecondPoint, secondPointId); + doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); + doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } @@ -156,11 +156,11 @@ void VToolPointOfIntersection::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrFirstPoint, firstPointId); - SetAttribute(domElement, AttrSecondPoint, secondPointId); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); + doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); } } @@ -169,7 +169,7 @@ void VToolPointOfIntersection::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogPointOfIntersection *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId())); - SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId())); + doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId())); } diff --git a/src/tools/drawTools/vtoolpointofintersection.h b/src/tools/drawTools/vtoolpointofintersection.h index 33e2905c6..1692c75e4 100644 --- a/src/tools/drawTools/vtoolpointofintersection.h +++ b/src/tools/drawTools/vtoolpointofintersection.h @@ -48,7 +48,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolPointOfIntersection(VDomDocument *doc, VContainer *data, const qint64 &id, + VToolPointOfIntersection(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &firstPointId, const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** @@ -62,7 +62,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -79,7 +79,7 @@ public: */ static void Create(const qint64 _id, const QString &pointName, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, + VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; public slots: diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 98ca0ce68..04ab02cd3 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -32,7 +32,7 @@ const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder"); -VToolShoulderPoint::VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, +VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, const qint64 &pShoulder, const Tool::Sources &typeCreation, QGraphicsItem * parent) @@ -89,7 +89,7 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li } } -void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data) +void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogShoulderPoint *dialogTool = qobject_cast(dialog); @@ -107,7 +107,7 @@ void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, V void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VPointF *firstPoint = data->GeometricObject(p1Line); @@ -190,17 +190,17 @@ void VToolShoulderPoint::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrP1Line, basePointId); - SetAttribute(domElement, AttrP2Line, p2Line); - SetAttribute(domElement, AttrPShoulder, pShoulder); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrP1Line, basePointId); + doc->SetAttribute(domElement, AttrP2Line, p2Line); + doc->SetAttribute(domElement, AttrPShoulder, pShoulder); AddToCalculation(domElement); } @@ -211,14 +211,14 @@ void VToolShoulderPoint::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrName, toMM(point->mx())); - SetAttribute(domElement, AttrName, toMM(point->my())); - SetAttribute(domElement, AttrTypeLine, typeLine); - SetAttribute(domElement, AttrLength, formula); - SetAttribute(domElement, AttrP1Line, basePointId); - SetAttribute(domElement, AttrP2Line, p2Line); - SetAttribute(domElement, AttrPShoulder, pShoulder); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrName, toMM(point->mx())); + doc->SetAttribute(domElement, AttrName, toMM(point->my())); + doc->SetAttribute(domElement, AttrTypeLine, typeLine); + doc->SetAttribute(domElement, AttrLength, formula); + doc->SetAttribute(domElement, AttrP1Line, basePointId); + doc->SetAttribute(domElement, AttrP2Line, p2Line); + doc->SetAttribute(domElement, AttrPShoulder, pShoulder); } } @@ -234,10 +234,10 @@ void VToolShoulderPoint::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogShoulderPoint *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); - SetAttribute(domElement, AttrLength, dialogTool->getFormula()); - SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->getP1Line())); - SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->getP2Line())); - SetAttribute(domElement, AttrPShoulder, QString().setNum(dialogTool->getPShoulder())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrTypeLine, dialogTool->getTypeLine()); + doc->SetAttribute(domElement, AttrLength, dialogTool->getFormula()); + doc->SetAttribute(domElement, AttrP1Line, QString().setNum(dialogTool->getP1Line())); + doc->SetAttribute(domElement, AttrP2Line, QString().setNum(dialogTool->getP2Line())); + doc->SetAttribute(domElement, AttrPShoulder, QString().setNum(dialogTool->getPShoulder())); } diff --git a/src/tools/drawTools/vtoolshoulderpoint.h b/src/tools/drawTools/vtoolshoulderpoint.h index fec464fc2..0566a994e 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.h +++ b/src/tools/drawTools/vtoolshoulderpoint.h @@ -51,7 +51,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolShoulderPoint(VDomDocument *doc, VContainer *data, const qint64 &id, const QString &typeLine, + VToolShoulderPoint(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, const qint64 &pShoulder, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); @@ -76,7 +76,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -96,7 +96,7 @@ public: */ static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, - const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; public slots: diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index 38922455b..f470b4d1f 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -31,7 +31,7 @@ const QString VToolSinglePoint::ToolType = QStringLiteral("single"); -VToolSinglePoint::VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, +VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, QGraphicsItem * parent ) :VToolPoint(doc, data, id, parent) { @@ -66,13 +66,13 @@ void VToolSinglePoint::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrX, toMM(point->x())); - SetAttribute(domElement, AttrY, toMM(point->y())); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrX, toMM(point->x())); + doc->SetAttribute(domElement, AttrY, toMM(point->y())); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); AddToCalculation(domElement); } @@ -83,11 +83,11 @@ void VToolSinglePoint::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrX, QString().setNum(toMM(point->x()))); - SetAttribute(domElement, AttrY, QString().setNum(toMM(point->y()))); - SetAttribute(domElement, AttrMx, QString().setNum(toMM(point->mx()))); - SetAttribute(domElement, AttrMy, QString().setNum(toMM(point->my()))); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrX, QString().setNum(toMM(point->x()))); + doc->SetAttribute(domElement, AttrY, QString().setNum(toMM(point->y()))); + doc->SetAttribute(domElement, AttrMx, QString().setNum(toMM(point->mx()))); + doc->SetAttribute(domElement, AttrMy, QString().setNum(toMM(point->my()))); } } @@ -113,8 +113,8 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrX, QString().setNum(toMM(newPos.x()))); - SetAttribute(domElement, AttrY, QString().setNum(toMM(newPos.y()))); + doc->SetAttribute(domElement, AttrX, QString().setNum(toMM(newPos.x()))); + doc->SetAttribute(domElement, AttrY, QString().setNum(toMM(newPos.y()))); QList list = this->scene()->views(); VAbstractTool::NewSceneRect(this->scene(), list[0]); @@ -142,9 +142,9 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialogTool); QPointF p = dialogTool->getPoint(); QString name = dialogTool->getName(); - SetAttribute(domElement, AttrName, name); - SetAttribute(domElement, AttrX, QString().setNum(toMM(p.x()))); - SetAttribute(domElement, AttrY, QString().setNum(toMM(p.y()))); + doc->SetAttribute(domElement, AttrName, name); + doc->SetAttribute(domElement, AttrX, QString().setNum(toMM(p.x()))); + doc->SetAttribute(domElement, AttrY, QString().setNum(toMM(p.y()))); } void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color) diff --git a/src/tools/drawTools/vtoolsinglepoint.h b/src/tools/drawTools/vtoolsinglepoint.h index 625a2b231..2e09e0353 100644 --- a/src/tools/drawTools/vtoolsinglepoint.h +++ b/src/tools/drawTools/vtoolsinglepoint.h @@ -47,7 +47,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolSinglePoint (VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, + VToolSinglePoint (VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0 ); /** * @brief setDialog set dialog when user want change tool option. diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index 02760da64..cada66ebe 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -33,7 +33,7 @@ const QString VToolSpline::TagName = QStringLiteral("spline"); const QString VToolSpline::ToolType = QStringLiteral("simple"); -VToolSpline::VToolSpline(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, +VToolSpline::VToolSpline(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector()) { @@ -90,7 +90,7 @@ void VToolSpline::setDialog() dialogTool->setKCurve(spl->GetKcurve()); } -void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, +void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); @@ -109,7 +109,7 @@ void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocu void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { VPointF point1 = *data->GeometricObject(p1); @@ -166,11 +166,11 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrAngle1, QString().setNum(spl.GetAngle1())); - SetAttribute(domElement, AttrAngle2, QString().setNum(spl.GetAngle2())); - SetAttribute(domElement, AttrKAsm1, QString().setNum(spl.GetKasm1())); - SetAttribute(domElement, AttrKAsm2, QString().setNum(spl.GetKasm2())); - SetAttribute(domElement, AttrKCurve, QString().setNum(spl.GetKcurve())); + doc->SetAttribute(domElement, AttrAngle1, QString().setNum(spl.GetAngle1())); + doc->SetAttribute(domElement, AttrAngle2, QString().setNum(spl.GetAngle2())); + doc->SetAttribute(domElement, AttrKAsm1, QString().setNum(spl.GetKasm1())); + doc->SetAttribute(domElement, AttrKAsm2, QString().setNum(spl.GetKasm2())); + doc->SetAttribute(domElement, AttrKCurve, QString().setNum(spl.GetKcurve())); emit FullUpdateTree(); emit toolhaveChange(); } @@ -186,15 +186,15 @@ void VToolSpline::AddToFile() const VSpline *spl = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrPoint1, spl->GetP1().id()); - SetAttribute(domElement, AttrPoint4, spl->GetP4().id()); - SetAttribute(domElement, AttrAngle1, spl->GetAngle1()); - SetAttribute(domElement, AttrAngle2, spl->GetAngle2()); - SetAttribute(domElement, AttrKAsm1, spl->GetKasm1()); - SetAttribute(domElement, AttrKAsm2, spl->GetKasm2()); - SetAttribute(domElement, AttrKCurve, spl->GetKcurve()); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrPoint1, spl->GetP1().id()); + doc->SetAttribute(domElement, AttrPoint4, spl->GetP4().id()); + doc->SetAttribute(domElement, AttrAngle1, spl->GetAngle1()); + doc->SetAttribute(domElement, AttrAngle2, spl->GetAngle2()); + doc->SetAttribute(domElement, AttrKAsm1, spl->GetKasm1()); + doc->SetAttribute(domElement, AttrKAsm2, spl->GetKasm2()); + doc->SetAttribute(domElement, AttrKCurve, spl->GetKcurve()); AddToCalculation(domElement); } @@ -205,13 +205,13 @@ void VToolSpline::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrPoint1, spl->GetP1().id()); - SetAttribute(domElement, AttrPoint4, spl->GetP4().id()); - SetAttribute(domElement, AttrAngle1, spl->GetAngle1()); - SetAttribute(domElement, AttrAngle2, spl->GetAngle2()); - SetAttribute(domElement, AttrKAsm1, spl->GetKasm1()); - SetAttribute(domElement, AttrKAsm2, spl->GetKasm2()); - SetAttribute(domElement, AttrKCurve, spl->GetKcurve()); + doc->SetAttribute(domElement, AttrPoint1, spl->GetP1().id()); + doc->SetAttribute(domElement, AttrPoint4, spl->GetP4().id()); + doc->SetAttribute(domElement, AttrAngle1, spl->GetAngle1()); + doc->SetAttribute(domElement, AttrAngle2, spl->GetAngle2()); + doc->SetAttribute(domElement, AttrKAsm1, spl->GetKasm1()); + doc->SetAttribute(domElement, AttrKAsm2, spl->GetKasm2()); + doc->SetAttribute(domElement, AttrKCurve, spl->GetKcurve()); } } @@ -298,13 +298,13 @@ void VToolSpline::SaveDialog(QDomElement &domElement) spl = VSpline (point1, controlPoints[0]->pos(), controlPoints[1]->pos(), point4, dialogTool->getKCurve()); - SetAttribute(domElement, AttrPoint1, spl.GetP1().id()); - SetAttribute(domElement, AttrPoint4, spl.GetP4().id()); - SetAttribute(domElement, AttrAngle1, spl.GetAngle1()); - SetAttribute(domElement, AttrAngle2, spl.GetAngle2()); - SetAttribute(domElement, AttrKAsm1, spl.GetKasm1()); - SetAttribute(domElement, AttrKAsm2, spl.GetKasm2()); - SetAttribute(domElement, AttrKCurve, spl.GetKcurve()); + doc->SetAttribute(domElement, AttrPoint1, spl.GetP1().id()); + doc->SetAttribute(domElement, AttrPoint4, spl.GetP4().id()); + doc->SetAttribute(domElement, AttrAngle1, spl.GetAngle1()); + doc->SetAttribute(domElement, AttrAngle2, spl.GetAngle2()); + doc->SetAttribute(domElement, AttrKAsm1, spl.GetKasm1()); + doc->SetAttribute(domElement, AttrKAsm2, spl.GetKasm2()); + doc->SetAttribute(domElement, AttrKCurve, spl.GetKcurve()); } void VToolSpline::RefreshGeometry() diff --git a/src/tools/drawTools/vtoolspline.h b/src/tools/drawTools/vtoolspline.h index fc8350083..ce15a1500 100644 --- a/src/tools/drawTools/vtoolspline.h +++ b/src/tools/drawTools/vtoolspline.h @@ -49,7 +49,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolSpline (VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, + VToolSpline (VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0 ); /** * @brief setDialog set dialog when user want change tool option. @@ -62,7 +62,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -81,7 +81,7 @@ public: */ static void Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; static const QString ToolType; diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index 4316905f5..587854374 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -32,7 +32,7 @@ const QString VToolSplinePath::TagName = QStringLiteral("spline"); const QString VToolSplinePath::ToolType = QStringLiteral("path"); -VToolSplinePath::VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, +VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector()) { @@ -84,7 +84,7 @@ void VToolSplinePath::setDialog() dialogTool->SetPath(*splPath); } -void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data) +void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogSplinePath *dialogTool = qobject_cast(dialog); @@ -99,7 +99,7 @@ void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDom } void VToolSplinePath::Create(const qint64 _id, VSplinePath *path, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, + VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { qint64 id = _id; @@ -151,7 +151,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); + doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); emit FullUpdateTree(); emit toolhaveChange(); @@ -181,10 +181,10 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path) if (domElement.isNull() == false) { VSplinePoint p = path[i]; - SetAttribute(domElement, AttrPSpline, p.P().id()); - SetAttribute(domElement, AttrKAsm1, p.KAsm1()); - SetAttribute(domElement, AttrKAsm2, p.KAsm2()); - SetAttribute(domElement, AttrAngle, p.Angle2()); + doc->SetAttribute(domElement, AttrPSpline, p.P().id()); + doc->SetAttribute(domElement, AttrKAsm1, p.KAsm1()); + doc->SetAttribute(domElement, AttrKAsm2, p.KAsm2()); + doc->SetAttribute(domElement, AttrAngle, p.Angle2()); } } } @@ -230,9 +230,9 @@ void VToolSplinePath::AddToFile() VSplinePath splPath = *VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrKCurve, splPath.getKCurve()); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrKCurve, splPath.getKCurve()); for (qint32 i = 0; i < splPath.CountPoint(); ++i) { @@ -268,7 +268,7 @@ void VToolSplinePath::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); + doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); } @@ -279,10 +279,10 @@ void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint & { QDomElement pathPoint = doc->createElement(AttrPathPoint); - SetAttribute(pathPoint, AttrPSpline, splPoint.P().id()); - SetAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1()); - SetAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2()); - SetAttribute(pathPoint, AttrAngle, splPoint.Angle2()); + doc->SetAttribute(pathPoint, AttrPSpline, splPoint.P().id()); + doc->SetAttribute(pathPoint, AttrKAsm1, splPoint.KAsm1()); + doc->SetAttribute(pathPoint, AttrKAsm2, splPoint.KAsm2()); + doc->SetAttribute(pathPoint, AttrAngle, splPoint.Angle2()); domElement.appendChild(pathPoint); } @@ -376,7 +376,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement) CorectControlPoints(spl, splPath, i); } - SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); + doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); } diff --git a/src/tools/drawTools/vtoolsplinepath.h b/src/tools/drawTools/vtoolsplinepath.h index a905f4cf8..77398eba1 100644 --- a/src/tools/drawTools/vtoolsplinepath.h +++ b/src/tools/drawTools/vtoolsplinepath.h @@ -48,7 +48,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolSplinePath(VDomDocument *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, + VToolSplinePath(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -61,7 +61,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -73,7 +73,7 @@ public: * @param typeCreation way we create this tool. */ static void Create(const qint64 _id, VSplinePath *path, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, + VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; static const QString ToolType; diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index c0be5dd83..4dd50e717 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -31,7 +31,7 @@ const QString VToolTriangle::ToolType = QStringLiteral("triangle"); -VToolTriangle::VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, +VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId), @@ -62,7 +62,7 @@ void VToolTriangle::setDialog() } void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data) + VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogTriangle *dialogTool = qobject_cast(dialog); @@ -78,7 +78,7 @@ void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene, void VToolTriangle::Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, - const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VDomDocument *doc, + const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { const VPointF *axisP1 = data->GeometricObject(axisP1Id); @@ -194,16 +194,16 @@ void VToolTriangle::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrAxisP1, axisP1Id); - SetAttribute(domElement, AttrAxisP2, axisP2Id); - SetAttribute(domElement, AttrFirstPoint, firstPointId); - SetAttribute(domElement, AttrSecondPoint, secondPointId); + doc->SetAttribute(domElement, AttrAxisP1, axisP1Id); + doc->SetAttribute(domElement, AttrAxisP2, axisP2Id); + doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); + doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); AddToCalculation(domElement); } @@ -214,13 +214,13 @@ void VToolTriangle::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrName, point->name()); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); - SetAttribute(domElement, AttrAxisP1, axisP1Id); - SetAttribute(domElement, AttrAxisP2, axisP2Id); - SetAttribute(domElement, AttrFirstPoint, firstPointId); - SetAttribute(domElement, AttrSecondPoint, secondPointId); + doc->SetAttribute(domElement, AttrName, point->name()); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrAxisP1, axisP1Id); + doc->SetAttribute(domElement, AttrAxisP2, axisP2Id); + doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); + doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); } } @@ -229,9 +229,9 @@ void VToolTriangle::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialog); DialogTriangle *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - SetAttribute(domElement, AttrName, dialogTool->getPointName()); - SetAttribute(domElement, AttrAxisP1, QString().setNum(dialogTool->getAxisP1Id())); - SetAttribute(domElement, AttrAxisP2, QString().setNum(dialogTool->getAxisP2Id())); - SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId())); - SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId())); + doc->SetAttribute(domElement, AttrName, dialogTool->getPointName()); + doc->SetAttribute(domElement, AttrAxisP1, QString().setNum(dialogTool->getAxisP1Id())); + doc->SetAttribute(domElement, AttrAxisP2, QString().setNum(dialogTool->getAxisP2Id())); + doc->SetAttribute(domElement, AttrFirstPoint, QString().setNum(dialogTool->getFirstPointId())); + doc->SetAttribute(domElement, AttrSecondPoint, QString().setNum(dialogTool->getSecondPointId())); } diff --git a/src/tools/drawTools/vtooltriangle.h b/src/tools/drawTools/vtooltriangle.h index ba2f76bf4..9d6c4fc2d 100644 --- a/src/tools/drawTools/vtooltriangle.h +++ b/src/tools/drawTools/vtooltriangle.h @@ -50,7 +50,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolTriangle(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, + VToolTriangle(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** @@ -64,7 +64,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -83,7 +83,7 @@ public: */ static void Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); /** * @brief FindPoint find point intersection two foots right triangle. diff --git a/src/tools/nodeDetails/vabstractnode.cpp b/src/tools/nodeDetails/vabstractnode.cpp index 4a9464eb2..43f39520c 100644 --- a/src/tools/nodeDetails/vabstractnode.cpp +++ b/src/tools/nodeDetails/vabstractnode.cpp @@ -32,7 +32,7 @@ const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject"); const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool"); -VAbstractNode::VAbstractNode(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &idNode, +VAbstractNode::VAbstractNode(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &idNode, const qint64 &idTool, QObject *parent) : VAbstractTool(doc, data, id, parent), idNode(idNode), idTool(idTool) { @@ -76,7 +76,7 @@ void VAbstractNode::DeleteNode() void VAbstractNode::AddToModeling(const QDomElement &domElement) { QDomElement modelingElement; - bool ok = doc->GetActivModelingElement(modelingElement); + bool ok = doc->GetActivNodeElement(VPattern::TagModeling, modelingElement); if (ok) { modelingElement.appendChild(domElement); diff --git a/src/tools/nodeDetails/vabstractnode.h b/src/tools/nodeDetails/vabstractnode.h index fc3519cb8..181cfd165 100644 --- a/src/tools/nodeDetails/vabstractnode.h +++ b/src/tools/nodeDetails/vabstractnode.h @@ -46,7 +46,7 @@ public: * @param id object id in containerNode. * @param parent parent object. */ - VAbstractNode(VDomDocument *doc, VContainer *data, const qint64 &id, const qint64 &idNode, + VAbstractNode(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &idNode, const qint64 &idTool, QObject *parent = 0); virtual ~VAbstractNode() {} static const QString AttrIdObject; diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index ebda652c1..fe2516375 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -33,7 +33,7 @@ const QString VNodeArc::TagName = QStringLiteral("arc"); const QString VNodeArc::ToolType = QStringLiteral("modeling"); -VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Tool::Sources &typeCreation, +VNodeArc::VNodeArc(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent, QGraphicsItem *parent) :VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent) { @@ -50,7 +50,7 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, } } -void VNodeArc::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse, +void VNodeArc::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool, QObject *parent) { VAbstractTool::AddRecord(id, Tool::NodeArc, doc); @@ -93,12 +93,12 @@ void VNodeArc::AddToFile() { QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrIdObject, idNode); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrIdObject, idNode); if (idTool != 0) { - SetAttribute(domElement, AttrIdTool, idTool); + doc->SetAttribute(domElement, AttrIdTool, idTool); } AddToModeling(domElement); @@ -109,10 +109,10 @@ void VNodeArc::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrIdObject, idNode); + doc->SetAttribute(domElement, AttrIdObject, idNode); if (idTool != 0) { - SetAttribute(domElement, AttrIdTool, idTool); + doc->SetAttribute(domElement, AttrIdTool, idTool); } } } diff --git a/src/tools/nodeDetails/vnodearc.h b/src/tools/nodeDetails/vnodearc.h index 2a5093f69..6ab04e358 100644 --- a/src/tools/nodeDetails/vnodearc.h +++ b/src/tools/nodeDetails/vnodearc.h @@ -48,7 +48,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, + VNodeArc(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, QGraphicsItem * parent = 0); /** @@ -60,7 +60,7 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse, + static void Create(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *parent = 0); static const QString TagName; static const QString ToolType; diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index d86fbccd8..a3d7ffd14 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -33,7 +33,7 @@ const QString VNodePoint::TagName = QStringLiteral("point"); const QString VNodePoint::ToolType = QStringLiteral("modeling"); -VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, +VNodePoint::VNodePoint(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint, const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent, QGraphicsItem *parent) :VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), @@ -58,7 +58,7 @@ VNodePoint::VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 id } } -void VNodePoint::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, +void VNodePoint::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint, const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool, QObject *parent) { @@ -105,14 +105,14 @@ void VNodePoint::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrIdObject, idNode); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrIdObject, idNode); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); if (idTool != 0) { - SetAttribute(domElement, AttrIdTool, idTool); + doc->SetAttribute(domElement, AttrIdTool, idTool); } AddToModeling(domElement); @@ -124,12 +124,12 @@ void VNodePoint::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrIdObject, idNode); - SetAttribute(domElement, AttrMx, toMM(point->mx())); - SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrIdObject, idNode); + doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); + doc->SetAttribute(domElement, AttrMy, toMM(point->my())); if (idTool != 0) { - SetAttribute(domElement, AttrIdTool, idTool); + doc->SetAttribute(domElement, AttrIdTool, idTool); } } } @@ -172,8 +172,8 @@ void VNodePoint::UpdateNamePosition(qreal mx, qreal my) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrMx, QString().setNum(toMM(mx))); - SetAttribute(domElement, AttrMy, QString().setNum(toMM(my))); + doc->SetAttribute(domElement, AttrMx, QString().setNum(toMM(mx))); + doc->SetAttribute(domElement, AttrMy, QString().setNum(toMM(my))); emit toolhaveChange(); } } diff --git a/src/tools/nodeDetails/vnodepoint.h b/src/tools/nodeDetails/vnodepoint.h index 9e366c5af..ea66884c7 100644 --- a/src/tools/nodeDetails/vnodepoint.h +++ b/src/tools/nodeDetails/vnodepoint.h @@ -48,7 +48,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VNodePoint(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, + VNodePoint(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint, const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, QGraphicsItem * parent = 0 ); /** @@ -60,7 +60,7 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idPoint, + static void Create(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint, const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *parent = 0); static const QString TagName; diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index 7ec99d27b..778cf3c62 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -33,7 +33,7 @@ const QString VNodeSpline::TagName = QStringLiteral("spline"); const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline"); -VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, +VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent, QGraphicsItem * parent) :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) @@ -51,7 +51,7 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 } } -VNodeSpline *VNodeSpline::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, +VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool, QObject *parent) { @@ -96,12 +96,12 @@ void VNodeSpline::AddToFile() { QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrIdObject, idNode); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrIdObject, idNode); if (idTool != 0) { - SetAttribute(domElement, AttrIdTool, idTool); + doc->SetAttribute(domElement, AttrIdTool, idTool); } AddToModeling(domElement); @@ -112,10 +112,10 @@ void VNodeSpline::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrIdObject, QString().setNum(idNode)); + doc->SetAttribute(domElement, AttrIdObject, QString().setNum(idNode)); if (idTool != 0) { - SetAttribute(domElement, AttrIdTool, idTool); + doc->SetAttribute(domElement, AttrIdTool, idTool); } } } diff --git a/src/tools/nodeDetails/vnodespline.h b/src/tools/nodeDetails/vnodespline.h index 20559a3c5..aebc2b3c4 100644 --- a/src/tools/nodeDetails/vnodespline.h +++ b/src/tools/nodeDetails/vnodespline.h @@ -48,7 +48,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, + VNodeSpline(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, QGraphicsItem * parent = 0); /** @@ -61,7 +61,7 @@ public: * @param typeCreation way we create this tool. * @return */ - static VNodeSpline *Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, + static VNodeSpline *Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *parent = 0); static const QString TagName; diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index 54dc91ea5..db5effcfd 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -33,7 +33,7 @@ const QString VNodeSplinePath::TagName = QStringLiteral("spline"); const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); -VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, +VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent, QGraphicsItem * parent) :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) @@ -51,7 +51,7 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, } } -void VNodeSplinePath::Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, +void VNodeSplinePath::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool, QObject *parent) { @@ -100,12 +100,12 @@ void VNodeSplinePath::AddToFile() { QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrIdObject, idNode); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrIdObject, idNode); if (idTool != 0) { - SetAttribute(domElement, AttrIdTool, idTool); + doc->SetAttribute(domElement, AttrIdTool, idTool); } AddToModeling(domElement); @@ -116,10 +116,10 @@ void VNodeSplinePath::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrIdObject, QString().setNum(idNode)); + doc->SetAttribute(domElement, AttrIdObject, QString().setNum(idNode)); if (idTool != 0) { - SetAttribute(domElement, AttrIdTool, idTool); + doc->SetAttribute(domElement, AttrIdTool, idTool); } } } diff --git a/src/tools/nodeDetails/vnodesplinepath.h b/src/tools/nodeDetails/vnodesplinepath.h index 5429fee8c..5f35b8607 100644 --- a/src/tools/nodeDetails/vnodesplinepath.h +++ b/src/tools/nodeDetails/vnodesplinepath.h @@ -48,7 +48,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, + VNodeSplinePath(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, QGraphicsItem * parent = 0); /** @@ -60,7 +60,7 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(VDomDocument *doc, VContainer *data, qint64 id, qint64 idSpline, + static void Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *parent = 0); static const QString TagName; diff --git a/src/tools/vabstracttool.cpp b/src/tools/vabstracttool.cpp index 8bb711086..b1cc2a69c 100644 --- a/src/tools/vabstracttool.cpp +++ b/src/tools/vabstracttool.cpp @@ -69,13 +69,13 @@ const QString VAbstractTool::TypeLineDotLine = QStringLiteral("dotLine"); const QString VAbstractTool::TypeLineDashDotLine = QStringLiteral("dashDotLine"); const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine"); -VAbstractTool::VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent) +VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, qint64 id, QObject *parent) :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine) { Q_CHECK_PTR(doc); - connect(this, &VAbstractTool::toolhaveChange, this->doc, &VDomDocument::haveLiteChange); - connect(this->doc, &VDomDocument::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile); - connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VDomDocument::FullUpdateTree); + connect(this, &VAbstractTool::toolhaveChange, this->doc, &VPattern::haveLiteChange); + connect(this->doc, &VPattern::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile); + connect(this, &VAbstractTool::FullUpdateTree, this->doc, &VPattern::FullUpdateTree); emit toolhaveChange(); } @@ -303,7 +303,7 @@ const QStringList VAbstractTool::Styles() return styles; } -void VAbstractTool::AddRecord(const qint64 id, const Tool::Tools &toolType, VDomDocument *doc) +void VAbstractTool::AddRecord(const qint64 id, const Tool::Tools &toolType, VPattern *doc) { qint64 cursor = doc->getCursor(); QVector *history = doc->getHistory(); diff --git a/src/tools/vabstracttool.h b/src/tools/vabstracttool.h index c18f77f92..b866e14c0 100644 --- a/src/tools/vabstracttool.h +++ b/src/tools/vabstracttool.h @@ -30,7 +30,7 @@ #define VABSTRACTTOOL_H #include "vdatatool.h" -#include "../xml/vdomdocument.h" +#include "../xml/vpattern.h" #include /** @@ -47,7 +47,7 @@ public: * @param id object id in container. * @param parent parent object. */ - VAbstractTool(VDomDocument *doc, VContainer *data, qint64 id, QObject *parent = 0); + VAbstractTool(VPattern *doc, VContainer *data, qint64 id, QObject *parent = 0); virtual ~VAbstractTool(){} /** * @brief NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view. @@ -153,7 +153,7 @@ public: * @param toolType tool type * @param doc dom document container */ - static void AddRecord(const qint64 id, const Tool::Tools &toolType, VDomDocument *doc); + static void AddRecord(const qint64 id, const Tool::Tools &toolType, VPattern *doc); public slots: /** * @brief FullUpdateFromFile update tool data form file. @@ -178,7 +178,7 @@ protected: /** * @brief doc dom document container */ - VDomDocument *doc; + VPattern *doc; /** * @brief id object id. */ @@ -227,26 +227,7 @@ protected: * @return pen style. */ Qt::PenStyle LineStyle(); - template - /** - * @brief SetAttribute set attribute in pattern file. Replace "," by ".". - * @param domElement element in xml tree. - * @param name name of attribute. - * @param value value of attribute. - */ - void SetAttribute(QDomElement &domElement, const QString &name, const T &value) - { - QString val = QString().setNum(value); - val = val.replace(",", "."); - domElement.setAttribute(name, val); - } private: Q_DISABLE_COPY(VAbstractTool) }; - -template <> -inline void VAbstractTool::SetAttribute(QDomElement &domElement, const QString &name, const QString &value) -{ - domElement.setAttribute(name, value); -} #endif // VABSTRACTTOOL_H diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index 6a0e26e1d..278e2713a 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -40,7 +40,7 @@ const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType"); const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour"); const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling"); -VToolDetail::VToolDetail(VDomDocument *doc, VContainer *data, const qint64 &id, const Tool::Sources &typeCreation, +VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const qint64 &id, const Tool::Sources &typeCreation, VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(0), sceneDetails(scene) { @@ -93,7 +93,7 @@ void VToolDetail::setDialog() dialogTool->setDetails(detail); } -void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data) +void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogDetail *dialogTool = qobject_cast(dialog); @@ -140,7 +140,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocu Create(0, det, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolDetail::Create(const qint64 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VDomDocument *doc, +void VToolDetail::Create(const qint64 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { qint64 id = _id; @@ -188,10 +188,10 @@ void VToolDetail::FullUpdateFromGui(int result) DialogDetail *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); VDetail det = dialogTool->getDetails(); - SetAttribute(domElement, AttrName, det.getName()); - SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSeamAllowance())); - SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed())); - SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth())); + doc->SetAttribute(domElement, AttrName, det.getName()); + doc->SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSeamAllowance())); + doc->SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed())); + doc->SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth())); RemoveAllChild(domElement); for (ptrdiff_t i = 0; i < det.CountNode(); ++i) { @@ -221,13 +221,13 @@ void VToolDetail::AddToFile() VDetail detail = VAbstractTool::data.GetDetail(id); QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrName, detail.getName()); - SetAttribute(domElement, AttrMx, toMM(detail.getMx())); - SetAttribute(domElement, AttrMy, toMM(detail.getMy())); - SetAttribute(domElement, AttrSupplement, detail.getSeamAllowance()); - SetAttribute(domElement, AttrClosed, detail.getClosed()); - SetAttribute(domElement, AttrWidth, detail.getWidth()); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrName, detail.getName()); + doc->SetAttribute(domElement, AttrMx, toMM(detail.getMx())); + doc->SetAttribute(domElement, AttrMy, toMM(detail.getMy())); + doc->SetAttribute(domElement, AttrSupplement, detail.getSeamAllowance()); + doc->SetAttribute(domElement, AttrClosed, detail.getClosed()); + doc->SetAttribute(domElement, AttrWidth, detail.getWidth()); for (ptrdiff_t i = 0; i < detail.CountNode(); ++i) { @@ -235,7 +235,7 @@ void VToolDetail::AddToFile() } QDomElement element; - bool ok = doc->GetActivDetailsElement(element); + bool ok = doc->GetActivNodeElement(VPattern::TagDetails, element); if (ok) { element.appendChild(domElement); @@ -248,10 +248,10 @@ void VToolDetail::RefreshDataInFile() if (domElement.isElement()) { VDetail det = VAbstractTool::data.GetDetail(id); - SetAttribute(domElement, AttrName, det.getName()); - SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSeamAllowance())); - SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed())); - SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth())); + doc->SetAttribute(domElement, AttrName, det.getName()); + doc->SetAttribute(domElement, AttrSupplement, QString().setNum(det.getSeamAllowance())); + doc->SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed())); + doc->SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth())); RemoveAllChild(domElement); for (ptrdiff_t i = 0; i < det.CountNode(); ++i) { @@ -270,8 +270,8 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrMx, QString().setNum(toMM(newPos.x()))); - SetAttribute(domElement, AttrMy, QString().setNum(toMM(newPos.y()))); + doc->SetAttribute(domElement, AttrMx, QString().setNum(toMM(newPos.x()))); + doc->SetAttribute(domElement, AttrMy, QString().setNum(toMM(newPos.y()))); QList list = this->scene()->views(); VAbstractTool::NewSceneRect(this->scene(), list[0]); @@ -362,30 +362,30 @@ void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node) { QDomElement nod = doc->createElement(TagNode); - SetAttribute(nod, AttrIdObject, node.getId()); - SetAttribute(nod, AttrMx, toMM(node.getMx())); - SetAttribute(nod, AttrMy, toMM(node.getMy())); + doc->SetAttribute(nod, AttrIdObject, node.getId()); + doc->SetAttribute(nod, AttrMx, toMM(node.getMx())); + doc->SetAttribute(nod, AttrMy, toMM(node.getMy())); if (node.getTypeNode() == NodeDetail::Contour) { - SetAttribute(nod, AttrNodeType, NodeTypeContour); + doc->SetAttribute(nod, AttrNodeType, NodeTypeContour); } else { - SetAttribute(nod, AttrNodeType, NodeTypeModeling); + doc->SetAttribute(nod, AttrNodeType, NodeTypeModeling); } switch (node.getTypeTool()) { case (Tool::NodeArc): - SetAttribute(nod, AttrType, QStringLiteral("NodeArc")); + doc->SetAttribute(nod, AttrType, QStringLiteral("NodeArc")); break; case (Tool::NodePoint): - SetAttribute(nod, AttrType, QStringLiteral("NodePoint")); + doc->SetAttribute(nod, AttrType, QStringLiteral("NodePoint")); break; case (Tool::NodeSpline): - SetAttribute(nod, AttrType, QStringLiteral("NodeSpline")); + doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSpline")); break; case (Tool::NodeSplinePath): - SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); + doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); break; default: qWarning()<<"May be wrong tool type!!! Ignoring."<setY(line.p2().y()); } -void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data) +void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data) { Q_CHECK_PTR(dialog); DialogUnionDetails *dialogTool = qobject_cast(dialog); @@ -417,7 +417,7 @@ void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VD void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetail &d2, const qint64 &d1id, const qint64 &d2id, const ptrdiff_t &indexD1, const ptrdiff_t &indexD2, - VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data, + VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { VToolUnionDetails *unionDetails = 0; @@ -613,7 +613,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai } } -QVector VToolUnionDetails::GetDetailFromFile(VDomDocument *doc, const QDomElement &domElement) +QVector VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomElement &domElement) { QVector vector; QDomNodeList detailList = domElement.childNodes(); @@ -672,10 +672,10 @@ void VToolUnionDetails::AddToFile() { QDomElement domElement = doc->createElement(TagName); - SetAttribute(domElement, AttrId, id); - SetAttribute(domElement, AttrType, ToolType); - SetAttribute(domElement, AttrIndexD1, indexD1); - SetAttribute(domElement, AttrIndexD2, indexD2); + doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, AttrType, ToolType); + doc->SetAttribute(domElement, AttrIndexD1, indexD1); + doc->SetAttribute(domElement, AttrIndexD2, indexD2); AddDetail(domElement, d1); AddDetail(domElement, d2); @@ -688,8 +688,8 @@ void VToolUnionDetails::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - SetAttribute(domElement, AttrIndexD1, indexD1); - SetAttribute(domElement, AttrIndexD2, indexD2); + doc->SetAttribute(domElement, AttrIndexD1, indexD1); + doc->SetAttribute(domElement, AttrIndexD2, indexD2); QDomNode domNode = domElement.firstChild(); domNode = UpdateDetail(domNode, d1); @@ -713,30 +713,30 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node { QDomElement nod = doc->createElement(TagNode); - SetAttribute(nod, AttrIdObject, node.getId()); - SetAttribute(nod, AttrMx, toMM(node.getMx())); - SetAttribute(nod, AttrMy, toMM(node.getMy())); + doc->SetAttribute(nod, AttrIdObject, node.getId()); + doc->SetAttribute(nod, AttrMx, toMM(node.getMx())); + doc->SetAttribute(nod, AttrMy, toMM(node.getMy())); if (node.getTypeNode() == NodeDetail::Contour) { - SetAttribute(nod, AttrNodeType, NodeTypeContour); + doc->SetAttribute(nod, AttrNodeType, NodeTypeContour); } else { - SetAttribute(nod, AttrNodeType, NodeTypeModeling); + doc->SetAttribute(nod, AttrNodeType, NodeTypeModeling); } switch (node.getTypeTool()) { case (Tool::NodeArc): - SetAttribute(nod, AttrType, QStringLiteral("NodeArc")); + doc->SetAttribute(nod, AttrType, QStringLiteral("NodeArc")); break; case (Tool::NodePoint): - SetAttribute(nod, AttrType, QStringLiteral("NodePoint")); + doc->SetAttribute(nod, AttrType, QStringLiteral("NodePoint")); break; case (Tool::NodeSpline): - SetAttribute(nod, AttrType, QStringLiteral("NodeSpline")); + doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSpline")); break; case (Tool::NodeSplinePath): - SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); + doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); break; default: qWarning()<<"May be wrong tool type!!! Ignoring."<GetActivModelingElement(modelingElement); + bool ok = doc->GetActivNodeElement(VPattern::TagModeling, modelingElement); if (ok) { modelingElement.appendChild(domElement); diff --git a/src/tools/vtooluniondetails.h b/src/tools/vtooluniondetails.h index 5a7c68f8b..d8d507b01 100644 --- a/src/tools/vtooluniondetails.h +++ b/src/tools/vtooluniondetails.h @@ -51,7 +51,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolUnionDetails(VDomDocument *doc, VContainer *data, const qint64 &id, const VDetail &d1, const VDetail &d2, + VToolUnionDetails(VPattern *doc, VContainer *data, const qint64 &id, const VDetail &d1, const VDetail &d2, const ptrdiff_t &indexD1, const ptrdiff_t &indexD2, const Tool::Sources &typeCreation, QObject *parent = 0); /** @@ -64,7 +64,7 @@ public: * @param doc dom document container. * @param data container with variables. */ - static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VDomDocument *doc, VContainer *data); + static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *doc, VContainer *data); /** * @brief Create help create tool. * @param _id tool id, 0 if tool doesn't exist yet. @@ -82,7 +82,7 @@ public: */ static void Create(const qint64 _id, const VDetail &d1, const VDetail &d2, const qint64 &d1id, const qint64 &d2id, const ptrdiff_t &indexD1, const ptrdiff_t &indexD2, VMainGraphicsScene *scene, - VDomDocument *doc, VContainer *data, const Document::Documents &parse, + VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); /** * @brief GetDetailFromFile parse detail from file. @@ -90,7 +90,7 @@ public: * @param domElement tag in xml tree. * @return detail stored in file. */ - static QVector GetDetailFromFile(VDomDocument *doc, const QDomElement &domElement); + static QVector GetDetailFromFile(VPattern *doc, const QDomElement &domElement); static const QString TagName; static const QString ToolType; static const QString TagDetail; @@ -115,7 +115,7 @@ public: * @param pRotate point rotation. * @param angle angle rotation. */ - static void AddToNewDetail(QObject *tool, VDomDocument *doc, VContainer *data, VDetail &newDetail, + static void AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail, const VDetail &det, const ptrdiff_t &i, const qint64 &idTool, const qreal &dx = 0, const qreal &dy = 0, const qint64 &pRotate = 0, const qreal &angle = 0); /** diff --git a/src/widgets/vsimplesplinepath.cpp b/src/widgets/vsimplesplinepath.cpp index fb63883b4..1488fb1d8 100644 --- a/src/widgets/vsimplesplinepath.cpp +++ b/src/widgets/vsimplesplinepath.cpp @@ -28,7 +28,7 @@ #include "vsimplesplinepath.h" -VSimpleSplinePath::VSimpleSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qreal *factor) +VSimpleSplinePath::VSimpleSplinePath(VPattern *doc, VContainer *data, qint64 id, qreal *factor) :VAbstractTool(doc, data, id), factor(factor) { } diff --git a/src/widgets/vsimplesplinepath.h b/src/widgets/vsimplesplinepath.h index 457f32bf5..ae7af4fa7 100644 --- a/src/widgets/vsimplesplinepath.h +++ b/src/widgets/vsimplesplinepath.h @@ -47,7 +47,7 @@ public: * @param id spline path id. * @param factor scale factor. */ - VSimpleSplinePath(VDomDocument *doc, VContainer *data, qint64 id, qreal *factor); + VSimpleSplinePath(VPattern *doc, VContainer *data, qint64 id, qreal *factor); protected: /** * @brief mouseReleaseEvent handle mouse release events. diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index 2af908437..97155f9a5 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -27,35 +27,15 @@ *************************************************************************/ #include "vdomdocument.h" -#include "../exception/vexceptionwrongparameterid.h" #include "../exception/vexceptionconversionerror.h" #include "../exception/vexceptionemptyparameter.h" -#include "../exception/vexceptionuniqueid.h" -#include "../exception/vexceptionobjecterror.h" #include "../exception/vexceptionbadid.h" -#include "../tools/vtooldetail.h" -#include "../tools/vtooluniondetails.h" -#include "../tools/drawTools/drawtools.h" -#include "../tools/nodeDetails/nodedetails.h" -#include +VDomDocument::VDomDocument(VContainer *data) + : QDomDocument(), data(data), map(QHash()) +{ -VDomDocument::VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent) - : QObject(parent), QDomDocument(), map(QHash()), nameActivDraw(QString()), data(data), - tools(QHash()), history(QVector()), cursor(0), - comboBoxDraws(comboBoxDraws), mode(mode), patternModified(false){} - -VDomDocument::VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, - QObject *parent) - :QObject(parent), QDomDocument(name), map(QHash()), nameActivDraw(QString()), data(data), - tools(QHash()), history(QVector()), cursor(0), - comboBoxDraws(comboBoxDraws), mode(mode), patternModified(false){} - -VDomDocument::VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws, - Draw::Draws *mode, QObject *parent) - :QObject(parent), QDomDocument(doctype), map(QHash()), nameActivDraw(QString()), data(data), - tools(QHash()), history(QVector()), cursor(0), - comboBoxDraws(comboBoxDraws), mode(mode), patternModified(false){} +} QDomElement VDomDocument::elementById(const QString& id) { @@ -69,8 +49,7 @@ QDomElement VDomDocument::elementById(const QString& id) map.remove(id); } - bool res = this->find(this->documentElement(), id); - if (res) + if (this->find(this->documentElement(), id)) { return map[id]; } @@ -99,7 +78,7 @@ bool VDomDocument::find(const QDomElement &node, const QString& id) { if (node.hasAttribute("id")) { - QString value = node.attribute("id"); + const QString value = node.attribute("id"); this->map[value] = node; if (value == id) { @@ -112,55 +91,7 @@ bool VDomDocument::find(const QDomElement &node, const QString& id) QDomNode n = node.childNodes().at(i); if (n.isElement()) { - bool res = this->find(n.toElement(), id); - if (res) - { - return true; - } - } - } - - return false; -} - -void VDomDocument::CreateEmptyFile() -{ - QDomElement patternElement = this->createElement("pattern"); - this->appendChild(patternElement); - - QDomComment info = this->createComment("Valentina pattern format."); - patternElement.appendChild(info); - QDomNode xmlNode = this->createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); - this->insertBefore(xmlNode, this->firstChild()); - - QDomElement authorElement = this->createElement("author"); - patternElement.appendChild(authorElement); - - QDomElement descElement = this->createElement("description"); - patternElement.appendChild(descElement); - - QDomElement notesElement = this->createElement("notes"); - patternElement.appendChild(notesElement); - - QDomElement incrElement = this->createElement("increments"); - patternElement.appendChild(incrElement); -} - -bool VDomDocument::CheckNameDraw(const QString& name) const -{ - Q_ASSERT_X(name.isEmpty() == false, "CheckNameDraw", "name draw is empty"); - QDomNodeList elements = this->documentElement().elementsByTagName( "draw" ); - if (elements.size() == 0) - { - return false; - } - for ( qint32 i = 0; i < elements.count(); i++ ) - { - QDomElement elem = elements.at( i ).toElement(); - if (elem.isNull() == false) - { - QString fieldName = elem.attribute( "name" ); - if ( fieldName == name ) + if (this->find(n.toElement(), id)) { return true; } @@ -169,301 +100,14 @@ bool VDomDocument::CheckNameDraw(const QString& name) const return false; } -bool VDomDocument::appendDraw(const QString& name) -{ - Q_ASSERT_X(name.isEmpty() == false, "appendDraw", "name draw is empty"); - if (name.isEmpty()) - { - return false; - } - if (CheckNameDraw(name)== false) - { - QDomElement rootElement = this->documentElement(); - - QDomElement drawElement = this->createElement("draw"); - QDomAttr drawAttr = this->createAttribute("name"); - drawAttr.setValue(name); - drawElement.setAttributeNode(drawAttr); - - QDomElement calculationElement = this->createElement("calculation"); - QDomElement modelingElement = this->createElement("modeling"); - QDomElement pathsElement = this->createElement("details"); - drawElement.appendChild(calculationElement); - drawElement.appendChild(modelingElement); - drawElement.appendChild(pathsElement); - - rootElement.appendChild(drawElement); - - if (nameActivDraw.isEmpty()) - { - SetActivDraw(name); - } - else - { - ChangeActivDraw(name); - } - return true; - } - else - { - return false; - } - return false; -} - -void VDomDocument::ChangeActivDraw(const QString& name, const Document::Documents &parse) -{ - Q_ASSERT_X(name.isEmpty() == false, "ChangeActivDraw", "name draw is empty"); - if (CheckNameDraw(name) == true) - { - this->nameActivDraw = name; - if (parse == Document::FullParse) - { - emit ChangedActivDraw(name); - } - } -} - -bool VDomDocument::SetNameDraw(const QString& name) -{ - Q_ASSERT_X(name.isEmpty() == false, "SetNameDraw", "name draw is empty"); - QString oldName = nameActivDraw; - QDomElement element; - if (GetActivDrawElement(element)) - { - nameActivDraw = name; - element.setAttribute("name", nameActivDraw); - emit patternChanged(); - emit ChangedNameDraw(oldName, nameActivDraw); - return true; - } - else - { - qWarning()<<"Can't find activ draw"<nameActivDraw = name; -} - -bool VDomDocument::GetActivDrawElement(QDomElement &element) -{ - if (nameActivDraw.isEmpty() == false) - { - QDomNodeList elements = this->documentElement().elementsByTagName( "draw" ); - if (elements.size() == 0) - { - return false; - } - for ( qint32 i = 0; i < elements.count(); i++ ) - { - element = elements.at( i ).toElement(); - if (element.isNull() == false) - { - QString fieldName = element.attribute( "name" ); - if ( fieldName == nameActivDraw ) - { - return true; - } - } - } - } - return false; -} - -bool VDomDocument::GetActivCalculationElement(QDomElement &element) -{ - bool ok = GetActivNodeElement("calculation", element); - if (ok) - { - return true; - } - else - { - return false; - } -} - -bool VDomDocument::GetActivModelingElement(QDomElement &element) -{ - bool ok = GetActivNodeElement("modeling", element); - if (ok) - { - return true; - } - else - { - return false; - } -} - -bool VDomDocument::GetActivDetailsElement(QDomElement &element) -{ - bool ok = GetActivNodeElement("details", element); - if (ok) - { - return true; - } - else - { - return false; - } -} - -bool VDomDocument::GetActivNodeElement(const QString& name, QDomElement &element) -{ - Q_ASSERT_X(name.isEmpty() == false, "GetActivNodeElement", "name draw is empty"); - QDomElement drawElement; - bool drawOk = this->GetActivDrawElement(drawElement); - if (drawOk == true) - { - QDomNodeList listElement = drawElement.elementsByTagName(name); - if (listElement.size() == 0 || listElement.size() > 1) - { - return false; - } - element = listElement.at( 0 ).toElement(); - if (element.isNull() == false) - { - return true; - } - else - { - return false; - } - } - else - { - return false; - } -} - -void VDomDocument::Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, - VMainGraphicsScene *sceneDetail) -{ - Q_CHECK_PTR(sceneDraw); - Q_CHECK_PTR(sceneDetail); - if (parse == Document::FullParse) - { - TestUniqueId(); - data->Clear(); - data->CreateManTableIGroup(); - nameActivDraw.clear(); - sceneDraw->clear(); - sceneDetail->clear(); - comboBoxDraws->clear(); - tools.clear(); - cursor = 0; - } - data->ClearLengthLines(); - data->ClearLengthArcs(); - data->ClearLengthSplines(); - data->ClearLineAngles(); - data->ClearDetails(); - history.clear(); - QDomElement rootElement = this->documentElement(); - QDomNode domNode = rootElement.firstChild(); - while (domNode.isNull() == false) - { - if (domNode.isElement()) - { - QDomElement domElement = domNode.toElement(); - if (domElement.isNull() == false) - { - if (domElement.tagName()=="draw") - { - if (parse == Document::FullParse) - { - if (nameActivDraw.isEmpty()) - { - SetActivDraw(domElement.attribute("name")); - } - else - { - ChangeActivDraw(domElement.attribute("name")); - } - comboBoxDraws->addItem(domElement.attribute("name")); - } - else - { - ChangeActivDraw(domElement.attribute("name"), Document::LiteParse); - } - ParseDrawElement(sceneDraw, sceneDetail, domElement, parse); - } - if (domElement.tagName()=="increments") - { - ParseIncrementsElement(domElement); - } - } - } - domNode = domNode.nextSibling(); - } -} - -VDataTool *VDomDocument::getTool(const qint64 &id) -{ - if (tools.contains(id)) - { - return tools.value(id); - } - else - { - QString error = QString(tr("Can't find tool id = %1 in table.")).arg(id); - throw VException(error); - } - return 0; -} - -void VDomDocument::ParseIncrementsElement(const QDomNode &node) -{ - QDomNode domNode = node.firstChild(); - while (domNode.isNull() == false) - { - if (domNode.isElement()) - { - QDomElement domElement = domNode.toElement(); - if (domElement.isNull() == false) - { - if (domElement.tagName() == "increment") - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, "name", ""); - qreal base = GetParametrDouble(domElement, "base", "0"); - qreal ksize = GetParametrDouble(domElement, "ksize", "0"); - qreal kgrowth = GetParametrDouble(domElement, "kgrowth", "0"); - QString desc = GetParametrString(domElement, "description", "Description"); - data->UpdateId(id); - data->AddIncrementTableRow(name, VIncrementTableRow(id, base, ksize, kgrowth, desc)); - } - } - } - domNode = domNode.nextSibling(); - } -} - -qint64 VDomDocument::GetParametrId(const QDomElement &domElement) const -{ - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - qint64 id = GetParametrLongLong(domElement, "id", "0"); - if (id <= 0) - { - throw VExceptionWrongParameterId(tr("Got wrong parameter id. Need only id > 0."), domElement); - } - return id; -} - qint64 VDomDocument::GetParametrLongLong(const QDomElement &domElement, const QString &name, const QString &defValue) const { Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); bool ok = false; - QString parametr = GetParametrString(domElement, name, defValue); - qint64 id = parametr.toLongLong(&ok); + const QString parametr = GetParametrString(domElement, name, defValue); + const qint64 id = parametr.toLongLong(&ok); if (ok == false) { throw VExceptionConversionError(tr("Can't convert toLongLong parameter"), name); @@ -476,7 +120,7 @@ QString VDomDocument::GetParametrString(const QDomElement &domElement, const QSt { Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - QString parameter = domElement.attribute(name, defValue); + const QString parameter = domElement.attribute(name, defValue); if (parameter.isEmpty()) { throw VExceptionEmptyParameter(tr("Got empty parameter"), name, domElement); @@ -490,903 +134,27 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); bool ok = false; QString parametr = GetParametrString(domElement, name, defValue); - qreal param = parametr.replace(",", ".").toDouble(&ok); + const qreal param = parametr.replace(",", ".").toDouble(&ok); if (ok == false) { - qDebug()<<"defValue"< vector; - CollectId(this->documentElement(), vector); -} - -void VDomDocument::CollectId(const QDomElement &node, QVector &vector) const -{ - if (node.hasAttribute("id")) - { - qint64 id = GetParametrId(node); - if (vector.contains(id)) - { - throw VExceptionUniqueId(tr("This id is not unique."), node); - } - vector.append(id); - } - - for (qint32 i=0; iClearCalculationGObjects(); - ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Calculation); - } - if (domElement.tagName() == "modeling") - { - ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Modeling); - } - if (domElement.tagName() == "details") - { - ParseDetails(sceneDetail, domElement, parse); - } - } - } - domNode = domNode.nextSibling(); - } -} - -void VDomDocument::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, - const QDomNode& node, const Document::Documents &parse, const Draw::Draws &mode) -{ - Q_CHECK_PTR(sceneDraw); - Q_CHECK_PTR(sceneDetail); - VMainGraphicsScene *scene = 0; - if (mode == Draw::Calculation) - { - scene = sceneDraw; - } - else - { - scene = sceneDetail; - } - QDomNodeList nodeList = node.childNodes(); - qint32 num = nodeList.size(); - for (qint32 i = 0; i < num; ++i) - { - QDomElement domElement = nodeList.at(i).toElement(); - if (domElement.isNull() == false) - { - if (domElement.tagName() == "point") - { - ParsePointElement(scene, domElement, parse, domElement.attribute("type", "")); - continue; - } - if (domElement.tagName() == "line") - { - ParseLineElement(scene, domElement, parse); - continue; - } - if (domElement.tagName() == "spline") - { - ParseSplineElement(scene, domElement, parse, domElement.attribute("type", "")); - continue; - } - if (domElement.tagName() == "arc") - { - ParseArcElement(scene, domElement, parse, domElement.attribute("type", "")); - continue; - } - if (domElement.tagName() == "tools") - { - ParseToolsElement(scene, domElement, parse, domElement.attribute("type", "")); - continue; - } - } - } -} - -void VDomDocument::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, - const Document::Documents &parse) -{ - Q_CHECK_PTR(sceneDetail); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - try - { - VDetail detail; - VDetail oldDetail; - qint64 id = GetParametrId(domElement); - detail.setName(GetParametrString(domElement, VAbstractTool::AttrName, "")); - detail.setMx(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0"))); - detail.setMy(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "0.0"))); - detail.setSeamAllowance(GetParametrLongLong(domElement, VToolDetail::AttrSupplement, "1")); - detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0")); - detail.setClosed(GetParametrLongLong(domElement, VToolDetail::AttrClosed, "1")); - - QDomNodeList nodeList = domElement.childNodes(); - qint32 num = nodeList.size(); - for (qint32 i = 0; i < num; ++i) - { - QDomElement element = nodeList.at(i).toElement(); - if (element.isNull() == false) - { - if (element.tagName() == VToolDetail::TagNode) - { - qint64 id = GetParametrLongLong(element, VToolDetail::AttrIdObject, "0"); - qreal mx = toPixel(GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); - qreal my = toPixel(GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); - Tool::Tools tool; - NodeDetail::NodeDetails nodeType = NodeDetail::Contour; - QString t = GetParametrString(element, "type", "NodePoint"); - if (t == "NodePoint") - { - tool = Tool::NodePoint; -// const VPointF *point = data->GeometricObject(id); -// oldDetail.append(VNodeDetail(point.getIdObject(), tool, NodeDetail::Contour)); - } - else if (t == "NodeArc") - { - tool = Tool::NodeArc; -// VArc arc = data->GetArc(id); -// oldDetail.append(VNodeDetail(arc.getIdObject(), tool, NodeDetail::Contour)); - } - else if (t == "NodeSpline") - { - tool = Tool::NodeSpline; -// VSpline spl = data->GetSpline(id); -// oldDetail.append(VNodeDetail(spl.getIdObject(), tool, NodeDetail::Contour)); - } - else if (t == "NodeSplinePath") - { - tool = Tool::NodeSplinePath; -// VSplinePath splPath = data->GetSplinePath(id); -// oldDetail.append(VNodeDetail(splPath.getIdObject(), tool, NodeDetail::Contour)); - } - detail.append(VNodeDetail(id, tool, nodeType, mx, my)); - } - } - } - VToolDetail::Create(id, detail, sceneDetail, this, data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating detail"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } -} - -void VDomDocument::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, - const Document::Documents &parse) -{ - Q_CHECK_PTR(sceneDetail); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - QDomNode domNode = domElement.firstChild(); - while (domNode.isNull() == false) - { - if (domNode.isElement()) - { - QDomElement domElement = domNode.toElement(); - if (domElement.isNull() == false) - { - if (domElement.tagName() == VToolDetail::TagName) - { - ParseDetailElement(sceneDetail, domElement, parse); - } - } - } - domNode = domNode.nextSibling(); - } -} - -void VDomDocument::ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString& type) -{ - Q_CHECK_PTR(scene); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of point is empty"); - - - QStringList points; - points << VToolSinglePoint::ToolType << VToolEndLine::ToolType << VToolAlongLine::ToolType - << VToolShoulderPoint::ToolType << VToolNormal::ToolType << VToolBisector::ToolType - << VToolLineIntersect::ToolType << VToolPointOfContact::ToolType << VNodePoint::ToolType - << VToolHeight::ToolType << VToolTriangle::ToolType << VToolPointOfIntersection::ToolType - << VToolCutSpline::ToolType << VToolCutSplinePath::ToolType << VToolCutArc::ToolType; - switch(points.indexOf(type)) { - case 0: //VToolSinglePoint::ToolType - { - VToolSinglePoint *spoint = 0; - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, "A"); - qreal x = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrX, "10.0")); - qreal y = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0")); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - - data->UpdateGObject(id, new VPointF(x, y, name, mx, my)); - VDrawTool::AddRecord(id, Tool::SinglePointTool, this); - if (parse != Document::FullParse) - { - UpdateToolData(id, data); - } - if (parse == Document::FullParse) - { - spoint = new VToolSinglePoint(this, data, id, Tool::FromFile); - Q_CHECK_PTR(spoint); - scene->addItem(spoint); - connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); - tools[id] = spoint; - } - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating single point"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - scene->removeItem(spoint); - delete spoint; - throw excep; - } - break; - } - case 1: //VToolEndLine::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); - QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); - qint64 basePointId = GetParametrLongLong(domElement, VAbstractTool::AttrBasePoint, "0"); - qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); - - VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId, - mx, my, scene, this, data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating point of end line"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 2: //VToolAlongLine::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); - QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); - qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); - - VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my, scene, this, data, - parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating point along line"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 3: //VToolShoulderPoint::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); - QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); - qint64 p1Line = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line, "0"); - qint64 p2Line = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line, "0"); - qint64 pShoulder = GetParametrLongLong(domElement, VAbstractTool::AttrPShoulder, "0"); - - VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my, scene, this, - data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating point of shoulder"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 4: //VToolNormal::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); - QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); - qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); - qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); - - VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, - angle, mx, my, scene, this,data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating point of normal"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 5: //VToolBisector::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); - QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); - qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); - qint64 thirdPointId = GetParametrLongLong(domElement, VAbstractTool::AttrThirdPoint, "0"); - - VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, - typeLine, name, mx, my, scene, this, data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating point of bisector"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 6: //VToolLineIntersect::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - qint64 p1Line1Id = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line1, "0"); - qint64 p2Line1Id = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line1, "0"); - qint64 p1Line2Id = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line2, "0"); - qint64 p2Line2Id = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line2, "0"); - - VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, - mx, my, scene, this, data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating point of lineintersection"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 7: //VToolPointOfContact::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "0"); - qint64 center = GetParametrLongLong(domElement, VAbstractTool::AttrCenter, "0"); - qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); - - VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, - mx, my, scene, this,data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating point of contact"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 8: //VNodePoint::ToolType - try - { - qint64 id = GetParametrId(domElement); - qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); - qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); - const VPointF *point = data->GeometricObject(idObject ); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), - mx, my, idObject,Draw::Modeling)); - VNodePoint::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating modeling point"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 9: //VToolHeight::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); - qint64 basePointId = GetParametrLongLong(domElement, VAbstractTool::AttrBasePoint, "0"); - qint64 p1LineId = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line, "0"); - qint64 p2LineId = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line, "0"); - - VToolHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId, - mx, my, scene, this, data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating height"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 10: //VToolTriangle::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - qint64 axisP1Id = GetParametrLongLong(domElement, VAbstractTool::AttrAxisP1, "0"); - qint64 axisP2Id = GetParametrLongLong(domElement, VAbstractTool::AttrAxisP2, "0"); - qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); - - VToolTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, scene, this, data, - parse, Tool::FromFile); - return; - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating triangle"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 11: //VToolPointOfIntersection::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); - - VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, - mx, my, scene, this, data, parse,Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating point of intersection"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 12: //VToolCutSpline::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); - qint64 splineId = GetParametrLongLong(domElement, VToolCutSpline::AttrSpline, "0"); - - VToolCutSpline::Create(id, name, formula, splineId, mx, my, scene, this, data, parse, Tool::FromFile); - return; - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating cut spline point"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 13: //VToolCutSplinePath::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); - qint64 splinePathId = GetParametrLongLong(domElement, VToolCutSplinePath::AttrSplinePath, "0"); - - VToolCutSplinePath::Create(id, name, formula, splinePathId, mx, my, - scene, this, data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating cut spline path point"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 14: //VToolCutArc::ToolType - try - { - qint64 id = GetParametrId(domElement); - QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); - qint64 arcId = GetParametrLongLong(domElement, VToolCutArc::AttrArc, "0"); - - VToolCutArc::Create(id, name, formula, arcId, mx, my, scene, this, data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating cut arc point"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - default: - qWarning() << "Illegal point type in VDomDocument::ParsePointElement()."; - break; - } -} - -void VDomDocument::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, - const Document::Documents &parse) -{ - Q_CHECK_PTR(scene); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - try - { - qint64 id = GetParametrId(domElement); - qint64 firstPoint = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - qint64 secondPoint = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); - QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); - - VToolLine::Create(id, firstPoint, secondPoint, typeLine, scene, this, data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating line"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } -} - -void VDomDocument::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement, - const Document::Documents &parse, const QString &type) -{ - Q_CHECK_PTR(scene); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); - - QStringList splines; - splines << VToolSpline::ToolType << VToolSplinePath::ToolType << VNodeSpline::ToolType << VNodeSplinePath::ToolType; - switch(splines.indexOf(type)) { - case 0: //VToolSpline::ToolType - try - { - qint64 id = GetParametrId(domElement); - qint64 point1 = GetParametrLongLong(domElement, VAbstractTool::AttrPoint1, "0"); - qint64 point4 = GetParametrLongLong(domElement, VAbstractTool::AttrPoint4, "0"); - qreal angle1 = GetParametrDouble(domElement, VAbstractTool::AttrAngle1, "270.0"); - qreal angle2 = GetParametrDouble(domElement, VAbstractTool::AttrAngle2, "90.0"); - qreal kAsm1 = GetParametrDouble(domElement, VAbstractTool::AttrKAsm1, "1.0"); - qreal kAsm2 = GetParametrDouble(domElement, VAbstractTool::AttrKAsm2, "1.0"); - qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0"); - - VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this, data, parse,Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating simple curve"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 1: //VToolSplinePath::ToolType - try - { - qint64 id = GetParametrId(domElement); - qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0"); - VSplinePath *path = new VSplinePath(kCurve); - Q_CHECK_PTR(path); - - QDomNodeList nodeList = domElement.childNodes(); - qint32 num = nodeList.size(); - for (qint32 i = 0; i < num; ++i) - { - QDomElement element = nodeList.at(i).toElement(); - if (element.isNull() == false) - { - if (element.tagName() == VAbstractTool::AttrPathPoint) - { - qreal kAsm1 = GetParametrDouble(element, VAbstractTool::AttrKAsm1, "1.0"); - qreal angle = GetParametrDouble(element, VAbstractTool::AttrAngle, "0"); - qreal kAsm2 = GetParametrDouble(element, VAbstractTool::AttrKAsm2, "1.0"); - qint64 pSpline = GetParametrLongLong(element, VAbstractTool::AttrPSpline, "0"); - VPointF p = *data->GeometricObject(pSpline); - - QLineF line(0, 0, 100, 0); - line.setAngle(angle+180); - - VSplinePoint splPoint(p, kAsm1, line.angle(), kAsm2, angle); - path->append(splPoint); - if (parse == Document::FullParse) - { - IncrementReferens(pSpline); - } - } - } - } - - VToolSplinePath::Create(id, path, scene, this, data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating curve path"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 2: //VNodeSpline::ToolType - try - { - qint64 id = GetParametrId(domElement); - qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); - qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); - VSpline *spl = new VSpline(*data->GeometricObject(idObject)); - Q_CHECK_PTR(spl); - spl->setIdObject(idObject); - spl->setMode(Draw::Modeling); - data->UpdateGObject(id, spl); - VNodeSpline::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating modeling simple curve"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 3: //VNodeSplinePath::ToolType - try - { - qint64 id = GetParametrId(domElement); - qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); - qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); - VSplinePath *path = new VSplinePath(*data->GeometricObject(idObject)); - Q_CHECK_PTR(path); - path->setIdObject(idObject); - path->setMode(Draw::Modeling); - data->UpdateGObject(id, path); - VNodeSplinePath::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating modeling curve path"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - default: - qWarning() << "Illegal spline type in VDomDocument::ParseSplineElement()."; - break; - } -} - -void VDomDocument::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement, - const Document::Documents &parse, const QString &type) -{ - Q_CHECK_PTR(scene); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); - - QStringList arcs; - arcs << VToolArc::ToolType << VNodeArc::ToolType; - - switch(arcs.indexOf(type)) { - case 0: //VToolArc::ToolType - try - { - qint64 id = GetParametrId(domElement); - qint64 center = GetParametrLongLong(domElement, VAbstractTool::AttrCenter, "0"); - QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "10"); - QString f1 = GetParametrString(domElement, VAbstractTool::AttrAngle1, "180"); - QString f2 = GetParametrString(domElement, VAbstractTool::AttrAngle2, "270"); - - VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating simple arc"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - case 1: //VNodeArc::ToolType - try - { - qint64 id = GetParametrId(domElement); - qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); - qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); - VArc *arc = new VArc(*data->GeometricObject(idObject)); - Q_CHECK_PTR(arc); - arc->setIdObject(idObject); - arc->setMode(Draw::Modeling); - data->UpdateGObject(id, arc); - VNodeArc::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating modeling arc"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - default: - qWarning() << "Illegal arc type in VDomDocument::ParseArcElement()."; - break; - } -} - -void VDomDocument::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement, - const Document::Documents &parse, const QString &type) -{ - Q_CHECK_PTR(scene); - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); - - QStringList tools; - tools << VToolUnionDetails::ToolType; - - switch(tools.indexOf(type)) { - case 0: //VToolUnionDetails::ToolType - try - { - qint64 id = GetParametrId(domElement); - qint64 indexD1 = GetParametrLongLong(domElement, VToolUnionDetails::AttrIndexD1, "-1"); - qint64 indexD2 = GetParametrLongLong(domElement, VToolUnionDetails::AttrIndexD2, "-1"); - - QVector vector = VToolUnionDetails::GetDetailFromFile(this, domElement); - - VToolUnionDetails::Create(id, vector[0], vector[1], 0, 0, indexD1, indexD2, scene, this, data, parse, - Tool::FromFile); - } - catch (const VExceptionBadId &e) - { - VExceptionObjectError excep(tr("Error creating or updating union details"), domElement); - excep.AddMoreInformation(e.ErrorMessage()); - throw excep; - } - break; - default: - qWarning() << "Illegal tools type in VDomDocument::ParseToolsElement()."; - break; - } -} - -void VDomDocument::FullUpdateTree() -{ - VMainGraphicsScene *scene = new VMainGraphicsScene(); - Q_CHECK_PTR(scene); - try - { - Parse(Document::LiteParse, scene, scene); - } - catch (const std::bad_alloc &) - { - delete scene; - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error parsing file.")); - msgBox.setInformativeText("std::bad_alloc"); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setIcon(QMessageBox::Warning); - msgBox.exec(); - return; - } - catch (...) - { - delete scene; - throw; - } - - delete scene; - setCurrentData(); - emit FullUpdateFromFile(); -} - -void VDomDocument::haveLiteChange() -{ - patternModified = true; - emit patternChanged(); -} - -void VDomDocument::ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable) -{ - emit ShowTool(id, color, enable); -} -bool VDomDocument::isPatternModified() const -{ - return patternModified; -} - -void VDomDocument::setPatternModified(bool value) -{ - patternModified = value; -} - -QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVal) -{ - QDomNodeList nodeList = this->elementsByTagName(tagName); + const QDomNodeList nodeList = this->elementsByTagName(tagName); if (nodeList.isEmpty()) { return defVal; } else { - QDomNode domNode = nodeList.at(0); + const QDomNode domNode = nodeList.at(0); if (domNode.isNull() == false && domNode.isElement()) { - QDomElement domElement = domNode.toElement(); + const QDomElement domElement = domNode.toElement(); if (domElement.isNull() == false) { return domElement.text(); @@ -1395,83 +163,3 @@ QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVa } return defVal; } - - -void VDomDocument::setCursor(const qint64 &value) -{ - cursor = value; - emit ChangedCursor(cursor); -} - -void VDomDocument::setCurrentData() -{ - if (*mode == Draw::Calculation) - { - QString nameDraw = comboBoxDraws->itemText(comboBoxDraws->currentIndex()); - if (nameActivDraw != nameDraw) - { - nameActivDraw = nameDraw; - qint64 id = 0; - if (history.size() == 0) - { - return; - } - for (qint32 i = 0; i < history.size(); ++i) - { - VToolRecord tool = history.at(i); - if (tool.getNameDraw() == nameDraw) - { - id = tool.getId(); - } - } - if (id == 0) - { - VToolRecord tool = history.at(history.size()-1); - id = tool.getId(); - if (id == 0) - { - return; - } - } - if (tools.size() > 0) - { - VDataTool *vTool = tools.value(id); - data->setData(vTool->getData()); - } - } - } -} - -void VDomDocument::AddTool(const qint64 &id, VDataTool *tool) -{ - Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - Q_CHECK_PTR(tool); - tools.insert(id, tool); -} - -void VDomDocument::UpdateToolData(const qint64 &id, VContainer *data) -{ - Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - Q_CHECK_PTR(data); - VDataTool *tool = tools.value(id); - Q_CHECK_PTR(tool); - tool->VDataTool::setData(data); -} - -void VDomDocument::IncrementReferens(qint64 id) const -{ - Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - VDataTool *tool = tools.value(id); - Q_CHECK_PTR(tool); - tool->incrementReferens(); -} - -void VDomDocument::DecrementReferens(qint64 id) const -{ - Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); - VDataTool *tool = tools.value(id); - if (tool != 0) - { - tool->decrementReferens(); - } -} diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index e808e614e..de30543de 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -30,62 +30,29 @@ #define VDOMDOCUMENT_H #include "../container/vcontainer.h" -#include "../widgets/vmaingraphicsscene.h" -#include "../tools/vdatatool.h" -#include "vtoolrecord.h" -#include #include #include -namespace Document -{ - /** - * @brief The Document enum types parse. - */ - enum Document { LiteParse, FullParse}; - Q_DECLARE_FLAGS(Documents, Document) -} -Q_DECLARE_OPERATORS_FOR_FLAGS(Document::Documents) - #ifdef Q_CC_GNU #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" #endif /** - * @brief The VDomDocument class working with pattern file. + * @brief The VDomDocument class extend QDomDocument class. */ -class VDomDocument : public QObject, public QDomDocument +class VDomDocument : public QDomDocument { - Q_OBJECT + Q_DECLARE_TR_FUNCTIONS(VDomDocument) public: - /** - * @brief VDomDocument constructor. - * @param data container with variables. - * @param comboBoxDraws combobox for pattern peaces names. - * @param mode draw mode. - */ - VDomDocument(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent = 0); - /** - * @brief VDomDocument constructor. - * @param name pattern peace name. - * @param data container with variables. - * @param comboBoxDraws combobox for pattern peaces names. - * @param mode draw mode. - */ - VDomDocument(const QString& name, VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, - QObject *parent = 0); - /** - * @brief VDomDocument constructor. - * @param doc dom document container type. - * @param data container with variables. - * @param comboBoxDraws combobox for pattern peaces names. - * @param mode draw mode. - */ - VDomDocument(const QDomDocumentType& doctype, VContainer *data, QComboBox *comboBoxDraws, - Draw::Draws *mode, QObject *parent = 0); - ~VDomDocument(){} + /** + * @brief VDomDocument constructor. + * @param data container with variables. + * @param parent parent object + */ + VDomDocument(VContainer *data); + virtual ~VDomDocument(){} /** * @brief elementById find element by id. * @param id value id attribute. @@ -97,121 +64,19 @@ public: * @param element tag. */ void removeAllChilds(QDomElement &element); + template /** - * @brief CreateEmptyFile create minimal empty file. + * @brief SetAttribute set attribute in pattern file. Replace "," by ".". + * @param domElement element in xml tree. + * @param name name of attribute. + * @param value value of attribute. */ - void CreateEmptyFile(); - /** - * @brief ChangeActivDraw set new pattern peace name. - * @param name new name. - * @param parse parser file mode. - */ - void ChangeActivDraw(const QString& name, const Document::Documents &parse = Document::FullParse); - /** - * @brief GetNameActivDraw return current pattern peace name. - * @return pattern peace name. - */ - inline QString GetNameActivDraw() const {return nameActivDraw;} - /** - * @brief GetActivDrawElement return draw tag for current pattern peace. - * @param element draw tag. - * @return true if found. - */ - bool GetActivDrawElement(QDomElement &element); - /** - * @brief GetActivCalculationElement return calculation tag for current pattern peace. - * @param element calculation tag. - * @return true if found. - */ - bool GetActivCalculationElement(QDomElement &element); - /** - * @brief GetActivModelingElement return modeling tag for current pattern peace. - * @param element modeling tag - * @return true if found. - */ - bool GetActivModelingElement(QDomElement &element); - /** - * @brief GetActivDetailsElement return details tag for current pattern peace. - * @param element details tag. - * @return true if found. - */ - bool GetActivDetailsElement(QDomElement &element); - /** - * @brief appendDraw add new pattern peace structure to the file. - * @param name pattern peace name. - * @return true if success. - */ - bool appendDraw(const QString& name); - /** - * @brief SetNameDraw change current pattern peace. - * @param name pattern peace name. - * @return true if success. - */ - bool SetNameDraw(const QString& name); - /** - * @brief Parse parse file. - * @param parse parser file mode. - * @param sceneDraw pointer to draw scene. - * @param sceneDetail pointer to details scene. - */ - void Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, - VMainGraphicsScene *sceneDetail); - /** - * @brief getTools return list of tools pointers. - * @return list. - */ - inline QHash* getTools() {return &tools;} - /** - * @brief getTool return tool from tool list. - * @param id tool id. - * @return tool. - */ - VDataTool* getTool(const qint64 &id); - /** - * @brief getHistory return list with list of history records. - * @return list of history records. - */ - inline QVector *getHistory() {return &history;} - /** - * @brief getCursor return cursor. - * @return cursor. - */ - inline qint64 getCursor() const {return cursor;} - /** - * @brief setCursor set cursor. - * @param value cursor. - */ - void setCursor(const qint64 &value); - /** - * @brief setCurrentData set current data set. - */ - void setCurrentData(); - /** - * @brief AddTool add tool to list tools. - * @param id tool id. - * @param tool tool. - */ - void AddTool(const qint64 &id, VDataTool *tool); - /** - * @brief UpdateToolData update tool in list tools. - * @param id tool id. - * @param data container with variables. - */ - void UpdateToolData(const qint64 &id, VContainer *data); - /** - * @brief IncrementReferens increment reference parent objects. - * @param id parent object id. - */ - void IncrementReferens(qint64 id) const; - /** - * @brief DecrementReferens decrement reference parent objects. - * @param id parent object id. - */ - void DecrementReferens(qint64 id) const; - /** - * @brief TestUniqueId test exist unique id in pattern file. Each id must be unique. - */ - void TestUniqueId() const; + void SetAttribute(QDomElement &domElement, const QString &name, const T &value) + { + QString val = QString().setNum(value); + val = val.replace(",", "."); + domElement.setAttribute(name, val); + } /** * @brief GetParametrLongLong return long long value of attribute. * @param domElement tag in xml tree. @@ -226,7 +91,8 @@ public: * @param name attribute name. * @return attribute value. */ - QString GetParametrString(const QDomElement& domElement, const QString &name, const QString &defValue) const; + QString GetParametrString(const QDomElement& domElement, const QString &name, + const QString &defValue = QString()) const; /** * @brief GetParametrDouble return double value of attribute. * @param domElement tag in xml tree. @@ -234,100 +100,19 @@ public: * @return double value. */ qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue) const; + QString UniqueTagText(const QString &tagName, const QString &defVal = QString()) const; +protected: /** - * @brief SPointActiveDraw return id base point current pattern peace. - * @return id base point. + * @brief data container with data. */ - qint64 SPointActiveDraw(); - bool isPatternModified() const; - void setPatternModified(bool value); - QString UniqueTagText(const QString &tagName, const QString &defVal = QString()); -signals: - /** - * @brief ChangedActivDraw change active pattern peace. - * @param newName new pattern peace name. - */ - void ChangedActivDraw(const QString &newName); - /** - * @brief ChangedNameDraw save new name active pattern peace. - * @param oldName old name. - * @param newName new name. - */ - void ChangedNameDraw(const QString &oldName, const QString &newName); - /** - * @brief FullUpdateFromFile update tool data form file. - */ - void FullUpdateFromFile(); - /** - * @brief patternChanged emit if we have unsaved change. - */ - void patternChanged(); - /** - * @brief ShowTool highlight tool. - * @param id tool id. - * @param color highlight color. - * @param enable enable or disable highlight. - */ - void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); - /** - * @brief ChangedCursor change cursor position. - * @param id tool id. - */ - void ChangedCursor(qint64 id); -public slots: - /** - * @brief FullUpdateTree lite parse file. - */ - void FullUpdateTree(); - /** - * @brief haveLiteChange we have unsaved change. - */ - void haveLiteChange(); - /** - * @brief ShowHistoryTool hightlight tool. - * @param id tool id. - * @param color hightlight color. - * @param enable enable or diasable hightlight. - */ - void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable); + VContainer *data; private: Q_DISABLE_COPY(VDomDocument) /** * @brief map use for finding element by id. */ QHash map; - /** - * @brief nameActivDraw name current pattern peace. - */ - QString nameActivDraw; - /** - * @brief data container with data. - */ - VContainer *data; - /** - * @brief tools list with pointer on tools. - */ - QHash tools; - /** - * @brief history history records. - */ - QVector history; - /** - * @brief cursor cursor keep id tool after which we will add new tool in file. - */ - qint64 cursor; - /** - * @brief comboBoxDraws combobox with pattern peace names. - */ - QComboBox *comboBoxDraws; - /** - * @brief mode current draw mode. - */ - Draw::Draws *mode; - /** - * @brief fileModified true if exist change in file. - */ - bool patternModified; + /** * @brief find find element by id. * @param node node. @@ -335,126 +120,14 @@ private: * @return true if found. */ bool find(const QDomElement &node, const QString& id); - /** - * @brief CheckNameDraw check if exist pattern peace with this name. - * @param name pattern peace name. - * @return true if exist. - */ - bool CheckNameDraw(const QString& name) const; - /** - * @brief SetActivDraw set current pattern peace. - * @param name pattern peace name. - */ - void SetActivDraw(const QString& name); - /** - * @brief GetActivNodeElement find element in current pattern peace by name. - * @param name name tag. - * @param element element. - * @return true if found. - */ - bool GetActivNodeElement(const QString& name, QDomElement& element); - /** - * @brief ParseDrawElement parse draw tag. - * @param sceneDraw draw scene. - * @param sceneDetail details scene. - * @param node node. - * @param parse parser file mode. - */ - void ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, - const QDomNode& node, const Document::Documents &parse); - /** - * @brief ParseDrawMode parse draw tag with draw mode. - * @param sceneDraw draw scene. - * @param sceneDetail details scene. - * @param node node. - * @param parse parser file mode. - * @param mode draw mode. - */ - void ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, - const QDomNode& node, const Document::Documents &parse, const Draw::Draws &mode); - /** - * @brief ParseDetailElement parse detail tag. - * @param sceneDetail detail scene. - * @param domElement tag in xml tree. - * @param parse parser file mode. - */ - void ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, - const Document::Documents &parse); - /** - * @brief ParseDetails parse details tag. - * @param sceneDetail detail scene. - * @param domElement tag in xml tree. - * @param parse parser file mode. - */ - void ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, - const Document::Documents &parse); - /** - * @brief ParsePointElement parse point tag. - * @param scene scene. - * @param domElement tag in xml tree. - * @param parse parser file mode. - * @param type type of point. - * @param mode draw mode. - */ - void ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString &type); - /** - * @brief ParseLineElement parse line tag. - * @param scene scene. - * @param domElement tag in xml tree. - * @param parse parser file mode. - * @param mode draw mode. - */ - void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse); - /** - * @brief ParseSplineElement parse spline tag. - * @param scene scene. - * @param domElement tag in xml tree. - * @param parse parser file mode. - * @param type type of spline. - * @param mode draw mode. - */ - void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString& type); - /** - * @brief ParseArcElement parse arc tag. - * @param scene scene. - * @param domElement tag in xml tree. - * @param parse parser file mode. - * @param type type of spline. - * @param mode draw mode. - */ - void ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString& type); - /** - * @brief ParseToolsElement parse tools tag. - * @param scene scene. - * @param domElement tag in xml tree. - * @param parse parser file mode. - * @param type type of spline. - */ - void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement, - const Document::Documents &parse, const QString& type); - /** - * @brief ParseIncrementsElement parse increments tag. - * @param node tag in xml tree. - */ - void ParseIncrementsElement(const QDomNode& node); - /** - * @brief GetParametrId return value id attribute. - * @param domElement tag in xml tree. - * @return id value. - */ - qint64 GetParametrId(const QDomElement& domElement) const; - /** - * @brief CollectId recursive function, try find id attribute in file. Throw exclusion if find not unique. - * @param node tag in xml tree. - * @param vector list with ids. - */ - void CollectId(const QDomElement &node, QVector &vector)const; }; +template <> +inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, const QString &value) +{ + domElement.setAttribute(name, value); +} + #ifdef Q_CC_GNU #pragma GCC diagnostic pop #endif diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp new file mode 100644 index 000000000..9b152c98b --- /dev/null +++ b/src/xml/vpattern.cpp @@ -0,0 +1,1265 @@ +/************************************************************************ + ** + ** @file vpattern.cpp + ** @author Roman Telezhinsky + ** @date 24 2, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 "vpattern.h" + +#include "../tools/vtooldetail.h" +#include "../tools/vtooluniondetails.h" +#include "../tools/drawTools/drawtools.h" +#include "../tools/nodeDetails/nodedetails.h" +#include "../exception/vexceptionobjecterror.h" +#include "../exception/vexceptionwrongparameterid.h" +#include "../exception/vexceptionuniqueid.h" + +#include + +const QString VPattern::TagCalculation = QStringLiteral("calculation"); +const QString VPattern::TagModeling = QStringLiteral("modeling"); +const QString VPattern::TagDetails = QStringLiteral("details"); +const QString VPattern::TagAuthor = QStringLiteral("author"); +const QString VPattern::TagDescription = QStringLiteral("description"); +const QString VPattern::TagNotes = QStringLiteral("notes"); +const QString VPattern::TagIncrements = QStringLiteral("increments"); +const QString VPattern::TagDraw = QStringLiteral("draw"); +const QString VPattern::AttrName = QStringLiteral("name"); + +VPattern::VPattern(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent) + : QObject(parent), VDomDocument(data), nameActivDraw(QString()), tools(QHash()), + history(QVector()), cursor(0), comboBoxDraws(comboBoxDraws), mode(mode), patternModified(false) +{ +} + +void VPattern::CreateEmptyFile() +{ + QDomElement patternElement = this->createElement("pattern"); + + patternElement.appendChild(createComment("Valentina pattern format.")); + patternElement.appendChild(createElement(TagAuthor)); + patternElement.appendChild(createElement(TagDescription)); + patternElement.appendChild(createElement(TagNotes)); + patternElement.appendChild(createElement(TagIncrements)); + + this->appendChild(patternElement); + insertBefore(createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""), this->firstChild()); +} + +void VPattern::ChangeActivDraw(const QString &name, const Document::Documents &parse) +{ + Q_ASSERT_X(name.isEmpty() == false, "ChangeActivDraw", "name draw is empty"); + if (CheckNameDraw(name)) + { + this->nameActivDraw = name; + if (parse == Document::FullParse) + { + emit ChangedActivDraw(name); + } + } +} + +bool VPattern::GetActivDrawElement(QDomElement &element) +{ + if (nameActivDraw.isEmpty() == false) + { + const QDomNodeList elements = this->documentElement().elementsByTagName( TagDraw ); + if (elements.size() == 0) + { + return false; + } + for ( qint32 i = 0; i < elements.count(); i++ ) + { + element = elements.at( i ).toElement(); + if (element.isNull() == false) + { + const QString fieldName = element.attribute( AttrName ); + if ( fieldName == nameActivDraw ) + { + return true; + } + } + } + } + return false; +} + +bool VPattern::appendDraw(const QString &name) +{ + Q_ASSERT_X(name.isEmpty() == false, "appendDraw", "name draw is empty"); + if (name.isEmpty()) + { + return false; + } + if (CheckNameDraw(name) == false) + { + QDomElement rootElement = this->documentElement(); + + QDomElement drawElement = this->createElement(TagDraw); + SetAttribute(drawElement, AttrName, name); + + drawElement.appendChild(createElement(TagCalculation)); + drawElement.appendChild(createElement(TagModeling)); + drawElement.appendChild(createElement(TagDetails)); + + rootElement.appendChild(drawElement); + + if (nameActivDraw.isEmpty()) + { + SetActivDraw(name); + } + else + { + ChangeActivDraw(name); + } + return true; + } + return false; +} + +bool VPattern::SetNameDraw(const QString &name) +{ + Q_ASSERT_X(name.isEmpty() == false, "SetNameDraw", "name draw is empty"); + const QString oldName = nameActivDraw; + QDomElement element; + if (GetActivDrawElement(element)) + { + nameActivDraw = name; + element.setAttribute(AttrName, nameActivDraw); + emit patternChanged(); + emit ChangedNameDraw(oldName, nameActivDraw); + return true; + } + else + { + qWarning()<<"Can't find activ draw"<addItem(GetParametrString(domElement, AttrName)); + } + else + { + ChangeActivDraw(GetParametrString(domElement, AttrName), Document::LiteParse); + } + ParseDrawElement(sceneDraw, sceneDetail, domElement, parse); + } + if (domElement.tagName()=="increments") + { + ParseIncrementsElement(domElement); + } + } + } + domNode = domNode.nextSibling(); + } +} + +VDataTool *VPattern::getTool(const qint64 &id) +{ + if (tools.contains(id)) + { + return tools.value(id); + } + else + { + const QString error = QString(tr("Can't find tool id = %1 in table.")).arg(id); + throw VException(error); + } + return 0; +} + +void VPattern::setCursor(const qint64 &value) +{ + cursor = value; + emit ChangedCursor(cursor); +} + +void VPattern::setCurrentData() +{ + if (*mode == Draw::Calculation) + { + const QString nameDraw = comboBoxDraws->itemText(comboBoxDraws->currentIndex()); + if (nameActivDraw != nameDraw) + { + nameActivDraw = nameDraw; + qint64 id = 0; + if (history.size() == 0) + { + return; + } + for (qint32 i = 0; i < history.size(); ++i) + { + const VToolRecord tool = history.at(i); + if (tool.getNameDraw() == nameDraw) + { + id = tool.getId(); + } + } + if (id == 0) + { + const VToolRecord tool = history.at(history.size()-1); + id = tool.getId(); + if (id == 0) + { + return; + } + } + if (tools.size() > 0) + { + const VDataTool *vTool = tools.value(id); + data->setData(vTool->getData()); + } + } + } +} + +void VPattern::AddTool(const qint64 &id, VDataTool *tool) +{ + Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); + Q_CHECK_PTR(tool); + tools.insert(id, tool); +} + +void VPattern::UpdateToolData(const qint64 &id, VContainer *data) +{ + Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); + Q_CHECK_PTR(data); + VDataTool *tool = tools.value(id); + Q_CHECK_PTR(tool); + tool->VDataTool::setData(data); +} + +void VPattern::IncrementReferens(qint64 id) const +{ + Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); + VDataTool *tool = tools.value(id); + Q_CHECK_PTR(tool); + tool->incrementReferens(); +} + +void VPattern::DecrementReferens(qint64 id) const +{ + Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); + VDataTool *tool = tools.value(id); + Q_CHECK_PTR(tool); + tool->decrementReferens(); +} + +void VPattern::TestUniqueId() const +{ + QVector vector; + CollectId(documentElement(), vector); +} + +qint64 VPattern::SPointActiveDraw() +{ + QDomElement calcElement; + if (GetActivNodeElement(TagCalculation, calcElement)) + { + const QDomNode domNode = calcElement.firstChild(); + if (domNode.isNull() == false && domNode.isElement()) + { + const QDomElement domElement = domNode.toElement(); + if (domElement.isNull() == false) + { + if (domElement.tagName() == VToolPoint::TagName && + domElement.attribute("type", "") == VToolSinglePoint::ToolType) + { + return GetParametrId(domElement); + } + } + } + } + return 0; +} + +bool VPattern::CheckNameDraw(const QString &name) const +{ + Q_ASSERT_X(name.isEmpty() == false, "CheckNameDraw", "name draw is empty"); + const QDomNodeList elements = this->documentElement().elementsByTagName( TagDraw ); + if (elements.size() == 0) + { + return false; + } + for ( qint32 i = 0; i < elements.count(); i++ ) + { + const QDomElement elem = elements.at( i ).toElement(); + if (elem.isNull() == false) + { + if ( GetParametrString(elem, AttrName) == name ) + { + return true; + } + } + } + return false; +} + +void VPattern::SetActivDraw(const QString &name) +{ + Q_ASSERT_X(name.isEmpty() == false, "SetActivDraw", "name draw is empty"); + this->nameActivDraw = name; +} + +bool VPattern::GetActivNodeElement(const QString &name, QDomElement &element) +{ + Q_ASSERT_X(name.isEmpty() == false, "GetActivNodeElement", "name draw is empty"); + QDomElement drawElement; + if (GetActivDrawElement(drawElement)) + { + const QDomNodeList listElement = drawElement.elementsByTagName(name); + if (listElement.size() != 1) + { + return false; + } + element = listElement.at( 0 ).toElement(); + if (element.isNull() == false) + { + return true; + } + else + { + return false; + } + } + return false; +} + +void VPattern::FullUpdateTree() +{ + VMainGraphicsScene *scene = new VMainGraphicsScene(); + Q_CHECK_PTR(scene); + try + { + Parse(Document::LiteParse, scene, scene); + } + catch (const std::bad_alloc &) + { + delete scene; + QMessageBox msgBox; + msgBox.setWindowTitle(tr("Error!")); + msgBox.setText(tr("Error parsing file.")); + msgBox.setInformativeText("std::bad_alloc"); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.setIcon(QMessageBox::Warning); + msgBox.exec(); + return; + } + catch (...) + { + delete scene; + throw; + } + + delete scene; + setCurrentData(); + emit FullUpdateFromFile(); +} + +void VPattern::haveLiteChange() +{ + patternModified = true; + emit patternChanged(); +} + +void VPattern::ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable) +{ + emit ShowTool(id, color, enable); +} + +void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node, + const Document::Documents &parse) +{ + QDomNode domNode = node.firstChild(); + while (domNode.isNull() == false) + { + if (domNode.isElement()) + { + const QDomElement domElement = domNode.toElement(); + if (domElement.isNull() == false) + { + if (domElement.tagName() == "calculation") + { + data->ClearCalculationGObjects(); + ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Calculation); + } + if (domElement.tagName() == "modeling") + { + ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Modeling); + } + if (domElement.tagName() == "details") + { + ParseDetails(sceneDetail, domElement, parse); + } + } + } + domNode = domNode.nextSibling(); + } +} + +void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node, + const Document::Documents &parse, const Draw::Draws &mode) +{ + Q_CHECK_PTR(sceneDraw); + Q_CHECK_PTR(sceneDetail); + VMainGraphicsScene *scene = 0; + if (mode == Draw::Calculation) + { + scene = sceneDraw; + } + else + { + scene = sceneDetail; + } + const QDomNodeList nodeList = node.childNodes(); + const qint32 num = nodeList.size(); + for (qint32 i = 0; i < num; ++i) + { + const QDomElement domElement = nodeList.at(i).toElement(); + if (domElement.isNull() == false) + { + if (domElement.tagName() == "point") + { + ParsePointElement(scene, domElement, parse, domElement.attribute("type", "")); + continue; + } + if (domElement.tagName() == "line") + { + ParseLineElement(scene, domElement, parse); + continue; + } + if (domElement.tagName() == "spline") + { + ParseSplineElement(scene, domElement, parse, domElement.attribute("type", "")); + continue; + } + if (domElement.tagName() == "arc") + { + ParseArcElement(scene, domElement, parse, domElement.attribute("type", "")); + continue; + } + if (domElement.tagName() == "tools") + { + ParseToolsElement(scene, domElement, parse, domElement.attribute("type", "")); + continue; + } + } + } +} + +void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, + const Document::Documents &parse) +{ + Q_CHECK_PTR(sceneDetail); + Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + try + { + VDetail detail; + const qint64 id = GetParametrId(domElement); + detail.setName(GetParametrString(domElement, VAbstractTool::AttrName, "")); + detail.setMx(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0"))); + detail.setMy(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "0.0"))); + detail.setSeamAllowance(GetParametrLongLong(domElement, VToolDetail::AttrSupplement, "1")); + detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0")); + detail.setClosed(GetParametrLongLong(domElement, VToolDetail::AttrClosed, "1")); + + const QDomNodeList nodeList = domElement.childNodes(); + const qint32 num = nodeList.size(); + for (qint32 i = 0; i < num; ++i) + { + const QDomElement element = nodeList.at(i).toElement(); + if (element.isNull() == false) + { + if (element.tagName() == VToolDetail::TagNode) + { + const qint64 id = GetParametrLongLong(element, VToolDetail::AttrIdObject, "0"); + const qreal mx = toPixel(GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); + const qreal my = toPixel(GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); + const NodeDetail::NodeDetails nodeType = NodeDetail::Contour; + const QString t = GetParametrString(element, "type", "NodePoint"); + Tool::Tools tool; + if (t == "NodePoint") + { + tool = Tool::NodePoint; + } + else if (t == "NodeArc") + { + tool = Tool::NodeArc; + } + else if (t == "NodeSpline") + { + tool = Tool::NodeSpline; + } + else if (t == "NodeSplinePath") + { + tool = Tool::NodeSplinePath; + } + detail.append(VNodeDetail(id, tool, nodeType, mx, my)); + } + } + } + VToolDetail::Create(id, detail, sceneDetail, this, data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating detail"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } +} + +void VPattern::ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, + const Document::Documents &parse) +{ + Q_CHECK_PTR(sceneDetail); + Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + QDomNode domNode = domElement.firstChild(); + while (domNode.isNull() == false) + { + if (domNode.isElement()) + { + const QDomElement domElement = domNode.toElement(); + if (domElement.isNull() == false) + { + if (domElement.tagName() == VToolDetail::TagName) + { + ParseDetailElement(sceneDetail, domElement, parse); + } + } + } + domNode = domNode.nextSibling(); + } +} + +void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &domElement, + const Document::Documents &parse, const QString &type) +{ + Q_CHECK_PTR(scene); + Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of point is empty"); + + + QStringList points; + points << VToolSinglePoint::ToolType << VToolEndLine::ToolType << VToolAlongLine::ToolType + << VToolShoulderPoint::ToolType << VToolNormal::ToolType << VToolBisector::ToolType + << VToolLineIntersect::ToolType << VToolPointOfContact::ToolType << VNodePoint::ToolType + << VToolHeight::ToolType << VToolTriangle::ToolType << VToolPointOfIntersection::ToolType + << VToolCutSpline::ToolType << VToolCutSplinePath::ToolType << VToolCutArc::ToolType; + switch(points.indexOf(type)) { + case 0: //VToolSinglePoint::ToolType + { + VToolSinglePoint *spoint = 0; + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "A"); + const qreal x = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrX, "10.0")); + const qreal y = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0")); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + + data->UpdateGObject(id, new VPointF(x, y, name, mx, my)); + VDrawTool::AddRecord(id, Tool::SinglePointTool, this); + if (parse != Document::FullParse) + { + UpdateToolData(id, data); + } + if (parse == Document::FullParse) + { + spoint = new VToolSinglePoint(this, data, id, Tool::FromFile); + Q_CHECK_PTR(spoint); + scene->addItem(spoint); + connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); + tools[id] = spoint; + } + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating single point"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + scene->removeItem(spoint); + delete spoint; + throw excep; + } + break; + } + case 1: //VToolEndLine::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, + VAbstractTool::TypeLineLine); + const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); + const qint64 basePointId = GetParametrLongLong(domElement, VAbstractTool::AttrBasePoint, "0"); + const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); + + VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId, + mx, my, scene, this, data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating point of end line"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 2: //VToolAlongLine::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, + VAbstractTool::TypeLineLine); + const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); + const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); + const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + + VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my, scene, this, + data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating point along line"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 3: //VToolShoulderPoint::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, + VAbstractTool::TypeLineLine); + const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); + const qint64 p1Line = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line, "0"); + const qint64 p2Line = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line, "0"); + const qint64 pShoulder = GetParametrLongLong(domElement, VAbstractTool::AttrPShoulder, "0"); + + VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my, scene, this, + data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating point of shoulder"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 4: //VToolNormal::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, + VAbstractTool::TypeLineLine); + const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); + const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); + const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); + + VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, + angle, mx, my, scene, this,data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating point of normal"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 5: //VToolBisector::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, + VAbstractTool::TypeLineLine); + const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); + const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); + const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + const qint64 thirdPointId = GetParametrLongLong(domElement, VAbstractTool::AttrThirdPoint, "0"); + + VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, + typeLine, name, mx, my, scene, this, data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating point of bisector"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 6: //VToolLineIntersect::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qint64 p1Line1Id = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line1, "0"); + const qint64 p2Line1Id = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line1, "0"); + const qint64 p1Line2Id = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line2, "0"); + const qint64 p2Line2Id = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line2, "0"); + + VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, + mx, my, scene, this, data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating point of lineintersection"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 7: //VToolPointOfContact::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "0"); + const qint64 center = GetParametrLongLong(domElement, VAbstractTool::AttrCenter, "0"); + const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); + const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + + VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, + mx, my, scene, this,data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating point of contact"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 8: //VNodePoint::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); + const qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); + const VPointF *point = data->GeometricObject(idObject ); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), + mx, my, idObject,Draw::Modeling)); + VNodePoint::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating modeling point"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 9: //VToolHeight::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, + VAbstractTool::TypeLineLine); + const qint64 basePointId = GetParametrLongLong(domElement, VAbstractTool::AttrBasePoint, "0"); + const qint64 p1LineId = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line, "0"); + const qint64 p2LineId = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line, "0"); + + VToolHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId, + mx, my, scene, this, data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating height"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 10: //VToolTriangle::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qint64 axisP1Id = GetParametrLongLong(domElement, VAbstractTool::AttrAxisP1, "0"); + const qint64 axisP2Id = GetParametrLongLong(domElement, VAbstractTool::AttrAxisP2, "0"); + const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); + const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + + VToolTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, scene, this, + data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating triangle"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 11: //VToolPointOfIntersection::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); + const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + + VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, + mx, my, scene, this, data, parse,Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating point of intersection"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 12: //VToolCutSpline::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); + const qint64 splineId = GetParametrLongLong(domElement, VToolCutSpline::AttrSpline, "0"); + + VToolCutSpline::Create(id, name, formula, splineId, mx, my, scene, this, data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating cut spline point"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 13: //VToolCutSplinePath::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); + const qint64 splinePathId = GetParametrLongLong(domElement, VToolCutSplinePath::AttrSplinePath, "0"); + + VToolCutSplinePath::Create(id, name, formula, splinePathId, mx, my, + scene, this, data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating cut spline path point"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 14: //VToolCutArc::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); + const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); + const qint64 arcId = GetParametrLongLong(domElement, VToolCutArc::AttrArc, "0"); + + VToolCutArc::Create(id, name, formula, arcId, mx, my, scene, this, data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating cut arc point"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + default: + qWarning() << "Illegal point type in VDomDocument::ParsePointElement()."; + break; + } +} + +void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &domElement, const Document::Documents &parse) +{ + Q_CHECK_PTR(scene); + Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + try + { + const qint64 id = GetParametrId(domElement); + const qint64 firstPoint = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); + const qint64 secondPoint = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); + + VToolLine::Create(id, firstPoint, secondPoint, typeLine, scene, this, data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating line"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } +} + +void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &domElement, + const Document::Documents &parse, const QString &type) +{ + Q_CHECK_PTR(scene); + Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); + + QStringList splines; + splines << VToolSpline::ToolType << VToolSplinePath::ToolType << VNodeSpline::ToolType << VNodeSplinePath::ToolType; + switch(splines.indexOf(type)) { + case 0: //VToolSpline::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const qint64 point1 = GetParametrLongLong(domElement, VAbstractTool::AttrPoint1, "0"); + const qint64 point4 = GetParametrLongLong(domElement, VAbstractTool::AttrPoint4, "0"); + const qreal angle1 = GetParametrDouble(domElement, VAbstractTool::AttrAngle1, "270.0"); + const qreal angle2 = GetParametrDouble(domElement, VAbstractTool::AttrAngle2, "90.0"); + const qreal kAsm1 = GetParametrDouble(domElement, VAbstractTool::AttrKAsm1, "1.0"); + const qreal kAsm2 = GetParametrDouble(domElement, VAbstractTool::AttrKAsm2, "1.0"); + const qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0"); + + VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this, data, parse, + Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating simple curve"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 1: //VToolSplinePath::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0"); + VSplinePath *path = new VSplinePath(kCurve); + Q_CHECK_PTR(path); + + const QDomNodeList nodeList = domElement.childNodes(); + const qint32 num = nodeList.size(); + for (qint32 i = 0; i < num; ++i) + { + const QDomElement element = nodeList.at(i).toElement(); + if (element.isNull() == false) + { + if (element.tagName() == VAbstractTool::AttrPathPoint) + { + const qreal kAsm1 = GetParametrDouble(element, VAbstractTool::AttrKAsm1, "1.0"); + const qreal angle = GetParametrDouble(element, VAbstractTool::AttrAngle, "0"); + const qreal kAsm2 = GetParametrDouble(element, VAbstractTool::AttrKAsm2, "1.0"); + const qint64 pSpline = GetParametrLongLong(element, VAbstractTool::AttrPSpline, "0"); + const VPointF p = *data->GeometricObject(pSpline); + + QLineF line(0, 0, 100, 0); + line.setAngle(angle+180); + + VSplinePoint splPoint(p, kAsm1, line.angle(), kAsm2, angle); + path->append(splPoint); + if (parse == Document::FullParse) + { + IncrementReferens(pSpline); + } + } + } + } + + VToolSplinePath::Create(id, path, scene, this, data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating curve path"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 2: //VNodeSpline::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); + const qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); + VSpline *spl = new VSpline(*data->GeometricObject(idObject)); + Q_CHECK_PTR(spl); + spl->setIdObject(idObject); + spl->setMode(Draw::Modeling); + data->UpdateGObject(id, spl); + VNodeSpline::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating modeling simple curve"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 3: //VNodeSplinePath::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); + const qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); + VSplinePath *path = new VSplinePath(*data->GeometricObject(idObject)); + Q_CHECK_PTR(path); + path->setIdObject(idObject); + path->setMode(Draw::Modeling); + data->UpdateGObject(id, path); + VNodeSplinePath::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating modeling curve path"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + default: + qWarning() << "Illegal spline type in VDomDocument::ParseSplineElement()."; + break; + } +} + +void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &domElement, + const Document::Documents &parse, const QString &type) +{ + Q_CHECK_PTR(scene); + Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); + + QStringList arcs; + arcs << VToolArc::ToolType << VNodeArc::ToolType; + + switch(arcs.indexOf(type)) { + case 0: //VToolArc::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const qint64 center = GetParametrLongLong(domElement, VAbstractTool::AttrCenter, "0"); + const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "10"); + const QString f1 = GetParametrString(domElement, VAbstractTool::AttrAngle1, "180"); + const QString f2 = GetParametrString(domElement, VAbstractTool::AttrAngle2, "270"); + + VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating simple arc"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + case 1: //VNodeArc::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); + const qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); + VArc *arc = new VArc(*data->GeometricObject(idObject)); + Q_CHECK_PTR(arc); + arc->setIdObject(idObject); + arc->setMode(Draw::Modeling); + data->UpdateGObject(id, arc); + VNodeArc::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating modeling arc"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + default: + qWarning() << "Illegal arc type in VDomDocument::ParseArcElement()."; + break; + } +} + +void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &domElement, + const Document::Documents &parse, const QString &type) +{ + Q_CHECK_PTR(scene); + Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty"); + + QStringList tools; + tools << VToolUnionDetails::ToolType; + + switch(tools.indexOf(type)) { + case 0: //VToolUnionDetails::ToolType + try + { + const qint64 id = GetParametrId(domElement); + const qint64 indexD1 = GetParametrLongLong(domElement, VToolUnionDetails::AttrIndexD1, "-1"); + const qint64 indexD2 = GetParametrLongLong(domElement, VToolUnionDetails::AttrIndexD2, "-1"); + + const QVector vector = VToolUnionDetails::GetDetailFromFile(this, domElement); + + VToolUnionDetails::Create(id, vector[0], vector[1], 0, 0, indexD1, indexD2, scene, this, data, parse, + Tool::FromFile); + } + catch (const VExceptionBadId &e) + { + VExceptionObjectError excep(tr("Error creating or updating union details"), domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + break; + default: + qWarning() << "Illegal tools type in VDomDocument::ParseToolsElement()."; + break; + } +} + +void VPattern::ParseIncrementsElement(const QDomNode &node) +{ + QDomNode domNode = node.firstChild(); + while (domNode.isNull() == false) + { + if (domNode.isElement()) + { + const QDomElement domElement = domNode.toElement(); + if (domElement.isNull() == false) + { + if (domElement.tagName() == "increment") + { + qint64 id = GetParametrId(domElement); + QString name = GetParametrString(domElement, "name", ""); + qreal base = GetParametrDouble(domElement, "base", "0"); + qreal ksize = GetParametrDouble(domElement, "ksize", "0"); + qreal kgrowth = GetParametrDouble(domElement, "kgrowth", "0"); + QString desc = GetParametrString(domElement, "description", "Description"); + data->UpdateId(id); + data->AddIncrementTableRow(name, VIncrementTableRow(id, base, ksize, kgrowth, desc)); + } + } + } + domNode = domNode.nextSibling(); + } +} + +qint64 VPattern::GetParametrId(const QDomElement &domElement) const +{ + Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + const qint64 id = GetParametrLongLong(domElement, "id", "0"); + if (id <= 0) + { + throw VExceptionWrongParameterId(tr("Got wrong parameter id. Need only id > 0."), domElement); + } + return id; +} + +void VPattern::CollectId(const QDomElement &node, QVector &vector) const +{ + if (node.hasAttribute("id")) + { + const qint64 id = GetParametrId(node); + if (vector.contains(id)) + { + throw VExceptionUniqueId(tr("This id is not unique."), node); + } + vector.append(id); + } + + for (qint32 i=0; iClear(); + data->CreateManTableIGroup(); + nameActivDraw.clear(); + sceneDraw->clear(); + sceneDetail->clear(); + comboBoxDraws->clear(); + tools.clear(); + cursor = 0; + } + data->ClearLengthLines(); + data->ClearLengthArcs(); + data->ClearLengthSplines(); + data->ClearLineAngles(); + data->ClearDetails(); + history.clear(); +} diff --git a/src/xml/vpattern.h b/src/xml/vpattern.h new file mode 100644 index 000000000..3ce440177 --- /dev/null +++ b/src/xml/vpattern.h @@ -0,0 +1,367 @@ +/************************************************************************ + ** + ** @file vpattern.h + ** @author Roman Telezhinsky + ** @date 24 2, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 VPATTERN_H +#define VPATTERN_H + +#include "vdomdocument.h" +#include "../widgets/vmaingraphicsscene.h" +#include "../tools/vdatatool.h" +#include "vtoolrecord.h" +#include + +namespace Document +{ + /** + * @brief The Document enum parse types. + */ + enum Document { LiteParse, FullParse}; + Q_DECLARE_FLAGS(Documents, Document) +} +Q_DECLARE_OPERATORS_FOR_FLAGS(Document::Documents) + +/** + * @brief The VPattern class working with pattern file. + */ +class VPattern : public QObject, public VDomDocument +{ + Q_OBJECT +public: + VPattern(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent = 0); + /** + * @brief CreateEmptyFile create minimal empty file. + */ + void CreateEmptyFile(); + /** + * @brief ChangeActivDraw set new pattern peace name. + * @param name new name. + * @param parse parser file mode. + */ + void ChangeActivDraw(const QString& name, const Document::Documents &parse = Document::FullParse); + /** + * @brief GetNameActivDraw return current pattern peace name. + * @return pattern peace name. + */ + inline QString GetNameActivDraw() const {return nameActivDraw;} + /** + * @brief GetActivDrawElement return draw tag for current pattern peace. + * @param element draw tag. + * @return true if found. + */ + bool GetActivDrawElement(QDomElement &element); + /** + * @brief appendDraw add new pattern peace structure to the file. + * @param name pattern peace name. + * @return true if success. + */ + bool appendDraw(const QString& name); + /** + * @brief SetNameDraw change current pattern peace. + * @param name pattern peace name. + * @return true if success. + */ + bool SetNameDraw(const QString& name); + /** + * @brief Parse parse file. + * @param parse parser file mode. + * @param sceneDraw pointer to draw scene. + * @param sceneDetail pointer to details scene. + */ + void Parse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, + VMainGraphicsScene *sceneDetail); + /** + * @brief getTools return list of tools pointers. + * @return list. + */ + inline QHash* getTools() {return &tools;} + /** + * @brief getTool return tool from tool list. + * @param id tool id. + * @return tool. + */ + VDataTool* getTool(const qint64 &id); + /** + * @brief getHistory return list with list of history records. + * @return list of history records. + */ + inline QVector *getHistory() {return &history;} + /** + * @brief getCursor return cursor. + * @return cursor. + */ + inline qint64 getCursor() const {return cursor;} + /** + * @brief setCursor set cursor. + * @param value cursor. + */ + void setCursor(const qint64 &value); + /** + * @brief setCurrentData set current data set. + */ + void setCurrentData(); + /** + * @brief AddTool add tool to list tools. + * @param id tool id. + * @param tool tool. + */ + void AddTool(const qint64 &id, VDataTool *tool); + /** + * @brief UpdateToolData update tool in list tools. + * @param id tool id. + * @param data container with variables. + */ + void UpdateToolData(const qint64 &id, VContainer *data); + /** + * @brief IncrementReferens increment reference parent objects. + * @param id parent object id. + */ + void IncrementReferens(qint64 id) const; + /** + * @brief DecrementReferens decrement reference parent objects. + * @param id parent object id. + */ + void DecrementReferens(qint64 id) const; + /** + * @brief TestUniqueId test exist unique id in pattern file. Each id must be unique. + */ + void TestUniqueId() const; + /** + * @brief SPointActiveDraw return id base point current pattern peace. + * @return id base point. + */ + qint64 SPointActiveDraw(); + inline bool isPatternModified() const {return patternModified;} + inline void setPatternModified(bool value) {patternModified = value;} + /** + * @brief GetActivNodeElement find element in current pattern piece by name. + * @param name name tag. + * @param element element. + * @return true if found. + */ + bool GetActivNodeElement(const QString& name, QDomElement& element); + static const QString TagCalculation; + static const QString TagModeling; + static const QString TagDetails; + static const QString TagAuthor; + static const QString TagDescription; + static const QString TagNotes; + static const QString TagIncrements; + static const QString TagDraw; + static const QString AttrName; +signals: + /** + * @brief ChangedActivDraw change active pattern peace. + * @param newName new pattern peace name. + */ + void ChangedActivDraw(const QString &newName); + /** + * @brief ChangedNameDraw save new name active pattern peace. + * @param oldName old name. + * @param newName new name. + */ + void ChangedNameDraw(const QString &oldName, const QString &newName); + /** + * @brief FullUpdateFromFile update tool data form file. + */ + void FullUpdateFromFile(); + /** + * @brief patternChanged emit if we have unsaved change. + */ + void patternChanged(); + /** + * @brief ShowTool highlight tool. + * @param id tool id. + * @param color highlight color. + * @param enable enable or disable highlight. + */ + void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + /** + * @brief ChangedCursor change cursor position. + * @param id tool id. + */ + void ChangedCursor(qint64 id); +public slots: + /** + * @brief FullUpdateTree lite parse file. + */ + void FullUpdateTree(); + /** + * @brief haveLiteChange we have unsaved change. + */ + void haveLiteChange(); + /** + * @brief ShowHistoryTool hightlight tool. + * @param id tool id. + * @param color hightlight color. + * @param enable enable or diasable hightlight. + */ + void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable); +private: + Q_DISABLE_COPY(VPattern) + /** + * @brief nameActivDraw name current pattern peace. + */ + QString nameActivDraw; + /** + * @brief tools list with pointer on tools. + */ + QHash tools; + /** + * @brief history history records. + */ + QVector history; + /** + * @brief cursor cursor keep id tool after which we will add new tool in file. + */ + qint64 cursor; + QComboBox *comboBoxDraws; + /** + * @brief mode current draw mode. + */ + Draw::Draws *mode; + /** + * @brief fileModified true if exist change in file. + */ + bool patternModified; + /** + * @brief CheckNameDraw check if exist pattern peace with this name. + * @param name pattern peace name. + * @return true if exist. + */ + bool CheckNameDraw(const QString& name) const; + /** + * @brief SetActivDraw set current pattern peace. + * @param name pattern peace name. + */ + void SetActivDraw(const QString& name); + + /** + * @brief ParseDrawElement parse draw tag. + * @param sceneDraw draw scene. + * @param sceneDetail details scene. + * @param node node. + * @param parse parser file mode. + */ + void ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, + const QDomNode& node, const Document::Documents &parse); + /** + * @brief ParseDrawMode parse draw tag with draw mode. + * @param sceneDraw draw scene. + * @param sceneDetail details scene. + * @param node node. + * @param parse parser file mode. + * @param mode draw mode. + */ + void ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, + const QDomNode& node, const Document::Documents &parse, const Draw::Draws &mode); + /** + * @brief ParseDetailElement parse detail tag. + * @param sceneDetail detail scene. + * @param domElement tag in xml tree. + * @param parse parser file mode. + */ + void ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, + const Document::Documents &parse); + /** + * @brief ParseDetails parse details tag. + * @param sceneDetail detail scene. + * @param domElement tag in xml tree. + * @param parse parser file mode. + */ + void ParseDetails(VMainGraphicsScene *sceneDetail, const QDomElement &domElement, + const Document::Documents &parse); + /** + * @brief ParsePointElement parse point tag. + * @param scene scene. + * @param domElement tag in xml tree. + * @param parse parser file mode. + * @param type type of point. + * @param mode draw mode. + */ + void ParsePointElement(VMainGraphicsScene *scene, const QDomElement& domElement, + const Document::Documents &parse, const QString &type); + /** + * @brief ParseLineElement parse line tag. + * @param scene scene. + * @param domElement tag in xml tree. + * @param parse parser file mode. + * @param mode draw mode. + */ + void ParseLineElement(VMainGraphicsScene *scene, const QDomElement& domElement, + const Document::Documents &parse); + /** + * @brief ParseSplineElement parse spline tag. + * @param scene scene. + * @param domElement tag in xml tree. + * @param parse parser file mode. + * @param type type of spline. + * @param mode draw mode. + */ + void ParseSplineElement(VMainGraphicsScene *scene, const QDomElement& domElement, + const Document::Documents &parse, const QString& type); + /** + * @brief ParseArcElement parse arc tag. + * @param scene scene. + * @param domElement tag in xml tree. + * @param parse parser file mode. + * @param type type of spline. + * @param mode draw mode. + */ + void ParseArcElement(VMainGraphicsScene *scene, const QDomElement& domElement, + const Document::Documents &parse, const QString& type); + /** + * @brief ParseToolsElement parse tools tag. + * @param scene scene. + * @param domElement tag in xml tree. + * @param parse parser file mode. + * @param type type of spline. + */ + void ParseToolsElement(VMainGraphicsScene *scene, const QDomElement& domElement, + const Document::Documents &parse, const QString& type); + /** + * @brief ParseIncrementsElement parse increments tag. + * @param node tag in xml tree. + */ + void ParseIncrementsElement(const QDomNode& node); + /** + * @brief GetParametrId return value id attribute. + * @param domElement tag in xml tree. + * @return id value. + */ + qint64 GetParametrId(const QDomElement& domElement) const; + /** + * @brief CollectId recursive function, try find id attribute in file. Throw exclusion if find not unique. + * @param node tag in xml tree. + * @param vector list with ids. + */ + void CollectId(const QDomElement &node, QVector &vector)const; + void PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, + VMainGraphicsScene *sceneDetail); +}; + +#endif // VPATTERN_H diff --git a/src/xml/xml.pri b/src/xml/xml.pri index 0214e42b5..08b77844d 100644 --- a/src/xml/xml.pri +++ b/src/xml/xml.pri @@ -1,7 +1,9 @@ HEADERS += \ src/xml/vtoolrecord.h \ - src/xml/vdomdocument.h + src/xml/vdomdocument.h \ + src/xml/vpattern.h SOURCES += \ src/xml/vtoolrecord.cpp \ - src/xml/vdomdocument.cpp + src/xml/vdomdocument.cpp \ + src/xml/vpattern.cpp From e184fcc6a79ad538f8f6c9c3baf2f032aec36481 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 25 Feb 2014 16:40:24 +0200 Subject: [PATCH 10/60] Use for id quint32 type instead qint64. --HG-- branch : feature --- share/resources/schema/pattern.xsd | 100 +++++----- src/container/vcontainer.cpp | 48 ++--- src/container/vcontainer.h | 44 ++--- src/container/vincrementtablerow.cpp | 2 +- src/container/vincrementtablerow.h | 8 +- src/dialogs/app/dialoghistory.cpp | 106 +++++------ src/dialogs/app/dialoghistory.h | 4 +- src/dialogs/app/dialogincrements.cpp | 22 +-- src/dialogs/app/dialogincrements.h | 2 +- src/dialogs/tools/dialogalongline.cpp | 6 +- src/dialogs/tools/dialogalongline.h | 14 +- src/dialogs/tools/dialogarc.cpp | 4 +- src/dialogs/tools/dialogarc.h | 8 +- src/dialogs/tools/dialogbisector.cpp | 8 +- src/dialogs/tools/dialogbisector.h | 20 +- src/dialogs/tools/dialogcutarc.cpp | 4 +- src/dialogs/tools/dialogcutarc.h | 8 +- src/dialogs/tools/dialogcutspline.cpp | 4 +- src/dialogs/tools/dialogcutspline.h | 8 +- src/dialogs/tools/dialogcutsplinepath.cpp | 4 +- src/dialogs/tools/dialogcutsplinepath.h | 8 +- src/dialogs/tools/dialogdetail.cpp | 4 +- src/dialogs/tools/dialogdetail.h | 4 +- src/dialogs/tools/dialogendline.cpp | 4 +- src/dialogs/tools/dialogendline.h | 8 +- src/dialogs/tools/dialogheight.cpp | 8 +- src/dialogs/tools/dialogheight.h | 20 +- src/dialogs/tools/dialogline.cpp | 10 +- src/dialogs/tools/dialogline.h | 14 +- src/dialogs/tools/dialoglineintersect.cpp | 18 +- src/dialogs/tools/dialoglineintersect.h | 26 +-- src/dialogs/tools/dialognormal.cpp | 6 +- src/dialogs/tools/dialognormal.h | 14 +- src/dialogs/tools/dialogpointofcontact.cpp | 8 +- src/dialogs/tools/dialogpointofcontact.h | 20 +- .../tools/dialogpointofintersection.cpp | 6 +- src/dialogs/tools/dialogpointofintersection.h | 14 +- src/dialogs/tools/dialogshoulderpoint.cpp | 8 +- src/dialogs/tools/dialogshoulderpoint.h | 20 +- src/dialogs/tools/dialogspline.cpp | 12 +- src/dialogs/tools/dialogspline.h | 14 +- src/dialogs/tools/dialogsplinepath.cpp | 8 +- src/dialogs/tools/dialogsplinepath.h | 6 +- src/dialogs/tools/dialogtool.cpp | 54 +++--- src/dialogs/tools/dialogtool.h | 24 +-- src/dialogs/tools/dialogtriangle.cpp | 10 +- src/dialogs/tools/dialogtriangle.h | 26 +-- src/dialogs/tools/dialoguniondetails.cpp | 6 +- src/dialogs/tools/dialoguniondetails.h | 18 +- src/exception/vexceptionbadid.h | 6 +- src/geometry/varc.cpp | 4 +- src/geometry/varc.h | 4 +- src/geometry/vdetail.cpp | 22 +-- src/geometry/vdetail.h | 22 +-- src/geometry/vequidistant.cpp | 2 +- src/geometry/vequidistant.h | 2 +- src/geometry/vgobject.cpp | 10 +- src/geometry/vgobject.h | 14 +- src/geometry/vnodedetail.cpp | 2 +- src/geometry/vnodedetail.h | 8 +- src/geometry/vpointf.cpp | 2 +- src/geometry/vpointf.h | 2 +- src/geometry/vspline.cpp | 4 +- src/geometry/vspline.h | 4 +- src/geometry/vsplinepath.cpp | 2 +- src/geometry/vsplinepath.h | 2 +- src/mainwindow.cpp | 10 +- src/tools/drawTools/vdrawtool.cpp | 6 +- src/tools/drawTools/vdrawtool.h | 6 +- src/tools/drawTools/vtoolalongline.cpp | 14 +- src/tools/drawTools/vtoolalongline.h | 10 +- src/tools/drawTools/vtoolarc.cpp | 10 +- src/tools/drawTools/vtoolarc.h | 6 +- src/tools/drawTools/vtoolbisector.cpp | 18 +- src/tools/drawTools/vtoolbisector.h | 14 +- src/tools/drawTools/vtoolcutarc.cpp | 18 +- src/tools/drawTools/vtoolcutarc.h | 16 +- src/tools/drawTools/vtoolcutspline.cpp | 20 +- src/tools/drawTools/vtoolcutspline.h | 18 +- src/tools/drawTools/vtoolcutsplinepath.cpp | 22 +-- src/tools/drawTools/vtoolcutsplinepath.h | 18 +- src/tools/drawTools/vtoolendline.cpp | 12 +- src/tools/drawTools/vtoolendline.h | 8 +- src/tools/drawTools/vtoolheight.cpp | 16 +- src/tools/drawTools/vtoolheight.h | 12 +- src/tools/drawTools/vtoolline.cpp | 16 +- src/tools/drawTools/vtoolline.h | 12 +- src/tools/drawTools/vtoollineintersect.cpp | 20 +- src/tools/drawTools/vtoollineintersect.h | 16 +- src/tools/drawTools/vtoollinepoint.cpp | 4 +- src/tools/drawTools/vtoollinepoint.h | 6 +- src/tools/drawTools/vtoolnormal.cpp | 16 +- src/tools/drawTools/vtoolnormal.h | 12 +- src/tools/drawTools/vtoolpoint.cpp | 4 +- src/tools/drawTools/vtoolpoint.h | 4 +- src/tools/drawTools/vtoolpointofcontact.cpp | 18 +- src/tools/drawTools/vtoolpointofcontact.h | 16 +- .../drawTools/vtoolpointofintersection.cpp | 14 +- .../drawTools/vtoolpointofintersection.h | 12 +- src/tools/drawTools/vtoolshoulderpoint.cpp | 18 +- src/tools/drawTools/vtoolshoulderpoint.h | 14 +- src/tools/drawTools/vtoolsinglepoint.cpp | 2 +- src/tools/drawTools/vtoolsinglepoint.h | 2 +- src/tools/drawTools/vtoolspline.cpp | 12 +- src/tools/drawTools/vtoolspline.h | 6 +- src/tools/drawTools/vtoolsplinepath.cpp | 8 +- src/tools/drawTools/vtoolsplinepath.h | 6 +- src/tools/drawTools/vtooltriangle.cpp | 20 +- src/tools/drawTools/vtooltriangle.h | 16 +- src/tools/nodeDetails/vabstractnode.cpp | 4 +- src/tools/nodeDetails/vabstractnode.h | 8 +- src/tools/nodeDetails/vnodearc.cpp | 8 +- src/tools/nodeDetails/vnodearc.h | 8 +- src/tools/nodeDetails/vnodepoint.cpp | 8 +- src/tools/nodeDetails/vnodepoint.h | 8 +- src/tools/nodeDetails/vnodespline.cpp | 8 +- src/tools/nodeDetails/vnodespline.h | 8 +- src/tools/nodeDetails/vnodesplinepath.cpp | 8 +- src/tools/nodeDetails/vnodesplinepath.h | 8 +- src/tools/vabstracttool.cpp | 6 +- src/tools/vabstracttool.h | 10 +- src/tools/vdatatool.h | 4 +- src/tools/vtooldetail.cpp | 16 +- src/tools/vtooldetail.h | 6 +- src/tools/vtooluniondetails.cpp | 38 ++-- src/tools/vtooluniondetails.h | 25 ++- src/widgets/vmaingraphicsscene.cpp | 2 +- src/widgets/vmaingraphicsscene.h | 4 +- src/widgets/vsimplearc.cpp | 2 +- src/widgets/vsimplearc.h | 6 +- src/widgets/vsimplespline.cpp | 2 +- src/widgets/vsimplespline.h | 6 +- src/widgets/vsimplesplinepath.cpp | 2 +- src/widgets/vsimplesplinepath.h | 2 +- src/xml/vdomdocument.cpp | 7 +- src/xml/vdomdocument.h | 2 +- src/xml/vpattern.cpp | 178 +++++++++--------- src/xml/vpattern.h | 32 ++-- src/xml/vtoolrecord.cpp | 2 +- src/xml/vtoolrecord.h | 8 +- 140 files changed, 948 insertions(+), 950 deletions(-) diff --git a/share/resources/schema/pattern.xsd b/share/resources/schema/pattern.xsd index 8c8394d6a..d1a1fe300 100644 --- a/share/resources/schema/pattern.xsd +++ b/share/resources/schema/pattern.xsd @@ -13,7 +13,7 @@ - + @@ -32,51 +32,51 @@ - + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - + + + - - - + + + - + - + @@ -86,21 +86,21 @@ - + - + - - + + @@ -113,31 +113,31 @@ - - + + - + - - + + - + - - + + - + @@ -149,9 +149,9 @@ - - - + + + @@ -159,10 +159,10 @@ - + - - + + @@ -178,20 +178,20 @@ - - - + + + - - + + - + - + diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index bcda3190d..7f49d3b71 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -31,13 +31,13 @@ #include #include -qint64 VContainer::_id = 0; +quint32 VContainer::_id = 0; VContainer::VContainer() - :base(QHash()), gObjects(QHash()), + :base(QHash()), gObjects(QHash()), standardTable(QHash()), incrementTable(QHash()), lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()), - lengthArcs(QHash()), details(QHash()) + lengthArcs(QHash()), details(QHash()) { SetSize(500); SetGrowth(1760); @@ -51,10 +51,10 @@ VContainer &VContainer::operator =(const VContainer &data) } VContainer::VContainer(const VContainer &data) - :base(QHash()), gObjects(QHash()), + :base(QHash()), gObjects(QHash()), standardTable(QHash()), incrementTable(QHash()), lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()), - lengthArcs(QHash()), details(QHash()) + lengthArcs(QHash()), details(QHash()) { setData(data); } @@ -71,9 +71,9 @@ void VContainer::setData(const VContainer &data) qDeleteAll(gObjects); gObjects.clear(); - const QHash *obj = data.DataGObjects(); + const QHash *obj = data.DataGObjects(); Q_CHECK_PTR(obj); - QHashIterator i(*obj); + QHashIterator i(*obj); while (i.hasNext()) { i.next(); @@ -112,7 +112,7 @@ void VContainer::setData(const VContainer &data) details = *data.DataDetails(); } -const VGObject *VContainer::GetGObject(qint64 id)const +const VGObject *VContainer::GetGObject(quint32 id)const { return GetObject(gObjects, id); } @@ -179,19 +179,19 @@ qreal VContainer::GetLineAngle(const QString &name) const return GetVariable(lineAngles, name); } -const VDetail VContainer::GetDetail(qint64 id) const +const VDetail VContainer::GetDetail(quint32 id) const { return GetVariable(details, id); } -qint64 VContainer::AddGObject(VGObject *obj) +quint32 VContainer::AddGObject(VGObject *obj) { return AddObject(gObjects, obj); } -qint64 VContainer::AddDetail(VDetail detail) +quint32 VContainer::AddDetail(VDetail detail) { - qint64 id = getNextId(); + quint32 id = getNextId(); details[id] = detail; return id; } @@ -201,13 +201,13 @@ void VContainer::AddIncrementTableRow(const QString &name, VIncrementTableRow ro incrementTable[name] = row; } -qint64 VContainer::getNextId() +quint32 VContainer::getNextId() { _id++; return _id; } -void VContainer::UpdateId(qint64 newId) +void VContainer::UpdateId(quint32 newId) { if (newId > _id) { @@ -216,7 +216,7 @@ void VContainer::UpdateId(qint64 newId) } template -void VContainer::UpdateObject(QHash &obj, const qint64 &id, val point) +void VContainer::UpdateObject(QHash &obj, const quint32 &id, val point) { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_CHECK_PTR(point); @@ -236,7 +236,7 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value) lengthSplines[name] = value; } -void VContainer::AddLengthArc(const qint64 &id) +void VContainer::AddLengthArc(const quint32 &id) { const VArc * arc = GeometricObject(id); lengthArcs[arc->name()] = toMM(arc->GetLength()); @@ -292,7 +292,7 @@ void VContainer::ClearCalculationGObjects() { if (gObjects.size()>0) { - QHashIterator i(gObjects); + QHashIterator i(gObjects); while (i.hasNext()) { i.next(); @@ -347,7 +347,7 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const return 0; } -void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId) +void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPointId) { QString nameLine = GetNameLine(firstPointId, secondPointId); const VPointF *first = GeometricObject(firstPointId); @@ -358,16 +358,16 @@ void VContainer::AddLine(const qint64 &firstPointId, const qint64 &secondPointId } template -qint64 VContainer::AddObject(QHash &obj, val value) +quint32 VContainer::AddObject(QHash &obj, val value) { Q_CHECK_PTR(value); - qint64 id = getNextId(); + quint32 id = getNextId(); value->setId(id); obj[id] = value; return id; } -QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const +QString VContainer::GetNameLine(const quint32 &firstPoint, const quint32 &secondPoint) const { const VPointF *first = GeometricObject(firstPoint); const VPointF *second = GeometricObject(secondPoint); @@ -375,7 +375,7 @@ QString VContainer::GetNameLine(const qint64 &firstPoint, const qint64 &secondPo return QString("Line_%1_%2").arg(first->name(), second->name()); } -QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint) const +QString VContainer::GetNameLineAngle(const quint32 &firstPoint, const quint32 &secondPoint) const { const VPointF *first = GeometricObject(firstPoint); const VPointF *second = GeometricObject(secondPoint); @@ -383,12 +383,12 @@ QString VContainer::GetNameLineAngle(const qint64 &firstPoint, const qint64 &sec return QString("AngleLine_%1_%2").arg(first->name(), second->name()); } -void VContainer::UpdateGObject(qint64 id, VGObject* obj) +void VContainer::UpdateGObject(quint32 id, VGObject* obj) { UpdateObject(gObjects, id, obj); } -void VContainer::UpdateDetail(qint64 id, const VDetail &detail) +void VContainer::UpdateDetail(quint32 id, const VDetail &detail) { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); details[id] = detail; diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index 87508a6b8..fd44cfcf7 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -62,7 +62,7 @@ public: VContainer(const VContainer &data); ~VContainer(); template - void CopyGObject(const VContainer &data, const qint64 &id) + void CopyGObject(const VContainer &data, const quint32 &id) { T *obj = new T(*data.GeometricObject(id)); Q_CHECK_PTR(obj); @@ -74,7 +74,7 @@ public: */ void setData(const VContainer &data); template - const T GeometricObject(qint64 id) const + const T GeometricObject(quint32 id) const { VGObject *gObj = 0; if (gObjects.contains(id)) @@ -95,7 +95,7 @@ public: * @param id id of point * @return point */ - const VGObject *GetGObject(qint64 id) const; + const VGObject *GetGObject(quint32 id) const; /** * @brief GetStandardTableCell return standard table row by name * @param name name of standard table row @@ -137,24 +137,24 @@ public: * @param id id of detail * @return detail */ - const VDetail GetDetail(qint64 id) const; + const VDetail GetDetail(quint32 id) const; /** * @brief getId return current id * @return current id */ - static qint64 getId() {return _id;} + static quint32 getId() {return _id;} /** * @brief AddPoint add new point to container * @param point new point * @return return id of new point in container */ - qint64 AddGObject(VGObject *obj); + quint32 AddGObject(VGObject *obj); /** * @brief AddDetail add new detail to container * @param detail new detail * @return return id of new detail in container */ - qint64 AddDetail(VDetail detail); + quint32 AddDetail(VDetail detail); /** * @brief AddStandardTableCell add new row of standard table * @param name name of row of standard table @@ -184,7 +184,7 @@ public: * @brief AddLengthArc add length of arc to container * @param id id of arc */ - void AddLengthArc(const qint64 &id); + void AddLengthArc(const quint32 &id); /** * @brief AddLineAngle add angle of line to container * @param name name of line angle @@ -197,7 +197,7 @@ public: * @param secondPointId id of second point of line * @param mode mode of line */ - void AddLine(const qint64 &firstPointId, const qint64 &secondPointId); + void AddLine(const quint32 &firstPointId, const quint32 &secondPointId); /** * @brief GetNameLine return name of line * @param firstPoint id of first point of line @@ -205,7 +205,7 @@ public: * @return name of line */ // cppcheck-suppress functionStatic - QString GetNameLine(const qint64 &firstPoint, const qint64 &secondPoint) const; + QString GetNameLine(const quint32 &firstPoint, const quint32 &secondPoint) const; /** * @brief GetNameLineAngle return name of line angle * @param firstPoint id of first point of line @@ -213,19 +213,19 @@ public: * @return name of angle of line */ // cppcheck-suppress functionStatic - QString GetNameLineAngle(const qint64 &firstPoint, const qint64 &secondPoint) const; + QString GetNameLineAngle(const quint32 &firstPoint, const quint32 &secondPoint) const; /** * @brief UpdatePoint update point by id * @param id id of existing point * @param point point */ - void UpdateGObject(qint64 id, VGObject* obj); + void UpdateGObject(quint32 id, VGObject* obj); /** * @brief UpdateDetail update detail by id * @param id id of existing detail * @param detail detail */ - void UpdateDetail(qint64 id, const VDetail &detail); + void UpdateDetail(quint32 id, const VDetail &detail); /** * @brief UpdateStandardTableCell update standard table row by name * @param name name of row @@ -319,7 +319,7 @@ public: * @brief getNextId generate next unique id * @return next unique id */ - static qint64 getNextId(); + static quint32 getNextId(); /** * @brief RemoveIncrementTableRow remove row by name from increment table * @param name name of existing row @@ -329,7 +329,7 @@ public: * @brief data container with datagObjects return container of gObjects * @return pointer on container of gObjects */ - inline const QHash *DataGObjects() const {return &gObjects;} + inline const QHash *DataGObjects() const {return &gObjects;} /** * @brief data container with dataBase return container of data * @return pointer on container of base data @@ -369,12 +369,12 @@ public: * @brief data container with dataDetails return container of details * @return pointer on container of details */ - inline const QHash *DataDetails() const {return &details;} + inline const QHash *DataDetails() const {return &details;} /** * @brief UpdateId update id. If new id bigger when current save new like current. * @param newId id */ - static void UpdateId(qint64 newId); + static void UpdateId(quint32 newId); /** * @brief CreateManTableIGroup generate man standard table of measurements */ @@ -383,7 +383,7 @@ private: /** * @brief _id current id. New object will have value +1. For empty class equal 0. */ - static qint64 _id; + static quint32 _id; /** * @brief base container of base data (size and growth) */ @@ -391,7 +391,7 @@ private: /** * @brief gObjects graphicals objects of pattern. */ - QHash gObjects; + QHash gObjects; /** * @brief standardTable container of standard table rows */ @@ -419,7 +419,7 @@ private: /** * @brief details container of details */ - QHash details; + QHash details; template /** * @brief GetObject return object from container @@ -445,7 +445,7 @@ private: * @param id id of existing object * @param point object */ - void UpdateObject(QHash &obj, const qint64 &id, val point); + void UpdateObject(QHash &obj, const quint32 &id, val point); template /** * @brief AddObject add object to container @@ -453,7 +453,7 @@ private: * @param value object * @return id of object in container */ - static qint64 AddObject(QHash &obj, val value); + static quint32 AddObject(QHash &obj, val value); }; #endif // VCONTAINER_H diff --git a/src/container/vincrementtablerow.cpp b/src/container/vincrementtablerow.cpp index 7b7b00655..2e41c2755 100644 --- a/src/container/vincrementtablerow.cpp +++ b/src/container/vincrementtablerow.cpp @@ -31,5 +31,5 @@ VIncrementTableRow::VIncrementTableRow() :id(0), base(0), ksize(0), kgrowth(0), description(QString()){} -VIncrementTableRow::VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth, QString description) +VIncrementTableRow::VIncrementTableRow(quint32 id, qreal base, qreal ksize, qreal kgrowth, QString description) :id(id), base(base), ksize(ksize), kgrowth(kgrowth), description(description){} diff --git a/src/container/vincrementtablerow.h b/src/container/vincrementtablerow.h index 493967569..e7572befd 100644 --- a/src/container/vincrementtablerow.h +++ b/src/container/vincrementtablerow.h @@ -49,18 +49,18 @@ public: * @param kgrowth increment in growths * @param description description of increment */ - VIncrementTableRow(qint64 id, qreal base, qreal ksize, qreal kgrowth, + VIncrementTableRow(quint32 id, qreal base, qreal ksize, qreal kgrowth, QString description = QString()); /** * @brief getId return id of row * @return id */ - inline qint64 getId() const {return id;} + inline quint32 getId() const {return id;} /** * @brief setId set id of row * @param value id */ - inline void setId(const qint64 &value) {id = value;} + inline void setId(const quint32 &value) {id = value;} /** * @brief getBase return value in base size and growth * @return value @@ -105,7 +105,7 @@ private: /** * @brief id identificator */ - qint64 id; + quint32 id; /** * @brief base value in base size and growth */ diff --git a/src/dialogs/app/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp index fa920848c..2f97b8367 100644 --- a/src/dialogs/app/dialoghistory.cpp +++ b/src/dialogs/app/dialoghistory.cpp @@ -63,7 +63,7 @@ DialogHistory::~DialogHistory() void DialogHistory::DialogAccepted() { QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0); - qint64 id = qvariant_cast(item->data(Qt::UserRole)); + quint32 id = qvariant_cast(item->data(Qt::UserRole)); emit ShowHistoryTool(id, Qt::green, false); emit DialogClosed(QDialog::Accepted); } @@ -78,7 +78,7 @@ void DialogHistory::cellClicked(int row, int column) item = ui->tableWidget->item(row, 0); cursorRow = row; item->setIcon(QIcon("://icon/32x32/put_after.png")); - qint64 id = qvariant_cast(item->data(Qt::UserRole)); + quint32 id = qvariant_cast(item->data(Qt::UserRole)); disconnect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor); doc->setCursor(id); connect(doc, &VPattern::ChangedCursor, this, &DialogHistory::ChangedCursor); @@ -86,22 +86,22 @@ void DialogHistory::cellClicked(int row, int column) else { QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0); - qint64 id = qvariant_cast(item->data(Qt::UserRole)); + quint32 id = qvariant_cast(item->data(Qt::UserRole)); emit ShowHistoryTool(id, Qt::green, false); cursorToolRecordRow = row; item = ui->tableWidget->item(cursorToolRecordRow, 0); - id = qvariant_cast(item->data(Qt::UserRole)); + id = qvariant_cast(item->data(Qt::UserRole)); emit ShowHistoryTool(id, Qt::green, true); } } -void DialogHistory::ChangedCursor(qint64 id) +void DialogHistory::ChangedCursor(quint32 id) { for (qint32 i = 0; i< ui->tableWidget->rowCount(); ++i) { QTableWidgetItem *item = ui->tableWidget->item(i, 0); - qint64 rId = qvariant_cast(item->data(Qt::UserRole)); + quint32 rId = qvariant_cast(item->data(Qt::UserRole)); if (rId == id) { QTableWidgetItem *oldCursorItem = ui->tableWidget->item(cursorRow, 0); @@ -161,15 +161,15 @@ void DialogHistory::FillTable() QString DialogHistory::Record(const VToolRecord &tool) { QString record = QString(); - qint64 basePointId = 0; - qint64 secondPointId = 0; - qint64 firstPointId = 0; - qint64 thirdPointId = 0; - qint64 p1Line1 = 0; - qint64 p2Line1 = 0; - qint64 p1Line2 = 0; - qint64 p2Line2 = 0; - qint64 center = 0; + quint32 basePointId = 0; + quint32 secondPointId = 0; + quint32 firstPointId = 0; + quint32 thirdPointId = 0; + quint32 p1Line1 = 0; + quint32 p2Line1 = 0; + quint32 p1Line2 = 0; + quint32 p2Line2 = 0; + quint32 center = 0; QDomElement domElement; switch ( tool.getTypeTool() ) { @@ -186,7 +186,7 @@ QString DialogHistory::Record(const VToolRecord &tool) domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - basePointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrBasePoint, "0"); + basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); } QString basePointIdName = data->GeometricObject(basePointId)->name(); QString toolIdName = data->GeometricObject(tool.getId())->name(); @@ -198,8 +198,8 @@ QString DialogHistory::Record(const VToolRecord &tool) domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - firstPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); } QString firstPointIdName = data->GeometricObject(firstPointId)->name(); QString secondPointIdName = data->GeometricObject(secondPointId)->name(); @@ -211,8 +211,8 @@ QString DialogHistory::Record(const VToolRecord &tool) domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - basePointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); } QString basePointIdName = data->GeometricObject(basePointId)->name(); QString secondPointIdName = data->GeometricObject(secondPointId)->name(); @@ -231,8 +231,8 @@ QString DialogHistory::Record(const VToolRecord &tool) domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - basePointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); } QString basePointIdName = data->GeometricObject(basePointId)->name(); QString secondPointIdName = data->GeometricObject(secondPointId)->name(); @@ -245,9 +245,9 @@ QString DialogHistory::Record(const VToolRecord &tool) domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - firstPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); - thirdPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrThirdPoint, "0"); + firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); + thirdPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrThirdPoint, "0"); } QString firstPointIdName = data->GeometricObject(firstPointId)->name(); QString basePointIdName = data->GeometricObject(basePointId)->name(); @@ -262,10 +262,10 @@ QString DialogHistory::Record(const VToolRecord &tool) domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - p1Line1 = doc->GetParametrLongLong(domElement, VAbstractTool::AttrP1Line1, "0"); - p2Line1 = doc->GetParametrLongLong(domElement, VAbstractTool::AttrP2Line1, "0"); - p1Line2 = doc->GetParametrLongLong(domElement, VAbstractTool::AttrP1Line2, "0"); - p2Line2 = doc->GetParametrLongLong(domElement, VAbstractTool::AttrP2Line2, "0"); + p1Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0"); + p2Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0"); + p1Line2 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line2, "0"); + p2Line2 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line2, "0"); } QString p1Line1Name = data->GeometricObject(p1Line1)->name(); QString p2Line1Name = data->GeometricObject(p2Line1)->name(); @@ -314,9 +314,9 @@ QString DialogHistory::Record(const VToolRecord &tool) domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - center = doc->GetParametrLongLong(domElement, VAbstractTool::AttrCenter, "0"); - firstPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + center = doc->GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0"); + firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); } QString firstPointIdName = data->GeometricObject(firstPointId)->name(); QString centerName = data->GeometricObject(center)->name(); @@ -328,14 +328,14 @@ QString DialogHistory::Record(const VToolRecord &tool) } case Tool::Height: { - qint64 p1LineId = 0; - qint64 p2LineId = 0; + quint32 p1LineId = 0; + quint32 p2LineId = 0; domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - basePointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrBasePoint, "0"); - p1LineId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrP1Line, "0"); - p2LineId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrP2Line, "0"); + basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); + p1LineId = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0"); + p2LineId = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0"); } QString basePointIdName = data->GeometricObject(basePointId)->name(); QString p1LineIdName = data->GeometricObject(p1LineId)->name(); @@ -346,15 +346,15 @@ QString DialogHistory::Record(const VToolRecord &tool) } case Tool::Triangle: { - qint64 axisP1Id = 0; - qint64 axisP2Id = 0; + quint32 axisP1Id = 0; + quint32 axisP2Id = 0; domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - axisP1Id = doc->GetParametrLongLong(domElement, VAbstractTool::AttrAxisP1, "0"); - axisP2Id = doc->GetParametrLongLong(domElement, VAbstractTool::AttrAxisP2, "0"); - firstPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + axisP1Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0"); + axisP2Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0"); + firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); } QString axisP1IdName = data->GeometricObject(axisP1Id)->name(); QString axisP2IdName = data->GeometricObject(axisP2Id)->name(); @@ -369,8 +369,8 @@ QString DialogHistory::Record(const VToolRecord &tool) domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - firstPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); } QString firstPointIdName = data->GeometricObject(firstPointId)->name(); QString secondPointIdName = data->GeometricObject(secondPointId)->name(); @@ -381,11 +381,11 @@ QString DialogHistory::Record(const VToolRecord &tool) break; case Tool::CutArcTool: { - qint64 arcId = 0; + quint32 arcId = 0; domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - arcId = doc->GetParametrLongLong(domElement, VToolCutArc::AttrArc, "0"); + arcId = doc->GetParametrUInt(domElement, VToolCutArc::AttrArc, "0"); } const VArc *arc = data->GeometricObject(arcId); QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name(); @@ -395,11 +395,11 @@ QString DialogHistory::Record(const VToolRecord &tool) break; case Tool::CutSplineTool: { - qint64 splineId = 0; + quint32 splineId = 0; domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - splineId = doc->GetParametrLongLong(domElement, VToolCutSpline::AttrSpline, "0"); + splineId = doc->GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0"); } const VSpline *spl = data->GeometricObject(splineId); QString toolIdName = data->GeometricObject(tool.getId())->name(); @@ -410,11 +410,11 @@ QString DialogHistory::Record(const VToolRecord &tool) break; case Tool::CutSplinePathTool: { - qint64 splinePathId = 0; + quint32 splinePathId = 0; domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement()) { - splinePathId = doc->GetParametrLongLong(domElement, VToolCutSplinePath::AttrSplinePath, "0"); + splinePathId = doc->GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0"); } const VSplinePath *splPath = data->GeometricObject(splinePathId); QVector points = splPath->GetSplinePath(); @@ -469,7 +469,7 @@ void DialogHistory::ShowPoint() item->setSelected(true); cursorToolRecordRow = 0; item = ui->tableWidget->item(0, 0); - qint64 id = qvariant_cast(item->data(Qt::UserRole)); + quint32 id = qvariant_cast(item->data(Qt::UserRole)); emit ShowHistoryTool(id, Qt::green, true); } } @@ -477,7 +477,7 @@ void DialogHistory::ShowPoint() void DialogHistory::closeEvent(QCloseEvent *event) { QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0); - qint64 id = qvariant_cast(item->data(Qt::UserRole)); + quint32 id = qvariant_cast(item->data(Qt::UserRole)); emit ShowHistoryTool(id, Qt::green, false); DialogTool::closeEvent(event); } diff --git a/src/dialogs/app/dialoghistory.h b/src/dialogs/app/dialoghistory.h index 526f6f46f..3a6f797c7 100644 --- a/src/dialogs/app/dialoghistory.h +++ b/src/dialogs/app/dialoghistory.h @@ -67,7 +67,7 @@ public slots: * @brief ChangedCursor changed cursor of input. Cursor show after what record we will insert new object * @param id id of object */ - void ChangedCursor(qint64 id); + void ChangedCursor(quint32 id); /** * @brief UpdateHistory update history table */ @@ -79,7 +79,7 @@ signals: * @param color new color of tool * @param enable true enable selection, false disable selection */ - void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable); + void ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable); protected: /** * @brief closeEvent handle when windows is closing diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index 7bd2c87df..048fce127 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -110,7 +110,7 @@ void DialogIncrements::FillIncrementTable() { const QHash *incrementTable = data->DataIncrementTable(); QHashIterator i(*incrementTable); - QMap map; + QMap map; //Sorting QHash by id while (i.hasNext()) { @@ -120,7 +120,7 @@ void DialogIncrements::FillIncrementTable() } qint32 currentRow = -1; - QMapIterator iMap(map); + QMapIterator iMap(map); while (iMap.hasNext()) { iMap.next(); @@ -312,7 +312,7 @@ void DialogIncrements::clickedToolButtonAdd() num++; } while (data->IncrementTableContains(name)); - qint64 id = data->getNextId(); + quint32 id = data->getNextId(); qreal base = 0; qreal ksize = 0; qreal kgrowth = 0; @@ -367,7 +367,7 @@ void DialogIncrements::clickedToolButtonRemove() qint32 row = item->row(); QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0); data->RemoveIncrementTableRow(itemName->text()); - qint64 id = qvariant_cast(item->data(Qt::UserRole)); + quint32 id = qvariant_cast(item->data(Qt::UserRole)); QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { @@ -384,7 +384,7 @@ void DialogIncrements::clickedToolButtonRemove() emit haveLiteChange(); } -void DialogIncrements::AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize, qreal kgrowth, +void DialogIncrements::AddIncrementToFile(quint32 id, QString name, qreal base, qreal ksize, qreal kgrowth, QString description) { QDomNodeList list = doc->elementsByTagName("increments"); @@ -421,14 +421,14 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) { QTableWidgetItem *item = 0; QTableWidgetItem *itemName = 0; - qint64 id; + quint32 id; QDomElement domElement; this->row = row; switch (column) { case 0: item = ui->tableWidgetIncrement->item(row, 0); - id = qvariant_cast(item->data(Qt::UserRole)); + id = qvariant_cast(item->data(Qt::UserRole)); domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { @@ -442,7 +442,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) case 2: itemName = ui->tableWidgetIncrement->item(row, 0); item = ui->tableWidgetIncrement->item(row, column); - id = qvariant_cast(itemName->data(Qt::UserRole)); + id = qvariant_cast(itemName->data(Qt::UserRole)); domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { @@ -464,7 +464,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) case 3: itemName = ui->tableWidgetIncrement->item(row, 0); item = ui->tableWidgetIncrement->item(row, column); - id = qvariant_cast(itemName->data(Qt::UserRole)); + id = qvariant_cast(itemName->data(Qt::UserRole)); domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { @@ -477,7 +477,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) case 4: itemName = ui->tableWidgetIncrement->item(row, 0); item = ui->tableWidgetIncrement->item(row, column); - id = qvariant_cast(itemName->data(Qt::UserRole)); + id = qvariant_cast(itemName->data(Qt::UserRole)); domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { @@ -490,7 +490,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) case 5: itemName = ui->tableWidgetIncrement->item(row, 0); item = ui->tableWidgetIncrement->item(row, column); - id = qvariant_cast(itemName->data(Qt::UserRole)); + id = qvariant_cast(itemName->data(Qt::UserRole)); domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { diff --git a/src/dialogs/app/dialogincrements.h b/src/dialogs/app/dialogincrements.h index 85e13eba7..7ed6977b3 100644 --- a/src/dialogs/app/dialogincrements.h +++ b/src/dialogs/app/dialogincrements.h @@ -133,7 +133,7 @@ private: * @param kgrowth increment in growths * @param description description of increment */ - void AddIncrementToFile(qint64 id, QString name, qreal base, qreal ksize, qreal kgrowth, + void AddIncrementToFile(quint32 id, QString name, qreal base, qreal ksize, qreal kgrowth, QString description); }; diff --git a/src/dialogs/tools/dialogalongline.cpp b/src/dialogs/tools/dialogalongline.cpp index f7d1f21ee..26e72d9e9 100644 --- a/src/dialogs/tools/dialogalongline.cpp +++ b/src/dialogs/tools/dialogalongline.cpp @@ -81,7 +81,7 @@ DialogAlongLine::~DialogAlongLine() delete ui; } -void DialogAlongLine::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogAlongLine::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { @@ -124,12 +124,12 @@ void DialogAlongLine::DialogAccepted() emit DialogClosed(QDialog::Accepted); } -void DialogAlongLine::setSecondPointId(const qint64 &value, const qint64 &id) +void DialogAlongLine::setSecondPointId(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } -void DialogAlongLine::setFirstPointId(const qint64 &value, const qint64 &id) +void DialogAlongLine::setFirstPointId(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); } diff --git a/src/dialogs/tools/dialogalongline.h b/src/dialogs/tools/dialogalongline.h index 33acbc715..33dceade7 100644 --- a/src/dialogs/tools/dialogalongline.h +++ b/src/dialogs/tools/dialogalongline.h @@ -84,31 +84,31 @@ public: * @brief getFirstPointId return id first point of line * @return id */ - inline qint64 getFirstPointId() const {return firstPointId;} + inline quint32 getFirstPointId() const {return firstPointId;} /** * @brief setFirstPointId set id first point of line * @param value id * @param id id of current point */ - void setFirstPointId(const qint64 &value, const qint64 &id); + void setFirstPointId(const quint32 &value, const quint32 &id); /** * @brief getSecondPointId return id second point of line * @return id */ - inline qint64 getSecondPointId() const {return secondPointId;} + inline quint32 getSecondPointId() const {return secondPointId;} /** * @brief setSecondPointId set id second point of line * @param value id * @param id id of current point */ - void setSecondPointId(const qint64 &value, const qint64 &id); + void setSecondPointId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -138,11 +138,11 @@ private: /** * @brief firstPointId id first point of line */ - qint64 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id second point of line */ - qint64 secondPointId; + quint32 secondPointId; }; #endif // DIALOGALONGLINE_H diff --git a/src/dialogs/tools/dialogarc.cpp b/src/dialogs/tools/dialogarc.cpp index 5056dc055..de4898881 100644 --- a/src/dialogs/tools/dialogarc.cpp +++ b/src/dialogs/tools/dialogarc.cpp @@ -94,7 +94,7 @@ DialogArc::~DialogArc() delete ui; } -void DialogArc::SetCenter(const qint64 &value) +void DialogArc::SetCenter(const quint32 &value) { center = value; ChangeCurrentData(ui->comboBoxBasePoint, center); @@ -118,7 +118,7 @@ void DialogArc::SetRadius(const QString &value) ui->lineEditRadius->setText(radius); } -void DialogArc::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogArc::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { diff --git a/src/dialogs/tools/dialogarc.h b/src/dialogs/tools/dialogarc.h index d472ad928..f712ffc19 100644 --- a/src/dialogs/tools/dialogarc.h +++ b/src/dialogs/tools/dialogarc.h @@ -54,12 +54,12 @@ public: * @brief GetCenter return id of center point * @return id id */ - inline qint64 GetCenter() const {return center;} + inline quint32 GetCenter() const {return center;} /** * @brief SetCenter set id of center point * @param value id */ - void SetCenter(const qint64 &value); + void SetCenter(const quint32 &value); /** * @brief GetRadius return formula of radius * @return formula @@ -96,7 +96,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -172,7 +172,7 @@ private: /** * @brief center id of center point */ - qint64 center; + quint32 center; /** * @brief radius formula of radius */ diff --git a/src/dialogs/tools/dialogbisector.cpp b/src/dialogs/tools/dialogbisector.cpp index 50500f263..f0a4e1045 100644 --- a/src/dialogs/tools/dialogbisector.cpp +++ b/src/dialogs/tools/dialogbisector.cpp @@ -82,7 +82,7 @@ DialogBisector::~DialogBisector() delete ui; } -void DialogBisector::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogBisector::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { @@ -144,17 +144,17 @@ void DialogBisector::setFormula(const QString &value) ui->lineEditFormula->setText(formula); } -void DialogBisector::setFirstPointId(const qint64 &value, const qint64 &id) +void DialogBisector::setFirstPointId(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); } -void DialogBisector::setSecondPointId(const qint64 &value, const qint64 &id) +void DialogBisector::setSecondPointId(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } -void DialogBisector::setThirdPointId(const qint64 &value, const qint64 &id) +void DialogBisector::setThirdPointId(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxThirdPoint, thirdPointId, value, id); } diff --git a/src/dialogs/tools/dialogbisector.h b/src/dialogs/tools/dialogbisector.h index ec4168754..f93466e1e 100644 --- a/src/dialogs/tools/dialogbisector.h +++ b/src/dialogs/tools/dialogbisector.h @@ -84,42 +84,42 @@ public: * @brief getFirstPointId return id of first point * @return id */ - inline qint64 getFirstPointId() const {return firstPointId;} + inline quint32 getFirstPointId() const {return firstPointId;} /** * @brief setFirstPointId set id of first point * @param value id * @param id don't show this id in list */ - void setFirstPointId(const qint64 &value, const qint64 &id); + void setFirstPointId(const quint32 &value, const quint32 &id); /** * @brief getSecondPointId return id of second point * @return id */ - inline qint64 getSecondPointId() const {return secondPointId;} + inline quint32 getSecondPointId() const {return secondPointId;} /** * @brief setSecondPointId set id of second point * @param value id * @param id don't show this id in list */ - void setSecondPointId(const qint64 &value, const qint64 &id); + void setSecondPointId(const quint32 &value, const quint32 &id); /** * @brief getThirdPointId return id of third point * @return id */ - inline qint64 getThirdPointId() const {return thirdPointId;} + inline quint32 getThirdPointId() const {return thirdPointId;} /** * @brief setThirdPointId set id of third point * @param value id * @param id don't show this id in list */ - void setThirdPointId(const qint64 &value, const qint64 &id); + void setThirdPointId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -149,15 +149,15 @@ private: /** * @brief firstPointId id of first point */ - qint64 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id of second point */ - qint64 secondPointId; + quint32 secondPointId; /** * @brief thirdPointId id of third point */ - qint64 thirdPointId; + quint32 thirdPointId; }; #endif // DIALOGBISECTOR_H diff --git a/src/dialogs/tools/dialogcutarc.cpp b/src/dialogs/tools/dialogcutarc.cpp index 71d9c919a..af9c00b46 100644 --- a/src/dialogs/tools/dialogcutarc.cpp +++ b/src/dialogs/tools/dialogcutarc.cpp @@ -76,7 +76,7 @@ DialogCutArc::~DialogCutArc() delete ui; } -void DialogCutArc::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogCutArc::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Arc) { @@ -95,7 +95,7 @@ void DialogCutArc::DialogAccepted() emit DialogClosed(QDialog::Accepted); } -void DialogCutArc::setArcId(const qint64 &value, const qint64 &id) +void DialogCutArc::setArcId(const quint32 &value, const quint32 &id) { setCurrentArcId(ui->comboBoxArc, arcId, value, id, ComboMode::CutArc); } diff --git a/src/dialogs/tools/dialogcutarc.h b/src/dialogs/tools/dialogcutarc.h index 0baf2dcbc..4e296c416 100644 --- a/src/dialogs/tools/dialogcutarc.h +++ b/src/dialogs/tools/dialogcutarc.h @@ -74,20 +74,20 @@ public: * @brief getArcId return id of arc * @return id */ - qint64 getArcId() const {return arcId;} + quint32 getArcId() const {return arcId;} /** * @brief setArcId set id of arc * @param value id * @param id don't show this id in list */ - void setArcId(const qint64 &value, const qint64 &id); + void setArcId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -109,7 +109,7 @@ private: /** * @brief arcId keep id of arc */ - qint64 arcId; + quint32 arcId; }; #endif // DIALOGCUTARC_H diff --git a/src/dialogs/tools/dialogcutspline.cpp b/src/dialogs/tools/dialogcutspline.cpp index 988faea7e..33dc8b931 100644 --- a/src/dialogs/tools/dialogcutspline.cpp +++ b/src/dialogs/tools/dialogcutspline.cpp @@ -88,12 +88,12 @@ void DialogCutSpline::setFormula(const QString &value) ui->lineEditFormula->setText(formula); } -void DialogCutSpline::setSplineId(const qint64 &value, const qint64 &id) +void DialogCutSpline::setSplineId(const quint32 &value, const quint32 &id) { setCurrentSplineId(ui->comboBoxSpline, splineId, value, id, ComboMode::CutSpline); } -void DialogCutSpline::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogCutSpline::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Spline) { diff --git a/src/dialogs/tools/dialogcutspline.h b/src/dialogs/tools/dialogcutspline.h index 17d6f6bae..c429eeb73 100644 --- a/src/dialogs/tools/dialogcutspline.h +++ b/src/dialogs/tools/dialogcutspline.h @@ -74,20 +74,20 @@ public: * @brief getSplineId return id base point of line * @return id */ - inline qint64 getSplineId() const {return splineId;} + inline quint32 getSplineId() const {return splineId;} /** * @brief setSplineId set id spline * @param value id * @param id don't show this id in list */ - void setSplineId(const qint64 &value, const qint64 &id); + void setSplineId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -109,7 +109,7 @@ private: /** * @brief splineId keep id of spline */ - qint64 splineId; + quint32 splineId; }; #endif // DIALOGCUTSPLINE_H diff --git a/src/dialogs/tools/dialogcutsplinepath.cpp b/src/dialogs/tools/dialogcutsplinepath.cpp index 561b47f5c..12f92a2bc 100644 --- a/src/dialogs/tools/dialogcutsplinepath.cpp +++ b/src/dialogs/tools/dialogcutsplinepath.cpp @@ -89,12 +89,12 @@ void DialogCutSplinePath::setFormula(const QString &value) ui->lineEditFormula->setText(formula); } -void DialogCutSplinePath::setSplinePathId(const qint64 &value, const qint64 &id) +void DialogCutSplinePath::setSplinePathId(const quint32 &value, const quint32 &id) { setCurrentSplinePathId(ui->comboBoxSplinePath, splinePathId, value, id, ComboMode::CutSpline); } -void DialogCutSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogCutSplinePath::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::SplinePath) { diff --git a/src/dialogs/tools/dialogcutsplinepath.h b/src/dialogs/tools/dialogcutsplinepath.h index b4dadc0b1..6c19e15bb 100644 --- a/src/dialogs/tools/dialogcutsplinepath.h +++ b/src/dialogs/tools/dialogcutsplinepath.h @@ -74,20 +74,20 @@ public: * @brief getSplineId return id base point of line * @return id */ - inline qint64 getSplinePathId() const {return splinePathId;} + inline quint32 getSplinePathId() const {return splinePathId;} /** * @brief setSplineId set id spline * @param value id * @param id don't show this id in list */ - void setSplinePathId(const qint64 &value, const qint64 &id); + void setSplinePathId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -109,7 +109,7 @@ private: /** * @brief splinePathId keep id of splinePath */ - qint64 splinePathId; + quint32 splinePathId; }; #endif // DIALOGCUTSPLINEPATH_H diff --git a/src/dialogs/tools/dialogdetail.cpp b/src/dialogs/tools/dialogdetail.cpp index a465d7764..57b1ec48a 100644 --- a/src/dialogs/tools/dialogdetail.cpp +++ b/src/dialogs/tools/dialogdetail.cpp @@ -60,7 +60,7 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent) connect(ui.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem); } -void DialogDetail::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogDetail::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type != Scene::Line && type != Scene::Detail) { @@ -103,7 +103,7 @@ void DialogDetail::DialogAccepted() emit DialogClosed(QDialog::Accepted); } -void DialogDetail::NewItem(qint64 id, const Tool::Tools &typeTool, const NodeDetail::NodeDetails &typeNode, qreal mx, +void DialogDetail::NewItem(quint32 id, const Tool::Tools &typeTool, const NodeDetail::NodeDetails &typeNode, qreal mx, qreal my) { QString name; diff --git a/src/dialogs/tools/dialogdetail.h b/src/dialogs/tools/dialogdetail.h index c02c41940..0ddd2a653 100644 --- a/src/dialogs/tools/dialogdetail.h +++ b/src/dialogs/tools/dialogdetail.h @@ -61,7 +61,7 @@ public slots: * @param id id of objects (points, arcs, splines, spline paths) * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -121,7 +121,7 @@ private: * @param mx offset respect to x * @param my offset respect to y */ - void NewItem(qint64 id, const Tool::Tools &typeTool, const NodeDetail::NodeDetails &typeNode, + void NewItem(quint32 id, const Tool::Tools &typeTool, const NodeDetail::NodeDetails &typeNode, qreal mx = 0, qreal my = 0); }; diff --git a/src/dialogs/tools/dialogendline.cpp b/src/dialogs/tools/dialogendline.cpp index ba0834eb4..359083d19 100644 --- a/src/dialogs/tools/dialogendline.cpp +++ b/src/dialogs/tools/dialogendline.cpp @@ -93,7 +93,7 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged); } -void DialogEndLine::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogEndLine::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { @@ -128,7 +128,7 @@ void DialogEndLine::setAngle(const qreal &value) ui->doubleSpinBoxAngle->setValue(angle); } -void DialogEndLine::setBasePointId(const qint64 &value, const qint64 &id) +void DialogEndLine::setBasePointId(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id); } diff --git a/src/dialogs/tools/dialogendline.h b/src/dialogs/tools/dialogendline.h index 34cadbaf5..4426170d8 100644 --- a/src/dialogs/tools/dialogendline.h +++ b/src/dialogs/tools/dialogendline.h @@ -94,20 +94,20 @@ public: * @brief getBasePointId return id base point of line * @return id */ - inline qint64 getBasePointId() const {return basePointId;} + inline quint32 getBasePointId() const {return basePointId;} /** * @brief setBasePointId set id base point of line * @param value id * @param id don't show this id in list */ - void setBasePointId(const qint64 &value, const qint64 &id); + void setBasePointId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -137,7 +137,7 @@ private: /** * @brief basePointId id base point of line */ - qint64 basePointId; + quint32 basePointId; }; #endif // DIALOGENDLINE_H diff --git a/src/dialogs/tools/dialogheight.cpp b/src/dialogs/tools/dialogheight.cpp index 184cf725d..8c5339aaf 100644 --- a/src/dialogs/tools/dialogheight.cpp +++ b/src/dialogs/tools/dialogheight.cpp @@ -68,25 +68,25 @@ void DialogHeight::setTypeLine(const QString &value) SetupTypeLine(ui->comboBoxLineType, value); } -void DialogHeight::setBasePointId(const qint64 &value, const qint64 &id) +void DialogHeight::setBasePointId(const quint32 &value, const quint32 &id) { basePointId = value; setCurrentPointId(ui->comboBoxBasePoint, basePointId, value, id); } -void DialogHeight::setP1LineId(const qint64 &value, const qint64 &id) +void DialogHeight::setP1LineId(const quint32 &value, const quint32 &id) { p1LineId = value; setCurrentPointId(ui->comboBoxP1Line, p1LineId, value, id); } -void DialogHeight::setP2LineId(const qint64 &value, const qint64 &id) +void DialogHeight::setP2LineId(const quint32 &value, const quint32 &id) { p2LineId = value; setCurrentPointId(ui->comboBoxP2Line, p2LineId, value, id); } -void DialogHeight::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogHeight::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { diff --git a/src/dialogs/tools/dialogheight.h b/src/dialogs/tools/dialogheight.h index 4074ba80e..f767c6205 100644 --- a/src/dialogs/tools/dialogheight.h +++ b/src/dialogs/tools/dialogheight.h @@ -74,42 +74,42 @@ public: * @brief getBasePointId return id base point of height * @return id */ - inline qint64 getBasePointId() const {return basePointId;} + inline quint32 getBasePointId() const {return basePointId;} /** * @brief setBasePointId set id base point of height * @param value id * @param id don't show this id in list */ - void setBasePointId(const qint64 &value, const qint64 &id); + void setBasePointId(const quint32 &value, const quint32 &id); /** * @brief getP1LineId return id first point of line * @return id id */ - inline qint64 getP1LineId() const {return p1LineId;} + inline quint32 getP1LineId() const {return p1LineId;} /** * @brief setP1LineId set id first point of line * @param value id * @param id don't show this id in list */ - void setP1LineId(const qint64 &value, const qint64 &id); + void setP1LineId(const quint32 &value, const quint32 &id); /** * @brief getP2LineId return id second point of line * @return id */ - inline qint64 getP2LineId() const{return p2LineId;} + inline quint32 getP2LineId() const{return p2LineId;} /** * @brief setP2LineId set id second point of line * @param value id * @param id don't show this id in list */ - void setP2LineId(const qint64 &value, const qint64 &id); + void setP2LineId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -135,15 +135,15 @@ private: /** * @brief basePointId id base point of height */ - qint64 basePointId; + quint32 basePointId; /** * @brief p1LineId id first point of line */ - qint64 p1LineId; + quint32 p1LineId; /** * @brief p2LineId id second point of line */ - qint64 p2LineId; + quint32 p2LineId; }; #endif // DIALOGHEIGHT_H diff --git a/src/dialogs/tools/dialogline.cpp b/src/dialogs/tools/dialogline.cpp index ccbb31eb8..4433856c3 100644 --- a/src/dialogs/tools/dialogline.cpp +++ b/src/dialogs/tools/dialogline.cpp @@ -52,7 +52,7 @@ DialogLine::~DialogLine() delete ui; } -void DialogLine::setSecondPoint(const qint64 &value) +void DialogLine::setSecondPoint(const quint32 &value) { secondPoint = value; const VPointF *point = data->GeometricObject(value); @@ -69,7 +69,7 @@ void DialogLine::setTypeLine(const QString &value) SetupTypeLine(ui->comboBoxLineType, value); } -void DialogLine::setFirstPoint(const qint64 &value) +void DialogLine::setFirstPoint(const quint32 &value) { firstPoint = value; const VPointF *point = data->GeometricObject(value); @@ -84,14 +84,14 @@ void DialogLine::setFirstPoint(const qint64 &value) void DialogLine::DialogAccepted() { qint32 index = ui->comboBoxFirstPoint->currentIndex(); - firstPoint = qvariant_cast(ui->comboBoxFirstPoint->itemData(index)); + firstPoint = qvariant_cast(ui->comboBoxFirstPoint->itemData(index)); index = ui->comboBoxSecondPoint->currentIndex(); - secondPoint = qvariant_cast(ui->comboBoxSecondPoint->itemData(index)); + secondPoint = qvariant_cast(ui->comboBoxSecondPoint->itemData(index)); typeLine = GetTypeLine(ui->comboBoxLineType); DialogClosed(QDialog::Accepted); } -void DialogLine::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogLine::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { diff --git a/src/dialogs/tools/dialogline.h b/src/dialogs/tools/dialogline.h index 1ec7d59a3..f5b400379 100644 --- a/src/dialogs/tools/dialogline.h +++ b/src/dialogs/tools/dialogline.h @@ -54,22 +54,22 @@ public: * @brief getFirstPoint return id first point * @return id */ - inline qint64 getFirstPoint() const {return firstPoint;} + inline quint32 getFirstPoint() const {return firstPoint;} /** * @brief setFirstPoint set id first point * @param value id */ - void setFirstPoint(const qint64 &value); + void setFirstPoint(const quint32 &value); /** * @brief getSecondPoint return id second point * @return id */ - inline qint64 getSecondPoint() const {return secondPoint;} + inline quint32 getSecondPoint() const {return secondPoint;} /** * @brief setSecondPoint set id second point * @param value id */ - void setSecondPoint(const qint64 &value); + void setSecondPoint(const quint32 &value); /** * @brief getTypeLine return type of line * @return type @@ -86,7 +86,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -104,11 +104,11 @@ private: /** * @brief firstPoint id first point */ - qint64 firstPoint; + quint32 firstPoint; /** * @brief secondPoint id second point */ - qint64 secondPoint; + quint32 secondPoint; /** * @brief typeLine type of line */ diff --git a/src/dialogs/tools/dialoglineintersect.cpp b/src/dialogs/tools/dialoglineintersect.cpp index 4950225f2..31a04adbc 100644 --- a/src/dialogs/tools/dialoglineintersect.cpp +++ b/src/dialogs/tools/dialoglineintersect.cpp @@ -57,7 +57,7 @@ DialogLineIntersect::~DialogLineIntersect() delete ui; } -void DialogLineIntersect::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogLineIntersect::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { @@ -142,28 +142,28 @@ void DialogLineIntersect::DialogAccepted() void DialogLineIntersect::P1Line1Changed( int index) { - p1Line1 = qvariant_cast(ui->comboBoxP1Line1->itemData(index)); + p1Line1 = qvariant_cast(ui->comboBoxP1Line1->itemData(index)); flagPoint = CheckIntersecion(); CheckState(); } void DialogLineIntersect::P2Line1Changed(int index) { - p2Line1 = qvariant_cast(ui->comboBoxP2Line1->itemData(index)); + p2Line1 = qvariant_cast(ui->comboBoxP2Line1->itemData(index)); flagPoint = CheckIntersecion(); CheckState(); } void DialogLineIntersect::P1Line2Changed(int index) { - p1Line2 = qvariant_cast(ui->comboBoxP1Line2->itemData(index)); + p1Line2 = qvariant_cast(ui->comboBoxP1Line2->itemData(index)); flagPoint = CheckIntersecion(); CheckState(); } void DialogLineIntersect::P2Line2Changed(int index) { - p2Line2 = qvariant_cast(ui->comboBoxP2Line2->itemData(index)); + p2Line2 = qvariant_cast(ui->comboBoxP2Line2->itemData(index)); flagPoint = CheckIntersecion(); CheckState(); } @@ -195,25 +195,25 @@ bool DialogLineIntersect::CheckIntersecion() } } -void DialogLineIntersect::setP2Line2(const qint64 &value) +void DialogLineIntersect::setP2Line2(const quint32 &value) { p2Line2 = value; ChangeCurrentData(ui->comboBoxP2Line2, value); } -void DialogLineIntersect::setP1Line2(const qint64 &value) +void DialogLineIntersect::setP1Line2(const quint32 &value) { p1Line2 = value; ChangeCurrentData(ui->comboBoxP1Line2, value); } -void DialogLineIntersect::setP2Line1(const qint64 &value) +void DialogLineIntersect::setP2Line1(const quint32 &value) { p2Line1 = value; ChangeCurrentData(ui->comboBoxP2Line1, value); } -void DialogLineIntersect::setP1Line1(const qint64 &value) +void DialogLineIntersect::setP1Line1(const quint32 &value) { p1Line1 = value; ChangeCurrentData(ui->comboBoxP1Line1, value); diff --git a/src/dialogs/tools/dialoglineintersect.h b/src/dialogs/tools/dialoglineintersect.h index 49871348c..bfc0c0888 100644 --- a/src/dialogs/tools/dialoglineintersect.h +++ b/src/dialogs/tools/dialoglineintersect.h @@ -54,42 +54,42 @@ public: * @brief getP1Line1 return id first point of first line * @return id */ - inline qint64 getP1Line1() const {return p1Line1;} + inline quint32 getP1Line1() const {return p1Line1;} /** * @brief setP1Line1 set id first point of first line * @param value id */ - void setP1Line1(const qint64 &value); + void setP1Line1(const quint32 &value); /** * @brief getP2Line1 return id second point of first line * @return id */ - inline qint64 getP2Line1() const {return p2Line1;} + inline quint32 getP2Line1() const {return p2Line1;} /** * @brief setP2Line1 set id second point of first line * @param value id */ - void setP2Line1(const qint64 &value); + void setP2Line1(const quint32 &value); /** * @brief getP1Line2 return id first point of second line * @return id */ - inline qint64 getP1Line2() const {return p1Line2;} + inline quint32 getP1Line2() const {return p1Line2;} /** * @brief setP1Line2 set id first point of second line * @param value id */ - void setP1Line2(const qint64 &value); + void setP1Line2(const quint32 &value); /** * @brief getP2Line2 return id second point of second line * @return id */ - inline qint64 getP2Line2() const {return p2Line2;} + inline quint32 getP2Line2() const {return p2Line2;} /** * @brief setP2Line2 set id second point of second line * @param value id */ - void setP2Line2(const qint64 &value); + void setP2Line2(const quint32 &value); /** * @brief getPointName return name of point * @return @@ -106,7 +106,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -148,19 +148,19 @@ private: /** * @brief p1Line1 id first point of first line */ - qint64 p1Line1; + quint32 p1Line1; /** * @brief p2Line1 id second point of first line */ - qint64 p2Line1; + quint32 p2Line1; /** * @brief p1Line2 id first point of second line */ - qint64 p1Line2; + quint32 p1Line2; /** * @brief p2Line2 id second point of second line */ - qint64 p2Line2; + quint32 p2Line2; /** * @brief flagPoint keep state of point */ diff --git a/src/dialogs/tools/dialognormal.cpp b/src/dialogs/tools/dialognormal.cpp index 70e9c1aed..99ea9f05f 100644 --- a/src/dialogs/tools/dialognormal.cpp +++ b/src/dialogs/tools/dialognormal.cpp @@ -98,7 +98,7 @@ DialogNormal::~DialogNormal() delete ui; } -void DialogNormal::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogNormal::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { @@ -142,12 +142,12 @@ void DialogNormal::DialogAccepted() emit DialogClosed(QDialog::Accepted); } -void DialogNormal::setSecondPointId(const qint64 &value, const qint64 &id) +void DialogNormal::setSecondPointId(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } -void DialogNormal::setFirstPointId(const qint64 &value, const qint64 &id) +void DialogNormal::setFirstPointId(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); } diff --git a/src/dialogs/tools/dialognormal.h b/src/dialogs/tools/dialognormal.h index 556a8b9a2..5bf0459b5 100644 --- a/src/dialogs/tools/dialognormal.h +++ b/src/dialogs/tools/dialognormal.h @@ -94,31 +94,31 @@ public: * @brief getFirstPointId return id of first point * @return id */ - inline qint64 getFirstPointId() const {return firstPointId;} + inline quint32 getFirstPointId() const {return firstPointId;} /** * @brief setFirstPointId set id of first point * @param value id * @param id don't show this id in list */ - void setFirstPointId(const qint64 &value, const qint64 &id); + void setFirstPointId(const quint32 &value, const quint32 &id); /** * @brief getSecondPointId return id of second point * @return id */ - inline qint64 getSecondPointId() const {return secondPointId;} + inline quint32 getSecondPointId() const {return secondPointId;} /** * @brief setSecondPointId set id of second point * @param value id * @param id don't show this id in list */ - void setSecondPointId(const qint64 &value, const qint64 &id); + void setSecondPointId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -152,11 +152,11 @@ private: /** * @brief firstPointId id first point of line */ - qint64 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id second point of line */ - qint64 secondPointId; + quint32 secondPointId; }; #endif // DIALOGNORMAL_H diff --git a/src/dialogs/tools/dialogpointofcontact.cpp b/src/dialogs/tools/dialogpointofcontact.cpp index 2f8374a2a..b66dfe4fd 100644 --- a/src/dialogs/tools/dialogpointofcontact.cpp +++ b/src/dialogs/tools/dialogpointofcontact.cpp @@ -75,7 +75,7 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare connect(ui.lineEditFormula, &QLineEdit::textChanged, this, &DialogPointOfContact::FormulaChanged); } -void DialogPointOfContact::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogPointOfContact::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { @@ -129,17 +129,17 @@ void DialogPointOfContact::DialogAccepted() emit DialogClosed(QDialog::Accepted); } -void DialogPointOfContact::setSecondPoint(const qint64 &value, const qint64 &id) +void DialogPointOfContact::setSecondPoint(const quint32 &value, const quint32 &id) { setCurrentPointId(ui.comboBoxSecondPoint, secondPoint, value, id); } -void DialogPointOfContact::setFirstPoint(const qint64 &value, const qint64 &id) +void DialogPointOfContact::setFirstPoint(const quint32 &value, const quint32 &id) { setCurrentPointId(ui.comboBoxFirstPoint, firstPoint, value, id); } -void DialogPointOfContact::setCenter(const qint64 &value, const qint64 &id) +void DialogPointOfContact::setCenter(const quint32 &value, const quint32 &id) { setCurrentPointId(ui.comboBoxCenter, center, value, id); center = value; diff --git a/src/dialogs/tools/dialogpointofcontact.h b/src/dialogs/tools/dialogpointofcontact.h index d5a610c30..75a2d6a13 100644 --- a/src/dialogs/tools/dialogpointofcontact.h +++ b/src/dialogs/tools/dialogpointofcontact.h @@ -69,42 +69,42 @@ public: * @brief GetCenter return id of center point * @return id */ - inline qint64 getCenter() const {return center;} + inline quint32 getCenter() const {return center;} /** * @brief SetCenter set id of center point * @param value id * @param id don't show this id in list. */ - void setCenter(const qint64 &value, const qint64 &id); + void setCenter(const quint32 &value, const quint32 &id); /** * @brief getFirstPoint return id first point * @return id */ - inline qint64 getFirstPoint() const {return firstPoint;} + inline quint32 getFirstPoint() const {return firstPoint;} /** * @brief setFirstPoint set id first point * @param value id * @param id don't show this id in list. */ - void setFirstPoint(const qint64 &value, const qint64 &id); + void setFirstPoint(const quint32 &value, const quint32 &id); /** * @brief getSecondPoint return id second point * @return id */ - inline qint64 getSecondPoint() const {return secondPoint;} + inline quint32 getSecondPoint() const {return secondPoint;} /** * @brief setSecondPoint set id second point * @param value id * @param id don't show this id in list. */ - void setSecondPoint(const qint64 &value, const qint64 &id); + void setSecondPoint(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -130,15 +130,15 @@ private: /** * @brief center id center point of arc */ - qint64 center; + quint32 center; /** * @brief firstPoint id first point of line */ - qint64 firstPoint; + quint32 firstPoint; /** * @brief secondPoint id second point of line */ - qint64 secondPoint; + quint32 secondPoint; }; #endif // DIALOGPOINTOFCONTACT_H diff --git a/src/dialogs/tools/dialogpointofintersection.cpp b/src/dialogs/tools/dialogpointofintersection.cpp index 0ec306a6e..b7faaa0a2 100644 --- a/src/dialogs/tools/dialogpointofintersection.cpp +++ b/src/dialogs/tools/dialogpointofintersection.cpp @@ -55,13 +55,13 @@ DialogPointOfIntersection::~DialogPointOfIntersection() delete ui; } -void DialogPointOfIntersection::setSecondPointId(const qint64 &value, const qint64 &id) +void DialogPointOfIntersection::setSecondPointId(const quint32 &value, const quint32 &id) { secondPointId = value; setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } -void DialogPointOfIntersection::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogPointOfIntersection::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { @@ -102,7 +102,7 @@ void DialogPointOfIntersection::DialogAccepted() emit DialogClosed(QDialog::Accepted); } -void DialogPointOfIntersection::setFirstPointId(const qint64 &value, const qint64 &id) +void DialogPointOfIntersection::setFirstPointId(const quint32 &value, const quint32 &id) { firstPointId = value; setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); diff --git a/src/dialogs/tools/dialogpointofintersection.h b/src/dialogs/tools/dialogpointofintersection.h index 4a184a544..6798bd3ca 100644 --- a/src/dialogs/tools/dialogpointofintersection.h +++ b/src/dialogs/tools/dialogpointofintersection.h @@ -64,31 +64,31 @@ public: * @brief getFirstPointId return id of first point * @return id */ - inline qint64 getFirstPointId() const {return firstPointId;} + inline quint32 getFirstPointId() const {return firstPointId;} /** * @brief setFirstPointId set id of first point * @param value id * @param id don't show this id in list. */ - void setFirstPointId(const qint64 &value, const qint64 &id); + void setFirstPointId(const quint32 &value, const quint32 &id); /** * @brief getSecondPointId return id of second point * @return id */ - inline qint64 getSecondPointId() const {return secondPointId;} + inline quint32 getSecondPointId() const {return secondPointId;} /** * @brief setSecondPointId set id of second point * @param value id * @param id don't show this id in list. */ - void setSecondPointId(const qint64 &value, const qint64 &id); + void setSecondPointId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -110,11 +110,11 @@ private: /** * @brief firstPointId id first point of line */ - qint64 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id second point of line */ - qint64 secondPointId; + quint32 secondPointId; }; #endif // DIALOGPOINTOFINTERSECTION_H diff --git a/src/dialogs/tools/dialogshoulderpoint.cpp b/src/dialogs/tools/dialogshoulderpoint.cpp index ddf25d596..4a0500ba6 100644 --- a/src/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/dialogs/tools/dialogshoulderpoint.cpp @@ -83,7 +83,7 @@ DialogShoulderPoint::~DialogShoulderPoint() delete ui; } -void DialogShoulderPoint::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogShoulderPoint::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { @@ -138,17 +138,17 @@ void DialogShoulderPoint::DialogAccepted() emit DialogClosed(QDialog::Accepted); } -void DialogShoulderPoint::setPShoulder(const qint64 &value, const qint64 &id) +void DialogShoulderPoint::setPShoulder(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxPShoulder, pShoulder, value, id); } -void DialogShoulderPoint::setP2Line(const qint64 &value, const qint64 &id) +void DialogShoulderPoint::setP2Line(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxP2Line, p2Line, value, id); } -void DialogShoulderPoint::setP1Line(const qint64 &value, const qint64 &id) +void DialogShoulderPoint::setP1Line(const quint32 &value, const quint32 &id) { setCurrentPointId(ui->comboBoxP1Line, p1Line, value, id); } diff --git a/src/dialogs/tools/dialogshoulderpoint.h b/src/dialogs/tools/dialogshoulderpoint.h index 790aba904..c456ebc68 100644 --- a/src/dialogs/tools/dialogshoulderpoint.h +++ b/src/dialogs/tools/dialogshoulderpoint.h @@ -84,42 +84,42 @@ public: * @brief getP1Line return id first point of line * @return id */ - inline qint64 getP1Line() const {return p1Line;} + inline quint32 getP1Line() const {return p1Line;} /** * @brief setP1Line set id first point of line * @param value id * @param id don't show this id in list */ - void setP1Line(const qint64 &value, const qint64 &id); + void setP1Line(const quint32 &value, const quint32 &id); /** * @brief getP2Line return id second point of line * @return id */ - inline qint64 getP2Line() const {return p2Line;} + inline quint32 getP2Line() const {return p2Line;} /** * @brief setP2Line set id second point of line * @param value id * @param id don't show this id in list */ - void setP2Line(const qint64 &value, const qint64 &id); + void setP2Line(const quint32 &value, const quint32 &id); /** * @brief getPShoulder return id shoulder point * @return id */ - inline qint64 getPShoulder() const {return pShoulder;} + inline quint32 getPShoulder() const {return pShoulder;} /** * @brief setPShoulder set id shoulder point * @param value id * @param id don't show this id in list */ - void setPShoulder(const qint64 &value, const qint64 &id); + void setPShoulder(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -149,15 +149,15 @@ private: /** * @brief p1Line id first point of line */ - qint64 p1Line; + quint32 p1Line; /** * @brief p2Line id second point of line */ - qint64 p2Line; + quint32 p2Line; /** * @brief pShoulder id shoulder point */ - qint64 pShoulder; + quint32 pShoulder; }; #endif // DIALOGSHOULDERPOINT_H diff --git a/src/dialogs/tools/dialogspline.cpp b/src/dialogs/tools/dialogspline.cpp index 88b1a8f19..a5fdef0f0 100644 --- a/src/dialogs/tools/dialogspline.cpp +++ b/src/dialogs/tools/dialogspline.cpp @@ -51,12 +51,12 @@ DialogSpline::~DialogSpline() delete ui; } -qint64 DialogSpline::getP1() const +quint32 DialogSpline::getP1() const { return p1; } -void DialogSpline::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogSpline::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { @@ -81,7 +81,7 @@ void DialogSpline::ChoosedObject(qint64 id, const Scene::Scenes &type) number = 0; emit ToolTip(""); index = ui->comboBoxP1->currentIndex(); - qint64 p1Id = qvariant_cast(ui->comboBoxP1->itemData(index)); + quint32 p1Id = qvariant_cast(ui->comboBoxP1->itemData(index)); QPointF p1 = data->GeometricObject(p1Id)->toQPointF(); QPointF p4 = data->GeometricObject(id)->toQPointF(); @@ -139,19 +139,19 @@ void DialogSpline::setAngle1(const qreal &value) ui->spinBoxAngle1->setValue(static_cast(value)); } -void DialogSpline::setP4(const qint64 &value) +void DialogSpline::setP4(const quint32 &value) { p4 = value; ChangeCurrentData(ui->comboBoxP4, value); } -void DialogSpline::setP1(const qint64 &value) +void DialogSpline::setP1(const quint32 &value) { p1 = value; ChangeCurrentData(ui->comboBoxP1, value); } -qint64 DialogSpline::getP4() const +quint32 DialogSpline::getP4() const { return p4; } diff --git a/src/dialogs/tools/dialogspline.h b/src/dialogs/tools/dialogspline.h index f78b94bd5..281d28ea8 100644 --- a/src/dialogs/tools/dialogspline.h +++ b/src/dialogs/tools/dialogspline.h @@ -54,22 +54,22 @@ public: * @brief getP1 return id first point of spline * @return id */ - qint64 getP1() const; + quint32 getP1() const; /** * @brief setP1 set id first point of spline * @param value id */ - void setP1(const qint64 &value); + void setP1(const quint32 &value); /** * @brief getP4 return id fourth point of spline * @return id */ - qint64 getP4() const; + quint32 getP4() const; /** * @brief setP4 set id fourth point of spline * @param value id */ - void setP4(const qint64 &value); + void setP4(const quint32 &value); /** * @brief getAngle1 return first angle of spline * @return angle in degree @@ -126,7 +126,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -144,11 +144,11 @@ private: /** * @brief p1 id first point of spline */ - qint64 p1; + quint32 p1; /** * @brief p4 id fourth point of spline */ - qint64 p4; + quint32 p4; /** * @brief angle1 first angle of spline in degree */ diff --git a/src/dialogs/tools/dialogsplinepath.cpp b/src/dialogs/tools/dialogsplinepath.cpp index 7f80afc83..4abe04686 100644 --- a/src/dialogs/tools/dialogsplinepath.cpp +++ b/src/dialogs/tools/dialogsplinepath.cpp @@ -76,7 +76,7 @@ void DialogSplinePath::SetPath(const VSplinePath &value) } -void DialogSplinePath::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogSplinePath::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { @@ -113,7 +113,7 @@ void DialogSplinePath::PointChanged(int row) void DialogSplinePath::currentPointChanged(int index) { - qint64 id = qvariant_cast(ui->comboBoxPoint->itemData(index)); + quint32 id = qvariant_cast(ui->comboBoxPoint->itemData(index)); qint32 row = ui->listWidget->currentRow(); QListWidgetItem *item = ui->listWidget->item( row ); VSplinePoint p = qvariant_cast(item->data(Qt::UserRole)); @@ -164,7 +164,7 @@ void DialogSplinePath::KAsm2Changed(qreal d) item->setData(Qt::UserRole, QVariant::fromValue(p)); } -void DialogSplinePath::NewItem(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2) +void DialogSplinePath::NewItem(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2) { const VPointF *point = data->GeometricObject(id); QListWidgetItem *item = new QListWidgetItem(point->name()); @@ -182,7 +182,7 @@ void DialogSplinePath::NewItem(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2 EnableFields(); } -void DialogSplinePath::DataPoint(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2) +void DialogSplinePath::DataPoint(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2) { disconnect(ui->comboBoxPoint, static_cast(&QComboBox::currentIndexChanged), this, &DialogSplinePath::currentPointChanged); diff --git a/src/dialogs/tools/dialogsplinepath.h b/src/dialogs/tools/dialogsplinepath.h index fe33e24d6..5d9ab2ec6 100644 --- a/src/dialogs/tools/dialogsplinepath.h +++ b/src/dialogs/tools/dialogsplinepath.h @@ -67,7 +67,7 @@ public slots: * @param id id of point or detail * @param type don't show this id in list */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -120,7 +120,7 @@ private: * @param kAsm2 second coefficient asymmetry * @param angle2 second angle in degree */ - void NewItem(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2); + void NewItem(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2); /** * @brief dataPoint show data of point in fields * @param id id @@ -129,7 +129,7 @@ private: * @param kAsm2 second coefficient asymmetry * @param angle2 second angle of spline */ - void DataPoint(qint64 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2); + void DataPoint(quint32 id, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2); /** * @brief EnableFields enable or disable fields */ diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index 1e721d7e5..353ef34f4 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -70,12 +70,12 @@ void DialogTool::showEvent(QShowEvent *event) isInitialized = true;//first show windows are held } -void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const +void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const { Q_CHECK_PTR(box); - const QHash *objs = data->DataGObjects(); - QHashIterator i(*objs); - QMap list; + const QHash *objs = data->DataGObjects(); + QHashIterator i(*objs); + QMap list; while (i.hasNext()) { i.next(); @@ -92,12 +92,12 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const qint64 &id) const FillList(box, list); } -void DialogTool::FillComboBoxArcs(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutArc cut) const +void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutArc cut) const { Q_CHECK_PTR(box); - const QHash *objs = data->DataGObjects(); - QHashIterator i(*objs); - QMap list; + const QHash *objs = data->DataGObjects(); + QHashIterator i(*objs); + QMap list; while (i.hasNext()) { i.next(); @@ -129,12 +129,12 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const qint64 &id, ComboMode::C FillList(box, list); } -void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const +void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const { Q_CHECK_PTR(box); - const QHash *objs = data->DataGObjects(); - QHashIterator i(*objs); - QMap list; + const QHash *objs = data->DataGObjects(); + QHashIterator i(*objs); + QMap list; while (i.hasNext()) { i.next(); @@ -166,12 +166,12 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const qint64 &id, ComboMode FillList(box, list); } -void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const qint64 &id, ComboMode::ComboBoxCutSpline cut) const +void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const { Q_CHECK_PTR(box); - const QHash *objs = data->DataGObjects(); - QHashIterator i(*objs); - QMap list; + const QHash *objs = data->DataGObjects(); + QHashIterator i(*objs); + QMap list; while (i.hasNext()) { i.next(); @@ -261,7 +261,7 @@ void DialogTool::ChangeCurrentText(QComboBox *box, const QString &value) } } -void DialogTool::ChangeCurrentData(QComboBox *box, const qint64 &value) const +void DialogTool::ChangeCurrentData(QComboBox *box, const quint32 &value) const { qint32 index = box->findData(value); if (index != -1) @@ -333,7 +333,7 @@ void DialogTool::Eval(QLineEdit *edit, bool &flag, QTimer *timer, QLabel *label) labelEditFormula->setPalette(palette); } -void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const +void DialogTool::setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) const { Q_CHECK_PTR(box); FillComboBoxPoints(box, id); @@ -341,7 +341,7 @@ void DialogTool::setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 ChangeCurrentData(box, value); } -void DialogTool::setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint64 &value, const qint64 &id, +void DialogTool::setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, const quint32 &id, ComboMode::ComboBoxCutSpline cut) const { Q_CHECK_PTR(box); @@ -350,7 +350,7 @@ void DialogTool::setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint ChangeCurrentData(box, value); } -void DialogTool::setCurrentArcId(QComboBox *box, qint64 &arcId, const qint64 &value, const qint64 &id, +void DialogTool::setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, const quint32 &id, ComboMode::ComboBoxCutArc cut) const { Q_CHECK_PTR(box); @@ -359,8 +359,8 @@ void DialogTool::setCurrentArcId(QComboBox *box, qint64 &arcId, const qint64 &va ChangeCurrentData(box, value); } -void DialogTool::setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value, - const qint64 &id, ComboMode::ComboBoxCutSpline cut) const +void DialogTool::setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value, + const quint32 &id, ComboMode::ComboBoxCutSpline cut) const { Q_CHECK_PTR(box); FillComboBoxSplinesPath(box, id, cut); @@ -368,14 +368,14 @@ void DialogTool::setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, co ChangeCurrentData(box, value); } -qint64 DialogTool::getCurrentObjectId(QComboBox *box) const +quint32 DialogTool::getCurrentObjectId(QComboBox *box) const { Q_CHECK_PTR(box); qint32 index = box->currentIndex(); Q_ASSERT(index != -1); if (index != -1) { - return qvariant_cast(box->itemData(index)); + return qvariant_cast(box->itemData(index)); } else { @@ -383,12 +383,12 @@ qint64 DialogTool::getCurrentObjectId(QComboBox *box) const } } -void DialogTool::FillList(QComboBox *box, const QMap &list) const +void DialogTool::FillList(QComboBox *box, const QMap &list) const { Q_CHECK_PTR(box); box->clear(); - QMapIterator iter(list); + QMapIterator iter(list); while (iter.hasNext()) { iter.next(); @@ -402,7 +402,7 @@ void DialogTool::CheckState() bOk->setEnabled(flagFormula && flagName); } -void DialogTool::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogTool::ChoosedObject(quint32 id, const Scene::Scenes &type) { Q_UNUSED(id); Q_UNUSED(type); diff --git a/src/dialogs/tools/dialogtool.h b/src/dialogs/tools/dialogtool.h index 613dcdbac..4e1cf2079 100644 --- a/src/dialogs/tools/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -82,7 +82,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief NamePointChanged check name of point */ @@ -274,8 +274,8 @@ protected: * @param box comboBox * @param id don't show this id in list */ - void FillComboBoxPoints(QComboBox *box, const qint64 &id = 0)const; - void FillComboBoxArcs(QComboBox *box, const qint64 &id = 0, + void FillComboBoxPoints(QComboBox *box, const quint32 &id = 0)const; + void FillComboBoxArcs(QComboBox *box, const quint32 &id = 0, ComboMode::ComboBoxCutArc cut = ComboMode::NoCutArc)const; /** * @brief FillComboBoxSplines fill comboBox list of splines @@ -283,7 +283,7 @@ protected: * @param id don't show id in list * @param cut if set to ComboMode::CutSpline don't show id+1 and id+2 */ - void FillComboBoxSplines(QComboBox *box, const qint64 &id = 0, + void FillComboBoxSplines(QComboBox *box, const quint32 &id = 0, ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline)const; /** * @brief FillComboBoxSplinesPath @@ -291,7 +291,7 @@ protected: * @param id don't show id in list * @param cut if set to ComboMode::CutSpline don't show id+1 and id+2 */ - void FillComboBoxSplinesPath(QComboBox *box, const qint64 &id = 0, + void FillComboBoxSplinesPath(QComboBox *box, const quint32 &id = 0, ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline)const; /** * @brief FillComboBoxTypeLine fill comboBox list of type lines @@ -331,7 +331,7 @@ protected: * @param box combobox * @param value id of item */ - void ChangeCurrentData(QComboBox *box, const qint64 &value) const; + void ChangeCurrentData(QComboBox *box, const quint32 &value) const; /** * @brief PutValHere put variable into line edit from list * @param lineEdit lineEdit @@ -360,7 +360,7 @@ protected: * @param value point id * @param id don't show this id in list */ - void setCurrentPointId(QComboBox *box, qint64 &pointId, const qint64 &value, const qint64 &id) const; + void setCurrentPointId(QComboBox *box, quint32 &pointId, const quint32 &value, const quint32 &id) const; /** * @brief setCurrentSplineId set current spline id in combobox * @param box combobox @@ -369,7 +369,7 @@ protected: * @param id don't show this id in list * @param cut if set to ComboMode::CutSpline don't show id+1 and id+2 */ - void setCurrentSplineId(QComboBox *box, qint64 &splineId, const qint64 &value, const qint64 &id, + void setCurrentSplineId(QComboBox *box, quint32 &splineId, const quint32 &value, const quint32 &id, ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const; /** * @brief setCurrentArcId @@ -379,7 +379,7 @@ protected: * @param id don't show this id in list * @param cut if set to ComboMode::CutArc don't show id+1 and id+2 */ - void setCurrentArcId(QComboBox *box, qint64 &arcId, const qint64 &value, const qint64 &id, + void setCurrentArcId(QComboBox *box, quint32 &arcId, const quint32 &value, const quint32 &id, ComboMode::ComboBoxCutArc cut = ComboMode::NoCutArc) const; /** * @brief setCurrentSplinePathId set current splinePath id in combobox @@ -389,21 +389,21 @@ protected: * @param id don't show this id in list * @param cut if set to ComboMode::CutSpline don't show id+1 and id+2 */ - void setCurrentSplinePathId(QComboBox *box, qint64 &splinePathId, const qint64 &value, const qint64 &id, + void setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value, const quint32 &id, ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const; /** * @brief getCurrentPointId return current point id in combobox * @param box combobox * @return id or -1 if combobox is empty */ - qint64 getCurrentObjectId(QComboBox *box) const; + quint32 getCurrentObjectId(QComboBox *box) const; private: /** * @brief FillList fill combobox list * @param box combobox * @param list list with ids and names */ - void FillList(QComboBox *box, const QMap &list)const; + void FillList(QComboBox *box, const QMap &list)const; }; #endif // DIALOGTOOL_H diff --git a/src/dialogs/tools/dialogtriangle.cpp b/src/dialogs/tools/dialogtriangle.cpp index e4c1f63aa..b4ba5320e 100644 --- a/src/dialogs/tools/dialogtriangle.cpp +++ b/src/dialogs/tools/dialogtriangle.cpp @@ -57,7 +57,7 @@ DialogTriangle::~DialogTriangle() delete ui; } -void DialogTriangle::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogTriangle::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { @@ -110,25 +110,25 @@ void DialogTriangle::setPointName(const QString &value) ui->lineEditNamePoint->setText(pointName); } -void DialogTriangle::setSecondPointId(const qint64 &value, const qint64 &id) +void DialogTriangle::setSecondPointId(const quint32 &value, const quint32 &id) { secondPointId = value; setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } -void DialogTriangle::setFirstPointId(const qint64 &value, const qint64 &id) +void DialogTriangle::setFirstPointId(const quint32 &value, const quint32 &id) { firstPointId = value; setCurrentPointId(ui->comboBoxFirstPoint, firstPointId, value, id); } -void DialogTriangle::setAxisP2Id(const qint64 &value, const qint64 &id) +void DialogTriangle::setAxisP2Id(const quint32 &value, const quint32 &id) { axisP2Id = value; setCurrentPointId(ui->comboBoxAxisP2, axisP2Id, value, id); } -void DialogTriangle::setAxisP1Id(const qint64 &value, const qint64 &id) +void DialogTriangle::setAxisP1Id(const quint32 &value, const quint32 &id) { axisP1Id = value; setCurrentPointId(ui->comboBoxAxisP1, axisP1Id, value, id); diff --git a/src/dialogs/tools/dialogtriangle.h b/src/dialogs/tools/dialogtriangle.h index 0335aa9c4..964921d70 100644 --- a/src/dialogs/tools/dialogtriangle.h +++ b/src/dialogs/tools/dialogtriangle.h @@ -54,46 +54,46 @@ public: * @brief getAxisP1Id return id first point of axis * @return id */ - inline qint64 getAxisP1Id() const {return axisP1Id;} + inline quint32 getAxisP1Id() const {return axisP1Id;} /** * @brief setAxisP1Id set id first point of axis * @param value id * @param id don't show this point in list */ - void setAxisP1Id(const qint64 &value, const qint64 &id); + void setAxisP1Id(const quint32 &value, const quint32 &id); /** * @brief getAxisP2Id return id second point of axis * @return id */ - inline qint64 getAxisP2Id() const {return axisP2Id;} + inline quint32 getAxisP2Id() const {return axisP2Id;} /** * @brief setAxisP2Id set id second point of axis * @param value id * @param id don't show this point in list */ - void setAxisP2Id(const qint64 &value, const qint64 &id); + void setAxisP2Id(const quint32 &value, const quint32 &id); /** * @brief getFirstPointId return id of first point * @return id */ - inline qint64 getFirstPointId() const {return firstPointId;} + inline quint32 getFirstPointId() const {return firstPointId;} /** * @brief setFirstPointId set id of first point * @param value id * @param id don't show this point in list */ - void setFirstPointId(const qint64 &value, const qint64 &id); + void setFirstPointId(const quint32 &value, const quint32 &id); /** * @brief getSecondPointId return id of second point * @return id */ - inline qint64 getSecondPointId() const {return secondPointId;} + inline quint32 getSecondPointId() const {return secondPointId;} /** * @brief setSecondPointId set id of second point * @param value id * @param id don't show this point in list */ - void setSecondPointId(const qint64 &value, const qint64 &id); + void setSecondPointId(const quint32 &value, const quint32 &id); /** * @brief getPointName return name of point * @return name @@ -110,7 +110,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(qint64 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -132,19 +132,19 @@ private: /** * @brief axisP1Id id first point of axis */ - qint64 axisP1Id; + quint32 axisP1Id; /** * @brief axisP2Id id second point of axis */ - qint64 axisP2Id; + quint32 axisP2Id; /** * @brief firstPointId id first point of line */ - qint64 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id second point of line */ - qint64 secondPointId; + quint32 secondPointId; }; #endif // DIALOGTRIANGLE_H diff --git a/src/dialogs/tools/dialoguniondetails.cpp b/src/dialogs/tools/dialoguniondetails.cpp index 9dac1278d..73c80a3f6 100644 --- a/src/dialogs/tools/dialoguniondetails.cpp +++ b/src/dialogs/tools/dialoguniondetails.cpp @@ -45,7 +45,7 @@ DialogUnionDetails::~DialogUnionDetails() delete ui; } -void DialogUnionDetails::ChoosedObject(qint64 id, const Scene::Scenes &type) +void DialogUnionDetails::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (numberD == 0) { @@ -62,7 +62,7 @@ void DialogUnionDetails::DialogAccepted() emit DialogClosed(QDialog::Accepted); } -bool DialogUnionDetails::CheckObject(const qint64 &id, const qint64 &idDetail) const +bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail) const { if (idDetail == 0) { @@ -72,7 +72,7 @@ bool DialogUnionDetails::CheckObject(const qint64 &id, const qint64 &idDetail) c return det.Containes(id); } -void DialogUnionDetails::ChoosedDetail(const qint64 &id, const Scene::Scenes &type, qint64 &idDetail, ptrdiff_t &index) +void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Scene::Scenes &type, quint32 &idDetail, ptrdiff_t &index) { if (idDetail == 0) { diff --git a/src/dialogs/tools/dialoguniondetails.h b/src/dialogs/tools/dialoguniondetails.h index ad94b45f4..c165436ab 100644 --- a/src/dialogs/tools/dialoguniondetails.h +++ b/src/dialogs/tools/dialoguniondetails.h @@ -54,12 +54,12 @@ public: * @brief getD1 return id first detail * @return id */ - inline qint64 getD1() const {return d1;} + inline quint32 getD1() const {return d1;} /** * @brief getD2 return id second detail * @return id */ - inline qint64 getD2() const {return d2;} + inline quint32 getD2() const {return d2;} /** * @brief getIndexD1 return index edge first detail * @return index @@ -76,7 +76,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - void ChoosedObject(qint64 id, const Scene::Scenes &type); + void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -98,11 +98,11 @@ private: /** * @brief d1 id first detail */ - qint64 d1; + quint32 d1; /** * @brief d2 id second detail */ - qint64 d2; + quint32 d2; /** * @brief numberD number of detail, what we already have */ @@ -114,18 +114,18 @@ private: /** * @brief p1 id first point of detail */ - qint64 p1; + quint32 p1; /** * @brief p2 id second point of detail */ - qint64 p2; + quint32 p2; /** * @brief CheckObject check if detail contain this id * @param id id of item * @param idDetail detail id * @return true if contain */ - bool CheckObject(const qint64 &id, const qint64 &idDetail) const; + bool CheckObject(const quint32 &id, const quint32 &idDetail) const; /** * @brief ChoosedDetail help save information about detail and points on detail * @param id id selected object @@ -133,7 +133,7 @@ private: * @param idDetail id detail * @param index index of edge */ - void ChoosedDetail(const qint64 &id, const Scene::Scenes &type, qint64 &idDetail, ptrdiff_t &index); + void ChoosedDetail(const quint32 &id, const Scene::Scenes &type, quint32 &idDetail, ptrdiff_t &index); }; #endif // DIALOGUNIONDETAILS_H diff --git a/src/exception/vexceptionbadid.h b/src/exception/vexceptionbadid.h index 91a407c0c..587d74d7c 100644 --- a/src/exception/vexceptionbadid.h +++ b/src/exception/vexceptionbadid.h @@ -42,7 +42,7 @@ public: * @param what string with error * @param id id */ - VExceptionBadId(const QString &what, const qint64 &id) + VExceptionBadId(const QString &what, const quint32 &id) :VException(what), id(id), key(QString()){} /** * @brief VExceptionBadId exception bad id @@ -67,7 +67,7 @@ public: * @brief BadId return bad id * @return id */ - inline qint64 BadId() const {return id; } + inline quint32 BadId() const {return id; } /** * @brief BadKey return bad key * @return key @@ -77,7 +77,7 @@ protected: /** * @brief id id */ - qint64 id; + quint32 id; /** * @brief key key */ diff --git a/src/geometry/varc.cpp b/src/geometry/varc.cpp index af91b0396..30ee685bc 100644 --- a/src/geometry/varc.cpp +++ b/src/geometry/varc.cpp @@ -39,7 +39,7 @@ VArc::VArc () } VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, - QString formulaF2, qint64 idObject, Draw::Draws mode) + QString formulaF2, quint32 idObject, Draw::Draws mode) : VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius), center(center) { @@ -173,7 +173,7 @@ QPointF VArc::CutArc(const qreal &length, VArc &arc1, VArc &arc2) const return line.p2(); } -void VArc::setId(const qint64 &id) +void VArc::setId(const quint32 &id) { _id = id; _name = QString ("Arc_%1_%2").arg(center.name()).arg(id); diff --git a/src/geometry/varc.h b/src/geometry/varc.h index b2d42d334..ccb13fef0 100644 --- a/src/geometry/varc.h +++ b/src/geometry/varc.h @@ -56,7 +56,7 @@ public: * @param f2 end angle (degree). */ VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, - QString formulaF2, qint64 idObject = 0, Draw::Draws mode = Draw::Calculation); + QString formulaF2, quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); /** * @brief VArc copy constructor * @param arc arc @@ -150,7 +150,7 @@ public: * @brief setId keep id arc in data. * @param id id arc in data. */ - virtual void setId(const qint64 &id); + virtual void setId(const quint32 &id); private: /** * @brief f1 start angle in degree. diff --git a/src/geometry/vdetail.cpp b/src/geometry/vdetail.cpp index d5e089ffb..ab7379dd4 100644 --- a/src/geometry/vdetail.cpp +++ b/src/geometry/vdetail.cpp @@ -72,7 +72,7 @@ void VDetail::ClearNodes() nodes.clear(); } -bool VDetail::Containes(const qint64 &id) const +bool VDetail::Containes(const quint32 &id) const { for (ptrdiff_t i = 0; i < nodes.size(); ++i) { @@ -95,22 +95,22 @@ const VNodeDetail &VDetail::at(ptrdiff_t indx) const return nodes[indx]; } -ptrdiff_t VDetail::indexOfNode(const qint64 &id) const +ptrdiff_t VDetail::indexOfNode(const quint32 &id) const { return indexOfNode(nodes, id); } -qint64 VDetail::id() const +quint32 VDetail::id() const { return _id; } -void VDetail::setId(const qint64 &id) +void VDetail::setId(const quint32 &id) { _id = id; } -bool VDetail::OnEdge(const qint64 &p1, const qint64 &p2) const +bool VDetail::OnEdge(const quint32 &p1, const quint32 &p2) const { QVector list = listNodePoint(); if (list.size() < 3) @@ -147,7 +147,7 @@ bool VDetail::OnEdge(const qint64 &p1, const qint64 &p2) const } } -ptrdiff_t VDetail::Edge(const qint64 &p1, const qint64 &p2) const +ptrdiff_t VDetail::Edge(const quint32 &p1, const quint32 &p2) const { if (OnEdge(p1, p2) == false) { @@ -171,7 +171,7 @@ ptrdiff_t VDetail::Edge(const qint64 &p1, const qint64 &p2) const } } -void VDetail::NodeOnEdge(const ptrdiff_t &index, VNodeDetail &p1, VNodeDetail &p2) const +void VDetail::NodeOnEdge(const quint32 &index, VNodeDetail &p1, VNodeDetail &p2) const { QVector list = listNodePoint(); if (index < 0 || index > list.size()) @@ -190,7 +190,7 @@ void VDetail::NodeOnEdge(const ptrdiff_t &index, VNodeDetail &p1, VNodeDetail &p } } -VDetail VDetail::RemoveEdge(const ptrdiff_t &index) const +VDetail VDetail::RemoveEdge(const quint32 &index) const { VDetail det(*this); det.ClearNodes(); @@ -232,9 +232,9 @@ VDetail VDetail::RemoveEdge(const ptrdiff_t &index) const return det; } -QList VDetail::Missing(const VDetail &det) const +QList VDetail::Missing(const VDetail &det) const { - QList list; + QList list; if (nodes.size() == det.CountNode()) { return list; @@ -268,7 +268,7 @@ QVector VDetail::listNodePoint() const return list; } -ptrdiff_t VDetail::indexOfNode(const QVector &list, const qint64 &id) +ptrdiff_t VDetail::indexOfNode(const QVector &list, const quint32 &id) { for (ptrdiff_t i = 0; i < list.size(); ++i) { diff --git a/src/geometry/vdetail.h b/src/geometry/vdetail.h index 9bdaa6eaf..fa4318fef 100644 --- a/src/geometry/vdetail.h +++ b/src/geometry/vdetail.h @@ -103,7 +103,7 @@ public: * @param id object id. * @return true if containe. */ - bool Containes(const qint64 &id)const; + bool Containes(const quint32 &id)const; /** * @brief operator [] find node by index in list. * @param indx index node in list. @@ -191,17 +191,17 @@ public: * @param id object (arc, point, spline, splinePath) id. * @return index in list or -1 id can't find. */ - ptrdiff_t indexOfNode(const qint64 &id) const; + ptrdiff_t indexOfNode(const quint32 &id) const; /** * @brief id return id detail in list data. * @return id. */ - qint64 id() const; + quint32 id() const; /** * @brief setId set id detail in list data. * @param id detail id. */ - void setId(const qint64 &id); + void setId(const quint32 &id); /** * @brief OnEdge checks if two poins located on the edge. Edge is line between two points. If between two points * located arcs or splines ignore this. @@ -209,7 +209,7 @@ public: * @param p2 id second point. * @return true - on edge, false - no. */ - bool OnEdge(const qint64 &p1, const qint64 &p2)const; + bool OnEdge(const quint32 &p1, const quint32 &p2)const; /** * @brief Edge return edge index in detail. Edge is line between two points. If between two points * located arcs or splines ignore this. @@ -217,32 +217,32 @@ public: * @param p2 id second point. * @return edge index or -1 if points don't located on edge */ - ptrdiff_t Edge(const qint64 &p1, const qint64 &p2)const; + ptrdiff_t Edge(const quint32 &p1, const quint32 &p2)const; /** * @brief NodeOnEdge return nodes located on edge with index. * @param index index of edge. * @param p1 first node. * @param p2 second node. */ - void NodeOnEdge(const ptrdiff_t &index, VNodeDetail &p1, VNodeDetail &p2)const; + void NodeOnEdge(const quint32 &index, VNodeDetail &p1, VNodeDetail &p2)const; /** * @brief RemoveEdge return detail without edge with index. * @param index idex of edge. * @return */ - VDetail RemoveEdge(const ptrdiff_t &index) const; + VDetail RemoveEdge(const quint32 &index) const; /** * @brief Missing find missing ids in detail. When we deleted object in detail and return this detail need * understand, what nodes need make invisible. * @param det changed detail. * @return list with missing detail. */ - QList Missing(const VDetail &det) const; + QList Missing(const VDetail &det) const; private: /** * @brief _id id detail. */ - qint64 _id; + quint32 _id; /** * @brief nodes list detail nodes. */ @@ -282,7 +282,7 @@ private: * @param id object (arc, point, spline, splinePath) id. * @return index in list or -1 id can't find. */ - static ptrdiff_t indexOfNode(const QVector &list, const qint64 &id); + static ptrdiff_t indexOfNode(const QVector &list, const quint32 &id); }; #endif // VDETAIL_H diff --git a/src/geometry/vequidistant.cpp b/src/geometry/vequidistant.cpp index a0c7048e5..66407cf34 100644 --- a/src/geometry/vequidistant.cpp +++ b/src/geometry/vequidistant.cpp @@ -28,7 +28,7 @@ #include "vequidistant.h" -QPainterPath VEquidistant::ContourPath(const qint64 &idDetail, const VContainer *data) const +QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer *data) const { Q_CHECK_PTR(data); VDetail detail = data->GetDetail(idDetail); diff --git a/src/geometry/vequidistant.h b/src/geometry/vequidistant.h index a35ab3a83..652788fbb 100644 --- a/src/geometry/vequidistant.h +++ b/src/geometry/vequidistant.h @@ -44,7 +44,7 @@ public: * @param data container with objects (points, arcs, splines). * @return return painter path of contour detail. */ - QPainterPath ContourPath(const qint64 &idDetail, const VContainer *data) const; + QPainterPath ContourPath(const quint32 &idDetail, const VContainer *data) const; private: /** * @brief GetLengthContour return length of contour. diff --git a/src/geometry/vgobject.cpp b/src/geometry/vgobject.cpp index 94d025598..bbd23f03b 100644 --- a/src/geometry/vgobject.cpp +++ b/src/geometry/vgobject.cpp @@ -33,7 +33,7 @@ VGObject::VGObject() { } -VGObject::VGObject(const GObject::Type &type, const qint64 &idObject, const Draw::Draws &mode) +VGObject::VGObject(const GObject::Type &type, const quint32 &idObject, const Draw::Draws &mode) :_id(0), type(type), idObject(idObject), _name(QString()), mode(mode) { } @@ -53,12 +53,12 @@ VGObject &VGObject::operator=(const VGObject &obj) return *this; } -qint64 VGObject::getIdObject() const +quint32 VGObject::getIdObject() const { return idObject; } -void VGObject::setIdObject(const qint64 &value) +void VGObject::setIdObject(const quint32 &value) { idObject = value; } @@ -88,12 +88,12 @@ GObject::Type VGObject::getType() const return type; } -qint64 VGObject::id() const +quint32 VGObject::id() const { return _id; } -void VGObject::setId(const qint64 &id) +void VGObject::setId(const quint32 &id) { _id = id; } diff --git a/src/geometry/vgobject.h b/src/geometry/vgobject.h index 917cef7a9..c06428087 100644 --- a/src/geometry/vgobject.h +++ b/src/geometry/vgobject.h @@ -61,7 +61,7 @@ public: * @param idObject id parent object. * @param mode mode creation. Used in modeling mode. */ - VGObject(const GObject::Type &type, const qint64 &idObject = 0, const Draw::Draws &mode = Draw::Calculation); + VGObject(const GObject::Type &type, const quint32 &idObject = 0, const Draw::Draws &mode = Draw::Calculation); /** * @brief VGObject copy constructor. * @param obj object. @@ -78,12 +78,12 @@ public: * @brief getIdObject return parent id. * @return parent id or 0 if object don't have parent. */ - qint64 getIdObject() const; + quint32 getIdObject() const; /** * @brief setIdObject set parent id. * @param value parent id. */ - void setIdObject(const qint64 &value); + void setIdObject(const quint32 &value); /** * @brief name return name graphical object. * @return name @@ -113,17 +113,17 @@ public: * @brief id return id object. * @return id */ - qint64 id() const; + quint32 id() const; /** * @brief setId set id object. * @param id id. */ - virtual void setId(const qint64 &id); + virtual void setId(const quint32 &id); protected: /** * @brief _id id in container. Ned for arcs, spline and spline paths. */ - qint64 _id; + quint32 _id; /** * @brief type type of graphical object */ @@ -131,7 +131,7 @@ protected: /** * @brief idObject id of parent object. Only for modeling. All another return 0. */ - qint64 idObject; + quint32 idObject; /** * @brief _name object name */ diff --git a/src/geometry/vnodedetail.cpp b/src/geometry/vnodedetail.cpp index 45bc99e92..33a858f58 100644 --- a/src/geometry/vnodedetail.cpp +++ b/src/geometry/vnodedetail.cpp @@ -31,7 +31,7 @@ VNodeDetail::VNodeDetail() :id(0), typeTool(Tool::NodePoint), typeNode(NodeDetail::Contour), mx(0), my(0){} -VNodeDetail::VNodeDetail(qint64 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx, qreal my) +VNodeDetail::VNodeDetail(quint32 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx, qreal my) :id(id), typeTool(typeTool), typeNode(typeNode), mx(mx), my(my){} VNodeDetail::VNodeDetail(const VNodeDetail &node) diff --git a/src/geometry/vnodedetail.h b/src/geometry/vnodedetail.h index 3acff0c40..6d018339c 100644 --- a/src/geometry/vnodedetail.h +++ b/src/geometry/vnodedetail.h @@ -60,7 +60,7 @@ public: * @param mx object bias x axis * @param my object bias y axis */ - VNodeDetail(qint64 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx = 0, + VNodeDetail(quint32 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx = 0, qreal my = 0); /** * @brief VNodeDetail copy constructor @@ -77,12 +77,12 @@ public: * @brief getId return object id. * @return id. */ - inline qint64 getId() const {return id;} + inline quint32 getId() const {return id;} /** * @brief setId set object id. * @param value object id. */ - inline void setId(const qint64 &value) {id = value;} + inline void setId(const quint32 &value) {id = value;} /** * @brief getTypeTool return tool type. * @return tool type. @@ -127,7 +127,7 @@ private: /** * @brief id object id. */ - qint64 id; + quint32 id; /** * @brief typeTool type of tool */ diff --git a/src/geometry/vpointf.cpp b/src/geometry/vpointf.cpp index 33783552f..703b93fe1 100644 --- a/src/geometry/vpointf.cpp +++ b/src/geometry/vpointf.cpp @@ -28,7 +28,7 @@ #include "vpointf.h" -VPointF::VPointF(qreal x, qreal y, QString name, qreal mx, qreal my, qint64 idObject, Draw::Draws mode) +VPointF::VPointF(qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idObject, Draw::Draws mode) :VGObject(GObject::Point, idObject, mode), _mx(mx), _my(my), _x(x), _y(y) { this->_name = name; diff --git a/src/geometry/vpointf.h b/src/geometry/vpointf.h index 63da46ba7..51aaffcaa 100644 --- a/src/geometry/vpointf.h +++ b/src/geometry/vpointf.h @@ -60,7 +60,7 @@ public: * @param mx offset name respect to x * @param my offset name respect to y */ - VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, qint64 idObject = 0, + VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); /** * @brief operator = assignment operator diff --git a/src/geometry/vspline.cpp b/src/geometry/vspline.cpp index ecde28308..3a7e76ca4 100644 --- a/src/geometry/vspline.cpp +++ b/src/geometry/vspline.cpp @@ -40,7 +40,7 @@ VSpline::VSpline ( const VSpline & spline ) kCurve(spline.GetKcurve()){} VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, - qint64 idObject, Draw::Draws mode) + quint32 idObject, Draw::Draws mode) :VGObject(GObject::Spline, idObject, mode), p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve) { @@ -67,7 +67,7 @@ VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm this->p3 = p4p3.p2(); } -VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, qint64 idObject, Draw::Draws mode) +VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject, Draw::Draws mode) :VGObject(GObject::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1) { diff --git a/src/geometry/vspline.h b/src/geometry/vspline.h index 80b9dbc5d..af1bebfb8 100644 --- a/src/geometry/vspline.h +++ b/src/geometry/vspline.h @@ -66,7 +66,7 @@ public: * @param kAsm2 coefficient of length second control line. */ VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, - qint64 idObject = 0, Draw::Draws mode = Draw::Calculation); + quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); /** * @brief VSpline constructor. * @param p1 first point spline. @@ -74,7 +74,7 @@ public: * @param p3 second control point. * @param p4 second point spline. */ - VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, qint64 idObject = 0, + VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); /** * @brief GetP1 return first spline point. diff --git a/src/geometry/vsplinepath.cpp b/src/geometry/vsplinepath.cpp index 7bb871d7b..d91f0fc6d 100644 --- a/src/geometry/vsplinepath.cpp +++ b/src/geometry/vsplinepath.cpp @@ -29,7 +29,7 @@ #include "vsplinepath.h" #include "../exception/vexception.h" -VSplinePath::VSplinePath(qreal kCurve, qint64 idObject, Draw::Draws mode) +VSplinePath::VSplinePath(qreal kCurve, quint32 idObject, Draw::Draws mode) : VGObject(GObject::SplinePath, idObject, mode), path(QVector()), kCurve(kCurve), maxCountPoints(0) { } diff --git a/src/geometry/vsplinepath.h b/src/geometry/vsplinepath.h index 890689abf..b13cc4922 100644 --- a/src/geometry/vsplinepath.h +++ b/src/geometry/vsplinepath.h @@ -59,7 +59,7 @@ public: * @param idObject parent id. * @param mode mode creation spline path. */ - VSplinePath(qreal kCurve = 1, qint64 idObject = 0, Draw::Draws mode = Draw::Calculation); + VSplinePath(qreal kCurve = 1, quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); /** * @brief VSplinePath copy constructor. * @param splPath spline path. diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 6761c6873..8eb4b7cf8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -186,12 +186,12 @@ void MainWindow::ActionNewDraw() pattern->ClearGObjects(); //Create single point - qint64 id = pattern->AddGObject(new VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5, 10)); + quint32 id = pattern->AddGObject(new VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5, 10)); VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Tool::FromGui); sceneDraw->addItem(spoint); connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem); connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); - QHash* tools = doc->getTools(); + QHash* tools = doc->getTools(); tools->insert(id, spoint); VDrawTool::AddRecord(id, Tool::SinglePointTool, doc); SetEnableTool(true); @@ -657,7 +657,7 @@ void MainWindow::currentDrawChanged( int index ) if (drawMode) { ArrowTool(); - qint64 id = doc->SPointActiveDraw(); + quint32 id = doc->SPointActiveDraw(); if (id != 0) { const VPointF *p = pattern->GeometricObject(id); @@ -1084,8 +1084,8 @@ void MainWindow::ActionLayout(bool checked) Q_UNUSED(checked); hide(); QVector listDetails; - const QHash *details = pattern->DataDetails(); - QHashIterator idetail(*details); + const QHash *details = pattern->DataDetails(); + QHashIterator idetail(*details); while (idetail.hasNext()) { idetail.next(); diff --git a/src/tools/drawTools/vdrawtool.cpp b/src/tools/drawTools/vdrawtool.cpp index a588da3da..c2afef8d2 100644 --- a/src/tools/drawTools/vdrawtool.cpp +++ b/src/tools/drawTools/vdrawtool.cpp @@ -30,7 +30,7 @@ qreal VDrawTool::factor = 1; -VDrawTool::VDrawTool(VPattern *doc, VContainer *data, qint64 id) +VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id) :VAbstractTool(doc, data, id), ignoreContextMenuEvent(false), ignoreFullUpdate(false), nameActivDraw(doc->GetNameActivDraw()), dialog(0) { @@ -44,7 +44,7 @@ VDrawTool::~VDrawTool() delete dialog; } -void VDrawTool::ShowTool(qint64 id, Qt::GlobalColor color, bool enable) +void VDrawTool::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) { Q_UNUSED(id); Q_UNUSED(color); @@ -102,7 +102,7 @@ void VDrawTool::AddToCalculation(const QDomElement &domElement) bool ok = doc->GetActivNodeElement(VPattern::TagCalculation, calcElement); if (ok) { - qint64 id = doc->getCursor(); + quint32 id = doc->getCursor(); if (id <= 0) { calcElement.appendChild(domElement); diff --git a/src/tools/drawTools/vdrawtool.h b/src/tools/drawTools/vdrawtool.h index e44cbc54f..ff41eca7c 100644 --- a/src/tools/drawTools/vdrawtool.h +++ b/src/tools/drawTools/vdrawtool.h @@ -49,7 +49,7 @@ public: * @param id object id in container. * @param parent parent object. */ - VDrawTool(VPattern *doc, VContainer *data, qint64 id); + VDrawTool(VPattern *doc, VContainer *data, quint32 id); virtual ~VDrawTool(); /** * @brief setDialog set dialog when user want change tool option. @@ -67,7 +67,7 @@ public slots: * @param color highlight color. * @param enable enable or disable highlight. */ - virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); /** * @brief ChangedActivDraw disable or enable context menu after change active pattern peace. * @param newName new name active pattern peace. name new active pattern peace. @@ -183,7 +183,7 @@ protected: * @param color highlight color. * @param enable enable or disable highlight. */ - void ShowItem(Item *item, qint64 id, Qt::GlobalColor color, bool enable) + void ShowItem(Item *item, quint32 id, Qt::GlobalColor color, bool enable) { Q_CHECK_PTR(item); if (id == item->id) diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index 88b8d1149..c7c2da657 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -32,8 +32,8 @@ const QString VToolAlongLine::ToolType = QStringLiteral("alongLine"); -VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, qint64 id, const QString &formula, - const qint64 &firstPointId, const qint64 &secondPointId, +VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula, + const quint32 &firstPointId, const quint32 &secondPointId, const QString &typeLine, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent), secondPointId(secondPointId) @@ -151,16 +151,16 @@ void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatt DialogAlongLine *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); QString formula = dialogTool->getFormula(); - qint64 firstPointId = dialogTool->getFirstPointId(); - qint64 secondPointId = dialogTool->getSecondPointId(); + quint32 firstPointId = dialogTool->getFirstPointId(); + quint32 secondPointId = dialogTool->getSecondPointId(); QString typeLine = dialogTool->getTypeLine(); QString pointName = dialogTool->getPointName(); Create(0, pointName, typeLine, formula, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, +void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine, + const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { @@ -173,7 +173,7 @@ void VToolAlongLine::Create(const qint64 _id, const QString &pointName, const QS if (errorMsg.isEmpty()) { line.setLength(toPixel(result)); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject( new VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); diff --git a/src/tools/drawTools/vtoolalongline.h b/src/tools/drawTools/vtoolalongline.h index d1a325dec..0a3248eba 100644 --- a/src/tools/drawTools/vtoolalongline.h +++ b/src/tools/drawTools/vtoolalongline.h @@ -50,8 +50,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolAlongLine(VPattern *doc, VContainer *data, qint64 id, const QString &formula, - const qint64 &firstPointId, const qint64 &secondPointId, const QString &typeLine, + VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula, + const quint32 &firstPointId, const quint32 &secondPointId, const QString &typeLine, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -81,8 +81,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, const QString &formula, - const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, + static void Create(const quint32 _id, const QString &pointName, const QString &typeLine, const QString &formula, + const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; @@ -127,7 +127,7 @@ private: /** * @brief secondPointId id second point of line. */ - qint64 secondPointId; + quint32 secondPointId; }; #endif // VTOOLALONGLINE_H diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index 8eed179f8..e9bbe1808 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -33,7 +33,7 @@ const QString VToolArc::TagName = QStringLiteral("arc"); const QString VToolArc::ToolType = QStringLiteral("simple"); -VToolArc::VToolArc(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, +VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VDrawTool(doc, data, id), QGraphicsPathItem(parent) { @@ -75,14 +75,14 @@ void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *d Q_CHECK_PTR(dialog); DialogArc *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - qint64 center = dialogTool->GetCenter(); + quint32 center = dialogTool->GetCenter(); QString radius = dialogTool->GetRadius(); QString f1 = dialogTool->GetF1(); QString f2 = dialogTool->GetF2(); Create(0, center, radius, f1, f2, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, +void VToolArc::Create(const quint32 _id, const quint32 ¢er, const QString &radius, const QString &f1, const QString &f2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { @@ -113,7 +113,7 @@ void VToolArc::Create(const qint64 _id, const qint64 ¢er, const QString &rad VPointF c = *data->GeometricObject(center); VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 ); Q_CHECK_PTR(arc); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(arc); @@ -162,7 +162,7 @@ void VToolArc::ChangedActivDraw(const QString &newName) VDrawTool::ChangedActivDraw(newName); } -void VToolArc::ShowTool(qint64 id, Qt::GlobalColor color, bool enable) +void VToolArc::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) { ShowItem(this, id, color, enable); } diff --git a/src/tools/drawTools/vtoolarc.h b/src/tools/drawTools/vtoolarc.h index b81a4cfad..64452b7ca 100644 --- a/src/tools/drawTools/vtoolarc.h +++ b/src/tools/drawTools/vtoolarc.h @@ -48,7 +48,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object */ - VToolArc(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, + VToolArc(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -75,7 +75,7 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const qint64 ¢er, const QString &radius, const QString &f1, + static void Create(const quint32 _id, const quint32 ¢er, const QString &radius, const QString &f1, const QString &f2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; @@ -96,7 +96,7 @@ public slots: * @param color highlight color. * @param enable enable or disable highlight. */ - virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); /** * @brief SetFactor set current scale factor of scene. * @param factor scene scale factor. diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index 63a0a63e5..087ef7b2a 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -32,9 +32,9 @@ const QString VToolBisector::ToolType = QStringLiteral("bisector"); -VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, const Tool::Sources &typeCreation, +VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, + const QString &typeLine, const QString &formula, const quint32 &firstPointId, + const quint32 &secondPointId, const quint32 &thirdPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0), thirdPointId(0) { @@ -91,17 +91,17 @@ void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatte DialogBisector *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); QString formula = dialogTool->getFormula(); - qint64 firstPointId = dialogTool->getFirstPointId(); - qint64 secondPointId = dialogTool->getSecondPointId(); - qint64 thirdPointId = dialogTool->getThirdPointId(); + quint32 firstPointId = dialogTool->getFirstPointId(); + quint32 secondPointId = dialogTool->getSecondPointId(); + quint32 thirdPointId = dialogTool->getThirdPointId(); QString typeLine = dialogTool->getTypeLine(); QString pointName = dialogTool->getPointName(); Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, pointName, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolBisector::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, +void VToolBisector::Create(const quint32 _id, const QString &formula, const quint32 &firstPointId, + const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) @@ -117,7 +117,7 @@ void VToolBisector::Create(const qint64 _id, const QString &formula, const qint6 { QPointF fPoint = VToolBisector::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), thirdPoint->toQPointF(), toPixel(result)); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(new VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); diff --git a/src/tools/drawTools/vtoolbisector.h b/src/tools/drawTools/vtoolbisector.h index b88e284c1..86ee1adeb 100644 --- a/src/tools/drawTools/vtoolbisector.h +++ b/src/tools/drawTools/vtoolbisector.h @@ -50,9 +50,9 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolBisector(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qint64 &firstPointId, const qint64 &secondPointId, - const qint64 &thirdPointId, const Tool::Sources &typeCreation, + VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, + const quint32 &thirdPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief FindPoint find bisector point. @@ -93,8 +93,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const qint64 &thirdPointId, const QString &typeLine, + static void Create(const quint32 _id, const QString &formula, const quint32 &firstPointId, + const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); @@ -140,11 +140,11 @@ private: /** * @brief firstPointId id first point of angle. */ - qint64 firstPointId; + quint32 firstPointId; /** * @brief thirdPointId id third point of angle. */ - qint64 thirdPointId; + quint32 thirdPointId; }; #endif // VTOOLBISECTOR_H diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index 426ff7094..c181191b3 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -33,8 +33,8 @@ const QString VToolCutArc::ToolType = QStringLiteral("cutArc"); const QString VToolCutArc::AttrArc = QStringLiteral("arc"); -VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula, - const qint64 &arcId, const qint64 &arc1id, const qint64 &arc2id, +VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, + const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id, const Tool::Sources &typeCreation, QGraphicsItem * parent) :VToolPoint(doc, data, id, parent), formula(formula), arcId(arcId), firstArc(), secondArc(), arc1id(arc1id), arc2id(arc2id) @@ -84,11 +84,11 @@ void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern Q_CHECK_PTR(dialogTool); QString pointName = dialogTool->getPointName(); QString formula = dialogTool->getFormula(); - qint64 arcId = dialogTool->getArcId(); + quint32 arcId = dialogTool->getArcId(); Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolCutArc::Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &arcId, +void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &arcId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { @@ -102,9 +102,9 @@ void VToolCutArc::Create(const qint64 _id, const QString &pointName, const QStri VArc arc2; QPointF point = arc->CutArc(toPixel(result), arc1, arc2); - qint64 id = _id; - qint64 arc1id = 0; - qint64 arc2id = 0; + quint32 id = _id; + quint32 arc1id = 0; + quint32 arc2id = 0; if (typeCreation == Tool::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); @@ -170,7 +170,7 @@ void VToolCutArc::FullUpdateFromFile() RefreshGeometry(); } -void VToolCutArc::ArcChoosed(qint64 id) +void VToolCutArc::ArcChoosed(quint32 id) { emit ChoosedTool(id, Scene::Arc); } @@ -256,7 +256,7 @@ void VToolCutArc::SaveDialog(QDomElement &domElement) doc->SetAttribute(domElement, AttrArc, QString().setNum(dialogTool->getArcId())); } -void VToolCutArc::RefreshArc(VSimpleArc *sArc, qint64 arcid, SimpleArc::Translation tr) +void VToolCutArc::RefreshArc(VSimpleArc *sArc, quint32 arcid, SimpleArc::Translation tr) { const VArc *arc = VAbstractTool::data.GeometricObject(arcid); QPainterPath path; diff --git a/src/tools/drawTools/vtoolcutarc.h b/src/tools/drawTools/vtoolcutarc.h index 1cf876fa1..d6f8d3478 100644 --- a/src/tools/drawTools/vtoolcutarc.h +++ b/src/tools/drawTools/vtoolcutarc.h @@ -51,8 +51,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolCutArc(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula, - const qint64 &arcId, const qint64 &arc1id, const qint64 &arc2id, + VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, + const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -80,7 +80,7 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &pointName, const QString &formula, const qint64 &arcId, + static void Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &arcId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; @@ -94,7 +94,7 @@ public slots: * @brief ArcChoosed send signal about selection from cutted arc. * @param id object id in container. */ - void ArcChoosed(qint64 id); + void ArcChoosed(quint32 id); /** * @brief ChangedActivDraw disable or enable context menu after change active pattern peace. * @param newName new name active pattern peace. @@ -136,7 +136,7 @@ private: /** * @brief arcId keep id of arc */ - qint64 arcId; + quint32 arcId; /** * @brief firstArc first arc after cutting. */ @@ -148,18 +148,18 @@ private: /** * @brief arc1id id first arc after cutting. */ - const qint64 arc1id; + const quint32 arc1id; /** * @brief arc2id id second arc after cutting. */ - const qint64 arc2id; + const quint32 arc2id; /** * @brief RefreshArc refresh arc on scene. * @param sArc arc. * @param arcid arc id. * @param tr arc type. */ - void RefreshArc(VSimpleArc *sArc, qint64 arcid, SimpleArc::Translation tr); + void RefreshArc(VSimpleArc *sArc, quint32 arcid, SimpleArc::Translation tr); }; #endif // VTOOLCUTARC_H diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index 0c2c01ca7..0debf801d 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -33,8 +33,8 @@ const QString VToolCutSpline::ToolType = QStringLiteral("cutSpline"); const QString VToolCutSpline::AttrSpline = QStringLiteral("spline"); -VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula, - const qint64 &splineId, const qint64 &spl1id, const qint64 &spl2id, +VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, + const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), formula(formula), splineId(splineId), firstSpline(), secondSpline(), spl1id(spl1id), spl2id(spl2id) @@ -84,12 +84,12 @@ void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, Q_CHECK_PTR(dialogTool); QString pointName = dialogTool->getPointName(); QString formula = dialogTool->getFormula(); - qint64 splineId = dialogTool->getSplineId(); + quint32 splineId = dialogTool->getSplineId(); Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolCutSpline::Create(const qint64 _id, const QString &pointName, - const QString &formula, const qint64 &splineId, const qreal &mx, const qreal &my, +void VToolCutSpline::Create(const quint32 _id, const QString &pointName, + const QString &formula, const quint32 &splineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { @@ -102,9 +102,9 @@ void VToolCutSpline::Create(const qint64 _id, const QString &pointName, QPointF spl1p2, spl1p3, spl2p2, spl2p3; QPointF point = spl->CutSpline(toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3); - qint64 id = _id; - qint64 spl1id = 0; - qint64 spl2id = 0; + quint32 id = _id; + quint32 spl1id = 0; + quint32 spl2id = 0; if (typeCreation == Tool::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); @@ -171,7 +171,7 @@ void VToolCutSpline::FullUpdateFromFile() RefreshGeometry(); } -void VToolCutSpline::SplineChoosed(qint64 id) +void VToolCutSpline::SplineChoosed(quint32 id) { emit ChoosedTool(id, Scene::Spline); } @@ -262,7 +262,7 @@ void VToolCutSpline::SaveDialog(QDomElement &domElement) doc->SetAttribute(domElement, AttrSpline, QString().setNum(dialogTool->getSplineId())); } -void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr) +void VToolCutSpline::RefreshSpline(VSimpleSpline *spline, quint32 splid, SimpleSpline::Translation tr) { const VSpline *spl = VAbstractTool::data.GeometricObject(splid); QPainterPath path; diff --git a/src/tools/drawTools/vtoolcutspline.h b/src/tools/drawTools/vtoolcutspline.h index d9b0e7634..87405ee45 100644 --- a/src/tools/drawTools/vtoolcutspline.h +++ b/src/tools/drawTools/vtoolcutspline.h @@ -49,8 +49,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolCutSpline(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula, - const qint64 &splineId, const qint64 &spl1id, const qint64 &spl2id, + VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, + const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -78,8 +78,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &pointName, - const QString &formula, const qint64 &splineId, const qreal &mx, const qreal &my, + static void Create(const quint32 _id, const QString &pointName, + const QString &formula, const quint32 &splineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; @@ -93,7 +93,7 @@ public slots: * @brief SplineChoosed send signal about selection from spline. * @param id object id in container. */ - void SplineChoosed(qint64 id); + void SplineChoosed(quint32 id); /** * @brief ChangedActivDraw disable or enable context menu after change active pattern peace. * @param newName new name active pattern peace. @@ -139,7 +139,7 @@ private: /** * @brief splineId keep id of spline. */ - qint64 splineId; + quint32 splineId; /** * @brief firstSpline first spline after cutting. */ @@ -151,18 +151,18 @@ private: /** * @brief spl1id id first spline after cutting. */ - const qint64 spl1id; + const quint32 spl1id; /** * @brief spl2id id second spline after cutting. */ - const qint64 spl2id; + const quint32 spl2id; /** * @brief RefreshSpline refresh spline on scene. * @param spline spline. * @param splid spline id. * @param tr spline type. */ - void RefreshSpline(VSimpleSpline *spline, qint64 splid, SimpleSpline::Translation tr); + void RefreshSpline(VSimpleSpline *spline, quint32 splid, SimpleSpline::Translation tr); }; #endif // VTOOLCUTSPLINE_H diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index 495d4897d..e8ff9a8e9 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -33,9 +33,9 @@ const QString VToolCutSplinePath::ToolType = QStringLiteral("cutSplinePath"); const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath"); -VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qint64 &id, - const QString &formula, const qint64 &splinePathId, - const qint64 &splPath1id, const qint64 &splPath2id, +VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, + const QString &formula, const quint32 &splinePathId, + const quint32 &splPath1id, const quint32 &splPath2id, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), formula(formula), splinePathId(splinePathId), firstSpline(), secondSpline(), splPath1id (splPath1id), splPath2id(splPath2id) @@ -84,12 +84,12 @@ void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, V Q_CHECK_PTR(dialogTool); QString pointName = dialogTool->getPointName(); QString formula = dialogTool->getFormula(); - qint64 splinePathId = dialogTool->getSplinePathId(); + quint32 splinePathId = dialogTool->getSplinePathId(); Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, const QString &formula, - const qint64 &splinePathId, const qreal &mx, const qreal &my, +void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, const QString &formula, + const quint32 &splinePathId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { @@ -103,9 +103,9 @@ void VToolCutSplinePath::Create(const qint64 _id, const QString &pointName, cons qint32 p1 = 0, p2 = 0; QPointF point = splPath->CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3); - qint64 id = _id; - qint64 splPath1id = 0; - qint64 splPath2id = 0; + quint32 id = _id; + quint32 splPath1id = 0; + quint32 splPath2id = 0; if (typeCreation == Tool::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); @@ -252,7 +252,7 @@ void VToolCutSplinePath::FullUpdateFromFile() RefreshGeometry(); } -void VToolCutSplinePath::SplineChoosed(qint64 id) +void VToolCutSplinePath::SplineChoosed(quint32 id) { emit ChoosedTool(id, Scene::SplinePath); } @@ -343,7 +343,7 @@ void VToolCutSplinePath::SaveDialog(QDomElement &domElement) doc->SetAttribute(domElement, AttrSplinePath, QString().setNum(dialogTool->getSplinePathId())); } -void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr) +void VToolCutSplinePath::RefreshSpline(VSimpleSpline *spline, quint32 splPathid, SimpleSpline::Translation tr) { const VSplinePath *splPath = VAbstractTool::data.GeometricObject(splPathid); QPainterPath path; diff --git a/src/tools/drawTools/vtoolcutsplinepath.h b/src/tools/drawTools/vtoolcutsplinepath.h index f29d8a999..0a7f40b43 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.h +++ b/src/tools/drawTools/vtoolcutsplinepath.h @@ -52,8 +52,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolCutSplinePath(VPattern *doc, VContainer *data, const qint64 &id, const QString &formula, - const qint64 &splinePathId, const qint64 &splPath1id, const qint64 &splPath2id, + VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, + const quint32 &splinePathId, const quint32 &splPath1id, const quint32 &splPath2id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -81,8 +81,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &pointName, const QString &formula, - const qint64 &splinePathId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, + static void Create(const quint32 _id, const QString &pointName, const QString &formula, + const quint32 &splinePathId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; @@ -96,7 +96,7 @@ public slots: * @brief SplineChoosed send signal about selection splinePath. * @param id object id in container. */ - void SplineChoosed(qint64 id); + void SplineChoosed(quint32 id); /** * @brief ChangedActivDraw disable or enable context menu after change active pattern peace. * @param newName new name active pattern peace. @@ -142,7 +142,7 @@ private: /** * @brief splineId keep id of spline. */ - qint64 splinePathId; + quint32 splinePathId; /** * @brief firstSpline first splinePath after cutting. */ @@ -154,18 +154,18 @@ private: /** * @brief splPath1id id first splinePath after cutting. */ - const qint64 splPath1id; + const quint32 splPath1id; /** * @brief splPath2id id second splinePath after cutting. */ - const qint64 splPath2id; + const quint32 splPath2id; /** * @brief RefreshSpline refresh splinePath on scene. * @param spline splinePath. * @param splPathid splinePath id. * @param tr splineType type. */ - void RefreshSpline(VSimpleSpline *spline, qint64 splPathid, SimpleSpline::Translation tr); + void RefreshSpline(VSimpleSpline *spline, quint32 splPathid, SimpleSpline::Translation tr); }; #endif // VTOOLCUTSPLINEPATH_H diff --git a/src/tools/drawTools/vtoolendline.cpp b/src/tools/drawTools/vtoolendline.cpp index 4178689fe..2fb50a4ff 100644 --- a/src/tools/drawTools/vtoolendline.cpp +++ b/src/tools/drawTools/vtoolendline.cpp @@ -33,8 +33,8 @@ const QString VToolEndLine::ToolType = QStringLiteral("endLine"); -VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qreal &angle, const qint64 &basePointId, +VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const QString &formula, const qreal &angle, const quint32 &basePointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent) { @@ -72,13 +72,13 @@ void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatter QString typeLine = dialogTool->getTypeLine(); QString formula = dialogTool->getFormula(); qreal angle = dialogTool->getAngle(); - qint64 basePointId = dialogTool->getBasePointId(); + quint32 basePointId = dialogTool->getBasePointId(); Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const QString &formula, const qreal &angle, const qint64 &basePointId, +void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine, + const QString &formula, const qreal &angle, const quint32 &basePointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { @@ -91,7 +91,7 @@ void VToolEndLine::Create(const qint64 _id, const QString &pointName, const QStr { line.setLength(toPixel(result)); line.setAngle(angle); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(new VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); diff --git a/src/tools/drawTools/vtoolendline.h b/src/tools/drawTools/vtoolendline.h index 938beb98e..b85715035 100644 --- a/src/tools/drawTools/vtoolendline.h +++ b/src/tools/drawTools/vtoolendline.h @@ -50,8 +50,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolEndLine(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qreal &angle, const qint64 &basePointId, + VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const QString &formula, const qreal &angle, const quint32 &basePointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -81,8 +81,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const QString &formula, const qreal &angle, const qint64 &basePointId, const qreal &mx, + static void Create(const quint32 _id, const QString &pointName, const QString &typeLine, + const QString &formula, const qreal &angle, const quint32 &basePointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; diff --git a/src/tools/drawTools/vtoolheight.cpp b/src/tools/drawTools/vtoolheight.cpp index 893e99459..bddc198b7 100644 --- a/src/tools/drawTools/vtoolheight.cpp +++ b/src/tools/drawTools/vtoolheight.cpp @@ -31,8 +31,8 @@ const QString VToolHeight::ToolType = QStringLiteral("height"); -VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, +VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, const Tool::Sources &typeCreation, QGraphicsItem * parent) :VToolLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), p1LineId(p1LineId), p2LineId(p2LineId) { @@ -69,15 +69,15 @@ void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogHeight::UpdateList); QString pointName = dialogTool->getPointName(); QString typeLine = dialogTool->getTypeLine(); - qint64 basePointId = dialogTool->getBasePointId(); - qint64 p1LineId = dialogTool->getP1LineId(); - qint64 p2LineId = dialogTool->getP2LineId(); + quint32 basePointId = dialogTool->getBasePointId(); + quint32 p1LineId = dialogTool->getP1LineId(); + quint32 p2LineId = dialogTool->getP2LineId(); Create(0, pointName, typeLine, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolHeight::Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, +void VToolHeight::Create(const quint32 _id, const QString &pointName, const QString &typeLine, + const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { @@ -86,7 +86,7 @@ void VToolHeight::Create(const qint64 _id, const QString &pointName, const QStri const VPointF *p2Line = data->GeometricObject(p2LineId); QPointF pHeight = FindPoint(QLineF(p1Line->toQPointF(), p2Line->toQPointF()), basePoint->toQPointF()); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(new VPointF(pHeight.x(), pHeight.y(), pointName, mx, my)); diff --git a/src/tools/drawTools/vtoolheight.h b/src/tools/drawTools/vtoolheight.h index f1117041a..1c0f222ba 100644 --- a/src/tools/drawTools/vtoolheight.h +++ b/src/tools/drawTools/vtoolheight.h @@ -50,8 +50,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolHeight(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, + VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -81,8 +81,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &pointName, const QString &typeLine, - const qint64 &basePointId, const qint64 &p1LineId, const qint64 &p2LineId, + static void Create(const quint32 _id, const QString &pointName, const QString &typeLine, + const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); /** @@ -125,11 +125,11 @@ private: /** * @brief p1LineId id first point of line. */ - qint64 p1LineId; + quint32 p1LineId; /** * @brief p2LineId id second point of line. */ - qint64 p2LineId; + quint32 p2LineId; }; #endif // VTOOLHEIGHT_H diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index 36aa631ce..766d7d998 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -31,7 +31,7 @@ const QString VToolLine::TagName = QStringLiteral("line"); -VToolLine::VToolLine(VPattern *doc, VContainer *data, qint64 id, qint64 firstPoint, qint64 secondPoint, +VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint, const QString &typeLine, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint) { @@ -72,20 +72,20 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern * Q_CHECK_PTR(dialog); DialogLine *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - qint64 firstPoint = dialogTool->getFirstPoint(); - qint64 secondPoint = dialogTool->getSecondPoint(); + quint32 firstPoint = dialogTool->getFirstPoint(); + quint32 secondPoint = dialogTool->getSecondPoint(); QString typeLine = dialogTool->getTypeLine(); Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolLine::Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, const QString &typeLine, +void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { Q_CHECK_PTR(scene); Q_CHECK_PTR(doc); Q_CHECK_PTR(data); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->getNextId(); @@ -119,7 +119,7 @@ void VToolLine::FullUpdateFromFile() RefreshGeometry(); } -void VToolLine::ShowTool(qint64 id, Qt::GlobalColor color, bool enable) +void VToolLine::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) { ShowItem(this, id, color, enable); } @@ -239,8 +239,8 @@ void VToolLine::RefreshGeometry() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - firstPoint = doc->GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPoint = doc->GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + firstPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + secondPoint = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); typeLine = doc->GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); } const VPointF *first = VAbstractTool::data.GeometricObject(firstPoint); diff --git a/src/tools/drawTools/vtoolline.h b/src/tools/drawTools/vtoolline.h index 4ca4ffcf9..7bf8d8367 100644 --- a/src/tools/drawTools/vtoolline.h +++ b/src/tools/drawTools/vtoolline.h @@ -51,8 +51,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolLine(VPattern *doc, VContainer *data, qint64 id, qint64 firstPoint, - qint64 secondPoint, const QString &typeLine, const Tool::Sources &typeCreation, + VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, + quint32 secondPoint, const QString &typeLine, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -78,7 +78,7 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 &_id, const qint64 &firstPoint, const qint64 &secondPoint, const QString &typeLine, + static void Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; @@ -98,7 +98,7 @@ public slots: * @param color highlight color. * @param enable enable or disable highlight. */ - virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); /** * @brief SetFactor set current scale factor of scene. * @param factor scene scale factor. @@ -152,11 +152,11 @@ private: /** * @brief firstPoint id first line point. */ - qint64 firstPoint; + quint32 firstPoint; /** * @brief secondPoint id second line point. */ - qint64 secondPoint; + quint32 secondPoint; /** * @brief RefreshGeometry refresh item on scene. */ diff --git a/src/tools/drawTools/vtoollineintersect.cpp b/src/tools/drawTools/vtoollineintersect.cpp index 132d6fff2..8f1aef09a 100644 --- a/src/tools/drawTools/vtoollineintersect.cpp +++ b/src/tools/drawTools/vtoollineintersect.cpp @@ -31,9 +31,9 @@ const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect"); -VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const qint64 &id, - const qint64 &p1Line1, const qint64 &p2Line1, const qint64 &p1Line2, - const qint64 &p2Line2, const Tool::Sources &typeCreation, +VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const quint32 &id, + const quint32 &p1Line1, const quint32 &p2Line1, const quint32 &p1Line2, + const quint32 &p2Line2, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2), p2Line2(p2Line2) @@ -67,17 +67,17 @@ void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, V Q_CHECK_PTR(dialog); DialogLineIntersect *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - qint64 p1Line1Id = dialogTool->getP1Line1(); - qint64 p2Line1Id = dialogTool->getP2Line1(); - qint64 p1Line2Id = dialogTool->getP1Line2(); - qint64 p2Line2Id = dialogTool->getP2Line2(); + quint32 p1Line1Id = dialogTool->getP1Line1(); + quint32 p2Line1Id = dialogTool->getP2Line1(); + quint32 p1Line2Id = dialogTool->getP1Line2(); + quint32 p2Line2Id = dialogTool->getP2Line2(); QString pointName = dialogTool->getPointName(); Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, - const qint64 &p1Line2Id, const qint64 &p2Line2Id, const QString &pointName, +void VToolLineIntersect::Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id, + const quint32 &p1Line2Id, const quint32 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) @@ -93,7 +93,7 @@ void VToolLineIntersect::Create(const qint64 _id, const qint64 &p1Line1Id, const QLineF::IntersectType intersect = line1.intersect(line2, &fPoint); if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) { - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(new VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); diff --git a/src/tools/drawTools/vtoollineintersect.h b/src/tools/drawTools/vtoollineintersect.h index 14125de25..e0101aa71 100644 --- a/src/tools/drawTools/vtoollineintersect.h +++ b/src/tools/drawTools/vtoollineintersect.h @@ -50,8 +50,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolLineIntersect(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &p1Line1, - const qint64 &p2Line1, const qint64 &p1Line2, const qint64 &p2Line2, + VToolLineIntersect(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &p1Line1, + const quint32 &p2Line1, const quint32 &p1Line2, const quint32 &p2Line2, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -81,8 +81,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const qint64 &p1Line1Id, const qint64 &p2Line1Id, const qint64 &p1Line2Id, - const qint64 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, + static void Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id, const quint32 &p1Line2Id, + const quint32 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; @@ -127,19 +127,19 @@ private: /** * @brief p1Line1 id first point first line. */ - qint64 p1Line1; + quint32 p1Line1; /** * @brief p2Line1 id second point first line. */ - qint64 p2Line1; + quint32 p2Line1; /** * @brief p1Line2 id first point second line. */ - qint64 p1Line2; + quint32 p1Line2; /** * @brief p2Line2 id second point second line. */ - qint64 p2Line2; + quint32 p2Line2; }; #endif // VTOOLLINEINTERSECT_H diff --git a/src/tools/drawTools/vtoollinepoint.cpp b/src/tools/drawTools/vtoollinepoint.cpp index e3dfab958..9d72fe009 100644 --- a/src/tools/drawTools/vtoollinepoint.cpp +++ b/src/tools/drawTools/vtoollinepoint.cpp @@ -28,8 +28,8 @@ #include "vtoollinepoint.h" -VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &basePointId, +VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, + const QString &typeLine, const QString &formula, const quint32 &basePointId, const qreal &angle, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), formula(formula), angle(angle), basePointId(basePointId), mainLine(0) diff --git a/src/tools/drawTools/vtoollinepoint.h b/src/tools/drawTools/vtoollinepoint.h index c15dd18b9..9f367a985 100644 --- a/src/tools/drawTools/vtoollinepoint.h +++ b/src/tools/drawTools/vtoollinepoint.h @@ -49,8 +49,8 @@ public: * @param angle line angle. * @param parent parent object. */ - VToolLinePoint(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qint64 &basePointId, const qreal &angle, + VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const QString &formula, const quint32 &basePointId, const qreal &angle, QGraphicsItem * parent = 0); public slots: /** @@ -75,7 +75,7 @@ protected: /** * @brief basePointId id base line point. */ - qint64 basePointId; + quint32 basePointId; /** * @brief mainLine line item. */ diff --git a/src/tools/drawTools/vtoolnormal.cpp b/src/tools/drawTools/vtoolnormal.cpp index b34e84c12..88ea3ae81 100644 --- a/src/tools/drawTools/vtoolnormal.cpp +++ b/src/tools/drawTools/vtoolnormal.cpp @@ -32,9 +32,9 @@ const QString VToolNormal::ToolType = QStringLiteral("normal"); -VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) +VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const QString &formula, const qreal &angle, const quint32 &firstPointId, + const quint32 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent), secondPointId(secondPointId) { @@ -69,8 +69,8 @@ void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern DialogNormal *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); QString formula = dialogTool->getFormula(); - qint64 firstPointId = dialogTool->getFirstPointId(); - qint64 secondPointId = dialogTool->getSecondPointId(); + quint32 firstPointId = dialogTool->getFirstPointId(); + quint32 secondPointId = dialogTool->getSecondPointId(); QString typeLine = dialogTool->getTypeLine(); QString pointName = dialogTool->getPointName(); qreal angle = dialogTool->getAngle(); @@ -78,8 +78,8 @@ void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern Document::FullParse, Tool::FromGui); } -void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const QString &typeLine, const QString &pointName, +void VToolNormal::Create(const quint32 _id, const QString &formula, const quint32 &firstPointId, + const quint32 &secondPointId, const QString &typeLine, const QString &pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) @@ -93,7 +93,7 @@ void VToolNormal::Create(const qint64 _id, const QString &formula, const qint64 { QPointF fPoint = VToolNormal::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), toPixel(result), angle); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(new VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); diff --git a/src/tools/drawTools/vtoolnormal.h b/src/tools/drawTools/vtoolnormal.h index ae79635c9..8efeea75b 100644 --- a/src/tools/drawTools/vtoolnormal.h +++ b/src/tools/drawTools/vtoolnormal.h @@ -51,9 +51,9 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolNormal(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qreal &angle, const qint64 &firstPointId, - const qint64 &secondPointId, const Tool::Sources &typeCreation, + VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const QString &formula, const qreal &angle, const quint32 &firstPointId, + const quint32 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -84,8 +84,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &formula, const qint64 &firstPointId, - const qint64 &secondPointId, const QString &typeLine, const QString &pointName, + static void Create(const quint32 _id, const QString &formula, const quint32 &firstPointId, + const quint32 &secondPointId, const QString &typeLine, const QString &pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); @@ -141,7 +141,7 @@ private: /** * @brief secondPointId id second line point. */ - qint64 secondPointId; + quint32 secondPointId; }; #endif // VTOOLNORMAL_H diff --git a/src/tools/drawTools/vtoolpoint.cpp b/src/tools/drawTools/vtoolpoint.cpp index c906561b1..87ceb5ced 100644 --- a/src/tools/drawTools/vtoolpoint.cpp +++ b/src/tools/drawTools/vtoolpoint.cpp @@ -30,7 +30,7 @@ const QString VToolPoint::TagName = QStringLiteral("point"); -VToolPoint::VToolPoint(VPattern *doc, VContainer *data, qint64 id, QGraphicsItem *parent):VDrawTool(doc, data, id), +VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent):VDrawTool(doc, data, id), QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0) { namePoint = new VGraphicsSimpleTextItem(this); @@ -96,7 +96,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName) VDrawTool::ChangedActivDraw(newName); } -void VToolPoint::ShowTool(qint64 id, Qt::GlobalColor color, bool enable) +void VToolPoint::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) { ShowItem(this, id, color, enable); } diff --git a/src/tools/drawTools/vtoolpoint.h b/src/tools/drawTools/vtoolpoint.h index 22a48c9be..1a5f0223c 100644 --- a/src/tools/drawTools/vtoolpoint.h +++ b/src/tools/drawTools/vtoolpoint.h @@ -46,7 +46,7 @@ public: * @param id object id in container. * @param parent parent object. */ - VToolPoint(VPattern *doc, VContainer *data, qint64 id, QGraphicsItem * parent = 0); + VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = 0); virtual ~VToolPoint(){} static const QString TagName; public slots: @@ -66,7 +66,7 @@ public slots: * @param color highlight color. * @param enable enable or disable highlight. */ - virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); /** * @brief SetFactor set current scale factor of scene. * @param factor scene scale factor. diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index 261716c9a..21b944bd3 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -32,9 +32,9 @@ const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact"); -VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const qint64 &id, - const QString &radius, const qint64 ¢er, - const qint64 &firstPointId, const qint64 &secondPointId, +VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const quint32 &id, + const QString &radius, const quint32 ¢er, + const quint32 &firstPointId, const quint32 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) : VToolPoint(doc, data, id, parent), arcRadius(radius), center(center), firstPointId(firstPointId), secondPointId(secondPointId) @@ -94,16 +94,16 @@ void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, DialogPointOfContact *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); QString radius = dialogTool->getRadius(); - qint64 center = dialogTool->getCenter(); - qint64 firstPointId = dialogTool->getFirstPoint(); - qint64 secondPointId = dialogTool->getSecondPoint(); + quint32 center = dialogTool->getCenter(); + quint32 firstPointId = dialogTool->getFirstPoint(); + quint32 secondPointId = dialogTool->getSecondPoint(); QString pointName = dialogTool->getPointName(); Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const qint64 ¢er, - const qint64 &firstPointId, const qint64 &secondPointId, +void VToolPointOfContact::Create(const quint32 _id, const QString &radius, const quint32 ¢er, + const quint32 &firstPointId, const quint32 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) @@ -119,7 +119,7 @@ void VToolPointOfContact::Create(const qint64 _id, const QString &radius, const { QPointF fPoint = VToolPointOfContact::FindPoint(toPixel(result), centerP->toQPointF(), firstP->toQPointF(), secondP->toQPointF()); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(new VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); diff --git a/src/tools/drawTools/vtoolpointofcontact.h b/src/tools/drawTools/vtoolpointofcontact.h index 6dd7b5482..45e28d64a 100644 --- a/src/tools/drawTools/vtoolpointofcontact.h +++ b/src/tools/drawTools/vtoolpointofcontact.h @@ -49,9 +49,9 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolPointOfContact(VPattern *doc, VContainer *data, const qint64 &id, - const QString &arcRadius, const qint64 ¢er, - const qint64 &firstPointId, const qint64 &secondPointId, + VToolPointOfContact(VPattern *doc, VContainer *data, const quint32 &id, + const QString &arcRadius, const quint32 ¢er, + const quint32 &firstPointId, const quint32 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -91,8 +91,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &arcRadius, const qint64 ¢er, - const qint64 &firstPointId, const qint64 &secondPointId, const QString &pointName, + static void Create(const quint32 _id, const QString &arcRadius, const quint32 ¢er, + const quint32 &firstPointId, const quint32 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; @@ -141,15 +141,15 @@ private: /** * @brief center id center arc point. */ - qint64 center; + quint32 center; /** * @brief firstPointId id first line point. */ - qint64 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id second line point. */ - qint64 secondPointId; + quint32 secondPointId; }; #endif // VTOOLPOINTOFCONTACT_H diff --git a/src/tools/drawTools/vtoolpointofintersection.cpp b/src/tools/drawTools/vtoolpointofintersection.cpp index 5775196dc..1b1fbaac9 100644 --- a/src/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/tools/drawTools/vtoolpointofintersection.cpp @@ -31,8 +31,8 @@ const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfIntersection"); -VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *data, const qint64 &id, - const qint64 &firstPointId, const qint64 &secondPointId, +VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *data, const quint32 &id, + const quint32 &firstPointId, const quint32 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), firstPointId(firstPointId), secondPointId(secondPointId) { @@ -64,14 +64,14 @@ void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *sc Q_CHECK_PTR(dialog); DialogPointOfIntersection *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - qint64 firstPointId = dialogTool->getFirstPointId(); - qint64 secondPointId = dialogTool->getSecondPointId(); + quint32 firstPointId = dialogTool->getFirstPointId(); + quint32 secondPointId = dialogTool->getSecondPointId(); QString pointName = dialogTool->getPointName(); Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolPointOfIntersection::Create(const qint64 _id, const QString &pointName, const qint64 &firstPointId, - const qint64 &secondPointId, const qreal &mx, const qreal &my, +void VToolPointOfIntersection::Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId, + const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { @@ -79,7 +79,7 @@ void VToolPointOfIntersection::Create(const qint64 _id, const QString &pointName const VPointF *secondPoint = data->GeometricObject(secondPointId); QPointF point(firstPoint->x(), secondPoint->y()); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(new VPointF(point.x(), point.y(), pointName, mx, my)); diff --git a/src/tools/drawTools/vtoolpointofintersection.h b/src/tools/drawTools/vtoolpointofintersection.h index 1692c75e4..8d26f069e 100644 --- a/src/tools/drawTools/vtoolpointofintersection.h +++ b/src/tools/drawTools/vtoolpointofintersection.h @@ -48,8 +48,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolPointOfIntersection(VPattern *doc, VContainer *data, const qint64 &id, - const qint64 &firstPointId, const qint64 &secondPointId, + VToolPointOfIntersection(VPattern *doc, VContainer *data, const quint32 &id, + const quint32 &firstPointId, const quint32 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -77,8 +77,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &pointName, const qint64 &firstPointId, - const qint64 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, + static void Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId, + const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; @@ -119,11 +119,11 @@ private: /** * @brief firstPointId id first line point. */ - qint64 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id second line point. */ - qint64 secondPointId; + quint32 secondPointId; }; #endif // VTOOLPOINTOFINTERSECTION_H diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 04ab02cd3..962298b69 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -32,9 +32,9 @@ const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder"); -VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const qint64 &id, - const QString &typeLine, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, const Tool::Sources &typeCreation, +VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, + const QString &typeLine, const QString &formula, const quint32 &p1Line, + const quint32 &p2Line, const quint32 &pShoulder, const Tool::Sources &typeCreation, QGraphicsItem * parent) :VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), pShoulder(pShoulder) { @@ -95,17 +95,17 @@ void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, V DialogShoulderPoint *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); QString formula = dialogTool->getFormula(); - qint64 p1Line = dialogTool->getP1Line(); - qint64 p2Line = dialogTool->getP2Line(); - qint64 pShoulder = dialogTool->getPShoulder(); + quint32 p1Line = dialogTool->getP1Line(); + quint32 p2Line = dialogTool->getP2Line(); + quint32 pShoulder = dialogTool->getPShoulder(); QString typeLine = dialogTool->getTypeLine(); QString pointName = dialogTool->getPointName(); Create(0, formula, p1Line, p2Line, pShoulder, typeLine, pointName, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const qint64 &p1Line, - const qint64 &p2Line, const qint64 &pShoulder, const QString &typeLine, +void VToolShoulderPoint::Create(const quint32 _id, const QString &formula, const quint32 &p1Line, + const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) @@ -121,7 +121,7 @@ void VToolShoulderPoint::Create(const qint64 _id, const QString &formula, const { QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), shoulderPoint->toQPointF(), toPixel(result)); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(new VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); diff --git a/src/tools/drawTools/vtoolshoulderpoint.h b/src/tools/drawTools/vtoolshoulderpoint.h index 0566a994e..e7414f8f3 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.h +++ b/src/tools/drawTools/vtoolshoulderpoint.h @@ -51,9 +51,9 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolShoulderPoint(VPattern *doc, VContainer *data, const qint64 &id, const QString &typeLine, - const QString &formula, const qint64 &p1Line, const qint64 &p2Line, - const qint64 &pShoulder, const Tool::Sources &typeCreation, + VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const QString &formula, const quint32 &p1Line, const quint32 &p2Line, + const quint32 &pShoulder, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -94,8 +94,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &formula, const qint64 &p1Line, const qint64 &p2Line, - const qint64 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, + static void Create(const quint32 _id, const QString &formula, const quint32 &p1Line, const quint32 &p2Line, + const quint32 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString ToolType; @@ -140,11 +140,11 @@ private: /** * @brief p2Line id second line point. */ - qint64 p2Line; + quint32 p2Line; /** * @brief pShoulder id shoulder line point. */ - qint64 pShoulder; + quint32 pShoulder; }; #endif // VTOOLSHOULDERPOINT_H diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index f470b4d1f..5960111f1 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -31,7 +31,7 @@ const QString VToolSinglePoint::ToolType = QStringLiteral("single"); -VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, +VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, QGraphicsItem * parent ) :VToolPoint(doc, data, id, parent) { diff --git a/src/tools/drawTools/vtoolsinglepoint.h b/src/tools/drawTools/vtoolsinglepoint.h index 2e09e0353..c09751f46 100644 --- a/src/tools/drawTools/vtoolsinglepoint.h +++ b/src/tools/drawTools/vtoolsinglepoint.h @@ -47,7 +47,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolSinglePoint (VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, + VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0 ); /** * @brief setDialog set dialog when user want change tool option. diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index cada66ebe..c5795b2c0 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -33,7 +33,7 @@ const QString VToolSpline::TagName = QStringLiteral("spline"); const QString VToolSpline::ToolType = QStringLiteral("simple"); -VToolSpline::VToolSpline(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, +VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector()) { @@ -96,8 +96,8 @@ void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern Q_CHECK_PTR(dialog); DialogSpline *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - qint64 p1 = dialogTool->getP1(); - qint64 p4 = dialogTool->getP4(); + quint32 p1 = dialogTool->getP1(); + quint32 p4 = dialogTool->getP4(); qreal kAsm1 = dialogTool->getKAsm1(); qreal kAsm2 = dialogTool->getKAsm2(); qreal angle1 = dialogTool->getAngle1(); @@ -107,7 +107,7 @@ void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern Tool::FromGui); } -void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, +void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) @@ -116,7 +116,7 @@ void VToolSpline::Create(const qint64 _id, const qint64 &p1, const qint64 &p4, c VPointF point4 = *data->GeometricObject(p4); VSpline *spline = new VSpline(point1, point4, angle1, angle2, kAsm1, kAsm2, kCurve); Q_CHECK_PTR(spline); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(spline); @@ -355,7 +355,7 @@ void VToolSpline::ChangedActivDraw(const QString &newName) VDrawTool::ChangedActivDraw(newName); } -void VToolSpline::ShowTool(qint64 id, Qt::GlobalColor color, bool enable) +void VToolSpline::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) { ShowItem(this, id, color, enable); } diff --git a/src/tools/drawTools/vtoolspline.h b/src/tools/drawTools/vtoolspline.h index ce15a1500..5b40d582f 100644 --- a/src/tools/drawTools/vtoolspline.h +++ b/src/tools/drawTools/vtoolspline.h @@ -49,7 +49,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolSpline (VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, + VToolSpline (VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0 ); /** * @brief setDialog set dialog when user want change tool option. @@ -79,7 +79,7 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const qint64 &p1, const qint64 &p4, const qreal &kAsm1, + static void Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); @@ -124,7 +124,7 @@ public slots: * @param color highlight color. * @param enable enable or disable highlight. */ - virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); /** * @brief SetFactor set current scale factor of scene. * @param factor scene scale factor. diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index 587854374..caa09ffb0 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -32,7 +32,7 @@ const QString VToolSplinePath::TagName = QStringLiteral("spline"); const QString VToolSplinePath::ToolType = QStringLiteral("path"); -VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, +VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector()) { @@ -98,11 +98,11 @@ void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPat Create(0, path, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolSplinePath::Create(const qint64 _id, VSplinePath *path, VMainGraphicsScene *scene, +void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(path); @@ -209,7 +209,7 @@ void VToolSplinePath::ChangedActivDraw(const QString &newName) VDrawTool::ChangedActivDraw(newName); } -void VToolSplinePath::ShowTool(qint64 id, Qt::GlobalColor color, bool enable) +void VToolSplinePath::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) { ShowItem(this, id, color, enable); } diff --git a/src/tools/drawTools/vtoolsplinepath.h b/src/tools/drawTools/vtoolsplinepath.h index 77398eba1..4374934e1 100644 --- a/src/tools/drawTools/vtoolsplinepath.h +++ b/src/tools/drawTools/vtoolsplinepath.h @@ -48,7 +48,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolSplinePath(VPattern *doc, VContainer *data, qint64 id, const Tool::Sources &typeCreation, + VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -72,7 +72,7 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, VSplinePath *path, VMainGraphicsScene *scene, + static void Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; @@ -116,7 +116,7 @@ public slots: * @param color highlight color. * @param enable enable or disable highlight. */ - virtual void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); /** * @brief SetFactor set current scale factor of scene. * @param factor scene scale factor. diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index 4dd50e717..8fd15aa2f 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -31,9 +31,9 @@ const QString VToolTriangle::ToolType = QStringLiteral("triangle"); -VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const qint64 &id, - const qint64 &axisP1Id, const qint64 &axisP2Id, const qint64 &firstPointId, - const qint64 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) +VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, + const quint32 &axisP1Id, const quint32 &axisP2Id, const quint32 &firstPointId, + const quint32 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId), secondPointId(secondPointId) { @@ -67,17 +67,17 @@ void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene, Q_CHECK_PTR(dialog); DialogTriangle *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); - qint64 axisP1Id = dialogTool->getAxisP1Id(); - qint64 axisP2Id = dialogTool->getAxisP2Id(); - qint64 firstPointId = dialogTool->getFirstPointId(); - qint64 secondPointId = dialogTool->getSecondPointId(); + quint32 axisP1Id = dialogTool->getAxisP1Id(); + quint32 axisP2Id = dialogTool->getAxisP2Id(); + quint32 firstPointId = dialogTool->getFirstPointId(); + quint32 secondPointId = dialogTool->getSecondPointId(); QString pointName = dialogTool->getPointName(); Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolTriangle::Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, - const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, +void VToolTriangle::Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id, + const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { @@ -88,7 +88,7 @@ void VToolTriangle::Create(const qint64 _id, const QString &pointName, const qin QPointF point = FindPoint(axisP1->toQPointF(), axisP2->toQPointF(), firstPoint->toQPointF(), secondPoint->toQPointF()); - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->AddGObject(new VPointF(point.x(), point.y(), pointName, mx, my)); diff --git a/src/tools/drawTools/vtooltriangle.h b/src/tools/drawTools/vtooltriangle.h index 9d6c4fc2d..03913eed0 100644 --- a/src/tools/drawTools/vtooltriangle.h +++ b/src/tools/drawTools/vtooltriangle.h @@ -50,8 +50,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolTriangle(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &axisP1Id, - const qint64 &axisP2Id, const qint64 &firstPointId, const qint64 &secondPointId, + VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &axisP1Id, + const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); /** * @brief setDialog set dialog when user want change tool option. @@ -81,8 +81,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const QString &pointName, const qint64 &axisP1Id, const qint64 &axisP2Id, - const qint64 &firstPointId, const qint64 &secondPointId, const qreal &mx, const qreal &my, + static void Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id, const quint32 &axisP2Id, + const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); /** @@ -133,19 +133,19 @@ private: /** * @brief axisP1Id id first axis point. */ - qint64 axisP1Id; + quint32 axisP1Id; /** * @brief axisP2Id id second axis point. */ - qint64 axisP2Id; + quint32 axisP2Id; /** * @brief firstPointId id first triangle point, what lies on the hypotenuse. */ - qint64 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id second triangle point, what lies on the hypotenuse. */ - qint64 secondPointId; + quint32 secondPointId; }; #endif // VTOOLTRIANGLE_H diff --git a/src/tools/nodeDetails/vabstractnode.cpp b/src/tools/nodeDetails/vabstractnode.cpp index 43f39520c..ad3cb74a0 100644 --- a/src/tools/nodeDetails/vabstractnode.cpp +++ b/src/tools/nodeDetails/vabstractnode.cpp @@ -32,8 +32,8 @@ const QString VAbstractNode::AttrIdObject = QStringLiteral("idObject"); const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool"); -VAbstractNode::VAbstractNode(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &idNode, - const qint64 &idTool, QObject *parent) +VAbstractNode::VAbstractNode(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode, + const quint32 &idTool, QObject *parent) : VAbstractTool(doc, data, id, parent), idNode(idNode), idTool(idTool) { _referens = 0; diff --git a/src/tools/nodeDetails/vabstractnode.h b/src/tools/nodeDetails/vabstractnode.h index 181cfd165..8fc0ced14 100644 --- a/src/tools/nodeDetails/vabstractnode.h +++ b/src/tools/nodeDetails/vabstractnode.h @@ -46,8 +46,8 @@ public: * @param id object id in containerNode. * @param parent parent object. */ - VAbstractNode(VPattern *doc, VContainer *data, const qint64 &id, const qint64 &idNode, - const qint64 &idTool, QObject *parent = 0); + VAbstractNode(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode, + const quint32 &idTool, QObject *parent = 0); virtual ~VAbstractNode() {} static const QString AttrIdObject; static const QString AttrIdTool; @@ -56,11 +56,11 @@ protected: /** * @brief idNodenode id. */ - qint64 idNode; + quint32 idNode; /** * @brief idTool id tool. */ - qint64 idTool; + quint32 idTool; /** * @brief AddToModeling add tag to modeling tag current pattern peace. * @param domElement tag. diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index fe2516375..8548e93f7 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -33,8 +33,8 @@ const QString VNodeArc::TagName = QStringLiteral("arc"); const QString VNodeArc::ToolType = QStringLiteral("modeling"); -VNodeArc::VNodeArc(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, const Tool::Sources &typeCreation, - const qint64 &idTool, QObject *qoParent, QGraphicsItem *parent) +VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Tool::Sources &typeCreation, + const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent) :VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); @@ -50,8 +50,8 @@ VNodeArc::VNodeArc(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, con } } -void VNodeArc::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse, - const Tool::Sources &typeCreation, const qint64 &idTool, QObject *parent) +void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document::Documents &parse, + const Tool::Sources &typeCreation, const quint32 &idTool, QObject *parent) { VAbstractTool::AddRecord(id, Tool::NodeArc, doc); if (parse == Document::FullParse) diff --git a/src/tools/nodeDetails/vnodearc.h b/src/tools/nodeDetails/vnodearc.h index 6ab04e358..34ff14e4c 100644 --- a/src/tools/nodeDetails/vnodearc.h +++ b/src/tools/nodeDetails/vnodearc.h @@ -48,8 +48,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VNodeArc(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, - const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, + VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, + const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = 0, QGraphicsItem * parent = 0); /** * @brief Create help create tool. @@ -60,8 +60,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(VPattern *doc, VContainer *data, qint64 id, qint64 idArc, const Document::Documents &parse, - const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *parent = 0); + static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document::Documents &parse, + const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *parent = 0); static const QString TagName; static const QString ToolType; /** diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index a3d7ffd14..4a10d8508 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -33,8 +33,8 @@ const QString VNodePoint::TagName = QStringLiteral("point"); const QString VNodePoint::ToolType = QStringLiteral("modeling"); -VNodePoint::VNodePoint(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint, - const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent, +VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, + const Tool::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent) :VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(0), lineName(0) @@ -58,8 +58,8 @@ VNodePoint::VNodePoint(VPattern *doc, VContainer *data, qint64 id, qint64 idPoin } } -void VNodePoint::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint, - const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool, +void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, + const Document::Documents &parse, const Tool::Sources &typeCreation, const quint32 &idTool, QObject *parent) { VAbstractTool::AddRecord(id, Tool::NodePoint, doc); diff --git a/src/tools/nodeDetails/vnodepoint.h b/src/tools/nodeDetails/vnodepoint.h index ea66884c7..cea90ffd3 100644 --- a/src/tools/nodeDetails/vnodepoint.h +++ b/src/tools/nodeDetails/vnodepoint.h @@ -48,8 +48,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VNodePoint(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint, - const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, + VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, + const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = 0, QGraphicsItem * parent = 0 ); /** * @brief Create help create tool. @@ -60,8 +60,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(VPattern *doc, VContainer *data, qint64 id, qint64 idPoint, - const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0, + static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, + const Document::Documents &parse, const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *parent = 0); static const QString TagName; static const QString ToolType; diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index 778cf3c62..13c04cf02 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -33,8 +33,8 @@ const QString VNodeSpline::TagName = QStringLiteral("spline"); const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline"); -VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, - const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent, +VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, + const Tool::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, QGraphicsItem * parent) :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) { @@ -51,9 +51,9 @@ VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, qint64 id, qint64 idSp } } -VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, +VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Document::Documents &parse, const Tool::Sources &typeCreation, - const qint64 &idTool, QObject *parent) + const quint32 &idTool, QObject *parent) { VAbstractTool::AddRecord(id, Tool::NodeSpline, doc); VNodeSpline *spl = 0; diff --git a/src/tools/nodeDetails/vnodespline.h b/src/tools/nodeDetails/vnodespline.h index aebc2b3c4..a7b1b1729 100644 --- a/src/tools/nodeDetails/vnodespline.h +++ b/src/tools/nodeDetails/vnodespline.h @@ -48,8 +48,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VNodeSpline(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, - const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, + VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, + const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = 0, QGraphicsItem * parent = 0); /** * @brief Create help create tool. @@ -61,9 +61,9 @@ public: * @param typeCreation way we create this tool. * @return */ - static VNodeSpline *Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, + static VNodeSpline *Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Document::Documents &parse, const Tool::Sources &typeCreation, - const qint64 &idTool = 0, QObject *parent = 0); + const quint32 &idTool = 0, QObject *parent = 0); static const QString TagName; static const QString ToolType; /** diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index db5effcfd..9f5000ef6 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -33,8 +33,8 @@ const QString VNodeSplinePath::TagName = QStringLiteral("spline"); const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); -VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, - const Tool::Sources &typeCreation, const qint64 &idTool, QObject *qoParent, +VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, + const Tool::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, QGraphicsItem * parent) :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) { @@ -51,8 +51,8 @@ VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, qint64 id, qin } } -void VNodeSplinePath::Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, - const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool, +void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, + const Document::Documents &parse, const Tool::Sources &typeCreation, const quint32 &idTool, QObject *parent) { VAbstractTool::AddRecord(id, Tool::NodeSplinePath, doc); diff --git a/src/tools/nodeDetails/vnodesplinepath.h b/src/tools/nodeDetails/vnodesplinepath.h index 5f35b8607..248773d6f 100644 --- a/src/tools/nodeDetails/vnodesplinepath.h +++ b/src/tools/nodeDetails/vnodesplinepath.h @@ -48,8 +48,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VNodeSplinePath(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, - const Tool::Sources &typeCreation, const qint64 &idTool = 0, QObject *qoParent = 0, + VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, + const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = 0, QGraphicsItem * parent = 0); /** * @brief Create help create tool. @@ -60,8 +60,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(VPattern *doc, VContainer *data, qint64 id, qint64 idSpline, - const Document::Documents &parse, const Tool::Sources &typeCreation, const qint64 &idTool = 0, + static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, + const Document::Documents &parse, const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *parent = 0); static const QString TagName; static const QString ToolType; diff --git a/src/tools/vabstracttool.cpp b/src/tools/vabstracttool.cpp index b1cc2a69c..7a1ede620 100644 --- a/src/tools/vabstracttool.cpp +++ b/src/tools/vabstracttool.cpp @@ -69,7 +69,7 @@ const QString VAbstractTool::TypeLineDotLine = QStringLiteral("dotLine"); const QString VAbstractTool::TypeLineDashDotLine = QStringLiteral("dashDotLine"); const QString VAbstractTool::TypeLineDashDotDotLine = QStringLiteral("dashDotDotLine"); -VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, qint64 id, QObject *parent) +VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent) :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), currentColor(Qt::black), typeLine(TypeLineLine) { Q_CHECK_PTR(doc); @@ -303,9 +303,9 @@ const QStringList VAbstractTool::Styles() return styles; } -void VAbstractTool::AddRecord(const qint64 id, const Tool::Tools &toolType, VPattern *doc) +void VAbstractTool::AddRecord(const quint32 id, const Tool::Tools &toolType, VPattern *doc) { - qint64 cursor = doc->getCursor(); + quint32 cursor = doc->getCursor(); QVector *history = doc->getHistory(); if (cursor <= 0) { diff --git a/src/tools/vabstracttool.h b/src/tools/vabstracttool.h index b866e14c0..13b170661 100644 --- a/src/tools/vabstracttool.h +++ b/src/tools/vabstracttool.h @@ -47,7 +47,7 @@ public: * @param id object id in container. * @param parent parent object. */ - VAbstractTool(VPattern *doc, VContainer *data, qint64 id, QObject *parent = 0); + VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent = 0); virtual ~VAbstractTool(){} /** * @brief NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view. @@ -93,7 +93,7 @@ public: * @brief getId return object id. * @return id. */ - inline qint64 getId() const {return id;} + inline quint32 getId() const {return id;} /** * @brief LineCoefficients coefficient for equation of segment. Segment equestion ax+by+c=0. * @param line line @@ -153,7 +153,7 @@ public: * @param toolType tool type * @param doc dom document container */ - static void AddRecord(const qint64 id, const Tool::Tools &toolType, VPattern *doc); + static void AddRecord(const quint32 id, const Tool::Tools &toolType, VPattern *doc); public slots: /** * @brief FullUpdateFromFile update tool data form file. @@ -169,7 +169,7 @@ signals: * @param id object id in container. * @param type type of scene object. */ - void ChoosedTool(qint64 id, Scene::Scenes type); + void ChoosedTool(quint32 id, Scene::Scenes type); /** * @brief FullUpdateTree emit if need reparse pattern file. */ @@ -182,7 +182,7 @@ protected: /** * @brief id object id. */ - const qint64 id; + const quint32 id; /** * @brief baseColor base color for tool. */ diff --git a/src/tools/vdatatool.h b/src/tools/vdatatool.h index 34fbdd5b7..6f6c5a6c3 100644 --- a/src/tools/vdatatool.h +++ b/src/tools/vdatatool.h @@ -66,7 +66,7 @@ public: * @brief referens return count of referens. * @return count count of referens. */ - virtual inline qint64 referens() const {return _referens;} + virtual inline quint32 referens() const {return _referens;} /** * @brief incrementReferens increment referens. */ @@ -83,7 +83,7 @@ protected: /** * @brief _referens keep count tools what use this tool. If value more than 1 you can't delete tool. */ - qint64 _referens; + quint32 _referens; }; #endif // VDATATOOL_H diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index 278e2713a..a07ca47f4 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -40,7 +40,7 @@ const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType"); const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour"); const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling"); -VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const qint64 &id, const Tool::Sources &typeCreation, +VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Tool::Sources &typeCreation, VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(0), sceneDetails(scene) { @@ -102,7 +102,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern VDetail det; for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) { - qint64 id = 0; + quint32 id = 0; switch (detail[i].getTypeTool()) { case (Tool::NodePoint): @@ -140,10 +140,10 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern Create(0, det, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolDetail::Create(const qint64 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VPattern *doc, +void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui || typeCreation == Tool::FromTool) { id = data->AddDetail(newDetail); @@ -162,7 +162,7 @@ void VToolDetail::Create(const qint64 &_id, const VDetail &newDetail, VMainGraph VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene); scene->addItem(detail); connect(detail, &VToolDetail::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - QHash* tools = doc->getTools(); + QHash* tools = doc->getTools(); tools->insert(id, detail); } } @@ -198,8 +198,8 @@ void VToolDetail::FullUpdateFromGui(int result) AddNode(domElement, det[i]); } VDetail detail = VAbstractTool::data.GetDetail(id); - QList list = detail.Missing(det); - QHash* tools = doc->getTools(); + QList list = detail.Missing(det); + QHash* tools = doc->getTools(); if (list.size()>0) { for (qint32 i = 0; i < list.size(); ++i) @@ -404,7 +404,7 @@ template //cppcheck-suppress unusedFunction void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node) { - QHash* tools = doc->getTools(); + QHash* tools = doc->getTools(); Q_CHECK_PTR(tools); Tool *tool = qobject_cast(tools->value(node.getId())); Q_CHECK_PTR(tool); diff --git a/src/tools/vtooldetail.h b/src/tools/vtooldetail.h index 5983c8db7..9d6f856e6 100644 --- a/src/tools/vtooldetail.h +++ b/src/tools/vtooldetail.h @@ -49,7 +49,7 @@ public: * @param scene pointer to scene. * @param parent parent object */ - VToolDetail(VPattern *doc, VContainer *data, const qint64 &id, const Tool::Sources &typeCreation, + VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Tool::Sources &typeCreation, VMainGraphicsScene *scene, QGraphicsItem * parent = 0); ~VToolDetail(); /** @@ -63,7 +63,7 @@ public: * @param id id parent object. * @return id for new object. */ - static qint64 CreateNode(VContainer *data, const qint64 &id) + static quint32 CreateNode(VContainer *data, const quint32 &id) { //We can't use exist object. Need create new. T *node = new T(*data->GeometricObject(id)); @@ -90,7 +90,7 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, + static void Create(const quint32 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index 9ecde2a06..092e08f85 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -41,8 +41,8 @@ const QString VToolUnionDetails::AttrNodeType = QStringLiteral("nodeType"); const QString VToolUnionDetails::NodeTypeContour = QStringLiteral("Contour"); const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling"); -VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const qint64 &id, const VDetail &d1, - const VDetail &d2, const ptrdiff_t &indexD1, const ptrdiff_t &indexD2, +VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, + const VDetail &d2, const quint32 &indexD1, const quint32 &indexD2, const Tool::Sources &typeCreation, QObject *parent) :VAbstractTool(doc, data, id, parent), d1(d1), d2(d2), indexD1(indexD1), indexD2(indexD2) { @@ -57,10 +57,10 @@ VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const qint } void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail, - const VDetail &det, const ptrdiff_t &i, const qint64 &idTool, const qreal &dx, - const qreal &dy, const qint64 &pRotate, const qreal &angle) + const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx, + const qreal &dy, const quint32 &pRotate, const qreal &angle) { - qint64 id = 0, idObject = 0; + quint32 id = 0, idObject = 0; switch (det.at(i).getTypeTool()) { case (Tool::NodePoint): @@ -106,7 +106,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer QLineF l1(center->toQPointF(), p1.toQPointF()); QLineF l2(center->toQPointF(), p2.toQPointF()); center->setMode(Draw::Modeling); - qint64 idCenter = data->AddGObject(center); + quint32 idCenter = data->AddGObject(center); Q_UNUSED(idCenter); VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(), QString().setNum(l1.angle()), l2.angle(), @@ -137,7 +137,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer VPointF *p1 = new VPointF(spline->GetP1()); Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); - qint64 idP1 = data->AddGObject(p1); + quint32 idP1 = data->AddGObject(p1); VPointF p2 = VPointF(spline->GetP2()); BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); @@ -148,7 +148,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer VPointF *p4 = new VPointF(spline->GetP4()); Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); - qint64 idP4 = data->AddGObject(p4); + quint32 idP4 = data->AddGObject(p4); VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, Draw::Modeling); @@ -186,7 +186,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); - qint64 idP1 = data->AddGObject(p1); + quint32 idP1 = data->AddGObject(p1); --k; VPointF p2 = VPointF(spline.GetP2()); @@ -201,7 +201,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); - qint64 idP4 = data->AddGObject(p4); + quint32 idP4 = data->AddGObject(p4); --k; VSpline spl = VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline.GetKcurve()); @@ -235,8 +235,8 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer newDetail.append(VNodeDetail(id, det.at(i).getTypeTool(), NodeDetail::Contour)); } -void VToolUnionDetails::UpdatePoints(const qint64 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i, - qint64 &idCount, const qreal &dx, const qreal &dy, const qint64 &pRotate, +void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i, + quint32 &idCount, const qreal &dx, const qreal &dy, const quint32 &pRotate, const qreal &angle) { switch (det.at(i).getTypeTool()) @@ -415,13 +415,13 @@ void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VP Tool::FromGui); } -void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetail &d2, const qint64 &d1id, - const qint64 &d2id, const ptrdiff_t &indexD1, const ptrdiff_t &indexD2, +void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, + const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { VToolUnionDetails *unionDetails = 0; - qint64 id = _id; + quint32 id = _id; if (typeCreation == Tool::FromGui) { id = data->getNextId(); @@ -438,7 +438,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai { //Scene doesn't show this tool, so doc will destroy this object. unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, doc); - QHash* tools = doc->getTools(); + QHash* tools = doc->getTools(); tools->insert(id, unionDetails); for (ptrdiff_t i = 0; i < d1.CountNode(); ++i) { @@ -528,7 +528,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai newDetail.setName("Detail"); VToolDetail::Create(0, newDetail, scene, doc, data, parse, Tool::FromTool); - QHash* tools = doc->getTools(); + QHash* tools = doc->getTools(); VToolDetail *toolDet = qobject_cast(tools->value(d1id)); toolDet->Remove(); @@ -540,7 +540,7 @@ void VToolUnionDetails::Create(const qint64 _id, const VDetail &d1, const VDetai { VDetail uD1 = d1.RemoveEdge(indexD1); VDetail uD2 = d2.RemoveEdge(indexD2); - qint64 idCount = 0; + quint32 idCount = 0; qint32 j = 0, i = 0; qint32 nD1 = uD1.CountNode(); qint32 nD2 = uD2.CountNode(); @@ -635,7 +635,7 @@ QVector VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomE { if (element.tagName() == VToolUnionDetails::TagNode) { - qint64 id = doc->GetParametrLongLong(element, VToolDetail::AttrIdObject, "0"); + quint32 id = doc->GetParametrUInt(element, VToolDetail::AttrIdObject, "0"); qreal mx = toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); qreal my = toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); Tool::Tools tool; diff --git a/src/tools/vtooluniondetails.h b/src/tools/vtooluniondetails.h index d8d507b01..aae979e7b 100644 --- a/src/tools/vtooluniondetails.h +++ b/src/tools/vtooluniondetails.h @@ -51,9 +51,9 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolUnionDetails(VPattern *doc, VContainer *data, const qint64 &id, const VDetail &d1, const VDetail &d2, - const ptrdiff_t &indexD1, const ptrdiff_t &indexD2, - const Tool::Sources &typeCreation, QObject *parent = 0); + VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, const VDetail &d2, + const quint32 &indexD1, const quint32 &indexD2, const Tool::Sources &typeCreation, + QObject *parent = 0); /** * @brief setDialog set dialog when user want change tool option. */ @@ -80,10 +80,9 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const qint64 _id, const VDetail &d1, const VDetail &d2, const qint64 &d1id, const qint64 &d2id, - const ptrdiff_t &indexD1, const ptrdiff_t &indexD2, VMainGraphicsScene *scene, - VPattern *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); + static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, const quint32 &d2id, + const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, VPattern *doc, + VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); /** * @brief GetDetailFromFile parse detail from file. * @param doc dom document container. @@ -116,8 +115,8 @@ public: * @param angle angle rotation. */ static void AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail, - const VDetail &det, const ptrdiff_t &i, const qint64 &idTool, const qreal &dx = 0, - const qreal &dy = 0, const qint64 &pRotate = 0, const qreal &angle = 0); + const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx = 0, + const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0); /** * @brief UpdatePoints update data for united details. * @param idDetail id united detail. @@ -130,8 +129,8 @@ public: * @param pRotate point rotation. * @param angle angle rotation. */ - static void UpdatePoints(const qint64 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i, - qint64 &idCount, const qreal &dx = 0, const qreal &dy = 0, const qint64 &pRotate = 0, + static void UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i, + quint32 &idCount, const qreal &dx = 0, const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0); /** * @brief BiasRotatePoint bias and rotate point. @@ -170,11 +169,11 @@ private: /** * @brief indexD1 index edge in first detail. */ - ptrdiff_t indexD1; + quint32 indexD1; /** * @brief indexD2 index edge in second detail. */ - ptrdiff_t indexD2; + quint32 indexD2; /** * @brief AddDetail add detail to xml file. * @param domElement tag in xml tree. diff --git a/src/widgets/vmaingraphicsscene.cpp b/src/widgets/vmaingraphicsscene.cpp index e2bd07775..7b1b9320d 100644 --- a/src/widgets/vmaingraphicsscene.cpp +++ b/src/widgets/vmaingraphicsscene.cpp @@ -62,7 +62,7 @@ void VMainGraphicsScene::setTransform(const QTransform &transform) _transform = transform; } -void VMainGraphicsScene::ChoosedItem(qint64 id, const Scene::Scenes &type) +void VMainGraphicsScene::ChoosedItem(quint32 id, const Scene::Scenes &type) { emit ChoosedObject(id, type); } diff --git a/src/widgets/vmaingraphicsscene.h b/src/widgets/vmaingraphicsscene.h index d8f1cd9c2..49b134cf8 100644 --- a/src/widgets/vmaingraphicsscene.h +++ b/src/widgets/vmaingraphicsscene.h @@ -85,7 +85,7 @@ public slots: * @param id object id. * @param type object scene type. */ - void ChoosedItem(qint64 id, const Scene::Scenes &type); + void ChoosedItem(quint32 id, const Scene::Scenes &type); /** * @brief SetFactor set current scale factor of scene. * @param factor scene scale factor. scene scale factor. @@ -118,7 +118,7 @@ signals: * @param id object id. * @param type object scene type. */ - void ChoosedObject(qint64 id, Scene::Scenes type); + void ChoosedObject(quint32 id, Scene::Scenes type); /** * @brief NewFactor send new scale factor. * @param factor scene scale factor. diff --git a/src/widgets/vsimplearc.cpp b/src/widgets/vsimplearc.cpp index b9151da3e..f6cf369eb 100644 --- a/src/widgets/vsimplearc.cpp +++ b/src/widgets/vsimplearc.cpp @@ -28,7 +28,7 @@ #include "vsimplearc.h" -VSimpleArc::VSimpleArc(qint64 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) +VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) { if (factor == 0) diff --git a/src/widgets/vsimplearc.h b/src/widgets/vsimplearc.h index 408d12f6e..32665a254 100644 --- a/src/widgets/vsimplearc.h +++ b/src/widgets/vsimplearc.h @@ -55,13 +55,13 @@ public: * @param factor scale factor. * @param parent parent object. */ - VSimpleArc(qint64 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0); + VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0); signals: /** * @brief Choosed send id when clicked. * @param id arc id. */ - void Choosed(qint64 id); + void Choosed(quint32 id); protected: /** * @brief mouseReleaseEvent handle mouse release events. @@ -83,7 +83,7 @@ private: /** * @brief id arc id. */ - qint64 id; + quint32 id; /** * @brief factor scale factor. */ diff --git a/src/widgets/vsimplespline.cpp b/src/widgets/vsimplespline.cpp index c77be792a..3e5d2d063 100644 --- a/src/widgets/vsimplespline.cpp +++ b/src/widgets/vsimplespline.cpp @@ -29,7 +29,7 @@ #include "vsimplespline.h" #include "../options.h" -VSimpleSpline::VSimpleSpline(qint64 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) +VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) { if (factor == 0) diff --git a/src/widgets/vsimplespline.h b/src/widgets/vsimplespline.h index d6c8ae2cc..4853c1cbe 100644 --- a/src/widgets/vsimplespline.h +++ b/src/widgets/vsimplespline.h @@ -55,13 +55,13 @@ public: * @param currentColor current color. * @param parent parent object. */ - VSimpleSpline(qint64 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0); + VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0); signals: /** * @brief Choosed send id when clicked. * @param id spline id. */ - void Choosed(qint64 id); + void Choosed(quint32 id); protected: /** * @brief mouseReleaseEvent handle mouse release events. @@ -83,7 +83,7 @@ private: /** * @brief id spline id. */ - qint64 id; + quint32 id; /** * @brief factor scale factor. */ diff --git a/src/widgets/vsimplesplinepath.cpp b/src/widgets/vsimplesplinepath.cpp index 1488fb1d8..5be43d00d 100644 --- a/src/widgets/vsimplesplinepath.cpp +++ b/src/widgets/vsimplesplinepath.cpp @@ -28,7 +28,7 @@ #include "vsimplesplinepath.h" -VSimpleSplinePath::VSimpleSplinePath(VPattern *doc, VContainer *data, qint64 id, qreal *factor) +VSimpleSplinePath::VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor) :VAbstractTool(doc, data, id), factor(factor) { } diff --git a/src/widgets/vsimplesplinepath.h b/src/widgets/vsimplesplinepath.h index ae7af4fa7..6cb9df94b 100644 --- a/src/widgets/vsimplesplinepath.h +++ b/src/widgets/vsimplesplinepath.h @@ -47,7 +47,7 @@ public: * @param id spline path id. * @param factor scale factor. */ - VSimpleSplinePath(VPattern *doc, VContainer *data, qint64 id, qreal *factor); + VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor); protected: /** * @brief mouseReleaseEvent handle mouse release events. diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index 97155f9a5..041330daf 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -100,17 +100,16 @@ bool VDomDocument::find(const QDomElement &node, const QString& id) return false; } -qint64 VDomDocument::GetParametrLongLong(const QDomElement &domElement, const QString &name, - const QString &defValue) const +quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QString &name, const QString &defValue) const { Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); bool ok = false; const QString parametr = GetParametrString(domElement, name, defValue); - const qint64 id = parametr.toLongLong(&ok); + const quint32 id = parametr.toUInt(&ok); if (ok == false) { - throw VExceptionConversionError(tr("Can't convert toLongLong parameter"), name); + throw VExceptionConversionError(tr("Can't convert toUInt parameter"), name); } return id; } diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index de30543de..2b510dd66 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -83,7 +83,7 @@ public: * @param name attribute name. * @return long long value. */ - qint64 GetParametrLongLong(const QDomElement& domElement, const QString &name, + quint32 GetParametrUInt(const QDomElement& domElement, const QString &name, const QString &defValue) const; /** * @brief GetParametrString return string value of attribute. diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index 9b152c98b..ae0cd3314 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -49,7 +49,7 @@ const QString VPattern::TagDraw = QStringLiteral("draw"); const QString VPattern::AttrName = QStringLiteral("name"); VPattern::VPattern(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent) - : QObject(parent), VDomDocument(data), nameActivDraw(QString()), tools(QHash()), + : QObject(parent), VDomDocument(data), nameActivDraw(QString()), tools(QHash()), history(QVector()), cursor(0), comboBoxDraws(comboBoxDraws), mode(mode), patternModified(false) { } @@ -202,7 +202,7 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene } } -VDataTool *VPattern::getTool(const qint64 &id) +VDataTool *VPattern::getTool(const quint32 &id) { if (tools.contains(id)) { @@ -216,7 +216,7 @@ VDataTool *VPattern::getTool(const qint64 &id) return 0; } -void VPattern::setCursor(const qint64 &value) +void VPattern::setCursor(const quint32 &value) { cursor = value; emit ChangedCursor(cursor); @@ -230,7 +230,7 @@ void VPattern::setCurrentData() if (nameActivDraw != nameDraw) { nameActivDraw = nameDraw; - qint64 id = 0; + quint32 id = 0; if (history.size() == 0) { return; @@ -261,14 +261,14 @@ void VPattern::setCurrentData() } } -void VPattern::AddTool(const qint64 &id, VDataTool *tool) +void VPattern::AddTool(const quint32 &id, VDataTool *tool) { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_CHECK_PTR(tool); tools.insert(id, tool); } -void VPattern::UpdateToolData(const qint64 &id, VContainer *data) +void VPattern::UpdateToolData(const quint32 &id, VContainer *data) { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); Q_CHECK_PTR(data); @@ -277,7 +277,7 @@ void VPattern::UpdateToolData(const qint64 &id, VContainer *data) tool->VDataTool::setData(data); } -void VPattern::IncrementReferens(qint64 id) const +void VPattern::IncrementReferens(quint32 id) const { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); VDataTool *tool = tools.value(id); @@ -285,7 +285,7 @@ void VPattern::IncrementReferens(qint64 id) const tool->incrementReferens(); } -void VPattern::DecrementReferens(qint64 id) const +void VPattern::DecrementReferens(quint32 id) const { Q_ASSERT_X(id > 0, Q_FUNC_INFO, "id <= 0"); VDataTool *tool = tools.value(id); @@ -295,11 +295,11 @@ void VPattern::DecrementReferens(qint64 id) const void VPattern::TestUniqueId() const { - QVector vector; + QVector vector; CollectId(documentElement(), vector); } -qint64 VPattern::SPointActiveDraw() +quint32 VPattern::SPointActiveDraw() { QDomElement calcElement; if (GetActivNodeElement(TagCalculation, calcElement)) @@ -411,7 +411,7 @@ void VPattern::haveLiteChange() emit patternChanged(); } -void VPattern::ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable) +void VPattern::ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable) { emit ShowTool(id, color, enable); } @@ -504,13 +504,13 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle try { VDetail detail; - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); detail.setName(GetParametrString(domElement, VAbstractTool::AttrName, "")); detail.setMx(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0"))); detail.setMy(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "0.0"))); - detail.setSeamAllowance(GetParametrLongLong(domElement, VToolDetail::AttrSupplement, "1")); + detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1")); detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0")); - detail.setClosed(GetParametrLongLong(domElement, VToolDetail::AttrClosed, "1")); + detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1")); const QDomNodeList nodeList = domElement.childNodes(); const qint32 num = nodeList.size(); @@ -521,7 +521,7 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle { if (element.tagName() == VToolDetail::TagNode) { - const qint64 id = GetParametrLongLong(element, VToolDetail::AttrIdObject, "0"); + const quint32 id = GetParametrUInt(element, VToolDetail::AttrIdObject, "0"); const qreal mx = toPixel(GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); const qreal my = toPixel(GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); const NodeDetail::NodeDetails nodeType = NodeDetail::Contour; @@ -600,7 +600,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d VToolSinglePoint *spoint = 0; try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "A"); const qreal x = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrX, "10.0")); const qreal y = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0")); @@ -636,14 +636,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 1: //VToolEndLine::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); - const qint64 basePointId = GetParametrLongLong(domElement, VAbstractTool::AttrBasePoint, "0"); + const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId, @@ -659,15 +659,15 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 2: //VToolAlongLine::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); - const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my, scene, this, data, parse, Tool::FromFile); @@ -682,16 +682,16 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 3: //VToolShoulderPoint::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); - const qint64 p1Line = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line, "0"); - const qint64 p2Line = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line, "0"); - const qint64 pShoulder = GetParametrLongLong(domElement, VAbstractTool::AttrPShoulder, "0"); + const quint32 p1Line = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0"); + const quint32 p2Line = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0"); + const quint32 pShoulder = GetParametrUInt(domElement, VAbstractTool::AttrPShoulder, "0"); VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my, scene, this, data, parse, Tool::FromFile); @@ -706,15 +706,15 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 4: //VToolNormal::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); - const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, @@ -730,16 +730,16 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 5: //VToolBisector::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); - const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); - const qint64 thirdPointId = GetParametrLongLong(domElement, VAbstractTool::AttrThirdPoint, "0"); + const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); + const quint32 thirdPointId = GetParametrUInt(domElement, VAbstractTool::AttrThirdPoint, "0"); VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, typeLine, name, mx, my, scene, this, data, parse, Tool::FromFile); @@ -754,14 +754,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 6: //VToolLineIntersect::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - const qint64 p1Line1Id = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line1, "0"); - const qint64 p2Line1Id = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line1, "0"); - const qint64 p1Line2Id = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line2, "0"); - const qint64 p2Line2Id = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line2, "0"); + const quint32 p1Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0"); + const quint32 p2Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0"); + const quint32 p1Line2Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line2, "0"); + const quint32 p2Line2Id = GetParametrUInt(domElement, VAbstractTool::AttrP2Line2, "0"); VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, mx, my, scene, this, data, parse, Tool::FromFile); @@ -776,14 +776,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 7: //VToolPointOfContact::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "0"); - const qint64 center = GetParametrLongLong(domElement, VAbstractTool::AttrCenter, "0"); - const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0"); + const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my, scene, this,data, parse, Tool::FromFile); @@ -798,9 +798,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 8: //VNodePoint::ToolType try { - const qint64 id = GetParametrId(domElement); - const qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); - const qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); + const quint32 id = GetParametrId(domElement); + const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); + const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); const VPointF *point = data->GeometricObject(idObject ); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); @@ -818,15 +818,15 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 9: //VToolHeight::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); - const qint64 basePointId = GetParametrLongLong(domElement, VAbstractTool::AttrBasePoint, "0"); - const qint64 p1LineId = GetParametrLongLong(domElement, VAbstractTool::AttrP1Line, "0"); - const qint64 p2LineId = GetParametrLongLong(domElement, VAbstractTool::AttrP2Line, "0"); + const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); + const quint32 p1LineId = GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0"); + const quint32 p2LineId = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0"); VToolHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId, mx, my, scene, this, data, parse, Tool::FromFile); @@ -841,14 +841,14 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 10: //VToolTriangle::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - const qint64 axisP1Id = GetParametrLongLong(domElement, VAbstractTool::AttrAxisP1, "0"); - const qint64 axisP2Id = GetParametrLongLong(domElement, VAbstractTool::AttrAxisP2, "0"); - const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + const quint32 axisP1Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0"); + const quint32 axisP2Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0"); + const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); VToolTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, scene, this, data, parse, Tool::FromFile); @@ -863,12 +863,12 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 11: //VToolPointOfIntersection::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - const qint64 firstPointId = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - const qint64 secondPointId = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, scene, this, data, parse,Tool::FromFile); @@ -883,12 +883,12 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 12: //VToolCutSpline::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); - const qint64 splineId = GetParametrLongLong(domElement, VToolCutSpline::AttrSpline, "0"); + const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0"); VToolCutSpline::Create(id, name, formula, splineId, mx, my, scene, this, data, parse, Tool::FromFile); } @@ -902,12 +902,12 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 13: //VToolCutSplinePath::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); - const qint64 splinePathId = GetParametrLongLong(domElement, VToolCutSplinePath::AttrSplinePath, "0"); + const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0"); VToolCutSplinePath::Create(id, name, formula, splinePathId, mx, my, scene, this, data, parse, Tool::FromFile); @@ -922,12 +922,12 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d case 14: //VToolCutArc::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); - const qint64 arcId = GetParametrLongLong(domElement, VToolCutArc::AttrArc, "0"); + const quint32 arcId = GetParametrUInt(domElement, VToolCutArc::AttrArc, "0"); VToolCutArc::Create(id, name, formula, arcId, mx, my, scene, this, data, parse, Tool::FromFile); } @@ -950,9 +950,9 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); try { - const qint64 id = GetParametrId(domElement); - const qint64 firstPoint = GetParametrLongLong(domElement, VAbstractTool::AttrFirstPoint, "0"); - const qint64 secondPoint = GetParametrLongLong(domElement, VAbstractTool::AttrSecondPoint, "0"); + const quint32 id = GetParametrId(domElement); + const quint32 firstPoint = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPoint = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); VToolLine::Create(id, firstPoint, secondPoint, typeLine, scene, this, data, parse, Tool::FromFile); @@ -978,9 +978,9 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & case 0: //VToolSpline::ToolType try { - const qint64 id = GetParametrId(domElement); - const qint64 point1 = GetParametrLongLong(domElement, VAbstractTool::AttrPoint1, "0"); - const qint64 point4 = GetParametrLongLong(domElement, VAbstractTool::AttrPoint4, "0"); + const quint32 id = GetParametrId(domElement); + const quint32 point1 = GetParametrUInt(domElement, VAbstractTool::AttrPoint1, "0"); + const quint32 point4 = GetParametrUInt(domElement, VAbstractTool::AttrPoint4, "0"); const qreal angle1 = GetParametrDouble(domElement, VAbstractTool::AttrAngle1, "270.0"); const qreal angle2 = GetParametrDouble(domElement, VAbstractTool::AttrAngle2, "90.0"); const qreal kAsm1 = GetParametrDouble(domElement, VAbstractTool::AttrKAsm1, "1.0"); @@ -1000,7 +1000,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & case 1: //VToolSplinePath::ToolType try { - const qint64 id = GetParametrId(domElement); + const quint32 id = GetParametrId(domElement); const qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0"); VSplinePath *path = new VSplinePath(kCurve); Q_CHECK_PTR(path); @@ -1017,7 +1017,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & const qreal kAsm1 = GetParametrDouble(element, VAbstractTool::AttrKAsm1, "1.0"); const qreal angle = GetParametrDouble(element, VAbstractTool::AttrAngle, "0"); const qreal kAsm2 = GetParametrDouble(element, VAbstractTool::AttrKAsm2, "1.0"); - const qint64 pSpline = GetParametrLongLong(element, VAbstractTool::AttrPSpline, "0"); + const quint32 pSpline = GetParametrUInt(element, VAbstractTool::AttrPSpline, "0"); const VPointF p = *data->GeometricObject(pSpline); QLineF line(0, 0, 100, 0); @@ -1045,9 +1045,9 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & case 2: //VNodeSpline::ToolType try { - const qint64 id = GetParametrId(domElement); - const qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); - const qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); + const quint32 id = GetParametrId(domElement); + const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); + const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VSpline *spl = new VSpline(*data->GeometricObject(idObject)); Q_CHECK_PTR(spl); spl->setIdObject(idObject); @@ -1065,9 +1065,9 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & case 3: //VNodeSplinePath::ToolType try { - const qint64 id = GetParametrId(domElement); - const qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); - const qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); + const quint32 id = GetParametrId(domElement); + const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); + const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VSplinePath *path = new VSplinePath(*data->GeometricObject(idObject)); Q_CHECK_PTR(path); path->setIdObject(idObject); @@ -1102,8 +1102,8 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom case 0: //VToolArc::ToolType try { - const qint64 id = GetParametrId(domElement); - const qint64 center = GetParametrLongLong(domElement, VAbstractTool::AttrCenter, "0"); + const quint32 id = GetParametrId(domElement); + const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0"); const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "10"); const QString f1 = GetParametrString(domElement, VAbstractTool::AttrAngle1, "180"); const QString f2 = GetParametrString(domElement, VAbstractTool::AttrAngle2, "270"); @@ -1120,9 +1120,9 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom case 1: //VNodeArc::ToolType try { - const qint64 id = GetParametrId(domElement); - const qint64 idObject = GetParametrLongLong(domElement, VAbstractNode::AttrIdObject, "0"); - const qint64 idTool = GetParametrLongLong(domElement, VAbstractNode::AttrIdTool, "0"); + const quint32 id = GetParametrId(domElement); + const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); + const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VArc *arc = new VArc(*data->GeometricObject(idObject)); Q_CHECK_PTR(arc); arc->setIdObject(idObject); @@ -1157,9 +1157,9 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d case 0: //VToolUnionDetails::ToolType try { - const qint64 id = GetParametrId(domElement); - const qint64 indexD1 = GetParametrLongLong(domElement, VToolUnionDetails::AttrIndexD1, "-1"); - const qint64 indexD2 = GetParametrLongLong(domElement, VToolUnionDetails::AttrIndexD2, "-1"); + const quint32 id = GetParametrId(domElement); + const quint32 indexD1 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD1, "-1"); + const quint32 indexD2 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD2, "-1"); const QVector vector = VToolUnionDetails::GetDetailFromFile(this, domElement); @@ -1191,7 +1191,7 @@ void VPattern::ParseIncrementsElement(const QDomNode &node) { if (domElement.tagName() == "increment") { - qint64 id = GetParametrId(domElement); + quint32 id = GetParametrId(domElement); QString name = GetParametrString(domElement, "name", ""); qreal base = GetParametrDouble(domElement, "base", "0"); qreal ksize = GetParametrDouble(domElement, "ksize", "0"); @@ -1206,10 +1206,10 @@ void VPattern::ParseIncrementsElement(const QDomNode &node) } } -qint64 VPattern::GetParametrId(const QDomElement &domElement) const +quint32 VPattern::GetParametrId(const QDomElement &domElement) const { Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - const qint64 id = GetParametrLongLong(domElement, "id", "0"); + const quint32 id = GetParametrUInt(domElement, "id", "0"); if (id <= 0) { throw VExceptionWrongParameterId(tr("Got wrong parameter id. Need only id > 0."), domElement); @@ -1217,11 +1217,11 @@ qint64 VPattern::GetParametrId(const QDomElement &domElement) const return id; } -void VPattern::CollectId(const QDomElement &node, QVector &vector) const +void VPattern::CollectId(const QDomElement &node, QVector &vector) const { if (node.hasAttribute("id")) { - const qint64 id = GetParametrId(node); + const quint32 id = GetParametrId(node); if (vector.contains(id)) { throw VExceptionUniqueId(tr("This id is not unique."), node); diff --git a/src/xml/vpattern.h b/src/xml/vpattern.h index 3ce440177..2c52058b1 100644 --- a/src/xml/vpattern.h +++ b/src/xml/vpattern.h @@ -98,13 +98,13 @@ public: * @brief getTools return list of tools pointers. * @return list. */ - inline QHash* getTools() {return &tools;} + inline QHash* getTools() {return &tools;} /** * @brief getTool return tool from tool list. * @param id tool id. * @return tool. */ - VDataTool* getTool(const qint64 &id); + VDataTool* getTool(const quint32 &id); /** * @brief getHistory return list with list of history records. * @return list of history records. @@ -114,12 +114,12 @@ public: * @brief getCursor return cursor. * @return cursor. */ - inline qint64 getCursor() const {return cursor;} + inline quint32 getCursor() const {return cursor;} /** * @brief setCursor set cursor. * @param value cursor. */ - void setCursor(const qint64 &value); + void setCursor(const quint32 &value); /** * @brief setCurrentData set current data set. */ @@ -129,23 +129,23 @@ public: * @param id tool id. * @param tool tool. */ - void AddTool(const qint64 &id, VDataTool *tool); + void AddTool(const quint32 &id, VDataTool *tool); /** * @brief UpdateToolData update tool in list tools. * @param id tool id. * @param data container with variables. */ - void UpdateToolData(const qint64 &id, VContainer *data); + void UpdateToolData(const quint32 &id, VContainer *data); /** * @brief IncrementReferens increment reference parent objects. * @param id parent object id. */ - void IncrementReferens(qint64 id) const; + void IncrementReferens(quint32 id) const; /** * @brief DecrementReferens decrement reference parent objects. * @param id parent object id. */ - void DecrementReferens(qint64 id) const; + void DecrementReferens(quint32 id) const; /** * @brief TestUniqueId test exist unique id in pattern file. Each id must be unique. */ @@ -154,7 +154,7 @@ public: * @brief SPointActiveDraw return id base point current pattern peace. * @return id base point. */ - qint64 SPointActiveDraw(); + quint32 SPointActiveDraw(); inline bool isPatternModified() const {return patternModified;} inline void setPatternModified(bool value) {patternModified = value;} /** @@ -199,12 +199,12 @@ signals: * @param color highlight color. * @param enable enable or disable highlight. */ - void ShowTool(qint64 id, Qt::GlobalColor color, bool enable); + void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); /** * @brief ChangedCursor change cursor position. * @param id tool id. */ - void ChangedCursor(qint64 id); + void ChangedCursor(quint32 id); public slots: /** * @brief FullUpdateTree lite parse file. @@ -220,7 +220,7 @@ public slots: * @param color hightlight color. * @param enable enable or diasable hightlight. */ - void ShowHistoryTool(qint64 id, Qt::GlobalColor color, bool enable); + void ShowHistoryTool(quint32 id, Qt::GlobalColor color, bool enable); private: Q_DISABLE_COPY(VPattern) /** @@ -230,7 +230,7 @@ private: /** * @brief tools list with pointer on tools. */ - QHash tools; + QHash tools; /** * @brief history history records. */ @@ -238,7 +238,7 @@ private: /** * @brief cursor cursor keep id tool after which we will add new tool in file. */ - qint64 cursor; + quint32 cursor; QComboBox *comboBoxDraws; /** * @brief mode current draw mode. @@ -353,13 +353,13 @@ private: * @param domElement tag in xml tree. * @return id value. */ - qint64 GetParametrId(const QDomElement& domElement) const; + quint32 GetParametrId(const QDomElement& domElement) const; /** * @brief CollectId recursive function, try find id attribute in file. Throw exclusion if find not unique. * @param node tag in xml tree. * @param vector list with ids. */ - void CollectId(const QDomElement &node, QVector &vector)const; + void CollectId(const QDomElement &node, QVector &vector)const; void PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail); }; diff --git a/src/xml/vtoolrecord.cpp b/src/xml/vtoolrecord.cpp index e5e69ac0a..110a9c9c2 100644 --- a/src/xml/vtoolrecord.cpp +++ b/src/xml/vtoolrecord.cpp @@ -31,5 +31,5 @@ VToolRecord::VToolRecord() :id(0), typeTool(Tool::ArrowTool), nameDraw(QString()){} -VToolRecord::VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw) +VToolRecord::VToolRecord(const quint32 &id, const Tool::Tools &typeTool, const QString &nameDraw) :id(id), typeTool(typeTool), nameDraw(nameDraw){} diff --git a/src/xml/vtoolrecord.h b/src/xml/vtoolrecord.h index 0a622f8ae..0746b1e0b 100644 --- a/src/xml/vtoolrecord.h +++ b/src/xml/vtoolrecord.h @@ -49,17 +49,17 @@ public: * @param typeTool tool type. * @param nameDraw pattern peace name. */ - VToolRecord(const qint64 &id, const Tool::Tools &typeTool, const QString &nameDraw); + VToolRecord(const quint32 &id, const Tool::Tools &typeTool, const QString &nameDraw); /** * @brief getId return tool id. * @return id. */ - inline qint64 getId() const {return id;} + inline quint32 getId() const {return id;} /** * @brief setId set tool id. * @param value id. */ - inline void setId(const qint64 &value) {id = value;} + inline void setId(const quint32 &value) {id = value;} /** * @brief getTypeTool return tool type. * @return tool type. @@ -84,7 +84,7 @@ private: /** * @brief id tool id. */ - qint64 id; + quint32 id; /** * @brief typeTool tool type. */ From 1b3de9e4a2c20ef91877338cd2a8f19e24cd75ef Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 25 Feb 2014 16:55:02 +0200 Subject: [PATCH 11/60] Make method ValidatePattern static. --HG-- branch : feature --- src/geometry/vdetail.cpp | 10 +-- src/mainwindow.cpp | 80 +----------------- src/mainwindow.h | 11 --- src/tools/drawTools/vtoolalongline.cpp | 4 +- src/tools/drawTools/vtoolbisector.cpp | 6 +- src/tools/drawTools/vtoolcutarc.cpp | 2 +- src/tools/drawTools/vtoolcutspline.cpp | 2 +- src/tools/drawTools/vtoolcutsplinepath.cpp | 2 +- src/tools/drawTools/vtoolendline.cpp | 2 +- src/tools/drawTools/vtoolheight.cpp | 6 +- src/tools/drawTools/vtoollineintersect.cpp | 8 +- src/tools/drawTools/vtoolnormal.cpp | 4 +- src/tools/drawTools/vtoolpointofcontact.cpp | 6 +- .../drawTools/vtoolpointofintersection.cpp | 4 +- src/tools/drawTools/vtoolshoulderpoint.cpp | 6 +- src/tools/drawTools/vtooltriangle.cpp | 8 +- src/xml/vdomdocument.cpp | 81 +++++++++++++++++++ src/xml/vdomdocument.h | 11 +++ 18 files changed, 128 insertions(+), 125 deletions(-) diff --git a/src/geometry/vdetail.cpp b/src/geometry/vdetail.cpp index ab7379dd4..d92786a5c 100644 --- a/src/geometry/vdetail.cpp +++ b/src/geometry/vdetail.cpp @@ -174,13 +174,13 @@ ptrdiff_t VDetail::Edge(const quint32 &p1, const quint32 &p2) const void VDetail::NodeOnEdge(const quint32 &index, VNodeDetail &p1, VNodeDetail &p2) const { QVector list = listNodePoint(); - if (index < 0 || index > list.size()) + if (index > static_cast(list.size())) { qWarning()<<"Wrong edge index index ="< list.size() - 1) + if (index + 1 > static_cast(list.size()) - 1) { p2 = list.at(0); } @@ -196,9 +196,9 @@ VDetail VDetail::RemoveEdge(const quint32 &index) const det.ClearNodes(); QVector list = this->listNodePoint(); - qint32 edge = list.size(); - ptrdiff_t k = 0; - for (ptrdiff_t i=0; i(list.size()); + quint32 k = 0; + for (quint32 i=0; i #include #include -#include -#include #include -#include -//This class need for validation pattern file using XSD shema -class MessageHandler : public QAbstractMessageHandler -{ -public: - MessageHandler() : QAbstractMessageHandler(0), m_messageType(QtMsgType()), m_description(QString()), - m_sourceLocation(QSourceLocation()){} - inline QString statusMessage() const {return m_description;} - inline qint64 line() const {return m_sourceLocation.line();} - inline qint64 column() const {return m_sourceLocation.column();} -protected: - virtual void handleMessage(QtMsgType type, const QString &description, - const QUrl &identifier, const QSourceLocation &sourceLocation) - { - Q_UNUSED(type); - Q_UNUSED(identifier); - - m_messageType = type; - m_description = description; - m_sourceLocation = sourceLocation; - } -private: - QtMsgType m_messageType; - QString m_description; - QSourceLocation m_sourceLocation; -}; MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainWindow), pattern(0), doc(0), tool(Tool::ArrowTool), currentScene(0), @@ -1146,56 +1118,6 @@ void MainWindow::MinimumScrollBar() verScrollBar->setValue(verScrollBar->minimum()); } -bool MainWindow::ValidatePattern(const QString &schema, const QString &fileName, QString &errorMsg, qint64 &errorLine, - qint64 &errorColumn) const -{ - errorLine = -1; - errorColumn = -1; - QFile pattern(fileName); - if (pattern.open(QIODevice::ReadOnly) == false) - { - errorMsg = QString(tr("Can't open pattern file %1:\n%2.").arg(fileName).arg(pattern.errorString())); - return false; - } - QFile fileSchema(schema); - if (fileSchema.open(QIODevice::ReadOnly) == false) - { - errorMsg = QString(tr("Can't open schema file %1:\n%2.").arg(schema).arg(fileSchema.errorString())); - return false; - } - - MessageHandler messageHandler; - QXmlSchema sch; - sch.setMessageHandler(&messageHandler); - sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName())); - - bool errorOccurred = false; - if (sch.isValid() == false) - { - errorOccurred = true; - } - else - { - QXmlSchemaValidator validator(sch); - if (validator.validate(&pattern, QUrl::fromLocalFile(pattern.fileName())) == false) - { - errorOccurred = true; - } - } - - if (errorOccurred) - { - errorMsg = messageHandler.statusMessage(); - errorLine = messageHandler.line(); - errorColumn = messageHandler.column(); - return false; - } - else - { - return true; - } -} - bool MainWindow::SavePattern(const QString &fileName) { try @@ -1455,7 +1377,7 @@ void MainWindow::LoadPattern(const QString &fileName) qint64 errorColumn = 0; if (file.open(QIODevice::ReadOnly)) { - if (ValidatePattern("://schema/pattern.xsd", fileName, errorMsg, errorLine, errorColumn)) + if (VDomDocument::ValidatePattern("://schema/pattern.xsd", fileName, errorMsg, errorLine, errorColumn)) { qint32 errorLine = 0; qint32 errorColumn = 0; diff --git a/src/mainwindow.h b/src/mainwindow.h index 04c6625b4..0421cf7df 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -516,17 +516,6 @@ private: * @brief MinimumScrollBar set scroll bar to minimum. */ void MinimumScrollBar(); - /** - * @brief ValidatePattern validate pattern file by xsd schema. - * @param schema path to schema file. - * @param fileName name of pattern file. - * @param errorMsg error message. - * @param errorLine number error line. - * @param errorColumn number error column. - * @return true if validation successful. - */ - bool ValidatePattern(const QString &schema, const QString &curFile, QString &errorMsg, qint64 &errorLine, - qint64 &errorColumn) const; template /** * @brief ClosedDialog handle close dialog diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index c7c2da657..bf6abdba3 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -56,8 +56,8 @@ void VToolAlongLine::FullUpdateFromFile() { typeLine = domElement.attribute(AttrTypeLine, ""); formula = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); + basePointId = domElement.attribute(AttrFirstPoint, "").toUInt(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt(); } RefreshGeometry(); } diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index 087ef7b2a..7208a4610 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -155,9 +155,9 @@ void VToolBisector::FullUpdateFromFile() { typeLine = domElement.attribute(AttrTypeLine, ""); formula = domElement.attribute(AttrLength, ""); - firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - basePointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); - thirdPointId = domElement.attribute(AttrThirdPoint, "").toLongLong(); + firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt(); + basePointId = domElement.attribute(AttrSecondPoint, "").toUInt(); + thirdPointId = domElement.attribute(AttrThirdPoint, "").toUInt(); } RefreshGeometry(); } diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index c181191b3..e34f08fef 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -165,7 +165,7 @@ void VToolCutArc::FullUpdateFromFile() if (domElement.isElement()) { formula = domElement.attribute(AttrLength, ""); - arcId = domElement.attribute(AttrArc, "").toLongLong(); + arcId = domElement.attribute(AttrArc, "").toUInt(); } RefreshGeometry(); } diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index 0debf801d..162080406 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -166,7 +166,7 @@ void VToolCutSpline::FullUpdateFromFile() if (domElement.isElement()) { formula = domElement.attribute(AttrLength, ""); - splineId = domElement.attribute(AttrSpline, "").toLongLong(); + splineId = domElement.attribute(AttrSpline, "").toUInt(); } RefreshGeometry(); } diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index e8ff9a8e9..92a43ddd0 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -247,7 +247,7 @@ void VToolCutSplinePath::FullUpdateFromFile() if (domElement.isElement()) { formula = domElement.attribute(AttrLength, ""); - splinePathId = domElement.attribute(AttrSplinePath, "").toLongLong(); + splinePathId = domElement.attribute(AttrSplinePath, "").toUInt(); } RefreshGeometry(); } diff --git a/src/tools/drawTools/vtoolendline.cpp b/src/tools/drawTools/vtoolendline.cpp index 2fb50a4ff..68504a32d 100644 --- a/src/tools/drawTools/vtoolendline.cpp +++ b/src/tools/drawTools/vtoolendline.cpp @@ -127,7 +127,7 @@ void VToolEndLine::FullUpdateFromFile() { typeLine = domElement.attribute(AttrTypeLine, ""); formula = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrBasePoint, "").toLongLong(); + basePointId = domElement.attribute(AttrBasePoint, "").toUInt(); angle = domElement.attribute(AttrAngle, "").toInt(); } RefreshGeometry(); diff --git a/src/tools/drawTools/vtoolheight.cpp b/src/tools/drawTools/vtoolheight.cpp index bddc198b7..9f3525cba 100644 --- a/src/tools/drawTools/vtoolheight.cpp +++ b/src/tools/drawTools/vtoolheight.cpp @@ -131,9 +131,9 @@ void VToolHeight::FullUpdateFromFile() if (domElement.isElement()) { typeLine = domElement.attribute(AttrTypeLine, ""); - basePointId = domElement.attribute(AttrBasePoint, "").toLongLong(); - p1LineId = domElement.attribute(AttrP1Line, "").toLongLong(); - p2LineId = domElement.attribute(AttrP2Line, "").toLongLong(); + basePointId = domElement.attribute(AttrBasePoint, "").toUInt(); + p1LineId = domElement.attribute(AttrP1Line, "").toUInt(); + p2LineId = domElement.attribute(AttrP2Line, "").toUInt(); } RefreshGeometry(); diff --git a/src/tools/drawTools/vtoollineintersect.cpp b/src/tools/drawTools/vtoollineintersect.cpp index 8f1aef09a..d6ec5cc8f 100644 --- a/src/tools/drawTools/vtoollineintersect.cpp +++ b/src/tools/drawTools/vtoollineintersect.cpp @@ -136,10 +136,10 @@ void VToolLineIntersect::FullUpdateFromFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - p1Line1 = domElement.attribute(AttrP1Line1, "").toLongLong(); - p2Line1 = domElement.attribute(AttrP2Line1, "").toLongLong(); - p1Line2 = domElement.attribute(AttrP1Line2, "").toLongLong(); - p2Line2 = domElement.attribute(AttrP2Line2, "").toLongLong(); + p1Line1 = domElement.attribute(AttrP1Line1, "").toUInt(); + p2Line1 = domElement.attribute(AttrP2Line1, "").toUInt(); + p1Line2 = domElement.attribute(AttrP1Line2, "").toUInt(); + p2Line2 = domElement.attribute(AttrP2Line2, "").toUInt(); } RefreshPointGeometry(*VAbstractTool::data.GeometricObject(id)); } diff --git a/src/tools/drawTools/vtoolnormal.cpp b/src/tools/drawTools/vtoolnormal.cpp index 88ea3ae81..bcc9f0eb0 100644 --- a/src/tools/drawTools/vtoolnormal.cpp +++ b/src/tools/drawTools/vtoolnormal.cpp @@ -140,8 +140,8 @@ void VToolNormal::FullUpdateFromFile() { typeLine = domElement.attribute(AttrTypeLine, ""); formula = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); + basePointId = domElement.attribute(AttrFirstPoint, "").toUInt(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt(); angle = domElement.attribute(AttrAngle, "").toDouble(); } RefreshGeometry(); diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index 21b944bd3..0791d4dfd 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -160,9 +160,9 @@ void VToolPointOfContact::FullUpdateFromFile() if (domElement.isElement()) { arcRadius = domElement.attribute(AttrRadius, ""); - center = domElement.attribute(AttrCenter, "").toLongLong(); - firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); + center = domElement.attribute(AttrCenter, "").toUInt(); + firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt(); } RefreshPointGeometry(*VAbstractTool::data.GeometricObject(id)); } diff --git a/src/tools/drawTools/vtoolpointofintersection.cpp b/src/tools/drawTools/vtoolpointofintersection.cpp index 1b1fbaac9..6744f1d6f 100644 --- a/src/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/tools/drawTools/vtoolpointofintersection.cpp @@ -111,8 +111,8 @@ void VToolPointOfIntersection::FullUpdateFromFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); + firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt(); } VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject(id)); } diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 962298b69..95ca09e19 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -162,9 +162,9 @@ void VToolShoulderPoint::FullUpdateFromFile() { typeLine = domElement.attribute(AttrTypeLine, ""); formula = domElement.attribute(AttrLength, ""); - basePointId = domElement.attribute(AttrP1Line, "").toLongLong(); - p2Line = domElement.attribute(AttrP2Line, "").toLongLong(); - pShoulder = domElement.attribute(AttrPShoulder, "").toLongLong(); + basePointId = domElement.attribute(AttrP1Line, "").toUInt(); + p2Line = domElement.attribute(AttrP2Line, "").toUInt(); + pShoulder = domElement.attribute(AttrPShoulder, "").toUInt(); } RefreshGeometry(); } diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index 8fd15aa2f..1e86786ee 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -163,10 +163,10 @@ void VToolTriangle::FullUpdateFromFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - axisP1Id = domElement.attribute(AttrAxisP1, "").toLongLong(); - axisP2Id = domElement.attribute(AttrAxisP2, "").toLongLong(); - firstPointId = domElement.attribute(AttrFirstPoint, "").toLongLong(); - secondPointId = domElement.attribute(AttrSecondPoint, "").toLongLong(); + axisP1Id = domElement.attribute(AttrAxisP1, "").toUInt(); + axisP2Id = domElement.attribute(AttrAxisP2, "").toUInt(); + firstPointId = domElement.attribute(AttrFirstPoint, "").toUInt(); + secondPointId = domElement.attribute(AttrSecondPoint, "").toUInt(); } VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject(id)); } diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index 041330daf..734ebae19 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -31,6 +31,37 @@ #include "../exception/vexceptionemptyparameter.h" #include "../exception/vexceptionbadid.h" +#include +#include +#include +#include + +//This class need for validation pattern file using XSD shema +class MessageHandler : public QAbstractMessageHandler +{ +public: + MessageHandler() : QAbstractMessageHandler(0), m_messageType(QtMsgType()), m_description(QString()), + m_sourceLocation(QSourceLocation()){} + inline QString statusMessage() const {return m_description;} + inline qint64 line() const {return m_sourceLocation.line();} + inline qint64 column() const {return m_sourceLocation.column();} +protected: + virtual void handleMessage(QtMsgType type, const QString &description, + const QUrl &identifier, const QSourceLocation &sourceLocation) + { + Q_UNUSED(type); + Q_UNUSED(identifier); + + m_messageType = type; + m_description = description; + m_sourceLocation = sourceLocation; + } +private: + QtMsgType m_messageType; + QString m_description; + QSourceLocation m_sourceLocation; +}; + VDomDocument::VDomDocument(VContainer *data) : QDomDocument(), data(data), map(QHash()) { @@ -162,3 +193,53 @@ QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVa } return defVal; } + +bool VDomDocument::ValidatePattern(const QString &schema, const QString &fileName, QString &errorMsg, qint64 &errorLine, + qint64 &errorColumn) +{ + errorLine = -1; + errorColumn = -1; + QFile pattern(fileName); + if (pattern.open(QIODevice::ReadOnly) == false) + { + errorMsg = QString(tr("Can't open file %1:\n%2.").arg(fileName).arg(pattern.errorString())); + return false; + } + QFile fileSchema(schema); + if (fileSchema.open(QIODevice::ReadOnly) == false) + { + errorMsg = QString(tr("Can't open schema file %1:\n%2.").arg(schema).arg(fileSchema.errorString())); + return false; + } + + MessageHandler messageHandler; + QXmlSchema sch; + sch.setMessageHandler(&messageHandler); + sch.load(&fileSchema, QUrl::fromLocalFile(fileSchema.fileName())); + + bool errorOccurred = false; + if (sch.isValid() == false) + { + errorOccurred = true; + } + else + { + QXmlSchemaValidator validator(sch); + if (validator.validate(&pattern, QUrl::fromLocalFile(pattern.fileName())) == false) + { + errorOccurred = true; + } + } + + if (errorOccurred) + { + errorMsg = messageHandler.statusMessage(); + errorLine = messageHandler.line(); + errorColumn = messageHandler.column(); + return false; + } + else + { + return true; + } +} diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index 2b510dd66..e1a944956 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -101,6 +101,17 @@ public: */ qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue) const; QString UniqueTagText(const QString &tagName, const QString &defVal = QString()) const; + /** + * @brief ValidatePattern validate pattern file by xsd schema. + * @param schema path to schema file. + * @param fileName name of pattern file. + * @param errorMsg error message. + * @param errorLine number error line. + * @param errorColumn number error column. + * @return true if validation successful. + */ + static bool ValidatePattern(const QString &schema, const QString &fileName, QString &errorMsg, qint64 &errorLine, + qint64 &errorColumn); protected: /** * @brief data container with data. From 313d4aad6b60889ae1c5f006072623c9b5355445 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 25 Feb 2014 20:03:17 +0200 Subject: [PATCH 12/60] Refactoring if-else. Static members instead strings. --HG-- branch : feature --- src/tools/vabstracttool.cpp | 5 +- src/tools/vtooldetail.cpp | 15 ++- src/tools/vtooldetail.h | 4 + src/xml/vpattern.cpp | 190 +++++++++++++++++++++--------------- src/xml/vpattern.h | 13 +++ 5 files changed, 142 insertions(+), 85 deletions(-) diff --git a/src/tools/vabstracttool.cpp b/src/tools/vabstracttool.cpp index 7a1ede620..3832ba14c 100644 --- a/src/tools/vabstracttool.cpp +++ b/src/tools/vabstracttool.cpp @@ -62,8 +62,9 @@ const QString VAbstractTool::AttrPathPoint = QStringLiteral("pathPoint"); const QString VAbstractTool::AttrPSpline = QStringLiteral("pSpline"); const QString VAbstractTool::AttrAxisP1 = QStringLiteral("axisP1"); const QString VAbstractTool::AttrAxisP2 = QStringLiteral("axisP2"); -const QString VAbstractTool::TypeLineNone = QStringLiteral("none"); -const QString VAbstractTool::TypeLineLine = QStringLiteral("hair"); + +const QString VAbstractTool::TypeLineNone = QStringLiteral("none"); +const QString VAbstractTool::TypeLineLine = QStringLiteral("hair"); const QString VAbstractTool::TypeLineDashLine = QStringLiteral("dashLine"); const QString VAbstractTool::TypeLineDotLine = QStringLiteral("dotLine"); const QString VAbstractTool::TypeLineDashDotLine = QStringLiteral("dashDotLine"); diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index a07ca47f4..3beb3072f 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -32,14 +32,21 @@ const QString VToolDetail::TagName = QStringLiteral("detail"); const QString VToolDetail::TagNode = QStringLiteral("node"); + const QString VToolDetail::AttrSupplement = QStringLiteral("supplement"); const QString VToolDetail::AttrClosed = QStringLiteral("closed"); const QString VToolDetail::AttrWidth = QStringLiteral("width"); const QString VToolDetail::AttrIdObject = QStringLiteral("idObject"); const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType"); + const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour"); const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling"); +const QString VToolDetail::NodeArc = QStringLiteral("NodeArc"); +const QString VToolDetail::NodePoint = QStringLiteral("NodePoint"); +const QString VToolDetail::NodeSpline = QStringLiteral("NodeSpline"); +const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath"); + VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Tool::Sources &typeCreation, VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(0), sceneDetails(scene) @@ -376,16 +383,16 @@ void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node) switch (node.getTypeTool()) { case (Tool::NodeArc): - doc->SetAttribute(nod, AttrType, QStringLiteral("NodeArc")); + doc->SetAttribute(nod, AttrType, NodeArc); break; case (Tool::NodePoint): - doc->SetAttribute(nod, AttrType, QStringLiteral("NodePoint")); + doc->SetAttribute(nod, AttrType, NodePoint); break; case (Tool::NodeSpline): - doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSpline")); + doc->SetAttribute(nod, AttrType, NodeSpline); break; case (Tool::NodeSplinePath): - doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); + doc->SetAttribute(nod, AttrType, NodeSplinePath); break; default: qWarning()<<"May be wrong tool type!!! Ignoring."< +const QString VPattern::TagPattern = QStringLiteral("pattern"); const QString VPattern::TagCalculation = QStringLiteral("calculation"); const QString VPattern::TagModeling = QStringLiteral("modeling"); const QString VPattern::TagDetails = QStringLiteral("details"); @@ -45,8 +46,22 @@ const QString VPattern::TagAuthor = QStringLiteral("author"); const QString VPattern::TagDescription = QStringLiteral("description"); const QString VPattern::TagNotes = QStringLiteral("notes"); const QString VPattern::TagIncrements = QStringLiteral("increments"); +const QString VPattern::TagIncrement = QStringLiteral("increment"); const QString VPattern::TagDraw = QStringLiteral("draw"); +const QString VPattern::TagPoint = QStringLiteral("point"); +const QString VPattern::TagLine = QStringLiteral("line"); +const QString VPattern::TagSpline = QStringLiteral("spline"); +const QString VPattern::TagArc = QStringLiteral("arc"); +const QString VPattern::TagTools = QStringLiteral("tools"); + const QString VPattern::AttrName = QStringLiteral("name"); +const QString VPattern::AttrType = QStringLiteral("type"); + +const QString VPattern::IncrementName = QStringLiteral("name"); +const QString VPattern::IncrementBase = QStringLiteral("base"); +const QString VPattern::IncrementKsize = QStringLiteral("ksize"); +const QString VPattern::IncrementKgrowth = QStringLiteral("kgrowth"); +const QString VPattern::IncrementDescription = QStringLiteral("description"); VPattern::VPattern(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent) : QObject(parent), VDomDocument(data), nameActivDraw(QString()), tools(QHash()), @@ -56,7 +71,7 @@ VPattern::VPattern(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode void VPattern::CreateEmptyFile() { - QDomElement patternElement = this->createElement("pattern"); + QDomElement patternElement = this->createElement(TagPattern); patternElement.appendChild(createComment("Valentina pattern format.")); patternElement.appendChild(createElement(TagAuthor)); @@ -172,29 +187,35 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene const QDomElement domElement = domNode.toElement(); if (domElement.isNull() == false) { - if (domElement.tagName()==TagDraw) + QStringList tags; + tags << TagDraw << TagIncrements; + switch(tags.indexOf(domElement.tagName())) { - if (parse == Document::FullParse) - { - if (nameActivDraw.isEmpty()) + case 0: // TagDraw + if (parse == Document::FullParse) { - SetActivDraw(GetParametrString(domElement, AttrName)); + if (nameActivDraw.isEmpty()) + { + SetActivDraw(GetParametrString(domElement, AttrName)); + } + else + { + ChangeActivDraw(GetParametrString(domElement, AttrName)); + } + comboBoxDraws->addItem(GetParametrString(domElement, AttrName)); } else { - ChangeActivDraw(GetParametrString(domElement, AttrName)); + ChangeActivDraw(GetParametrString(domElement, AttrName), Document::LiteParse); } - comboBoxDraws->addItem(GetParametrString(domElement, AttrName)); - } - else - { - ChangeActivDraw(GetParametrString(domElement, AttrName), Document::LiteParse); - } - ParseDrawElement(sceneDraw, sceneDetail, domElement, parse); - } - if (domElement.tagName()=="increments") - { - ParseIncrementsElement(domElement); + ParseDrawElement(sceneDraw, sceneDetail, domElement, parse); + break; + case 1: // TagIncrements + ParseIncrementsElement(domElement); + break; + default: + qWarning()<<"Wrong tag name"<ClearCalculationGObjects(); - ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Calculation); - } - if (domElement.tagName() == "modeling") - { - ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Modeling); - } - if (domElement.tagName() == "details") - { - ParseDetails(sceneDetail, domElement, parse); + case 0: // TagCalculation + data->ClearCalculationGObjects(); + ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Calculation); + break; + case 1: // TagModeling + ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Modeling); + break; + case 2: // TagDetails + ParseDetails(sceneDetail, domElement, parse); + break; + default: + qWarning()<<"Wrong tag name"<UpdateId(id); data->AddIncrementTableRow(name, VIncrementTableRow(id, base, ksize, kgrowth, desc)); } @@ -1209,7 +1241,7 @@ void VPattern::ParseIncrementsElement(const QDomNode &node) quint32 VPattern::GetParametrId(const QDomElement &domElement) const { Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - const quint32 id = GetParametrUInt(domElement, "id", "0"); + const quint32 id = GetParametrUInt(domElement, VAbstractTool::AttrId, "0"); if (id <= 0) { throw VExceptionWrongParameterId(tr("Got wrong parameter id. Need only id > 0."), domElement); @@ -1219,7 +1251,7 @@ quint32 VPattern::GetParametrId(const QDomElement &domElement) const void VPattern::CollectId(const QDomElement &node, QVector &vector) const { - if (node.hasAttribute("id")) + if (node.hasAttribute(VAbstractTool::AttrId)) { const quint32 id = GetParametrId(node); if (vector.contains(id)) diff --git a/src/xml/vpattern.h b/src/xml/vpattern.h index 2c52058b1..afdb02e3e 100644 --- a/src/xml/vpattern.h +++ b/src/xml/vpattern.h @@ -164,6 +164,7 @@ public: * @return true if found. */ bool GetActivNodeElement(const QString& name, QDomElement& element); + static const QString TagPattern; static const QString TagCalculation; static const QString TagModeling; static const QString TagDetails; @@ -171,8 +172,20 @@ public: static const QString TagDescription; static const QString TagNotes; static const QString TagIncrements; + static const QString TagIncrement; static const QString TagDraw; + static const QString TagPoint; + static const QString TagLine; + static const QString TagSpline; + static const QString TagArc; + static const QString TagTools; static const QString AttrName; + static const QString AttrType; + static const QString IncrementName; + static const QString IncrementBase; + static const QString IncrementKsize; + static const QString IncrementKgrowth; + static const QString IncrementDescription; signals: /** * @brief ChangedActivDraw change active pattern peace. From 42c54aa5036c711675e715579a9aef446425f00d Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 26 Feb 2014 10:18:59 +0200 Subject: [PATCH 13/60] Inline member functions defined outside the class. --HG-- branch : feature --- src/container/vcontainer.h | 171 +++++++++++++++--- src/container/vincrementtablerow.h | 70 ++++++- src/container/vstandardtablerow.h | 28 ++- .../app/dialogindividualmeasurements.h | 14 +- src/dialogs/tools/dialogalongline.h | 53 ++++-- src/dialogs/tools/dialogarc.h | 102 ++++++----- src/dialogs/tools/dialogbisector.h | 73 +++++--- src/dialogs/tools/dialogcutspline.h | 37 ++-- src/dialogs/tools/dialogcutsplinepath.h | 37 ++-- src/dialogs/tools/dialogdetail.h | 7 +- src/dialogs/tools/dialogendline.h | 49 +++-- src/dialogs/tools/dialogheight.h | 49 +++-- src/dialogs/tools/dialogline.h | 55 ++++-- src/dialogs/tools/dialoglineintersect.h | 49 +++-- src/dialogs/tools/dialognormal.h | 60 ++++-- src/dialogs/tools/dialogpointofcontact.h | 47 +++-- src/dialogs/tools/dialogpointofintersection.h | 39 ++-- src/dialogs/tools/dialogshoulderpoint.h | 56 ++++-- src/dialogs/tools/dialogsinglepoint.h | 28 ++- src/dialogs/tools/dialogspline.h | 49 +++-- src/dialogs/tools/dialogsplinepath.h | 21 ++- src/dialogs/tools/dialogtriangle.h | 49 +++-- src/dialogs/tools/dialoguniondetails.h | 28 ++- src/exception/vexception.h | 29 ++- src/exception/vexceptionbadid.h | 14 +- src/exception/vexceptionconversionerror.cpp | 6 + src/exception/vexceptionconversionerror.h | 10 +- src/exception/vexceptionemptyparameter.cpp | 6 + src/exception/vexceptionemptyparameter.h | 32 +++- src/exception/vexceptionobjecterror.cpp | 7 + src/exception/vexceptionobjecterror.h | 54 ++++-- src/exception/vexceptionuniqueid.cpp | 6 + src/exception/vexceptionuniqueid.h | 44 +++-- src/exception/vexceptionwrongparameterid.cpp | 6 + src/exception/vexceptionwrongparameterid.h | 46 +++-- src/geometry/varc.h | 99 ++++++---- src/geometry/vdetail.h | 158 ++++++++++++---- src/geometry/vnodedetail.h | 128 +++++++++---- src/geometry/vpointf.cpp | 15 ++ src/geometry/vpointf.h | 84 +++++++-- src/geometry/vspline.h | 62 +++++-- src/geometry/vsplinepath.h | 68 +++++-- src/geometry/vsplinepoint.h | 94 +++++++--- src/tools/vabstracttool.h | 32 ++-- src/tools/vdatatool.h | 42 +++-- src/widgets/vitem.cpp | 11 ++ src/widgets/vitem.h | 12 +- src/widgets/vmaingraphicsscene.h | 28 ++- src/widgets/vtablegraphicsview.h | 24 ++- src/xml/vdomdocument.cpp | 21 ++- src/xml/vpattern.h | 46 ++++- src/xml/vtoolrecord.h | 64 +++++-- 52 files changed, 1807 insertions(+), 612 deletions(-) diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index fd44cfcf7..0fb81df09 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -160,8 +160,7 @@ public: * @param name name of row of standard table * @param cell row of standard table */ - inline void AddStandardTableCell(const QString& name, const VStandardTableRow &cell) - {standardTable[name] = cell;} + void AddStandardTableCell(const QString& name, const VStandardTableRow &cell); /** * @brief AddIncrementTableRow add new row of increment table * @param name name of new row of increment table @@ -231,15 +230,13 @@ public: * @param name name of row * @param cell row of standard table */ - inline void UpdateStandardTableCell(const QString& name, VStandardTableRow cell) - {standardTable[name] = cell;} + void UpdateStandardTableCell(const QString& name, VStandardTableRow cell); /** * @brief UpdateIncrementTableRow update increment table row by name * @param name name of row * @param row row */ - inline void UpdateIncrementTableRow(const QString& name, VIncrementTableRow row) - {incrementTable[name] = row;} + void UpdateIncrementTableRow(const QString& name, VIncrementTableRow row); /** * @brief GetValueStandardTableCell return value of standard table row by name * @param name name of row @@ -264,44 +261,44 @@ public: /** * @brief ClearIncrementTable clear increment table */ - inline void ClearIncrementTable() {incrementTable.clear();} + void ClearIncrementTable(); /** * @brief ClearLengthLines clear length lines */ - inline void ClearLengthLines() {lengthLines.clear();} + void ClearLengthLines(); /** * @brief ClearLengthSplines clear length splines */ - inline void ClearLengthSplines() {lengthSplines.clear();} + void ClearLengthSplines(); /** * @brief ClearLengthArcs clear length arcs */ - inline void ClearLengthArcs() {lengthArcs.clear();} + void ClearLengthArcs(); /** * @brief ClearLineAngles clear angles of lines */ - inline void ClearLineAngles() {lineAngles.clear();} - inline void ClearDetails() {details.clear();} + void ClearLineAngles(); + void ClearDetails(); /** * @brief SetSize set value of size * @param size value of size in mm */ - inline void SetSize(qint32 size) {base["Сг"] = size;} + void SetSize(qint32 size); /** * @brief SetGrowth set value of growth * @param growth value of growth in mm */ - inline void SetGrowth(qint32 growth) {base["Р"] = growth;} + void SetGrowth(qint32 growth); /** * @brief size return size * @return size in mm */ - inline qint32 size() const {return base.value("Сг");} + qint32 size() const; /** * @brief growth return growth * @return growth in mm */ - inline qint32 growth() const {return base.value("Р");} + qint32 growth() const; /** * @brief FindVar return value of variable by name * @param name name of variable @@ -314,7 +311,7 @@ public: * @param name name of row * @return true if contains */ - inline bool IncrementTableContains(const QString& name) {return incrementTable.contains(name);} + bool IncrementTableContains(const QString& name); /** * @brief getNextId generate next unique id * @return next unique id @@ -324,52 +321,52 @@ public: * @brief RemoveIncrementTableRow remove row by name from increment table * @param name name of existing row */ - inline void RemoveIncrementTableRow(const QString& name) {incrementTable.remove(name);} + void RemoveIncrementTableRow(const QString& name); /** * @brief data container with datagObjects return container of gObjects * @return pointer on container of gObjects */ - inline const QHash *DataGObjects() const {return &gObjects;} + const QHash *DataGObjects() const; /** * @brief data container with dataBase return container of data * @return pointer on container of base data */ - inline const QHash *DataBase() const {return &base;} + const QHash *DataBase() const; /** * @brief data container with dataStandardTable return container of standard table * @return pointer on container of standard table */ - inline const QHash *DataStandardTable() const {return &standardTable;} + const QHash *DataStandardTable() const; /** * @brief data container with dataIncrementTable return container of increment table * @return pointer on container of increment table */ - inline const QHash *DataIncrementTable() const {return &incrementTable;} + const QHash *DataIncrementTable() const; /** * @brief data container with dataLengthLines return container of lines lengths * @return pointer on container of lines lengths */ - inline const QHash *DataLengthLines() const {return &lengthLines;} + const QHash *DataLengthLines() const; /** * @brief data container with dataLengthSplines return container of splines lengths * @return pointer on container of splines lengths */ - inline const QHash *DataLengthSplines() const {return &lengthSplines;} + const QHash *DataLengthSplines() const; /** * @brief data container with dataLengthArcs return container of arcs length * @return pointer on container of arcs length */ - inline const QHash *DataLengthArcs() const {return &lengthArcs;} + const QHash *DataLengthArcs() const; /** * @brief data container with dataLineAngles return container of angles of line * @return pointer on container of angles of line */ - inline const QHash *DataLineAngles() const {return &lineAngles;} + const QHash *DataLineAngles() const; /** * @brief data container with dataDetails return container of details * @return pointer on container of details */ - inline const QHash *DataDetails() const {return &details;} + const QHash *DataDetails() const; /** * @brief UpdateId update id. If new id bigger when current save new like current. * @param newId id @@ -456,4 +453,124 @@ private: static quint32 AddObject(QHash &obj, val value); }; +inline void VContainer::AddStandardTableCell(const QString &name, const VStandardTableRow &cell) +{ + standardTable[name] = cell; +} + +inline void VContainer::UpdateStandardTableCell(const QString &name, VStandardTableRow cell) +{ + standardTable[name] = cell; +} + +inline void VContainer::UpdateIncrementTableRow(const QString &name, VIncrementTableRow row) +{ + incrementTable[name] = row; +} + +inline void VContainer::ClearIncrementTable() +{ + incrementTable.clear(); +} + +inline void VContainer::ClearLengthLines() +{ + lengthLines.clear(); +} + +inline void VContainer::ClearLengthSplines() +{ + lengthSplines.clear(); +} + +inline void VContainer::ClearLengthArcs() +{ + lengthArcs.clear(); +} + +inline void VContainer::ClearLineAngles() +{ + lineAngles.clear(); +} + +inline void VContainer::ClearDetails() +{ + details.clear(); +} + +inline void VContainer::SetSize(qint32 size) +{ + base["Сг"] = size; +} + +inline void VContainer::SetGrowth(qint32 growth) +{ + base["Р"] = growth; +} + +inline qint32 VContainer::size() const +{ + return base.value("Сг"); +} + +inline qint32 VContainer::growth() const +{ + return base.value("Р"); +} + +inline bool VContainer::IncrementTableContains(const QString &name) +{ + return incrementTable.contains(name); +} + +inline void VContainer::RemoveIncrementTableRow(const QString &name) +{ + incrementTable.remove(name); +} + +inline const QHash *VContainer::DataGObjects() const +{ + return &gObjects; +} + +inline const QHash *VContainer::DataBase() const +{ + return &base; +} + +inline const QHash *VContainer::DataStandardTable() const +{ + return &standardTable; +} + +inline const QHash *VContainer::DataIncrementTable() const +{ + return &incrementTable; +} + +inline const QHash *VContainer::DataLengthLines() const +{ + return &lengthLines; +} + +inline const QHash *VContainer::DataLengthSplines() const +{ + return &lengthSplines; +} + +inline const QHash *VContainer::DataLengthArcs() const +{ + return &lengthArcs; +} + +inline const QHash *VContainer::DataLineAngles() const +{ + return &lineAngles; +} + +inline const QHash *VContainer::DataDetails() const +{ + return &details; +} + #endif // VCONTAINER_H diff --git a/src/container/vincrementtablerow.h b/src/container/vincrementtablerow.h index e7572befd..b077d7940 100644 --- a/src/container/vincrementtablerow.h +++ b/src/container/vincrementtablerow.h @@ -55,52 +55,52 @@ public: * @brief getId return id of row * @return id */ - inline quint32 getId() const {return id;} + quint32 getId() const; /** * @brief setId set id of row * @param value id */ - inline void setId(const quint32 &value) {id = value;} + void setId(const quint32 &value); /** * @brief getBase return value in base size and growth * @return value */ - inline qreal getBase() const {return base;} + qreal getBase() const; /** * @brief setBase set value in base size and growth * @param value base value */ - inline void setBase(const qreal &value) {base = value;} + void setBase(const qreal &value); /** * @brief getKsize return increment in sizes * @return increment */ - inline qreal getKsize() const {return ksize;} + qreal getKsize() const; /** * @brief setKsize set increment in sizes * @param value value of increment */ - inline void setKsize(const qreal &value) {ksize = value;} + void setKsize(const qreal &value); /** * @brief getKgrowth return increment in growths * @return increment */ - inline qreal getKgrowth() const {return kgrowth;} + qreal getKgrowth() const; /** * @brief setKgrowth set increment in growths * @param value value of increment */ - inline void setKgrowth(const qreal &value) {kgrowth = value;} + void setKgrowth(const qreal &value); /** * @brief getDescription return description * @return description */ - inline QString getDescription() const {return description;} + QString getDescription() const; /** * @brief setDescription set description for row * @param value description */ - inline void setDescription(const QString &value) {description = value;} + void setDescription(const QString &value); private: /** * @brief id identificator @@ -124,4 +124,54 @@ private: QString description; }; +inline quint32 VIncrementTableRow::getId() const +{ + return id; +} + +inline void VIncrementTableRow::setId(const quint32 &value) +{ + id = value; +} + +inline qreal VIncrementTableRow::getBase() const +{ + return base; +} + +inline void VIncrementTableRow::setBase(const qreal &value) +{ + base = value; +} + +inline qreal VIncrementTableRow::getKsize() const +{ + return ksize; +} + +inline void VIncrementTableRow::setKsize(const qreal &value) +{ + ksize = value; +} + +inline qreal VIncrementTableRow::getKgrowth() const +{ + return kgrowth; +} + +inline void VIncrementTableRow::setKgrowth(const qreal &value) +{ + kgrowth = value; +} + +inline QString VIncrementTableRow::getDescription() const +{ + return description; +} + +inline void VIncrementTableRow::setDescription(const QString &value) +{ + description = value; +} + #endif // VINCREMENTTABLEROW_H diff --git a/src/container/vstandardtablerow.h b/src/container/vstandardtablerow.h index 7f6298392..5dafdbac6 100644 --- a/src/container/vstandardtablerow.h +++ b/src/container/vstandardtablerow.h @@ -55,22 +55,22 @@ public: * @brief GetBase return value in base size and growth * @return value */ - inline qint32 GetBase() const {return base;} + qint32 GetBase() const; /** * @brief GetKsize return increment in sizes * @return increment */ - inline qreal GetKsize() const {return ksize;} + qreal GetKsize() const; /** * @brief GetKgrowth return increment in growths * @return increment */ - inline qreal GetKgrowth() const {return kgrowth;} + qreal GetKgrowth() const; /** * @brief GetDescription return description * @return description */ - inline QString GetDescription() const {return description;} + QString GetDescription() const; private: /** * @brief base value in base size and growth @@ -90,4 +90,24 @@ private: QString description; }; +inline qint32 VStandardTableRow::GetBase() const +{ + return base; +} + +inline qreal VStandardTableRow::GetKsize() const +{ + return ksize; +} + +inline qreal VStandardTableRow::GetKgrowth() const +{ + return kgrowth; +} + +inline QString VStandardTableRow::GetDescription() const +{ + return description; +} + #endif // VSTANDARDTABLEROW_H diff --git a/src/dialogs/app/dialogindividualmeasurements.h b/src/dialogs/app/dialogindividualmeasurements.h index 2f122c8e4..0e87bb685 100644 --- a/src/dialogs/app/dialogindividualmeasurements.h +++ b/src/dialogs/app/dialogindividualmeasurements.h @@ -42,8 +42,8 @@ class DialogIndividualMeasurements : public QDialog public: explicit DialogIndividualMeasurements(QWidget *parent = 0); ~DialogIndividualMeasurements(); - inline QString name() const {return _name;} - inline QString tablePath() const{return _tablePath;} + QString name() const; + QString tablePath() const; private: Q_DISABLE_COPY(DialogIndividualMeasurements) Ui::DialogIndividualMeasurements *ui; @@ -54,4 +54,14 @@ private: void CheckState(); }; +inline QString DialogIndividualMeasurements::name() const +{ + return _name; +} + +inline QString DialogIndividualMeasurements::tablePath() const +{ + return _tablePath; +} + #endif // DIALOGINDIVIDUALMEASUREMENTS_H diff --git a/src/dialogs/tools/dialogalongline.h b/src/dialogs/tools/dialogalongline.h index 33dceade7..693328fb0 100644 --- a/src/dialogs/tools/dialogalongline.h +++ b/src/dialogs/tools/dialogalongline.h @@ -43,18 +43,18 @@ class DialogAlongLine : public DialogTool { Q_OBJECT public: - /** - * @brief DialogAlongLine create dialog - * @param data container with data - * @param parent parent widget - */ - DialogAlongLine(const VContainer *data, QWidget *parent = 0); - ~DialogAlongLine(); + /** + * @brief DialogAlongLine create dialog + * @param data container with data + * @param parent parent widget + */ + DialogAlongLine(const VContainer *data, QWidget *parent = 0); + ~DialogAlongLine(); /** * @brief getPointName return name of point * @return name */ - inline QString getPointName() const {return pointName;} + QString getPointName() const; /** * @brief setPointName set name of point * @param value name @@ -64,7 +64,7 @@ public: * @brief getTypeLine return type of line * @return type */ - inline QString getTypeLine() const {return typeLine;} + QString getTypeLine() const; /** * @brief setTypeLine set type of line * @param value type @@ -74,7 +74,7 @@ public: * @brief getFormula return string of formula * @return formula */ - inline QString getFormula() const {return formula;} + QString getFormula() const; /** * @brief setFormula set string of formula * @param value formula @@ -84,7 +84,7 @@ public: * @brief getFirstPointId return id first point of line * @return id */ - inline quint32 getFirstPointId() const {return firstPointId;} + quint32 getFirstPointId() const; /** * @brief setFirstPointId set id first point of line * @param value id @@ -95,7 +95,7 @@ public: * @brief getSecondPointId return id second point of line * @return id */ - inline quint32 getSecondPointId() const {return secondPointId;} + quint32 getSecondPointId() const; /** * @brief setSecondPointId set id second point of line * @param value id @@ -138,11 +138,36 @@ private: /** * @brief firstPointId id first point of line */ - quint32 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id second point of line */ - quint32 secondPointId; + quint32 secondPointId; }; +inline QString DialogAlongLine::getPointName() const +{ + return pointName; +} + +inline QString DialogAlongLine::getTypeLine() const +{ + return typeLine; +} + +inline QString DialogAlongLine::getFormula() const +{ + return formula; +} + +inline quint32 DialogAlongLine::getFirstPointId() const +{ + return firstPointId; +} + +inline quint32 DialogAlongLine::getSecondPointId() const +{ + return secondPointId; +} + #endif // DIALOGALONGLINE_H diff --git a/src/dialogs/tools/dialogarc.h b/src/dialogs/tools/dialogarc.h index f712ffc19..f1366f9e1 100644 --- a/src/dialogs/tools/dialogarc.h +++ b/src/dialogs/tools/dialogarc.h @@ -43,164 +43,184 @@ class DialogArc : public DialogTool { Q_OBJECT public: - /** - * @brief DialogArc create dialog - * @param data container with data - * @param parent parent widget - */ - DialogArc(const VContainer *data, QWidget *parent = 0); - ~DialogArc(); + /** + * @brief DialogArc create dialog + * @param data container with data + * @param parent parent widget + */ + DialogArc(const VContainer *data, QWidget *parent = 0); + ~DialogArc(); /** * @brief GetCenter return id of center point * @return id id */ - inline quint32 GetCenter() const {return center;} + quint32 GetCenter() const; /** * @brief SetCenter set id of center point * @param value id */ - void SetCenter(const quint32 &value); + void SetCenter(const quint32 &value); /** * @brief GetRadius return formula of radius * @return formula */ - inline QString GetRadius() const {return radius;} + QString GetRadius() const; /** * @brief SetRadius set formula of radius * @param value formula */ - void SetRadius(const QString &value); + void SetRadius(const QString &value); /** * @brief GetF1 return formula first angle of arc * @return formula */ - inline QString GetF1() const {return f1;} + QString GetF1() const; /** * @brief SetF1 set formula first angle of arc * @param value formula */ - void SetF1(const QString &value); + void SetF1(const QString &value); /** * @brief GetF2 return formula second angle of arc * @return formula */ - inline QString GetF2() const {return f2;} + QString GetF2() const; /** * @brief SetF2 set formula second angle of arc * @param value formula */ - void SetF2(const QString &value); + void SetF2(const QString &value); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ - virtual void DialogAccepted(); + virtual void DialogAccepted(); /** * @brief ValChenged show description angles of lines * @param row number of row */ - virtual void ValChenged(int row); + virtual void ValChenged(int row); /** * @brief PutRadius put variable into formula of radius */ - void PutRadius(); + void PutRadius(); /** * @brief PutF1 put variable into formula of first angle */ - void PutF1(); + void PutF1(); /** * @brief PutF2 put variable into formula of second angle */ - void PutF2(); + void PutF2(); /** * @brief LineAngles show variable angles of lines */ - void LineAngles(); + void LineAngles(); /** * @brief RadiusChanged after change formula of radius calculate value and show result */ - void RadiusChanged(); + void RadiusChanged(); /** * @brief F1Changed after change formula of first angle calculate value and show result */ - void F1Changed(); + void F1Changed(); /** * @brief F2Changed after change formula of second angle calculate value and show result */ - void F2Changed(); + void F2Changed(); protected: /** * @brief CheckState if all is right enable button ok */ - virtual void CheckState(); + virtual void CheckState(); private: Q_DISABLE_COPY(DialogArc) /** * @brief ui keeps information about user interface */ - Ui::DialogArc *ui; + Ui::DialogArc *ui; /** * @brief flagRadius true if value of radius is correct */ - bool flagRadius; + bool flagRadius; /** * @brief flagF1 true if value of first angle is correct */ - bool flagF1; + bool flagF1; /** * @brief flagF2 true if value of second angle is correct */ - bool flagF2; + bool flagF2; /** * @brief timerRadius timer of check formula of radius */ - QTimer *timerRadius; + QTimer *timerRadius; /** * @brief timerF1 timer of check formula of first angle */ - QTimer *timerF1; + QTimer *timerF1; /** * @brief timerF2 timer of check formula of second angle */ - QTimer *timerF2; + QTimer *timerF2; /** * @brief center id of center point */ - quint32 center; + quint32 center; /** * @brief radius formula of radius */ - QString radius; + QString radius; /** * @brief f1 formula of first angle */ - QString f1; + QString f1; /** * @brief f2 formula of second angle */ - QString f2; + QString f2; /** * @brief EvalRadius calculate value of radius */ - void EvalRadius(); + void EvalRadius(); /** * @brief EvalF1 calculate value of first angle */ - void EvalF1(); + void EvalF1(); /** * @brief EvalF2 calculate value of second angle */ - void EvalF2(); + void EvalF2(); /** * @brief ShowLineAngles show varibles angles of lines */ - void ShowLineAngles(); + void ShowLineAngles(); }; +inline quint32 DialogArc::GetCenter() const +{ + return center; +} + +inline QString DialogArc::GetRadius() const +{ + return radius; +} + +inline QString DialogArc::GetF1() const +{ + return f1; +} + +inline QString DialogArc::GetF2() const +{ + return f2; +} + #endif // DIALOGARC_H diff --git a/src/dialogs/tools/dialogbisector.h b/src/dialogs/tools/dialogbisector.h index f93466e1e..ba581956d 100644 --- a/src/dialogs/tools/dialogbisector.h +++ b/src/dialogs/tools/dialogbisector.h @@ -43,87 +43,87 @@ class DialogBisector : public DialogTool { Q_OBJECT public: - /** - * @brief DialogBisector create dialog - * @param data container with data - * @param parent parent widget - */ - DialogBisector(const VContainer *data, QWidget *parent = 0); - ~DialogBisector(); + /** + * @brief DialogBisector create dialog + * @param data container with data + * @param parent parent widget + */ + DialogBisector(const VContainer *data, QWidget *parent = 0); + ~DialogBisector(); /** * @brief getPointName return name of point * @return name */ - QString getPointName() const {return pointName;} + QString getPointName() const {return pointName;} /** * @brief setPointName set name of point * @param value name */ - void setPointName(const QString &value); + void setPointName(const QString &value); /** * @brief getTypeLine return type of line * @return type */ - inline QString getTypeLine() const {return typeLine;} + QString getTypeLine() const; /** * @brief setTypeLine set type of line * @param value type */ - void setTypeLine(const QString &value); + void setTypeLine(const QString &value); /** * @brief getFormula return string of formula * @return formula */ - inline QString getFormula() const {return formula;} + QString getFormula() const; /** * @brief setFormula set string of formula * @param value formula */ - void setFormula(const QString &value); + void setFormula(const QString &value); /** * @brief getFirstPointId return id of first point * @return id */ - inline quint32 getFirstPointId() const {return firstPointId;} + quint32 getFirstPointId() const; /** * @brief setFirstPointId set id of first point * @param value id * @param id don't show this id in list */ - void setFirstPointId(const quint32 &value, const quint32 &id); + void setFirstPointId(const quint32 &value, const quint32 &id); /** * @brief getSecondPointId return id of second point * @return id */ - inline quint32 getSecondPointId() const {return secondPointId;} + quint32 getSecondPointId() const; /** * @brief setSecondPointId set id of second point * @param value id * @param id don't show this id in list */ - void setSecondPointId(const quint32 &value, const quint32 &id); + void setSecondPointId(const quint32 &value, const quint32 &id); /** * @brief getThirdPointId return id of third point * @return id */ - inline quint32 getThirdPointId() const {return thirdPointId;} + quint32 getThirdPointId() const; /** * @brief setThirdPointId set id of third point * @param value id * @param id don't show this id in list */ - void setThirdPointId(const quint32 &value, const quint32 &id); + void setThirdPointId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ - virtual void DialogAccepted(); + virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogBisector) /** @@ -149,15 +149,40 @@ private: /** * @brief firstPointId id of first point */ - quint32 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id of second point */ - quint32 secondPointId; + quint32 secondPointId; /** * @brief thirdPointId id of third point */ - quint32 thirdPointId; + quint32 thirdPointId; }; +inline QString DialogBisector::getTypeLine() const +{ + return typeLine; +} + +inline QString DialogBisector::getFormula() const +{ + return formula; +} + +inline quint32 DialogBisector::getFirstPointId() const +{ + return firstPointId; +} + +inline quint32 DialogBisector::getSecondPointId() const +{ + return secondPointId; +} + +inline quint32 DialogBisector::getThirdPointId() const +{ + return thirdPointId; +} + #endif // DIALOGBISECTOR_H diff --git a/src/dialogs/tools/dialogcutspline.h b/src/dialogs/tools/dialogcutspline.h index c429eeb73..c7e9ef3f5 100644 --- a/src/dialogs/tools/dialogcutspline.h +++ b/src/dialogs/tools/dialogcutspline.h @@ -54,44 +54,44 @@ public: * @brief getPointName return name of point * @return name */ - inline QString getPointName() const {return pointName;} + QString getPointName() const; /** * @brief setPointName set name of point * @param value name */ - void setPointName(const QString &value); + void setPointName(const QString &value); /** * @brief getFormula return string of formula * @return formula */ - inline QString getFormula() const {return formula;} + QString getFormula() const; /** * @brief setFormula set string of formula * @param value formula */ - void setFormula(const QString &value); + void setFormula(const QString &value); /** * @brief getSplineId return id base point of line * @return id */ - inline quint32 getSplineId() const {return splineId;} + quint32 getSplineId() const; /** * @brief setSplineId set id spline * @param value id * @param id don't show this id in list */ - void setSplineId(const quint32 &value, const quint32 &id); + void setSplineId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ - virtual void DialogAccepted(); + virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogCutSpline) /** @@ -101,15 +101,30 @@ private: /** * @brief pointName name of created point */ - QString pointName; + QString pointName; /** * @brief formula string with formula */ - QString formula; + QString formula; /** * @brief splineId keep id of spline */ - quint32 splineId; + quint32 splineId; }; +inline QString DialogCutSpline::getPointName() const +{ + return pointName; +} + +inline QString DialogCutSpline::getFormula() const +{ + return formula; +} + +inline quint32 DialogCutSpline::getSplineId() const +{ + return splineId; +} + #endif // DIALOGCUTSPLINE_H diff --git a/src/dialogs/tools/dialogcutsplinepath.h b/src/dialogs/tools/dialogcutsplinepath.h index 6c19e15bb..0137e7f6c 100644 --- a/src/dialogs/tools/dialogcutsplinepath.h +++ b/src/dialogs/tools/dialogcutsplinepath.h @@ -54,44 +54,44 @@ public: * @brief getPointName return name of point * @return name */ - inline QString getPointName() const {return pointName;} + QString getPointName() const; /** * @brief setPointName set name of point * @param value name */ - void setPointName(const QString &value); + void setPointName(const QString &value); /** * @brief getFormula return string of formula * @return formula */ - inline QString getFormula() const {return formula;} + QString getFormula() const; /** * @brief setFormula set string of formula * @param value formula */ - void setFormula(const QString &value); + void setFormula(const QString &value); /** * @brief getSplineId return id base point of line * @return id */ - inline quint32 getSplinePathId() const {return splinePathId;} + quint32 getSplinePathId() const; /** * @brief setSplineId set id spline * @param value id * @param id don't show this id in list */ - void setSplinePathId(const quint32 &value, const quint32 &id); + void setSplinePathId(const quint32 &value, const quint32 &id); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ - virtual void DialogAccepted(); + virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogCutSplinePath) /** @@ -101,15 +101,30 @@ private: /** * @brief pointName name of created point */ - QString pointName; + QString pointName; /** * @brief formula string with formula */ - QString formula; + QString formula; /** * @brief splinePathId keep id of splinePath */ - quint32 splinePathId; + quint32 splinePathId; }; +inline QString DialogCutSplinePath::getPointName() const +{ + return pointName; +} + +inline QString DialogCutSplinePath::getFormula() const +{ + return formula; +} + +inline quint32 DialogCutSplinePath::getSplinePathId() const +{ + return splinePathId; +} + #endif // DIALOGCUTSPLINEPATH_H diff --git a/src/dialogs/tools/dialogdetail.h b/src/dialogs/tools/dialogdetail.h index 0ddd2a653..fec51637f 100644 --- a/src/dialogs/tools/dialogdetail.h +++ b/src/dialogs/tools/dialogdetail.h @@ -49,7 +49,7 @@ public: * @brief getDetails return detail * @return detail */ - inline VDetail getDetails() const {return details;} + VDetail getDetails() const; /** * @brief setDetails set detail * @param value detail @@ -125,4 +125,9 @@ private: qreal mx = 0, qreal my = 0); }; +inline VDetail DialogDetail::getDetails() const +{ + return details; +} + #endif // DIALOGDETAIL_H diff --git a/src/dialogs/tools/dialogendline.h b/src/dialogs/tools/dialogendline.h index 4426170d8..8bfcc1d6b 100644 --- a/src/dialogs/tools/dialogendline.h +++ b/src/dialogs/tools/dialogendline.h @@ -43,18 +43,18 @@ class DialogEndLine : public DialogTool { Q_OBJECT public: - /** - * @brief DialogEndLine create dialog - * @param data container with data - * @param parent parent widget - */ - DialogEndLine(const VContainer *data, QWidget *parent = 0); - ~DialogEndLine(); + /** + * @brief DialogEndLine create dialog + * @param data container with data + * @param parent parent widget + */ + DialogEndLine(const VContainer *data, QWidget *parent = 0); + ~DialogEndLine(); /** * @brief getPointName return name of point * @return name */ - inline QString getPointName() const {return pointName;} + QString getPointName() const; /** * @brief setPointName set name of point * @param value name @@ -64,7 +64,7 @@ public: * @brief getTypeLine return type of line * @return type */ - inline QString getTypeLine() const {return typeLine;} + QString getTypeLine() const; /** * @brief setTypeLine set type of line * @param value type @@ -74,7 +74,7 @@ public: * @brief getFormula return string of formula * @return formula */ - inline QString getFormula() const {return formula;} + QString getFormula() const; /** * @brief setFormula set string of formula * @param value formula @@ -84,7 +84,7 @@ public: * @brief getAngle return angle of line * @return angle in degree */ - inline qreal getAngle() const {return angle;} + qreal getAngle() const; /** * @brief setAngle set angle of line * @param value angle in degree @@ -94,7 +94,7 @@ public: * @brief getBasePointId return id base point of line * @return id */ - inline quint32 getBasePointId() const {return basePointId;} + quint32 getBasePointId() const; /** * @brief setBasePointId set id base point of line * @param value id @@ -140,4 +140,29 @@ private: quint32 basePointId; }; +inline QString DialogEndLine::getPointName() const +{ + return pointName; +} + +inline QString DialogEndLine::getTypeLine() const +{ + return typeLine; +} + +inline QString DialogEndLine::getFormula() const +{ + return formula; +} + +inline qreal DialogEndLine::getAngle() const +{ + return angle; +} + +inline quint32 DialogEndLine::getBasePointId() const +{ + return basePointId; +} + #endif // DIALOGENDLINE_H diff --git a/src/dialogs/tools/dialogheight.h b/src/dialogs/tools/dialogheight.h index f767c6205..9c718d626 100644 --- a/src/dialogs/tools/dialogheight.h +++ b/src/dialogs/tools/dialogheight.h @@ -43,18 +43,18 @@ class DialogHeight : public DialogTool { Q_OBJECT public: - /** - * @brief DialogHeight create dialog - * @param data container with data - * @param parent parent widget - */ - DialogHeight(const VContainer *data, QWidget *parent = 0); - ~DialogHeight(); + /** + * @brief DialogHeight create dialog + * @param data container with data + * @param parent parent widget + */ + DialogHeight(const VContainer *data, QWidget *parent = 0); + ~DialogHeight(); /** * @brief getPointName return name of point * @return name */ - inline QString getPointName() const {return pointName;} + QString getPointName() const; /** * @brief setPointName set name of point * @param value name @@ -64,7 +64,7 @@ public: * @brief getTypeLine return type of line * @return type */ - inline QString getTypeLine() const {return typeLine;} + QString getTypeLine() const; /** * @brief setTypeLine set type of line * @param value type @@ -74,7 +74,7 @@ public: * @brief getBasePointId return id base point of height * @return id */ - inline quint32 getBasePointId() const {return basePointId;} + quint32 getBasePointId() const; /** * @brief setBasePointId set id base point of height * @param value id @@ -85,7 +85,7 @@ public: * @brief getP1LineId return id first point of line * @return id id */ - inline quint32 getP1LineId() const {return p1LineId;} + quint32 getP1LineId() const; /** * @brief setP1LineId set id first point of line * @param value id @@ -96,7 +96,7 @@ public: * @brief getP2LineId return id second point of line * @return id */ - inline quint32 getP2LineId() const{return p2LineId;} + quint32 getP2LineId() const; /** * @brief setP2LineId set id second point of line * @param value id @@ -146,4 +146,29 @@ private: quint32 p2LineId; }; +inline QString DialogHeight::getPointName() const +{ + return pointName; +} + +inline QString DialogHeight::getTypeLine() const +{ + return typeLine; +} + +inline quint32 DialogHeight::getBasePointId() const +{ + return basePointId; +} + +inline quint32 DialogHeight::getP1LineId() const +{ + return p1LineId; +} + +inline quint32 DialogHeight::getP2LineId() const +{ + return p2LineId; +} + #endif // DIALOGHEIGHT_H diff --git a/src/dialogs/tools/dialogline.h b/src/dialogs/tools/dialogline.h index f5b400379..ec53ffcdf 100644 --- a/src/dialogs/tools/dialogline.h +++ b/src/dialogs/tools/dialogline.h @@ -43,76 +43,91 @@ class DialogLine : public DialogTool { Q_OBJECT public: - /** - * @brief DialogLine create dialog - * @param data container with data - * @param parent parent widget - */ - DialogLine(const VContainer *data, QWidget *parent = 0); - ~DialogLine(); + /** + * @brief DialogLine create dialog + * @param data container with data + * @param parent parent widget + */ + DialogLine(const VContainer *data, QWidget *parent = 0); + ~DialogLine(); /** * @brief getFirstPoint return id first point * @return id */ - inline quint32 getFirstPoint() const {return firstPoint;} + quint32 getFirstPoint() const; /** * @brief setFirstPoint set id first point * @param value id */ - void setFirstPoint(const quint32 &value); + void setFirstPoint(const quint32 &value); /** * @brief getSecondPoint return id second point * @return id */ - inline quint32 getSecondPoint() const {return secondPoint;} + quint32 getSecondPoint() const; /** * @brief setSecondPoint set id second point * @param value id */ - void setSecondPoint(const quint32 &value); + void setSecondPoint(const quint32 &value); /** * @brief getTypeLine return type of line * @return type */ - inline QString getTypeLine() const {return typeLine;} + QString getTypeLine() const; /** * @brief setTypeLine set type of line * @param value type */ - void setTypeLine(const QString &value); + void setTypeLine(const QString &value); public slots: /** * @brief ChoosedObject gets id and type of selected object. Save right data and ignore wrong. * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ - virtual void DialogAccepted(); + virtual void DialogAccepted(); private: Q_DISABLE_COPY(DialogLine) /** * @brief ui keeps information about user interface */ - Ui::DialogLine *ui; + Ui::DialogLine *ui; /** * @brief number number of handled objects */ - qint32 number; + qint32 number; /** * @brief firstPoint id first point */ - quint32 firstPoint; + quint32 firstPoint; /** * @brief secondPoint id second point */ - quint32 secondPoint; + quint32 secondPoint; /** * @brief typeLine type of line */ - QString typeLine; + QString typeLine; }; +inline quint32 DialogLine::getFirstPoint() const +{ + return firstPoint; +} + +inline quint32 DialogLine::getSecondPoint() const +{ + return secondPoint; +} + +inline QString DialogLine::getTypeLine() const +{ + return typeLine; +} + #endif // DIALOGLINE_H diff --git a/src/dialogs/tools/dialoglineintersect.h b/src/dialogs/tools/dialoglineintersect.h index bfc0c0888..dc0edbf22 100644 --- a/src/dialogs/tools/dialoglineintersect.h +++ b/src/dialogs/tools/dialoglineintersect.h @@ -43,18 +43,18 @@ class DialogLineIntersect : public DialogTool { Q_OBJECT public: - /** - * @brief DialogLineIntersect create dialog - * @param data container with data - * @param parent parent widget - */ - DialogLineIntersect(const VContainer *data, QWidget *parent = 0); - ~DialogLineIntersect(); + /** + * @brief DialogLineIntersect create dialog + * @param data container with data + * @param parent parent widget + */ + DialogLineIntersect(const VContainer *data, QWidget *parent = 0); + ~DialogLineIntersect(); /** * @brief getP1Line1 return id first point of first line * @return id */ - inline quint32 getP1Line1() const {return p1Line1;} + quint32 getP1Line1() const; /** * @brief setP1Line1 set id first point of first line * @param value id @@ -64,7 +64,7 @@ public: * @brief getP2Line1 return id second point of first line * @return id */ - inline quint32 getP2Line1() const {return p2Line1;} + quint32 getP2Line1() const; /** * @brief setP2Line1 set id second point of first line * @param value id @@ -74,7 +74,7 @@ public: * @brief getP1Line2 return id first point of second line * @return id */ - inline quint32 getP1Line2() const {return p1Line2;} + quint32 getP1Line2() const; /** * @brief setP1Line2 set id first point of second line * @param value id @@ -84,7 +84,7 @@ public: * @brief getP2Line2 return id second point of second line * @return id */ - inline quint32 getP2Line2() const {return p2Line2;} + quint32 getP2Line2() const; /** * @brief setP2Line2 set id second point of second line * @param value id @@ -94,7 +94,7 @@ public: * @brief getPointName return name of point * @return */ - inline QString getPointName() const {return pointName;} + QString getPointName() const; /** * @brief setPointName set name of point * @param value @@ -176,4 +176,29 @@ private: bool CheckIntersecion(); }; +inline quint32 DialogLineIntersect::getP1Line1() const +{ + return p1Line1; +} + +inline quint32 DialogLineIntersect::getP2Line1() const +{ + return p2Line1; +} + +inline quint32 DialogLineIntersect::getP1Line2() const +{ + return p1Line2; +} + +inline quint32 DialogLineIntersect::getP2Line2() const +{ + return p2Line2; +} + +inline QString DialogLineIntersect::getPointName() const +{ + return pointName; +} + #endif // DIALOGLINEINTERSECT_H diff --git a/src/dialogs/tools/dialognormal.h b/src/dialogs/tools/dialognormal.h index 5bf0459b5..11aef3280 100644 --- a/src/dialogs/tools/dialognormal.h +++ b/src/dialogs/tools/dialognormal.h @@ -43,18 +43,18 @@ class DialogNormal : public DialogTool { Q_OBJECT public: - /** - * @brief DialogNormal create dialog - * @param data container with data - * @param parent parent widget - */ - DialogNormal(const VContainer *data, QWidget *parent = 0); - ~DialogNormal(); + /** + * @brief DialogNormal create dialog + * @param data container with data + * @param parent parent widget + */ + DialogNormal(const VContainer *data, QWidget *parent = 0); + ~DialogNormal(); /** * @brief getPointName return name of point * @return name */ - inline QString getPointName() const{return pointName;} + QString getPointName() const; /** * @brief setPointName set name of point * @param value name @@ -64,7 +64,7 @@ public: * @brief getTypeLine return type of line * @return type */ - inline QString getTypeLine() const {return typeLine;} + QString getTypeLine() const; /** * @brief setTypeLine set type of line * @param value type @@ -74,7 +74,7 @@ public: * @brief getFormula return string of formula * @return formula */ - inline QString getFormula() const {return formula;} + QString getFormula() const; /** * @brief setFormula set string of formula * @param value formula @@ -84,7 +84,7 @@ public: * @brief getAngle return aditional angle of normal * @return angle in degree */ - inline qreal getAngle() const {return angle;} + qreal getAngle() const; /** * @brief setAngle set aditional angle of normal * @param value angle in degree @@ -94,7 +94,7 @@ public: * @brief getFirstPointId return id of first point * @return id */ - inline quint32 getFirstPointId() const {return firstPointId;} + quint32 getFirstPointId() const; /** * @brief setFirstPointId set id of first point * @param value id @@ -105,7 +105,7 @@ public: * @brief getSecondPointId return id of second point * @return id */ - inline quint32 getSecondPointId() const {return secondPointId;} + quint32 getSecondPointId() const; /** * @brief setSecondPointId set id of second point * @param value id @@ -152,11 +152,41 @@ private: /** * @brief firstPointId id first point of line */ - quint32 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id second point of line */ - quint32 secondPointId; + quint32 secondPointId; }; +inline QString DialogNormal::getPointName() const +{ + return pointName; +} + +inline QString DialogNormal::getTypeLine() const +{ + return typeLine; +} + +inline QString DialogNormal::getFormula() const +{ + return formula; +} + +inline qreal DialogNormal::getAngle() const +{ + return angle; +} + +inline quint32 DialogNormal::getFirstPointId() const +{ + return firstPointId; +} + +inline quint32 DialogNormal::getSecondPointId() const +{ + return secondPointId; +} + #endif // DIALOGNORMAL_H diff --git a/src/dialogs/tools/dialogpointofcontact.h b/src/dialogs/tools/dialogpointofcontact.h index 75a2d6a13..f6a80ab6c 100644 --- a/src/dialogs/tools/dialogpointofcontact.h +++ b/src/dialogs/tools/dialogpointofcontact.h @@ -39,17 +39,17 @@ class DialogPointOfContact : public DialogTool { Q_OBJECT public: - /** - * @brief DialogPointOfContact create dialog - * @param data container with data - * @param parent parent widget - */ - DialogPointOfContact(const VContainer *data, QWidget *parent = 0); + /** + * @brief DialogPointOfContact create dialog + * @param data container with data + * @param parent parent widget + */ + DialogPointOfContact(const VContainer *data, QWidget *parent = 0); /** * @brief getPointName return name of point * @return name */ - inline QString getPointName() const {return pointName;} + QString getPointName() const; /** * @brief setPointName set name of point * @param value name @@ -59,7 +59,7 @@ public: * @brief getRadius return formula radius of arc * @return formula */ - inline QString getRadius() const {return radius;} + QString getRadius() const; /** * @brief setRadius set formula radius of arc * @param value formula @@ -69,7 +69,7 @@ public: * @brief GetCenter return id of center point * @return id */ - inline quint32 getCenter() const {return center;} + quint32 getCenter() const; /** * @brief SetCenter set id of center point * @param value id @@ -80,7 +80,7 @@ public: * @brief getFirstPoint return id first point * @return id */ - inline quint32 getFirstPoint() const {return firstPoint;} + quint32 getFirstPoint() const; /** * @brief setFirstPoint set id first point * @param value id @@ -91,7 +91,7 @@ public: * @brief getSecondPoint return id second point * @return id */ - inline quint32 getSecondPoint() const {return secondPoint;} + quint32 getSecondPoint() const; /** * @brief setSecondPoint set id second point * @param value id @@ -141,4 +141,29 @@ private: quint32 secondPoint; }; +inline QString DialogPointOfContact::getPointName() const +{ + return pointName; +} + +inline QString DialogPointOfContact::getRadius() const +{ + return radius; +} + +inline quint32 DialogPointOfContact::getCenter() const +{ + return center; +} + +inline quint32 DialogPointOfContact::getFirstPoint() const +{ + return firstPoint; +} + +inline quint32 DialogPointOfContact::getSecondPoint() const +{ + return secondPoint; +} + #endif // DIALOGPOINTOFCONTACT_H diff --git a/src/dialogs/tools/dialogpointofintersection.h b/src/dialogs/tools/dialogpointofintersection.h index 6798bd3ca..dfa8d51c4 100644 --- a/src/dialogs/tools/dialogpointofintersection.h +++ b/src/dialogs/tools/dialogpointofintersection.h @@ -43,18 +43,18 @@ class DialogPointOfIntersection : public DialogTool { Q_OBJECT public: - /** - * @brief DialogPointOfIntersection create dialog - * @param data container with data - * @param parent parent widget - */ - DialogPointOfIntersection(const VContainer *data, QWidget *parent = 0); - ~DialogPointOfIntersection(); + /** + * @brief DialogPointOfIntersection create dialog + * @param data container with data + * @param parent parent widget + */ + DialogPointOfIntersection(const VContainer *data, QWidget *parent = 0); + ~DialogPointOfIntersection(); /** * @brief getPointName return name of point * @return name */ - inline QString getPointName() const {return pointName;} + QString getPointName() const; /** * @brief setPointName set name of point * @param value name @@ -64,7 +64,7 @@ public: * @brief getFirstPointId return id of first point * @return id */ - inline quint32 getFirstPointId() const {return firstPointId;} + quint32 getFirstPointId() const; /** * @brief setFirstPointId set id of first point * @param value id @@ -75,7 +75,7 @@ public: * @brief getSecondPointId return id of second point * @return id */ - inline quint32 getSecondPointId() const {return secondPointId;} + quint32 getSecondPointId() const; /** * @brief setSecondPointId set id of second point * @param value id @@ -110,11 +110,26 @@ private: /** * @brief firstPointId id first point of line */ - quint32 firstPointId; + quint32 firstPointId; /** * @brief secondPointId id second point of line */ - quint32 secondPointId; + quint32 secondPointId; }; +inline QString DialogPointOfIntersection::getPointName() const +{ + return pointName; +} + +inline quint32 DialogPointOfIntersection::getFirstPointId() const +{ + return firstPointId; +} + +inline quint32 DialogPointOfIntersection::getSecondPointId() const +{ + return secondPointId; +} + #endif // DIALOGPOINTOFINTERSECTION_H diff --git a/src/dialogs/tools/dialogshoulderpoint.h b/src/dialogs/tools/dialogshoulderpoint.h index c456ebc68..642f742d3 100644 --- a/src/dialogs/tools/dialogshoulderpoint.h +++ b/src/dialogs/tools/dialogshoulderpoint.h @@ -43,18 +43,18 @@ class DialogShoulderPoint : public DialogTool { Q_OBJECT public: - /** - * @brief DialogShoulderPoint create dialog - * @param data container with data - * @param parent parent widget - */ - DialogShoulderPoint(const VContainer *data, QWidget *parent = 0); - ~DialogShoulderPoint(); + /** + * @brief DialogShoulderPoint create dialog + * @param data container with data + * @param parent parent widget + */ + DialogShoulderPoint(const VContainer *data, QWidget *parent = 0); + ~DialogShoulderPoint(); /** * @brief getPointName return name of point * @return name */ - inline QString getPointName() const {return pointName;} + QString getPointName() const; /** * @brief setPointName set name of point * @param value name @@ -64,7 +64,7 @@ public: * @brief getTypeLine return type of line * @return type */ - inline QString getTypeLine() const {return typeLine;} + QString getTypeLine() const; /** * @brief setTypeLine set type of line * @param value type @@ -74,7 +74,7 @@ public: * @brief getFormula return string of formula * @return formula */ - inline QString getFormula() const {return formula;} + QString getFormula() const; /** * @brief setFormula set string of formula * @param value formula @@ -84,7 +84,7 @@ public: * @brief getP1Line return id first point of line * @return id */ - inline quint32 getP1Line() const {return p1Line;} + quint32 getP1Line() const; /** * @brief setP1Line set id first point of line * @param value id @@ -95,7 +95,7 @@ public: * @brief getP2Line return id second point of line * @return id */ - inline quint32 getP2Line() const {return p2Line;} + quint32 getP2Line() const; /** * @brief setP2Line set id second point of line * @param value id @@ -106,7 +106,7 @@ public: * @brief getPShoulder return id shoulder point * @return id */ - inline quint32 getPShoulder() const {return pShoulder;} + quint32 getPShoulder() const; /** * @brief setPShoulder set id shoulder point * @param value id @@ -160,4 +160,34 @@ private: quint32 pShoulder; }; +inline QString DialogShoulderPoint::getPointName() const +{ + return pointName; +} + +inline QString DialogShoulderPoint::getTypeLine() const +{ + return typeLine; +} + +inline QString DialogShoulderPoint::getFormula() const +{ + return formula; +} + +inline quint32 DialogShoulderPoint::getP1Line() const +{ + return p1Line; +} + +inline quint32 DialogShoulderPoint::getP2Line() const +{ + return p2Line; +} + +inline quint32 DialogShoulderPoint::getPShoulder() const +{ + return pShoulder; +} + #endif // DIALOGSHOULDERPOINT_H diff --git a/src/dialogs/tools/dialogsinglepoint.h b/src/dialogs/tools/dialogsinglepoint.h index ac667adc5..f3d4d6e33 100644 --- a/src/dialogs/tools/dialogsinglepoint.h +++ b/src/dialogs/tools/dialogsinglepoint.h @@ -43,12 +43,13 @@ class DialogSinglePoint : public DialogTool { Q_OBJECT public: - /** - * @brief DialogSinglePoint create dialog - * @param data container with data - * @param parent parent widget - */ - DialogSinglePoint(const VContainer *data, QWidget *parent = 0); + /** + * @brief DialogSinglePoint create dialog + * @param data container with data + * @param parent parent widget + */ + DialogSinglePoint(const VContainer *data, QWidget *parent = 0); + ~DialogSinglePoint(); /** * @brief setData set name and point * @param name name of point @@ -59,13 +60,12 @@ public: * @brief getName return name * @return name */ - inline QString getName()const {return name;} + QString getName()const; /** * @brief getPoint return point * @return point */ - inline QPointF getPoint()const {return point;} - ~DialogSinglePoint(); + QPointF getPoint()const; public slots: /** * @brief mousePress get mouse position @@ -92,4 +92,14 @@ private: QPointF point; }; +inline QString DialogSinglePoint::getName() const +{ + return name; +} + +inline QPointF DialogSinglePoint::getPoint() const +{ + return point; +} + #endif // DIALOGSINGLEPOINT_H diff --git a/src/dialogs/tools/dialogspline.h b/src/dialogs/tools/dialogspline.h index 281d28ea8..40e0bebac 100644 --- a/src/dialogs/tools/dialogspline.h +++ b/src/dialogs/tools/dialogspline.h @@ -43,13 +43,13 @@ class DialogSpline : public DialogTool { Q_OBJECT public: - /** - * @brief DialogSpline create dialog - * @param data container with data - * @param parent parent widget - */ - DialogSpline(const VContainer *data, QWidget *parent = 0); - ~DialogSpline(); + /** + * @brief DialogSpline create dialog + * @param data container with data + * @param parent parent widget + */ + DialogSpline(const VContainer *data, QWidget *parent = 0); + ~DialogSpline(); /** * @brief getP1 return id first point of spline * @return id @@ -74,7 +74,7 @@ public: * @brief getAngle1 return first angle of spline * @return angle in degree */ - inline qreal getAngle1() const {return angle1;} + qreal getAngle1() const; /** * @brief setAngle1 set first angle of spline * @param value angle in degree @@ -84,7 +84,7 @@ public: * @brief getAngle2 return second angle of spline * @return angle in degree */ - inline qreal getAngle2() const {return angle2;} + qreal getAngle2() const; /** * @brief setAngle2 set second angle of spline * @param value angle in degree @@ -94,7 +94,7 @@ public: * @brief getKAsm1 return first coefficient asymmetry * @return value. Can be >= 0. */ - inline qreal getKAsm1() const {return kAsm1;} + qreal getKAsm1() const; /** * @brief setKAsm1 set first coefficient asymmetry * @param value value. Can be >= 0. @@ -104,7 +104,7 @@ public: * @brief getKAsm2 return second coefficient asymmetry * @return value. Can be >= 0. */ - inline qreal getKAsm2() const {return kAsm2;} + qreal getKAsm2() const; /** * @brief setKAsm2 set second coefficient asymmetry * @param value value. Can be >= 0. @@ -114,7 +114,7 @@ public: * @brief getKCurve return coefficient curve * @return value. Can be >= 0. */ - inline qreal getKCurve() const {return kCurve;} + qreal getKCurve() const; /** * @brief setKCurve set coefficient curve * @param value value. Can be >= 0. @@ -171,4 +171,29 @@ private: qreal kCurve; }; +inline qreal DialogSpline::getAngle1() const +{ + return angle1; +} + +inline qreal DialogSpline::getAngle2() const +{ + return angle2; +} + +inline qreal DialogSpline::getKAsm1() const +{ + return kAsm1; +} + +inline qreal DialogSpline::getKAsm2() const +{ + return kAsm2; +} + +inline qreal DialogSpline::getKCurve() const +{ + return kCurve; +} + #endif // DIALOGSPLINE_H diff --git a/src/dialogs/tools/dialogsplinepath.h b/src/dialogs/tools/dialogsplinepath.h index 5d9ab2ec6..5024c143a 100644 --- a/src/dialogs/tools/dialogsplinepath.h +++ b/src/dialogs/tools/dialogsplinepath.h @@ -44,18 +44,18 @@ class DialogSplinePath : public DialogTool { Q_OBJECT public: - /** - * @brief DialogSplinePath create dialog - * @param data container with data - * @param parent parent widget - */ - DialogSplinePath(const VContainer *data, QWidget *parent = 0); - ~DialogSplinePath(); + /** + * @brief DialogSplinePath create dialog + * @param data container with data + * @param parent parent widget + */ + DialogSplinePath(const VContainer *data, QWidget *parent = 0); + ~DialogSplinePath(); /** * @brief GetPath return spline path * @return path */ - inline VSplinePath GetPath() const {return path;} + VSplinePath GetPath() const; /** * @brief SetPath set spline path * @param value path @@ -136,4 +136,9 @@ private: void EnableFields(); }; +inline VSplinePath DialogSplinePath::GetPath() const +{ + return path; +} + #endif // DIALOGSPLINEPATH_H diff --git a/src/dialogs/tools/dialogtriangle.h b/src/dialogs/tools/dialogtriangle.h index 964921d70..c1667fc43 100644 --- a/src/dialogs/tools/dialogtriangle.h +++ b/src/dialogs/tools/dialogtriangle.h @@ -43,18 +43,18 @@ class DialogTriangle : public DialogTool { Q_OBJECT public: - /** - * @brief DialogTriangle create dialog - * @param data container with data - * @param parent parent widget - */ - DialogTriangle(const VContainer *data, QWidget *parent = 0); - ~DialogTriangle(); + /** + * @brief DialogTriangle create dialog + * @param data container with data + * @param parent parent widget + */ + DialogTriangle(const VContainer *data, QWidget *parent = 0); + ~DialogTriangle(); /** * @brief getAxisP1Id return id first point of axis * @return id */ - inline quint32 getAxisP1Id() const {return axisP1Id;} + quint32 getAxisP1Id() const; /** * @brief setAxisP1Id set id first point of axis * @param value id @@ -65,7 +65,7 @@ public: * @brief getAxisP2Id return id second point of axis * @return id */ - inline quint32 getAxisP2Id() const {return axisP2Id;} + quint32 getAxisP2Id() const; /** * @brief setAxisP2Id set id second point of axis * @param value id @@ -76,7 +76,7 @@ public: * @brief getFirstPointId return id of first point * @return id */ - inline quint32 getFirstPointId() const {return firstPointId;} + quint32 getFirstPointId() const; /** * @brief setFirstPointId set id of first point * @param value id @@ -87,7 +87,7 @@ public: * @brief getSecondPointId return id of second point * @return id */ - inline quint32 getSecondPointId() const {return secondPointId;} + quint32 getSecondPointId() const; /** * @brief setSecondPointId set id of second point * @param value id @@ -98,7 +98,7 @@ public: * @brief getPointName return name of point * @return name */ - inline QString getPointName() const {return pointName;} + QString getPointName() const; /** * @brief setPointName set name of point * @param value name @@ -147,4 +147,29 @@ private: quint32 secondPointId; }; +inline quint32 DialogTriangle::getAxisP1Id() const +{ + return axisP1Id; +} + +inline quint32 DialogTriangle::getAxisP2Id() const +{ + return axisP2Id; +} + +inline quint32 DialogTriangle::getFirstPointId() const +{ + return firstPointId; +} + +inline quint32 DialogTriangle::getSecondPointId() const +{ + return secondPointId; +} + +inline QString DialogTriangle::getPointName() const +{ + return pointName; +} + #endif // DIALOGTRIANGLE_H diff --git a/src/dialogs/tools/dialoguniondetails.h b/src/dialogs/tools/dialoguniondetails.h index c165436ab..a525c0aba 100644 --- a/src/dialogs/tools/dialoguniondetails.h +++ b/src/dialogs/tools/dialoguniondetails.h @@ -54,22 +54,22 @@ public: * @brief getD1 return id first detail * @return id */ - inline quint32 getD1() const {return d1;} + quint32 getD1() const; /** * @brief getD2 return id second detail * @return id */ - inline quint32 getD2() const {return d2;} + quint32 getD2() const; /** * @brief getIndexD1 return index edge first detail * @return index */ - inline ptrdiff_t getIndexD1() const {return indexD1;} + ptrdiff_t getIndexD1() const; /** * @brief getIndexD2 return index edge second detail * @return index */ - inline ptrdiff_t getIndexD2() const {return indexD2;} + ptrdiff_t getIndexD2() const; public slots: /** * @brief ChoosedObject gets id and type of selected object. Save correct data and ignore wrong. @@ -136,4 +136,24 @@ private: void ChoosedDetail(const quint32 &id, const Scene::Scenes &type, quint32 &idDetail, ptrdiff_t &index); }; +inline quint32 DialogUnionDetails::getD1() const +{ + return d1; +} + +inline quint32 DialogUnionDetails::getD2() const +{ + return d2; +} + +inline ptrdiff_t DialogUnionDetails::getIndexD1() const +{ + return indexD1; +} + +inline ptrdiff_t DialogUnionDetails::getIndexD2() const +{ + return indexD2; +} + #endif // DIALOGUNIONDETAILS_H diff --git a/src/exception/vexception.h b/src/exception/vexception.h index 6eea96e64..e25f6b9f1 100644 --- a/src/exception/vexception.h +++ b/src/exception/vexception.h @@ -54,37 +54,52 @@ public: /** * @brief raise method raise for exception */ - inline void raise() const { throw *this; } + void raise() const; /** * @brief clone clone exception * @return new exception */ - inline VException *clone() const { return new VException(*this); } + VException *clone() const; /** * @brief ErrorMessage return main error message * @return error message */ - virtual QString ErrorMessage() const; + virtual QString ErrorMessage() const; /** * @brief DetailedInformation return detailed information about error * @return detailed information */ - virtual QString DetailedInformation() const { return QString(); } + virtual QString DetailedInformation() const { return QString(); } /** * @brief What return string with error * @return string with error */ - inline QString What() const {return what;} + QString What() const; /** * @brief CriticalMessageBox show Critical Message Box. * @param situation main text message box. */ - virtual void CriticalMessageBox(const QString &situation, QWidget *parent = 0) const; + virtual void CriticalMessageBox(const QString &situation, QWidget *parent = 0) const; protected: /** * @brief what string with error */ - QString what; + QString what; }; +inline void VException::raise() const +{ + throw *this; +} + +inline VException *VException::clone() const +{ + return new VException(*this); +} + +inline QString VException::What() const +{ + return what; +} + #endif // VEXCEPTION_H diff --git a/src/exception/vexceptionbadid.h b/src/exception/vexceptionbadid.h index 587d74d7c..beee3cdf0 100644 --- a/src/exception/vexceptionbadid.h +++ b/src/exception/vexceptionbadid.h @@ -67,12 +67,12 @@ public: * @brief BadId return bad id * @return id */ - inline quint32 BadId() const {return id; } + quint32 BadId() const; /** * @brief BadKey return bad key * @return key */ - inline QString BadKey() const {return key; } + QString BadKey() const; protected: /** * @brief id id @@ -84,4 +84,14 @@ protected: QString key; }; +inline quint32 VExceptionBadId::BadId() const +{ + return id; +} + +inline QString VExceptionBadId::BadKey() const +{ + return key; +} + #endif // VEXCEPTIONBADID_H diff --git a/src/exception/vexceptionconversionerror.cpp b/src/exception/vexceptionconversionerror.cpp index cfc0634c5..bc216ba43 100644 --- a/src/exception/vexceptionconversionerror.cpp +++ b/src/exception/vexceptionconversionerror.cpp @@ -34,6 +34,12 @@ VExceptionConversionError::VExceptionConversionError(const QString &what, const Q_ASSERT_X(str.isEmpty() == false, Q_FUNC_INFO, "Error converting string is empty"); } +VExceptionConversionError::VExceptionConversionError(const VExceptionConversionError &e) + :VException(e), str(e.String()) +{ + +} + QString VExceptionConversionError::ErrorMessage() const { QString error = QString("ExceptionConversionError: %1 %2").arg(what, str); diff --git a/src/exception/vexceptionconversionerror.h b/src/exception/vexceptionconversionerror.h index 9f725b28f..fbf5d4ac2 100644 --- a/src/exception/vexceptionconversionerror.h +++ b/src/exception/vexceptionconversionerror.h @@ -47,8 +47,7 @@ public: * @brief VExceptionConversionError copy constructor * @param e exception */ - VExceptionConversionError(const VExceptionConversionError &e) - :VException(e), str(e.String()){} + VExceptionConversionError(const VExceptionConversionError &e); virtual ~VExceptionConversionError() noexcept (true) {} /** * @brief ErrorMessage return main error message @@ -59,7 +58,7 @@ public: * @brief String return string, where happend error * @return string */ - inline QString String() const {return str;} + QString String() const; protected: /** * @brief str string, where happend error @@ -67,4 +66,9 @@ protected: QString str; }; +inline QString VExceptionConversionError::String() const +{ + return str; +} + #endif // VEXCEPTIONCONVERSIONERROR_H diff --git a/src/exception/vexceptionemptyparameter.cpp b/src/exception/vexceptionemptyparameter.cpp index c3fdf6b7a..1d12deac5 100644 --- a/src/exception/vexceptionemptyparameter.cpp +++ b/src/exception/vexceptionemptyparameter.cpp @@ -42,6 +42,12 @@ VExceptionEmptyParameter::VExceptionEmptyParameter(const QString &what, const QS lineNumber = domElement.lineNumber(); } +VExceptionEmptyParameter::VExceptionEmptyParameter(const VExceptionEmptyParameter &e) + :VException(e), name(e.Name()), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()) +{ + +} + QString VExceptionEmptyParameter::ErrorMessage() const { QString error = QString("ExceptionEmptyParameter: %1 %2").arg(what, name); diff --git a/src/exception/vexceptionemptyparameter.h b/src/exception/vexceptionemptyparameter.h index b514683a9..8f9f5525a 100644 --- a/src/exception/vexceptionemptyparameter.h +++ b/src/exception/vexceptionemptyparameter.h @@ -50,9 +50,7 @@ public: * @brief VExceptionEmptyParameter copy constructor * @param e exception */ - VExceptionEmptyParameter(const VExceptionEmptyParameter &e) - :VException(e), name(e.Name()), tagText(e.TagText()), tagName(e.TagName()), - lineNumber(e.LineNumber()){} + VExceptionEmptyParameter(const VExceptionEmptyParameter &e); virtual ~VExceptionEmptyParameter() noexcept (true) {} /** * @brief ErrorMessage return main error message @@ -68,22 +66,22 @@ public: * @brief Name return name of attribute where error * @return name */ - inline QString Name() const {return name;} + QString Name() const; /** * @brief TagText return tag text * @return tag text */ - inline QString TagText() const {return tagText;} + QString TagText() const; /** * @brief TagName return tag name * @return tag name */ - inline QString TagName() const {return tagName;} + QString TagName() const; /** * @brief LineNumber return line number of tag * @return line number */ - inline qint32 LineNumber() const {return lineNumber;} + qint32 LineNumber() const; protected: /** * @brief name name attribute @@ -103,4 +101,24 @@ protected: qint32 lineNumber; }; +inline QString VExceptionEmptyParameter::Name() const +{ + return name; +} + +inline QString VExceptionEmptyParameter::TagText() const +{ + return tagText; +} + +inline QString VExceptionEmptyParameter::TagName() const +{ + return tagName; +} + +inline qint32 VExceptionEmptyParameter::LineNumber() const +{ + return lineNumber; +} + #endif // VEXCEPTIONEMPTYPARAMETER_H diff --git a/src/exception/vexceptionobjecterror.cpp b/src/exception/vexceptionobjecterror.cpp index 7b77be4a3..ab69f8a3b 100644 --- a/src/exception/vexceptionobjecterror.cpp +++ b/src/exception/vexceptionobjecterror.cpp @@ -39,6 +39,13 @@ VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElem lineNumber = domElement.lineNumber(); } +VExceptionObjectError::VExceptionObjectError(const VExceptionObjectError &e) + :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()), + moreInfo(e.MoreInformation()) +{ + +} + QString VExceptionObjectError::ErrorMessage() const { QString error = QString("ExceptionObjectError: %1").arg(what); diff --git a/src/exception/vexceptionobjecterror.h b/src/exception/vexceptionobjecterror.h index 71e90329b..ab2baa4f5 100644 --- a/src/exception/vexceptionobjecterror.h +++ b/src/exception/vexceptionobjecterror.h @@ -39,20 +39,18 @@ class VExceptionObjectError : public VException { public: - /** - * @brief VExceptionObjectError exception object error - * @param what string with error - * @param domElement dom element - */ - VExceptionObjectError(const QString &what, const QDomElement &domElement); - /** - * @brief VExceptionObjectError copy constructor - * @param e exception - */ - VExceptionObjectError(const VExceptionObjectError &e) - :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()), - moreInfo(e.MoreInformation()){} - virtual ~VExceptionObjectError() noexcept (true) {} + /** + * @brief VExceptionObjectError exception object error + * @param what string with error + * @param domElement dom element + */ + VExceptionObjectError(const QString &what, const QDomElement &domElement); + /** + * @brief VExceptionObjectError copy constructor + * @param e exception + */ + VExceptionObjectError(const VExceptionObjectError &e); + virtual ~VExceptionObjectError() noexcept (true) {} /** * @brief ErrorMessage return main error message * @return main error message @@ -67,17 +65,17 @@ public: * @brief TagText return tag text * @return tag text */ - inline QString TagText() const {return tagText;} + QString TagText() const; /** * @brief TagName return tag name * @return tag name */ - inline QString TagName() const {return tagName;} + QString TagName() const; /** * @brief LineNumber return line number in file * @return line number */ - inline qint32 LineNumber() const {return lineNumber;} + qint32 LineNumber() const; /** * @brief AddMoreInformation add more information for error * @param info information @@ -87,7 +85,7 @@ public: * @brief MoreInformation return more information for error * @return information */ - inline QString MoreInformation() const {return moreInfo;} + QString MoreInformation() const; protected: /** * @brief tagText tag text @@ -107,4 +105,24 @@ protected: QString moreInfo; }; +inline QString VExceptionObjectError::TagText() const +{ + return tagText; +} + +inline QString VExceptionObjectError::TagName() const +{ + return tagName; +} + +inline qint32 VExceptionObjectError::LineNumber() const +{ + return lineNumber; +} + +inline QString VExceptionObjectError::MoreInformation() const +{ + return moreInfo; +} + #endif // VEXCEPTIONOBJECTERROR_H diff --git a/src/exception/vexceptionuniqueid.cpp b/src/exception/vexceptionuniqueid.cpp index 9232d0ca7..6578290ca 100644 --- a/src/exception/vexceptionuniqueid.cpp +++ b/src/exception/vexceptionuniqueid.cpp @@ -40,6 +40,12 @@ VExceptionUniqueId::VExceptionUniqueId(const QString &what, const QDomElement &d lineNumber = domElement.lineNumber(); } +VExceptionUniqueId::VExceptionUniqueId(const VExceptionUniqueId &e) + :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()) +{ + +} + QString VExceptionUniqueId::ErrorMessage() const { QString error = QString("ExceptionUniqueId: %1").arg(what); diff --git a/src/exception/vexceptionuniqueid.h b/src/exception/vexceptionuniqueid.h index 7e8abd569..8125c2966 100644 --- a/src/exception/vexceptionuniqueid.h +++ b/src/exception/vexceptionuniqueid.h @@ -39,18 +39,17 @@ class VExceptionUniqueId : public VException { public: - /** - * @brief VExceptionUniqueId exception unique id - * @param what string with error - * @param domElement dom element - */ - VExceptionUniqueId(const QString &what, const QDomElement &domElement); - /** - * @brief VExceptionUniqueId copy constructor - * @param e exception - */ - VExceptionUniqueId(const VExceptionUniqueId &e) - :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){} + /** + * @brief VExceptionUniqueId exception unique id + * @param what string with error + * @param domElement dom element + */ + VExceptionUniqueId(const QString &what, const QDomElement &domElement); + /** + * @brief VExceptionUniqueId copy constructor + * @param e exception + */ + VExceptionUniqueId(const VExceptionUniqueId &e); virtual ~VExceptionUniqueId() noexcept (true){} /** * @brief ErrorMessage return main error message @@ -66,17 +65,17 @@ public: * @brief TagText return tag text * @return tag text */ - inline QString TagText() const {return tagText;} + QString TagText() const; /** * @brief TagName return tag name * @return tag name */ - inline QString TagName() const {return tagName;} + QString TagName() const; /** * @brief LineNumber return line number in file * @return line number */ - inline qint32 LineNumber() const {return lineNumber;} + qint32 LineNumber() const; protected: /** * @brief tagText tag text @@ -92,4 +91,19 @@ protected: qint32 lineNumber; }; +inline QString VExceptionUniqueId::TagText() const +{ + return tagText; +} + +inline QString VExceptionUniqueId::TagName() const +{ + return tagName; +} + +inline qint32 VExceptionUniqueId::LineNumber() const +{ + return lineNumber; +} + #endif // VEXCEPTIONUNIQUEID_H diff --git a/src/exception/vexceptionwrongparameterid.cpp b/src/exception/vexceptionwrongparameterid.cpp index 14f5ab8ef..0e99ee018 100644 --- a/src/exception/vexceptionwrongparameterid.cpp +++ b/src/exception/vexceptionwrongparameterid.cpp @@ -39,6 +39,12 @@ VExceptionWrongParameterId::VExceptionWrongParameterId(const QString &what, cons lineNumber = domElement.lineNumber(); } +VExceptionWrongParameterId::VExceptionWrongParameterId(const VExceptionWrongParameterId &e) + :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()) +{ + +} + QString VExceptionWrongParameterId::ErrorMessage() const { QString error = QString("ExceptionWrongParameterId: %1").arg(what); diff --git a/src/exception/vexceptionwrongparameterid.h b/src/exception/vexceptionwrongparameterid.h index bc10495c8..55879c986 100644 --- a/src/exception/vexceptionwrongparameterid.h +++ b/src/exception/vexceptionwrongparameterid.h @@ -39,19 +39,18 @@ class VExceptionWrongParameterId : public VException { public: - /** - * @brief VExceptionWrongParameterId exception wrong parameter id - * @param what string with error - * @param domElement som element - */ - VExceptionWrongParameterId(const QString &what, const QDomElement &domElement); - /** - * @brief VExceptionWrongParameterId copy constructor - * @param e exception - */ - VExceptionWrongParameterId(const VExceptionWrongParameterId &e) - :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()){} - virtual ~VExceptionWrongParameterId() noexcept (true){} + /** + * @brief VExceptionWrongParameterId exception wrong parameter id + * @param what string with error + * @param domElement som element + */ + VExceptionWrongParameterId(const QString &what, const QDomElement &domElement); + /** + * @brief VExceptionWrongParameterId copy constructor + * @param e exception + */ + VExceptionWrongParameterId(const VExceptionWrongParameterId &e); + virtual ~VExceptionWrongParameterId() noexcept (true){} /** * @brief ErrorMessage return main error message * @return main error message @@ -66,17 +65,17 @@ public: * @brief TagText return tag text * @return tag text */ - inline QString TagText() const {return tagText;} + QString TagText() const; /** * @brief TagName return tag name * @return tag name */ - inline QString TagName() const {return tagName;} + QString TagName() const; /** * @brief LineNumber return line number in file * @return line number */ - inline qint32 LineNumber() const {return lineNumber;} + qint32 LineNumber() const; protected: /** * @brief tagText tag text @@ -92,4 +91,19 @@ protected: qint32 lineNumber; }; +inline QString VExceptionWrongParameterId::TagText() const +{ + return tagText; +} + +inline QString VExceptionWrongParameterId::TagName() const +{ + return tagName; +} + +inline qint32 VExceptionWrongParameterId::LineNumber() const +{ + return lineNumber; +} + #endif // VEXCEPTIONWRONGPARAMETERID_H diff --git a/src/geometry/varc.h b/src/geometry/varc.h index ccb13fef0..3bfceac46 100644 --- a/src/geometry/varc.h +++ b/src/geometry/varc.h @@ -44,50 +44,50 @@ class VArc: public VGObject { Q_DECLARE_TR_FUNCTIONS(VArc) public: - /** - * @brief VArc default constructor. - */ - VArc (); - /** - * @brief VArc constructor. - * @param center center point. - * @param radius arc radius. - * @param f1 start angle (degree). - * @param f2 end angle (degree). - */ - VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, - QString formulaF2, quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); - /** - * @brief VArc copy constructor - * @param arc arc - */ - VArc(const VArc &arc); - /** - * @brief operator = assignment operator - * @param arc arc - * @return arc - */ - VArc& operator= (const VArc &arc); + /** + * @brief VArc default constructor. + */ + VArc (); + /** + * @brief VArc constructor. + * @param center center point. + * @param radius arc radius. + * @param f1 start angle (degree). + * @param f2 end angle (degree). + */ + VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, + QString formulaF2, quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); + /** + * @brief VArc copy constructor + * @param arc arc + */ + VArc(const VArc &arc); + /** + * @brief operator = assignment operator + * @param arc arc + * @return arc + */ + VArc& operator= (const VArc &arc); /** * @brief GetF1 return start angle. * @return angle in degree. */ - inline QString GetFormulaF1 () const {return formulaF1;} + QString GetFormulaF1 () const; /** * @brief GetF1 return formula for start angle. * @return string with formula. */ - inline qreal GetF1 () const {return f1;} + qreal GetF1 () const; /** * @brief GetF2 return end angle. * @return angle in degree. */ - inline QString GetFormulaF2 () const {return formulaF2;} + QString GetFormulaF2 () const; /** * @brief GetF2 return formula for end angle. * @return string with formula. */ - inline qreal GetF2 () const {return f2;} + qreal GetF2 () const; /** * @brief GetLength return arc length. * @return length. @@ -97,22 +97,22 @@ public: * @brief GetRadius return arc radius. * @return radius. */ - inline QString GetFormulaRadius () const {return formulaRadius;} + QString GetFormulaRadius () const; /** * @brief GetRadius return formula for radius. * @return string with formula. */ - inline qreal GetRadius () const {return radius;} + qreal GetRadius () const; /** * @brief GetCenter return center point. * @return center point. */ - inline VPointF GetCenter () const {return center;} + VPointF GetCenter () const; /** * @brief GetP1 return point associated with start angle. * @return point. */ - QPointF GetP1() const; + QPointF GetP1() const; /** * @brief GetP2 return point associated with end angle. * @return точку point. @@ -182,4 +182,39 @@ private: VPointF center; }; +inline QString VArc::GetFormulaF1() const +{ + return formulaF1; +} + +inline qreal VArc::GetF1() const +{ + return f1; +} + +inline QString VArc::GetFormulaF2() const +{ + return formulaF2; +} + +inline qreal VArc::GetF2() const +{ + return f2; +} + +inline QString VArc::GetFormulaRadius() const +{ + return formulaRadius; +} + +inline qreal VArc::GetRadius() const +{ + return radius; +} + +inline VPointF VArc::GetCenter() const +{ + return center; +} + #endif // VARC_H diff --git a/src/geometry/vdetail.h b/src/geometry/vdetail.h index fa4318fef..6c0a2975c 100644 --- a/src/geometry/vdetail.h +++ b/src/geometry/vdetail.h @@ -59,32 +59,32 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Detail::Equidistants) class VDetail { public: - /** - * @brief VDetail default contructor. Create empty detail. - */ - VDetail(); - /** - * @brief VDetail constructor. - * @param name detail name. - * @param nodes list of nodes. - */ - VDetail(const QString &name, const QVector &nodes); - /** - * @brief VDetail copy constructor. - * @param detail detail. - */ - VDetail(const VDetail &detail); - /** - * @brief operator = assignment operator. - * @param detail detail. - * @return new detail. - */ - VDetail &operator=(const VDetail &detail); + /** + * @brief VDetail default contructor. Create empty detail. + */ + VDetail(); + /** + * @brief VDetail constructor. + * @param name detail name. + * @param nodes list of nodes. + */ + VDetail(const QString &name, const QVector &nodes); + /** + * @brief VDetail copy constructor. + * @param detail detail. + */ + VDetail(const VDetail &detail); + /** + * @brief operator = assignment operator. + * @param detail detail. + * @return new detail. + */ + VDetail &operator=(const VDetail &detail); /** * @brief append append in the end of list node. * @param node new node. */ - inline void append(const VNodeDetail &node) {nodes.append(node);} + void append(const VNodeDetail &node); /** * @brief Clear detail full clear. */ @@ -97,7 +97,7 @@ public: * @brief CountNode return count nodes. * @return count. */ - inline qint32 CountNode() const {return nodes.size();} + qint32 CountNode() const; /** * @brief Containes check if detail containe this id. * @param id object id. @@ -120,72 +120,72 @@ public: * @brief getName return detail name. * @return name. */ - inline QString getName() const {return name;} + QString getName() const; /** * @brief setName set detail name. * @param value new name. */ - inline void setName(const QString &value) {name = value;} + void setName(const QString &value); /** * @brief getMx return bias for X axis. * @return x bias. */ - inline qreal getMx() const {return mx;} + qreal getMx() const; /** * @brief setMx set bias for X axis. * @param value new x bias. */ - inline void setMx(const qreal &value) {mx = value;} + void setMx(const qreal &value); /** * @brief getMy get bias for y axis. * @return y axis. */ - inline qreal getMy() const {return my;} + qreal getMy() const; /** * @brief setMy set bias for y axis. * @param value new y bias. */ - inline void setMy(const qreal &value) {my = value;} + void setMy(const qreal &value); /** * @brief getSeamAllowance keep status for seam allowance detail. * @return true - need seam allowance, false - no need seam allowance. */ - inline bool getSeamAllowance() const {return seamAllowance;} + bool getSeamAllowance() const; /** * @brief setSeamAllowance set status for seam allowance detail. * @param value true - need seam allowance, false - no need seam allowance. */ - inline void setSeamAllowance(bool value) {seamAllowance = value;} + void setSeamAllowance(bool value); /** * @brief getClosed keep close status for detail equdistant. * @return true - close equdistant, false - don't close equdistant. */ - inline bool getClosed() const {return closed;} + bool getClosed() const; /** * @brief setClosed set close status for detail equdistant. * @param value true - close equdistant, false - don't close equdistant. */ - inline void setClosed(bool value) {closed = value;} + void setClosed(bool value); /** * @brief getWidth return value detail seam allowance. * @return value in mm. */ - inline qreal getWidth() const {return width;} + qreal getWidth() const; /** * @brief setWidth set value detail seam allowance. * @param value width in mm. */ - inline void setWidth(const qreal &value) {width = value;} + void setWidth(const qreal &value); /** * @brief getNodes return list of nodes. * @return list of nodes. */ - inline QVector getNodes() const {return nodes;} + QVector getNodes() const; /** * @brief setNodes set list of nodes * @param value list of nodes */ - inline void setNodes(const QVector &value) {nodes = value;} + void setNodes(const QVector &value); /** * @brief indexOfNode return index in list node using id object. * @param id object (arc, point, spline, splinePath) id. @@ -237,12 +237,12 @@ public: * @param det changed detail. * @return list with missing detail. */ - QList Missing(const VDetail &det) const; + QList Missing(const VDetail &det) const; private: /** * @brief _id id detail. */ - quint32 _id; + quint32 _id; /** * @brief nodes list detail nodes. */ @@ -285,4 +285,84 @@ private: static ptrdiff_t indexOfNode(const QVector &list, const quint32 &id); }; +inline void VDetail::append(const VNodeDetail &node) +{ + nodes.append(node); +} + +inline qint32 VDetail::CountNode() const +{ + return nodes.size(); +} + +inline QString VDetail::getName() const +{ + return name; +} + +inline void VDetail::setName(const QString &value) +{ + name = value; +} + +inline qreal VDetail::getMx() const +{ + return mx; +} + +inline void VDetail::setMx(const qreal &value) +{ + mx = value; +} + +inline qreal VDetail::getMy() const +{ + return my; +} + +inline void VDetail::setMy(const qreal &value) +{ + my = value; +} + +inline bool VDetail::getSeamAllowance() const +{ + return seamAllowance; +} + +inline void VDetail::setSeamAllowance(bool value) +{ + seamAllowance = value; +} + +inline bool VDetail::getClosed() const +{ + return closed; +} + +inline void VDetail::setClosed(bool value) +{ + closed = value; +} + +inline qreal VDetail::getWidth() const +{ + return width; +} + +inline void VDetail::setWidth(const qreal &value) +{ + width = value; +} + +inline QVector VDetail::getNodes() const +{ + return nodes; +} + +inline void VDetail::setNodes(const QVector &value) +{ + nodes = value; +} + #endif // VDETAIL_H diff --git a/src/geometry/vnodedetail.h b/src/geometry/vnodedetail.h index 6d018339c..ec7d77e38 100644 --- a/src/geometry/vnodedetail.h +++ b/src/geometry/vnodedetail.h @@ -48,90 +48,90 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(NodeDetail::NodeDetails) class VNodeDetail { public: - /** - * @brief VNodeDetail default constructor. - */ - VNodeDetail(); - /** - * @brief VNodeDetail constructor. - * @param id object id - * @param typeTool type tool - * @param typeNode type node - * @param mx object bias x axis - * @param my object bias y axis - */ - VNodeDetail(quint32 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx = 0, - qreal my = 0); - /** - * @brief VNodeDetail copy constructor - * @param node node - */ - VNodeDetail(const VNodeDetail &node); - /** - * @brief operator = assignment operator - * @param node node - * @return node - */ - VNodeDetail &operator=(const VNodeDetail &node); + /** + * @brief VNodeDetail default constructor. + */ + VNodeDetail(); + /** + * @brief VNodeDetail constructor. + * @param id object id + * @param typeTool type tool + * @param typeNode type node + * @param mx object bias x axis + * @param my object bias y axis + */ + VNodeDetail(quint32 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx = 0, + qreal my = 0); + /** + * @brief VNodeDetail copy constructor + * @param node node + */ + VNodeDetail(const VNodeDetail &node); + /** + * @brief operator = assignment operator + * @param node node + * @return node + */ + VNodeDetail &operator=(const VNodeDetail &node); /** * @brief getId return object id. * @return id. */ - inline quint32 getId() const {return id;} + quint32 getId() const; /** * @brief setId set object id. * @param value object id. */ - inline void setId(const quint32 &value) {id = value;} + void setId(const quint32 &value); /** * @brief getTypeTool return tool type. * @return tool type. */ - inline Tool::Tools getTypeTool() const {return typeTool;} + Tool::Tools getTypeTool() const; /** * @brief setTypeTool set tool type. * @param value tool type. */ - inline void setTypeTool(const Tool::Tools &value) {typeTool = value;} + void setTypeTool(const Tool::Tools &value); /** * @brief getTypeNode return node type. * @return node type. */ - inline NodeDetail::NodeDetails getTypeNode() const {return typeNode;} + NodeDetail::NodeDetails getTypeNode() const; /** * @brief setTypeNode set node type. * @param value node type. */ - inline void setTypeNode(const NodeDetail::NodeDetails &value) {typeNode = value;} + void setTypeNode(const NodeDetail::NodeDetails &value); /** * @brief getMx return object bias x axis. * @return bias x axis. */ - inline qreal getMx() const {return mx;} + qreal getMx() const; /** * @brief setMx set object bias x axis. * @param value bias x axis. */ - inline void setMx(const qreal &value) {mx = value;} + void setMx(const qreal &value); /** * @brief getMy return object bias y axis. * @return bias y axis. */ - inline qreal getMy() const {return my;} + qreal getMy() const; /** * @brief setMy set object bias y axis. * @param value bias y axis. */ - inline void setMy(const qreal &value) {my = value;} + void setMy(const qreal &value); private: /** * @brief id object id. */ - quint32 id; + quint32 id; /** * @brief typeTool type of tool */ - Tool::Tools typeTool; + Tool::Tools typeTool; /** * @brief typeNode node type. */ @@ -139,13 +139,63 @@ private: /** * @brief mx bias x axis. */ - qreal mx; + qreal mx; /** * @brief my bias y axis. */ - qreal my; + qreal my; }; +inline quint32 VNodeDetail::getId() const +{ + return id; +} + +inline void VNodeDetail::setId(const quint32 &value) +{ + id = value; +} + +inline Tool::Tools VNodeDetail::getTypeTool() const +{ + return typeTool; +} + +inline void VNodeDetail::setTypeTool(const Tool::Tools &value) +{ + typeTool = value; +} + +inline NodeDetail::NodeDetails VNodeDetail::getTypeNode() const +{ + return typeNode; +} + +inline void VNodeDetail::setTypeNode(const NodeDetail::NodeDetails &value) +{ + typeNode = value; +} + +inline qreal VNodeDetail::getMx() const +{ + return mx; +} + +inline void VNodeDetail::setMx(const qreal &value) +{ + mx = value; +} + +inline qreal VNodeDetail::getMy() const +{ + return my; +} + +inline void VNodeDetail::setMy(const qreal &value) +{ + my = value; +} + Q_DECLARE_METATYPE(VNodeDetail) #endif // VNODEDETAIL_H diff --git a/src/geometry/vpointf.cpp b/src/geometry/vpointf.cpp index 703b93fe1..0455cfbb7 100644 --- a/src/geometry/vpointf.cpp +++ b/src/geometry/vpointf.cpp @@ -34,6 +34,21 @@ VPointF::VPointF(qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idO this->_name = name; } +VPointF::VPointF() :VGObject(GObject::Point, 0, Draw::Calculation), _mx(0), _my(0), _x(0), _y(0) +{ + +} + +VPointF::VPointF(const VPointF &point) :VGObject(point), _mx(point.mx()), _my(point.my()), _x(point.x()), _y(point.y()) +{ + +} + +VPointF::VPointF(const QPointF &point) :VGObject(VPointF()), _mx(0), _my(0), _x(point.x()), _y(point.y()) +{ + +} + VPointF &VPointF::operator =(const VPointF &point) { VGObject::operator=(point); diff --git a/src/geometry/vpointf.h b/src/geometry/vpointf.h index 51aaffcaa..416c5e58f 100644 --- a/src/geometry/vpointf.h +++ b/src/geometry/vpointf.h @@ -43,16 +43,13 @@ public: /** * @brief VPointF creat empty point */ - inline VPointF () - :VGObject(GObject::Point, 0, Draw::Calculation), _mx(0), _my(0), _x(0), _y(0){} + VPointF (); /** * @brief VPointF copy constructor * @param point */ - inline VPointF (const VPointF &point ) - :VGObject(point), _mx(point.mx()), _my(point.my()), _x(point.x()), _y(point.y()){} - inline VPointF (const QPointF &point ) - :VGObject(VPointF()), _mx(0), _my(0), _x(point.x()), _y(point.y()){} + VPointF (const VPointF &point ); + VPointF (const QPointF &point ); /** * @brief VPointF create new point * @param x x coordinate @@ -62,59 +59,60 @@ public: */ VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); + ~VPointF(){} /** * @brief operator = assignment operator * @param point point * @return point */ - VPointF &operator=(const VPointF &point); - ~VPointF(){} + VPointF &operator=(const VPointF &point); + /** * @brief mx return offset name respect to x * @return offset */ - inline qreal mx() const {return _mx;} + qreal mx() const; /** * @brief my return offset name respect to y * @return offset */ - inline qreal my() const {return _my;} + qreal my() const; /** * @brief setMx set offset name respect to x * @param mx offset */ - inline void setMx(qreal mx) {_mx = mx;} + void setMx(qreal mx); /** * @brief setMy set offset name respect to y * @param my offset */ - inline void setMy(qreal my) {_my = my;} + void setMy(qreal my); /** * @brief toQPointF convert to QPointF * @return QPointF point */ - inline QPointF toQPointF()const {return QPointF(_x, _y);} + QPointF toQPointF()const; /** * @brief x return x coordinate * @return value */ - inline qreal x() const {return _x;} + qreal x() const; /** * @brief setX set x coordinate * @param value x coordinate */ - inline void setX(const qreal &value){_x = value;} + void setX(const qreal &value); /** * @brief y return y coordinate * @return value */ - inline qreal y() const {return _y;} + qreal y() const; /** * @brief setY set y coordinate * @param value y coordinate */ - inline void setY(const qreal &value){_y = value;} - virtual QString name() const{return _name;} + void setY(const qreal &value); + virtual QString name() const; private: /** * @brief _mx offset name respect to x @@ -134,4 +132,54 @@ private: qreal _y; }; +inline qreal VPointF::mx() const +{ + return _mx; +} + +inline qreal VPointF::my() const +{ + return _my; +} + +inline void VPointF::setMx(qreal mx) +{ + _mx = mx; +} + +inline void VPointF::setMy(qreal my) +{ + _my = my; +} + +inline QPointF VPointF::toQPointF() const +{ + return QPointF(_x, _y); +} + +inline qreal VPointF::x() const +{ + return _x; +} + +inline void VPointF::setX(const qreal &value) +{ + _x = value; +} + +inline qreal VPointF::y() const +{ + return _y; +} + +inline void VPointF::setY(const qreal &value) +{ + _y = value; +} + +inline QString VPointF::name() const +{ + return _name; +} + #endif // VPOINTF_H diff --git a/src/geometry/vspline.h b/src/geometry/vspline.h index af1bebfb8..96211ba50 100644 --- a/src/geometry/vspline.h +++ b/src/geometry/vspline.h @@ -80,57 +80,57 @@ public: * @brief GetP1 return first spline point. * @return first point. */ - VPointF GetP1 () const {return p1;} + VPointF GetP1 () const {return p1;} /** * @brief GetP2 return first control point. * @return first control point. */ - inline QPointF GetP2 () const {return p2;} + QPointF GetP2 () const; /** * @brief GetP3 return second control point. * @return second control point. */ - inline QPointF GetP3 () const {return p3;} + QPointF GetP3 () const; /** * @brief GetP4 return last spline point. * @return остання точка сплайну. */ - inline VPointF GetP4 () const {return p4;} + VPointF GetP4 () const; /** * @brief GetAngle1 return first angle control line. * @return angle. */ - inline qreal GetAngle1 () const {return angle1;} + qreal GetAngle1 () const; /** * @brief GetAngle2 return second angle control line. * @return angle. */ - inline qreal GetAngle2() const {return angle2;} + qreal GetAngle2() const; /** * @brief GetLength return length of spline. * @return length. */ - qreal GetLength () const; + qreal GetLength () const; /** * @brief name return spline name. Used for variables. * @return name. */ - QString name () const; + QString name () const; /** * @brief GetKasm1 return coefficient of length first control line. * @return coefficient. */ - inline qreal GetKasm1() const {return kAsm1;} + qreal GetKasm1() const; /** * @brief GetKasm2 return coefficient of length second control line. * @return coefficient. */ - inline qreal GetKasm2() const {return kAsm2;} + qreal GetKasm2() const; /** * @brief GetKcurve return coefficient of curvature spline. * @return coefficient */ - inline qreal GetKcurve() const {return kCurve;} + qreal GetKcurve() const; /** * @brief CrossingSplLine check intersection spline with line. * @param line line. @@ -266,4 +266,44 @@ private: void CreateName(); }; +inline QPointF VSpline::GetP2() const +{ + return p2; +} + +inline QPointF VSpline::GetP3() const +{ + return p3; +} + +inline VPointF VSpline::GetP4() const +{ + return p4; +} + +inline qreal VSpline::GetAngle1() const +{ + return angle1; +} + +inline qreal VSpline::GetAngle2() const +{ + return angle2; +} + +inline qreal VSpline::GetKasm1() const +{ + return kAsm1; +} + +inline qreal VSpline::GetKasm2() const +{ + return kAsm2; +} + +inline qreal VSpline::GetKcurve() const +{ + return kCurve; +} + #endif // VSPLINE_H diff --git a/src/geometry/vsplinepath.h b/src/geometry/vsplinepath.h index b13cc4922..127ed5b3f 100644 --- a/src/geometry/vsplinepath.h +++ b/src/geometry/vsplinepath.h @@ -53,18 +53,18 @@ class VSplinePath :public VGObject { Q_DECLARE_TR_FUNCTIONS(VSplinePath) public: - /** - * @brief VSplinePath constructor. - * @param kCurve coefficient of curvature spline path. - * @param idObject parent id. - * @param mode mode creation spline path. - */ - VSplinePath(qreal kCurve = 1, quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); - /** - * @brief VSplinePath copy constructor. - * @param splPath spline path. - */ - VSplinePath(const VSplinePath& splPath); + /** + * @brief VSplinePath constructor. + * @param kCurve coefficient of curvature spline path. + * @param idObject parent id. + * @param mode mode creation spline path. + */ + VSplinePath(qreal kCurve = 1, quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); + /** + * @brief VSplinePath copy constructor. + * @param splPath spline path. + */ + VSplinePath(const VSplinePath& splPath); /** * @brief append add point in the end of list points. * @param point new point. @@ -79,7 +79,7 @@ public: * @brief CountPoint return count point. * @return count. */ - inline qint32 CountPoint() const {return path.size();} + qint32 CountPoint() const; /** * @brief GetSpline return spline by index. * @param index index spline in spline path. @@ -90,7 +90,7 @@ public: * @brief GetPath return QPainterPath which reprezent spline path. * @return path. */ - QPainterPath GetPath() const; + QPainterPath GetPath() const; /** * @brief GetPathPoints return list of points what located on path. * @return list. @@ -100,7 +100,7 @@ public: * @brief GetSplinePath return list with spline points. * @return list. */ - inline QVector GetSplinePath() const {return path;} + QVector GetSplinePath() const; /** * @brief GetLength return length of spline path. * @return length. @@ -123,22 +123,22 @@ public: /** * @brief Clear clear list of points. */ - inline void Clear() {path.clear();} + void Clear(); /** * @brief getKCurve return coefficient of curvature spline path. * @return coefficient of curvature spline. */ - inline qreal getKCurve() const {return kCurve;} + qreal getKCurve() const; /** * @brief setKCurve set coefficient of curvature spline path. * @param value coefficient of curvature spline path. */ - inline void setKCurve(const qreal &value) {kCurve = value;} + void setKCurve(const qreal &value); /** * @brief GetPoint pointer to list spline point. * @return list. */ - inline const QVector *GetPoint() const {return &path;} + const QVector *GetPoint() const; /** * @brief operator = assignment operator. * @param path spline path. @@ -212,4 +212,34 @@ protected: qint32 maxCountPoints; }; +inline qint32 VSplinePath::CountPoint() const +{ + return path.size(); +} + +inline QVector VSplinePath::GetSplinePath() const +{ + return path; +} + +inline void VSplinePath::Clear() +{ + path.clear(); +} + +inline qreal VSplinePath::getKCurve() const +{ + return kCurve; +} + +inline void VSplinePath::setKCurve(const qreal &value) +{ + kCurve = value; +} + +inline const QVector *VSplinePath::GetPoint() const +{ + return &path; +} + #endif // VSPLINEPATH_H diff --git a/src/geometry/vsplinepoint.h b/src/geometry/vsplinepoint.h index 30517c406..dbe57a5db 100644 --- a/src/geometry/vsplinepoint.h +++ b/src/geometry/vsplinepoint.h @@ -39,73 +39,73 @@ class VSplinePoint { public: - /** - * @brief VSplinePoint default constructor. - */ - VSplinePoint(); - /** - * @brief VSplinePoint constructor. - * @param pSpline spline point. - * @param angle second angle control line. - * @param factor coefficient of length second control line. - */ - VSplinePoint(VPointF pSpline, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2); - /** - * @brief VSplinePoint copy constructor - * @param point point - */ - VSplinePoint(const VSplinePoint &point); - ~VSplinePoint() {} + /** + * @brief VSplinePoint default constructor. + */ + VSplinePoint(); + /** + * @brief VSplinePoint constructor. + * @param pSpline spline point. + * @param angle second angle control line. + * @param factor coefficient of length second control line. + */ + VSplinePoint(VPointF pSpline, qreal kAsm1, qreal angle1, qreal kAsm2, qreal angle2); + /** + * @brief VSplinePoint copy constructor + * @param point point + */ + VSplinePoint(const VSplinePoint &point); + ~VSplinePoint() {} /** * @brief P return point. * @return point. */ - inline VPointF P() const {return pSpline;} + VPointF P() const; /** * @brief SetP set point. * @param value point. */ - inline void SetP(const VPointF &value) {pSpline = value;} + void SetP(const VPointF &value); /** * @brief Angle1 return first angle of spline. * @return angle. */ - inline qreal Angle1() const {return angle1;} + qreal Angle1() const; /** * @brief SetAngle1 set first angle of spline. * @param value angle. */ - void SetAngle1(const qreal &value); + void SetAngle1(const qreal &value); /** * @brief SetAngle2 set second angle of spline. * @param value angle. */ - void SetAngle2(const qreal &value); + void SetAngle2(const qreal &value); /** * @brief Angle2 return second angle of spline. * @return angle. */ - inline qreal Angle2() const {return angle2;} + qreal Angle2() const; /** * @brief KAsm1 return coefficient of length first control line. * @return coefficient. */ - inline qreal KAsm1() const {return kAsm1;} + qreal KAsm1() const; /** * @brief SetKAsm1 set coefficient of length first control line. * @param value coefficient. */ - inline void SetKAsm1(const qreal &value) {kAsm1 = value;} + void SetKAsm1(const qreal &value); /** * @brief KAsm2 return coefficient of length second control line. * @return coefficient. */ - inline qreal KAsm2() const {return kAsm2;} + qreal KAsm2() const; /** * @brief SetKAsm2 set coefficient of length second control line. * @param value coefficient. */ - inline void SetKAsm2(const qreal &value) {kAsm2 = value;} + void SetKAsm2(const qreal &value); protected: /** * @brief pSpline point. @@ -129,6 +129,46 @@ protected: qreal kAsm2; }; +inline VPointF VSplinePoint::P() const +{ + return pSpline; +} + +inline void VSplinePoint::SetP(const VPointF &value) +{ + pSpline = value; +} + +inline qreal VSplinePoint::Angle1() const +{ + return angle1; +} + +inline qreal VSplinePoint::Angle2() const +{ + return angle2; +} + +inline qreal VSplinePoint::KAsm1() const +{ + return kAsm1; +} + +inline void VSplinePoint::SetKAsm1(const qreal &value) +{ + kAsm1 = value; +} + +inline qreal VSplinePoint::KAsm2() const +{ + return kAsm2; +} + +inline void VSplinePoint::SetKAsm2(const qreal &value) +{ + kAsm2 = value; +} + Q_DECLARE_METATYPE(VSplinePoint) #endif // VSPLINEPOINT_H diff --git a/src/tools/vabstracttool.h b/src/tools/vabstracttool.h index 13b170661..0b2351d4c 100644 --- a/src/tools/vabstracttool.h +++ b/src/tools/vabstracttool.h @@ -40,15 +40,15 @@ class VAbstractTool: public VDataTool { Q_OBJECT public: - /** - * @brief VAbstractTool container. - * @param doc dom document container. - * @param data container with data. - * @param id object id in container. - * @param parent parent object. - */ - VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent = 0); - virtual ~VAbstractTool(){} + /** + * @brief VAbstractTool container. + * @param doc dom document container. + * @param data container with data. + * @param id object id in container. + * @param parent parent object. + */ + VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent = 0); + virtual ~VAbstractTool(){} /** * @brief NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view. * @param sc scene. @@ -93,7 +93,7 @@ public: * @brief getId return object id. * @return id. */ - inline quint32 getId() const {return id;} + quint32 getId() const; /** * @brief LineCoefficients coefficient for equation of segment. Segment equestion ax+by+c=0. * @param line line @@ -207,7 +207,7 @@ protected: * @brief getData return pointer to data container. * @return container. */ - inline const VContainer *getData() const {return &data;} + const VContainer *getData() const; /** * @brief RemoveReferens decrement value of reference. */ @@ -230,4 +230,14 @@ protected: private: Q_DISABLE_COPY(VAbstractTool) }; + +inline quint32 VAbstractTool::getId() const +{ + return id; +} + +inline const VContainer *VAbstractTool::getData() const +{ + return &data; +} #endif // VABSTRACTTOOL_H diff --git a/src/tools/vdatatool.h b/src/tools/vdatatool.h index 6f6c5a6c3..d2b941393 100644 --- a/src/tools/vdatatool.h +++ b/src/tools/vdatatool.h @@ -39,13 +39,13 @@ class VDataTool : public QObject { Q_OBJECT public: - /** - * @brief VDataTool constructor. - * @param data container with variables - * @param parent parent object - */ - VDataTool(VContainer *data, QObject *parent = 0); - virtual ~VDataTool(){} + /** + * @brief VDataTool constructor. + * @param data container with variables + * @param parent parent object + */ + VDataTool(VContainer *data, QObject *parent = 0); + virtual ~VDataTool(){} /** * @brief operator = assignment operator. * @param tool tool @@ -56,21 +56,21 @@ public: * @brief getData return data container. * @return container. */ - inline VContainer getData() const { return data; } + VContainer getData() const; /** * @brief setData set data container. * @param value container. */ - inline void setData(const VContainer *value){data = *value;} + void setData(const VContainer *value); /** * @brief referens return count of referens. * @return count count of referens. */ - virtual inline quint32 referens() const {return _referens;} + virtual quint32 referens() const; /** * @brief incrementReferens increment referens. */ - virtual inline void incrementReferens(){++_referens;} + virtual void incrementReferens(); /** * @brief decrementReferens decrement referens. */ @@ -86,4 +86,24 @@ protected: quint32 _referens; }; +inline VContainer VDataTool::getData() const +{ + return data; +} + +inline void VDataTool::setData(const VContainer *value) +{ + data = *value; +} + +inline quint32 VDataTool::referens() const +{ + return _referens; +} + +inline void VDataTool::incrementReferens() +{ + ++_referens; +} + #endif // VDATATOOL_H diff --git a/src/widgets/vitem.cpp b/src/widgets/vitem.cpp index f42b9a4d2..8d548a648 100644 --- a/src/widgets/vitem.cpp +++ b/src/widgets/vitem.cpp @@ -37,6 +37,17 @@ VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent ) { } +VItem::VItem():numInOutList(0), paper(0) +{ + +} + +VItem::VItem(int numInList, QGraphicsItem *parent):QGraphicsPathItem (parent), numInOutList(numInList), + paper(0) +{ + +} + void VItem::checkItemChange() { QRectF rect; diff --git a/src/widgets/vitem.h b/src/widgets/vitem.h index cc2df7284..0b8523045 100644 --- a/src/widgets/vitem.h +++ b/src/widgets/vitem.h @@ -42,14 +42,13 @@ public: /** * @brief VItem default constructor. */ - VItem ():numInOutList(0), paper(0){} + VItem (); /** * @brief VItem constructor. * @param numInList index in list of details. * @param parent parent object. */ - VItem (int numInList, QGraphicsItem * parent = 0):QGraphicsPathItem (parent), numInOutList(numInList), - paper(0){} + VItem (int numInList, QGraphicsItem * parent = 0); /** * @brief VItem constructor. * @param path detail path. @@ -81,7 +80,7 @@ public slots: * @brief SetIndexInList set detail index in list. * @param index index in list. */ - inline void SetIndexInList( qint32 index ) {numInOutList = index;} + void SetIndexInList( qint32 index ); protected: /** * @brief itemChange handle item change. @@ -118,4 +117,9 @@ signals: */ void itemColliding ( QList list, int number ); }; + +inline void VItem::SetIndexInList(qint32 index) +{ + numInOutList = index; +} #endif // VITEM_H diff --git a/src/widgets/vmaingraphicsscene.h b/src/widgets/vmaingraphicsscene.h index 49b134cf8..a25b4a74f 100644 --- a/src/widgets/vmaingraphicsscene.h +++ b/src/widgets/vmaingraphicsscene.h @@ -53,22 +53,22 @@ public: * @brief getHorScrollBar return scene horizontal scrollbar. * @return horizontal scrollbar. */ - inline qint32 getHorScrollBar() const {return horScrollBar;} + qint32 getHorScrollBar() const; /** * @brief setHorScrollBar set scene horizontal scrollbar. * @param value horizontal scrollbar. */ - inline void setHorScrollBar(const qint32 &value) {horScrollBar = value;} + void setHorScrollBar(const qint32 &value); /** * @brief getVerScrollBar return scene vertical scrollbar. * @return vertical scrollbar. */ - inline qint32 getVerScrollBar() const {return verScrollBar;} + qint32 getVerScrollBar() const; /** * @brief setVerScrollBar set scene vertical scrollbar. * @param value vertical scrollbar. */ - inline void setVerScrollBar(const qint32 &value) {verScrollBar = value;} + void setVerScrollBar(const qint32 &value); /** * @brief transform return view transformation. * @return view transformation. @@ -143,4 +143,24 @@ private: QTransform _transform; }; +inline qint32 VMainGraphicsScene::getHorScrollBar() const +{ + return horScrollBar; +} + +inline void VMainGraphicsScene::setHorScrollBar(const qint32 &value) +{ + horScrollBar = value; +} + +inline qint32 VMainGraphicsScene::getVerScrollBar() const +{ + return verScrollBar; +} + +inline void VMainGraphicsScene::setVerScrollBar(const qint32 &value) +{ + verScrollBar = value; +} + #endif // VMAINGRAPHICSSCENE_H diff --git a/src/widgets/vtablegraphicsview.h b/src/widgets/vtablegraphicsview.h index 6fbdafabe..7d7ebd5c9 100644 --- a/src/widgets/vtablegraphicsview.h +++ b/src/widgets/vtablegraphicsview.h @@ -42,7 +42,8 @@ public: * @brief The typeMove_e enum type items moves. */ enum typeMove_e { Left, Right, Up, Down }; - VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent = 0); + + VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent = 0); signals: /** * @brief itemChect emit after change selection state detail. @@ -57,7 +58,7 @@ public slots: /** * @brief rotateItems handle rotatation detail. */ - inline void rotateItems() {rotateIt();} + void rotateItems(); /** * @brief MirrorItem mirror detail. */ @@ -65,11 +66,11 @@ public slots: /** * @brief ZoomIn zoom in paper scale. */ - inline void ZoomIn() {scale(1.1, 1.1);} + void ZoomIn(); /** * @brief ZoomOut zoom out paper scale. */ - inline void ZoomOut() {scale(1/1.1, 1/1.1);} + void ZoomOut(); protected: /** * @brief wheelEvent handle wheel events. @@ -103,4 +104,19 @@ protected: }; +inline void VTableGraphicsView::rotateItems() +{ + rotateIt(); +} + +inline void VTableGraphicsView::ZoomIn() +{ + scale(1.1, 1.1); +} + +inline void VTableGraphicsView::ZoomOut() +{ + scale(1/1.1, 1/1.1); +} + #endif // VTABLEGRAPHICSVIEW_H diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index 734ebae19..de4449ec4 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -42,9 +42,9 @@ class MessageHandler : public QAbstractMessageHandler public: MessageHandler() : QAbstractMessageHandler(0), m_messageType(QtMsgType()), m_description(QString()), m_sourceLocation(QSourceLocation()){} - inline QString statusMessage() const {return m_description;} - inline qint64 line() const {return m_sourceLocation.line();} - inline qint64 column() const {return m_sourceLocation.column();} + QString statusMessage() const; + qint64 line() const; + qint64 column() const; protected: virtual void handleMessage(QtMsgType type, const QString &description, const QUrl &identifier, const QSourceLocation &sourceLocation) @@ -62,6 +62,21 @@ private: QSourceLocation m_sourceLocation; }; +inline QString MessageHandler::statusMessage() const +{ + return m_description; +} + +inline qint64 MessageHandler::line() const +{ + return m_sourceLocation.line(); +} + +inline qint64 MessageHandler::column() const +{ + return m_sourceLocation.column(); +} + VDomDocument::VDomDocument(VContainer *data) : QDomDocument(), data(data), map(QHash()) { diff --git a/src/xml/vpattern.h b/src/xml/vpattern.h index afdb02e3e..454786598 100644 --- a/src/xml/vpattern.h +++ b/src/xml/vpattern.h @@ -67,7 +67,7 @@ public: * @brief GetNameActivDraw return current pattern peace name. * @return pattern peace name. */ - inline QString GetNameActivDraw() const {return nameActivDraw;} + QString GetNameActivDraw() const; /** * @brief GetActivDrawElement return draw tag for current pattern peace. * @param element draw tag. @@ -98,23 +98,23 @@ public: * @brief getTools return list of tools pointers. * @return list. */ - inline QHash* getTools() {return &tools;} + QHash* getTools(); /** * @brief getTool return tool from tool list. * @param id tool id. * @return tool. */ - VDataTool* getTool(const quint32 &id); + VDataTool* getTool(const quint32 &id); /** * @brief getHistory return list with list of history records. * @return list of history records. */ - inline QVector *getHistory() {return &history;} + QVector *getHistory(); /** * @brief getCursor return cursor. * @return cursor. */ - inline quint32 getCursor() const {return cursor;} + quint32 getCursor() const; /** * @brief setCursor set cursor. * @param value cursor. @@ -154,9 +154,9 @@ public: * @brief SPointActiveDraw return id base point current pattern peace. * @return id base point. */ - quint32 SPointActiveDraw(); - inline bool isPatternModified() const {return patternModified;} - inline void setPatternModified(bool value) {patternModified = value;} + quint32 SPointActiveDraw(); + bool isPatternModified() const; + void setPatternModified(bool value); /** * @brief GetActivNodeElement find element in current pattern piece by name. * @param name name tag. @@ -377,4 +377,34 @@ private: VMainGraphicsScene *sceneDetail); }; +inline QString VPattern::GetNameActivDraw() const +{ + return nameActivDraw; +} + +inline QHash *VPattern::getTools() +{ + return &tools; +} + +inline QVector *VPattern::getHistory() +{ + return &history; +} + +inline quint32 VPattern::getCursor() const +{ + return cursor; +} + +inline bool VPattern::isPatternModified() const +{ + return patternModified; +} + +inline void VPattern::setPatternModified(bool value) +{ + patternModified = value; +} + #endif // VPATTERN_H diff --git a/src/xml/vtoolrecord.h b/src/xml/vtoolrecord.h index 0746b1e0b..3530d1c5e 100644 --- a/src/xml/vtoolrecord.h +++ b/src/xml/vtoolrecord.h @@ -39,47 +39,47 @@ class VToolRecord { public: - /** - * @brief VToolRecord default constructor. - */ - VToolRecord(); - /** - * @brief VToolRecord constructor. - * @param id tool id. - * @param typeTool tool type. - * @param nameDraw pattern peace name. - */ - VToolRecord(const quint32 &id, const Tool::Tools &typeTool, const QString &nameDraw); + /** + * @brief VToolRecord default constructor. + */ + VToolRecord(); + /** + * @brief VToolRecord constructor. + * @param id tool id. + * @param typeTool tool type. + * @param nameDraw pattern peace name. + */ + VToolRecord(const quint32 &id, const Tool::Tools &typeTool, const QString &nameDraw); /** * @brief getId return tool id. * @return id. */ - inline quint32 getId() const {return id;} + quint32 getId() const; /** * @brief setId set tool id. * @param value id. */ - inline void setId(const quint32 &value) {id = value;} + void setId(const quint32 &value); /** * @brief getTypeTool return tool type. * @return tool type. */ - inline Tool::Tools getTypeTool() const {return typeTool;} + Tool::Tools getTypeTool() const; /** * @brief setTypeTool set tool type. * @param value tool type. */ - inline void setTypeTool(const Tool::Tools &value) {typeTool = value;} + void setTypeTool(const Tool::Tools &value); /** * @brief getNameDraw return pattern peace name. * @return pattern peace name. */ - inline QString getNameDraw() const {return nameDraw;} + QString getNameDraw() const; /** * @brief setNameDraw set pattern peace name. * @param value pattern peace name. */ - inline void setNameDraw(const QString &value) {nameDraw = value;} + void setNameDraw(const QString &value); private: /** * @brief id tool id. @@ -95,4 +95,34 @@ private: QString nameDraw; }; +inline quint32 VToolRecord::getId() const +{ + return id; +} + +inline void VToolRecord::setId(const quint32 &value) +{ + id = value; +} + +inline Tool::Tools VToolRecord::getTypeTool() const +{ + return typeTool; +} + +inline void VToolRecord::setTypeTool(const Tool::Tools &value) +{ + typeTool = value; +} + +inline QString VToolRecord::getNameDraw() const +{ + return nameDraw; +} + +inline void VToolRecord::setNameDraw(const QString &value) +{ + nameDraw = value; +} + #endif // VTOOLRECORD_H From 4fcd7d9b25273d06b86360ca5572d3eb4e069248 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 26 Feb 2014 11:22:05 +0200 Subject: [PATCH 14/60] NULL (0) replaced with nullptr. --HG-- branch : feature --- src/container/calculator.h | 4 ++-- src/container/vcontainer.h | 2 +- src/dialogs/app/configdialog.cpp | 2 +- src/dialogs/app/configdialog.h | 2 +- src/dialogs/app/dialoghistory.h | 2 +- src/dialogs/app/dialogincrements.cpp | 4 ++-- src/dialogs/app/dialogincrements.h | 2 +- src/dialogs/app/dialogindividualmeasurements.h | 2 +- src/dialogs/app/dialogmeasurements.h | 2 +- src/dialogs/app/dialogpatternproperties.h | 2 +- src/dialogs/app/dialogstandardmeasurements.h | 2 +- src/dialogs/app/pages.h | 4 ++-- src/dialogs/tools/dialogalongline.h | 2 +- src/dialogs/tools/dialogarc.cpp | 2 +- src/dialogs/tools/dialogarc.h | 2 +- src/dialogs/tools/dialogbisector.h | 2 +- src/dialogs/tools/dialogcutarc.h | 2 +- src/dialogs/tools/dialogcutspline.h | 2 +- src/dialogs/tools/dialogcutsplinepath.h | 2 +- src/dialogs/tools/dialogdetail.h | 2 +- src/dialogs/tools/dialogendline.h | 2 +- src/dialogs/tools/dialogheight.h | 2 +- src/dialogs/tools/dialogline.h | 2 +- src/dialogs/tools/dialoglineintersect.h | 2 +- src/dialogs/tools/dialognormal.h | 2 +- src/dialogs/tools/dialogpointofcontact.h | 2 +- src/dialogs/tools/dialogpointofintersection.h | 2 +- src/dialogs/tools/dialogshoulderpoint.h | 2 +- src/dialogs/tools/dialogsinglepoint.h | 2 +- src/dialogs/tools/dialogspline.h | 2 +- src/dialogs/tools/dialogsplinepath.h | 2 +- src/dialogs/tools/dialogtool.cpp | 11 ++++++----- src/dialogs/tools/dialogtool.h | 2 +- src/dialogs/tools/dialogtriangle.h | 2 +- src/dialogs/tools/dialoguniondetails.h | 2 +- src/exception/vexception.h | 2 +- src/mainwindow.cpp | 16 ++++++++-------- src/mainwindow.h | 2 +- src/tablewindow.cpp | 6 +++--- src/tablewindow.h | 2 +- src/tools/drawTools/vdrawtool.cpp | 4 ++-- src/tools/drawTools/vdrawtool.h | 2 +- src/tools/drawTools/vtoolalongline.h | 2 +- src/tools/drawTools/vtoolarc.h | 2 +- src/tools/drawTools/vtoolbisector.h | 2 +- src/tools/drawTools/vtoolcutarc.h | 2 +- src/tools/drawTools/vtoolcutspline.cpp | 2 +- src/tools/drawTools/vtoolcutspline.h | 2 +- src/tools/drawTools/vtoolcutsplinepath.h | 2 +- src/tools/drawTools/vtoolendline.h | 2 +- src/tools/drawTools/vtoolheight.h | 2 +- src/tools/drawTools/vtoolline.h | 2 +- src/tools/drawTools/vtoollineintersect.h | 2 +- src/tools/drawTools/vtoollinepoint.cpp | 2 +- src/tools/drawTools/vtoollinepoint.h | 2 +- src/tools/drawTools/vtoolnormal.h | 2 +- src/tools/drawTools/vtoolpoint.h | 2 +- src/tools/drawTools/vtoolpointofcontact.h | 2 +- src/tools/drawTools/vtoolpointofintersection.h | 2 +- src/tools/drawTools/vtoolshoulderpoint.h | 2 +- src/tools/drawTools/vtoolsinglepoint.h | 2 +- src/tools/drawTools/vtoolspline.h | 2 +- src/tools/drawTools/vtoolsplinepath.h | 2 +- src/tools/drawTools/vtooltriangle.h | 2 +- src/tools/nodeDetails/vabstractnode.h | 2 +- src/tools/nodeDetails/vnodearc.h | 7 +++---- src/tools/nodeDetails/vnodepoint.cpp | 2 +- src/tools/nodeDetails/vnodepoint.h | 6 +++--- src/tools/nodeDetails/vnodespline.cpp | 2 +- src/tools/nodeDetails/vnodespline.h | 6 +++--- src/tools/nodeDetails/vnodesplinepath.h | 4 ++-- src/tools/vabstracttool.h | 2 +- src/tools/vdatatool.h | 2 +- src/tools/vtooldetail.cpp | 2 +- src/tools/vtooldetail.h | 2 +- src/tools/vtooluniondetails.h | 2 +- src/widgets/doubledelegate.h | 2 +- src/widgets/textdelegate.h | 2 +- src/widgets/vcontrolpointspline.cpp | 3 ++- src/widgets/vcontrolpointspline.h | 2 +- src/widgets/vgraphicssimpletextitem.h | 4 ++-- src/widgets/vitem.cpp | 8 ++++---- src/widgets/vitem.h | 4 ++-- src/widgets/vmaingraphicsscene.h | 2 +- src/widgets/vmaingraphicsview.h | 2 +- src/widgets/vsimplearc.cpp | 6 +++--- src/widgets/vsimplearc.h | 2 +- src/widgets/vsimplespline.cpp | 6 +++--- src/widgets/vsimplespline.h | 2 +- src/widgets/vtablegraphicsview.h | 2 +- src/xml/vdomdocument.cpp | 2 +- src/xml/vpattern.h | 2 +- 92 files changed, 127 insertions(+), 126 deletions(-) diff --git a/src/container/calculator.h b/src/container/calculator.h index 6618e310a..00b0fe7ef 100644 --- a/src/container/calculator.h +++ b/src/container/calculator.h @@ -42,8 +42,8 @@ public: * @brief Calculator class constructor. * @param data pointer to a variable container. */ - explicit Calculator(const VContainer *data):errorMsg(0), token(QString()), tok(0), token_type(0), prog(QString()), - index(0), data(data), debugFormula(QString()){} + explicit Calculator(const VContainer *data):errorMsg(nullptr), token(QString()), tok(0), token_type(0), + prog(QString()), index(0), data(data), debugFormula(QString()){} /** * @brief eval calculate formula. * @param prog string of formula. diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index 0fb81df09..eee7edbda 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -76,7 +76,7 @@ public: template const T GeometricObject(quint32 id) const { - VGObject *gObj = 0; + VGObject *gObj = nullptr; if (gObjects.contains(id)) { gObj = gObjects.value(id); diff --git a/src/dialogs/app/configdialog.cpp b/src/dialogs/app/configdialog.cpp index 1cfdb228b..283ed3da3 100644 --- a/src/dialogs/app/configdialog.cpp +++ b/src/dialogs/app/configdialog.cpp @@ -29,7 +29,7 @@ #include "configdialog.h" ConfigDialog::ConfigDialog(QWidget *parent) : - QDialog(parent), contentsWidget(0), pagesWidget(0), configurationPage(0), patternPage(0) + QDialog(parent), contentsWidget(nullptr), pagesWidget(nullptr), configurationPage(nullptr), patternPage(nullptr) { contentsWidget = new QListWidget; Q_CHECK_PTR(contentsWidget); diff --git a/src/dialogs/app/configdialog.h b/src/dialogs/app/configdialog.h index 9acc653aa..d1bfef44f 100644 --- a/src/dialogs/app/configdialog.h +++ b/src/dialogs/app/configdialog.h @@ -40,7 +40,7 @@ class ConfigDialog : public QDialog { Q_OBJECT public: - explicit ConfigDialog(QWidget *parent = 0); + explicit ConfigDialog(QWidget *parent = nullptr); public slots: void changePage(QListWidgetItem *current, QListWidgetItem *previous); protected: diff --git a/src/dialogs/app/dialoghistory.h b/src/dialogs/app/dialoghistory.h index 3a6f797c7..9b1337df4 100644 --- a/src/dialogs/app/dialoghistory.h +++ b/src/dialogs/app/dialoghistory.h @@ -50,7 +50,7 @@ public: * @param doc dom document container * @param parent parent widget */ - DialogHistory(VContainer *data, VPattern *doc, QWidget *parent = 0); + DialogHistory(VContainer *data, VPattern *doc, QWidget *parent = nullptr); virtual ~DialogHistory(); public slots: /** diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index 048fce127..796c4ee21 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -419,8 +419,8 @@ void DialogIncrements::AddIncrementToFile(quint32 id, QString name, qreal base, void DialogIncrements::cellChanged ( qint32 row, qint32 column ) { - QTableWidgetItem *item = 0; - QTableWidgetItem *itemName = 0; + QTableWidgetItem *item = nullptr; + QTableWidgetItem *itemName = nullptr; quint32 id; QDomElement domElement; this->row = row; diff --git a/src/dialogs/app/dialogincrements.h b/src/dialogs/app/dialogincrements.h index 7ed6977b3..7ea4841a4 100644 --- a/src/dialogs/app/dialogincrements.h +++ b/src/dialogs/app/dialogincrements.h @@ -50,7 +50,7 @@ public: * @param doc dom document container * @param parent parent widget */ - DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = 0); + DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = nullptr); ~DialogIncrements(); public slots: /** diff --git a/src/dialogs/app/dialogindividualmeasurements.h b/src/dialogs/app/dialogindividualmeasurements.h index 0e87bb685..bcde13c66 100644 --- a/src/dialogs/app/dialogindividualmeasurements.h +++ b/src/dialogs/app/dialogindividualmeasurements.h @@ -40,7 +40,7 @@ class DialogIndividualMeasurements : public QDialog Q_OBJECT public: - explicit DialogIndividualMeasurements(QWidget *parent = 0); + explicit DialogIndividualMeasurements(QWidget *parent = nullptr); ~DialogIndividualMeasurements(); QString name() const; QString tablePath() const; diff --git a/src/dialogs/app/dialogmeasurements.h b/src/dialogs/app/dialogmeasurements.h index 73945dda9..2a098c32c 100644 --- a/src/dialogs/app/dialogmeasurements.h +++ b/src/dialogs/app/dialogmeasurements.h @@ -49,7 +49,7 @@ class DialogMeasurements : public QDialog { Q_OBJECT public: - explicit DialogMeasurements(QWidget *parent = 0); + explicit DialogMeasurements(QWidget *parent = nullptr); ~DialogMeasurements(); Measurements::Type type() const; private: diff --git a/src/dialogs/app/dialogpatternproperties.h b/src/dialogs/app/dialogpatternproperties.h index 5efd8a28a..9bd8c11f9 100644 --- a/src/dialogs/app/dialogpatternproperties.h +++ b/src/dialogs/app/dialogpatternproperties.h @@ -40,7 +40,7 @@ class DialogPatternProperties : public QDialog { Q_OBJECT public: - DialogPatternProperties(VPattern *doc, QWidget *parent = 0); + DialogPatternProperties(VPattern *doc, QWidget *parent = nullptr); virtual ~DialogPatternProperties(); signals: void haveChange(); diff --git a/src/dialogs/app/dialogstandardmeasurements.h b/src/dialogs/app/dialogstandardmeasurements.h index 2a7156f50..d89ed2593 100644 --- a/src/dialogs/app/dialogstandardmeasurements.h +++ b/src/dialogs/app/dialogstandardmeasurements.h @@ -39,7 +39,7 @@ class DialogStandardMeasurements : public QDialog { Q_OBJECT public: - explicit DialogStandardMeasurements(QWidget *parent = 0); + explicit DialogStandardMeasurements(QWidget *parent = nullptr); ~DialogStandardMeasurements(); QString name() const; QString tablePath() const; diff --git a/src/dialogs/app/pages.h b/src/dialogs/app/pages.h index dc52a36f4..ef8e96e1c 100644 --- a/src/dialogs/app/pages.h +++ b/src/dialogs/app/pages.h @@ -35,7 +35,7 @@ class ConfigurationPage : public QWidget { Q_OBJECT public: - ConfigurationPage(QWidget *parent = 0); + ConfigurationPage(QWidget *parent = nullptr); void Apply(); public slots: void LangChenged(); @@ -54,7 +54,7 @@ class PatternPage : public QWidget { Q_OBJECT public: - PatternPage(QWidget *parent = 0); + PatternPage(QWidget *parent = nullptr); void Apply(); private: Q_DISABLE_COPY(PatternPage) diff --git a/src/dialogs/tools/dialogalongline.h b/src/dialogs/tools/dialogalongline.h index 693328fb0..0edbf7f55 100644 --- a/src/dialogs/tools/dialogalongline.h +++ b/src/dialogs/tools/dialogalongline.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogAlongLine(const VContainer *data, QWidget *parent = 0); + DialogAlongLine(const VContainer *data, QWidget *parent = nullptr); ~DialogAlongLine(); /** * @brief getPointName return name of point diff --git a/src/dialogs/tools/dialogarc.cpp b/src/dialogs/tools/dialogarc.cpp index de4898881..d8fcacda1 100644 --- a/src/dialogs/tools/dialogarc.cpp +++ b/src/dialogs/tools/dialogarc.cpp @@ -34,7 +34,7 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent) :DialogTool(data, parent), ui(new Ui::DialogArc), flagRadius(false), flagF1(false), flagF2(false), - timerRadius(0), timerF1(0), timerF2(0), center(0), radius(QString()), f1(QString()), f2(QString()) + timerRadius(nullptr), timerF1(nullptr), timerF2(nullptr), center(0), radius(QString()), f1(QString()), f2(QString()) { ui->setupUi(this); diff --git a/src/dialogs/tools/dialogarc.h b/src/dialogs/tools/dialogarc.h index f1366f9e1..03343cc39 100644 --- a/src/dialogs/tools/dialogarc.h +++ b/src/dialogs/tools/dialogarc.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogArc(const VContainer *data, QWidget *parent = 0); + DialogArc(const VContainer *data, QWidget *parent = nullptr); ~DialogArc(); /** * @brief GetCenter return id of center point diff --git a/src/dialogs/tools/dialogbisector.h b/src/dialogs/tools/dialogbisector.h index ba581956d..5488ce972 100644 --- a/src/dialogs/tools/dialogbisector.h +++ b/src/dialogs/tools/dialogbisector.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogBisector(const VContainer *data, QWidget *parent = 0); + DialogBisector(const VContainer *data, QWidget *parent = nullptr); ~DialogBisector(); /** * @brief getPointName return name of point diff --git a/src/dialogs/tools/dialogcutarc.h b/src/dialogs/tools/dialogcutarc.h index 4e296c416..9b9d285c3 100644 --- a/src/dialogs/tools/dialogcutarc.h +++ b/src/dialogs/tools/dialogcutarc.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogCutArc(const VContainer *data, QWidget *parent = 0); + DialogCutArc(const VContainer *data, QWidget *parent = nullptr); ~DialogCutArc(); /** * @brief getPointName return name point on arc diff --git a/src/dialogs/tools/dialogcutspline.h b/src/dialogs/tools/dialogcutspline.h index c7e9ef3f5..f5e507e2c 100644 --- a/src/dialogs/tools/dialogcutspline.h +++ b/src/dialogs/tools/dialogcutspline.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogCutSpline(const VContainer *data, QWidget *parent = 0); + DialogCutSpline(const VContainer *data, QWidget *parent = nullptr); ~DialogCutSpline(); /** * @brief getPointName return name of point diff --git a/src/dialogs/tools/dialogcutsplinepath.h b/src/dialogs/tools/dialogcutsplinepath.h index 0137e7f6c..0accc6d67 100644 --- a/src/dialogs/tools/dialogcutsplinepath.h +++ b/src/dialogs/tools/dialogcutsplinepath.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogCutSplinePath(const VContainer *data, QWidget *parent = 0); + DialogCutSplinePath(const VContainer *data, QWidget *parent = nullptr); ~DialogCutSplinePath(); /** * @brief getPointName return name of point diff --git a/src/dialogs/tools/dialogdetail.h b/src/dialogs/tools/dialogdetail.h index fec51637f..bf39910b1 100644 --- a/src/dialogs/tools/dialogdetail.h +++ b/src/dialogs/tools/dialogdetail.h @@ -44,7 +44,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogDetail(const VContainer *data, QWidget *parent = 0); + DialogDetail(const VContainer *data, QWidget *parent = nullptr); /** * @brief getDetails return detail * @return detail diff --git a/src/dialogs/tools/dialogendline.h b/src/dialogs/tools/dialogendline.h index 8bfcc1d6b..05ce3c82c 100644 --- a/src/dialogs/tools/dialogendline.h +++ b/src/dialogs/tools/dialogendline.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogEndLine(const VContainer *data, QWidget *parent = 0); + DialogEndLine(const VContainer *data, QWidget *parent = nullptr); ~DialogEndLine(); /** * @brief getPointName return name of point diff --git a/src/dialogs/tools/dialogheight.h b/src/dialogs/tools/dialogheight.h index 9c718d626..8fd4f9a25 100644 --- a/src/dialogs/tools/dialogheight.h +++ b/src/dialogs/tools/dialogheight.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogHeight(const VContainer *data, QWidget *parent = 0); + DialogHeight(const VContainer *data, QWidget *parent = nullptr); ~DialogHeight(); /** * @brief getPointName return name of point diff --git a/src/dialogs/tools/dialogline.h b/src/dialogs/tools/dialogline.h index ec53ffcdf..2df217fce 100644 --- a/src/dialogs/tools/dialogline.h +++ b/src/dialogs/tools/dialogline.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogLine(const VContainer *data, QWidget *parent = 0); + DialogLine(const VContainer *data, QWidget *parent = nullptr); ~DialogLine(); /** * @brief getFirstPoint return id first point diff --git a/src/dialogs/tools/dialoglineintersect.h b/src/dialogs/tools/dialoglineintersect.h index dc0edbf22..421f5d0aa 100644 --- a/src/dialogs/tools/dialoglineintersect.h +++ b/src/dialogs/tools/dialoglineintersect.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogLineIntersect(const VContainer *data, QWidget *parent = 0); + DialogLineIntersect(const VContainer *data, QWidget *parent = nullptr); ~DialogLineIntersect(); /** * @brief getP1Line1 return id first point of first line diff --git a/src/dialogs/tools/dialognormal.h b/src/dialogs/tools/dialognormal.h index 11aef3280..9d747b9b9 100644 --- a/src/dialogs/tools/dialognormal.h +++ b/src/dialogs/tools/dialognormal.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogNormal(const VContainer *data, QWidget *parent = 0); + DialogNormal(const VContainer *data, QWidget *parent = nullptr); ~DialogNormal(); /** * @brief getPointName return name of point diff --git a/src/dialogs/tools/dialogpointofcontact.h b/src/dialogs/tools/dialogpointofcontact.h index f6a80ab6c..b569cae72 100644 --- a/src/dialogs/tools/dialogpointofcontact.h +++ b/src/dialogs/tools/dialogpointofcontact.h @@ -44,7 +44,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogPointOfContact(const VContainer *data, QWidget *parent = 0); + DialogPointOfContact(const VContainer *data, QWidget *parent = nullptr); /** * @brief getPointName return name of point * @return name diff --git a/src/dialogs/tools/dialogpointofintersection.h b/src/dialogs/tools/dialogpointofintersection.h index dfa8d51c4..2a60ca2ad 100644 --- a/src/dialogs/tools/dialogpointofintersection.h +++ b/src/dialogs/tools/dialogpointofintersection.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogPointOfIntersection(const VContainer *data, QWidget *parent = 0); + DialogPointOfIntersection(const VContainer *data, QWidget *parent = nullptr); ~DialogPointOfIntersection(); /** * @brief getPointName return name of point diff --git a/src/dialogs/tools/dialogshoulderpoint.h b/src/dialogs/tools/dialogshoulderpoint.h index 642f742d3..30342ee81 100644 --- a/src/dialogs/tools/dialogshoulderpoint.h +++ b/src/dialogs/tools/dialogshoulderpoint.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogShoulderPoint(const VContainer *data, QWidget *parent = 0); + DialogShoulderPoint(const VContainer *data, QWidget *parent = nullptr); ~DialogShoulderPoint(); /** * @brief getPointName return name of point diff --git a/src/dialogs/tools/dialogsinglepoint.h b/src/dialogs/tools/dialogsinglepoint.h index f3d4d6e33..a4f994043 100644 --- a/src/dialogs/tools/dialogsinglepoint.h +++ b/src/dialogs/tools/dialogsinglepoint.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogSinglePoint(const VContainer *data, QWidget *parent = 0); + DialogSinglePoint(const VContainer *data, QWidget *parent = nullptr); ~DialogSinglePoint(); /** * @brief setData set name and point diff --git a/src/dialogs/tools/dialogspline.h b/src/dialogs/tools/dialogspline.h index 40e0bebac..e42cc1388 100644 --- a/src/dialogs/tools/dialogspline.h +++ b/src/dialogs/tools/dialogspline.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogSpline(const VContainer *data, QWidget *parent = 0); + DialogSpline(const VContainer *data, QWidget *parent = nullptr); ~DialogSpline(); /** * @brief getP1 return id first point of spline diff --git a/src/dialogs/tools/dialogsplinepath.h b/src/dialogs/tools/dialogsplinepath.h index 5024c143a..ad1fcb708 100644 --- a/src/dialogs/tools/dialogsplinepath.h +++ b/src/dialogs/tools/dialogsplinepath.h @@ -49,7 +49,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogSplinePath(const VContainer *data, QWidget *parent = 0); + DialogSplinePath(const VContainer *data, QWidget *parent = nullptr); ~DialogSplinePath(); /** * @brief GetPath return spline path diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index 353ef34f4..d2b23fc1b 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -34,11 +34,12 @@ #include DialogTool::DialogTool(const VContainer *data, QWidget *parent) - :QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(0), bOk(0), - spinBoxAngle(0), lineEditFormula(0), listWidget(0), labelResultCalculation(0), labelDescription(0), - labelEditNamePoint(0), labelEditFormula(0), radioButtonSizeGrowth(0), radioButtonStandardTable(0), - radioButtonIncrements(0), radioButtonLengthLine(0), radioButtonLengthArc(0), radioButtonLengthCurve(0), - lineStyles(QStringList()) + :QDialog(parent), data(data), isInitialized(false), flagName(true), flagFormula(true), timerFormula(nullptr), + bOk(nullptr), spinBoxAngle(nullptr), lineEditFormula(nullptr), listWidget(nullptr), + labelResultCalculation(nullptr), labelDescription(nullptr), labelEditNamePoint(nullptr), + labelEditFormula(nullptr), radioButtonSizeGrowth(nullptr), radioButtonStandardTable(nullptr), + radioButtonIncrements(nullptr), radioButtonLengthLine(nullptr), radioButtonLengthArc(nullptr), + radioButtonLengthCurve(nullptr), lineStyles(QStringList()) { Q_CHECK_PTR(data); timerFormula = new QTimer(this); diff --git a/src/dialogs/tools/dialogtool.h b/src/dialogs/tools/dialogtool.h index 4e1cf2079..ee1abf5df 100644 --- a/src/dialogs/tools/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -63,7 +63,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogTool(const VContainer *data, QWidget *parent = 0); + DialogTool(const VContainer *data, QWidget *parent = nullptr); virtual ~DialogTool() {} signals: /** diff --git a/src/dialogs/tools/dialogtriangle.h b/src/dialogs/tools/dialogtriangle.h index c1667fc43..cbacec9ac 100644 --- a/src/dialogs/tools/dialogtriangle.h +++ b/src/dialogs/tools/dialogtriangle.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogTriangle(const VContainer *data, QWidget *parent = 0); + DialogTriangle(const VContainer *data, QWidget *parent = nullptr); ~DialogTriangle(); /** * @brief getAxisP1Id return id first point of axis diff --git a/src/dialogs/tools/dialoguniondetails.h b/src/dialogs/tools/dialoguniondetails.h index a525c0aba..e972de851 100644 --- a/src/dialogs/tools/dialoguniondetails.h +++ b/src/dialogs/tools/dialoguniondetails.h @@ -48,7 +48,7 @@ public: * @param data container with data * @param parent parent widget */ - DialogUnionDetails(const VContainer *data, QWidget *parent = 0); + DialogUnionDetails(const VContainer *data, QWidget *parent = nullptr); ~DialogUnionDetails(); /** * @brief getD1 return id first detail diff --git a/src/exception/vexception.h b/src/exception/vexception.h index e25f6b9f1..ea0145ce7 100644 --- a/src/exception/vexception.h +++ b/src/exception/vexception.h @@ -79,7 +79,7 @@ public: * @brief CriticalMessageBox show Critical Message Box. * @param situation main text message box. */ - virtual void CriticalMessageBox(const QString &situation, QWidget *parent = 0) const; + virtual void CriticalMessageBox(const QString &situation, QWidget *parent = nullptr) const; protected: /** * @brief what string with error diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ccbf524ff..f72d42447 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -48,11 +48,11 @@ MainWindow::MainWindow(QWidget *parent) - :QMainWindow(parent), ui(new Ui::MainWindow), pattern(0), doc(0), tool(Tool::ArrowTool), currentScene(0), - sceneDraw(0), sceneDetails(0), mouseCoordinate(0), helpLabel(0), view(0), isInitialized(false), dialogTable(0), - dialogTool(0), dialogHistory(0), comboBoxDraws(0), curFile(QString()), mode(Draw::Calculation), - currentDrawIndex(0), currentToolBoxIndex(0), drawMode(true), recentFileActs{0,0,0,0,0}, separatorAct(0), - autoSaveTimer(0) + :QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Tool::ArrowTool), + currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), + view(nullptr), isInitialized(false), dialogTable(0), dialogTool(nullptr), dialogHistory(nullptr), + comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0), currentToolBoxIndex(0), + drawMode(true), recentFileActs{0,0,0,0,0}, separatorAct(nullptr), autoSaveTimer(nullptr) { CreateActions(); CreateMenus(); @@ -650,7 +650,7 @@ void MainWindow::mouseMove(const QPointF &scenePos) void MainWindow::CancelTool() { delete dialogTool; - dialogTool = 0; + dialogTool = nullptr; switch ( tool ) { case Tool::ArrowTool: @@ -1031,7 +1031,7 @@ void MainWindow::ClosedActionTable() { ui->actionTable->setChecked(false); delete dialogTable; - dialogTable = 0; + dialogTable = nullptr; } void MainWindow::ActionHistory(bool checked) @@ -1336,7 +1336,7 @@ void MainWindow::InitAutoSave() { //Autosaving file each 5 minutes delete autoSaveTimer; - autoSaveTimer = 0; + autoSaveTimer = nullptr; QSettings settings(QSettings::IniFormat, QSettings::UserScope, QApplication::organizationName(), QApplication::applicationName()); diff --git a/src/mainwindow.h b/src/mainwindow.h index 0421cf7df..9cc622812 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -55,7 +55,7 @@ public: * @brief MainWindow constructor. * @param parent parent widget. */ - explicit MainWindow(QWidget *parent = 0); + explicit MainWindow(QWidget *parent = nullptr); ~MainWindow(); /** * @brief LoadPattern open pattern file. diff --git a/src/tablewindow.cpp b/src/tablewindow.cpp index 755050913..c4d489b34 100644 --- a/src/tablewindow.cpp +++ b/src/tablewindow.cpp @@ -34,9 +34,9 @@ #include "options.h" TableWindow::TableWindow(QWidget *parent) - :QMainWindow(parent), numberDetal(0), colission(0), ui(new Ui::TableWindow), - listDetails(QVector()), outItems(false), collidingItems(false), tableScene(0), - paper(0), shadowPaper(0), listOutItems(0), listCollidingItems(QList()), + :QMainWindow(parent), numberDetal(nullptr), colission(nullptr), ui(new Ui::TableWindow), + listDetails(QVector()), outItems(false), collidingItems(false), tableScene(nullptr), + paper(nullptr), shadowPaper(nullptr), listOutItems(nullptr), listCollidingItems(QList()), indexDetail(0), sceneRect(QRectF()), fileName(QString()), description(QString()) { ui->setupUi(this); diff --git a/src/tablewindow.h b/src/tablewindow.h index 00e6a6a0c..026bda81d 100644 --- a/src/tablewindow.h +++ b/src/tablewindow.h @@ -57,7 +57,7 @@ public: * @brief TableWindow constructor. * @param parent parent widget. */ - explicit TableWindow(QWidget *parent = 0); + explicit TableWindow(QWidget *parent = nullptr); ~TableWindow(); public slots: /** diff --git a/src/tools/drawTools/vdrawtool.cpp b/src/tools/drawTools/vdrawtool.cpp index c2afef8d2..69e864c3b 100644 --- a/src/tools/drawTools/vdrawtool.cpp +++ b/src/tools/drawTools/vdrawtool.cpp @@ -32,7 +32,7 @@ qreal VDrawTool::factor = 1; VDrawTool::VDrawTool(VPattern *doc, VContainer *data, quint32 id) :VAbstractTool(doc, data, id), ignoreContextMenuEvent(false), ignoreFullUpdate(false), - nameActivDraw(doc->GetNameActivDraw()), dialog(0) + nameActivDraw(doc->GetNameActivDraw()), dialog(nullptr) { connect(this->doc, &VPattern::ChangedActivDraw, this, &VDrawTool::ChangedActivDraw); connect(this->doc, &VPattern::ChangedNameDraw, this, &VDrawTool::ChangedNameDraw); @@ -85,7 +85,7 @@ void VDrawTool::FullUpdateFromGui(int result) } } delete dialog; - dialog = 0; + dialog = nullptr; } void VDrawTool::SetFactor(qreal factor) diff --git a/src/tools/drawTools/vdrawtool.h b/src/tools/drawTools/vdrawtool.h index ff41eca7c..73c440a52 100644 --- a/src/tools/drawTools/vdrawtool.h +++ b/src/tools/drawTools/vdrawtool.h @@ -134,7 +134,7 @@ protected: { QMenu menu; QAction *actionOption = menu.addAction(tr("Options")); - QAction *actionRemove = 0; + QAction *actionRemove = nullptr; if (showRemove) { actionRemove = menu.addAction(tr("Delete")); diff --git a/src/tools/drawTools/vtoolalongline.h b/src/tools/drawTools/vtoolalongline.h index 0a3248eba..e254004c7 100644 --- a/src/tools/drawTools/vtoolalongline.h +++ b/src/tools/drawTools/vtoolalongline.h @@ -52,7 +52,7 @@ public: */ VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, const QString &typeLine, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolarc.h b/src/tools/drawTools/vtoolarc.h index 64452b7ca..65dd734b7 100644 --- a/src/tools/drawTools/vtoolarc.h +++ b/src/tools/drawTools/vtoolarc.h @@ -49,7 +49,7 @@ public: * @param parent parent object */ VToolArc(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); + QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolbisector.h b/src/tools/drawTools/vtoolbisector.h index 86ee1adeb..02ba4e90d 100644 --- a/src/tools/drawTools/vtoolbisector.h +++ b/src/tools/drawTools/vtoolbisector.h @@ -53,7 +53,7 @@ public: VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &thirdPointId, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); + QGraphicsItem * parent = nullptr); /** * @brief FindPoint find bisector point. * @param firstPoint first point of angle. diff --git a/src/tools/drawTools/vtoolcutarc.h b/src/tools/drawTools/vtoolcutarc.h index d6f8d3478..4e845f170 100644 --- a/src/tools/drawTools/vtoolcutarc.h +++ b/src/tools/drawTools/vtoolcutarc.h @@ -53,7 +53,7 @@ public: */ VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index 162080406..25c4d850a 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -108,7 +108,7 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, if (typeCreation == Tool::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p != 0); + Q_CHECK_PTR(p); id = data->AddGObject(p); VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); diff --git a/src/tools/drawTools/vtoolcutspline.h b/src/tools/drawTools/vtoolcutspline.h index 87405ee45..6baf52e85 100644 --- a/src/tools/drawTools/vtoolcutspline.h +++ b/src/tools/drawTools/vtoolcutspline.h @@ -51,7 +51,7 @@ public: */ VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolcutsplinepath.h b/src/tools/drawTools/vtoolcutsplinepath.h index 0a7f40b43..2f9707bef 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.h +++ b/src/tools/drawTools/vtoolcutsplinepath.h @@ -54,7 +54,7 @@ public: */ VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &splinePathId, const quint32 &splPath1id, const quint32 &splPath2id, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolendline.h b/src/tools/drawTools/vtoolendline.h index b85715035..98eebac48 100644 --- a/src/tools/drawTools/vtoolendline.h +++ b/src/tools/drawTools/vtoolendline.h @@ -52,7 +52,7 @@ public: */ VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const qreal &angle, const quint32 &basePointId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolheight.h b/src/tools/drawTools/vtoolheight.h index 1c0f222ba..5adb588b1 100644 --- a/src/tools/drawTools/vtoolheight.h +++ b/src/tools/drawTools/vtoolheight.h @@ -52,7 +52,7 @@ public: */ VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolline.h b/src/tools/drawTools/vtoolline.h index 7bf8d8367..056b88a0b 100644 --- a/src/tools/drawTools/vtoolline.h +++ b/src/tools/drawTools/vtoolline.h @@ -53,7 +53,7 @@ public: */ VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint, const QString &typeLine, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); + QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoollineintersect.h b/src/tools/drawTools/vtoollineintersect.h index e0101aa71..00fb946f8 100644 --- a/src/tools/drawTools/vtoollineintersect.h +++ b/src/tools/drawTools/vtoollineintersect.h @@ -52,7 +52,7 @@ public: */ VToolLineIntersect(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &p1Line1, const quint32 &p2Line1, const quint32 &p1Line2, const quint32 &p2Line2, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoollinepoint.cpp b/src/tools/drawTools/vtoollinepoint.cpp index 9d72fe009..d8b739890 100644 --- a/src/tools/drawTools/vtoollinepoint.cpp +++ b/src/tools/drawTools/vtoollinepoint.cpp @@ -32,7 +32,7 @@ VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &i const QString &typeLine, const QString &formula, const quint32 &basePointId, const qreal &angle, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), formula(formula), angle(angle), basePointId(basePointId), - mainLine(0) + mainLine(nullptr) { this->typeLine = typeLine; Q_ASSERT_X(basePointId > 0, Q_FUNC_INFO, "basePointId <= 0"); diff --git a/src/tools/drawTools/vtoollinepoint.h b/src/tools/drawTools/vtoollinepoint.h index 9f367a985..52628620a 100644 --- a/src/tools/drawTools/vtoollinepoint.h +++ b/src/tools/drawTools/vtoollinepoint.h @@ -51,7 +51,7 @@ public: */ VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const quint32 &basePointId, const qreal &angle, - QGraphicsItem * parent = 0); + QGraphicsItem * parent = nullptr); public slots: /** * @brief ChangedActivDraw disable or enable context menu after change active pattern peace. diff --git a/src/tools/drawTools/vtoolnormal.h b/src/tools/drawTools/vtoolnormal.h index 8efeea75b..dc6241e68 100644 --- a/src/tools/drawTools/vtoolnormal.h +++ b/src/tools/drawTools/vtoolnormal.h @@ -54,7 +54,7 @@ public: VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const qreal &angle, const quint32 &firstPointId, const quint32 &secondPointId, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); + QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolpoint.h b/src/tools/drawTools/vtoolpoint.h index 1a5f0223c..4622d6bc9 100644 --- a/src/tools/drawTools/vtoolpoint.h +++ b/src/tools/drawTools/vtoolpoint.h @@ -46,7 +46,7 @@ public: * @param id object id in container. * @param parent parent object. */ - VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = 0); + VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr); virtual ~VToolPoint(){} static const QString TagName; public slots: diff --git a/src/tools/drawTools/vtoolpointofcontact.h b/src/tools/drawTools/vtoolpointofcontact.h index 45e28d64a..76d0d90b7 100644 --- a/src/tools/drawTools/vtoolpointofcontact.h +++ b/src/tools/drawTools/vtoolpointofcontact.h @@ -52,7 +52,7 @@ public: VToolPointOfContact(VPattern *doc, VContainer *data, const quint32 &id, const QString &arcRadius, const quint32 ¢er, const quint32 &firstPointId, const quint32 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolpointofintersection.h b/src/tools/drawTools/vtoolpointofintersection.h index 8d26f069e..d6df58072 100644 --- a/src/tools/drawTools/vtoolpointofintersection.h +++ b/src/tools/drawTools/vtoolpointofintersection.h @@ -50,7 +50,7 @@ public: */ VToolPointOfIntersection(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &firstPointId, const quint32 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolshoulderpoint.h b/src/tools/drawTools/vtoolshoulderpoint.h index e7414f8f3..2de3803be 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.h +++ b/src/tools/drawTools/vtoolshoulderpoint.h @@ -54,7 +54,7 @@ public: VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const quint32 &p1Line, const quint32 &p2Line, const quint32 &pShoulder, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); + QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolsinglepoint.h b/src/tools/drawTools/vtoolsinglepoint.h index c09751f46..c869e81f6 100644 --- a/src/tools/drawTools/vtoolsinglepoint.h +++ b/src/tools/drawTools/vtoolsinglepoint.h @@ -48,7 +48,7 @@ public: * @param parent parent object. */ VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0 ); + QGraphicsItem * parent = nullptr ); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolspline.h b/src/tools/drawTools/vtoolspline.h index 5b40d582f..dd675d78c 100644 --- a/src/tools/drawTools/vtoolspline.h +++ b/src/tools/drawTools/vtoolspline.h @@ -50,7 +50,7 @@ public: * @param parent parent object. */ VToolSpline (VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0 ); + QGraphicsItem * parent = nullptr ); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtoolsplinepath.h b/src/tools/drawTools/vtoolsplinepath.h index 4374934e1..286585b00 100644 --- a/src/tools/drawTools/vtoolsplinepath.h +++ b/src/tools/drawTools/vtoolsplinepath.h @@ -49,7 +49,7 @@ public: * @param parent parent object. */ VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, - QGraphicsItem * parent = 0); + QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/drawTools/vtooltriangle.h b/src/tools/drawTools/vtooltriangle.h index 03913eed0..ffdb63e30 100644 --- a/src/tools/drawTools/vtooltriangle.h +++ b/src/tools/drawTools/vtooltriangle.h @@ -52,7 +52,7 @@ public: */ VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &axisP1Id, const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/tools/nodeDetails/vabstractnode.h b/src/tools/nodeDetails/vabstractnode.h index 8fc0ced14..b91bde905 100644 --- a/src/tools/nodeDetails/vabstractnode.h +++ b/src/tools/nodeDetails/vabstractnode.h @@ -47,7 +47,7 @@ public: * @param parent parent object. */ VAbstractNode(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode, - const quint32 &idTool, QObject *parent = 0); + const quint32 &idTool, QObject *parent = nullptr); virtual ~VAbstractNode() {} static const QString AttrIdObject; static const QString AttrIdTool; diff --git a/src/tools/nodeDetails/vnodearc.h b/src/tools/nodeDetails/vnodearc.h index 34ff14e4c..2564b429b 100644 --- a/src/tools/nodeDetails/vnodearc.h +++ b/src/tools/nodeDetails/vnodearc.h @@ -48,9 +48,8 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, - const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = 0, - QGraphicsItem * parent = 0); + VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Tool::Sources &typeCreation, + const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr); /** * @brief Create help create tool. * @param doc dom document container. @@ -61,7 +60,7 @@ public: * @param typeCreation way we create this tool. */ static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document::Documents &parse, - const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *parent = 0); + const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr); static const QString TagName; static const QString ToolType; /** diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index 4a10d8508..5bbcb6b74 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -37,7 +37,7 @@ VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPo const Tool::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent) :VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), - namePoint(0), lineName(0) + namePoint(nullptr), lineName(nullptr) { namePoint = new VGraphicsSimpleTextItem(this); lineName = new QGraphicsLineItem(this); diff --git a/src/tools/nodeDetails/vnodepoint.h b/src/tools/nodeDetails/vnodepoint.h index cea90ffd3..951d4e0af 100644 --- a/src/tools/nodeDetails/vnodepoint.h +++ b/src/tools/nodeDetails/vnodepoint.h @@ -49,8 +49,8 @@ public: * @param parent parent object. */ VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, - const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = 0, - QGraphicsItem * parent = 0 ); + const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = nullptr, + QGraphicsItem * parent = nullptr ); /** * @brief Create help create tool. * @param doc dom document container. @@ -62,7 +62,7 @@ public: */ static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Document::Documents &parse, const Tool::Sources &typeCreation, const quint32 &idTool = 0, - QObject *parent = 0); + QObject *parent = nullptr); static const QString TagName; static const QString ToolType; /** diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index 13c04cf02..8b68df85e 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -56,7 +56,7 @@ VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, quint32 id, qu const quint32 &idTool, QObject *parent) { VAbstractTool::AddRecord(id, Tool::NodeSpline, doc); - VNodeSpline *spl = 0; + VNodeSpline *spl = nullptr; if (parse == Document::FullParse) { spl = new VNodeSpline(doc, data, id, idSpline, typeCreation, idTool, parent); diff --git a/src/tools/nodeDetails/vnodespline.h b/src/tools/nodeDetails/vnodespline.h index a7b1b1729..1384ea97e 100644 --- a/src/tools/nodeDetails/vnodespline.h +++ b/src/tools/nodeDetails/vnodespline.h @@ -49,8 +49,8 @@ public: * @param parent parent object. */ VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, - const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = 0, - QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = nullptr, + QGraphicsItem * parent = nullptr); /** * @brief Create help create tool. * @param doc dom document container. @@ -63,7 +63,7 @@ public: */ static VNodeSpline *Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, const Document::Documents &parse, const Tool::Sources &typeCreation, - const quint32 &idTool = 0, QObject *parent = 0); + const quint32 &idTool = 0, QObject *parent = nullptr); static const QString TagName; static const QString ToolType; /** diff --git a/src/tools/nodeDetails/vnodesplinepath.h b/src/tools/nodeDetails/vnodesplinepath.h index 248773d6f..3d96c306a 100644 --- a/src/tools/nodeDetails/vnodesplinepath.h +++ b/src/tools/nodeDetails/vnodesplinepath.h @@ -49,8 +49,8 @@ public: * @param parent parent object. */ VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, - const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = 0, - QGraphicsItem * parent = 0); + const Tool::Sources &typeCreation, const quint32 &idTool = 0, + QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr); /** * @brief Create help create tool. * @param doc dom document container. diff --git a/src/tools/vabstracttool.h b/src/tools/vabstracttool.h index 0b2351d4c..48b613971 100644 --- a/src/tools/vabstracttool.h +++ b/src/tools/vabstracttool.h @@ -47,7 +47,7 @@ public: * @param id object id in container. * @param parent parent object. */ - VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent = 0); + VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr); virtual ~VAbstractTool(){} /** * @brief NewSceneRect calculate scene rect what contains all items and doesn't less that size of scene view. diff --git a/src/tools/vdatatool.h b/src/tools/vdatatool.h index d2b941393..69ef0a00f 100644 --- a/src/tools/vdatatool.h +++ b/src/tools/vdatatool.h @@ -44,7 +44,7 @@ public: * @param data container with variables * @param parent parent object */ - VDataTool(VContainer *data, QObject *parent = 0); + VDataTool(VContainer *data, QObject *parent = nullptr); virtual ~VDataTool(){} /** * @brief operator = assignment operator. diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index 3beb3072f..5ad9740b4 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -49,7 +49,7 @@ const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath"); VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Tool::Sources &typeCreation, VMainGraphicsScene *scene, QGraphicsItem *parent) - :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(0), sceneDetails(scene) + :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene) { VDetail detail = data->GetDetail(id); for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) diff --git a/src/tools/vtooldetail.h b/src/tools/vtooldetail.h index aaf11337c..c15d4da54 100644 --- a/src/tools/vtooldetail.h +++ b/src/tools/vtooldetail.h @@ -50,7 +50,7 @@ public: * @param parent parent object */ VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Tool::Sources &typeCreation, - VMainGraphicsScene *scene, QGraphicsItem * parent = 0); + VMainGraphicsScene *scene, QGraphicsItem * parent = nullptr); ~VToolDetail(); /** * @brief setDialog set dialog when user want change tool option. diff --git a/src/tools/vtooluniondetails.h b/src/tools/vtooluniondetails.h index aae979e7b..32505d861 100644 --- a/src/tools/vtooluniondetails.h +++ b/src/tools/vtooluniondetails.h @@ -53,7 +53,7 @@ public: */ VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, const VDetail &d2, const quint32 &indexD1, const quint32 &indexD2, const Tool::Sources &typeCreation, - QObject *parent = 0); + QObject *parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ diff --git a/src/widgets/doubledelegate.h b/src/widgets/doubledelegate.h index fde48b36b..f515b14cb 100644 --- a/src/widgets/doubledelegate.h +++ b/src/widgets/doubledelegate.h @@ -43,7 +43,7 @@ public: * @brief DoubleSpinBoxDelegate constructor. * @param parent parent object. */ - DoubleSpinBoxDelegate(QObject *parent = 0): QItemDelegate(parent), lastValue(-10001.0){} + DoubleSpinBoxDelegate(QObject *parent = nullptr): QItemDelegate(parent), lastValue(-10001.0){} /** * @brief createEditorReturns the widget used to edit the item specified by index for editing. The parent widget and * style option are used to control how the editor widget appears. diff --git a/src/widgets/textdelegate.h b/src/widgets/textdelegate.h index 5bdac8a6e..442ca1a3d 100644 --- a/src/widgets/textdelegate.h +++ b/src/widgets/textdelegate.h @@ -43,7 +43,7 @@ public: * @brief TextDelegate constructor. * @param parent parent widget. */ - explicit TextDelegate(QObject *parent = 0); + explicit TextDelegate(QObject *parent = nullptr); /** * @brief createEditorReturns the widget used to edit the item specified by index for editing. The parent widget and * style option are used to control how the editor widget appears. diff --git a/src/widgets/vcontrolpointspline.cpp b/src/widgets/vcontrolpointspline.cpp index bf1dc0be8..c8ba29692 100644 --- a/src/widgets/vcontrolpointspline.cpp +++ b/src/widgets/vcontrolpointspline.cpp @@ -34,7 +34,8 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint, QGraphicsItem *parent) - :QGraphicsEllipseItem(parent), radius(toPixel(1.5)), controlLine(0), indexSpline(indexSpline), position(position) + :QGraphicsEllipseItem(parent), radius(toPixel(1.5)), controlLine(nullptr), indexSpline(indexSpline), + position(position) { //create circle QRectF rec = QRectF(0, 0, radius*2, radius*2); diff --git a/src/widgets/vcontrolpointspline.h b/src/widgets/vcontrolpointspline.h index 60e8b5b54..550420bfb 100644 --- a/src/widgets/vcontrolpointspline.h +++ b/src/widgets/vcontrolpointspline.h @@ -50,7 +50,7 @@ public: */ VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint, - QGraphicsItem * parent = 0); + QGraphicsItem * parent = nullptr); signals: /** * @brief ControlPointChangePosition emit when control point change position. diff --git a/src/widgets/vgraphicssimpletextitem.h b/src/widgets/vgraphicssimpletextitem.h index f21454f4d..4c6967a60 100644 --- a/src/widgets/vgraphicssimpletextitem.h +++ b/src/widgets/vgraphicssimpletextitem.h @@ -42,13 +42,13 @@ public: * @brief VGraphicsSimpleTextItem default constructor. * @param parent parent object. */ - VGraphicsSimpleTextItem(QGraphicsItem * parent = 0); + VGraphicsSimpleTextItem(QGraphicsItem * parent = nullptr); /** * @brief VGraphicsSimpleTextItem constructor. * @param text text. * @param parent parent object. */ - VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent = 0 ); + VGraphicsSimpleTextItem( const QString & text, QGraphicsItem * parent = nullptr ); /** * @brief FontSize return label font size. * @return font size. diff --git a/src/widgets/vitem.cpp b/src/widgets/vitem.cpp index 8d548a648..bbbf2d11e 100644 --- a/src/widgets/vitem.cpp +++ b/src/widgets/vitem.cpp @@ -33,17 +33,17 @@ #include VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent ) - :QGraphicsPathItem ( path, parent ), numInOutList(numInList), paper(0) + :QGraphicsPathItem ( path, parent ), numInOutList(numInList), paper(nullptr) { } -VItem::VItem():numInOutList(0), paper(0) +VItem::VItem():numInOutList(0), paper(nullptr) { } VItem::VItem(int numInList, QGraphicsItem *parent):QGraphicsPathItem (parent), numInOutList(numInList), - paper(0) + paper(nullptr) { } @@ -51,7 +51,7 @@ VItem::VItem(int numInList, QGraphicsItem *parent):QGraphicsPathItem (parent), n void VItem::checkItemChange() { QRectF rect; - if (paper == 0) + if (paper == nullptr) { qDebug()<<"Don't set paper for detail!!!!"; rect = this->scene()->sceneRect(); diff --git a/src/widgets/vitem.h b/src/widgets/vitem.h index 0b8523045..4822e0f4b 100644 --- a/src/widgets/vitem.h +++ b/src/widgets/vitem.h @@ -48,14 +48,14 @@ public: * @param numInList index in list of details. * @param parent parent object. */ - VItem (int numInList, QGraphicsItem * parent = 0); + VItem (int numInList, QGraphicsItem * parent = nullptr); /** * @brief VItem constructor. * @param path detail path. * @param numInList index in list of details. * @param parent parent object. */ - VItem ( const QPainterPath & path, int numInList, QGraphicsItem * parent = 0 ); + VItem ( const QPainterPath & path, int numInList, QGraphicsItem * parent = nullptr ); /** * @brief Rotate rotate detail on angle in degree. * @param angle angle in degree. diff --git a/src/widgets/vmaingraphicsscene.h b/src/widgets/vmaingraphicsscene.h index a25b4a74f..3b3f6afa4 100644 --- a/src/widgets/vmaingraphicsscene.h +++ b/src/widgets/vmaingraphicsscene.h @@ -48,7 +48,7 @@ public: * @param sceneRect scene rect. * @param parent parent object. */ - VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = 0); + VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = nullptr); /** * @brief getHorScrollBar return scene horizontal scrollbar. * @return horizontal scrollbar. diff --git a/src/widgets/vmaingraphicsview.h b/src/widgets/vmaingraphicsview.h index 175f35025..55cdfd648 100644 --- a/src/widgets/vmaingraphicsview.h +++ b/src/widgets/vmaingraphicsview.h @@ -42,7 +42,7 @@ public: * @brief VMainGraphicsView constructor. * @param parent parent object. */ - explicit VMainGraphicsView(QWidget *parent = 0); + explicit VMainGraphicsView(QWidget *parent = nullptr); signals: /** * @brief NewFactor send new scale factor. diff --git a/src/widgets/vsimplearc.cpp b/src/widgets/vsimplearc.cpp index f6cf369eb..91ebef9b9 100644 --- a/src/widgets/vsimplearc.cpp +++ b/src/widgets/vsimplearc.cpp @@ -31,7 +31,7 @@ VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) { - if (factor == 0) + if (factor == nullptr) { setPen(QPen(Qt::black, widthHairLine)); } @@ -55,7 +55,7 @@ void VSimpleArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - if (factor == 0) + if (factor == nullptr) { this->setPen(QPen(*currentColor, widthMainLine)); } @@ -68,7 +68,7 @@ void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VSimpleArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - if (factor == 0) + if (factor == nullptr) { this->setPen(QPen(*currentColor, widthHairLine)); } diff --git a/src/widgets/vsimplearc.h b/src/widgets/vsimplearc.h index 32665a254..914e93daf 100644 --- a/src/widgets/vsimplearc.h +++ b/src/widgets/vsimplearc.h @@ -55,7 +55,7 @@ public: * @param factor scale factor. * @param parent parent object. */ - VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0); + VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = nullptr); signals: /** * @brief Choosed send id when clicked. diff --git a/src/widgets/vsimplespline.cpp b/src/widgets/vsimplespline.cpp index 3e5d2d063..320bb37b8 100644 --- a/src/widgets/vsimplespline.cpp +++ b/src/widgets/vsimplespline.cpp @@ -32,7 +32,7 @@ VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) { - if (factor == 0) + if (factor == nullptr) { setPen(QPen(Qt::black, widthHairLine)); } @@ -56,7 +56,7 @@ void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - if (factor == 0) + if (factor == nullptr) { this->setPen(QPen(*currentColor, widthMainLine)); } @@ -69,7 +69,7 @@ void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - if (factor == 0) + if (factor == nullptr) { this->setPen(QPen(*currentColor, widthHairLine)); } diff --git a/src/widgets/vsimplespline.h b/src/widgets/vsimplespline.h index 4853c1cbe..51045182e 100644 --- a/src/widgets/vsimplespline.h +++ b/src/widgets/vsimplespline.h @@ -55,7 +55,7 @@ public: * @param currentColor current color. * @param parent parent object. */ - VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = 0, QObject *parent = 0); + VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = 0); signals: /** * @brief Choosed send id when clicked. diff --git a/src/widgets/vtablegraphicsview.h b/src/widgets/vtablegraphicsview.h index 7d7ebd5c9..abd79573a 100644 --- a/src/widgets/vtablegraphicsview.h +++ b/src/widgets/vtablegraphicsview.h @@ -43,7 +43,7 @@ public: */ enum typeMove_e { Left, Right, Up, Down }; - VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent = 0); + VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent = nullptr); signals: /** * @brief itemChect emit after change selection state detail. diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index de4449ec4..e22d956e5 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -40,7 +40,7 @@ class MessageHandler : public QAbstractMessageHandler { public: - MessageHandler() : QAbstractMessageHandler(0), m_messageType(QtMsgType()), m_description(QString()), + MessageHandler() : QAbstractMessageHandler(), m_messageType(QtMsgType()), m_description(QString()), m_sourceLocation(QSourceLocation()){} QString statusMessage() const; qint64 line() const; diff --git a/src/xml/vpattern.h b/src/xml/vpattern.h index 454786598..67298f618 100644 --- a/src/xml/vpattern.h +++ b/src/xml/vpattern.h @@ -52,7 +52,7 @@ class VPattern : public QObject, public VDomDocument { Q_OBJECT public: - VPattern(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent = 0); + VPattern(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent = nullptr); /** * @brief CreateEmptyFile create minimal empty file. */ From 25e6df1c1d9fd36bca824136e30b69d82ac05c84 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 26 Feb 2014 11:38:14 +0200 Subject: [PATCH 15/60] Methods can be static. --HG-- branch : feature --- src/geometry/vequidistant.cpp | 12 ++++++------ src/geometry/vequidistant.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/geometry/vequidistant.cpp b/src/geometry/vequidistant.cpp index 66407cf34..285a6eecd 100644 --- a/src/geometry/vequidistant.cpp +++ b/src/geometry/vequidistant.cpp @@ -157,7 +157,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer return path; } -qreal VEquidistant::GetLengthContour(const QVector &contour, const QVector &newPoints) const +qreal VEquidistant::GetLengthContour(const QVector &contour, const QVector &newPoints) { qreal length = 0; QVector points; @@ -170,7 +170,7 @@ qreal VEquidistant::GetLengthContour(const QVector &contour, const QVec return length; } -QVector VEquidistant::biasPoints(const QVector &points, const qreal &mx, const qreal &my) const +QVector VEquidistant::biasPoints(const QVector &points, const qreal &mx, const qreal &my) { QVector p; for (qint32 i = 0; i < points.size(); ++i) @@ -183,7 +183,7 @@ QVector VEquidistant::biasPoints(const QVector &points, const return p; } -QVector VEquidistant::CorrectEquidistantPoints(const QVector &points) const +QVector VEquidistant::CorrectEquidistantPoints(const QVector &points) { QVector correctPoints; if (points.size()<4)//Better don't check if only three points. We can destroy equidistant. @@ -295,7 +295,7 @@ QPainterPath VEquidistant::Equidistant(QVector points, const Detail::Eq return ekv; } -QVector VEquidistant::CheckLoops(const QVector &points) const +QVector VEquidistant::CheckLoops(const QVector &points) { QVector ekvPoints; /*If we got less than 4 points no need seek loops.*/ @@ -353,7 +353,7 @@ QVector VEquidistant::CheckLoops(const QVector &points) const return ekvPoints; } -QVector VEquidistant::GetReversePoint(const QVector &points) const +QVector VEquidistant::GetReversePoint(const QVector &points) { Q_ASSERT(points.size() > 0); QVector reversePoints; @@ -421,7 +421,7 @@ QLineF VEquidistant::ParallelLine(const QLineF &line, qreal width) const return paralel; } -QPointF VEquidistant::SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width) const +QPointF VEquidistant::SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width) { Q_ASSERT(width > 0); QLineF pLine = line; diff --git a/src/geometry/vequidistant.h b/src/geometry/vequidistant.h index 652788fbb..2d261a0f4 100644 --- a/src/geometry/vequidistant.h +++ b/src/geometry/vequidistant.h @@ -52,7 +52,7 @@ private: * @param newPoints point whos we try to add to contour. * @return length length of contour. */ - qreal GetLengthContour(const QVector &contour, const QVector &newPoints) const; + static qreal GetLengthContour(const QVector &contour, const QVector &newPoints); /** * @brief biasPoints bias point. * @param points vector of points. @@ -60,13 +60,13 @@ private: * @param my offset respect to y. * @return new vector biased points. */ - QVector biasPoints(const QVector &points, const qreal &mx, const qreal &my) const; + static QVector biasPoints(const QVector &points, const qreal &mx, const qreal &my); /** * @brief CorrectEquidistantPoints clear equivalent points and remove point on line from equdistant. * @param points list of points equdistant. * @return corrected list. */ - QVector CorrectEquidistantPoints(const QVector &points) const; + static QVector CorrectEquidistantPoints(const QVector &points); /** * @brief Equidistant create equidistant painter path for detail. * @param points vector of points. @@ -80,13 +80,13 @@ private: * @param points vector of points of equidistant. * @return vector of points of equidistant. */ - QVector CheckLoops(const QVector &points) const; + static QVector CheckLoops(const QVector &points); /** * @brief GetReversePoint return revers container of points. * @param points container with points. * @return reverced points. */ - QVector GetReversePoint(const QVector &points) const; + static QVector GetReversePoint(const QVector &points); /** * @brief EkvPoint return vector of points of equidistant two lines. Last point of two lines must be equal. * @param line1 first line. @@ -109,7 +109,7 @@ private: * @param width width to parallel line. * @return point of parallel line. */ - QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width) const; + static QPointF SingleParallelPoint(const QLineF &line, const qreal &angle, const qreal &width); }; #endif // VEQUIDISTANT_H From 79f2ddde2ac0624e92273ab6b096a6d2aef7ecb6 Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 26 Feb 2014 11:51:37 +0200 Subject: [PATCH 16/60] Vera++. --HG-- branch : feature --- src/dialogs/app/configdialog.cpp | 6 ++-- .../app/dialogindividualmeasurements.h | 5 +-- src/dialogs/app/dialogmeasurements.h | 5 +-- src/dialogs/app/dialogpatternproperties.h | 5 +-- src/dialogs/app/dialogstandardmeasurements.h | 5 +-- src/dialogs/tools/dialogtool.cpp | 2 +- src/dialogs/tools/dialogtool.h | 3 +- src/dialogs/tools/dialoguniondetails.cpp | 3 +- src/mainwindow.cpp | 6 +++- src/tablewindow.cpp | 4 +-- src/tools/drawTools/vtoolbisector.cpp | 7 ++-- src/tools/drawTools/vtoolline.cpp | 4 +-- src/tools/drawTools/vtoolline.h | 4 +-- src/tools/drawTools/vtoolshoulderpoint.cpp | 6 ++-- src/tools/drawTools/vtoolsplinepath.cpp | 2 +- src/tools/vabstracttool.cpp | 14 ++++---- src/tools/vtooluniondetails.h | 7 ++-- src/widgets/textdelegate.cpp | 4 +-- src/xml/vpattern.cpp | 36 ++++++++++--------- 19 files changed, 71 insertions(+), 57 deletions(-) diff --git a/src/dialogs/app/configdialog.cpp b/src/dialogs/app/configdialog.cpp index 283ed3da3..dd287a059 100644 --- a/src/dialogs/app/configdialog.cpp +++ b/src/dialogs/app/configdialog.cpp @@ -125,12 +125,12 @@ void ConfigDialog::createIcons() void ConfigDialog::Apply() { - switch(contentsWidget->currentRow()) + switch (contentsWidget->currentRow()) { - case(0): + case (0): configurationPage->Apply(); break; - case(1): + case (1): patternPage->Apply(); break; default: diff --git a/src/dialogs/app/dialogindividualmeasurements.h b/src/dialogs/app/dialogindividualmeasurements.h index bcde13c66..1c97d264e 100644 --- a/src/dialogs/app/dialogindividualmeasurements.h +++ b/src/dialogs/app/dialogindividualmeasurements.h @@ -31,8 +31,9 @@ #include -namespace Ui { -class DialogIndividualMeasurements; +namespace Ui +{ + class DialogIndividualMeasurements; } class DialogIndividualMeasurements : public QDialog diff --git a/src/dialogs/app/dialogmeasurements.h b/src/dialogs/app/dialogmeasurements.h index 2a098c32c..23ef5a64e 100644 --- a/src/dialogs/app/dialogmeasurements.h +++ b/src/dialogs/app/dialogmeasurements.h @@ -31,8 +31,9 @@ #include -namespace Ui { -class DialogMeasurements; +namespace Ui +{ + class DialogMeasurements; } namespace Measurements diff --git a/src/dialogs/app/dialogpatternproperties.h b/src/dialogs/app/dialogpatternproperties.h index 9bd8c11f9..3c4fae0c5 100644 --- a/src/dialogs/app/dialogpatternproperties.h +++ b/src/dialogs/app/dialogpatternproperties.h @@ -32,8 +32,9 @@ #include #include "../../xml/vpattern.h" -namespace Ui { -class DialogPatternProperties; +namespace Ui +{ + class DialogPatternProperties; } class DialogPatternProperties : public QDialog diff --git a/src/dialogs/app/dialogstandardmeasurements.h b/src/dialogs/app/dialogstandardmeasurements.h index d89ed2593..838cc48ce 100644 --- a/src/dialogs/app/dialogstandardmeasurements.h +++ b/src/dialogs/app/dialogstandardmeasurements.h @@ -31,8 +31,9 @@ #include -namespace Ui { -class DialogStandardMeasurements; +namespace Ui +{ + class DialogStandardMeasurements; } class DialogStandardMeasurements : public QDialog diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index d2b23fc1b..03ce0823f 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -213,7 +213,7 @@ void DialogTool::FillComboBoxTypeLine(QComboBox *box) const QString DialogTool::GetTypeLine(const QComboBox *box) const { - switch(lineStyles.indexOf(box->currentText())) + switch (lineStyles.indexOf(box->currentText())) { case 0: //No line return VAbstractTool::TypeLineNone; diff --git a/src/dialogs/tools/dialogtool.h b/src/dialogs/tools/dialogtool.h index ee1abf5df..9b68e07bb 100644 --- a/src/dialogs/tools/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -389,7 +389,8 @@ protected: * @param id don't show this id in list * @param cut if set to ComboMode::CutSpline don't show id+1 and id+2 */ - void setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value, const quint32 &id, + void setCurrentSplinePathId(QComboBox *box, quint32 &splinePathId, const quint32 &value, + const quint32 &id, ComboMode::ComboBoxCutSpline cut = ComboMode::NoCutSpline) const; /** * @brief getCurrentPointId return current point id in combobox diff --git a/src/dialogs/tools/dialoguniondetails.cpp b/src/dialogs/tools/dialoguniondetails.cpp index 73c80a3f6..580bcddc2 100644 --- a/src/dialogs/tools/dialoguniondetails.cpp +++ b/src/dialogs/tools/dialoguniondetails.cpp @@ -72,7 +72,8 @@ bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail) return det.Containes(id); } -void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Scene::Scenes &type, quint32 &idDetail, ptrdiff_t &index) +void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Scene::Scenes &type, quint32 &idDetail, + ptrdiff_t &index) { if (idDetail == 0) { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f72d42447..cdc622e12 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -52,7 +52,7 @@ MainWindow::MainWindow(QWidget *parent) currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), view(nullptr), isInitialized(false), dialogTable(0), dialogTool(nullptr), dialogHistory(nullptr), comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0), currentToolBoxIndex(0), - drawMode(true), recentFileActs{0,0,0,0,0}, separatorAct(nullptr), autoSaveTimer(nullptr) + drawMode(true), recentFileActs{0, 0, 0, 0, 0}, separatorAct(nullptr), autoSaveTimer(nullptr) { CreateActions(); CreateMenus(); @@ -1258,9 +1258,13 @@ bool MainWindow::MaybeSave() "Do you want to save your changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel); if (ret == QMessageBox::Save) + { return Save(); + } else if (ret == QMessageBox::Cancel) + { return false; + } } return true; } diff --git a/src/tablewindow.cpp b/src/tablewindow.cpp index c4d489b34..3902fc0c9 100644 --- a/src/tablewindow.cpp +++ b/src/tablewindow.cpp @@ -490,7 +490,7 @@ void TableWindow::EpsFile(const QString &name) const params << "-eps" << tmp.fileName() << name; PdfToPs(name, params); - } + } } void TableWindow::PsFile(const QString &name) const @@ -530,7 +530,7 @@ void TableWindow::PdfToPs(const QString &name, const QStringList ¶ms) const qDebug() << proc.errorString(); QFile f(name); - if (!f.exists()) + if (f.exists() == false) { QMessageBox msgBox(QMessageBox::Critical, "Critical error!", "Creating file '"+name+"' failed!", QMessageBox::Ok | QMessageBox::Default); diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index 7208a4610..b2e42fa59 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -32,10 +32,9 @@ const QString VToolBisector::ToolType = QStringLiteral("bisector"); -VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, - const QString &typeLine, const QString &formula, const quint32 &firstPointId, - const quint32 &secondPointId, const quint32 &thirdPointId, const Tool::Sources &typeCreation, - QGraphicsItem *parent) +VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, + const quint32 &thirdPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0), thirdPointId(0) { this->firstPointId = firstPointId; diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index 766d7d998..9589315eb 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -78,8 +78,8 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern * Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Tool::FromGui); } -void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, const QString &typeLine, - VMainGraphicsScene *scene, VPattern *doc, VContainer *data, +void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, + const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) { Q_CHECK_PTR(scene); diff --git a/src/tools/drawTools/vtoolline.h b/src/tools/drawTools/vtoolline.h index 056b88a0b..d1e8fc74d 100644 --- a/src/tools/drawTools/vtoolline.h +++ b/src/tools/drawTools/vtoolline.h @@ -78,8 +78,8 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, const QString &typeLine, - VMainGraphicsScene *scene, VPattern *doc, VContainer *data, + static void Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, + const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static const QString TagName; public slots: diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 95ca09e19..4f137473d 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -32,9 +32,9 @@ const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder"); -VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, - const QString &typeLine, const QString &formula, const quint32 &p1Line, - const quint32 &p2Line, const quint32 &pShoulder, const Tool::Sources &typeCreation, +VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, + const QString &formula, const quint32 &p1Line, const quint32 &p2Line, + const quint32 &pShoulder, const Tool::Sources &typeCreation, QGraphicsItem * parent) :VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), pShoulder(pShoulder) { diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index caa09ffb0..c58b3b5c3 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -374,7 +374,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement) splPath.getKCurve()); CorectControlPoints(spl, splPath, i); CorectControlPoints(spl, splPath, i); - } + } doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); diff --git a/src/tools/vabstracttool.cpp b/src/tools/vabstracttool.cpp index 3832ba14c..e6453f773 100644 --- a/src/tools/vabstracttool.cpp +++ b/src/tools/vabstracttool.cpp @@ -260,24 +260,24 @@ void VAbstractTool::DeleteTool(QGraphicsItem *tool) Qt::PenStyle VAbstractTool::LineStyle() { QStringList styles = Styles(); - switch(styles.indexOf(typeLine)) + switch (styles.indexOf(typeLine)) { - case 0: + case 0: // TypeLineNone return Qt::NoPen; break; - case 1: + case 1: // TypeLineLine return Qt::SolidLine; break; - case 2: + case 2: // TypeLineDashLine return Qt::DashLine; break; - case 3: + case 3: // TypeLineDotLine return Qt::DotLine; break; - case 4: + case 4: // TypeLineDashDotLine return Qt::DashDotLine; break; - case 5: + case 5: // TypeLineDashDotDotLine return Qt::DashDotDotLine; break; default: diff --git a/src/tools/vtooluniondetails.h b/src/tools/vtooluniondetails.h index 32505d861..625901f4e 100644 --- a/src/tools/vtooluniondetails.h +++ b/src/tools/vtooluniondetails.h @@ -80,9 +80,10 @@ public: * @param parse parser file mode. * @param typeCreation way we create this tool. */ - static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, const quint32 &d2id, - const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, VPattern *doc, - VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); + static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, + const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, + VPattern *doc, VContainer *data, const Document::Documents &parse, + const Tool::Sources &typeCreation); /** * @brief GetDetailFromFile parse detail from file. * @param doc dom document container. diff --git a/src/widgets/textdelegate.cpp b/src/widgets/textdelegate.cpp index 54050cb06..a073dadf7 100644 --- a/src/widgets/textdelegate.cpp +++ b/src/widgets/textdelegate.cpp @@ -69,7 +69,7 @@ void TextDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, cons QLineEdit *lineEdit = qobject_cast(editor); Q_CHECK_PTR(lineEdit); QString text = lineEdit->text(); - if(text.isEmpty()) + if (text.isEmpty()) { text = lastText; } @@ -94,7 +94,7 @@ void TextDelegate::commitAndCloseEditor() lastText = text; emit commitData(lineEdit); } - else if(text.isEmpty() == false) + else if (text.isEmpty() == false) { lineEdit->setText(lastText); emit commitData(lineEdit); diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index c900dbf3c..82f53e3af 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -189,7 +189,7 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene { QStringList tags; tags << TagDraw << TagIncrements; - switch(tags.indexOf(domElement.tagName())) + switch (tags.indexOf(domElement.tagName())) { case 0: // TagDraw if (parse == Document::FullParse) @@ -450,7 +450,7 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen { QStringList tags; tags << TagCalculation << TagModeling << TagDetails; - switch(tags.indexOf(domElement.tagName())) + switch (tags.indexOf(domElement.tagName())) { case 0: // TagCalculation data->ClearCalculationGObjects(); @@ -495,7 +495,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene * { QStringList tags; tags << TagPoint << TagLine << TagSpline << TagArc << TagTools; - switch(tags.indexOf(domElement.tagName())) + switch (tags.indexOf(domElement.tagName())) { case 0: // TagPoint ParsePointElement(scene, domElement, parse, domElement.attribute(AttrType, "")); @@ -555,7 +555,7 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle QStringList types; types << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline << VToolDetail::NodeSplinePath; - switch(types.indexOf(t)) + switch (types.indexOf(t)) { case 0: // VToolDetail::NodePoint tool = Tool::NodePoint; @@ -624,7 +624,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d << VToolLineIntersect::ToolType << VToolPointOfContact::ToolType << VNodePoint::ToolType << VToolHeight::ToolType << VToolTriangle::ToolType << VToolPointOfIntersection::ToolType << VToolCutSpline::ToolType << VToolCutSplinePath::ToolType << VToolCutArc::ToolType; - switch(points.indexOf(type)) { + switch (points.indexOf(type)) + { case 0: //VToolSinglePoint::ToolType { VToolSinglePoint *spoint = 0; @@ -747,8 +748,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); - VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, - angle, mx, my, scene, this,data, parse, Tool::FromFile); + VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene, + this, data, parse, Tool::FromFile); } catch (const VExceptionBadId &e) { @@ -815,8 +816,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); - VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, - mx, my, scene, this,data, parse, Tool::FromFile); + VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my, scene, this, + data, parse, Tool::FromFile); } catch (const VExceptionBadId &e) { @@ -834,8 +835,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const VPointF *point = data->GeometricObject(idObject ); const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); - data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), - mx, my, idObject,Draw::Modeling)); + data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), mx, my, idObject, + Draw::Modeling)); VNodePoint::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); } catch (const VExceptionBadId &e) @@ -900,8 +901,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); - VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, - mx, my, scene, this, data, parse,Tool::FromFile); + VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, scene, this, data, + parse, Tool::FromFile); } catch (const VExceptionBadId &e) { @@ -1006,7 +1007,8 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & QStringList splines; splines << VToolSpline::ToolType << VToolSplinePath::ToolType << VNodeSpline::ToolType << VNodeSplinePath::ToolType; - switch(splines.indexOf(type)) { + switch (splines.indexOf(type)) + { case 0: //VToolSpline::ToolType try { @@ -1130,7 +1132,8 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom QStringList arcs; arcs << VToolArc::ToolType << VNodeArc::ToolType; - switch(arcs.indexOf(type)) { + switch (arcs.indexOf(type)) + { case 0: //VToolArc::ToolType try { @@ -1185,7 +1188,8 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d QStringList tools; tools << VToolUnionDetails::ToolType; - switch(tools.indexOf(type)) { + switch (tools.indexOf(type)) + { case 0: //VToolUnionDetails::ToolType try { From 9bc366094091fca69a33240524c9ca9397821063 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 27 Feb 2014 11:30:05 +0200 Subject: [PATCH 17/60] Optimization switch - macros Q_UNREACHABLE(). --HG-- branch : feature --- src/dialogs/app/dialoghistory.cpp | 7 +++++++ src/dialogs/app/dialogincrements.cpp | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/dialogs/app/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp index 2f97b8367..756cf7982 100644 --- a/src/dialogs/app/dialoghistory.cpp +++ b/src/dialogs/app/dialoghistory.cpp @@ -174,6 +174,7 @@ QString DialogHistory::Record(const VToolRecord &tool) switch ( tool.getTypeTool() ) { case Tool::ArrowTool: + Q_UNREACHABLE(); break; case Tool::SinglePointTool: { @@ -435,16 +436,22 @@ QString DialogHistory::Record(const VToolRecord &tool) //Because "history" not only show history of pattern, but help restore current data for each pattern's piece, we //need add record about details and nodes, but don't show them. case Tool::Detail: + Q_UNREACHABLE(); break; case Tool::UnionDetails: + Q_UNREACHABLE(); break; case Tool::NodeArc: + Q_UNREACHABLE(); break; case Tool::NodePoint: + Q_UNREACHABLE(); break; case Tool::NodeSpline: + Q_UNREACHABLE(); break; case Tool::NodeSplinePath: + Q_UNREACHABLE(); break; default: qWarning()<row = row; switch (column) { - case 0: + case 0: // name item = ui->tableWidgetIncrement->item(row, 0); id = qvariant_cast(item->data(Qt::UserRole)); domElement = doc->elementById(QString().setNum(id)); @@ -439,7 +439,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) emit haveLiteChange(); } break; - case 2: + case 2: // base itemName = ui->tableWidgetIncrement->item(row, 0); item = ui->tableWidgetIncrement->item(row, column); id = qvariant_cast(itemName->data(Qt::UserRole)); @@ -461,7 +461,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) } } break; - case 3: + case 3: // ksize itemName = ui->tableWidgetIncrement->item(row, 0); item = ui->tableWidgetIncrement->item(row, column); id = qvariant_cast(itemName->data(Qt::UserRole)); @@ -474,7 +474,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) emit haveLiteChange(); } break; - case 4: + case 4: // kgrowth itemName = ui->tableWidgetIncrement->item(row, 0); item = ui->tableWidgetIncrement->item(row, column); id = qvariant_cast(itemName->data(Qt::UserRole)); @@ -487,7 +487,7 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) emit haveLiteChange(); } break; - case 5: + case 5: // description itemName = ui->tableWidgetIncrement->item(row, 0); item = ui->tableWidgetIncrement->item(row, column); id = qvariant_cast(itemName->data(Qt::UserRole)); From f027cad706f24f72dbec32c9fd2248184176f3af Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 27 Feb 2014 19:57:16 +0200 Subject: [PATCH 18/60] Standard measurement table for man (russian language). --HG-- branch : feature --- .../schema/standard_measurements.xsd | 2 +- share/tables/standard/GOST_man_ru.vst | 84 +++++++++++++++++++ 2 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 share/tables/standard/GOST_man_ru.vst diff --git a/share/resources/schema/standard_measurements.xsd b/share/resources/schema/standard_measurements.xsd index 37a4e4e63..7159630a7 100644 --- a/share/resources/schema/standard_measurements.xsd +++ b/share/resources/schema/standard_measurements.xsd @@ -15,7 +15,7 @@ - + diff --git a/share/tables/standard/GOST_man_ru.vst b/share/tables/standard/GOST_man_ru.vst new file mode 100644 index 000000000..052c9f807 --- /dev/null +++ b/share/tables/standard/GOST_man_ru.vst @@ -0,0 +1,84 @@ + + Типовые фигуры мужчин 1-й полнотной группы, обхват груди 100 см + mm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From ac4495d9d26064c210e94665038d9564451d577b Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 28 Feb 2014 15:30:34 +0200 Subject: [PATCH 19/60] Ignore Mercurial .orig files. --HG-- branch : feature --- .hgignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.hgignore b/.hgignore index 2e058acbc..828b54ff8 100644 --- a/.hgignore +++ b/.hgignore @@ -25,3 +25,6 @@ latex/ # Ignore file Qt translation. *.qm + +# Ignore Mercurial .orig files +*.orig From 3e98a8430812f11776c718251b99c668c813de2e Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 2 Mar 2014 17:52:03 +0200 Subject: [PATCH 20/60] Initial commit for russian individual table. --HG-- branch : feature --- share/tables/individual/indivindual_ru.vit | 91 ++++++++++++++++++++++ share/tables/standard/GOST_man_ru.vst | 6 +- 2 files changed, 94 insertions(+), 3 deletions(-) create mode 100644 share/tables/individual/indivindual_ru.vit diff --git a/share/tables/individual/indivindual_ru.vit b/share/tables/individual/indivindual_ru.vit new file mode 100644 index 000000000..3f6192a39 --- /dev/null +++ b/share/tables/individual/indivindual_ru.vit @@ -0,0 +1,91 @@ + + ru + + + + + + + + mm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/tables/standard/GOST_man_ru.vst b/share/tables/standard/GOST_man_ru.vst index 052c9f807..b0289246d 100644 --- a/share/tables/standard/GOST_man_ru.vst +++ b/share/tables/standard/GOST_man_ru.vst @@ -16,8 +16,8 @@ - - + + @@ -66,7 +66,7 @@ - + From 084061fbd57938aeff8444265e07d5d971783898 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 2 Mar 2014 20:32:54 +0200 Subject: [PATCH 21/60] Refactoring dialog history. --HG-- branch : feature --- share/resources/schema/pattern.xsd | 12 +- share/tables/individual/indivindual_ru.vit | 8 +- src/container/vcontainer.h | 19 +- src/dialogs/app/dialoghistory.cpp | 567 ++++++++++----------- src/mainwindow.cpp | 4 +- 5 files changed, 285 insertions(+), 325 deletions(-) diff --git a/share/resources/schema/pattern.xsd b/share/resources/schema/pattern.xsd index d1a1fe300..78a444e41 100644 --- a/share/resources/schema/pattern.xsd +++ b/share/resources/schema/pattern.xsd @@ -115,9 +115,9 @@ - + - + @@ -150,8 +150,8 @@ - - + + @@ -179,8 +179,8 @@ - - + + diff --git a/share/tables/individual/indivindual_ru.vit b/share/tables/individual/indivindual_ru.vit index 3f6192a39..0b2e1b5fc 100644 --- a/share/tables/individual/indivindual_ru.vit +++ b/share/tables/individual/indivindual_ru.vit @@ -53,7 +53,7 @@ - + @@ -74,12 +74,12 @@ - + - - + + diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index eee7edbda..e640f22d0 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -74,7 +74,7 @@ public: */ void setData(const VContainer &data); template - const T GeometricObject(quint32 id) const + const T GeometricObject(const quint32 &id) const { VGObject *gObj = nullptr; if (gObjects.contains(id)) @@ -84,10 +84,21 @@ public: else { throw VExceptionBadId(tr("Can't find object"), id); + return nullptr; } - T obj = dynamic_cast(gObj); - Q_CHECK_PTR(obj); - return obj; + + try + { + T obj = dynamic_cast(gObj); + Q_CHECK_PTR(obj); + return obj; + } + catch(const std::bad_alloc &) + { + throw VExceptionBadId(tr("Can't cast object"), id); + return nullptr; + } + return nullptr; } /** diff --git a/src/dialogs/app/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp index 756cf7982..ad0155a5b 100644 --- a/src/dialogs/app/dialoghistory.cpp +++ b/src/dialogs/app/dialoghistory.cpp @@ -121,36 +121,45 @@ void DialogHistory::UpdateHistory() void DialogHistory::FillTable() { ui->tableWidget->clear(); - QVector *history = doc->getHistory(); + const QVector *history = doc->getHistory(); + Q_CHECK_PTR(history); qint32 currentRow = -1; qint32 count = 0; ui->tableWidget->setRowCount(history->size()); for (qint32 i = 0; i< history->size(); ++i) { - VToolRecord tool = history->at(i); + const VToolRecord tool = history->at(i); if (tool.getNameDraw() != doc->GetNameActivDraw()) { continue; } - currentRow++; + const QString historyRecord = Record(tool); + if (historyRecord.isEmpty() ==false) + { + currentRow++; - QTableWidgetItem *item = new QTableWidgetItem(QString()); - item->setTextAlignment(Qt::AlignHCenter); - item->setData(Qt::UserRole, tool.getId()); - ui->tableWidget->setItem(currentRow, 0, item); + { + QTableWidgetItem *item = new QTableWidgetItem(QString()); + Q_CHECK_PTR(item); + item->setTextAlignment(Qt::AlignHCenter); + item->setData(Qt::UserRole, tool.getId()); + ui->tableWidget->setItem(currentRow, 0, item); + } - QString historyRecord = Record(tool); - item = new QTableWidgetItem(historyRecord); - item->setFont(QFont("Times", 12, QFont::Bold)); - item->setFlags(item->flags() ^ Qt::ItemIsEditable); - ui->tableWidget->setItem(currentRow, 1, item); - ++count; + QTableWidgetItem *item = new QTableWidgetItem(historyRecord); + Q_CHECK_PTR(item); + item->setFont(QFont("Times", 12, QFont::Bold)); + item->setFlags(item->flags() ^ Qt::ItemIsEditable); + ui->tableWidget->setItem(currentRow, 1, item); + ++count; + } } ui->tableWidget->setRowCount(count); if (history->size()>0) { cursorRow = currentRow; QTableWidgetItem *item = ui->tableWidget->item(cursorRow, 0); + Q_CHECK_PTR(item); item->setIcon(QIcon("://icon/32x32/put_after.png")); } ui->tableWidget->resizeColumnsToContents(); @@ -160,304 +169,244 @@ void DialogHistory::FillTable() QString DialogHistory::Record(const VToolRecord &tool) { - QString record = QString(); - quint32 basePointId = 0; - quint32 secondPointId = 0; - quint32 firstPointId = 0; - quint32 thirdPointId = 0; - quint32 p1Line1 = 0; - quint32 p2Line1 = 0; - quint32 p1Line2 = 0; - quint32 p2Line2 = 0; - quint32 center = 0; - QDomElement domElement; - switch ( tool.getTypeTool() ) + const QDomElement domElement = doc->elementById(QString().setNum(tool.getId())); + if (domElement.isElement() == false) { - case Tool::ArrowTool: - Q_UNREACHABLE(); - break; - case Tool::SinglePointTool: - { - QString name = data->GeometricObject(tool.getId())->name(); - record = QString(tr("%1 - Base point")).arg(name); - break; - } - case Tool::EndLineTool: - { - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); - } - QString basePointIdName = data->GeometricObject(basePointId)->name(); - QString toolIdName = data->GeometricObject(tool.getId())->name(); - record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(basePointIdName, toolIdName); - break; - } - case Tool::LineTool: - { - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); - } - QString firstPointIdName = data->GeometricObject(firstPointId)->name(); - QString secondPointIdName = data->GeometricObject(secondPointId)->name(); - record = QString(tr("%1_%2 - Line from point %1 to point %2")).arg(firstPointIdName, secondPointIdName); - break; - } - case Tool::AlongLineTool: - { - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); - } - QString basePointIdName = data->GeometricObject(basePointId)->name(); - QString secondPointIdName = data->GeometricObject(secondPointId)->name(); - QString toolIdName = data->GeometricObject(tool.getId())->name(); - record = QString(tr("%3 - Point along line %1_%2")).arg(basePointIdName, secondPointIdName, toolIdName); - break; - } - case Tool::ShoulderPointTool: - { - QString name = data->GeometricObject(tool.getId())->name(); - record = QString(tr("%1 - Point of shoulder")).arg(name); - break; - } - case Tool::NormalTool: - { - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); - } - QString basePointIdName = data->GeometricObject(basePointId)->name(); - QString secondPointIdName = data->GeometricObject(secondPointId)->name(); - QString toolIdName = data->GeometricObject(tool.getId())->name(); - record = QString(tr("%3 - normal to line %1_%2")).arg(basePointIdName, secondPointIdName, toolIdName); - break; - } - case Tool::BisectorTool: - { - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); - thirdPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrThirdPoint, "0"); - } - QString firstPointIdName = data->GeometricObject(firstPointId)->name(); - QString basePointIdName = data->GeometricObject(basePointId)->name(); - QString thirdPointIdName = data->GeometricObject(thirdPointId)->name(); - QString toolIdName = data->GeometricObject(tool.getId())->name(); - record = QString(tr("%4 - bisector of angle %1_%2_%3")).arg(firstPointIdName, basePointIdName, - thirdPointIdName, toolIdName); - break; - } - case Tool::LineIntersectTool: - { - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - p1Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0"); - p2Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0"); - p1Line2 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line2, "0"); - p2Line2 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line2, "0"); - } - QString p1Line1Name = data->GeometricObject(p1Line1)->name(); - QString p2Line1Name = data->GeometricObject(p2Line1)->name(); - QString p1Line2Name = data->GeometricObject(p1Line2)->name(); - QString p2Line2Name = data->GeometricObject(p2Line2)->name(); - QString toolIdName = data->GeometricObject(tool.getId())->name(); - record = QString(tr("%5 - intersection of lines %1_%2 and %3_%4")).arg(p1Line1Name, p2Line1Name, - p1Line2Name, p2Line2Name, - toolIdName); - break; - } - case Tool::SplineTool: - { - const VSpline *spl = data->GeometricObject(tool.getId()); - QString splP1Name = data->GeometricObject(spl->GetP1().id())->name(); - QString splP4Name = data->GeometricObject(spl->GetP4().id())->name(); - record = QString(tr("Curve %1_%2")).arg(splP1Name, splP4Name); - } - break; - case Tool::ArcTool: - { - const VArc *arc = data->GeometricObject(tool.getId()); - QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name(); - record = QString(tr("Arc with center in point %1")).arg(arcCenterName); - } - break; - case Tool::SplinePathTool: - { - const VSplinePath *splPath = data->GeometricObject(tool.getId()); - QVector points = splPath->GetSplinePath(); - if (points.size() != 0 ) - { - QString pName = data->GeometricObject(points[0].P().id())->name(); - record = QString(tr("Curve point %1")).arg(pName); - for (qint32 i = 1; i< points.size(); ++i) - { - pName = data->GeometricObject(points[i].P().id())->name(); - QString name = QString("_%1").arg(pName); - record.append(name); - } - } - } - break; - case Tool::PointOfContact: - { - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - center = doc->GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0"); - firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); - } - QString firstPointIdName = data->GeometricObject(firstPointId)->name(); - QString centerName = data->GeometricObject(center)->name(); - QString secondPointIdName = data->GeometricObject(secondPointId)->name(); - QString toolIdName = data->GeometricObject(tool.getId())->name(); - record = QString(tr("%4 - point of contact of arc with the center in point %1 and line %2_%3")).arg( - centerName, firstPointIdName, secondPointIdName, toolIdName); - break; - } - case Tool::Height: - { - quint32 p1LineId = 0; - quint32 p2LineId = 0; - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); - p1LineId = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0"); - p2LineId = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0"); - } - QString basePointIdName = data->GeometricObject(basePointId)->name(); - QString p1LineIdName = data->GeometricObject(p1LineId)->name(); - QString p2LineIdName = data->GeometricObject(p2LineId)->name(); - record = QString(tr("Point of perpendicular from point %1 to line %2_%3")).arg( basePointIdName, - p1LineIdName, p2LineIdName); - break; - } - case Tool::Triangle: - { - quint32 axisP1Id = 0; - quint32 axisP2Id = 0; - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - axisP1Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0"); - axisP2Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0"); - firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); - } - QString axisP1IdName = data->GeometricObject(axisP1Id)->name(); - QString axisP2IdName = data->GeometricObject(axisP2Id)->name(); - QString firstPointIdName = data->GeometricObject(firstPointId)->name(); - QString secondPointIdName = data->GeometricObject(secondPointId)->name(); - record = QString(tr("Triangle: axis %1_%2, points %3 and %4")).arg( axisP1IdName, axisP2IdName, - firstPointIdName, secondPointIdName); - break; - } - case Tool::PointOfIntersection: - { - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); - secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); - } - QString firstPointIdName = data->GeometricObject(firstPointId)->name(); - QString secondPointIdName = data->GeometricObject(secondPointId)->name(); - QString toolIdName = data->GeometricObject(tool.getId())->name(); - record = QString(tr("%1 - point of intersection %2 and %3")).arg(toolIdName, firstPointIdName, - secondPointIdName); - } - break; - case Tool::CutArcTool: - { - quint32 arcId = 0; - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - arcId = doc->GetParametrUInt(domElement, VToolCutArc::AttrArc, "0"); - } - const VArc *arc = data->GeometricObject(arcId); - QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name(); - QString toolIdName = data->GeometricObject(tool.getId())->name(); - record = QString(tr("%1 - cut arc with center %2")).arg(toolIdName, arcCenterName); - } - break; - case Tool::CutSplineTool: - { - quint32 splineId = 0; - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - splineId = doc->GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0"); - } - const VSpline *spl = data->GeometricObject(splineId); - QString toolIdName = data->GeometricObject(tool.getId())->name(); - QString splP1Name = data->GeometricObject(spl->GetP1().id())->name(); - QString splP4Name = data->GeometricObject(spl->GetP4().id())->name(); - record = QString(tr("%1 - cut curve %2_%3")).arg(toolIdName, splP1Name, splP4Name); - } - break; - case Tool::CutSplinePathTool: - { - quint32 splinePathId = 0; - domElement = doc->elementById(QString().setNum(tool.getId())); - if (domElement.isElement()) - { - splinePathId = doc->GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0"); - } - const VSplinePath *splPath = data->GeometricObject(splinePathId); - QVector points = splPath->GetSplinePath(); - if (points.size() != 0 ) - { - QString toolIdName = data->GeometricObject(tool.getId())->name(); - QString pName = data->GeometricObject(points[0].P().id())->name(); - record = QString(tr("%1 - cut curve path %2")).arg(toolIdName, pName); - for (qint32 i = 1; i< points.size(); ++i) - { - pName = data->GeometricObject(points[i].P().id())->name(); - QString name = QString("_%1").arg(pName); - record.append(name); - } - } - } - break; - //Because "history" not only show history of pattern, but help restore current data for each pattern's piece, we - //need add record about details and nodes, but don't show them. - case Tool::Detail: - Q_UNREACHABLE(); - break; - case Tool::UnionDetails: - Q_UNREACHABLE(); - break; - case Tool::NodeArc: - Q_UNREACHABLE(); - break; - case Tool::NodePoint: - Q_UNREACHABLE(); - break; - case Tool::NodeSpline: - Q_UNREACHABLE(); - break; - case Tool::NodeSplinePath: - Q_UNREACHABLE(); - break; - default: - qWarning()<GeometricObject(tool.getId())->name(); + return QString(tr("%1 - Base point")).arg(name); + } + case Tool::EndLineTool: + { + const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); + const QString basePointIdName = data->GeometricObject(basePointId)->name(); + const QString toolIdName = data->GeometricObject(tool.getId())->name(); + return QString(tr("%1_%2 - Line from point %1 to point %2")).arg(basePointIdName, toolIdName); + } + case Tool::LineTool: + { + const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); + const QString firstPointIdName = data->GeometricObject(firstPointId)->name(); + const QString secondPointIdName = data->GeometricObject(secondPointId)->name(); + return QString(tr("%1_%2 - Line from point %1 to point %2")).arg(firstPointIdName, secondPointIdName); + } + case Tool::AlongLineTool: + { + const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); + const QString basePointIdName = data->GeometricObject(basePointId)->name(); + const QString secondPointIdName = data->GeometricObject(secondPointId)->name(); + const QString toolIdName = data->GeometricObject(tool.getId())->name(); + return QString(tr("%3 - Point along line %1_%2")).arg(basePointIdName, secondPointIdName, toolIdName); + } + case Tool::ShoulderPointTool: + { + const QString name = data->GeometricObject(tool.getId())->name(); + return QString(tr("%1 - Point of shoulder")).arg(name); + } + case Tool::NormalTool: + { + const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); + const QString basePointIdName = data->GeometricObject(basePointId)->name(); + const QString secondPointIdName = data->GeometricObject(secondPointId)->name(); + const QString toolIdName = data->GeometricObject(tool.getId())->name(); + return QString(tr("%3 - normal to line %1_%2")).arg(basePointIdName, secondPointIdName, toolIdName); + } + case Tool::BisectorTool: + { + const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); + const quint32 thirdPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrThirdPoint, "0"); + const QString firstPointIdName = data->GeometricObject(firstPointId)->name(); + const QString secondPointIdName = data->GeometricObject(secondPointId)->name(); + const QString thirdPointIdName = data->GeometricObject(thirdPointId)->name(); + const QString toolIdName = data->GeometricObject(tool.getId())->name(); + return QString(tr("%4 - bisector of angle %1_%2_%3")).arg(firstPointIdName, secondPointIdName, + thirdPointIdName, toolIdName); + } + case Tool::LineIntersectTool: + { + const quint32 p1Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0"); + const quint32 p2Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0"); + const quint32 p1Line2 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line2, "0"); + const quint32 p2Line2 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line2, "0"); + const QString p1Line1Name = data->GeometricObject(p1Line1)->name(); + const QString p2Line1Name = data->GeometricObject(p2Line1)->name(); + const QString p1Line2Name = data->GeometricObject(p1Line2)->name(); + const QString p2Line2Name = data->GeometricObject(p2Line2)->name(); + const QString toolIdName = data->GeometricObject(tool.getId())->name(); + return QString(tr("%5 - intersection of lines %1_%2 and %3_%4")).arg(p1Line1Name, p2Line1Name, + p1Line2Name, p2Line2Name, + toolIdName); + } + case Tool::SplineTool: + { + const VSpline *spl = data->GeometricObject(tool.getId()); + Q_CHECK_PTR(spl); + const QString splP1Name = data->GeometricObject(spl->GetP1().id())->name(); + const QString splP4Name = data->GeometricObject(spl->GetP4().id())->name(); + return QString(tr("Curve %1_%2")).arg(splP1Name, splP4Name); + } + case Tool::ArcTool: + { + const VArc *arc = data->GeometricObject(tool.getId()); + Q_CHECK_PTR(arc); + const QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name(); + return QString(tr("Arc with center in point %1")).arg(arcCenterName); + } + case Tool::SplinePathTool: + { + const VSplinePath *splPath = data->GeometricObject(tool.getId()); + Q_CHECK_PTR(splPath); + const QVector points = splPath->GetSplinePath(); + QString record; + if (points.size() != 0 ) + { + const QString pName = data->GeometricObject(points.at(0).P().id())->name(); + record = QString(tr("Curve point %1")).arg(pName); + if(points.size() > 1) + { + const QString pName = data->GeometricObject(points.last().P().id())->name(); + record.append(QString("_%1").arg(pName)); + } + } + else + { + qWarning()<<"Not enough points in splinepath"<GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0"); + const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); + const QString firstPointIdName = data->GeometricObject(firstPointId)->name(); + const QString centerName = data->GeometricObject(center)->name(); + const QString secondPointIdName = data->GeometricObject(secondPointId)->name(); + const QString toolIdName = data->GeometricObject(tool.getId())->name(); + return QString(tr("%4 - point of contact of arc with the center in point %1 and line %2_%3")).arg( + centerName, firstPointIdName, secondPointIdName, toolIdName); + } + case Tool::Height: + { + const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); + const quint32 p1LineId = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0"); + const quint32 p2LineId = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0"); + const QString basePointIdName = data->GeometricObject(basePointId)->name(); + const QString p1LineIdName = data->GeometricObject(p1LineId)->name(); + const QString p2LineIdName = data->GeometricObject(p2LineId)->name(); + return QString(tr("Point of perpendicular from point %1 to line %2_%3")).arg(basePointIdName, + p1LineIdName, + p2LineIdName); + } + case Tool::Triangle: + { + const quint32 axisP1Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0"); + const quint32 axisP2Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0"); + const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); + const QString axisP1IdName = data->GeometricObject(axisP1Id)->name(); + const QString axisP2IdName = data->GeometricObject(axisP2Id)->name(); + const QString firstPointIdName = data->GeometricObject(firstPointId)->name(); + const QString secondPointIdName = data->GeometricObject(secondPointId)->name(); + return QString(tr("Triangle: axis %1_%2, points %3 and %4")).arg(axisP1IdName, axisP2IdName, + firstPointIdName, secondPointIdName); + } + case Tool::PointOfIntersection: + { + const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); + const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); + const QString firstPointIdName = data->GeometricObject(firstPointId)->name(); + const QString secondPointIdName = data->GeometricObject(secondPointId)->name(); + const QString toolIdName = data->GeometricObject(tool.getId())->name(); + return QString(tr("%1 - point of intersection %2 and %3")).arg(toolIdName, firstPointIdName, + secondPointIdName); + } + case Tool::CutArcTool: + { + const quint32 arcId = doc->GetParametrUInt(domElement, VToolCutArc::AttrArc, "0"); + const VArc *arc = data->GeometricObject(arcId); + Q_CHECK_PTR(arc); + const QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name(); + const QString toolIdName = data->GeometricObject(tool.getId())->name(); + return QString(tr("%1 - cut arc with center %2")).arg(toolIdName, arcCenterName); + } + case Tool::CutSplineTool: + { + const quint32 splineId = doc->GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0"); + const VSpline *spl = data->GeometricObject(splineId); + Q_CHECK_PTR(spl); + const QString toolIdName = data->GeometricObject(tool.getId())->name(); + const QString splP1Name = data->GeometricObject(spl->GetP1().id())->name(); + const QString splP4Name = data->GeometricObject(spl->GetP4().id())->name(); + return QString(tr("%1 - cut curve %2_%3")).arg(toolIdName, splP1Name, splP4Name); + } + case Tool::CutSplinePathTool: + { + const quint32 splinePathId = doc->GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0"); + const VSplinePath *splPath = data->GeometricObject(splinePathId); + Q_CHECK_PTR(splPath); + const QVector points = splPath->GetSplinePath(); + QString record; + if (points.size() != 0 ) + { + const QString toolIdName = data->GeometricObject(tool.getId())->name(); + const QString pName = data->GeometricObject(points.at(0).P().id())->name(); + record = QString(tr("%1 - cut curve path %2")).arg(toolIdName, pName); + if (points.size() > 1) + { + const QString pName = data->GeometricObject(points.last().P().id())->name(); + const QString name = QString("_%1").arg(pName); + record.append(name); + } + } + else + { + qWarning()<<"Not enough points in splinepath"<setWindowFlags(Qt::Window); - connect(dialogHistory, &DialogHistory::DialogClosed, this, - &MainWindow::ClosedActionHistory); + connect(dialogHistory, &DialogHistory::DialogClosed, this, &MainWindow::ClosedActionHistory); dialogHistory->show(); } else From 978858be5069d1b98cfc845c2da7057da7eed829 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 3 Mar 2014 17:30:04 +0200 Subject: [PATCH 22/60] Refactoring main windows. --HG-- branch : feature --- src/mainwindow.cpp | 109 +++++++++++++++++-------------------------- src/mainwindow.h | 1 + src/xml/vpattern.cpp | 8 +++- 3 files changed, 52 insertions(+), 66 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index cc00ee9ab..99be787f5 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -115,41 +115,14 @@ MainWindow::MainWindow(QWidget *parent) void MainWindow::ActionNewDraw() { - QString nameDraw; - bool bOk; - qint32 index; - QString nDraw = QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1); - QInputDialog *dlg = new QInputDialog(this); - dlg->setInputMode( QInputDialog::TextInput ); - dlg->setLabelText(tr("Pattern piece:")); - dlg->setTextEchoMode(QLineEdit::Normal); - dlg->setWindowTitle(tr("Enter a label for the pattern piece.")); - dlg->resize(300, 100); - dlg->setTextValue(nDraw); - while (1) + const QString nameDraw = PatternPieceName(QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1)); + if (nameDraw.isEmpty()) { - bOk = dlg->exec(); - nameDraw = dlg->textValue(); - if (bOk == false || nameDraw.isEmpty()) - { - delete dlg; - return; - } - index = comboBoxDraws->findText(nameDraw); - if (index != -1) - {//we already have this name - qCritical()<appendDraw(nameDraw); - if (bOk == false) + if (doc->appendDraw(nameDraw) == false) { - qCritical()<(&QComboBox::currentIndexChanged), @@ -158,18 +131,21 @@ void MainWindow::ActionNewDraw() pattern->ClearGObjects(); //Create single point - quint32 id = pattern->AddGObject(new VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5, 10)); + const quint32 id = pattern->AddGObject(new VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5, + 10)); VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Tool::FromGui); + Q_CHECK_PTR(spoint); sceneDraw->addItem(spoint); connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem); connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); QHash* tools = doc->getTools(); + Q_CHECK_PTR(tools); tools->insert(id, spoint); VDrawTool::AddRecord(id, Tool::SinglePointTool, doc); SetEnableTool(true); SetEnableWidgets(true); - index = comboBoxDraws->findText(nameDraw); + const qint32 index = comboBoxDraws->findText(nameDraw); if ( index != -1 ) { // -1 for not found comboBoxDraws->setCurrentIndex(index); @@ -181,46 +157,20 @@ void MainWindow::ActionNewDraw() void MainWindow::OptionDraw() { - QString nameDraw; - qint32 index; - QString nDraw = doc->GetNameActivDraw(); - QInputDialog *dlg = new QInputDialog(this); - dlg->setInputMode( QInputDialog::TextInput ); - dlg->setLabelText(tr("Pattern piece:")); - dlg->setTextEchoMode(QLineEdit::Normal); - dlg->setWindowTitle(tr("Enter a new label for the pattern piece.")); - dlg->resize(300, 100); - dlg->setTextValue(nDraw); - while (1) + const QString activDraw = doc->GetNameActivDraw(); + const QString nameDraw = PatternPieceName(activDraw); + if (nameDraw.isEmpty()) { - bool bOk = dlg->exec(); - nameDraw = dlg->textValue(); - if (bOk == false || nameDraw.isEmpty()) - { - delete dlg; - return; - } - index = comboBoxDraws->findText(nameDraw); - if (index != -1) - {//we already have this name - qCritical()<findText(doc->GetNameActivDraw()); if (doc->SetNameDraw(nameDraw)) { - comboBoxDraws->setItemText(index, nameDraw); + comboBoxDraws->setItemText(comboBoxDraws->findText(activDraw), nameDraw); } else { QMessageBox::warning(this, tr("Error saving change!!!"), tr("Can't save new label of pattern piece")); } - } template @@ -1362,6 +1312,35 @@ void MainWindow::InitAutoSave() } } +QString MainWindow::PatternPieceName(const QString &text) +{ + QInputDialog *dlg = new QInputDialog(this); + Q_CHECK_PTR(dlg); + dlg->setInputMode( QInputDialog::TextInput ); + dlg->setLabelText(tr("Pattern piece:")); + dlg->setTextEchoMode(QLineEdit::Normal); + dlg->setWindowTitle(tr("Enter a new label for the pattern piece.")); + dlg->resize(300, 100); + dlg->setTextValue(text); + QString nameDraw; + while (1) + { + const bool bOk = dlg->exec(); + nameDraw = dlg->textValue(); + if (bOk == false || nameDraw.isEmpty()) + { + delete dlg; + return QString(); + } + if (comboBoxDraws->findText(nameDraw) == -1) + { + break; + } + } + delete dlg; + return nameDraw; +} + MainWindow::~MainWindow() { CancelTool(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 9cc622812..8d83bbd99 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -561,6 +561,7 @@ private: void CreateMenus(); void CreateActions(); void InitAutoSave(); + QString PatternPieceName(const QString &text); }; #endif // MAINWINDOW_H diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index 82f53e3af..633734c8c 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -188,7 +188,7 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene if (domElement.isNull() == false) { QStringList tags; - tags << TagDraw << TagIncrements; + tags << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes; switch (tags.indexOf(domElement.tagName())) { case 0: // TagDraw @@ -213,6 +213,12 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene case 1: // TagIncrements ParseIncrementsElement(domElement); break; + case 2: // TagAuthor + break; + case 3: // TagDescription + break; + case 4: // TagNotes + break; default: qWarning()<<"Wrong tag name"< Date: Mon, 3 Mar 2014 17:42:14 +0200 Subject: [PATCH 23/60] Refactoring catching exceptions. --HG-- branch : feature --- src/widgets/vapplication.cpp | 58 +++++------------------------------- 1 file changed, 7 insertions(+), 51 deletions(-) diff --git a/src/widgets/vapplication.cpp b/src/widgets/vapplication.cpp index 0a4d7eaca..16664f94a 100644 --- a/src/widgets/vapplication.cpp +++ b/src/widgets/vapplication.cpp @@ -45,77 +45,33 @@ bool VApplication::notify(QObject *receiver, QEvent *event) } catch (const VExceptionObjectError &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error parsing file. Program will be terminated.")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setDetailedText(e.DetailedInformation()); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Error parsing file. Program will be terminated.")); abort(); } catch (const VExceptionBadId &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error bad id. Program will be terminated.")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Error bad id. Program will be terminated.")); abort(); } catch (const VExceptionConversionError &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error can't convert value. Program will be terminated.")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Error can't convert value. Program will be terminated.")); abort(); } catch (const VExceptionEmptyParameter &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error empty parameter. Program will be terminated.")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setDetailedText(e.DetailedInformation()); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Error empty parameter. Program will be terminated.")); abort(); } catch (const VExceptionWrongParameterId &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Error wrong id. Program will be terminated.")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setDetailedText(e.DetailedInformation()); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Error wrong id. Program will be terminated.")); abort(); } catch (const VException &e) { - QMessageBox msgBox; - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Something's wrong!!")); - msgBox.setInformativeText(e.ErrorMessage()); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - msgBox.setIcon(QMessageBox::Critical); - msgBox.exec(); + e.CriticalMessageBox(tr("Something's wrong!!")); + return true; } catch (std::exception& e) { From b15bb4fd334205454f63070a44c4d22113e335b8 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 3 Mar 2014 19:32:38 +0200 Subject: [PATCH 24/60] Left only one exception. --HG-- branch : feature --- src/exception/exception.pri | 10 +- ...tionuniqueid.cpp => vexceptionwrongid.cpp} | 17 ++- ...xceptionuniqueid.h => vexceptionwrongid.h} | 30 ++--- src/exception/vexceptionwrongparameterid.cpp | 58 ---------- src/exception/vexceptionwrongparameterid.h | 109 ------------------ src/mainwindow.cpp | 14 +-- src/widgets/vapplication.cpp | 4 +- src/xml/vpattern.cpp | 7 +- 8 files changed, 35 insertions(+), 214 deletions(-) rename src/exception/{vexceptionuniqueid.cpp => vexceptionwrongid.cpp} (80%) rename src/exception/{vexceptionuniqueid.h => vexceptionwrongid.h} (76%) delete mode 100644 src/exception/vexceptionwrongparameterid.cpp delete mode 100644 src/exception/vexceptionwrongparameterid.h diff --git a/src/exception/exception.pri b/src/exception/exception.pri index 3e0166be0..a743115fc 100644 --- a/src/exception/exception.pri +++ b/src/exception/exception.pri @@ -1,17 +1,15 @@ HEADERS += \ - src/exception/vexceptionwrongparameterid.h \ - src/exception/vexceptionuniqueid.h \ src/exception/vexceptionobjecterror.h \ src/exception/vexceptionemptyparameter.h \ src/exception/vexceptionconversionerror.h \ src/exception/vexceptionbadid.h \ - src/exception/vexception.h + src/exception/vexception.h \ + src/exception/vexceptionwrongid.h SOURCES += \ - src/exception/vexceptionwrongparameterid.cpp \ - src/exception/vexceptionuniqueid.cpp \ src/exception/vexceptionobjecterror.cpp \ src/exception/vexceptionemptyparameter.cpp \ src/exception/vexceptionconversionerror.cpp \ src/exception/vexceptionbadid.cpp \ - src/exception/vexception.cpp + src/exception/vexception.cpp \ + src/exception/vexceptionwrongid.cpp diff --git a/src/exception/vexceptionuniqueid.cpp b/src/exception/vexceptionwrongid.cpp similarity index 80% rename from src/exception/vexceptionuniqueid.cpp rename to src/exception/vexceptionwrongid.cpp index 6578290ca..ac78b1d99 100644 --- a/src/exception/vexceptionuniqueid.cpp +++ b/src/exception/vexceptionwrongid.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vexceptionuniqueid.cpp + ** @file vexceptionwrongparameterid.cpp ** @author Roman Telezhinsky ** @date November 15, 2013 ** @@ -26,11 +26,10 @@ ** *************************************************************************/ -#include "vexceptionuniqueid.h" +#include "vexceptionwrongid.h" +#include -#include - -VExceptionUniqueId::VExceptionUniqueId(const QString &what, const QDomElement &domElement) +VExceptionWrongId::VExceptionWrongId(const QString &what, const QDomElement &domElement) :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1) { Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); @@ -40,19 +39,19 @@ VExceptionUniqueId::VExceptionUniqueId(const QString &what, const QDomElement &d lineNumber = domElement.lineNumber(); } -VExceptionUniqueId::VExceptionUniqueId(const VExceptionUniqueId &e) +VExceptionWrongId::VExceptionWrongId(const VExceptionWrongId &e) :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()) { } -QString VExceptionUniqueId::ErrorMessage() const +QString VExceptionWrongId::ErrorMessage() const { - QString error = QString("ExceptionUniqueId: %1").arg(what); + QString error = QString("ExceptionWrongId: %1").arg(what); return error; } -QString VExceptionUniqueId::DetailedInformation() const +QString VExceptionWrongId::DetailedInformation() const { QString detail = QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText); return detail; diff --git a/src/exception/vexceptionuniqueid.h b/src/exception/vexceptionwrongid.h similarity index 76% rename from src/exception/vexceptionuniqueid.h rename to src/exception/vexceptionwrongid.h index 8125c2966..22be31c60 100644 --- a/src/exception/vexceptionuniqueid.h +++ b/src/exception/vexceptionwrongid.h @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vexceptionuniqueid.h + ** @file vexceptionwrongparameterid.h ** @author Roman Telezhinsky ** @date November 15, 2013 ** @@ -26,31 +26,31 @@ ** *************************************************************************/ -#ifndef VEXCEPTIONUNIQUEID_H -#define VEXCEPTIONUNIQUEID_H +#ifndef VEXCEPTIONWRONGID_H +#define VEXCEPTIONWRONGID_H #include "vexception.h" #include /** - * @brief The VExceptionUniqueId class for exception unique id + * @brief The VExceptionWrongId class for exception wrong id */ -class VExceptionUniqueId : public VException +class VExceptionWrongId : public VException { public: /** - * @brief VExceptionUniqueId exception unique id + * @brief VExceptionWrongId exception wrong parameter id * @param what string with error - * @param domElement dom element + * @param domElement som element */ - VExceptionUniqueId(const QString &what, const QDomElement &domElement); + VExceptionWrongId(const QString &what, const QDomElement &domElement); /** - * @brief VExceptionUniqueId copy constructor + * @brief VExceptionWrongId copy constructor * @param e exception */ - VExceptionUniqueId(const VExceptionUniqueId &e); - virtual ~VExceptionUniqueId() noexcept (true){} + VExceptionWrongId(const VExceptionWrongId &e); + virtual ~VExceptionWrongId() noexcept (true){} /** * @brief ErrorMessage return main error message * @return main error message @@ -91,19 +91,19 @@ protected: qint32 lineNumber; }; -inline QString VExceptionUniqueId::TagText() const +inline QString VExceptionWrongId::TagText() const { return tagText; } -inline QString VExceptionUniqueId::TagName() const +inline QString VExceptionWrongId::TagName() const { return tagName; } -inline qint32 VExceptionUniqueId::LineNumber() const +inline qint32 VExceptionWrongId::LineNumber() const { return lineNumber; } -#endif // VEXCEPTIONUNIQUEID_H +#endif // VEXCEPTIONWRONGID_H diff --git a/src/exception/vexceptionwrongparameterid.cpp b/src/exception/vexceptionwrongparameterid.cpp deleted file mode 100644 index 0e99ee018..000000000 --- a/src/exception/vexceptionwrongparameterid.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************************ - ** - ** @file vexceptionwrongparameterid.cpp - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 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 "vexceptionwrongparameterid.h" -#include - -VExceptionWrongParameterId::VExceptionWrongParameterId(const QString &what, const QDomElement &domElement) - :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1) -{ - Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - QTextStream stream(&tagText); - domElement.save(stream, 4); - tagName = domElement.tagName(); - lineNumber = domElement.lineNumber(); -} - -VExceptionWrongParameterId::VExceptionWrongParameterId(const VExceptionWrongParameterId &e) - :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()) -{ - -} - -QString VExceptionWrongParameterId::ErrorMessage() const -{ - QString error = QString("ExceptionWrongParameterId: %1").arg(what); - return error; -} - -QString VExceptionWrongParameterId::DetailedInformation() const -{ - QString detail = QString("tag: %1 in line %2\n%3").arg(tagName).arg(lineNumber).arg(tagText); - return detail; -} diff --git a/src/exception/vexceptionwrongparameterid.h b/src/exception/vexceptionwrongparameterid.h deleted file mode 100644 index 55879c986..000000000 --- a/src/exception/vexceptionwrongparameterid.h +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************ - ** - ** @file vexceptionwrongparameterid.h - ** @author Roman Telezhinsky - ** @date November 15, 2013 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013 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 VEXCEPTIONWRONGPARAMETERID_H -#define VEXCEPTIONWRONGPARAMETERID_H - -#include "vexception.h" - -#include - -/** - * @brief The VExceptionWrongParameterId class for exception wrong parameter id - */ -class VExceptionWrongParameterId : public VException -{ -public: - /** - * @brief VExceptionWrongParameterId exception wrong parameter id - * @param what string with error - * @param domElement som element - */ - VExceptionWrongParameterId(const QString &what, const QDomElement &domElement); - /** - * @brief VExceptionWrongParameterId copy constructor - * @param e exception - */ - VExceptionWrongParameterId(const VExceptionWrongParameterId &e); - virtual ~VExceptionWrongParameterId() noexcept (true){} - /** - * @brief ErrorMessage return main error message - * @return main error message - */ - virtual QString ErrorMessage() const; - /** - * @brief DetailedInformation return detailed information about error - * @return detailed information - */ - virtual QString DetailedInformation() const; - /** - * @brief TagText return tag text - * @return tag text - */ - QString TagText() const; - /** - * @brief TagName return tag name - * @return tag name - */ - QString TagName() const; - /** - * @brief LineNumber return line number in file - * @return line number - */ - qint32 LineNumber() const; -protected: - /** - * @brief tagText tag text - */ - QString tagText; - /** - * @brief tagName tag name - */ - QString tagName; - /** - * @brief lineNumber line number - */ - qint32 lineNumber; -}; - -inline QString VExceptionWrongParameterId::TagText() const -{ - return tagText; -} - -inline QString VExceptionWrongParameterId::TagName() const -{ - return tagName; -} - -inline qint32 VExceptionWrongParameterId::LineNumber() const -{ - return lineNumber; -} - -#endif // VEXCEPTIONWRONGPARAMETERID_H diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 99be787f5..315ef1196 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -33,8 +33,7 @@ #include "exception/vexceptionobjecterror.h" #include "exception/vexceptionconversionerror.h" #include "exception/vexceptionemptyparameter.h" -#include "exception/vexceptionwrongparameterid.h" -#include "exception/vexceptionuniqueid.h" +#include "exception/vexceptionwrongid.h" #include "version.h" #include @@ -1074,7 +1073,7 @@ bool MainWindow::SavePattern(const QString &fileName) { doc->TestUniqueId(); } - catch (const VExceptionUniqueId &e) + catch (const VExceptionWrongId &e) { e.CriticalMessageBox(tr("Error no unique id."), this); return false; @@ -1400,20 +1399,13 @@ void MainWindow::LoadPattern(const QString &fileName) Clear(); return; } - catch (const VExceptionWrongParameterId &e) + catch (const VExceptionWrongId &e) { e.CriticalMessageBox(tr("Error wrong id."), this); file.close(); Clear(); return; } - catch (const VExceptionUniqueId &e) - { - e.CriticalMessageBox(tr("Error no unique id."), this); - file.close(); - Clear(); - return; - } connect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), this, &MainWindow::currentDrawChanged); QString nameDraw = doc->GetNameActivDraw(); diff --git a/src/widgets/vapplication.cpp b/src/widgets/vapplication.cpp index 16664f94a..6686f8faf 100644 --- a/src/widgets/vapplication.cpp +++ b/src/widgets/vapplication.cpp @@ -31,7 +31,7 @@ #include "../exception/vexceptionbadid.h" #include "../exception/vexceptionconversionerror.h" #include "../exception/vexceptionemptyparameter.h" -#include "../exception/vexceptionwrongparameterid.h" +#include "../exception/vexceptionwrongid.h" #include #include @@ -63,7 +63,7 @@ bool VApplication::notify(QObject *receiver, QEvent *event) e.CriticalMessageBox(tr("Error empty parameter. Program will be terminated.")); abort(); } - catch (const VExceptionWrongParameterId &e) + catch (const VExceptionWrongId &e) { e.CriticalMessageBox(tr("Error wrong id. Program will be terminated.")); abort(); diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index 633734c8c..3c265a8e5 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -33,8 +33,7 @@ #include "../tools/drawTools/drawtools.h" #include "../tools/nodeDetails/nodedetails.h" #include "../exception/vexceptionobjecterror.h" -#include "../exception/vexceptionwrongparameterid.h" -#include "../exception/vexceptionuniqueid.h" +#include "../exception/vexceptionwrongid.h" #include @@ -1254,7 +1253,7 @@ quint32 VPattern::GetParametrId(const QDomElement &domElement) const const quint32 id = GetParametrUInt(domElement, VAbstractTool::AttrId, "0"); if (id <= 0) { - throw VExceptionWrongParameterId(tr("Got wrong parameter id. Need only id > 0."), domElement); + throw VExceptionWrongId(tr("Got wrong parameter id. Need only id > 0."), domElement); } return id; } @@ -1266,7 +1265,7 @@ void VPattern::CollectId(const QDomElement &node, QVector &vector) cons const quint32 id = GetParametrId(node); if (vector.contains(id)) { - throw VExceptionUniqueId(tr("This id is not unique."), node); + throw VExceptionWrongId(tr("This id is not unique."), node); } vector.append(id); } From b90fc0c1a608b76fc641888d23623eabdd05e67e Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 3 Mar 2014 20:14:56 +0200 Subject: [PATCH 25/60] Refactoring. --HG-- branch : feature --- src/geometry/vspline.cpp | 88 +++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 50 deletions(-) diff --git a/src/geometry/vspline.cpp b/src/geometry/vspline.cpp index 3a7e76ca4..5f3476d3d 100644 --- a/src/geometry/vspline.cpp +++ b/src/geometry/vspline.cpp @@ -282,36 +282,36 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, // Calculate all the mid-points of the line segments //---------------------- - double x12 = (x1 + x2) / 2; - double y12 = (y1 + y2) / 2; - double x23 = (x2 + x3) / 2; - double y23 = (y2 + y3) / 2; - double x34 = (x3 + x4) / 2; - double y34 = (y3 + y4) / 2; - double x123 = (x12 + x23) / 2; - double y123 = (y12 + y23) / 2; - double x234 = (x23 + x34) / 2; - double y234 = (y23 + y34) / 2; - double x1234 = (x123 + x234) / 2; - double y1234 = (y123 + y234) / 2; + const double x12 = (x1 + x2) / 2; + const double y12 = (y1 + y2) / 2; + const double x23 = (x2 + x3) / 2; + const double y23 = (y2 + y3) / 2; + const double x34 = (x3 + x4) / 2; + const double y34 = (y3 + y4) / 2; + const double x123 = (x12 + x23) / 2; + const double y123 = (y12 + y23) / 2; + const double x234 = (x23 + x34) / 2; + const double y234 = (y23 + y34) / 2; + const double x1234 = (x123 + x234) / 2; + const double y1234 = (y123 + y234) / 2; // Try to approximate the full cubic curve by a single straight line //------------------ - double dx = x4-x1; - double dy = y4-y1; + const double dx = x4-x1; + const double dy = y4-y1; double d2 = fabs((x2 - x4) * dy - (y2 - y4) * dx); double d3 = fabs((x3 - x4) * dy - (y3 - y4) * dx); - double da1, da2, k; switch ((static_cast(d2 > curve_collinearity_epsilon) << 1) + static_cast(d3 > curve_collinearity_epsilon)) { case 0: + { // All collinear OR p1==p4 //---------------------- - k = dx*dx + dy*dy; + double k = dx*dx + dy*dy; if (k < 0.000000001) { d2 = CalcSqDistance(x1, y1, x2, y2); @@ -320,12 +320,16 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, else { k = 1 / k; - da1 = x2 - x1; - da2 = y2 - y1; - d2 = k * (da1*dx + da2*dy); - da1 = x3 - x1; - da2 = y3 - y1; - d3 = k * (da1*dx + da2*dy); + { + const double da1 = x2 - x1; + const double da2 = y2 - y1; + d2 = k * (da1*dx + da2*dy); + } + { + const double da1 = x3 - x1; + const double da2 = y3 - y1; + d3 = k * (da1*dx + da2*dy); + } // cppcheck-suppress incorrectLogicOperator if (d2 > 0 && d2 < 1 && d3 > 0 && d3 < 1) { @@ -363,10 +367,8 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, { if (d2 < m_distance_tolerance_square) { - px.append(x2); py.append(y2); - //m_points.add(point_d(x2, y2)); return; } } @@ -374,31 +376,29 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, { if (d3 < m_distance_tolerance_square) { - px.append(x3); py.append(y3); - //m_points.add(point_d(x3, y3)); return; } } break; + } case 1: + { // p1,p2,p4 are collinear, p3 is significant //---------------------- if (d3 * d3 <= m_distance_tolerance_square * (dx*dx + dy*dy)) { if (m_angle_tolerance < curve_angle_tolerance_epsilon) { - px.append(x23); py.append(y23); - //m_points.add(point_d(x23, y23)); return; } // Angle Condition //---------------------- - da1 = fabs(atan2(y4 - y3, x4 - x3) - atan2(y3 - y2, x3 - x2)); + double da1 = fabs(atan2(y4 - y3, x4 - x3) - atan2(y3 - y2, x3 - x2)); if (da1 >= M_PI) { da1 = 2*M_PI - da1; @@ -406,14 +406,11 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, if (da1 < m_angle_tolerance) { - px.append(x2); py.append(y2); px.append(x3); py.append(y3); - //m_points.add(point_d(x2, y2)); - //m_points.add(point_d(x3, y3)); return; } @@ -421,33 +418,30 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, { if (da1 > m_cusp_limit) { - px.append(x3); py.append(y3); - //m_points.add(point_d(x3, y3)); return; } } } break; - + } case 2: + { // p1,p3,p4 are collinear, p2 is significant //---------------------- if (d2 * d2 <= m_distance_tolerance_square * (dx*dx + dy*dy)) { if (m_angle_tolerance < curve_angle_tolerance_epsilon) { - px.append(x23); py.append(y23); - //m_points.add(point_d(x23, y23)); return; } // Angle Condition //---------------------- - da1 = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1)); + double da1 = fabs(atan2(y3 - y2, x3 - x2) - atan2(y2 - y1, x2 - x1)); if (da1 >= M_PI) { da1 = 2*M_PI - da1; @@ -455,14 +449,11 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, if (da1 < m_angle_tolerance) { - px.append(x2); py.append(y2); px.append(x3); py.append(y3); - //m_points.add(point_d(x2, y2)); - //m_points.add(point_d(x3, y3)); return; } @@ -472,15 +463,14 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, { px.append(x2); py.append(y2); - - //m_points.add(point_d(x2, y2)); return; } } } break; - + } case 3: + { // Regular case //----------------- if ((d2 + d3)*(d2 + d3) <= m_distance_tolerance_square * (dx*dx + dy*dy)) @@ -490,18 +480,16 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, //---------------------- if (m_angle_tolerance < curve_angle_tolerance_epsilon) { - px.append(x23); py.append(y23); - //m_points.add(point_d(x23, y23)); return; } // Angle & Cusp Condition //---------------------- - k = atan2(y3 - y2, x3 - x2); - da1 = fabs(k - atan2(y2 - y1, x2 - x1)); - da2 = fabs(atan2(y4 - y3, x4 - x3) - k); + const double k = atan2(y3 - y2, x3 - x2); + double da1 = fabs(k - atan2(y2 - y1, x2 - x1)); + double da2 = fabs(atan2(y4 - y3, x4 - x3) - k); if (da1 >= M_PI) { da1 = 2*M_PI - da1; @@ -518,7 +506,6 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, px.append(x23); py.append(y23); - //m_points.add(point_d(x23, y23)); return; } @@ -540,6 +527,7 @@ void VSpline::PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, } } break; + } default: break; } From 96c19190a0dfeb3b553d4d67ba9abfa5333e3f00 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 4 Mar 2014 14:55:57 +0200 Subject: [PATCH 26/60] Refactoring. --HG-- branch : feature --- src/tools/drawTools/vtoolsplinepath.cpp | 81 +++++-------- src/tools/drawTools/vtoolsplinepath.h | 1 + src/tools/vtooluniondetails.cpp | 154 ++++++++++-------------- src/tools/vtooluniondetails.h | 1 + 4 files changed, 99 insertions(+), 138 deletions(-) diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index 5dbef60a4..6f879da06 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -171,6 +171,30 @@ void VToolSplinePath::CorectControlPoints(const VSpline &spl, VSplinePath &splPa splPath.UpdatePoint(indexSpline, SplinePoint::LastPoint, p); } +void VToolSplinePath::RefreshSplinePath(VSplinePath &splPath) +{ + for (qint32 i = 1; i<=splPath.Count(); ++i) + { + VSpline spl = splPath.GetSpline(i); + qint32 j = i*2; + disconnect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, + &VToolSplinePath::ControlPointChangePosition); + disconnect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, + &VToolSplinePath::ControlPointChangePosition); + controlPoints[j-2]->setPos(spl.GetP2()); + controlPoints[j-1]->setPos(spl.GetP3()); + connect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, + &VToolSplinePath::ControlPointChangePosition); + connect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, + &VToolSplinePath::ControlPointChangePosition); + + spl = VSpline (spl.GetP1(), controlPoints[j-2]->pos(), controlPoints[j-1]->pos(), spl.GetP4(), + splPath.getKCurve()); + CorectControlPoints(spl, splPath, i); + CorectControlPoints(spl, splPath, i); + } +} + void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path) { QDomNodeList nodeList = node.childNodes(); @@ -244,35 +268,16 @@ void VToolSplinePath::AddToFile() void VToolSplinePath::RefreshDataInFile() { - VSplinePath splPath = *VAbstractTool::data.GeometricObject(id); - for (qint32 i = 1; i<=splPath.Count(); ++i) + QDomElement domElement = doc->elementById(QString().setNum(id)); + if (domElement.isElement() == false) { - VSpline spl = splPath.GetSpline(i); - qint32 j = i*2; - disconnect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, - &VToolSplinePath::ControlPointChangePosition); - disconnect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, - &VToolSplinePath::ControlPointChangePosition); - controlPoints[j-2]->setPos(spl.GetP2()); - controlPoints[j-1]->setPos(spl.GetP3()); - connect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, - &VToolSplinePath::ControlPointChangePosition); - connect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, - &VToolSplinePath::ControlPointChangePosition); - - spl = VSpline (spl.GetP1(), controlPoints[j-2]->pos(), controlPoints[j-1]->pos(), spl.GetP4(), - splPath.getKCurve()); - CorectControlPoints(spl, splPath, i); - CorectControlPoints(spl, splPath, i); - - QDomElement domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); - UpdatePathPoint(domElement, splPath); - } - + qWarning()<<"Can't find element with id="<(id); + RefreshSplinePath(splPath); + doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); + UpdatePathPoint(domElement, splPath); } void VToolSplinePath::AddPathPoint(QDomElement &domElement, const VSplinePoint &splPoint) @@ -355,27 +360,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement) Q_CHECK_PTR(dialogTool); VSplinePath splPath = dialogTool->GetPath(); - for (qint32 i = 1; i<=splPath.Count(); ++i) - { - VSpline spl = splPath.GetSpline(i); - qint32 j = i*2; - disconnect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, - &VToolSplinePath::ControlPointChangePosition); - disconnect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, - &VToolSplinePath::ControlPointChangePosition); - controlPoints[j-2]->setPos(spl.GetP2()); - controlPoints[j-1]->setPos(spl.GetP3()); - connect(controlPoints[j-2], &VControlPointSpline::ControlPointChangePosition, this, - &VToolSplinePath::ControlPointChangePosition); - connect(controlPoints[j-1], &VControlPointSpline::ControlPointChangePosition, this, - &VToolSplinePath::ControlPointChangePosition); - - spl = VSpline (spl.GetP1(), controlPoints[j-2]->pos(), controlPoints[j-1]->pos(), spl.GetP4(), - splPath.getKCurve()); - CorectControlPoints(spl, splPath, i); - CorectControlPoints(spl, splPath, i); - } - + RefreshSplinePath(splPath); doc->SetAttribute(domElement, AttrKCurve, QString().setNum(splPath.getKCurve())); UpdatePathPoint(domElement, splPath); } diff --git a/src/tools/drawTools/vtoolsplinepath.h b/src/tools/drawTools/vtoolsplinepath.h index 286585b00..a573a76e2 100644 --- a/src/tools/drawTools/vtoolsplinepath.h +++ b/src/tools/drawTools/vtoolsplinepath.h @@ -199,6 +199,7 @@ private: * @param indexSpline index spline in spline path. */ void CorectControlPoints(const VSpline &spl, VSplinePath &splPath, const qint32 &indexSpline); + void RefreshSplinePath(VSplinePath &splPath); }; #endif // VTOOLSPLINEPATH_H diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index 092e08f85..5fbb34d7d 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -450,49 +450,41 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta } } + VNodeDetail det1p1; + VNodeDetail det1p2; + d1.NodeOnEdge(indexD1, det1p1, det1p2); + Q_UNUSED(det1p2); + + VPointF point1; + VPointF point2; + PointsOnEdge(d1, indexD1, point1, point2, data); + + VPointF point3; + VPointF point4; + PointsOnEdge(d2, indexD2, point3, point4, data); + + const qreal dx = point1.x() - point4.x(); + const qreal dy = point1.y() - point4.y(); + + point3.setX(point3.x()+dx); + point3.setY(point3.y()+dy); + + point4.setX(point4.x()+dx); + point4.setY(point4.y()+dy); + + const qreal angle = QLineF(point4.toQPointF(), point3.toQPointF()).angleTo(QLineF(point1.toQPointF(), + point2.toQPointF())); + qint32 pointsD2 = 0; //Keeps count points second detail, what we already add. if (typeCreation == Tool::FromGui) - { - VDetail uD1 = d1.RemoveEdge(indexD1); - VDetail uD2 = d2.RemoveEdge(indexD2); + { qint32 j = 0, i = 0; - qint32 nD1 = uD1.CountNode(); - qint32 nD2 = uD2.CountNode(); - qint32 pointsD2 = 0; //Keeps count points second detail, what we already add. VDetail newDetail; - - VNodeDetail det1p1; - VNodeDetail det1p2; - d1.NodeOnEdge(indexD1, det1p1, det1p2); - const VPointF *point1 = data->GeometricObject(det1p1.getId()); - const VPointF *point2 = data->GeometricObject(det1p2.getId()); - - VNodeDetail det2p1; - VNodeDetail det2p2; - d2.NodeOnEdge(indexD2, det2p1, det2p2); - VPointF point3 = VPointF(*data->GeometricObject(det2p1.getId())); - VPointF point4 = VPointF(*data->GeometricObject(det2p2.getId())); - - qreal dx = point1->x() - point4.x(); - qreal dy = point1->y() - point4.y(); - - point3.setX(point3.x()+dx); - point3.setY(point3.y()+dy); - - point4.setX(point4.x()+dx); - point4.setY(point4.y()+dy); - - QLineF l1(point1->toQPointF(), point2->toQPointF()); - QLineF l2(point4.toQPointF(), point3.toQPointF()); - qreal angle = l2.angleTo(l1); - - ptrdiff_t iD1 = d1.indexOfNode(det1p1.getId()); - do { - AddToNewDetail(unionDetails, doc, data, newDetail, uD1, i, id); + AddToNewDetail(unionDetails, doc, data, newDetail, d1.RemoveEdge(indexD1), i, id); ++i; - if (i > iD1 && pointsD2 < nD2-2) + if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < d2.RemoveEdge(indexD2).CountNode()-2) { do { @@ -501,83 +493,56 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta VNodeDetail node1; VNodeDetail node2; d2.NodeOnEdge(indexD2, node1, node2); - ptrdiff_t k = uD2.indexOfNode(node2.getId()); - if (k == uD2.CountNode()-1) + ptrdiff_t k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId()); + if (k == d2.RemoveEdge(indexD2).CountNode()-1) { j = 0; } else { - j = uD2.indexOfNode(node2.getId())+1; + j = d2.RemoveEdge(indexD2).indexOfNode(node2.getId())+1; } } - if (pointsD2 == nD2 -2) + if (pointsD2 == d2.RemoveEdge(indexD2).CountNode() -2) { break; } - if (j >= nD2) + if (j >= d2.RemoveEdge(indexD2).CountNode()) { j=0; } - AddToNewDetail(unionDetails, doc, data, newDetail, uD2, j, id, dx, dy, det1p1.getId(), angle); + AddToNewDetail(unionDetails, doc, data, newDetail, d2.RemoveEdge(indexD2), j, id, dx, dy, + det1p1.getId(), angle); ++pointsD2; ++j; - } while (pointsD2 < nD2); + } while (pointsD2 < d2.RemoveEdge(indexD2).CountNode()); } - } while(i* tools = doc->getTools(); + Q_CHECK_PTR(tools); - VToolDetail *toolDet = qobject_cast(tools->value(d1id)); - toolDet->Remove(); + { + VToolDetail *toolDet = qobject_cast(tools->value(d1id)); + Q_CHECK_PTR(toolDet); + toolDet->Remove(); + } - toolDet = qobject_cast(tools->value(d2id)); + VToolDetail *toolDet = qobject_cast(tools->value(d2id)); + Q_CHECK_PTR(toolDet); toolDet->Remove(); } else { - VDetail uD1 = d1.RemoveEdge(indexD1); - VDetail uD2 = d2.RemoveEdge(indexD2); quint32 idCount = 0; qint32 j = 0, i = 0; - qint32 nD1 = uD1.CountNode(); - qint32 nD2 = uD2.CountNode(); - qint32 pointsD2 = 0; //Keeps count points second detail, what we already add. - - VNodeDetail det1p1; - VNodeDetail det1p2; - d1.NodeOnEdge(indexD1, det1p1, det1p2); - const VPointF *point1 = data->GeometricObject(det1p1.getId()); - const VPointF *point2 = data->GeometricObject(det1p2.getId()); - - VNodeDetail det2p1; - VNodeDetail det2p2; - d2.NodeOnEdge(indexD2, det2p1, det2p2); - VPointF point3 = VPointF(*data->GeometricObject(det2p1.getId())); - VPointF point4 = VPointF(*data->GeometricObject(det2p2.getId())); - - qreal dx = point1->x() - point4.x(); - qreal dy = point1->y() - point4.y(); - - point3.setX(point3.x()+dx); - point3.setY(point3.y()+dy); - - point4.setX(point4.x()+dx); - point4.setY(point4.y()+dy); - - QLineF l1(point1->toQPointF(), point2->toQPointF()); - QLineF l2(point4.toQPointF(), point3.toQPointF()); - qreal angle = l2.angleTo(l1); - - ptrdiff_t iD1 = d1.indexOfNode(det1p1.getId()); - do { - UpdatePoints(id, data, uD1, i, idCount); + UpdatePoints(id, data, d1.RemoveEdge(indexD1), i, idCount); ++i; - if (i > iD1 && pointsD2 < nD2-2) + if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < d2.RemoveEdge(indexD2).CountNode()-2) { do { @@ -586,33 +551,42 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta VNodeDetail node1; VNodeDetail node2; d2.NodeOnEdge(indexD2, node1, node2); - ptrdiff_t k = uD2.indexOfNode(node2.getId()); - if (k == uD2.CountNode()-1) + ptrdiff_t k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId()); + if (k == d2.RemoveEdge(indexD2).CountNode()-1) { j = 0; } else { - j = uD2.indexOfNode(node2.getId())+1; + j = d2.RemoveEdge(indexD2).indexOfNode(node2.getId())+1; } } - if (pointsD2 == nD2-2) + if (pointsD2 == d2.RemoveEdge(indexD2).CountNode()-2) { break; } - if (j >= nD2) + if (j >= d2.RemoveEdge(indexD2).CountNode()) { j=0; } - UpdatePoints(id, data, uD2, j, idCount, dx, dy, det1p1.getId(), angle); + UpdatePoints(id, data, d2.RemoveEdge(indexD2), j, idCount, dx, dy, det1p1.getId(), angle); ++pointsD2; ++j; - } while (pointsD2 < nD2); + } while (pointsD2 < d2.RemoveEdge(indexD2).CountNode()); } - } while (iGeometricObject(det2p1.getId())); + p2 = VPointF(*data->GeometricObject(det2p2.getId())); +} + QVector VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomElement &domElement) { QVector vector; diff --git a/src/tools/vtooluniondetails.h b/src/tools/vtooluniondetails.h index 625901f4e..ee7a2b845 100644 --- a/src/tools/vtooluniondetails.h +++ b/src/tools/vtooluniondetails.h @@ -84,6 +84,7 @@ public: const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); + static void PointsOnEdge(const VDetail &d, const qint32 &index, VPointF &p1, VPointF &p2, VContainer *data); /** * @brief GetDetailFromFile parse detail from file. * @param doc dom document container. From e30d1fe9dd3a81e82f503423e65e239ff0915b99 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 4 Mar 2014 18:50:54 +0200 Subject: [PATCH 27/60] Refactoring. --HG-- branch : feature --- src/tools/drawTools/vabstractspline.cpp | 116 ++++++++++++++++++++++++ src/tools/drawTools/vabstractspline.h | 112 +++++++++++++++++++++++ src/tools/drawTools/vtoolspline.cpp | 86 +----------------- src/tools/drawTools/vtoolspline.h | 69 +------------- src/tools/drawTools/vtoolsplinepath.cpp | 84 +---------------- src/tools/drawTools/vtoolsplinepath.h | 54 +---------- src/tools/tools.pri | 6 +- 7 files changed, 238 insertions(+), 289 deletions(-) create mode 100644 src/tools/drawTools/vabstractspline.cpp create mode 100644 src/tools/drawTools/vabstractspline.h diff --git a/src/tools/drawTools/vabstractspline.cpp b/src/tools/drawTools/vabstractspline.cpp new file mode 100644 index 000000000..c2fa77ae9 --- /dev/null +++ b/src/tools/drawTools/vabstractspline.cpp @@ -0,0 +1,116 @@ +/************************************************************************ + ** + ** @file vabstractspline.cpp + ** @author Roman Telezhinsky + ** @date 4 3, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 "vabstractspline.h" + +const QString VAbstractSpline::TagName = QStringLiteral("spline"); + +VAbstractSpline::VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent) + :VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector()) +{ + ignoreFullUpdate = true; +} + +void VAbstractSpline::FullUpdateFromFile() +{ + RefreshGeometry(); +} + +void VAbstractSpline::ChangedActivDraw(const QString &newName) +{ + bool selectable = false; + if (nameActivDraw == newName) + { + selectable = true; + currentColor = Qt::black; + } + else + { + selectable = false; + currentColor = Qt::gray; + } + this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); + this->setAcceptHoverEvents (selectable); + emit setEnabledPoint(selectable); + VDrawTool::ChangedActivDraw(newName); +} + +void VAbstractSpline::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) +{ + ShowItem(this, id, color, enable); +} + +void VAbstractSpline::SetFactor(qreal factor) +{ + VDrawTool::SetFactor(factor); + RefreshGeometry(); +} + +void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) +{ + Q_UNUSED(event); + this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor)); +} + +void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) +{ + Q_UNUSED(event); + this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); +} + +QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) +{ + if (change == QGraphicsItem::ItemSelectedChange) + { + if (value == true) + { + // do stuff if selected + this->setFocus(); + } + else + { + // do stuff if not selected + } + } + + return QGraphicsItem::itemChange(change, value); +} + +void VAbstractSpline::keyReleaseEvent(QKeyEvent *event) +{ + switch (event->key()) + { + case Qt::Key_Delete: + DeleteTool(this); + break; + default: + break; + } + QGraphicsItem::keyReleaseEvent ( event ); +} diff --git a/src/tools/drawTools/vabstractspline.h b/src/tools/drawTools/vabstractspline.h new file mode 100644 index 000000000..46261a5c3 --- /dev/null +++ b/src/tools/drawTools/vabstractspline.h @@ -0,0 +1,112 @@ +/************************************************************************ + ** + ** @file vabstractspline.h + ** @author Roman Telezhinsky + ** @date 4 3, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 VABSTRACTSPLINE_H +#define VABSTRACTSPLINE_H + +#include "vdrawtool.h" +#include +#include "../../widgets/vcontrolpointspline.h" + +class VAbstractSpline:public VDrawTool, public QGraphicsPathItem +{ + Q_OBJECT +public: + VAbstractSpline(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem * parent = nullptr); + static const QString TagName; +public slots: + /** + * @brief FullUpdateFromFile update tool data form file. + */ + virtual void FullUpdateFromFile (); +signals: + /** + * @brief RefreshLine refresh control line. + * @param indexSpline position spline in spline list. + * @param position position point in spline. + * @param controlPoint new position control point. + * @param splinePoint new position spline point. + */ + void RefreshLine(const qint32 &indexSpline, SplinePoint::Position pos, + const QPointF &controlPoint, const QPointF &splinePoint); + /** + * @brief setEnabledPoint disable control points. + * @param enable enable or diasable points. + */ + void setEnabledPoint(bool enable); +protected: + /** + * @brief controlPoints list pointers of control points. + */ + QVector controlPoints; + /** + * @brief RefreshGeometry refresh item on scene. + */ + virtual void RefreshGeometry ()=0; + /** + * @brief ChangedActivDraw disable or enable context menu after change active pattern peace. + * @param newName new name active pattern peace. + */ + virtual void ChangedActivDraw ( const QString &newName ); + /** + * @brief ShowTool highlight tool. + * @param id object id in container + * @param color highlight color. + * @param enable enable or disable highlight. + */ + virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); + /** + * @brief SetFactor set current scale factor of scene. + * @param factor scene scale factor. + */ + virtual void SetFactor(qreal factor); + /** + * @brief hoverMoveEvent handle hover move events. + * @param event hover move event. + */ + virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); + /** + * @brief hoverLeaveEvent handle hover leave events. + * @param event hover leave event. + */ + virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); + /** + * @brief itemChange hadle item change. + * @param change change. + * @param value value. + * @return value. + */ + virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); + /** + * @brief keyReleaseEvent handle key release events. + * @param event key release event. + */ + virtual void keyReleaseEvent(QKeyEvent * event); +}; + +#endif // VABSTRACTSPLINE_H diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index ba3169d45..ef942471f 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -30,15 +30,11 @@ #include "../../geometry/vspline.h" #include "../../dialogs/tools/dialogspline.h" -const QString VToolSpline::TagName = QStringLiteral("spline"); const QString VToolSpline::ToolType = QStringLiteral("simple"); VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, - QGraphicsItem *parent) - :VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector()) + QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent) { - ignoreFullUpdate = true; - const VSpline *spl = data->GeometricObject(id); QPainterPath path; path.addPath(spl->GetPath()); @@ -144,11 +140,6 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4 } } -void VToolSpline::FullUpdateFromFile() -{ - RefreshGeometry(); -} - void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position, const QPointF &pos) { @@ -224,18 +215,6 @@ void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) QGraphicsItem::mouseReleaseEvent(event); } -void VToolSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor)); -} - -void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); -} - void VToolSpline::RemoveReferens() { const VSpline *spl = VAbstractTool::data.GeometricObject(id); @@ -243,37 +222,6 @@ void VToolSpline::RemoveReferens() doc->DecrementReferens(spl->GetP4().id()); } -QVariant VToolSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) -{ - if (change == QGraphicsItem::ItemSelectedChange) - { - if (value == true) - { - // do stuff if selected - this->setFocus(); - } - else - { - // do stuff if not selected - } - } - - return QGraphicsItem::itemChange(change, value); -} - -void VToolSpline::keyReleaseEvent(QKeyEvent *event) -{ - switch (event->key()) - { - case Qt::Key_Delete: - DeleteTool(this); - break; - default: - break; - } - QGraphicsItem::keyReleaseEvent ( event ); -} - void VToolSpline::SaveDialog(QDomElement &domElement) { Q_CHECK_PTR(dialog); @@ -333,35 +281,3 @@ void VToolSpline::RefreshGeometry() connect(controlPoints[1], &VControlPointSpline::ControlPointChangePosition, this, &VToolSpline::ControlPointChangePosition); } - - -void VToolSpline::ChangedActivDraw(const QString &newName) -{ - bool selectable = false; - if (nameActivDraw == newName) - { - selectable = true; - currentColor = Qt::black; - } - else - { - selectable = false; - currentColor = Qt::gray; - } - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); - this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); - this->setAcceptHoverEvents (selectable); - emit setEnabledPoint(selectable); - VDrawTool::ChangedActivDraw(newName); -} - -void VToolSpline::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) -{ - ShowItem(this, id, color, enable); -} - -void VToolSpline::SetFactor(qreal factor) -{ - VDrawTool::SetFactor(factor); - RefreshGeometry(); -} diff --git a/src/tools/drawTools/vtoolspline.h b/src/tools/drawTools/vtoolspline.h index dd675d78c..ead416779 100644 --- a/src/tools/drawTools/vtoolspline.h +++ b/src/tools/drawTools/vtoolspline.h @@ -29,15 +29,13 @@ #ifndef VTOOLSPLINE_H #define VTOOLSPLINE_H -#include "vdrawtool.h" -#include -#include "../../widgets/vcontrolpointspline.h" +#include "vabstractspline.h" #include "../../geometry/vsplinepath.h" /** * @brief The VToolSpline class tool for creation spline. I mean bezier curve. */ -class VToolSpline:public VDrawTool, public QGraphicsPathItem +class VToolSpline:public VAbstractSpline { Q_OBJECT public: @@ -83,28 +81,8 @@ public: const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); - static const QString TagName; static const QString ToolType; -signals: - /** - * @brief RefreshLine refresh control line. - * @param indexSpline position spline in spline list. - * @param position position point in spline. - * @param controlPoint new position control point. - * @param splinePoint new position spline point. - */ - void RefreshLine ( const qint32 &indexSpline, SplinePoint::Position position, - const QPointF &controlPoint, const QPointF &splinePoint ); - /** - * @brief setEnabledPoint disable control points. - * @param enable enable or diasable points. - */ - void setEnabledPoint ( bool enable ); public slots: - /** - * @brief FullUpdateFromFile update tool data form file. - */ - virtual void FullUpdateFromFile (); /** * @brief ControlPointChangePosition handle change position control point. * @param indexSpline position spline in spline list. @@ -113,23 +91,6 @@ public slots: */ void ControlPointChangePosition (const qint32 &indexSpline, const SplinePoint::Position &position, const QPointF &pos); - /** - * @brief ChangedActivDraw disable or enable context menu after change active pattern peace. - * @param newName new name active pattern peace. - */ - virtual void ChangedActivDraw ( const QString &newName ); - /** - * @brief ShowTool highlight tool. - * @param id object id in container - * @param color highlight color. - * @param enable enable or disable highlight. - */ - virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); - /** - * @brief SetFactor set current scale factor of scene. - * @param factor scene scale factor. - */ - virtual void SetFactor(qreal factor); protected: /** * @brief contextMenuEvent handle context menu events. @@ -149,41 +110,15 @@ protected: * @param event context menu event. */ virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - /** - * @brief hoverMoveEvent handle hover move events. - * @param event hover move event. - */ - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief hoverLeaveEvent handle hover leave events. - * @param event hover leave event. - */ - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); /** * @brief RemoveReferens decrement value of reference. */ virtual void RemoveReferens(); - /** - * @brief itemChange hadle item change. - * @param change change. - * @param value value. - * @return value. - */ - virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); - /** - * @brief keyReleaseEvent handle key release events. - * @param event key release event. - */ - virtual void keyReleaseEvent(QKeyEvent * event); /** * @brief SaveDialog save options into file after change in dialog. */ virtual void SaveDialog(QDomElement &domElement); private: - /** - * @brief controlPoints list pointers of control points. - */ - QVector controlPoints; /** * @brief RefreshGeometry refresh item on scene. */ diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index 6f879da06..2f8bdc246 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -29,14 +29,11 @@ #include "vtoolsplinepath.h" #include "../../dialogs/tools/dialogsplinepath.h" -const QString VToolSplinePath::TagName = QStringLiteral("spline"); const QString VToolSplinePath::ToolType = QStringLiteral("path"); VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, - QGraphicsItem *parent) - :VDrawTool(doc, data, id), QGraphicsPathItem(parent), controlPoints(QVector()) + QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent) { - ignoreFullUpdate = true; const VSplinePath *splPath = data->GeometricObject(id); QPainterPath path; path.addPath(splPath->GetPath()); @@ -128,11 +125,6 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics } } -void VToolSplinePath::FullUpdateFromFile() -{ - RefreshGeometry(); -} - void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position, const QPointF &pos) { @@ -213,37 +205,6 @@ void VToolSplinePath::UpdatePathPoint(QDomNode& node, VSplinePath &path) } } -void VToolSplinePath::ChangedActivDraw(const QString &newName) -{ - bool selectable = false; - if (nameActivDraw == newName) - { - selectable = true; - currentColor = Qt::black; - } - else - { - selectable = false; - currentColor = Qt::gray; - } - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); - this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); - this->setAcceptHoverEvents (selectable); - emit setEnabledPoint(selectable); - VDrawTool::ChangedActivDraw(newName); -} - -void VToolSplinePath::ShowTool(quint32 id, Qt::GlobalColor color, bool enable) -{ - ShowItem(this, id, color, enable); -} - -void VToolSplinePath::SetFactor(qreal factor) -{ - VDrawTool::SetFactor(factor); - RefreshGeometry(); -} - void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { ContextMenu(this, event); @@ -301,18 +262,6 @@ void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) QGraphicsItem::mouseReleaseEvent(event); } -void VToolSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor)); -} - -void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) -{ - Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); -} - void VToolSplinePath::RemoveReferens() { VSplinePath splPath = *VAbstractTool::data.GeometricObject(id); @@ -322,37 +271,6 @@ void VToolSplinePath::RemoveReferens() } } -QVariant VToolSplinePath::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) -{ - if (change == QGraphicsItem::ItemSelectedChange) - { - if (value == true) - { - // do stuff if selected - this->setFocus(); - } - else - { - // do stuff if not selected - } - } - - return QGraphicsItem::itemChange(change, value); -} - -void VToolSplinePath::keyReleaseEvent(QKeyEvent *event) -{ - switch (event->key()) - { - case Qt::Key_Delete: - DeleteTool(this); - break; - default: - break; - } - QGraphicsItem::keyReleaseEvent ( event ); -} - void VToolSplinePath::SaveDialog(QDomElement &domElement) { Q_CHECK_PTR(dialog); diff --git a/src/tools/drawTools/vtoolsplinepath.h b/src/tools/drawTools/vtoolsplinepath.h index a573a76e2..ab009fbcc 100644 --- a/src/tools/drawTools/vtoolsplinepath.h +++ b/src/tools/drawTools/vtoolsplinepath.h @@ -29,14 +29,12 @@ #ifndef VTOOLSPLINEPATH_H #define VTOOLSPLINEPATH_H -#include "vdrawtool.h" -#include -#include "../../widgets/vcontrolpointspline.h" +#include "vabstractspline.h" /** * @brief The VToolSplinePath class tool for creation spline path. */ -class VToolSplinePath:public VDrawTool, public QGraphicsPathItem +class VToolSplinePath:public VAbstractSpline { Q_OBJECT public: @@ -75,7 +73,6 @@ public: static void Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); - static const QString TagName; static const QString ToolType; signals: /** @@ -93,10 +90,6 @@ signals: */ void setEnabledPoint(bool enable); public slots: - /** - * @brief FullUpdateFromFile update tool data form file. - */ - virtual void FullUpdateFromFile(); /** * @brief ControlPointChangePosition handle change position control point. * @param indexSpline position spline in spline list. @@ -105,23 +98,6 @@ public slots: */ void ControlPointChangePosition(const qint32 &indexSpline, const SplinePoint::Position &position, const QPointF &pos); - /** - * @brief ChangedActivDraw disable or enable context menu after change active pattern peace. - * @param newName new name active pattern peace. - */ - virtual void ChangedActivDraw(const QString &newName); - /** - * @brief ShowTool highlight tool. - * @param id object id in container - * @param color highlight color. - * @param enable enable or disable highlight. - */ - virtual void ShowTool(quint32 id, Qt::GlobalColor color, bool enable); - /** - * @brief SetFactor set current scale factor of scene. - * @param factor scene scale factor. - */ - virtual void SetFactor(qreal factor); protected: /** * @brief contextMenuEvent handle context menu events. @@ -141,41 +117,15 @@ protected: * @param event mouse release event. */ virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ); - /** - * @brief hoverMoveEvent handle hover move events. - * @param event hover move event. - */ - virtual void hoverMoveEvent ( QGraphicsSceneHoverEvent * event ); - /** - * @brief hoverLeaveEvent handle hover leave events. - * @param event hover leave event. - */ - virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ); /** * @brief RemoveReferens decrement value of reference. */ virtual void RemoveReferens(); - /** - * @brief itemChange handle item change. - * @param change change. - * @param value value. - * @return value. - */ - virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ); - /** - * @brief keyReleaseEvent handle key release events. - * @param event key release event. - */ - virtual void keyReleaseEvent(QKeyEvent * event); /** * @brief SaveDialog save options into file after change in dialog. */ virtual void SaveDialog(QDomElement &domElement); private: - /** - * @brief controlPoints list pointers of control points. - */ - QVector controlPoints; /** * @brief RefreshGeometry refresh item on scene. */ diff --git a/src/tools/tools.pri b/src/tools/tools.pri index 578923b13..6e5924a6a 100644 --- a/src/tools/tools.pri +++ b/src/tools/tools.pri @@ -31,7 +31,8 @@ HEADERS += \ src/tools/drawTools/vtoolcutspline.h \ src/tools/drawTools/vtoolcutsplinepath.h \ src/tools/vtooluniondetails.h \ - src/tools/drawTools/vtoolcutarc.h + src/tools/drawTools/vtoolcutarc.h \ + src/tools/drawTools/vabstractspline.h SOURCES += \ src/tools/vtooldetail.cpp \ @@ -63,4 +64,5 @@ SOURCES += \ src/tools/drawTools/vtoolcutspline.cpp \ src/tools/drawTools/vtoolcutsplinepath.cpp \ src/tools/vtooluniondetails.cpp \ - src/tools/drawTools/vtoolcutarc.cpp + src/tools/drawTools/vtoolcutarc.cpp \ + src/tools/drawTools/vabstractspline.cpp From 2610487fe576484ea1762ef9b5d9f27aeea31cf5 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 4 Mar 2014 19:13:10 +0200 Subject: [PATCH 28/60] Refactoring. --HG-- branch : feature --- src/dialogs/tools/dialogalongline.cpp | 23 ++++++++--------------- src/dialogs/tools/dialognormal.cpp | 23 ++++++++--------------- src/dialogs/tools/dialogtool.cpp | 15 +++++++++++++++ src/dialogs/tools/dialogtool.h | 1 + 4 files changed, 32 insertions(+), 30 deletions(-) diff --git a/src/dialogs/tools/dialogalongline.cpp b/src/dialogs/tools/dialogalongline.cpp index 26e72d9e9..730ad762d 100644 --- a/src/dialogs/tools/dialogalongline.cpp +++ b/src/dialogs/tools/dialogalongline.cpp @@ -85,30 +85,23 @@ void DialogAlongLine::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { - const VPointF *point = data->GeometricObject(id); if (number == 0) { - qint32 index = ui->comboBoxFirstPoint->findText(point->name()); - if ( index != -1 ) - { // -1 for not found - ui->comboBoxFirstPoint->setCurrentIndex(index); + if (ChoosedPoint(id, ui->comboBoxFirstPoint, tr("Select second point of line"))) + { number++; - emit ToolTip(tr("Select second point of line")); return; } } if (number == 1) { - qint32 index = ui->comboBoxSecondPoint->findText(point->name()); - if ( index != -1 ) - { // -1 for not found - ui->comboBoxSecondPoint->setCurrentIndex(index); - number = 0; - emit ToolTip(""); - } - if (isInitialized == false) + if (ChoosedPoint(id, ui->comboBoxSecondPoint, "")) { - this->show(); + number = 0; + if (isInitialized == false) + { + this->show(); + } } } } diff --git a/src/dialogs/tools/dialognormal.cpp b/src/dialogs/tools/dialognormal.cpp index 99ea9f05f..401b4aa64 100644 --- a/src/dialogs/tools/dialognormal.cpp +++ b/src/dialogs/tools/dialognormal.cpp @@ -102,30 +102,23 @@ void DialogNormal::ChoosedObject(quint32 id, const Scene::Scenes &type) { if (type == Scene::Point) { - const VPointF *point = data->GeometricObject(id); if (number == 0) { - qint32 index = ui->comboBoxFirstPoint->findText(point->name()); - if ( index != -1 ) - { // -1 for not found - ui->comboBoxFirstPoint->setCurrentIndex(index); + if (ChoosedPoint(id, ui->comboBoxFirstPoint, tr("Select second point of line"))) + { number++; - emit ToolTip(tr("Select second point of line")); return; } } if (number == 1) { - qint32 index = ui->comboBoxSecondPoint->findText(point->name()); - if ( index != -1 ) - { // -1 for not found - ui->comboBoxSecondPoint->setCurrentIndex(index); - number = 0; - emit ToolTip(""); - } - if (isInitialized == false) + if (ChoosedPoint(id, ui->comboBoxSecondPoint, "")) { - this->show(); + number = 0; + if (isInitialized == false) + { + this->show(); + } } } } diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index 03ce0823f..496c52be6 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -384,6 +384,21 @@ quint32 DialogTool::getCurrentObjectId(QComboBox *box) const } } +bool DialogTool::ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip) +{ + Q_CHECK_PTR(box); + const VPointF *point = data->GeometricObject(id); + Q_CHECK_PTR(point); + const qint32 index = box->findText(point->name()); + if ( index != -1 ) + { // -1 for not found + box->setCurrentIndex(index); + emit ToolTip(toolTip); + return true; + } + return false; +} + void DialogTool::FillList(QComboBox *box, const QMap &list) const { Q_CHECK_PTR(box); diff --git a/src/dialogs/tools/dialogtool.h b/src/dialogs/tools/dialogtool.h index 9b68e07bb..48ee2b043 100644 --- a/src/dialogs/tools/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -398,6 +398,7 @@ protected: * @return id or -1 if combobox is empty */ quint32 getCurrentObjectId(QComboBox *box) const; + bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip); private: /** * @brief FillList fill combobox list From 9b78d1a0abb09eb49e5f1ccc061b4708d9b13bd0 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 4 Mar 2014 20:14:11 +0200 Subject: [PATCH 29/60] Refactoring. --HG-- branch : feature --- src/dialogs/tools/dialogendline.cpp | 19 ++----------------- src/dialogs/tools/dialognormal.cpp | 19 ++----------------- src/dialogs/tools/dialogtool.h | 16 +++++++++++++++- 3 files changed, 19 insertions(+), 35 deletions(-) diff --git a/src/dialogs/tools/dialogendline.cpp b/src/dialogs/tools/dialogendline.cpp index 359083d19..04f5c8900 100644 --- a/src/dialogs/tools/dialogendline.cpp +++ b/src/dialogs/tools/dialogendline.cpp @@ -36,7 +36,6 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) formula(QString()), angle(0), basePointId(0) { ui->setupUi(this); - spinBoxAngle = ui->doubleSpinBoxAngle; listWidget = ui->listWidget; labelResultCalculation = ui->labelResultCalculation; labelDescription = ui->labelDescription; @@ -61,22 +60,8 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) FillComboBoxTypeLine(ui->comboBoxLineType); - connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, - &DialogEndLine::ArrowDown); - connect(ui->toolButtonArrowUp, &QPushButton::clicked, this, - &DialogEndLine::ArrowUp); - connect(ui->toolButtonArrowLeft, &QPushButton::clicked, this, - &DialogEndLine::ArrowLeft); - connect(ui->toolButtonArrowRight, &QPushButton::clicked, this, - &DialogEndLine::ArrowRight); - connect(ui->toolButtonArrowLeftUp, &QPushButton::clicked, this, - &DialogEndLine::ArrowLeftUp); - connect(ui->toolButtonArrowLeftDown, &QPushButton::clicked, this, - &DialogEndLine::ArrowLeftDown); - connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this, - &DialogEndLine::ArrowRightUp); - connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this, - &DialogEndLine::ArrowRightDown); + InitArrow(ui); + connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEndLine::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); diff --git a/src/dialogs/tools/dialognormal.cpp b/src/dialogs/tools/dialognormal.cpp index 401b4aa64..8c7c03488 100644 --- a/src/dialogs/tools/dialognormal.cpp +++ b/src/dialogs/tools/dialognormal.cpp @@ -36,7 +36,6 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent) typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0) { ui->setupUi(this); - spinBoxAngle = ui->doubleSpinBoxAngle; listWidget = ui->listWidget; labelResultCalculation = ui->labelResultCalculation; labelDescription = ui->labelDescription; @@ -61,22 +60,8 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent) FillComboBoxPoints(ui->comboBoxSecondPoint); FillComboBoxTypeLine(ui->comboBoxLineType); - connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, - &DialogNormal::ArrowDown); - connect(ui->toolButtonArrowUp, &QPushButton::clicked, this, - &DialogNormal::ArrowUp); - connect(ui->toolButtonArrowLeft, &QPushButton::clicked, this, - &DialogNormal::ArrowLeft); - connect(ui->toolButtonArrowRight, &QPushButton::clicked, this, - &DialogNormal::ArrowRight); - connect(ui->toolButtonArrowLeftUp, &QPushButton::clicked, this, - &DialogNormal::ArrowLeftUp); - connect(ui->toolButtonArrowLeftDown, &QPushButton::clicked, this, - &DialogNormal::ArrowLeftDown); - connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this, - &DialogNormal::ArrowRightUp); - connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this, - &DialogNormal::ArrowRightDown); + InitArrow(ui); + connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogNormal::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogNormal::ValChenged); diff --git a/src/dialogs/tools/dialogtool.h b/src/dialogs/tools/dialogtool.h index 48ee2b043..bc2dce26a 100644 --- a/src/dialogs/tools/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -398,7 +398,21 @@ protected: * @return id or -1 if combobox is empty */ quint32 getCurrentObjectId(QComboBox *box) const; - bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip); + bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip); + template + void InitArrow(T *ui) + { + Q_CHECK_PTR(ui); + spinBoxAngle = ui->doubleSpinBoxAngle; + connect(ui->toolButtonArrowDown, &QPushButton::clicked, this, &DialogTool::ArrowDown); + connect(ui->toolButtonArrowUp, &QPushButton::clicked, this, &DialogTool::ArrowUp); + connect(ui->toolButtonArrowLeft, &QPushButton::clicked, this, &DialogTool::ArrowLeft); + connect(ui->toolButtonArrowRight, &QPushButton::clicked, this, &DialogTool::ArrowRight); + connect(ui->toolButtonArrowLeftUp, &QPushButton::clicked, this, &DialogTool::ArrowLeftUp); + connect(ui->toolButtonArrowLeftDown, &QPushButton::clicked, this, &DialogTool::ArrowLeftDown); + connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this, &DialogTool::ArrowRightUp); + connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this, &DialogTool::ArrowRightDown); + } private: /** * @brief FillList fill combobox list From eba24ec34b0d3b461017ebdc04c8e8cbc9684412 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 6 Mar 2014 15:28:46 +0200 Subject: [PATCH 30/60] Refactoring. --HG-- branch : feature --- src/dialogs/tools/dialogalongline.cpp | 31 +++-------- src/dialogs/tools/dialogarc.cpp | 25 +-------- src/dialogs/tools/dialogbisector.cpp | 24 ++------- src/dialogs/tools/dialogcutarc.cpp | 23 ++------- src/dialogs/tools/dialogcutspline.cpp | 24 ++------- src/dialogs/tools/dialogcutsplinepath.cpp | 24 ++------- src/dialogs/tools/dialogdetail.cpp | 10 ++-- src/dialogs/tools/dialogendline.cpp | 25 ++------- src/dialogs/tools/dialogheight.cpp | 5 +- src/dialogs/tools/dialogline.cpp | 5 +- src/dialogs/tools/dialoglineintersect.cpp | 5 +- src/dialogs/tools/dialognormal.cpp | 24 ++------- src/dialogs/tools/dialogpointofcontact.cpp | 12 +++-- .../tools/dialogpointofintersection.cpp | 5 +- src/dialogs/tools/dialogshoulderpoint.cpp | 26 ++-------- src/dialogs/tools/dialogsinglepoint.cpp | 7 ++- src/dialogs/tools/dialogspline.cpp | 6 +-- src/dialogs/tools/dialogsplinepath.cpp | 6 +-- src/dialogs/tools/dialogtool.h | 40 +++++++++++++-- src/dialogs/tools/dialogtriangle.cpp | 5 +- src/dialogs/tools/dialoguniondetails.cpp | 5 +- src/tools/vtooluniondetails.cpp | 51 ++++++++----------- src/tools/vtooluniondetails.h | 1 + 23 files changed, 115 insertions(+), 274 deletions(-) diff --git a/src/dialogs/tools/dialogalongline.cpp b/src/dialogs/tools/dialogalongline.cpp index 730ad762d..54a9896db 100644 --- a/src/dialogs/tools/dialogalongline.cpp +++ b/src/dialogs/tools/dialogalongline.cpp @@ -36,44 +36,27 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent) typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0) { ui->setupUi(this); - listWidget = ui->listWidget; labelResultCalculation = ui->labelResultCalculation; - labelDescription = ui->labelDescription; - radioButtonSizeGrowth = ui->radioButtonSizeGrowth; - radioButtonStandardTable = ui->radioButtonStandardTable; - radioButtonIncrements = ui->radioButtonIncrements; - radioButtonLengthLine = ui->radioButtonLengthLine; - radioButtonLengthArc = ui->radioButtonLengthArc; - radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; - labelEditNamePoint = ui->labelEditNamePoint; + flagFormula = false; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogAlongLine::DialogAccepted); flagName = false; CheckState(); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogAlongLine::DialogRejected); + InitOkCansel(ui); + FillComboBoxTypeLine(ui->comboBoxLineType); ui->comboBoxLineType->setCurrentIndex(0); FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxSecondPoint); + labelEditNamePoint = ui->labelEditNamePoint; connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogAlongLine::PutHere); - connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogAlongLine::PutVal); - connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogAlongLine::ValChenged); - - ShowVariable(data->DataBase()); - connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogAlongLine::SizeGrowth); - connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogAlongLine::StandardTable); - connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogAlongLine::Increments); - connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogAlongLine::LengthLines); - connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogAlongLine::LengthArcs); - connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogAlongLine::LengthCurves); - connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogAlongLine::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogAlongLine::NamePointChanged); + connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogAlongLine::EvalFormula); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogAlongLine::FormulaChanged); + InitVariables(ui); + connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogTool::PutVal); } DialogAlongLine::~DialogAlongLine() diff --git a/src/dialogs/tools/dialogarc.cpp b/src/dialogs/tools/dialogarc.cpp index d8fcacda1..ce76cceec 100644 --- a/src/dialogs/tools/dialogarc.cpp +++ b/src/dialogs/tools/dialogarc.cpp @@ -47,38 +47,17 @@ DialogArc::DialogArc(const VContainer *data, QWidget *parent) timerF2 = new QTimer(this); connect(timerF2, &QTimer::timeout, this, &DialogArc::EvalF2); - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogArc::DialogAccepted); - - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogArc::DialogRejected); + InitOkCansel(ui); FillComboBoxPoints(ui->comboBoxBasePoint); CheckState(); - listWidget = ui->listWidget; - labelDescription = ui->labelDescription; - radioButtonSizeGrowth = ui->radioButtonSizeGrowth; - radioButtonStandardTable = ui->radioButtonStandardTable; - radioButtonIncrements = ui->radioButtonIncrements; - radioButtonLengthLine = ui->radioButtonLengthLine; - radioButtonLengthArc = ui->radioButtonLengthArc; - radioButtonLengthCurve = ui->radioButtonLengthSpline; + InitVariables(ui); connect(ui->toolButtonPutHereRadius, &QPushButton::clicked, this, &DialogArc::PutRadius); connect(ui->toolButtonPutHereF1, &QPushButton::clicked, this, &DialogArc::PutF1); connect(ui->toolButtonPutHereF2, &QPushButton::clicked, this, &DialogArc::PutF2); - connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogArc::ValChenged); - - ShowVariable(data->DataBase()); - connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogArc::SizeGrowth); - connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogArc::StandardTable); - connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogArc::Increments); - connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogArc::LengthLines); - connect(ui->radioButtonLineAngles, &QRadioButton::clicked, this, &DialogArc::LineAngles); - connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogArc::LengthArcs); - connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogArc::LengthCurves); connect(ui->toolButtonEqualRadius, &QPushButton::clicked, this, &DialogArc::EvalRadius); connect(ui->toolButtonEqualF1, &QPushButton::clicked, this, &DialogArc::EvalF1); diff --git a/src/dialogs/tools/dialogbisector.cpp b/src/dialogs/tools/dialogbisector.cpp index f0a4e1045..df45158b7 100644 --- a/src/dialogs/tools/dialogbisector.cpp +++ b/src/dialogs/tools/dialogbisector.cpp @@ -36,25 +36,15 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent) typeLine(QString()), formula(QString()), firstPointId(0), secondPointId(0), thirdPointId(0) { ui->setupUi(this); - listWidget = ui->listWidget; + InitVariables(ui); labelResultCalculation = ui->labelResultCalculation; - labelDescription = ui->labelDescription; - radioButtonSizeGrowth = ui->radioButtonSizeGrowth; - radioButtonStandardTable = ui->radioButtonStandardTable; - radioButtonIncrements = ui->radioButtonIncrements; - radioButtonLengthLine = ui->radioButtonLengthLine; - radioButtonLengthArc = ui->radioButtonLengthArc; - radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; + InitOkCansel(ui); flagFormula = false; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogBisector::DialogAccepted); flagName = false; CheckState(); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogBisector::DialogRejected); FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxSecondPoint); @@ -62,16 +52,8 @@ DialogBisector::DialogBisector(const VContainer *data, QWidget *parent) FillComboBoxTypeLine(ui->comboBoxLineType); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogBisector::PutHere); - connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogBisector::PutVal); - connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogBisector::ValChenged); + connect(listWidget, &QListWidget::itemDoubleClicked, this, &DialogBisector::PutVal); - ShowVariable(data->DataBase()); - connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogBisector::SizeGrowth); - connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogBisector::StandardTable); - connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogBisector::Increments); - connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogBisector::LengthLines); - connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogBisector::LengthArcs); - connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogBisector::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogBisector::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogBisector::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogBisector::FormulaChanged); diff --git a/src/dialogs/tools/dialogcutarc.cpp b/src/dialogs/tools/dialogcutarc.cpp index af9c00b46..6e9580f25 100644 --- a/src/dialogs/tools/dialogcutarc.cpp +++ b/src/dialogs/tools/dialogcutarc.cpp @@ -33,39 +33,22 @@ DialogCutArc::DialogCutArc(const VContainer *data, QWidget *parent) : DialogTool(data, parent), ui(new Ui::DialogCutArc), pointName(QString()), formula(QString()), arcId(0) { ui->setupUi(this); - listWidget = ui->listWidget; + InitVariables(ui); labelResultCalculation = ui->labelResultCalculation; - labelDescription = ui->labelDescription; - radioButtonSizeGrowth = ui->radioButtonSizeGrowth; - radioButtonStandardTable = ui->radioButtonStandardTable; - radioButtonIncrements = ui->radioButtonIncrements; - radioButtonLengthLine = ui->radioButtonLengthLine; - radioButtonLengthArc = ui->radioButtonLengthArc; - radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; + + InitOkCansel(ui); flagFormula = false; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogCutArc::DialogAccepted); flagName = false; CheckState(); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogCutArc::DialogRejected); FillComboBoxArcs(ui->comboBoxArc); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutArc::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutArc::PutVal); - connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCutArc::ValChenged); - ShowVariable(data->DataBase()); - connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogCutArc::SizeGrowth); - connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogCutArc::StandardTable); - connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogCutArc::Increments); - connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogCutArc::LengthLines); - connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogCutArc::LengthArcs); - connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogCutArc::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutArc::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutArc::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutArc::FormulaChanged); diff --git a/src/dialogs/tools/dialogcutspline.cpp b/src/dialogs/tools/dialogcutspline.cpp index 33dc8b931..bc885d052 100644 --- a/src/dialogs/tools/dialogcutspline.cpp +++ b/src/dialogs/tools/dialogcutspline.cpp @@ -33,39 +33,21 @@ DialogCutSpline::DialogCutSpline(const VContainer *data, QWidget *parent) :DialogTool(data, parent), ui(new Ui::DialogCutSpline), pointName(QString()), formula(QString()), splineId(0) { ui->setupUi(this); - listWidget = ui->listWidget; + InitVariables(ui); labelResultCalculation = ui->labelResultCalculation; - labelDescription = ui->labelDescription; - radioButtonSizeGrowth = ui->radioButtonSizeGrowth; - radioButtonStandardTable = ui->radioButtonStandardTable; - radioButtonIncrements = ui->radioButtonIncrements; - radioButtonLengthLine = ui->radioButtonLengthLine; - radioButtonLengthArc = ui->radioButtonLengthArc; - radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; + InitOkCansel(ui); + flagFormula = false; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogCutSpline::DialogAccepted); flagName = false; CheckState(); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogCutSpline::DialogRejected); FillComboBoxSplines(ui->comboBoxSpline); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSpline::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSpline::PutVal); - connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCutSpline::ValChenged); - - ShowVariable(data->DataBase()); - connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogCutSpline::SizeGrowth); - connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogCutSpline::StandardTable); - connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogCutSpline::Increments); - connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogCutSpline::LengthLines); - connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogCutSpline::LengthArcs); - connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogCutSpline::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSpline::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSpline::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSpline::FormulaChanged); diff --git a/src/dialogs/tools/dialogcutsplinepath.cpp b/src/dialogs/tools/dialogcutsplinepath.cpp index 12f92a2bc..a21f01c11 100644 --- a/src/dialogs/tools/dialogcutsplinepath.cpp +++ b/src/dialogs/tools/dialogcutsplinepath.cpp @@ -34,39 +34,21 @@ DialogCutSplinePath::DialogCutSplinePath(const VContainer *data, QWidget *parent splinePathId(0) { ui->setupUi(this); - listWidget = ui->listWidget; + InitVariables(ui); labelResultCalculation = ui->labelResultCalculation; - labelDescription = ui->labelDescription; - radioButtonSizeGrowth = ui->radioButtonSizeGrowth; - radioButtonStandardTable = ui->radioButtonStandardTable; - radioButtonIncrements = ui->radioButtonIncrements; - radioButtonLengthLine = ui->radioButtonLengthLine; - radioButtonLengthArc = ui->radioButtonLengthArc; - radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; + + InitOkCansel(ui); flagFormula = false; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogCutSplinePath::DialogAccepted); flagName = false; CheckState(); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogCutSplinePath::DialogRejected); FillComboBoxSplinesPath(ui->comboBoxSplinePath); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogCutSplinePath::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogCutSplinePath::PutVal); - connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogCutSplinePath::ValChenged); - - ShowVariable(data->DataBase()); - connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogCutSplinePath::SizeGrowth); - connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogCutSplinePath::StandardTable); - connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogCutSplinePath::Increments); - connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogCutSplinePath::LengthLines); - connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogCutSplinePath::LengthArcs); - connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogCutSplinePath::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogCutSplinePath::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogCutSplinePath::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogCutSplinePath::FormulaChanged); diff --git a/src/dialogs/tools/dialogdetail.cpp b/src/dialogs/tools/dialogdetail.cpp index 57b1ec48a..2238a46ef 100644 --- a/src/dialogs/tools/dialogdetail.cpp +++ b/src/dialogs/tools/dialogdetail.cpp @@ -36,8 +36,13 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent) { ui.setupUi(this); labelEditNamePoint = ui.labelEditNameDetail; + bOk = ui.buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogDetail::DialogAccepted); + Q_CHECK_PTR(bOk); + connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted); + QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); + Q_CHECK_PTR(bCansel); + connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected); flagName = true;//We have default name of detail. QPalette palette = labelEditNamePoint->palette(); @@ -45,9 +50,6 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent) labelEditNamePoint->setPalette(palette); CheckState(); - QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogDetail::DialogRejected); - connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogDetail::ObjectChanged); connect(ui.spinBoxBiasX, static_cast(&QSpinBox::valueChanged), this, &DialogDetail::BiasXChanged); diff --git a/src/dialogs/tools/dialogendline.cpp b/src/dialogs/tools/dialogendline.cpp index 04f5c8900..4c67d7db4 100644 --- a/src/dialogs/tools/dialogendline.cpp +++ b/src/dialogs/tools/dialogendline.cpp @@ -36,43 +36,24 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) formula(QString()), angle(0), basePointId(0) { ui->setupUi(this); - listWidget = ui->listWidget; + InitVariables(ui); labelResultCalculation = ui->labelResultCalculation; - labelDescription = ui->labelDescription; - radioButtonSizeGrowth = ui->radioButtonSizeGrowth; - radioButtonStandardTable = ui->radioButtonStandardTable; - radioButtonIncrements = ui->radioButtonIncrements; - radioButtonLengthLine = ui->radioButtonLengthLine; - radioButtonLengthArc = ui->radioButtonLengthArc; - radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; + + InitOkCansel(ui); flagFormula = false; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogEndLine::DialogAccepted); flagName = false; CheckState(); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogEndLine::DialogRejected); FillComboBoxPoints(ui->comboBoxBasePoint); - FillComboBoxTypeLine(ui->comboBoxLineType); InitArrow(ui); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogEndLine::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogEndLine::PutVal); - connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogEndLine::ValChenged); - - ShowVariable(data->DataBase()); - connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogEndLine::SizeGrowth); - connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogEndLine::StandardTable); - connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogEndLine::Increments); - connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogEndLine::LengthLines); - connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogEndLine::LengthArcs); - connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogEndLine::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogEndLine::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogEndLine::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged); diff --git a/src/dialogs/tools/dialogheight.cpp b/src/dialogs/tools/dialogheight.cpp index 8c5339aaf..6b9b19f8f 100644 --- a/src/dialogs/tools/dialogheight.cpp +++ b/src/dialogs/tools/dialogheight.cpp @@ -37,12 +37,9 @@ DialogHeight::DialogHeight(const VContainer *data, QWidget *parent) { ui->setupUi(this); labelEditNamePoint = ui->labelEditNamePoint; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogHeight::DialogAccepted); + InitOkCansel(ui); flagName = false; CheckState(); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogHeight::DialogRejected); FillComboBoxPoints(ui->comboBoxBasePoint); FillComboBoxPoints(ui->comboBoxP1Line); diff --git a/src/dialogs/tools/dialogline.cpp b/src/dialogs/tools/dialogline.cpp index 4433856c3..2cb17f0cc 100644 --- a/src/dialogs/tools/dialogline.cpp +++ b/src/dialogs/tools/dialogline.cpp @@ -35,10 +35,7 @@ DialogLine::DialogLine(const VContainer *data, QWidget *parent) :DialogTool(data, parent), ui(new Ui::DialogLine), number(0), firstPoint(0), secondPoint(0), typeLine(QString()) { ui->setupUi(this); - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogLine::DialogAccepted); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogLine::DialogRejected); + InitOkCansel(ui); FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxSecondPoint); diff --git a/src/dialogs/tools/dialoglineintersect.cpp b/src/dialogs/tools/dialoglineintersect.cpp index 31a04adbc..185e9f830 100644 --- a/src/dialogs/tools/dialoglineintersect.cpp +++ b/src/dialogs/tools/dialoglineintersect.cpp @@ -37,12 +37,9 @@ DialogLineIntersect::DialogLineIntersect(const VContainer *data, QWidget *parent { ui->setupUi(this); number = 0; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogLineIntersect::DialogAccepted); + InitOkCansel(ui); labelEditNamePoint = ui->labelEditNamePoint; flagName = false; - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogLineIntersect::DialogRejected); FillComboBoxPoints(ui->comboBoxP1Line1); FillComboBoxPoints(ui->comboBoxP2Line1); diff --git a/src/dialogs/tools/dialognormal.cpp b/src/dialogs/tools/dialognormal.cpp index 8c7c03488..0f17ddb32 100644 --- a/src/dialogs/tools/dialognormal.cpp +++ b/src/dialogs/tools/dialognormal.cpp @@ -36,25 +36,16 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent) typeLine(QString()), formula(QString()), angle(0), firstPointId(0), secondPointId(0) { ui->setupUi(this); - listWidget = ui->listWidget; + InitVariables(ui); labelResultCalculation = ui->labelResultCalculation; - labelDescription = ui->labelDescription; - radioButtonSizeGrowth = ui->radioButtonSizeGrowth; - radioButtonStandardTable = ui->radioButtonStandardTable; - radioButtonIncrements = ui->radioButtonIncrements; - radioButtonLengthLine = ui->radioButtonLengthLine; - radioButtonLengthArc = ui->radioButtonLengthArc; - radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; + InitOkCansel(ui); + flagFormula = false; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogNormal::DialogAccepted); flagName = false; CheckState(); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogNormal::DialogRejected); FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxSecondPoint); @@ -64,15 +55,6 @@ DialogNormal::DialogNormal(const VContainer *data, QWidget *parent) connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogNormal::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogNormal::PutVal); - connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogNormal::ValChenged); - - ShowVariable(data->DataBase()); - connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogNormal::SizeGrowth); - connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogNormal::StandardTable); - connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogNormal::Increments); - connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogNormal::LengthLines); - connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogNormal::LengthArcs); - connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogNormal::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogNormal::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogNormal::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogNormal::FormulaChanged); diff --git a/src/dialogs/tools/dialogpointofcontact.cpp b/src/dialogs/tools/dialogpointofcontact.cpp index b66dfe4fd..d8e1f8ff0 100644 --- a/src/dialogs/tools/dialogpointofcontact.cpp +++ b/src/dialogs/tools/dialogpointofcontact.cpp @@ -47,13 +47,17 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare lineEditFormula = ui.lineEditFormula; labelEditFormula = ui.labelEditFormula; labelEditNamePoint = ui.labelEditNamePoint; - flagFormula = false; + bOk = ui.buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogPointOfContact::DialogAccepted); + Q_CHECK_PTR(bOk); + connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted); + QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); + Q_CHECK_PTR(bCansel); + connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected); + + flagFormula = false; flagName = false; CheckState(); - QPushButton *bCansel = ui.buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogPointOfContact::DialogRejected); FillComboBoxPoints(ui.comboBoxCenter); FillComboBoxPoints(ui.comboBoxFirstPoint); diff --git a/src/dialogs/tools/dialogpointofintersection.cpp b/src/dialogs/tools/dialogpointofintersection.cpp index b7faaa0a2..3fa7f88aa 100644 --- a/src/dialogs/tools/dialogpointofintersection.cpp +++ b/src/dialogs/tools/dialogpointofintersection.cpp @@ -37,12 +37,9 @@ DialogPointOfIntersection::DialogPointOfIntersection(const VContainer *data, QWi { ui->setupUi(this); labelEditNamePoint = ui->labelEditNamePoint; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogAccepted); + InitOkCansel(ui); flagName = false; CheckState(); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogPointOfIntersection::DialogRejected); FillComboBoxPoints(ui->comboBoxFirstPoint); FillComboBoxPoints(ui->comboBoxSecondPoint); diff --git a/src/dialogs/tools/dialogshoulderpoint.cpp b/src/dialogs/tools/dialogshoulderpoint.cpp index 4a0500ba6..723d8d699 100644 --- a/src/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/dialogs/tools/dialogshoulderpoint.cpp @@ -37,42 +37,24 @@ DialogShoulderPoint::DialogShoulderPoint(const VContainer *data, QWidget *parent { ui->setupUi(this); number = 0; - listWidget = ui->listWidget; + InitVariables(ui); labelResultCalculation = ui->labelResultCalculation; - labelDescription = ui->labelDescription; - radioButtonSizeGrowth = ui->radioButtonSizeGrowth; - radioButtonStandardTable = ui->radioButtonStandardTable; - radioButtonIncrements = ui->radioButtonIncrements; - radioButtonLengthLine = ui->radioButtonLengthLine; - radioButtonLengthArc = ui->radioButtonLengthArc; - radioButtonLengthCurve = ui->radioButtonLengthSpline; lineEditFormula = ui->lineEditFormula; labelEditFormula = ui->labelEditFormula; labelEditNamePoint = ui->labelEditNamePoint; + InitOkCansel(ui); + flagFormula = false; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogShoulderPoint::DialogAccepted); flagName = false; CheckState(); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogShoulderPoint::DialogRejected); - FillComboBoxTypeLine(ui->comboBoxLineType); + FillComboBoxTypeLine(ui->comboBoxLineType); FillComboBoxPoints(ui->comboBoxP1Line); FillComboBoxPoints(ui->comboBoxP2Line); FillComboBoxPoints(ui->comboBoxPShoulder); connect(ui->toolButtonPutHere, &QPushButton::clicked, this, &DialogShoulderPoint::PutHere); connect(ui->listWidget, &QListWidget::itemDoubleClicked, this, &DialogShoulderPoint::PutVal); - connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogShoulderPoint::ValChenged); - - ShowVariable(data->DataBase()); - connect(ui->radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogShoulderPoint::SizeGrowth); - connect(ui->radioButtonStandardTable, &QRadioButton::clicked, this, &DialogShoulderPoint::StandardTable); - connect(ui->radioButtonIncrements, &QRadioButton::clicked, this, &DialogShoulderPoint::Increments); - connect(ui->radioButtonLengthLine, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthLines); - connect(ui->radioButtonLengthArc, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthArcs); - connect(ui->radioButtonLengthSpline, &QRadioButton::clicked, this, &DialogShoulderPoint::LengthCurves); connect(ui->toolButtonEqual, &QPushButton::clicked, this, &DialogShoulderPoint::EvalFormula); connect(ui->lineEditNamePoint, &QLineEdit::textChanged, this, &DialogShoulderPoint::NamePointChanged); connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogShoulderPoint::FormulaChanged); diff --git a/src/dialogs/tools/dialogsinglepoint.cpp b/src/dialogs/tools/dialogsinglepoint.cpp index af69ba8b5..570758d28 100644 --- a/src/dialogs/tools/dialogsinglepoint.cpp +++ b/src/dialogs/tools/dialogsinglepoint.cpp @@ -38,13 +38,12 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) ui->setupUi(this); ui->doubleSpinBoxX->setRange(0, toMM(SceneSize)); ui->doubleSpinBoxY->setRange(0, toMM(SceneSize)); - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); labelEditNamePoint = ui->labelEditName; + InitOkCansel(ui); + flagName = false; CheckState(); - connect(bOk, &QPushButton::clicked, this, &DialogSinglePoint::DialogAccepted); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogSinglePoint::DialogRejected); + connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogSinglePoint::NamePointChanged); } diff --git a/src/dialogs/tools/dialogspline.cpp b/src/dialogs/tools/dialogspline.cpp index a5fdef0f0..bfe58082d 100644 --- a/src/dialogs/tools/dialogspline.cpp +++ b/src/dialogs/tools/dialogspline.cpp @@ -36,11 +36,7 @@ DialogSpline::DialogSpline(const VContainer *data, QWidget *parent) kAsm1(1), kAsm2(1), kCurve(1) { ui->setupUi(this); - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogSpline::DialogAccepted); - - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogSpline::DialogRejected); + InitOkCansel(ui); FillComboBoxPoints(ui->comboBoxP1); FillComboBoxPoints(ui->comboBoxP4); diff --git a/src/dialogs/tools/dialogsplinepath.cpp b/src/dialogs/tools/dialogsplinepath.cpp index 4abe04686..1fedb0b69 100644 --- a/src/dialogs/tools/dialogsplinepath.cpp +++ b/src/dialogs/tools/dialogsplinepath.cpp @@ -36,13 +36,9 @@ DialogSplinePath::DialogSplinePath(const VContainer *data, QWidget *parent) :DialogTool(data, parent), ui(new Ui::DialogSplinePath), path(VSplinePath()) { ui->setupUi(this); - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogSplinePath::DialogAccepted); + InitOkCansel(ui); bOk->setEnabled(false); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogSplinePath::DialogRejected); - FillComboBoxPoints(ui->comboBoxPoint); connect(ui->listWidget, &QListWidget::currentRowChanged, this, &DialogSplinePath::PointChanged); diff --git a/src/dialogs/tools/dialogtool.h b/src/dialogs/tools/dialogtool.h index bc2dce26a..2b3e0fe87 100644 --- a/src/dialogs/tools/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -35,6 +35,7 @@ #include #include #include +#include #include "../../container/vcontainer.h" namespace ComboMode @@ -397,10 +398,10 @@ protected: * @param box combobox * @return id or -1 if combobox is empty */ - quint32 getCurrentObjectId(QComboBox *box) const; - bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip); + quint32 getCurrentObjectId(QComboBox *box) const; + bool ChoosedPoint(const quint32 &id, QComboBox *box, const QString &toolTip); template - void InitArrow(T *ui) + void InitArrow(T *ui) { Q_CHECK_PTR(ui); spinBoxAngle = ui->doubleSpinBoxAngle; @@ -413,6 +414,39 @@ protected: connect(ui->toolButtonArrowRightUp, &QPushButton::clicked, this, &DialogTool::ArrowRightUp); connect(ui->toolButtonArrowRightDown, &QPushButton::clicked, this, &DialogTool::ArrowRightDown); } + template + void InitVariables(T *ui) + { + listWidget = ui->listWidget; + labelDescription = ui->labelDescription; + radioButtonSizeGrowth = ui->radioButtonSizeGrowth; + radioButtonStandardTable = ui->radioButtonStandardTable; + radioButtonIncrements = ui->radioButtonIncrements; + radioButtonLengthLine = ui->radioButtonLengthLine; + radioButtonLengthArc = ui->radioButtonLengthArc; + radioButtonLengthCurve = ui->radioButtonLengthSpline; + + connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); + + ShowVariable(data->DataBase()); + connect(radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeGrowth); + connect(radioButtonStandardTable, &QRadioButton::clicked, this, &DialogTool::StandardTable); + connect(radioButtonIncrements, &QRadioButton::clicked, this, &DialogTool::Increments); + connect(radioButtonLengthLine, &QRadioButton::clicked, this, &DialogTool::LengthLines); + connect(radioButtonLengthArc, &QRadioButton::clicked, this, &DialogTool::LengthArcs); + connect(radioButtonLengthCurve, &QRadioButton::clicked, this, &DialogTool::LengthCurves); + } + template + void InitOkCansel(T *ui) + { + bOk = ui->buttonBox->button(QDialogButtonBox::Ok); + Q_CHECK_PTR(bOk); + connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted); + + QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); + Q_CHECK_PTR(bCansel); + connect(bCansel, &QPushButton::clicked, this, &DialogTool::DialogRejected); + } private: /** * @brief FillList fill combobox list diff --git a/src/dialogs/tools/dialogtriangle.cpp b/src/dialogs/tools/dialogtriangle.cpp index b4ba5320e..19c3c9e53 100644 --- a/src/dialogs/tools/dialogtriangle.cpp +++ b/src/dialogs/tools/dialogtriangle.cpp @@ -37,12 +37,9 @@ DialogTriangle::DialogTriangle(const VContainer *data, QWidget *parent) { ui->setupUi(this); labelEditNamePoint = ui->labelEditNamePoint; - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogTriangle::DialogAccepted); + InitOkCansel(ui); flagName = false; CheckState(); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogTriangle::DialogRejected); FillComboBoxPoints(ui->comboBoxAxisP1); FillComboBoxPoints(ui->comboBoxAxisP2); diff --git a/src/dialogs/tools/dialoguniondetails.cpp b/src/dialogs/tools/dialoguniondetails.cpp index 580bcddc2..3a015d2ff 100644 --- a/src/dialogs/tools/dialoguniondetails.cpp +++ b/src/dialogs/tools/dialoguniondetails.cpp @@ -34,10 +34,7 @@ DialogUnionDetails::DialogUnionDetails(const VContainer *data, QWidget *parent) numberP(0), p1(0), p2(0) { ui->setupUi(this); - bOk = ui->buttonBox->button(QDialogButtonBox::Ok); - connect(bOk, &QPushButton::clicked, this, &DialogUnionDetails::DialogAccepted); - QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel); - connect(bCansel, &QPushButton::clicked, this, &DialogUnionDetails::DialogRejected); + InitOkCansel(ui); } DialogUnionDetails::~DialogUnionDetails() diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index 5fbb34d7d..5a70fb16e 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -488,21 +488,7 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta { do { - if (pointsD2 == 0) - { - VNodeDetail node1; - VNodeDetail node2; - d2.NodeOnEdge(indexD2, node1, node2); - ptrdiff_t k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId()); - if (k == d2.RemoveEdge(indexD2).CountNode()-1) - { - j = 0; - } - else - { - j = d2.RemoveEdge(indexD2).indexOfNode(node2.getId())+1; - } - } + FindJ(pointsD2, d2, indexD2, j); if (pointsD2 == d2.RemoveEdge(indexD2).CountNode() -2) { break; @@ -546,21 +532,7 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta { do { - if (pointsD2 == 0) - { - VNodeDetail node1; - VNodeDetail node2; - d2.NodeOnEdge(indexD2, node1, node2); - ptrdiff_t k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId()); - if (k == d2.RemoveEdge(indexD2).CountNode()-1) - { - j = 0; - } - else - { - j = d2.RemoveEdge(indexD2).indexOfNode(node2.getId())+1; - } - } + FindJ(pointsD2, d2, indexD2, j); if (pointsD2 == d2.RemoveEdge(indexD2).CountNode()-2) { break; @@ -587,6 +559,25 @@ void VToolUnionDetails::PointsOnEdge(const VDetail &d, const qint32 &index, VPoi p2 = VPointF(*data->GeometricObject(det2p2.getId())); } +void VToolUnionDetails::FindJ(const qint32 &pointsD2, const VDetail &d2, const qint32 &indexD2, qint32 &j) +{ + if (pointsD2 == 0) + { + VNodeDetail node1; + VNodeDetail node2; + d2.NodeOnEdge(indexD2, node1, node2); + ptrdiff_t k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId()); + if (k == d2.RemoveEdge(indexD2).CountNode()-1) + { + j = 0; + } + else + { + j = d2.RemoveEdge(indexD2).indexOfNode(node2.getId())+1; + } + } +} + QVector VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomElement &domElement) { QVector vector; diff --git a/src/tools/vtooluniondetails.h b/src/tools/vtooluniondetails.h index ee7a2b845..85fdaa978 100644 --- a/src/tools/vtooluniondetails.h +++ b/src/tools/vtooluniondetails.h @@ -85,6 +85,7 @@ public: VPattern *doc, VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); static void PointsOnEdge(const VDetail &d, const qint32 &index, VPointF &p1, VPointF &p2, VContainer *data); + static void FindJ(const qint32 &pointsD2, const VDetail &d2, const qint32 &indexD2, qint32 &j); /** * @brief GetDetailFromFile parse detail from file. * @param doc dom document container. From ab19b30713ae630311682e2b18aec7a204c70708 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 6 Mar 2014 15:35:14 +0200 Subject: [PATCH 31/60] Refactoring. --HG-- branch : feature --- src/tools/drawTools/vtoolcutspline.cpp | 17 +++++++++-------- src/tools/drawTools/vtoolcutsplinepath.cpp | 17 +++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index 678b11eeb..0e83bdfac 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -178,23 +178,24 @@ void VToolCutSpline::SplineChoosed(quint32 id) void VToolCutSpline::ChangedActivDraw(const QString &newName) { + bool flag = true; if (nameActivDraw == newName) { currentColor = Qt::black; - firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, true); - firstSpline->setAcceptHoverEvents(true); - secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, true); - secondSpline->setAcceptHoverEvents(true); + flag = true; } else { currentColor = Qt::gray; - firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, false); - firstSpline->setAcceptHoverEvents(false); - secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false); - secondSpline->setAcceptHoverEvents(false); + flag = false; } + + firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); + firstSpline->setAcceptHoverEvents(flag); firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + + secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); + secondSpline->setAcceptHoverEvents(flag); secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); VToolPoint::ChangedActivDraw(newName); } diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index 80fd71cfb..6eab2f31c 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -259,23 +259,24 @@ void VToolCutSplinePath::SplineChoosed(quint32 id) void VToolCutSplinePath::ChangedActivDraw(const QString &newName) { + bool flag = true; if (nameActivDraw == newName) { currentColor = Qt::black; - firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, true); - firstSpline->setAcceptHoverEvents(true); - secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, true); - secondSpline->setAcceptHoverEvents(true); + flag = true; } else { currentColor = Qt::gray; - firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, false); - firstSpline->setAcceptHoverEvents(false); - secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, false); - secondSpline->setAcceptHoverEvents(false); + flag = false; } + + firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); + firstSpline->setAcceptHoverEvents(flag); firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + + secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); + secondSpline->setAcceptHoverEvents(flag); secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); VToolPoint::ChangedActivDraw(newName); } From 2fc4d95faa2d4d769df7743c2beee87dbb453b23 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 6 Mar 2014 16:01:15 +0200 Subject: [PATCH 32/60] Refactoring. --HG-- branch : feature --- src/tools/drawTools/vtoolcutsplinepath.cpp | 71 ++++++++++------------ 1 file changed, 31 insertions(+), 40 deletions(-) diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index 6eab2f31c..d8f8a66cc 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -94,36 +94,42 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con const Document::Documents &parse, const Tool::Sources &typeCreation) { const VSplinePath *splPath = data->GeometricObject(splinePathId); + Q_CHECK_PTR(splPath); Calculator cal(data); QString errorMsg; qreal result = cal.eval(formula, &errorMsg); if (errorMsg.isEmpty()) { + quint32 id = _id; QPointF spl1p2, spl1p3, spl2p2, spl2p3; qint32 p1 = 0, p2 = 0; - QPointF point = splPath->CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3); - quint32 id = _id; - quint32 splPath1id = 0; - quint32 splPath2id = 0; + const QPointF point = splPath->CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3); + VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); + Q_CHECK_PTR(p); if (typeCreation == Tool::FromGui) { - VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p); id = data->AddGObject(p); - splPath1id = id + 1; - splPath2id = id + 2; + } + else + { + data->UpdateGObject(id, p); + } - VSplinePoint splP1 = splPath->at(p1); - VSplinePoint splP2 = splPath->at(p2); - VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p, splPath->getKCurve()); - VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve()); + quint32 splPath1id = id + 1; + quint32 splPath2id = id + 2; + const VSplinePoint splP1 = splPath->at(p1); + const VSplinePoint splP2 = splPath->at(p2); + const VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p, splPath->getKCurve()); + const VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve()); - VSplinePath *splPath1 = new VSplinePath(); - Q_CHECK_PTR(splPath1); - VSplinePath *splPath2 = new VSplinePath(); - Q_CHECK_PTR(splPath2); + VSplinePath *splPath1 = new VSplinePath(); + Q_CHECK_PTR(splPath1); + VSplinePath *splPath2 = new VSplinePath(); + Q_CHECK_PTR(splPath2); + if (typeCreation == Tool::FromGui) + { for (qint32 i = 0; i < splPath->CountPoint(); i++) { if (i <= p1 && i < p2) @@ -132,8 +138,8 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con { splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(), spl1.GetAngle1())); - VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(), - spl1.GetAngle2()+180, spl1.GetAngle2()); + const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(), + spl1.GetAngle2()+180, spl1.GetAngle2()); splPath1->append(cutPoint); continue; } @@ -143,8 +149,8 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con { if (i == p2) { - VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180, spl2.GetKasm1(), - spl2.GetAngle1()); + const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180, + spl2.GetKasm1(), spl2.GetAngle1()); splPath2->append(cutPoint); splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(), spl2.GetAngle2()+180)); @@ -165,22 +171,6 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con } else { - VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p); - data->UpdateGObject(id, p); - - splPath1id = id + 1; - splPath2id = id + 2; - - VSplinePoint splP1 = splPath->at(p1); - VSplinePoint splP2 = splPath->at(p2); - VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p, splPath->getKCurve()); - VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve()); - - VSplinePath *splPath1 = new VSplinePath(); - Q_CHECK_PTR(splPath1); - VSplinePath *splPath2 = new VSplinePath(); - Q_CHECK_PTR(splPath2); for (qint32 i = 0; i < splPath->CountPoint(); i++) { if (i <= p1 && i < p2) @@ -189,8 +179,8 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con { splPath1->append(VSplinePoint(splP1.P(), splP1.KAsm1(), spl1.GetAngle1()+180, spl1.GetKasm1(), spl1.GetAngle1())); - VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(), - spl2.GetKasm1(), spl1.GetAngle2()+180); + const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl1.GetAngle2(), + spl2.GetKasm1(), spl1.GetAngle2()+180); splPath1->append(cutPoint); continue; } @@ -200,8 +190,8 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con { if (i == p2) { - VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180, spl2.GetKasm1(), - spl2.GetAngle1()); + const VSplinePoint cutPoint = VSplinePoint(*p, spl1.GetKasm2(), spl2.GetAngle1()+180, + spl2.GetKasm1(), spl2.GetAngle1()); splPath2->append(cutPoint); splPath2->append(VSplinePoint(splP2.P(), spl2.GetKasm2(), spl2.GetAngle2(), splP2.KAsm2(), spl2.GetAngle2()+180)); @@ -230,6 +220,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con { VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id, splPath2id, typeCreation); + Q_CHECK_PTR(point); scene->addItem(point); connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor); From dd78969c9c2d5556f58d9bdc6d697673a1a9a6fb Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 6 Mar 2014 16:09:22 +0200 Subject: [PATCH 33/60] Refactoring. --HG-- branch : feature --- src/tools/drawTools/vtoolcutspline.cpp | 10 ++-------- src/tools/drawTools/vtoolcutsplinepath.cpp | 10 ++-------- src/widgets/vsimplespline.cpp | 7 +++++++ src/widgets/vsimplespline.h | 1 + 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index 0e83bdfac..ee7608e94 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -189,14 +189,8 @@ void VToolCutSpline::ChangedActivDraw(const QString &newName) currentColor = Qt::gray; flag = false; } - - firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); - firstSpline->setAcceptHoverEvents(flag); - firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); - - secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); - secondSpline->setAcceptHoverEvents(flag); - secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + firstSpline->ChangedActivDraw(flag); + secondSpline->ChangedActivDraw(flag); VToolPoint::ChangedActivDraw(newName); } diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index d8f8a66cc..ab4d1159f 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -261,14 +261,8 @@ void VToolCutSplinePath::ChangedActivDraw(const QString &newName) currentColor = Qt::gray; flag = false; } - - firstSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); - firstSpline->setAcceptHoverEvents(flag); - firstSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); - - secondSpline->setFlag(QGraphicsItem::ItemIsSelectable, flag); - secondSpline->setAcceptHoverEvents(flag); - secondSpline->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + firstSpline->ChangedActivDraw(flag); + secondSpline->ChangedActivDraw(flag); VToolPoint::ChangedActivDraw(newName); } diff --git a/src/widgets/vsimplespline.cpp b/src/widgets/vsimplespline.cpp index 70d5c2c3f..c70488228 100644 --- a/src/widgets/vsimplespline.cpp +++ b/src/widgets/vsimplespline.cpp @@ -44,6 +44,13 @@ VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *f setAcceptHoverEvents(true); } +void VSimpleSpline::ChangedActivDraw(const bool &flag) +{ + setFlag(QGraphicsItem::ItemIsSelectable, flag); + setAcceptHoverEvents(flag); + setPen(QPen(*currentColor, toPixel(widthHairLine)/ *factor)); +} + void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) diff --git a/src/widgets/vsimplespline.h b/src/widgets/vsimplespline.h index 51045182e..05f2bc816 100644 --- a/src/widgets/vsimplespline.h +++ b/src/widgets/vsimplespline.h @@ -56,6 +56,7 @@ public: * @param parent parent object. */ VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor = nullptr, QObject *parent = 0); + void ChangedActivDraw(const bool &flag); signals: /** * @brief Choosed send id when clicked. From 29c6dd0057198426aa7ec2452f6597cb02932dbf Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 6 Mar 2014 16:35:28 +0200 Subject: [PATCH 34/60] Individual measurements table. --HG-- branch : feature --- .../schema/individual_measurements.xsd | 75 +++++++++++- share/tables/individual/indivindual_ru.vit | 115 ++++++++++-------- 2 files changed, 134 insertions(+), 56 deletions(-) diff --git a/share/resources/schema/individual_measurements.xsd b/share/resources/schema/individual_measurements.xsd index 0a267d53c..7336ffdae 100644 --- a/share/resources/schema/individual_measurements.xsd +++ b/share/resources/schema/individual_measurements.xsd @@ -27,6 +27,7 @@ + @@ -35,6 +36,7 @@ + @@ -43,6 +45,7 @@ + @@ -51,6 +54,7 @@ + @@ -65,6 +69,7 @@ + @@ -73,6 +78,7 @@ + @@ -81,6 +87,7 @@ + @@ -89,6 +96,7 @@ + @@ -97,6 +105,7 @@ + @@ -105,6 +114,7 @@ + @@ -113,6 +123,7 @@ + @@ -121,6 +132,7 @@ + @@ -129,6 +141,7 @@ + @@ -137,6 +150,7 @@ + @@ -145,6 +159,7 @@ + @@ -153,6 +168,7 @@ + @@ -161,6 +177,7 @@ + @@ -169,6 +186,7 @@ + @@ -177,6 +195,7 @@ + @@ -185,6 +204,7 @@ + @@ -193,6 +213,7 @@ + @@ -201,6 +222,7 @@ + @@ -209,6 +231,7 @@ + @@ -217,6 +240,7 @@ + @@ -225,6 +249,7 @@ + @@ -233,6 +258,7 @@ + @@ -241,6 +267,7 @@ + @@ -249,6 +276,7 @@ + @@ -257,6 +285,7 @@ + @@ -265,6 +294,7 @@ + @@ -273,6 +303,7 @@ + @@ -281,6 +312,7 @@ + @@ -289,6 +321,7 @@ + @@ -303,6 +336,7 @@ + @@ -311,14 +345,16 @@ + - + + @@ -327,6 +363,7 @@ + @@ -335,6 +372,7 @@ + @@ -343,6 +381,7 @@ + @@ -351,14 +390,16 @@ + - + + @@ -367,6 +408,7 @@ + @@ -375,6 +417,7 @@ + @@ -389,6 +432,7 @@ + @@ -397,6 +441,7 @@ + @@ -405,6 +450,7 @@ + @@ -419,6 +465,7 @@ + @@ -427,6 +474,7 @@ + @@ -435,6 +483,7 @@ + @@ -443,6 +492,7 @@ + @@ -451,6 +501,7 @@ + @@ -459,6 +510,7 @@ + @@ -467,6 +519,7 @@ + @@ -481,6 +534,7 @@ + @@ -489,14 +543,16 @@ + - + + @@ -511,22 +567,25 @@ + - + + - + + @@ -535,6 +594,7 @@ + @@ -543,6 +603,7 @@ + @@ -551,6 +612,7 @@ + @@ -559,6 +621,7 @@ + @@ -567,6 +630,7 @@ + @@ -575,6 +639,7 @@ + diff --git a/share/tables/individual/indivindual_ru.vit b/share/tables/individual/indivindual_ru.vit index 0b2e1b5fc..61d4e722e 100644 --- a/share/tables/individual/indivindual_ru.vit +++ b/share/tables/individual/indivindual_ru.vit @@ -10,82 +10,95 @@ mm - + - + - - - + + + - - + + - - + + - + + + - + - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - - - + + + + + + - - - + + + - - - - - - - + + + + + + + - - - + + - - - - - - - - - + + + + + + + + + From 24245bf7596a549452cd7b1b47d09960e5bb1c7a Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 6 Mar 2014 17:28:31 +0200 Subject: [PATCH 35/60] Cppcheck. --HG-- branch : feature --- src/geometry/vequidistant.cpp | 6 +++--- src/geometry/vequidistant.h | 6 +++--- src/tools/drawTools/vtoolcutsplinepath.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/geometry/vequidistant.cpp b/src/geometry/vequidistant.cpp index 285a6eecd..13c763c8d 100644 --- a/src/geometry/vequidistant.cpp +++ b/src/geometry/vequidistant.cpp @@ -229,7 +229,7 @@ QVector VEquidistant::CorrectEquidistantPoints(const QVector & } QPainterPath VEquidistant::Equidistant(QVector points, const Detail::Equidistant &eqv, - const qreal &width) const + const qreal &width) { QPainterPath ekv; QVector ekvPoints; @@ -364,7 +364,7 @@ QVector VEquidistant::GetReversePoint(const QVector &points) return reversePoints; } -QVector VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width) const +QVector VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width) { Q_ASSERT(width > 0); QVector points; @@ -413,7 +413,7 @@ QVector VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2 return points; } -QLineF VEquidistant::ParallelLine(const QLineF &line, qreal width) const +QLineF VEquidistant::ParallelLine(const QLineF &line, qreal width) { Q_ASSERT(width > 0); QLineF paralel = QLineF (SingleParallelPoint(line, 90, width), SingleParallelPoint(QLineF(line.p2(), line.p1()), diff --git a/src/geometry/vequidistant.h b/src/geometry/vequidistant.h index 2d261a0f4..13830858b 100644 --- a/src/geometry/vequidistant.h +++ b/src/geometry/vequidistant.h @@ -74,7 +74,7 @@ private: * @param width width of equidistant. * @return return painter path of equidistant. */ - QPainterPath Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width) const; + static QPainterPath Equidistant(QVector points, const Detail::Equidistant &eqv, const qreal &width); /** * @brief CheckLoops seek and delete loops in equidistant. * @param points vector of points of equidistant. @@ -94,14 +94,14 @@ private: * @param width width of equidistant. * @return vector of points. */ - QVector EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width) const; + static QVector EkvPoint(const QLineF &line1, const QLineF &line2, const qreal &width); /** * @brief ParallelLine create parallel line. * @param line starting line. * @param width width to parallel line. * @return parallel line. */ - QLineF ParallelLine(const QLineF &line, qreal width ) const; + static QLineF ParallelLine(const QLineF &line, qreal width ); /** * @brief SingleParallelPoint return point of parallel line. * @param line starting line. diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index ab4d1159f..138d4dd0b 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -119,8 +119,8 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con quint32 splPath1id = id + 1; quint32 splPath2id = id + 2; - const VSplinePoint splP1 = splPath->at(p1); - const VSplinePoint splP2 = splPath->at(p2); + VSplinePoint splP1 = splPath->at(p1); + VSplinePoint splP2 = splPath->at(p2); const VSpline spl1 = VSpline(splP1.P(), spl1p2, spl1p3, *p, splPath->getKCurve()); const VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve()); From 39d0e94cece1aa7a0b718d3c0defb1518aaad916 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 6 Mar 2014 17:31:36 +0200 Subject: [PATCH 36/60] Restore cursor after warning. --HG-- branch : feature --- src/mainwindow.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 315ef1196..563bbdbae 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -917,6 +917,9 @@ void MainWindow::Clear() ui->actionSave->setEnabled(false); ui->actionPattern_properties->setEnabled(false); SetEnableTool(false); +#ifndef QT_NO_CURSOR + QApplication::restoreOverrideCursor(); +#endif } void MainWindow::NewPattern() From d06bc590003e5e920a8d515b9691652531094319 Mon Sep 17 00:00:00 2001 From: dismine Date: Thu, 6 Mar 2014 17:35:24 +0200 Subject: [PATCH 37/60] Vera++. --HG-- branch : feature --- src/container/vcontainer.h | 2 +- src/dialogs/app/dialoghistory.cpp | 2 +- src/tablewindow.cpp | 2 +- src/tools/vtooluniondetails.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index e640f22d0..6124857ce 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -93,7 +93,7 @@ public: Q_CHECK_PTR(obj); return obj; } - catch(const std::bad_alloc &) + catch (const std::bad_alloc &) { throw VExceptionBadId(tr("Can't cast object"), id); return nullptr; diff --git a/src/dialogs/app/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp index ad0155a5b..cba05c601 100644 --- a/src/dialogs/app/dialoghistory.cpp +++ b/src/dialogs/app/dialoghistory.cpp @@ -277,7 +277,7 @@ QString DialogHistory::Record(const VToolRecord &tool) { const QString pName = data->GeometricObject(points.at(0).P().id())->name(); record = QString(tr("Curve point %1")).arg(pName); - if(points.size() > 1) + if (points.size() > 1) { const QString pName = data->GeometricObject(points.last().P().id())->name(); record.append(QString("_%1").arg(pName)); diff --git a/src/tablewindow.cpp b/src/tablewindow.cpp index 360494f6d..de0598f80 100644 --- a/src/tablewindow.cpp +++ b/src/tablewindow.cpp @@ -519,7 +519,7 @@ void TableWindow::PsFile(const QString &name) const //TODO delete parametr name and use last parameter in string list instead. void TableWindow::PdfToPs(const QString &name, const QStringList ¶ms) const -{ +{ #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(Qt::WaitCursor); #endif diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index 5a70fb16e..a0aa457cb 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -477,7 +477,7 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta qint32 pointsD2 = 0; //Keeps count points second detail, what we already add. if (typeCreation == Tool::FromGui) - { + { qint32 j = 0, i = 0; VDetail newDetail; do From e3f412567e2c99f21f287f138e5942bcafa3c6f7 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 10 Mar 2014 17:55:51 +0200 Subject: [PATCH 38/60] Initial commit for classes working with measurements tables. --HG-- branch : feature --- .../schema/individual_measurements.xsd | 144 ++++++++++++++++++ share/tables/individual/indivindual_ru.vit | 2 + .../app/dialogindividualmeasurements.ui | 10 +- src/dialogs/app/dialogstandardmeasurements.ui | 2 +- src/dialogs/dialogs.h | 3 + src/mainwindow.cpp | 39 ++++- src/xml/vindividualmeasurements.cpp | 33 ++++ src/xml/vindividualmeasurements.h | 40 +++++ src/xml/vstandardmeasurements.cpp | 33 ++++ src/xml/vstandardmeasurements.h | 40 +++++ src/xml/xml.pri | 8 +- 11 files changed, 345 insertions(+), 9 deletions(-) create mode 100644 src/xml/vindividualmeasurements.cpp create mode 100644 src/xml/vindividualmeasurements.h create mode 100644 src/xml/vstandardmeasurements.cpp create mode 100644 src/xml/vstandardmeasurements.h diff --git a/share/resources/schema/individual_measurements.xsd b/share/resources/schema/individual_measurements.xsd index 7336ffdae..98295c417 100644 --- a/share/resources/schema/individual_measurements.xsd +++ b/share/resources/schema/individual_measurements.xsd @@ -324,6 +324,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/tables/individual/indivindual_ru.vit b/share/tables/individual/indivindual_ru.vit index 61d4e722e..9f7ee6edf 100644 --- a/share/tables/individual/indivindual_ru.vit +++ b/share/tables/individual/indivindual_ru.vit @@ -58,6 +58,8 @@ + + diff --git a/src/dialogs/app/dialogindividualmeasurements.ui b/src/dialogs/app/dialogindividualmeasurements.ui index d2fc3ea04..f82c642cc 100644 --- a/src/dialogs/app/dialogindividualmeasurements.ui +++ b/src/dialogs/app/dialogindividualmeasurements.ui @@ -19,7 +19,7 @@ - Pattern peace name + Pattern piece name @@ -54,7 +54,9 @@ ... - + + + @@ -88,7 +90,9 @@ ... - + + + diff --git a/src/dialogs/app/dialogstandardmeasurements.ui b/src/dialogs/app/dialogstandardmeasurements.ui index 241c84fb2..c8c2b2f16 100644 --- a/src/dialogs/app/dialogstandardmeasurements.ui +++ b/src/dialogs/app/dialogstandardmeasurements.ui @@ -25,7 +25,7 @@ - Pattern peace name + Pattern piece name 0 diff --git a/src/dialogs/dialogs.h b/src/dialogs/dialogs.h index 99f4ec34e..325c096a1 100644 --- a/src/dialogs/dialogs.h +++ b/src/dialogs/dialogs.h @@ -54,5 +54,8 @@ #include "app/dialogincrements.h" #include "app/configdialog.h" #include "app/dialogpatternproperties.h" +#include "app/dialogmeasurements.h" +#include "app/dialogindividualmeasurements.h" +#include "app/dialogstandardmeasurements.h" #endif // DIALOGS_H diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 563bbdbae..fb05be135 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -114,10 +114,43 @@ MainWindow::MainWindow(QWidget *parent) void MainWindow::ActionNewDraw() { - const QString nameDraw = PatternPieceName(QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1)); - if (nameDraw.isEmpty()) + QString nameDraw; + if (comboBoxDraws->count() == 0) { - return; + DialogMeasurements measurements(this); + measurements.exec(); + if (measurements.type() == Measurements::Standard) + { + DialogStandardMeasurements stMeasurements(this); + if (stMeasurements.exec() == QDialog::Accepted) + { + nameDraw = stMeasurements.name(); + } + else + { + return; + } + } + else + { + DialogIndividualMeasurements indMeasurements(this); + if (indMeasurements.exec() == QDialog::Accepted) + { + nameDraw = indMeasurements.name(); + } + else + { + return; + } + } + } + else + { + nameDraw = PatternPieceName(QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1)); + if (nameDraw.isEmpty()) + { + return; + } } if (doc->appendDraw(nameDraw) == false) { diff --git a/src/xml/vindividualmeasurements.cpp b/src/xml/vindividualmeasurements.cpp new file mode 100644 index 000000000..94bd3d812 --- /dev/null +++ b/src/xml/vindividualmeasurements.cpp @@ -0,0 +1,33 @@ +/************************************************************************ + ** + ** @file vindividualmeasurements.cpp + ** @author Roman Telezhinsky + ** @date 8 3, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 "vindividualmeasurements.h" + +VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data) +{ +} diff --git a/src/xml/vindividualmeasurements.h b/src/xml/vindividualmeasurements.h new file mode 100644 index 000000000..f2cf6fda6 --- /dev/null +++ b/src/xml/vindividualmeasurements.h @@ -0,0 +1,40 @@ +/************************************************************************ + ** + ** @file vindividualmeasurements.h + ** @author Roman Telezhinsky + ** @date 8 3, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 VINDIVIDUALMEASUREMENTS_H +#define VINDIVIDUALMEASUREMENTS_H + +#include "vdomdocument.h" + +class VIndividualMeasurements:public VDomDocument +{ +public: + VIndividualMeasurements(VContainer *data); +}; + +#endif // VINDIVIDUALMEASUREMENTS_H diff --git a/src/xml/vstandardmeasurements.cpp b/src/xml/vstandardmeasurements.cpp new file mode 100644 index 000000000..1aaf4cf46 --- /dev/null +++ b/src/xml/vstandardmeasurements.cpp @@ -0,0 +1,33 @@ +/************************************************************************ + ** + ** @file vstandardmeasurements.cpp + ** @author Roman Telezhinsky + ** @date 8 3, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 "vstandardmeasurements.h" + +VStandardMeasurements::VStandardMeasurements(VContainer *data):VDomDocument(data) +{ +} diff --git a/src/xml/vstandardmeasurements.h b/src/xml/vstandardmeasurements.h new file mode 100644 index 000000000..003af3625 --- /dev/null +++ b/src/xml/vstandardmeasurements.h @@ -0,0 +1,40 @@ +/************************************************************************ + ** + ** @file vstandardmeasurements.h + ** @author Roman Telezhinsky + ** @date 8 3, 2014 + ** + ** @brief + ** @copyright + ** This source code is part of the Valentine project, a pattern making + ** program, whose allow create and modeling patterns of clothing. + ** Copyright (C) 2013 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 VSTANDARDMEASUREMENTS_H +#define VSTANDARDMEASUREMENTS_H + +#include "vdomdocument.h" + +class VStandardMeasurements:public VDomDocument +{ +public: + VStandardMeasurements(VContainer *data); +}; + +#endif // VSTANDARDMEASUREMENTS_H diff --git a/src/xml/xml.pri b/src/xml/xml.pri index 08b77844d..fd858fb2b 100644 --- a/src/xml/xml.pri +++ b/src/xml/xml.pri @@ -1,9 +1,13 @@ HEADERS += \ src/xml/vtoolrecord.h \ src/xml/vdomdocument.h \ - src/xml/vpattern.h + src/xml/vpattern.h \ + src/xml/vstandardmeasurements.h \ + src/xml/vindividualmeasurements.h SOURCES += \ src/xml/vtoolrecord.cpp \ src/xml/vdomdocument.cpp \ - src/xml/vpattern.cpp + src/xml/vpattern.cpp \ + src/xml/vstandardmeasurements.cpp \ + src/xml/vindividualmeasurements.cpp From db2a3e9ca905e78089bf904c7a7d110ee805c50c Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 10 Mar 2014 18:22:55 +0200 Subject: [PATCH 39/60] Operator new throw exception bad_alloc, so does not make sense to use Q_CHECK_PTR macros for check. --HG-- branch : feature --- src/container/vcontainer.h | 1 - src/dialogs/app/configdialog.cpp | 12 -------- src/dialogs/app/dialoghistory.cpp | 2 -- src/dialogs/app/dialogincrements.cpp | 2 -- src/dialogs/app/pages.cpp | 33 ---------------------- src/dialogs/tools/dialogtool.cpp | 1 + src/exception/vexception.cpp | 1 - src/mainwindow.cpp | 8 ------ src/tools/drawTools/vtoolarc.cpp | 1 - src/tools/drawTools/vtoolcutarc.cpp | 8 ------ src/tools/drawTools/vtoolcutspline.cpp | 8 ------ src/tools/drawTools/vtoolcutsplinepath.cpp | 6 ---- src/tools/drawTools/vtoolline.cpp | 1 - src/tools/drawTools/vtoolpoint.cpp | 3 -- src/tools/drawTools/vtoolspline.cpp | 1 - src/tools/drawTools/vtoolsplinepath.cpp | 1 - src/tools/nodeDetails/vnodearc.cpp | 1 - src/tools/nodeDetails/vnodepoint.cpp | 1 - src/tools/nodeDetails/vnodesplinepath.cpp | 1 - src/tools/vtooldetail.h | 1 - src/tools/vtooluniondetails.cpp | 22 --------------- src/widgets/doubledelegate.cpp | 1 - src/widgets/textdelegate.cpp | 2 -- src/widgets/vmaingraphicsview.cpp | 1 - src/xml/vpattern.cpp | 8 +----- 25 files changed, 2 insertions(+), 125 deletions(-) diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index 6124857ce..03c2e66cd 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -65,7 +65,6 @@ public: void CopyGObject(const VContainer &data, const quint32 &id) { T *obj = new T(*data.GeometricObject(id)); - Q_CHECK_PTR(obj); UpdateGObject(id, obj); } /** diff --git a/src/dialogs/app/configdialog.cpp b/src/dialogs/app/configdialog.cpp index dd287a059..a5e1a1244 100644 --- a/src/dialogs/app/configdialog.cpp +++ b/src/dialogs/app/configdialog.cpp @@ -32,7 +32,6 @@ ConfigDialog::ConfigDialog(QWidget *parent) : QDialog(parent), contentsWidget(nullptr), pagesWidget(nullptr), configurationPage(nullptr), patternPage(nullptr) { contentsWidget = new QListWidget; - Q_CHECK_PTR(contentsWidget); contentsWidget->setViewMode(QListView::IconMode); contentsWidget->setIconSize(QSize(96, 84)); contentsWidget->setMovement(QListView::Static); @@ -41,20 +40,14 @@ ConfigDialog::ConfigDialog(QWidget *parent) : contentsWidget->setSpacing(12); pagesWidget = new QStackedWidget; - Q_CHECK_PTR(pagesWidget); configurationPage = new ConfigurationPage(); - Q_CHECK_PTR(configurationPage); pagesWidget->addWidget(configurationPage); patternPage = new PatternPage(); - Q_CHECK_PTR(patternPage); pagesWidget->addWidget(patternPage); QPushButton *applyButton = new QPushButton(tr("Apply")); - Q_CHECK_PTR(applyButton); QPushButton *canselButton = new QPushButton(tr("&Cancel")); - Q_CHECK_PTR(canselButton); QPushButton *okButton = new QPushButton(tr("&Ok")); - Q_CHECK_PTR(okButton); createIcons(); contentsWidget->setCurrentRow(0); @@ -64,19 +57,16 @@ ConfigDialog::ConfigDialog(QWidget *parent) : connect(okButton, &QPushButton::clicked, this, &ConfigDialog::Ok); QHBoxLayout *horizontalLayout = new QHBoxLayout; - Q_CHECK_PTR(horizontalLayout); horizontalLayout->addWidget(contentsWidget); horizontalLayout->addWidget(pagesWidget, 1); QHBoxLayout *buttonsLayout = new QHBoxLayout; - Q_CHECK_PTR(buttonsLayout); buttonsLayout->addStretch(1); buttonsLayout->addWidget(applyButton); buttonsLayout->addWidget(canselButton); buttonsLayout->addWidget(okButton); QVBoxLayout *mainLayout = new QVBoxLayout; - Q_CHECK_PTR(mainLayout); mainLayout->addLayout(horizontalLayout); mainLayout->addStretch(1); mainLayout->addSpacing(12); @@ -107,14 +97,12 @@ void ConfigDialog::closeEvent(QCloseEvent *event) void ConfigDialog::createIcons() { QListWidgetItem *configButton = new QListWidgetItem(contentsWidget); - Q_CHECK_PTR(configButton); configButton->setIcon(QIcon("://icon/config.png")); configButton->setText(tr("Configuration")); configButton->setTextAlignment(Qt::AlignHCenter); configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); QListWidgetItem *patternButton = new QListWidgetItem(contentsWidget); - Q_CHECK_PTR(patternButton); patternButton->setIcon(QIcon("://icon/pattern_config.png")); patternButton->setText(tr("Pattern")); patternButton->setTextAlignment(Qt::AlignHCenter); diff --git a/src/dialogs/app/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp index cba05c601..04385ea9f 100644 --- a/src/dialogs/app/dialoghistory.cpp +++ b/src/dialogs/app/dialoghistory.cpp @@ -140,14 +140,12 @@ void DialogHistory::FillTable() { QTableWidgetItem *item = new QTableWidgetItem(QString()); - Q_CHECK_PTR(item); item->setTextAlignment(Qt::AlignHCenter); item->setData(Qt::UserRole, tool.getId()); ui->tableWidget->setItem(currentRow, 0, item); } QTableWidgetItem *item = new QTableWidgetItem(historyRecord); - Q_CHECK_PTR(item); item->setFont(QFont("Times", 12, QFont::Bold)); item->setFlags(item->flags() ^ Qt::ItemIsEditable); ui->tableWidget->setItem(currentRow, 1, item); diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index 65a530856..38cda7ffe 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -39,10 +39,8 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par { ui->setupUi(this); TextDelegate *textDelegate = new TextDelegate(ui->tableWidgetIncrement); - Q_CHECK_PTR(textDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate); DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement); - Q_CHECK_PTR(doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate); diff --git a/src/dialogs/app/pages.cpp b/src/dialogs/app/pages.cpp index 3d12cbe90..8dcf9c239 100644 --- a/src/dialogs/app/pages.cpp +++ b/src/dialogs/app/pages.cpp @@ -71,18 +71,14 @@ QGroupBox *ConfigurationPage::SaveGroup() QApplication::applicationName()); QGroupBox *saveGroup = new QGroupBox(tr("Save")); - Q_CHECK_PTR(saveGroup); autoSaveCheck = new QCheckBox(tr("Auto-save modified pattern")); - Q_CHECK_PTR(autoSaveCheck); bool autoSaveValue = settings.value("configuration/autosave/state", 1).toBool(); autoSaveCheck->setChecked(autoSaveValue); QLabel *intervalLabel = new QLabel(tr("Interval:")); - Q_CHECK_PTR(intervalLabel); autoTime = new QSpinBox(); - Q_CHECK_PTR(autoTime); bool ok = true; qint32 autoTimeValue = settings.value("configuration/autosave/time", 5).toInt(&ok); if (ok == false) @@ -94,13 +90,11 @@ QGroupBox *ConfigurationPage::SaveGroup() autoTime->setSuffix(tr("min")); QHBoxLayout *autosaveLayout = new QHBoxLayout; - Q_CHECK_PTR(autosaveLayout); autosaveLayout->addWidget(autoSaveCheck); autosaveLayout->addWidget(intervalLabel); autosaveLayout->addWidget(autoTime); QVBoxLayout *saveLayout = new QVBoxLayout; - Q_CHECK_PTR(saveLayout); saveLayout->addLayout(autosaveLayout); saveGroup->setLayout(saveLayout); return saveGroup; @@ -112,13 +106,8 @@ QGroupBox *ConfigurationPage::LangGroup() QApplication::applicationName()); QGroupBox *langGroup = new QGroupBox(tr("Language")); - Q_CHECK_PTR(langGroup); - QLabel *guiLabel = new QLabel(tr("GUI language")); - Q_CHECK_PTR(guiLabel); - langCombo = new QComboBox; - Q_CHECK_PTR(langCombo); // format systems language QString defaultLocale = QLocale::system().name(); // e.g. "de_DE" @@ -158,26 +147,21 @@ QGroupBox *ConfigurationPage::LangGroup() &ConfigurationPage::LangChenged); QHBoxLayout *guiLangLayout = new QHBoxLayout; - Q_CHECK_PTR(guiLangLayout); guiLangLayout->addWidget(guiLabel); guiLangLayout->addWidget(langCombo); QLabel *separatorLabel = new QLabel(tr("Decimal separator parts")); - Q_CHECK_PTR(separatorLabel); osOptionCheck = new QCheckBox(tr("With OS options (.)")); - Q_CHECK_PTR(osOptionCheck); //bool osOptionValue = settings.value("configuration/osSeparator", 1).toBool(); //osOptionCheck->setChecked(osOptionValue); osOptionCheck->setEnabled(false); QHBoxLayout *separatorLayout = new QHBoxLayout; - Q_CHECK_PTR(separatorLayout); separatorLayout->addWidget(separatorLabel); separatorLayout->addWidget(osOptionCheck); QVBoxLayout *langLayout = new QVBoxLayout; - Q_CHECK_PTR(langLayout); langLayout->addLayout(guiLangLayout); langLayout->addLayout(separatorLayout); langGroup->setLayout(langLayout); @@ -215,13 +199,9 @@ QGroupBox *PatternPage::UserGroup() QApplication::applicationName()); QGroupBox *userGroup = new QGroupBox(tr("User")); - Q_CHECK_PTR(userGroup); - QLabel *nameLabel = new QLabel(tr("User name")); - Q_CHECK_PTR(nameLabel); userName = new QLineEdit; - Q_CHECK_PTR(userName); #ifdef Q_OS_WIN QString user = settings.value("pattern/user", QString::fromLocal8Bit(qgetenv("USERNAME").constData())).toString(); #else @@ -230,12 +210,10 @@ QGroupBox *PatternPage::UserGroup() userName->setText(user); QHBoxLayout *nameLayout = new QHBoxLayout; - Q_CHECK_PTR(nameLayout); nameLayout->addWidget(nameLabel); nameLayout->addWidget(userName); QVBoxLayout *userLayout = new QVBoxLayout; - Q_CHECK_PTR(userLayout); userLayout->addLayout(nameLayout); userGroup->setLayout(userLayout); return userGroup; @@ -247,20 +225,16 @@ QGroupBox *PatternPage::GraphOutputGroup() // QApplication::applicationName()); QGroupBox *graphOutputGroup = new QGroupBox(tr("Graphical output")); - Q_CHECK_PTR(graphOutputGroup); graphOutputCheck = new QCheckBox(tr("Use antialiasing")); - Q_CHECK_PTR(graphOutputCheck); //bool graphOutputValue = settings.value("pattern/graphicalOutput", 1).toBool(); //graphOutputCheck->setChecked(graphOutputValue); graphOutputCheck->setEnabled(false); QHBoxLayout *graphLayout = new QHBoxLayout; - Q_CHECK_PTR(graphLayout); graphLayout->addWidget(graphOutputCheck); QVBoxLayout *graphOutputLayout = new QVBoxLayout; - Q_CHECK_PTR(graphOutputLayout); graphOutputLayout->addLayout(graphLayout); graphOutputGroup->setLayout(graphOutputLayout); return graphOutputGroup; @@ -272,13 +246,8 @@ QGroupBox *PatternPage::UndoneGroup() // QApplication::applicationName()); QGroupBox *undoneGroup = new QGroupBox(tr("Undone")); - Q_CHECK_PTR(undoneGroup); - QLabel *undoneLabel = new QLabel(tr("Count steps")); - Q_CHECK_PTR(undoneLabel); - undoneCount = new QSpinBox; - Q_CHECK_PTR(undoneCount); // bool ok = true; // qint32 count = settings.value("pattern/undone", 100).toInt(&ok); // if (ok == false) @@ -289,12 +258,10 @@ QGroupBox *PatternPage::UndoneGroup() undoneCount->setEnabled(false); QHBoxLayout *countLayout = new QHBoxLayout; - Q_CHECK_PTR(countLayout); countLayout->addWidget(undoneLabel); countLayout->addWidget(undoneCount); QVBoxLayout *undoneLayout = new QVBoxLayout; - Q_CHECK_PTR(undoneLayout); undoneLayout->addLayout(countLayout); undoneGroup->setLayout(undoneLayout); return undoneGroup; diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index 496c52be6..f39f773d0 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -276,6 +276,7 @@ void DialogTool::PutValHere(QLineEdit *lineEdit, QListWidget *listWidget) Q_CHECK_PTR(lineEdit); Q_CHECK_PTR(listWidget); QListWidgetItem *item = listWidget->currentItem(); + Q_CHECK_PTR(item); int pos = lineEdit->cursorPosition(); lineEdit->setText(lineEdit->text().insert(lineEdit->cursorPosition(), item->text())); lineEdit->setFocus(); diff --git a/src/exception/vexception.cpp b/src/exception/vexception.cpp index 9d76e95be..35216898b 100644 --- a/src/exception/vexception.cpp +++ b/src/exception/vexception.cpp @@ -56,7 +56,6 @@ void VException::CriticalMessageBox(const QString &situation, QWidget * parent) } msgBox.setIcon(QMessageBox::Critical); QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); - Q_CHECK_PTR(horizontalSpacer); QGridLayout* layout = static_cast(msgBox.layout()); Q_CHECK_PTR(layout); layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fb05be135..b47bf60ef 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -166,7 +166,6 @@ void MainWindow::ActionNewDraw() const quint32 id = pattern->AddGObject(new VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5, 10)); VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Tool::FromGui); - Q_CHECK_PTR(spoint); sceneDraw->addItem(spoint); connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem); connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); @@ -218,7 +217,6 @@ void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &curso view->setCursor(cur); helpLabel->setText(toolTip); dialogTool = new Dialog(pattern, this); - Q_CHECK_PTR(dialogTool); connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChoosedObject); connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot); connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip); @@ -1001,7 +999,6 @@ void MainWindow::ActionTable(bool checked) if (checked) { dialogTable = new DialogIncrements(pattern, doc, this); - Q_CHECK_PTR(dialogTable); connect(dialogTable, &DialogIncrements::DialogClosed, this, &MainWindow::ClosedActionTable); dialogTable->show(); } @@ -1024,7 +1021,6 @@ void MainWindow::ActionHistory(bool checked) if (checked) { dialogHistory = new DialogHistory(pattern, doc, this); - Q_CHECK_PTR(dialogHistory); dialogHistory->setWindowFlags(Qt::Window); connect(dialogHistory, &DialogHistory::DialogClosed, this, &MainWindow::ClosedActionHistory); dialogHistory->show(); @@ -1284,7 +1280,6 @@ void MainWindow::CreateMenus() ui->menuFile->insertAction(ui->actionExit, recentFileActs[i]); } separatorAct = new QAction(this); - Q_CHECK_PTR(separatorAct); separatorAct->setSeparator(true); ui->menuFile->insertAction(ui->actionExit, separatorAct); UpdateRecentFileActions(); @@ -1315,7 +1310,6 @@ void MainWindow::CreateActions() for (int i = 0; i < MaxRecentFiles; ++i) { recentFileActs[i] = new QAction(this); - Q_CHECK_PTR(recentFileActs[i]); recentFileActs[i]->setVisible(false); connect(recentFileActs[i], &QAction::triggered, this, &MainWindow::OpenRecentFile); } @@ -1340,7 +1334,6 @@ void MainWindow::InitAutoSave() } autoSaveTimer = new QTimer(this); - Q_CHECK_PTR(autoSaveTimer); autoSaveTimer->setTimerType(Qt::VeryCoarseTimer); connect(autoSaveTimer, &QTimer::timeout, this, &MainWindow::AutoSavePattern); autoSaveTimer->start(autoTime*60000); @@ -1350,7 +1343,6 @@ void MainWindow::InitAutoSave() QString MainWindow::PatternPieceName(const QString &text) { QInputDialog *dlg = new QInputDialog(this); - Q_CHECK_PTR(dlg); dlg->setInputMode( QInputDialog::TextInput ); dlg->setLabelText(tr("Pattern piece:")); dlg->setTextEchoMode(QLineEdit::Normal); diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index f7e504b51..04c4687cb 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -112,7 +112,6 @@ void VToolArc::Create(const quint32 _id, const quint32 ¢er, const QString &r VPointF c = *data->GeometricObject(center); VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 ); - Q_CHECK_PTR(arc); quint32 id = _id; if (typeCreation == Tool::FromGui) { diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index d03df03ee..a16a9f87c 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -44,13 +44,11 @@ VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, con Q_ASSERT_X(arc2id > 0, Q_FUNC_INFO, "arc2id <= 0"); firstArc = new VSimpleArc(arc1id, ¤tColor, &factor); - Q_CHECK_PTR(firstArc); RefreshArc(firstArc, arc1id, SimpleArc::ForthPoint); firstArc->setParentItem(this); connect(firstArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed); secondArc = new VSimpleArc(arc2id, ¤tColor, &factor); - Q_CHECK_PTR(secondArc); RefreshArc(secondArc, arc2id, SimpleArc::FirstPoint); secondArc->setParentItem(this); connect(secondArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed); @@ -108,32 +106,26 @@ void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QStr if (typeCreation == Tool::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p); id = data->AddGObject(p); VArc * ar1 = new VArc(arc1); - Q_CHECK_PTR(ar1); arc1id = data->AddGObject(ar1); VArc * ar2 = new VArc(arc2); - Q_CHECK_PTR(ar2); arc2id = data->AddGObject(ar2); } else { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p); data->UpdateGObject(id, p); arc1id = id + 1; arc2id = id + 2; VArc * ar1 = new VArc(arc1); - Q_CHECK_PTR(ar1); data->UpdateGObject(arc1id, ar1); VArc * ar2 = new VArc(arc2); - Q_CHECK_PTR(ar2); data->UpdateGObject(arc2id, ar2); if (parse != Document::FullParse) diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index ee7608e94..c806746e2 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -44,13 +44,11 @@ VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &i Q_ASSERT_X(spl2id > 0, Q_FUNC_INFO, "spl2id <= 0"); firstSpline = new VSimpleSpline(spl1id, ¤tColor, &factor); - Q_CHECK_PTR(firstSpline); RefreshSpline(firstSpline, spl1id, SimpleSpline::ForthPoint); firstSpline->setParentItem(this); connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed); secondSpline = new VSimpleSpline(spl2id, ¤tColor, &factor); - Q_CHECK_PTR(secondSpline); RefreshSpline(secondSpline, spl2id, SimpleSpline::FirstPoint); secondSpline->setParentItem(this); connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed); @@ -108,35 +106,29 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, if (typeCreation == Tool::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p); id = data->AddGObject(p); VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); - Q_CHECK_PTR(spline1); spl1id = data->AddGObject(spline1); data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength())); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); - Q_CHECK_PTR(spline2); spl2id = data->AddGObject(spline2); data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength())); } else { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p); data->UpdateGObject(id, p); spl1id = id + 1; spl2id = id + 2; VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); - Q_CHECK_PTR(spline1); data->UpdateGObject(spl1id, spline1); data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength())); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); - Q_CHECK_PTR(spline2); data->UpdateGObject(spl2id, spline2); data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength())); diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index 138d4dd0b..e9eaa2647 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -45,13 +45,11 @@ VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qu Q_ASSERT_X(splPath2id > 0, Q_FUNC_INFO, "spl2id <= 0"); firstSpline = new VSimpleSpline(splPath1id, ¤tColor, &factor); - Q_CHECK_PTR(firstSpline); RefreshSpline(firstSpline, splPath1id, SimpleSpline::ForthPoint); firstSpline->setParentItem(this); connect(firstSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed); secondSpline = new VSimpleSpline(splPath2id, ¤tColor, &factor); - Q_CHECK_PTR(secondSpline); RefreshSpline(secondSpline, splPath2id, SimpleSpline::FirstPoint); secondSpline->setParentItem(this); connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed); @@ -106,7 +104,6 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con const QPointF point = splPath->CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3); VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - Q_CHECK_PTR(p); if (typeCreation == Tool::FromGui) { id = data->AddGObject(p); @@ -125,9 +122,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con const VSpline spl2 = VSpline(*p, spl2p2, spl2p3, splP2.P(), splPath->getKCurve()); VSplinePath *splPath1 = new VSplinePath(); - Q_CHECK_PTR(splPath1); VSplinePath *splPath2 = new VSplinePath(); - Q_CHECK_PTR(splPath2); if (typeCreation == Tool::FromGui) { for (qint32 i = 0; i < splPath->CountPoint(); i++) @@ -220,7 +215,6 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con { VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id, splPath2id, typeCreation); - Q_CHECK_PTR(point); scene->addItem(point); connect(point, &VToolPoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(scene, &VMainGraphicsScene::NewFactor, point, &VToolPoint::SetFactor); diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index 7a03394fd..938855141 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -104,7 +104,6 @@ void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quin if (parse == Document::FullParse) { VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, typeCreation); - Q_CHECK_PTR(line); scene->addItem(line); connect(line, &VToolLine::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(scene, &VMainGraphicsScene::NewFactor, line, &VToolLine::SetFactor); diff --git a/src/tools/drawTools/vtoolpoint.cpp b/src/tools/drawTools/vtoolpoint.cpp index cb3b2c32a..4b63db3b8 100644 --- a/src/tools/drawTools/vtoolpoint.cpp +++ b/src/tools/drawTools/vtoolpoint.cpp @@ -34,11 +34,9 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0) { namePoint = new VGraphicsSimpleTextItem(this); - Q_CHECK_PTR(namePoint); connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu); namePoint->setBrush(Qt::black); lineName = new QGraphicsLineItem(this); - Q_CHECK_PTR(lineName); lineName->setPen(QPen(Qt::black)); connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition); this->setBrush(QBrush(Qt::NoBrush)); @@ -51,7 +49,6 @@ VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsIte void VToolPoint::NameChangePosition(const QPointF &pos) { VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject(id)); - Q_CHECK_PTR(point); QPointF p = pos - this->pos(); point->setMx(p.x()); point->setMy(p.y()); diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index ef942471f..09fbf4381 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -111,7 +111,6 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4 VPointF point1 = *data->GeometricObject(p1); VPointF point4 = *data->GeometricObject(p4); VSpline *spline = new VSpline(point1, point4, angle1, angle2, kAsm1, kAsm2, kCurve); - Q_CHECK_PTR(spline); quint32 id = _id; if (typeCreation == Tool::FromGui) { diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index 2f8bdc246..3f4df7ef0 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -87,7 +87,6 @@ void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPat DialogSplinePath *dialogTool = qobject_cast(dialog); Q_CHECK_PTR(dialogTool); VSplinePath *path = new VSplinePath(dialogTool->GetPath()); - Q_CHECK_PTR(path); for (qint32 i = 0; i < path->CountPoint(); ++i) { doc->IncrementReferens((*path)[i].P().id()); diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index 9706f4d42..e2d55ef9f 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -57,7 +57,6 @@ void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc if (parse == Document::FullParse) { VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent); - Q_CHECK_PTR(arc); doc->AddTool(id, arc); if (idTool != 0) { diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index f11fb05e3..cf21cc2e1 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -68,7 +68,6 @@ void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idP //TODO Need create garbage collector and remove all nodes, what we don't use. //Better check garbage before each saving file. Check only modeling tags. VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent); - Q_CHECK_PTR(point); doc->AddTool(id, point); if (idTool != 0) { diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index d707ce348..5470e1cd0 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -59,7 +59,6 @@ void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint3 if (parse == Document::FullParse) { VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent); - Q_CHECK_PTR(splPath); doc->AddTool(id, splPath); const VSplinePath *path = data->GeometricObject(id); const QVector *points = path->GetPoint(); diff --git a/src/tools/vtooldetail.h b/src/tools/vtooldetail.h index c15d4da54..21f84bb48 100644 --- a/src/tools/vtooldetail.h +++ b/src/tools/vtooldetail.h @@ -67,7 +67,6 @@ public: { //We can't use exist object. Need create new. T *node = new T(*data->GeometricObject(id)); - Q_CHECK_PTR(node); node->setMode(Draw::Modeling); return data->AddGObject(node); } diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index a0aa457cb..31c68715c 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -72,13 +72,11 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer else { VPointF *point = new VPointF(*data->GeometricObject(det.at(i).getId())); - Q_CHECK_PTR(point); point->setMode(Draw::Modeling); BiasRotatePoint(point, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); idObject = data->AddGObject(point); VPointF *point1 = new VPointF(*point); - Q_CHECK_PTR(point1); point1->setMode(Draw::Modeling); id = data->AddGObject(point1); VNodePoint::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); @@ -99,7 +97,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer VPointF p2 = VPointF(arc->GetP2().x(), arc->GetP2().y(), "A", 0, 0); BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *center = new VPointF(arc->GetCenter()); - Q_CHECK_PTR(center); BiasRotatePoint(center, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); @@ -111,12 +108,10 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle())); - Q_CHECK_PTR(arc1); arc1->setMode(Draw::Modeling); idObject = data->AddGObject(arc1); VArc *arc2 = new VArc(*arc1); - Q_CHECK_PTR(arc2); arc2->setMode(Draw::Modeling); id = data->AddGObject(arc2); @@ -135,7 +130,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer const VSpline *spline = data->GeometricObject(det.at(i).getId()); VPointF *p1 = new VPointF(spline->GetP1()); - Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); quint32 idP1 = data->AddGObject(p1); @@ -146,17 +140,14 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *p4 = new VPointF(spline->GetP4()); - Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); quint32 idP4 = data->AddGObject(p4); VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, Draw::Modeling); - Q_CHECK_PTR(spl); idObject = data->AddGObject(spl); VSpline *spl1 = new VSpline(*spl); - Q_CHECK_PTR(spl1); spl1->setMode(Draw::Modeling); id = data->AddGObject(spl1); VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); @@ -172,7 +163,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer else { VSplinePath *path = new VSplinePath(); - Q_CHECK_PTR(path); path->setMode(Draw::Modeling); const VSplinePath *splinePath = data->GeometricObject(det.at(i).getId()); qint32 k = splinePath->getMaxCountPoints(); @@ -183,7 +173,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer splinePath->at(i).KAsm1(), splinePath->getKCurve()); VPointF *p1 = new VPointF(spline.GetP1()); - Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); quint32 idP1 = data->AddGObject(p1); @@ -198,7 +187,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer angle); VPointF *p4 = new VPointF(spline.GetP4()); - Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); quint32 idP4 = data->AddGObject(p4); @@ -221,7 +209,6 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer idObject = data->AddGObject(path); VSplinePath *path1 = new VSplinePath(*path); - Q_CHECK_PTR(path1); path1->setMode(Draw::Modeling); id = data->AddGObject(path1); VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); @@ -246,7 +233,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { VPointF *point = new VPointF(*data->GeometricObject(det.at(i).getId())); - Q_CHECK_PTR(point); point->setMode(Draw::Modeling); BiasRotatePoint(point, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; @@ -266,7 +252,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, VPointF p2 = VPointF(arc->GetP2()); BiasRotatePoint(&p2, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *center = new VPointF(arc->GetCenter()); - Q_CHECK_PTR(center); BiasRotatePoint(center, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); @@ -277,7 +262,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, data->UpdateGObject(idDetail+idCount, center); VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle())); - Q_CHECK_PTR(arc1); arc1->setMode(Draw::Modeling); ++idCount; data->UpdateGObject(idDetail+idCount, arc1); @@ -293,7 +277,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VSpline *spline = data->GeometricObject(det.at(i).getId()); VPointF *p1 = new VPointF(spline->GetP1()); - Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; data->UpdateGObject(idDetail+idCount, p1); @@ -305,7 +288,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, BiasRotatePoint(&p3, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); VPointF *p4 = new VPointF(spline->GetP4()); - Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; data->UpdateGObject(idDetail+idCount, p4); @@ -313,7 +295,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, Draw::Modeling); - Q_CHECK_PTR(spl); ++idCount; data->UpdateGObject(idDetail+idCount, spl); @@ -326,7 +307,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { VSplinePath *path = new VSplinePath(); - Q_CHECK_PTR(path); path->setMode(Draw::Modeling); const VSplinePath *splinePath = data->GeometricObject(det.at(i).getId()); Q_CHECK_PTR(splinePath); @@ -338,7 +318,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, splinePath->at(i).KAsm1(), splinePath->getKCurve()); VPointF *p1 = new VPointF(spline.GetP1()); - Q_CHECK_PTR(p1); BiasRotatePoint(p1, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; @@ -354,7 +333,6 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, angle); VPointF *p4 = new VPointF(spline.GetP4()); - Q_CHECK_PTR(p4); BiasRotatePoint(p4, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; diff --git a/src/widgets/doubledelegate.cpp b/src/widgets/doubledelegate.cpp index 1b2bccf23..596bbbd91 100644 --- a/src/widgets/doubledelegate.cpp +++ b/src/widgets/doubledelegate.cpp @@ -37,7 +37,6 @@ QWidget *DoubleSpinBoxDelegate::createEditor(QWidget *parent, const QStyleOption Q_UNUSED(option); Q_UNUSED(index); QDoubleSpinBox *editor = new QDoubleSpinBox(parent); - Q_CHECK_PTR(editor); editor->setMinimum(-10000.0); editor->setMaximum(10000.0); connect(editor, &QDoubleSpinBox::editingFinished, this, &DoubleSpinBoxDelegate::commitAndCloseEditor); diff --git a/src/widgets/textdelegate.cpp b/src/widgets/textdelegate.cpp index a073dadf7..45c57d6c6 100644 --- a/src/widgets/textdelegate.cpp +++ b/src/widgets/textdelegate.cpp @@ -41,10 +41,8 @@ QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem Q_UNUSED(option); Q_UNUSED(index); QLineEdit *editor = new QLineEdit(parent); - Q_CHECK_PTR(editor); QRegExp re("^(([^+ -/()\\^*%:;\"\'=.,><0-9]){1,1}[^+ -/()\\^*%:;\"\'=><]([0-9]){0,}){0,}$"); QRegExpValidator *v = new QRegExpValidator(re); - Q_CHECK_PTR(v); editor->setValidator( v ); connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor); return editor; diff --git a/src/widgets/vmaingraphicsview.cpp b/src/widgets/vmaingraphicsview.cpp index ada2d8c81..2b972be03 100644 --- a/src/widgets/vmaingraphicsview.cpp +++ b/src/widgets/vmaingraphicsview.cpp @@ -54,7 +54,6 @@ void VMainGraphicsView::wheelEvent(QWheelEvent *event) } QTimeLine *anim = new QTimeLine(300, this); - Q_CHECK_PTR(anim); anim->setUpdateInterval(20); if (QApplication::keyboardModifiers() == Qt::ControlModifier) diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index 3c265a8e5..f3a8b64e2 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -402,7 +402,6 @@ bool VPattern::GetActivNodeElement(const QString &name, QDomElement &element) void VPattern::FullUpdateTree() { VMainGraphicsScene *scene = new VMainGraphicsScene(); - Q_CHECK_PTR(scene); try { Parse(Document::LiteParse, scene, scene); @@ -482,7 +481,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene * { Q_CHECK_PTR(sceneDraw); Q_CHECK_PTR(sceneDetail); - VMainGraphicsScene *scene = 0; + VMainGraphicsScene *scene = nullptr; if (mode == Draw::Calculation) { scene = sceneDraw; @@ -652,7 +651,6 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d if (parse == Document::FullParse) { spoint = new VToolSinglePoint(this, data, id, Tool::FromFile); - Q_CHECK_PTR(spoint); scene->addItem(spoint); connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); @@ -1042,7 +1040,6 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & const quint32 id = GetParametrId(domElement); const qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0"); VSplinePath *path = new VSplinePath(kCurve); - Q_CHECK_PTR(path); const QDomNodeList nodeList = domElement.childNodes(); const qint32 num = nodeList.size(); @@ -1088,7 +1085,6 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VSpline *spl = new VSpline(*data->GeometricObject(idObject)); - Q_CHECK_PTR(spl); spl->setIdObject(idObject); spl->setMode(Draw::Modeling); data->UpdateGObject(id, spl); @@ -1108,7 +1104,6 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VSplinePath *path = new VSplinePath(*data->GeometricObject(idObject)); - Q_CHECK_PTR(path); path->setIdObject(idObject); path->setMode(Draw::Modeling); data->UpdateGObject(id, path); @@ -1164,7 +1159,6 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VArc *arc = new VArc(*data->GeometricObject(idObject)); - Q_CHECK_PTR(arc); arc->setIdObject(idObject); arc->setMode(Draw::Modeling); data->UpdateGObject(id, arc); From 8f5e01fbb2adf4e9e748eab74c325607544a4727 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 11 Mar 2014 13:43:24 +0200 Subject: [PATCH 40/60] Enum Units. --HG-- branch : feature --- src/container/vcontainer.cpp | 2 +- src/dialogs/app/dialoghistory.cpp | 50 +++++----- src/dialogs/tools/dialogalongline.cpp | 4 +- src/dialogs/tools/dialogalongline.h | 2 +- src/dialogs/tools/dialogarc.cpp | 4 +- src/dialogs/tools/dialogarc.h | 2 +- src/dialogs/tools/dialogbisector.cpp | 4 +- src/dialogs/tools/dialogbisector.h | 2 +- src/dialogs/tools/dialogcutarc.cpp | 4 +- src/dialogs/tools/dialogcutarc.h | 2 +- src/dialogs/tools/dialogcutspline.cpp | 4 +- src/dialogs/tools/dialogcutspline.h | 2 +- src/dialogs/tools/dialogcutsplinepath.cpp | 4 +- src/dialogs/tools/dialogcutsplinepath.h | 2 +- src/dialogs/tools/dialogdetail.cpp | 30 +++--- src/dialogs/tools/dialogdetail.h | 4 +- src/dialogs/tools/dialogendline.cpp | 4 +- src/dialogs/tools/dialogendline.h | 2 +- src/dialogs/tools/dialogheight.cpp | 4 +- src/dialogs/tools/dialogheight.h | 2 +- src/dialogs/tools/dialogline.cpp | 4 +- src/dialogs/tools/dialogline.h | 2 +- src/dialogs/tools/dialoglineintersect.cpp | 4 +- src/dialogs/tools/dialoglineintersect.h | 2 +- src/dialogs/tools/dialognormal.cpp | 4 +- src/dialogs/tools/dialognormal.h | 2 +- src/dialogs/tools/dialogpointofcontact.cpp | 4 +- src/dialogs/tools/dialogpointofcontact.h | 2 +- .../tools/dialogpointofintersection.cpp | 4 +- src/dialogs/tools/dialogpointofintersection.h | 2 +- src/dialogs/tools/dialogshoulderpoint.cpp | 4 +- src/dialogs/tools/dialogshoulderpoint.h | 2 +- src/dialogs/tools/dialogspline.cpp | 4 +- src/dialogs/tools/dialogspline.h | 2 +- src/dialogs/tools/dialogsplinepath.cpp | 4 +- src/dialogs/tools/dialogsplinepath.h | 2 +- src/dialogs/tools/dialogtool.cpp | 16 +-- src/dialogs/tools/dialogtool.h | 2 +- src/dialogs/tools/dialogtriangle.cpp | 4 +- src/dialogs/tools/dialogtriangle.h | 2 +- src/dialogs/tools/dialoguniondetails.cpp | 8 +- src/dialogs/tools/dialoguniondetails.h | 4 +- src/geometry/varc.cpp | 2 +- src/geometry/varc.h | 2 +- src/geometry/vdetail.cpp | 2 +- src/geometry/vequidistant.cpp | 8 +- src/geometry/vgobject.cpp | 8 +- src/geometry/vgobject.h | 9 +- src/geometry/vnodedetail.cpp | 4 +- src/geometry/vnodedetail.h | 12 +-- src/geometry/vpointf.cpp | 4 +- src/geometry/vpointf.h | 2 +- src/geometry/vspline.cpp | 4 +- src/geometry/vspline.h | 4 +- src/geometry/vsplinepath.cpp | 2 +- src/geometry/vsplinepath.h | 2 +- src/main.cpp | 2 + src/mainwindow.cpp | 99 +++++++++---------- src/mainwindow.h | 6 +- src/options.h | 27 ++--- src/tools/drawTools/vtoolalongline.cpp | 12 +-- src/tools/drawTools/vtoolalongline.h | 4 +- src/tools/drawTools/vtoolarc.cpp | 14 +-- src/tools/drawTools/vtoolarc.h | 4 +- src/tools/drawTools/vtoolbisector.cpp | 12 +-- src/tools/drawTools/vtoolbisector.h | 4 +- src/tools/drawTools/vtoolcutarc.cpp | 14 +-- src/tools/drawTools/vtoolcutarc.h | 4 +- src/tools/drawTools/vtoolcutspline.cpp | 14 +-- src/tools/drawTools/vtoolcutspline.h | 4 +- src/tools/drawTools/vtoolcutsplinepath.cpp | 16 +-- src/tools/drawTools/vtoolcutsplinepath.h | 4 +- src/tools/drawTools/vtoolendline.cpp | 12 +-- src/tools/drawTools/vtoolendline.h | 4 +- src/tools/drawTools/vtoolheight.cpp | 12 +-- src/tools/drawTools/vtoolheight.h | 4 +- src/tools/drawTools/vtoolline.cpp | 12 +-- src/tools/drawTools/vtoolline.h | 4 +- src/tools/drawTools/vtoollineintersect.cpp | 12 +-- src/tools/drawTools/vtoollineintersect.h | 4 +- src/tools/drawTools/vtoolnormal.cpp | 12 +-- src/tools/drawTools/vtoolnormal.h | 4 +- src/tools/drawTools/vtoolpoint.cpp | 2 +- src/tools/drawTools/vtoolpointofcontact.cpp | 12 +-- src/tools/drawTools/vtoolpointofcontact.h | 4 +- .../drawTools/vtoolpointofintersection.cpp | 12 +-- .../drawTools/vtoolpointofintersection.h | 4 +- src/tools/drawTools/vtoolshoulderpoint.cpp | 12 +-- src/tools/drawTools/vtoolshoulderpoint.h | 4 +- src/tools/drawTools/vtoolsinglepoint.cpp | 4 +- src/tools/drawTools/vtoolsinglepoint.h | 2 +- src/tools/drawTools/vtoolspline.cpp | 14 +-- src/tools/drawTools/vtoolspline.h | 4 +- src/tools/drawTools/vtoolsplinepath.cpp | 14 +-- src/tools/drawTools/vtoolsplinepath.h | 4 +- src/tools/drawTools/vtooltriangle.cpp | 12 +-- src/tools/drawTools/vtooltriangle.h | 4 +- src/tools/nodeDetails/vnodearc.cpp | 10 +- src/tools/nodeDetails/vnodearc.h | 4 +- src/tools/nodeDetails/vnodepoint.cpp | 10 +- src/tools/nodeDetails/vnodepoint.h | 4 +- src/tools/nodeDetails/vnodespline.cpp | 10 +- src/tools/nodeDetails/vnodespline.h | 4 +- src/tools/nodeDetails/vnodesplinepath.cpp | 10 +- src/tools/nodeDetails/vnodesplinepath.h | 4 +- src/tools/vabstracttool.cpp | 2 +- src/tools/vabstracttool.h | 4 +- src/tools/vtooldetail.cpp | 46 ++++----- src/tools/vtooldetail.h | 6 +- src/tools/vtooluniondetails.cpp | 86 ++++++++-------- src/tools/vtooluniondetails.h | 4 +- src/widgets/vmaingraphicsscene.cpp | 2 +- src/widgets/vmaingraphicsscene.h | 4 +- src/widgets/vsimplesplinepath.cpp | 2 +- src/xml/vpattern.cpp | 80 +++++++-------- src/xml/vpattern.h | 6 +- src/xml/vtoolrecord.cpp | 4 +- src/xml/vtoolrecord.h | 12 +-- 118 files changed, 515 insertions(+), 510 deletions(-) diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index 7f49d3b71..499460a9a 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -296,7 +296,7 @@ void VContainer::ClearCalculationGObjects() while (i.hasNext()) { i.next(); - if (i.value()->getMode() == Draw::Calculation) + if (i.value()->getMode() == Valentina::Calculation) { delete i.value(); gObjects.remove(i.key()); diff --git a/src/dialogs/app/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp index 04385ea9f..366f277ed 100644 --- a/src/dialogs/app/dialoghistory.cpp +++ b/src/dialogs/app/dialoghistory.cpp @@ -177,22 +177,22 @@ QString DialogHistory::Record(const VToolRecord &tool) { switch ( tool.getTypeTool() ) { - case Tool::ArrowTool: + case Valentina::ArrowTool: Q_UNREACHABLE(); break; - case Tool::SinglePointTool: + case Valentina::SinglePointTool: { const QString name = data->GeometricObject(tool.getId())->name(); return QString(tr("%1 - Base point")).arg(name); } - case Tool::EndLineTool: + case Valentina::EndLineTool: { const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); const QString basePointIdName = data->GeometricObject(basePointId)->name(); const QString toolIdName = data->GeometricObject(tool.getId())->name(); return QString(tr("%1_%2 - Line from point %1 to point %2")).arg(basePointIdName, toolIdName); } - case Tool::LineTool: + case Valentina::LineTool: { const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); @@ -200,7 +200,7 @@ QString DialogHistory::Record(const VToolRecord &tool) const QString secondPointIdName = data->GeometricObject(secondPointId)->name(); return QString(tr("%1_%2 - Line from point %1 to point %2")).arg(firstPointIdName, secondPointIdName); } - case Tool::AlongLineTool: + case Valentina::AlongLineTool: { const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); @@ -209,12 +209,12 @@ QString DialogHistory::Record(const VToolRecord &tool) const QString toolIdName = data->GeometricObject(tool.getId())->name(); return QString(tr("%3 - Point along line %1_%2")).arg(basePointIdName, secondPointIdName, toolIdName); } - case Tool::ShoulderPointTool: + case Valentina::ShoulderPointTool: { const QString name = data->GeometricObject(tool.getId())->name(); return QString(tr("%1 - Point of shoulder")).arg(name); } - case Tool::NormalTool: + case Valentina::NormalTool: { const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); @@ -223,7 +223,7 @@ QString DialogHistory::Record(const VToolRecord &tool) const QString toolIdName = data->GeometricObject(tool.getId())->name(); return QString(tr("%3 - normal to line %1_%2")).arg(basePointIdName, secondPointIdName, toolIdName); } - case Tool::BisectorTool: + case Valentina::BisectorTool: { const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); @@ -235,7 +235,7 @@ QString DialogHistory::Record(const VToolRecord &tool) return QString(tr("%4 - bisector of angle %1_%2_%3")).arg(firstPointIdName, secondPointIdName, thirdPointIdName, toolIdName); } - case Tool::LineIntersectTool: + case Valentina::LineIntersectTool: { const quint32 p1Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0"); const quint32 p2Line1 = doc->GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0"); @@ -250,7 +250,7 @@ QString DialogHistory::Record(const VToolRecord &tool) p1Line2Name, p2Line2Name, toolIdName); } - case Tool::SplineTool: + case Valentina::SplineTool: { const VSpline *spl = data->GeometricObject(tool.getId()); Q_CHECK_PTR(spl); @@ -258,14 +258,14 @@ QString DialogHistory::Record(const VToolRecord &tool) const QString splP4Name = data->GeometricObject(spl->GetP4().id())->name(); return QString(tr("Curve %1_%2")).arg(splP1Name, splP4Name); } - case Tool::ArcTool: + case Valentina::ArcTool: { const VArc *arc = data->GeometricObject(tool.getId()); Q_CHECK_PTR(arc); const QString arcCenterName = data->GeometricObject(arc->GetCenter().id())->name(); return QString(tr("Arc with center in point %1")).arg(arcCenterName); } - case Tool::SplinePathTool: + case Valentina::SplinePathTool: { const VSplinePath *splPath = data->GeometricObject(tool.getId()); Q_CHECK_PTR(splPath); @@ -288,7 +288,7 @@ QString DialogHistory::Record(const VToolRecord &tool) } return record; } - case Tool::PointOfContact: + case Valentina::PointOfContact: { const quint32 center = doc->GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0"); const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); @@ -300,7 +300,7 @@ QString DialogHistory::Record(const VToolRecord &tool) return QString(tr("%4 - point of contact of arc with the center in point %1 and line %2_%3")).arg( centerName, firstPointIdName, secondPointIdName, toolIdName); } - case Tool::Height: + case Valentina::Height: { const quint32 basePointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); const quint32 p1LineId = doc->GetParametrUInt(domElement, VAbstractTool::AttrP1Line, "0"); @@ -312,7 +312,7 @@ QString DialogHistory::Record(const VToolRecord &tool) p1LineIdName, p2LineIdName); } - case Tool::Triangle: + case Valentina::Triangle: { const quint32 axisP1Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0"); const quint32 axisP2Id = doc->GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0"); @@ -325,7 +325,7 @@ QString DialogHistory::Record(const VToolRecord &tool) return QString(tr("Triangle: axis %1_%2, points %3 and %4")).arg(axisP1IdName, axisP2IdName, firstPointIdName, secondPointIdName); } - case Tool::PointOfIntersection: + case Valentina::PointOfIntersection: { const quint32 firstPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 secondPointId = doc->GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); @@ -335,7 +335,7 @@ QString DialogHistory::Record(const VToolRecord &tool) return QString(tr("%1 - point of intersection %2 and %3")).arg(toolIdName, firstPointIdName, secondPointIdName); } - case Tool::CutArcTool: + case Valentina::CutArcTool: { const quint32 arcId = doc->GetParametrUInt(domElement, VToolCutArc::AttrArc, "0"); const VArc *arc = data->GeometricObject(arcId); @@ -344,7 +344,7 @@ QString DialogHistory::Record(const VToolRecord &tool) const QString toolIdName = data->GeometricObject(tool.getId())->name(); return QString(tr("%1 - cut arc with center %2")).arg(toolIdName, arcCenterName); } - case Tool::CutSplineTool: + case Valentina::CutSplineTool: { const quint32 splineId = doc->GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0"); const VSpline *spl = data->GeometricObject(splineId); @@ -354,7 +354,7 @@ QString DialogHistory::Record(const VToolRecord &tool) const QString splP4Name = data->GeometricObject(spl->GetP4().id())->name(); return QString(tr("%1 - cut curve %2_%3")).arg(toolIdName, splP1Name, splP4Name); } - case Tool::CutSplinePathTool: + case Valentina::CutSplinePathTool: { const quint32 splinePathId = doc->GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0"); const VSplinePath *splPath = data->GeometricObject(splinePathId); @@ -382,17 +382,17 @@ QString DialogHistory::Record(const VToolRecord &tool) } //Because "history" not only show history of pattern, but help restore current data for each pattern's //piece, we need add record about details and nodes, but don't show them. - case Tool::Detail: + case Valentina::DetailTool: break; - case Tool::UnionDetails: + case Valentina::UnionDetails: break; - case Tool::NodeArc: + case Valentina::NodeArc: break; - case Tool::NodePoint: + case Valentina::NodePoint: break; - case Tool::NodeSpline: + case Valentina::NodeSpline: break; - case Tool::NodeSplinePath: + case Valentina::NodeSplinePath: break; default: qWarning()<lineEditRadius->setText(radius); } -void DialogArc::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogArc::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { const VPointF *point = data->GeometricObject(id); diff --git a/src/dialogs/tools/dialogarc.h b/src/dialogs/tools/dialogarc.h index 03343cc39..0611c9b94 100644 --- a/src/dialogs/tools/dialogarc.h +++ b/src/dialogs/tools/dialogarc.h @@ -96,7 +96,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogbisector.cpp b/src/dialogs/tools/dialogbisector.cpp index df45158b7..e0003192a 100644 --- a/src/dialogs/tools/dialogbisector.cpp +++ b/src/dialogs/tools/dialogbisector.cpp @@ -64,9 +64,9 @@ DialogBisector::~DialogBisector() delete ui; } -void DialogBisector::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogBisector::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { const VPointF *point = data->GeometricObject(id); if (number == 0) diff --git a/src/dialogs/tools/dialogbisector.h b/src/dialogs/tools/dialogbisector.h index 5488ce972..6b928f807 100644 --- a/src/dialogs/tools/dialogbisector.h +++ b/src/dialogs/tools/dialogbisector.h @@ -119,7 +119,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogcutarc.cpp b/src/dialogs/tools/dialogcutarc.cpp index 6e9580f25..2206bec4d 100644 --- a/src/dialogs/tools/dialogcutarc.cpp +++ b/src/dialogs/tools/dialogcutarc.cpp @@ -59,9 +59,9 @@ DialogCutArc::~DialogCutArc() delete ui; } -void DialogCutArc::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogCutArc::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Arc) + if (type == Valentina::Arc) { const VArc *arc = data->GeometricObject(id); ChangeCurrentText(ui->comboBoxArc, arc->name()); diff --git a/src/dialogs/tools/dialogcutarc.h b/src/dialogs/tools/dialogcutarc.h index 9b9d285c3..c2af664e9 100644 --- a/src/dialogs/tools/dialogcutarc.h +++ b/src/dialogs/tools/dialogcutarc.h @@ -87,7 +87,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogcutspline.cpp b/src/dialogs/tools/dialogcutspline.cpp index bc885d052..ce959b199 100644 --- a/src/dialogs/tools/dialogcutspline.cpp +++ b/src/dialogs/tools/dialogcutspline.cpp @@ -75,9 +75,9 @@ void DialogCutSpline::setSplineId(const quint32 &value, const quint32 &id) setCurrentSplineId(ui->comboBoxSpline, splineId, value, id, ComboMode::CutSpline); } -void DialogCutSpline::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogCutSpline::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Spline) + if (type == Valentina::Spline) { const VSpline *spl = data->GeometricObject(id); ChangeCurrentText(ui->comboBoxSpline, spl->name()); diff --git a/src/dialogs/tools/dialogcutspline.h b/src/dialogs/tools/dialogcutspline.h index f5e507e2c..88d4c634b 100644 --- a/src/dialogs/tools/dialogcutspline.h +++ b/src/dialogs/tools/dialogcutspline.h @@ -87,7 +87,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogcutsplinepath.cpp b/src/dialogs/tools/dialogcutsplinepath.cpp index a21f01c11..003383392 100644 --- a/src/dialogs/tools/dialogcutsplinepath.cpp +++ b/src/dialogs/tools/dialogcutsplinepath.cpp @@ -76,9 +76,9 @@ void DialogCutSplinePath::setSplinePathId(const quint32 &value, const quint32 &i setCurrentSplinePathId(ui->comboBoxSplinePath, splinePathId, value, id, ComboMode::CutSpline); } -void DialogCutSplinePath::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogCutSplinePath::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::SplinePath) + if (type == Valentina::SplinePath) { const VSplinePath *splPath = data->GeometricObject(id); ChangeCurrentText(ui->comboBoxSplinePath, splPath->name()); diff --git a/src/dialogs/tools/dialogcutsplinepath.h b/src/dialogs/tools/dialogcutsplinepath.h index 0accc6d67..622d1f73d 100644 --- a/src/dialogs/tools/dialogcutsplinepath.h +++ b/src/dialogs/tools/dialogcutsplinepath.h @@ -87,7 +87,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogdetail.cpp b/src/dialogs/tools/dialogdetail.cpp index 2238a46ef..df0a1e044 100644 --- a/src/dialogs/tools/dialogdetail.cpp +++ b/src/dialogs/tools/dialogdetail.cpp @@ -62,23 +62,23 @@ DialogDetail::DialogDetail(const VContainer *data, QWidget *parent) connect(ui.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem); } -void DialogDetail::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogDetail::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type != Scene::Line && type != Scene::Detail) + if (type != Valentina::Line && type != Valentina::Detail) { switch (type) { - case (Scene::Arc): - NewItem(id, Tool::NodeArc, NodeDetail::Contour); + case (Valentina::Arc): + NewItem(id, Valentina::NodeArc, NodeDetail::Contour); break; - case (Scene::Point): - NewItem(id, Tool::NodePoint, NodeDetail::Contour); + case (Valentina::Point): + NewItem(id, Valentina::NodePoint, NodeDetail::Contour); break; - case (Scene::Spline): - NewItem(id, Tool::NodeSpline, NodeDetail::Contour); + case (Valentina::Spline): + NewItem(id, Valentina::NodeSpline, NodeDetail::Contour); break; - case (Scene::SplinePath): - NewItem(id, Tool::NodeSplinePath, NodeDetail::Contour); + case (Valentina::SplinePath): + NewItem(id, Valentina::NodeSplinePath, NodeDetail::Contour); break; default: qWarning()<GeometricObject(id); name = point->name(); break; } - case (Tool::NodeArc): + case (Valentina::NodeArc): { const VArc *arc = data->GeometricObject(id); name = arc->name(); break; } - case (Tool::NodeSpline): + case (Valentina::NodeSpline): { const VSpline *spl = data->GeometricObject(id); name = spl->name(); break; } - case (Tool::NodeSplinePath): + case (Valentina::NodeSplinePath): { const VSplinePath *splPath = data->GeometricObject(id); name = splPath->name(); diff --git a/src/dialogs/tools/dialogdetail.h b/src/dialogs/tools/dialogdetail.h index bf39910b1..38dbe5a3b 100644 --- a/src/dialogs/tools/dialogdetail.h +++ b/src/dialogs/tools/dialogdetail.h @@ -61,7 +61,7 @@ public slots: * @param id id of objects (points, arcs, splines, spline paths) * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -121,7 +121,7 @@ private: * @param mx offset respect to x * @param my offset respect to y */ - void NewItem(quint32 id, const Tool::Tools &typeTool, const NodeDetail::NodeDetails &typeNode, + void NewItem(quint32 id, const Valentina::Tools &typeTool, const NodeDetail::NodeDetails &typeNode, qreal mx = 0, qreal my = 0); }; diff --git a/src/dialogs/tools/dialogendline.cpp b/src/dialogs/tools/dialogendline.cpp index 4c67d7db4..806a7f43d 100644 --- a/src/dialogs/tools/dialogendline.cpp +++ b/src/dialogs/tools/dialogendline.cpp @@ -59,9 +59,9 @@ DialogEndLine::DialogEndLine(const VContainer *data, QWidget *parent) connect(ui->lineEditFormula, &QLineEdit::textChanged, this, &DialogEndLine::FormulaChanged); } -void DialogEndLine::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogEndLine::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { const VPointF *point = data->GeometricObject(id); ChangeCurrentText(ui->comboBoxBasePoint, point->name()); diff --git a/src/dialogs/tools/dialogendline.h b/src/dialogs/tools/dialogendline.h index 05ce3c82c..97015d833 100644 --- a/src/dialogs/tools/dialogendline.h +++ b/src/dialogs/tools/dialogendline.h @@ -107,7 +107,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogheight.cpp b/src/dialogs/tools/dialogheight.cpp index 6b9b19f8f..249e45fa7 100644 --- a/src/dialogs/tools/dialogheight.cpp +++ b/src/dialogs/tools/dialogheight.cpp @@ -83,9 +83,9 @@ void DialogHeight::setP2LineId(const quint32 &value, const quint32 &id) setCurrentPointId(ui->comboBoxP2Line, p2LineId, value, id); } -void DialogHeight::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogHeight::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { const VPointF *point = data->GeometricObject(id); switch (number) diff --git a/src/dialogs/tools/dialogheight.h b/src/dialogs/tools/dialogheight.h index 8fd4f9a25..79df86f24 100644 --- a/src/dialogs/tools/dialogheight.h +++ b/src/dialogs/tools/dialogheight.h @@ -109,7 +109,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogline.cpp b/src/dialogs/tools/dialogline.cpp index 2cb17f0cc..e5a580c88 100644 --- a/src/dialogs/tools/dialogline.cpp +++ b/src/dialogs/tools/dialogline.cpp @@ -88,9 +88,9 @@ void DialogLine::DialogAccepted() DialogClosed(QDialog::Accepted); } -void DialogLine::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogLine::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { const VPointF *point = data->GeometricObject(id); if (number == 0) diff --git a/src/dialogs/tools/dialogline.h b/src/dialogs/tools/dialogline.h index 2df217fce..82e8c4fa1 100644 --- a/src/dialogs/tools/dialogline.h +++ b/src/dialogs/tools/dialogline.h @@ -86,7 +86,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialoglineintersect.cpp b/src/dialogs/tools/dialoglineintersect.cpp index 185e9f830..22f7d0b05 100644 --- a/src/dialogs/tools/dialoglineintersect.cpp +++ b/src/dialogs/tools/dialoglineintersect.cpp @@ -54,9 +54,9 @@ DialogLineIntersect::~DialogLineIntersect() delete ui; } -void DialogLineIntersect::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogLineIntersect::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { const VPointF *point = data->GeometricObject(id); if (number == 0) diff --git a/src/dialogs/tools/dialoglineintersect.h b/src/dialogs/tools/dialoglineintersect.h index 421f5d0aa..c74e0b555 100644 --- a/src/dialogs/tools/dialoglineintersect.h +++ b/src/dialogs/tools/dialoglineintersect.h @@ -106,7 +106,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialognormal.cpp b/src/dialogs/tools/dialognormal.cpp index 0f17ddb32..298e36885 100644 --- a/src/dialogs/tools/dialognormal.cpp +++ b/src/dialogs/tools/dialognormal.cpp @@ -65,9 +65,9 @@ DialogNormal::~DialogNormal() delete ui; } -void DialogNormal::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogNormal::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { if (number == 0) { diff --git a/src/dialogs/tools/dialognormal.h b/src/dialogs/tools/dialognormal.h index 9d747b9b9..51a2f1c20 100644 --- a/src/dialogs/tools/dialognormal.h +++ b/src/dialogs/tools/dialognormal.h @@ -118,7 +118,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogpointofcontact.cpp b/src/dialogs/tools/dialogpointofcontact.cpp index d8e1f8ff0..334878e2b 100644 --- a/src/dialogs/tools/dialogpointofcontact.cpp +++ b/src/dialogs/tools/dialogpointofcontact.cpp @@ -79,9 +79,9 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare connect(ui.lineEditFormula, &QLineEdit::textChanged, this, &DialogPointOfContact::FormulaChanged); } -void DialogPointOfContact::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogPointOfContact::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { const VPointF *point = data->GeometricObject(id); if (number == 0) diff --git a/src/dialogs/tools/dialogpointofcontact.h b/src/dialogs/tools/dialogpointofcontact.h index b569cae72..9c8949ed7 100644 --- a/src/dialogs/tools/dialogpointofcontact.h +++ b/src/dialogs/tools/dialogpointofcontact.h @@ -104,7 +104,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogpointofintersection.cpp b/src/dialogs/tools/dialogpointofintersection.cpp index 3fa7f88aa..7a2646422 100644 --- a/src/dialogs/tools/dialogpointofintersection.cpp +++ b/src/dialogs/tools/dialogpointofintersection.cpp @@ -58,9 +58,9 @@ void DialogPointOfIntersection::setSecondPointId(const quint32 &value, const qui setCurrentPointId(ui->comboBoxSecondPoint, secondPointId, value, id); } -void DialogPointOfIntersection::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogPointOfIntersection::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { const VPointF *point = data->GeometricObject(id); if (number == 0) diff --git a/src/dialogs/tools/dialogpointofintersection.h b/src/dialogs/tools/dialogpointofintersection.h index 2a60ca2ad..b0f41e510 100644 --- a/src/dialogs/tools/dialogpointofintersection.h +++ b/src/dialogs/tools/dialogpointofintersection.h @@ -88,7 +88,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogshoulderpoint.cpp b/src/dialogs/tools/dialogshoulderpoint.cpp index 723d8d699..2a679c2b4 100644 --- a/src/dialogs/tools/dialogshoulderpoint.cpp +++ b/src/dialogs/tools/dialogshoulderpoint.cpp @@ -65,9 +65,9 @@ DialogShoulderPoint::~DialogShoulderPoint() delete ui; } -void DialogShoulderPoint::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogShoulderPoint::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { const VPointF *point = data->GeometricObject(id); if (number == 0) diff --git a/src/dialogs/tools/dialogshoulderpoint.h b/src/dialogs/tools/dialogshoulderpoint.h index 30342ee81..2fc36dcc5 100644 --- a/src/dialogs/tools/dialogshoulderpoint.h +++ b/src/dialogs/tools/dialogshoulderpoint.h @@ -119,7 +119,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogspline.cpp b/src/dialogs/tools/dialogspline.cpp index bfe58082d..411868d5b 100644 --- a/src/dialogs/tools/dialogspline.cpp +++ b/src/dialogs/tools/dialogspline.cpp @@ -52,9 +52,9 @@ quint32 DialogSpline::getP1() const return p1; } -void DialogSpline::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogSpline::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { const VPointF *point = data->GeometricObject(id); if (number == 0) diff --git a/src/dialogs/tools/dialogspline.h b/src/dialogs/tools/dialogspline.h index e42cc1388..c88ec7bb8 100644 --- a/src/dialogs/tools/dialogspline.h +++ b/src/dialogs/tools/dialogspline.h @@ -126,7 +126,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogsplinepath.cpp b/src/dialogs/tools/dialogsplinepath.cpp index 1fedb0b69..ed7d10dbf 100644 --- a/src/dialogs/tools/dialogsplinepath.cpp +++ b/src/dialogs/tools/dialogsplinepath.cpp @@ -72,9 +72,9 @@ void DialogSplinePath::SetPath(const VSplinePath &value) } -void DialogSplinePath::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogSplinePath::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { NewItem(id, 1, 0, 1, 180); emit ToolTip(tr("Select point of curve path")); diff --git a/src/dialogs/tools/dialogsplinepath.h b/src/dialogs/tools/dialogsplinepath.h index ad1fcb708..287d316cb 100644 --- a/src/dialogs/tools/dialogsplinepath.h +++ b/src/dialogs/tools/dialogsplinepath.h @@ -67,7 +67,7 @@ public slots: * @param id id of point or detail * @param type don't show this id in list */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index f39f773d0..82ad1925f 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -83,7 +83,7 @@ void DialogTool::FillComboBoxPoints(QComboBox *box, const quint32 &id) const if (i.key() != id) { VGObject *obj = i.value(); - if (obj->getType() == GObject::Point && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::Point && obj->getMode() == Valentina::Calculation) { const VPointF *point = data->GeometricObject(i.key()); list[point->name()] = i.key(); @@ -107,7 +107,7 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode:: if (i.key() != id + 1 && i.key() != id + 2) { VGObject *obj = i.value(); - if (obj->getType() == GObject::Arc && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::Arc && obj->getMode() == Valentina::Calculation) { const VArc *arc = data->GeometricObject(i.key()); list[arc->name()] = i.key(); @@ -119,7 +119,7 @@ void DialogTool::FillComboBoxArcs(QComboBox *box, const quint32 &id, ComboMode:: if (i.key() != id) { VGObject *obj = i.value(); - if (obj->getType() == GObject::Arc && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::Arc && obj->getMode() == Valentina::Calculation) { const VArc *arc = data->GeometricObject(i.key()); list[arc->name()] = i.key(); @@ -144,7 +144,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMod if (i.key() != id + 1 && i.key() != id + 2) { VGObject *obj = i.value(); - if (obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::Spline && obj->getMode() == Valentina::Calculation) { const VSpline *spl = data->GeometricObject(i.key()); list[spl->name()] = i.key(); @@ -156,7 +156,7 @@ void DialogTool::FillComboBoxSplines(QComboBox *box, const quint32 &id, ComboMod if (i.key() != id) { VGObject *obj = i.value(); - if (obj->getType() == GObject::Spline && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::Spline && obj->getMode() == Valentina::Calculation) { const VSpline *spl = data->GeometricObject(i.key()); list[spl->name()] = i.key(); @@ -181,7 +181,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, Comb if (i.key() != id + 1 && i.key() != id + 2) { VGObject *obj = i.value(); - if (obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::SplinePath && obj->getMode() == Valentina::Calculation) { const VSplinePath *splPath = data->GeometricObject(i.key()); list[splPath->name()] = i.key(); @@ -193,7 +193,7 @@ void DialogTool::FillComboBoxSplinesPath(QComboBox *box, const quint32 &id, Comb if (i.key() != id) { VGObject *obj = i.value(); - if (obj->getType() == GObject::SplinePath && obj->getMode() == Draw::Calculation) + if (obj->getType() == GObject::SplinePath && obj->getMode() == Valentina::Calculation) { const VSplinePath *splPath = data->GeometricObject(i.key()); list[splPath->name()] = i.key(); @@ -419,7 +419,7 @@ void DialogTool::CheckState() bOk->setEnabled(flagFormula && flagName); } -void DialogTool::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogTool::ChoosedObject(quint32 id, const Valentina::Scenes &type) { Q_UNUSED(id); Q_UNUSED(type); diff --git a/src/dialogs/tools/dialogtool.h b/src/dialogs/tools/dialogtool.h index 2b3e0fe87..dad41b0b5 100644 --- a/src/dialogs/tools/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -83,7 +83,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief NamePointChanged check name of point */ diff --git a/src/dialogs/tools/dialogtriangle.cpp b/src/dialogs/tools/dialogtriangle.cpp index 19c3c9e53..d58a3094d 100644 --- a/src/dialogs/tools/dialogtriangle.cpp +++ b/src/dialogs/tools/dialogtriangle.cpp @@ -54,9 +54,9 @@ DialogTriangle::~DialogTriangle() delete ui; } -void DialogTriangle::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogTriangle::ChoosedObject(quint32 id, const Valentina::Scenes &type) { - if (type == Scene::Point) + if (type == Valentina::Point) { const VPointF *point = data->GeometricObject(id); switch (number) diff --git a/src/dialogs/tools/dialogtriangle.h b/src/dialogs/tools/dialogtriangle.h index cbacec9ac..d1d132857 100644 --- a/src/dialogs/tools/dialogtriangle.h +++ b/src/dialogs/tools/dialogtriangle.h @@ -110,7 +110,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - virtual void ChoosedObject(quint32 id, const Scene::Scenes &type); + virtual void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ diff --git a/src/dialogs/tools/dialoguniondetails.cpp b/src/dialogs/tools/dialoguniondetails.cpp index 3a015d2ff..4eb9e10ad 100644 --- a/src/dialogs/tools/dialoguniondetails.cpp +++ b/src/dialogs/tools/dialoguniondetails.cpp @@ -42,7 +42,7 @@ DialogUnionDetails::~DialogUnionDetails() delete ui; } -void DialogUnionDetails::ChoosedObject(quint32 id, const Scene::Scenes &type) +void DialogUnionDetails::ChoosedObject(quint32 id, const Valentina::Scenes &type) { if (numberD == 0) { @@ -69,12 +69,12 @@ bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail) return det.Containes(id); } -void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Scene::Scenes &type, quint32 &idDetail, +void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Valentina::Scenes &type, quint32 &idDetail, ptrdiff_t &index) { if (idDetail == 0) { - if (type == Scene::Detail) + if (type == Valentina::Detail) { idDetail = id; emit ToolTip(tr("Select first point")); @@ -85,7 +85,7 @@ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const Scene::Scenes &t { return; } - if (type == Scene::Point) + if (type == Valentina::Point) { if (numberP == 0) { diff --git a/src/dialogs/tools/dialoguniondetails.h b/src/dialogs/tools/dialoguniondetails.h index e972de851..5d8e4a225 100644 --- a/src/dialogs/tools/dialoguniondetails.h +++ b/src/dialogs/tools/dialoguniondetails.h @@ -76,7 +76,7 @@ public slots: * @param id id of point or detail * @param type type of object */ - void ChoosedObject(quint32 id, const Scene::Scenes &type); + void ChoosedObject(quint32 id, const Valentina::Scenes &type); /** * @brief DialogAccepted save data and emit signal about closed dialog. */ @@ -133,7 +133,7 @@ private: * @param idDetail id detail * @param index index of edge */ - void ChoosedDetail(const quint32 &id, const Scene::Scenes &type, quint32 &idDetail, ptrdiff_t &index); + void ChoosedDetail(const quint32 &id, const Valentina::Scenes &type, quint32 &idDetail, ptrdiff_t &index); }; inline quint32 DialogUnionDetails::getD1() const diff --git a/src/geometry/varc.cpp b/src/geometry/varc.cpp index 30ee685bc..ca93eef28 100644 --- a/src/geometry/varc.cpp +++ b/src/geometry/varc.cpp @@ -39,7 +39,7 @@ VArc::VArc () } VArc::VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, - QString formulaF2, quint32 idObject, Draw::Draws mode) + QString formulaF2, quint32 idObject, Valentina::Draws mode) : VGObject(GObject::Arc, idObject, mode), f1(f1), formulaF1(formulaF1), f2(f2), formulaF2(formulaF2), radius(radius), formulaRadius(formulaRadius), center(center) { diff --git a/src/geometry/varc.h b/src/geometry/varc.h index 3bfceac46..b2e002e9d 100644 --- a/src/geometry/varc.h +++ b/src/geometry/varc.h @@ -56,7 +56,7 @@ public: * @param f2 end angle (degree). */ VArc (VPointF center, qreal radius, QString formulaRadius, qreal f1, QString formulaF1, qreal f2, - QString formulaF2, quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); + QString formulaF2, quint32 idObject = 0, Valentina::Draws mode = Valentina::Calculation); /** * @brief VArc copy constructor * @param arc arc diff --git a/src/geometry/vdetail.cpp b/src/geometry/vdetail.cpp index d92786a5c..34b72e73b 100644 --- a/src/geometry/vdetail.cpp +++ b/src/geometry/vdetail.cpp @@ -260,7 +260,7 @@ QVector VDetail::listNodePoint() const QVector list; for (ptrdiff_t i = 0; i < nodes.size(); ++i) { - if (nodes[i].getTypeTool() == Tool::NodePoint) + if (nodes[i].getTypeTool() == Valentina::NodePoint) { list.append(nodes[i]); } diff --git a/src/geometry/vequidistant.cpp b/src/geometry/vequidistant.cpp index 13c763c8d..af4106be5 100644 --- a/src/geometry/vequidistant.cpp +++ b/src/geometry/vequidistant.cpp @@ -38,7 +38,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer { switch (detail.at(i).getTypeTool()) { - case (Tool::NodePoint): + case (Valentina::NodePoint): { const VPointF *point = data->GeometricObject(detail.at(i).getId()); points.append(point->toQPointF()); @@ -51,7 +51,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer } } break; - case (Tool::NodeArc): + case (Valentina::NodeArc): { const VArc *arc = data->GeometricObject(detail.at(i).getId()); qreal len1 = GetLengthContour(points, arc->GetPoints()); @@ -75,7 +75,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer } } break; - case (Tool::NodeSpline): + case (Valentina::NodeSpline): { const VSpline *spline = data->GeometricObject(detail.at(i).getId()); qreal len1 = GetLengthContour(points, spline->GetPoints()); @@ -99,7 +99,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer } } break; - case (Tool::NodeSplinePath): + case (Valentina::NodeSplinePath): { const VSplinePath *splinePath = data->GeometricObject(detail.at(i).getId()); qreal len1 = GetLengthContour(points, splinePath->GetPathPoints()); diff --git a/src/geometry/vgobject.cpp b/src/geometry/vgobject.cpp index bbd23f03b..cd051d540 100644 --- a/src/geometry/vgobject.cpp +++ b/src/geometry/vgobject.cpp @@ -29,11 +29,11 @@ #include "vgobject.h" VGObject::VGObject() - :_id(0), type(GObject::Point), idObject(0), _name(QString()), mode(Draw::Calculation) + :_id(0), type(GObject::Point), idObject(0), _name(QString()), mode(Valentina::Calculation) { } -VGObject::VGObject(const GObject::Type &type, const quint32 &idObject, const Draw::Draws &mode) +VGObject::VGObject(const GObject::Type &type, const quint32 &idObject, const Valentina::Draws &mode) :_id(0), type(type), idObject(idObject), _name(QString()), mode(mode) { } @@ -73,12 +73,12 @@ void VGObject::setName(const QString &name) _name = name; } -Draw::Draws VGObject::getMode() const +Valentina::Draws VGObject::getMode() const { return mode; } -void VGObject::setMode(const Draw::Draws &value) +void VGObject::setMode(const Valentina::Draws &value) { mode = value; } diff --git a/src/geometry/vgobject.h b/src/geometry/vgobject.h index c06428087..773e6ce2e 100644 --- a/src/geometry/vgobject.h +++ b/src/geometry/vgobject.h @@ -61,7 +61,8 @@ public: * @param idObject id parent object. * @param mode mode creation. Used in modeling mode. */ - VGObject(const GObject::Type &type, const quint32 &idObject = 0, const Draw::Draws &mode = Draw::Calculation); + VGObject(const GObject::Type &type, const quint32 &idObject = 0, + const Valentina::Draws &mode = Valentina::Calculation); /** * @brief VGObject copy constructor. * @param obj object. @@ -98,12 +99,12 @@ public: * @brief getMode return mode creation. * @return mode. */ - Draw::Draws getMode() const; + Valentina::Draws getMode() const; /** * @brief setMode set mode creation. * @param value mode. */ - void setMode(const Draw::Draws &value); + void setMode(const Valentina::Draws &value); /** * @brief getType return object type. * @return type. @@ -139,7 +140,7 @@ protected: /** * @brief mode object created in calculation or drawing mode */ - Draw::Draws mode; + Valentina::Draws mode; }; #endif // VGOBJECT_H diff --git a/src/geometry/vnodedetail.cpp b/src/geometry/vnodedetail.cpp index 33a858f58..ca8183fad 100644 --- a/src/geometry/vnodedetail.cpp +++ b/src/geometry/vnodedetail.cpp @@ -29,9 +29,9 @@ #include "vnodedetail.h" VNodeDetail::VNodeDetail() - :id(0), typeTool(Tool::NodePoint), typeNode(NodeDetail::Contour), mx(0), my(0){} + :id(0), typeTool(Valentina::NodePoint), typeNode(NodeDetail::Contour), mx(0), my(0){} -VNodeDetail::VNodeDetail(quint32 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx, qreal my) +VNodeDetail::VNodeDetail(quint32 id, Valentina::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx, qreal my) :id(id), typeTool(typeTool), typeNode(typeNode), mx(mx), my(my){} VNodeDetail::VNodeDetail(const VNodeDetail &node) diff --git a/src/geometry/vnodedetail.h b/src/geometry/vnodedetail.h index ec7d77e38..2a16dac7d 100644 --- a/src/geometry/vnodedetail.h +++ b/src/geometry/vnodedetail.h @@ -60,7 +60,7 @@ public: * @param mx object bias x axis * @param my object bias y axis */ - VNodeDetail(quint32 id, Tool::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx = 0, + VNodeDetail(quint32 id, Valentina::Tools typeTool, NodeDetail::NodeDetails typeNode, qreal mx = 0, qreal my = 0); /** * @brief VNodeDetail copy constructor @@ -87,12 +87,12 @@ public: * @brief getTypeTool return tool type. * @return tool type. */ - Tool::Tools getTypeTool() const; + Valentina::Tools getTypeTool() const; /** * @brief setTypeTool set tool type. * @param value tool type. */ - void setTypeTool(const Tool::Tools &value); + void setTypeTool(const Valentina::Tools &value); /** * @brief getTypeNode return node type. * @return node type. @@ -131,7 +131,7 @@ private: /** * @brief typeTool type of tool */ - Tool::Tools typeTool; + Valentina::Tools typeTool; /** * @brief typeNode node type. */ @@ -156,12 +156,12 @@ inline void VNodeDetail::setId(const quint32 &value) id = value; } -inline Tool::Tools VNodeDetail::getTypeTool() const +inline Valentina::Tools VNodeDetail::getTypeTool() const { return typeTool; } -inline void VNodeDetail::setTypeTool(const Tool::Tools &value) +inline void VNodeDetail::setTypeTool(const Valentina::Tools &value) { typeTool = value; } diff --git a/src/geometry/vpointf.cpp b/src/geometry/vpointf.cpp index 0455cfbb7..97646ca9c 100644 --- a/src/geometry/vpointf.cpp +++ b/src/geometry/vpointf.cpp @@ -28,13 +28,13 @@ #include "vpointf.h" -VPointF::VPointF(qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idObject, Draw::Draws mode) +VPointF::VPointF(qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idObject, Valentina::Draws mode) :VGObject(GObject::Point, idObject, mode), _mx(mx), _my(my), _x(x), _y(y) { this->_name = name; } -VPointF::VPointF() :VGObject(GObject::Point, 0, Draw::Calculation), _mx(0), _my(0), _x(0), _y(0) +VPointF::VPointF() :VGObject(GObject::Point, 0, Valentina::Calculation), _mx(0), _my(0), _x(0), _y(0) { } diff --git a/src/geometry/vpointf.h b/src/geometry/vpointf.h index 416c5e58f..a88c8c99e 100644 --- a/src/geometry/vpointf.h +++ b/src/geometry/vpointf.h @@ -58,7 +58,7 @@ public: * @param my offset name respect to y */ VPointF ( qreal x, qreal y, QString name, qreal mx, qreal my, quint32 idObject = 0, - Draw::Draws mode = Draw::Calculation); + Valentina::Draws mode = Valentina::Calculation); ~VPointF(){} /** * @brief operator = assignment operator diff --git a/src/geometry/vspline.cpp b/src/geometry/vspline.cpp index 5f3476d3d..5b731da0e 100644 --- a/src/geometry/vspline.cpp +++ b/src/geometry/vspline.cpp @@ -40,7 +40,7 @@ VSpline::VSpline ( const VSpline & spline ) kCurve(spline.GetKcurve()){} VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, - quint32 idObject, Draw::Draws mode) + quint32 idObject, Valentina::Draws mode) :VGObject(GObject::Spline, idObject, mode), p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1), angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve) { @@ -67,7 +67,7 @@ VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm this->p3 = p4p3.p2(); } -VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject, Draw::Draws mode) +VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject, Valentina::Draws mode) :VGObject(GObject::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1), kAsm2(1), kCurve(1) { diff --git a/src/geometry/vspline.h b/src/geometry/vspline.h index 96211ba50..e6b1fb013 100644 --- a/src/geometry/vspline.h +++ b/src/geometry/vspline.h @@ -66,7 +66,7 @@ public: * @param kAsm2 coefficient of length second control line. */ VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve, - quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); + quint32 idObject = 0, Valentina::Draws mode = Valentina::Calculation); /** * @brief VSpline constructor. * @param p1 first point spline. @@ -75,7 +75,7 @@ public: * @param p4 second point spline. */ VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject = 0, - Draw::Draws mode = Draw::Calculation); + Valentina::Draws mode = Valentina::Calculation); /** * @brief GetP1 return first spline point. * @return first point. diff --git a/src/geometry/vsplinepath.cpp b/src/geometry/vsplinepath.cpp index d91f0fc6d..0351451e2 100644 --- a/src/geometry/vsplinepath.cpp +++ b/src/geometry/vsplinepath.cpp @@ -29,7 +29,7 @@ #include "vsplinepath.h" #include "../exception/vexception.h" -VSplinePath::VSplinePath(qreal kCurve, quint32 idObject, Draw::Draws mode) +VSplinePath::VSplinePath(qreal kCurve, quint32 idObject, Valentina::Draws mode) : VGObject(GObject::SplinePath, idObject, mode), path(QVector()), kCurve(kCurve), maxCountPoints(0) { } diff --git a/src/geometry/vsplinepath.h b/src/geometry/vsplinepath.h index 127ed5b3f..1b780f42a 100644 --- a/src/geometry/vsplinepath.h +++ b/src/geometry/vsplinepath.h @@ -59,7 +59,7 @@ public: * @param idObject parent id. * @param mode mode creation spline path. */ - VSplinePath(qreal kCurve = 1, quint32 idObject = 0, Draw::Draws mode = Draw::Calculation); + VSplinePath(qreal kCurve = 1, quint32 idObject = 0, Valentina::Draws mode = Valentina::Calculation); /** * @brief VSplinePath copy constructor. * @param splPath spline path. diff --git a/src/main.cpp b/src/main.cpp index 5bb95aa51..bf6e7159e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,6 +33,8 @@ #include "tablewindow.h" #include "options.h" +Valentina::Units patternUnit = Valentina::Cm; + #ifdef Q_OS_WIN const QString translationsPath = QString("/translations"); #else diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index b47bf60ef..098a82c18 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -45,12 +45,11 @@ #include #include - MainWindow::MainWindow(QWidget *parent) - :QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Tool::ArrowTool), + :QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Valentina::ArrowTool), currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), view(nullptr), isInitialized(false), dialogTable(0), dialogTool(nullptr), dialogHistory(nullptr), - comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0), currentToolBoxIndex(0), + comboBoxDraws(nullptr), curFile(QString()), mode(Valentina::Calculation), currentDrawIndex(0), currentToolBoxIndex(0), drawMode(true), recentFileActs{0, 0, 0, 0, 0}, separatorAct(nullptr), autoSaveTimer(nullptr) { CreateActions(); @@ -165,14 +164,14 @@ void MainWindow::ActionNewDraw() //Create single point const quint32 id = pattern->AddGObject(new VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5, 10)); - VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Tool::FromGui); + VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Valentina::FromGui); sceneDraw->addItem(spoint); connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem); connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); QHash* tools = doc->getTools(); Q_CHECK_PTR(tools); tools->insert(id, spoint); - VDrawTool::AddRecord(id, Tool::SinglePointTool, doc); + VDrawTool::AddRecord(id, Valentina::SinglePointTool, doc); SetEnableTool(true); SetEnableWidgets(true); @@ -205,7 +204,7 @@ void MainWindow::OptionDraw() } template -void MainWindow::SetToolButton(bool checked, Tool::Tools t, const QString &cursor, const QString &toolTip, +void MainWindow::SetToolButton(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip, Func closeDialogSlot) { if (checked) @@ -245,7 +244,7 @@ void MainWindow::ClosedDialog(int result) void MainWindow::ToolEndLine(bool checked) { - SetToolButton(checked, Tool::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), + SetToolButton(checked, Valentina::EndLineTool, ":/cursor/endline_cursor.png", tr("Select point"), &MainWindow::ClosedDialogEndLine); } @@ -256,7 +255,7 @@ void MainWindow::ClosedDialogEndLine(int result) void MainWindow::ToolLine(bool checked) { - SetToolButton(checked, Tool::LineTool, ":/cursor/line_cursor.png", tr("Select first point"), + SetToolButton(checked, Valentina::LineTool, ":/cursor/line_cursor.png", tr("Select first point"), &MainWindow::ClosedDialogLine); } @@ -267,7 +266,7 @@ void MainWindow::ClosedDialogLine(int result) void MainWindow::ToolAlongLine(bool checked) { - SetToolButton(checked, Tool::AlongLineTool, ":/cursor/alongline_cursor.png", tr("Select point"), + SetToolButton(checked, Valentina::AlongLineTool, ":/cursor/alongline_cursor.png", tr("Select point"), &MainWindow::ClosedDialogAlongLine); } @@ -278,7 +277,7 @@ void MainWindow::ClosedDialogAlongLine(int result) void MainWindow::ToolShoulderPoint(bool checked) { - SetToolButton(checked, Tool::ShoulderPointTool, ":/cursor/shoulder_cursor.png", + SetToolButton(checked, Valentina::ShoulderPointTool, ":/cursor/shoulder_cursor.png", tr("Select first point of line"), &MainWindow::ClosedDialogShoulderPoint); } @@ -289,7 +288,7 @@ void MainWindow::ClosedDialogShoulderPoint(int result) void MainWindow::ToolNormal(bool checked) { - SetToolButton(checked, Tool::NormalTool, ":/cursor/normal_cursor.png", + SetToolButton(checked, Valentina::NormalTool, ":/cursor/normal_cursor.png", tr("Select first point of line"), &MainWindow::ClosedDialogNormal); } @@ -300,7 +299,7 @@ void MainWindow::ClosedDialogNormal(int result) void MainWindow::ToolBisector(bool checked) { - SetToolButton(checked, Tool::BisectorTool, ":/cursor/bisector_cursor.png", + SetToolButton(checked, Valentina::BisectorTool, ":/cursor/bisector_cursor.png", tr("Select first point of angle"), &MainWindow::ClosedDialogBisector); } @@ -311,7 +310,7 @@ void MainWindow::ClosedDialogBisector(int result) void MainWindow::ToolLineIntersect(bool checked) { - SetToolButton(checked, Tool::LineIntersectTool, ":/cursor/intersect_cursor.png", + SetToolButton(checked, Valentina::LineIntersectTool, ":/cursor/intersect_cursor.png", tr("Select first point of first line"), &MainWindow::ClosedDialogLineIntersect); } @@ -322,7 +321,7 @@ void MainWindow::ClosedDialogLineIntersect(int result) void MainWindow::ToolSpline(bool checked) { - SetToolButton(checked, Tool::SplineTool, ":/cursor/spline_cursor.png", + SetToolButton(checked, Valentina::SplineTool, ":/cursor/spline_cursor.png", tr("Select first point curve"), &MainWindow::ClosedDialogSpline); } @@ -333,7 +332,7 @@ void MainWindow::ClosedDialogSpline(int result) void MainWindow::ToolCutSpline(bool checked) { - SetToolButton(checked, Tool::CutSplineTool, ":/cursor/spline_cut_point_cursor.png", + SetToolButton(checked, Valentina::CutSplineTool, ":/cursor/spline_cut_point_cursor.png", tr("Select simple curve"), &MainWindow::ClosedDialogCutSpline); } @@ -344,7 +343,7 @@ void MainWindow::ClosedDialogCutSpline(int result) void MainWindow::ToolArc(bool checked) { - SetToolButton(checked, Tool::ArcTool, ":/cursor/arc_cursor.png", + SetToolButton(checked, Valentina::ArcTool, ":/cursor/arc_cursor.png", tr("Select point of center of arc"), &MainWindow::ClosedDialogArc); } @@ -355,7 +354,7 @@ void MainWindow::ClosedDialogArc(int result) void MainWindow::ToolSplinePath(bool checked) { - SetToolButton(checked, Tool::SplinePathTool, ":/cursor/splinepath_cursor.png", + SetToolButton(checked, Valentina::SplinePathTool, ":/cursor/splinepath_cursor.png", tr("Select point of curve path"), &MainWindow::ClosedDialogSplinePath); } @@ -366,7 +365,7 @@ void MainWindow::ClosedDialogSplinePath(int result) void MainWindow::ToolCutSplinePath(bool checked) { - SetToolButton(checked, Tool::CutSplinePathTool, ":/cursor/splinepath_cut_point_cursor.png", + SetToolButton(checked, Valentina::CutSplinePathTool, ":/cursor/splinepath_cut_point_cursor.png", tr("Select curve path"), &MainWindow::ClosedDialogCutSplinePath); } @@ -377,7 +376,7 @@ void MainWindow::ClosedDialogCutSplinePath(int result) void MainWindow::ToolPointOfContact(bool checked) { - SetToolButton(checked, Tool::PointOfContact, ":/cursor/pointcontact_cursor.png", + SetToolButton(checked, Valentina::PointOfContact, ":/cursor/pointcontact_cursor.png", tr("Select first point of line"), &MainWindow::ClosedDialogPointOfContact); } @@ -388,7 +387,7 @@ void MainWindow::ClosedDialogPointOfContact(int result) void MainWindow::ToolDetail(bool checked) { - SetToolButton(checked, Tool::Detail, "://cursor/new_detail_cursor.png", + SetToolButton(checked, Valentina::DetailTool, "://cursor/new_detail_cursor.png", tr("Select points, arcs, curves clockwise."), &MainWindow::ClosedDialogDetail); } @@ -404,7 +403,7 @@ void MainWindow::ClosedDialogDetail(int result) void MainWindow::ToolHeight(bool checked) { - SetToolButton(checked, Tool::Height, ":/cursor/height_cursor.png", tr("Select base point"), + SetToolButton(checked, Valentina::Height, ":/cursor/height_cursor.png", tr("Select base point"), &MainWindow::ClosedDialogHeight); } @@ -415,7 +414,7 @@ void MainWindow::ClosedDialogHeight(int result) void MainWindow::ToolTriangle(bool checked) { - SetToolButton(checked, Tool::Triangle, ":/cursor/triangle_cursor.png", + SetToolButton(checked, Valentina::Triangle, ":/cursor/triangle_cursor.png", tr("Select first point of axis"), &MainWindow::ClosedDialogTriangle); } @@ -426,7 +425,7 @@ void MainWindow::ClosedDialogTriangle(int result) void MainWindow::ToolPointOfIntersection(bool checked) { - SetToolButton(checked, Tool::PointOfIntersection, ":/cursor/pointofintersect_cursor.png", + SetToolButton(checked, Valentina::PointOfIntersection, ":/cursor/pointofintersect_cursor.png", tr("Select point vertically"), &MainWindow::ClosedDialogPointOfIntersection); } @@ -437,7 +436,7 @@ void MainWindow::ClosedDialogPointOfIntersection(int result) void MainWindow::ToolUnionDetails(bool checked) { - SetToolButton(checked, Tool::UnionDetails, ":/cursor/union_cursor.png", tr("Select detail"), + SetToolButton(checked, Valentina::UnionDetails, ":/cursor/union_cursor.png", tr("Select detail"), &MainWindow::ClosedDialogUnionDetails); //Must disconnect this signal here. disconnect(doc, &VPattern::FullUpdateFromFile, dialogTool, &DialogTool::UpdateList); @@ -451,7 +450,7 @@ void MainWindow::ClosedDialogUnionDetails(int result) void MainWindow::ToolCutArc(bool checked) { - SetToolButton(checked, Tool::CutArcTool, ":/cursor/arc_cut_cursor.png", tr("Select arc"), + SetToolButton(checked, Valentina::CutArcTool, ":/cursor/arc_cut_cursor.png", tr("Select arc"), &MainWindow::ClosedDialogCutArc); } @@ -633,103 +632,103 @@ void MainWindow::CancelTool() dialogTool = nullptr; switch ( tool ) { - case Tool::ArrowTool: + case Valentina::ArrowTool: ui->actionArrowTool->setChecked(false); helpLabel->setText(""); break; - case Tool::SinglePointTool: + case Valentina::SinglePointTool: Q_UNREACHABLE(); //Nothing to do here because we can't create this tool from main window. break; - case Tool::EndLineTool: + case Valentina::EndLineTool: ui->toolButtonEndLine->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::LineTool: + case Valentina::LineTool: ui->toolButtonLine->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearFocus(); break; - case Tool::AlongLineTool: + case Valentina::AlongLineTool: ui->toolButtonAlongLine->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::ShoulderPointTool: + case Valentina::ShoulderPointTool: ui->toolButtonShoulderPoint->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::NormalTool: + case Valentina::NormalTool: ui->toolButtonNormal->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::BisectorTool: + case Valentina::BisectorTool: ui->toolButtonBisector->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::LineIntersectTool: + case Valentina::LineIntersectTool: ui->toolButtonLineIntersect->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::SplineTool: + case Valentina::SplineTool: ui->toolButtonSpline->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::ArcTool: + case Valentina::ArcTool: ui->toolButtonArc->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::SplinePathTool: + case Valentina::SplinePathTool: ui->toolButtonSplinePath->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::PointOfContact: + case Valentina::PointOfContact: ui->toolButtonPointOfContact->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::Detail: + case Valentina::DetailTool: ui->toolButtonNewDetail->setChecked(false); break; - case Tool::Height: + case Valentina::Height: ui->toolButtonHeight->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::Triangle: + case Valentina::Triangle: ui->toolButtonTriangle->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::PointOfIntersection: + case Valentina::PointOfIntersection: ui->toolButtonPointOfIntersection->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::CutSplineTool: + case Valentina::CutSplineTool: ui->toolButtonSplineCutPoint->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::CutSplinePathTool: + case Valentina::CutSplinePathTool: ui->toolButtonSplinePathCutPoint->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::UnionDetails: + case Valentina::UnionDetails: ui->toolButtonUnionDetails->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); break; - case Tool::CutArcTool: + case Valentina::CutArcTool: ui->toolButtonArcCutPoint->setChecked(false); currentScene->setFocus(Qt::OtherFocusReason); currentScene->clearSelection(); @@ -744,7 +743,7 @@ void MainWindow::ArrowTool() { CancelTool(); ui->actionArrowTool->setChecked(true); - tool = Tool::ArrowTool; + tool = Valentina::ArrowTool; QCursor cur(Qt::ArrowCursor); view->setCursor(cur); helpLabel->setText(""); @@ -802,7 +801,7 @@ void MainWindow::ActionDraw(bool checked) connect(view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor); RestoreCurrentScene(); - mode = Draw::Calculation; + mode = Valentina::Calculation; comboBoxDraws->setEnabled(true); comboBoxDraws->setCurrentIndex(currentDrawIndex);//restore current pattern peace drawMode = true; @@ -840,7 +839,7 @@ void MainWindow::ActionDetails(bool checked) comboBoxDraws->setEnabled(false); - mode = Draw::Modeling; + mode = Valentina::Modeling; SetEnableTool(true); currentToolBoxIndex = ui->toolBox->currentIndex(); ui->toolBox->setCurrentIndex(4); @@ -1059,7 +1058,7 @@ void MainWindow::SetEnableTool(bool enable) { bool drawTools = false; bool modelingTools = false; - if (mode == Draw::Calculation) + if (mode == Valentina::Calculation) { drawTools = enable; } diff --git a/src/mainwindow.h b/src/mainwindow.h index 8d83bbd99..c5bcc046e 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -407,7 +407,7 @@ private: /** * @brief tool current tool */ - Tool::Tools tool; + Valentina::Tools tool; /** * @brief currentScene pointer to current scene. */ @@ -450,7 +450,7 @@ private: /** * @brief mode keep current draw mode. */ - Draw::Draws mode; + Valentina::Draws mode; /** * @brief currentDrawIndex save current selected pattern peace. */ @@ -510,7 +510,7 @@ private: * @param toolTip first tooltipe. * @param closeDialogSlot function what handle after close dialog. */ - void SetToolButton(bool checked, Tool::Tools t, const QString &cursor, const QString &toolTip, + void SetToolButton(bool checked, Valentina::Tools t, const QString &cursor, const QString &toolTip, Func closeDialogSlot); /** * @brief MinimumScrollBar set scroll bar to minimum. diff --git a/src/options.h b/src/options.h index 1d4176d0c..6580940f4 100644 --- a/src/options.h +++ b/src/options.h @@ -51,18 +51,14 @@ inline double toMM(double pix) extern const QString translationsPath; -namespace Scene +namespace Valentina { /** * @brief The Scene enum */ enum Scene { Point, Line, Spline, Arc, SplinePath, Detail }; Q_DECLARE_FLAGS(Scenes, Scene) -} -Q_DECLARE_OPERATORS_FOR_FLAGS( Scene::Scenes ) -namespace Tool -{ /** * @brief The Tool enum */ @@ -84,7 +80,7 @@ namespace Tool SplinePathTool, CutSplinePathTool, PointOfContact, - Detail, + DetailTool, NodePoint, NodeArc, NodeSpline, @@ -101,18 +97,25 @@ namespace Tool */ enum Source { FromGui, FromFile, FromTool }; Q_DECLARE_FLAGS(Sources, Source) -} -Q_DECLARE_OPERATORS_FOR_FLAGS( Tool::Tools ) -Q_DECLARE_OPERATORS_FOR_FLAGS( Tool::Sources ) -namespace Draw -{ /** * @brief The Draw enum */ enum Draw { Calculation, Modeling }; Q_DECLARE_FLAGS(Draws, Draw) + + /** + * @brief The Unit enum + */ + enum Unit { Mm, Cm, In }; + Q_DECLARE_FLAGS(Units, Unit) } -Q_DECLARE_OPERATORS_FOR_FLAGS(Draw::Draws) +Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Scenes ) +Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Tools ) +Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Sources ) +Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Draws ) +Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Units ) + +extern Valentina::Units patternUnit; #endif // OPTIONS_H diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index bf6abdba3..961e2bf1b 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -34,12 +34,12 @@ const QString VToolAlongLine::ToolType = QStringLiteral("alongLine"); VToolAlongLine::VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, - const QString &typeLine, const Tool::Sources &typeCreation, + const QString &typeLine, const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, 0, parent), secondPointId(secondPointId) { - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -156,13 +156,13 @@ void VToolAlongLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatt QString typeLine = dialogTool->getTypeLine(); QString pointName = dialogTool->getPointName(); Create(0, pointName, typeLine, formula, firstPointId, secondPointId, 5, 10, scene, doc, data, - Document::FullParse, Tool::FromGui); + Document::FullParse, Valentina::FromGui); } void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, - VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) + VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VPointF *firstPoint = data->GeometricObject(firstPointId); const VPointF *secondPoint = data->GeometricObject(secondPointId); @@ -174,7 +174,7 @@ void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const Q { line.setLength(toPixel(result)); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject( new VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); data->AddLine(firstPointId, id); @@ -190,7 +190,7 @@ void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const Q doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::AlongLineTool, doc); + VDrawTool::AddRecord(id, Valentina::AlongLineTool, doc); if (parse == Document::FullParse) { VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId, diff --git a/src/tools/drawTools/vtoolalongline.h b/src/tools/drawTools/vtoolalongline.h index e254004c7..89924d36e 100644 --- a/src/tools/drawTools/vtoolalongline.h +++ b/src/tools/drawTools/vtoolalongline.h @@ -52,7 +52,7 @@ public: */ VToolAlongLine(VPattern *doc, VContainer *data, quint32 id, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, const QString &typeLine, - const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); + const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ @@ -84,7 +84,7 @@ public: static void Create(const quint32 _id, const QString &pointName, const QString &typeLine, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); + const Document::Documents &parse, const Valentina::Sources &typeCreation); static const QString ToolType; public slots: /** diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index 04c4687cb..4ba88dcff 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -33,7 +33,7 @@ const QString VToolArc::TagName = QStringLiteral("arc"); const QString VToolArc::ToolType = QStringLiteral("simple"); -VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, +VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VDrawTool(doc, data, id), QGraphicsPathItem(parent) { @@ -47,7 +47,7 @@ VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Tool::Sour this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setAcceptHoverEvents(true); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -79,12 +79,12 @@ void VToolArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern *d QString radius = dialogTool->GetRadius(); QString f1 = dialogTool->GetF1(); QString f2 = dialogTool->GetF2(); - Create(0, center, radius, f1, f2, scene, doc, data, Document::FullParse, Tool::FromGui); + Create(0, center, radius, f1, f2, scene, doc, data, Document::FullParse, Valentina::FromGui); } void VToolArc::Create(const quint32 _id, const quint32 ¢er, const QString &radius, const QString &f1, const QString &f2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation) + const Document::Documents &parse, const Valentina::Sources &typeCreation) { qreal calcRadius = 0, calcF1 = 0, calcF2 = 0; @@ -113,7 +113,7 @@ void VToolArc::Create(const quint32 _id, const quint32 ¢er, const QString &r VPointF c = *data->GeometricObject(center); VArc *arc = new VArc(c, calcRadius, radius, calcF1, f1, calcF2, f2 ); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(arc); } @@ -126,7 +126,7 @@ void VToolArc::Create(const quint32 _id, const quint32 ¢er, const QString &r } } data->AddLengthArc(id); - VDrawTool::AddRecord(id, Tool::ArcTool, doc); + VDrawTool::AddRecord(id, Valentina::ArcTool, doc); if (parse == Document::FullParse) { VToolArc *toolArc = new VToolArc(doc, data, id, typeCreation); @@ -209,7 +209,7 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - emit ChoosedTool(id, Scene::Arc); + emit ChoosedTool(id, Valentina::Arc); } QGraphicsItem::mouseReleaseEvent(event); } diff --git a/src/tools/drawTools/vtoolarc.h b/src/tools/drawTools/vtoolarc.h index 65dd734b7..8dd66a768 100644 --- a/src/tools/drawTools/vtoolarc.h +++ b/src/tools/drawTools/vtoolarc.h @@ -48,7 +48,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object */ - VToolArc(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, + VToolArc(VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. @@ -77,7 +77,7 @@ public: */ static void Create(const quint32 _id, const quint32 ¢er, const QString &radius, const QString &f1, const QString &f2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); + const Document::Documents &parse, const Valentina::Sources &typeCreation); static const QString TagName; static const QString ToolType; public slots: diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index b2e42fa59..373f140ec 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -34,13 +34,13 @@ const QString VToolBisector::ToolType = QStringLiteral("bisector"); VToolBisector::VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, - const quint32 &thirdPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) + const quint32 &thirdPointId, const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, secondPointId, 0, parent), firstPointId(0), thirdPointId(0) { this->firstPointId = firstPointId; this->thirdPointId = thirdPointId; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -96,14 +96,14 @@ void VToolBisector::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatte QString typeLine = dialogTool->getTypeLine(); QString pointName = dialogTool->getPointName(); Create(0, formula, firstPointId, secondPointId, thirdPointId, typeLine, pointName, 5, 10, scene, doc, data, - Document::FullParse, Tool::FromGui); + Document::FullParse, Valentina::FromGui); } void VToolBisector::Create(const quint32 _id, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation) + const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VPointF *firstPoint = data->GeometricObject(firstPointId); const VPointF *secondPoint = data->GeometricObject(secondPointId); @@ -117,7 +117,7 @@ void VToolBisector::Create(const quint32 _id, const QString &formula, const quin QPointF fPoint = VToolBisector::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), thirdPoint->toQPointF(), toPixel(result)); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(new VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); data->AddLine(firstPointId, id); @@ -131,7 +131,7 @@ void VToolBisector::Create(const quint32 _id, const QString &formula, const quin doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::BisectorTool, doc); + VDrawTool::AddRecord(id, Valentina::BisectorTool, doc); if (parse == Document::FullParse) { VToolBisector *point = new VToolBisector(doc, data, id, typeLine, formula, firstPointId, secondPointId, diff --git a/src/tools/drawTools/vtoolbisector.h b/src/tools/drawTools/vtoolbisector.h index 02ba4e90d..84aeac0f8 100644 --- a/src/tools/drawTools/vtoolbisector.h +++ b/src/tools/drawTools/vtoolbisector.h @@ -52,7 +52,7 @@ public: */ VToolBisector(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, - const quint32 &thirdPointId, const Tool::Sources &typeCreation, + const quint32 &thirdPointId, const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief FindPoint find bisector point. @@ -97,7 +97,7 @@ public: const quint32 &secondPointId, const quint32 &thirdPointId, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); + const Valentina::Sources &typeCreation); static const QString ToolType; public slots: /** diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index a16a9f87c..2c19e1be2 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -35,7 +35,7 @@ const QString VToolCutArc::AttrArc = QStringLiteral("arc"); VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id, - const Tool::Sources &typeCreation, QGraphicsItem * parent) + const Valentina::Sources &typeCreation, QGraphicsItem * parent) :VToolPoint(doc, data, id, parent), formula(formula), arcId(arcId), firstArc(), secondArc(), arc1id(arc1id), arc2id(arc2id) { @@ -53,7 +53,7 @@ VToolCutArc::VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, con secondArc->setParentItem(this); connect(secondArc, &VSimpleArc::Choosed, this, &VToolCutArc::ArcChoosed); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -83,12 +83,12 @@ void VToolCutArc::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern QString pointName = dialogTool->getPointName(); QString formula = dialogTool->getFormula(); quint32 arcId = dialogTool->getArcId(); - Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); + Create(0, pointName, formula, arcId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui); } void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &arcId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, - VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) + VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VArc *arc = data->GeometricObject(arcId); Calculator cal(data); @@ -103,7 +103,7 @@ void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QStr quint32 id = _id; quint32 arc1id = 0; quint32 arc2id = 0; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); id = data->AddGObject(p); @@ -136,7 +136,7 @@ void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QStr data->AddLengthArc(arc1id); data->AddLengthArc(arc2id); - VDrawTool::AddRecord(id, Tool::CutArcTool, doc); + VDrawTool::AddRecord(id, Valentina::CutArcTool, doc); if (parse == Document::FullParse) { VToolCutArc *point = new VToolCutArc(doc, data, id, formula, arcId, arc1id, arc2id, typeCreation); @@ -164,7 +164,7 @@ void VToolCutArc::FullUpdateFromFile() void VToolCutArc::ArcChoosed(quint32 id) { - emit ChoosedTool(id, Scene::Arc); + emit ChoosedTool(id, Valentina::Arc); } void VToolCutArc::ChangedActivDraw(const QString &newName) diff --git a/src/tools/drawTools/vtoolcutarc.h b/src/tools/drawTools/vtoolcutarc.h index 4e845f170..5d44d47b6 100644 --- a/src/tools/drawTools/vtoolcutarc.h +++ b/src/tools/drawTools/vtoolcutarc.h @@ -53,7 +53,7 @@ public: */ VToolCutArc(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &arcId, const quint32 &arc1id, const quint32 &arc2id, - const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); + const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ @@ -82,7 +82,7 @@ public: */ static void Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &arcId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, - VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); + VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation); static const QString ToolType; static const QString AttrArc; public slots: diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index c806746e2..6d6c5e97b 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -35,7 +35,7 @@ const QString VToolCutSpline::AttrSpline = QStringLiteral("spline"); VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, - const Tool::Sources &typeCreation, QGraphicsItem *parent) + const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), formula(formula), splineId(splineId), firstSpline(), secondSpline(), spl1id(spl1id), spl2id(spl2id) { @@ -53,7 +53,7 @@ VToolCutSpline::VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &i secondSpline->setParentItem(this); connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSpline::SplineChoosed); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -83,13 +83,13 @@ void VToolCutSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, QString pointName = dialogTool->getPointName(); QString formula = dialogTool->getFormula(); quint32 splineId = dialogTool->getSplineId(); - Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); + Create(0, pointName, formula, splineId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui); } void VToolCutSpline::Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &splineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation) + const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VSpline *spl = data->GeometricObject(splineId); Calculator cal(data); @@ -103,7 +103,7 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, quint32 id = _id; quint32 spl1id = 0; quint32 spl2id = 0; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); id = data->AddGObject(p); @@ -137,7 +137,7 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::CutSplineTool, doc); + VDrawTool::AddRecord(id, Valentina::CutSplineTool, doc); if (parse == Document::FullParse) { VToolCutSpline *point = new VToolCutSpline(doc, data, id, formula, splineId, spl1id, spl2id, typeCreation); @@ -165,7 +165,7 @@ void VToolCutSpline::FullUpdateFromFile() void VToolCutSpline::SplineChoosed(quint32 id) { - emit ChoosedTool(id, Scene::Spline); + emit ChoosedTool(id, Valentina::Spline); } void VToolCutSpline::ChangedActivDraw(const QString &newName) diff --git a/src/tools/drawTools/vtoolcutspline.h b/src/tools/drawTools/vtoolcutspline.h index 6baf52e85..5ed16027d 100644 --- a/src/tools/drawTools/vtoolcutspline.h +++ b/src/tools/drawTools/vtoolcutspline.h @@ -51,7 +51,7 @@ public: */ VToolCutSpline(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &splineId, const quint32 &spl1id, const quint32 &spl2id, - const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); + const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ @@ -81,7 +81,7 @@ public: static void Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &splineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); + const Document::Documents &parse, const Valentina::Sources &typeCreation); static const QString ToolType; static const QString AttrSpline; public slots: diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index e9eaa2647..c29c921cf 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -36,7 +36,7 @@ const QString VToolCutSplinePath::AttrSplinePath = QStringLiteral("splinePath"); VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &splinePathId, const quint32 &splPath1id, const quint32 &splPath2id, - const Tool::Sources &typeCreation, QGraphicsItem *parent) + const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), formula(formula), splinePathId(splinePathId), firstSpline(), secondSpline(), splPath1id (splPath1id), splPath2id(splPath2id) { @@ -54,7 +54,7 @@ VToolCutSplinePath::VToolCutSplinePath(VPattern *doc, VContainer *data, const qu secondSpline->setParentItem(this); connect(secondSpline, &VSimpleSpline::Choosed, this, &VToolCutSplinePath::SplineChoosed); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -83,13 +83,13 @@ void VToolCutSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, V QString pointName = dialogTool->getPointName(); QString formula = dialogTool->getFormula(); quint32 splinePathId = dialogTool->getSplinePathId(); - Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); + Create(0, pointName, formula, splinePathId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui); } void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &splinePathId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation) + const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VSplinePath *splPath = data->GeometricObject(splinePathId); Q_CHECK_PTR(splPath); @@ -104,7 +104,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con const QPointF point = splPath->CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3); VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(p); } @@ -123,7 +123,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con VSplinePath *splPath1 = new VSplinePath(); VSplinePath *splPath2 = new VSplinePath(); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { for (qint32 i = 0; i < splPath->CountPoint(); i++) { @@ -210,7 +210,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::CutSplinePathTool, doc); + VDrawTool::AddRecord(id, Valentina::CutSplinePathTool, doc); if (parse == Document::FullParse) { VToolCutSplinePath *point = new VToolCutSplinePath(doc, data, id, formula, splinePathId, splPath1id, @@ -239,7 +239,7 @@ void VToolCutSplinePath::FullUpdateFromFile() void VToolCutSplinePath::SplineChoosed(quint32 id) { - emit ChoosedTool(id, Scene::SplinePath); + emit ChoosedTool(id, Valentina::SplinePath); } void VToolCutSplinePath::ChangedActivDraw(const QString &newName) diff --git a/src/tools/drawTools/vtoolcutsplinepath.h b/src/tools/drawTools/vtoolcutsplinepath.h index 2f9707bef..08b319439 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.h +++ b/src/tools/drawTools/vtoolcutsplinepath.h @@ -54,7 +54,7 @@ public: */ VToolCutSplinePath(VPattern *doc, VContainer *data, const quint32 &id, const QString &formula, const quint32 &splinePathId, const quint32 &splPath1id, const quint32 &splPath2id, - const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); + const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ @@ -84,7 +84,7 @@ public: static void Create(const quint32 _id, const QString &pointName, const QString &formula, const quint32 &splinePathId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); + const Valentina::Sources &typeCreation); static const QString ToolType; static const QString AttrSplinePath; public slots: diff --git a/src/tools/drawTools/vtoolendline.cpp b/src/tools/drawTools/vtoolendline.cpp index 68504a32d..3448387ae 100644 --- a/src/tools/drawTools/vtoolendline.cpp +++ b/src/tools/drawTools/vtoolendline.cpp @@ -35,11 +35,11 @@ const QString VToolEndLine::ToolType = QStringLiteral("endLine"); VToolEndLine::VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const qreal &angle, const quint32 &basePointId, - const Tool::Sources &typeCreation, QGraphicsItem *parent) + const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, basePointId, angle, parent) { - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -74,13 +74,13 @@ void VToolEndLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPatter qreal angle = dialogTool->getAngle(); quint32 basePointId = dialogTool->getBasePointId(); Create(0, pointName, typeLine, formula, angle, basePointId, 5, 10, scene, doc, data, Document::FullParse, - Tool::FromGui); + Valentina::FromGui); } void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qreal &angle, const quint32 &basePointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, - VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) + VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VPointF *basePoint = data->GeometricObject(basePointId); QLineF line = QLineF(basePoint->toQPointF(), QPointF(basePoint->x()+100, basePoint->y())); @@ -92,7 +92,7 @@ void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QSt line.setLength(toPixel(result)); line.setAngle(angle); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(new VPointF(line.p2().x(), line.p2().y(), pointName, mx, my)); data->AddLine(basePointId, id); @@ -106,7 +106,7 @@ void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QSt doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::EndLineTool, doc); + VDrawTool::AddRecord(id, Valentina::EndLineTool, doc); if (parse == Document::FullParse) { VToolEndLine *point = new VToolEndLine(doc, data, id, typeLine, formula, angle, diff --git a/src/tools/drawTools/vtoolendline.h b/src/tools/drawTools/vtoolendline.h index 98eebac48..f386e360e 100644 --- a/src/tools/drawTools/vtoolendline.h +++ b/src/tools/drawTools/vtoolendline.h @@ -52,7 +52,7 @@ public: */ VToolEndLine(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const qreal &angle, const quint32 &basePointId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); + const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ @@ -84,7 +84,7 @@ public: static void Create(const quint32 _id, const QString &pointName, const QString &typeLine, const QString &formula, const qreal &angle, const quint32 &basePointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); + const Document::Documents &parse, const Valentina::Sources &typeCreation); static const QString ToolType; public slots: /** diff --git a/src/tools/drawTools/vtoolheight.cpp b/src/tools/drawTools/vtoolheight.cpp index 9f3525cba..c468180a6 100644 --- a/src/tools/drawTools/vtoolheight.cpp +++ b/src/tools/drawTools/vtoolheight.cpp @@ -33,11 +33,11 @@ const QString VToolHeight::ToolType = QStringLiteral("height"); VToolHeight::VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, - const Tool::Sources &typeCreation, QGraphicsItem * parent) + const Valentina::Sources &typeCreation, QGraphicsItem * parent) :VToolLinePoint(doc, data, id, typeLine, QString(), basePointId, 0, parent), p1LineId(p1LineId), p2LineId(p2LineId) { ignoreFullUpdate = true; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -73,13 +73,13 @@ void VToolHeight::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern quint32 p1LineId = dialogTool->getP1LineId(); quint32 p2LineId = dialogTool->getP2LineId(); Create(0, pointName, typeLine, basePointId, p1LineId, p2LineId, 5, 10, scene, doc, data, - Document::FullParse, Tool::FromGui); + Document::FullParse, Valentina::FromGui); } void VToolHeight::Create(const quint32 _id, const QString &pointName, const QString &typeLine, const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, - VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) + VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VPointF *basePoint = data->GeometricObject(basePointId); const VPointF *p1Line = data->GeometricObject(p1LineId); @@ -87,7 +87,7 @@ void VToolHeight::Create(const quint32 _id, const QString &pointName, const QStr QPointF pHeight = FindPoint(QLineF(p1Line->toQPointF(), p2Line->toQPointF()), basePoint->toQPointF()); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(new VPointF(pHeight.x(), pHeight.y(), pointName, mx, my)); data->AddLine(basePointId, id); @@ -105,7 +105,7 @@ void VToolHeight::Create(const quint32 _id, const QString &pointName, const QStr doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::Height, doc); + VDrawTool::AddRecord(id, Valentina::Height, doc); if (parse == Document::FullParse) { VToolHeight *point = new VToolHeight(doc, data, id, typeLine, basePointId, p1LineId, p2LineId, diff --git a/src/tools/drawTools/vtoolheight.h b/src/tools/drawTools/vtoolheight.h index 5adb588b1..ce1105806 100644 --- a/src/tools/drawTools/vtoolheight.h +++ b/src/tools/drawTools/vtoolheight.h @@ -52,7 +52,7 @@ public: */ VToolHeight(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); + const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ @@ -84,7 +84,7 @@ public: static void Create(const quint32 _id, const QString &pointName, const QString &typeLine, const quint32 &basePointId, const quint32 &p1LineId, const quint32 &p2LineId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, - VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); + VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation); /** * @brief FindPoint find projection base point onto line. * @param line line diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index 938855141..b1a768007 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -32,7 +32,7 @@ const QString VToolLine::TagName = QStringLiteral("line"); VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, quint32 secondPoint, - const QString &typeLine, const Tool::Sources &typeCreation, QGraphicsItem *parent) + const QString &typeLine, const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VDrawTool(doc, data, id), QGraphicsLineItem(parent), firstPoint(firstPoint), secondPoint(secondPoint) { this->typeLine = typeLine; @@ -47,7 +47,7 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP this->setAcceptHoverEvents(true); this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor, LineStyle())); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -75,18 +75,18 @@ void VToolLine::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern * quint32 firstPoint = dialogTool->getFirstPoint(); quint32 secondPoint = dialogTool->getSecondPoint(); QString typeLine = dialogTool->getTypeLine(); - Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Tool::FromGui); + Create(0, firstPoint, secondPoint, typeLine, scene, doc, data, Document::FullParse, Valentina::FromGui); } void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation) + const Document::Documents &parse, const Valentina::Sources &typeCreation) { Q_CHECK_PTR(scene); Q_CHECK_PTR(doc); Q_CHECK_PTR(data); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->getNextId(); data->AddLine(firstPoint, secondPoint); @@ -100,7 +100,7 @@ void VToolLine::Create(const quint32 &_id, const quint32 &firstPoint, const quin doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::LineTool, doc); + VDrawTool::AddRecord(id, Valentina::LineTool, doc); if (parse == Document::FullParse) { VToolLine *line = new VToolLine(doc, data, id, firstPoint, secondPoint, typeLine, typeCreation); diff --git a/src/tools/drawTools/vtoolline.h b/src/tools/drawTools/vtoolline.h index d1e8fc74d..be951fb59 100644 --- a/src/tools/drawTools/vtoolline.h +++ b/src/tools/drawTools/vtoolline.h @@ -52,7 +52,7 @@ public: * @param parent parent object. */ VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstPoint, - quint32 secondPoint, const QString &typeLine, const Tool::Sources &typeCreation, + quint32 secondPoint, const QString &typeLine, const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. @@ -80,7 +80,7 @@ public: */ static void Create(const quint32 &_id, const quint32 &firstPoint, const quint32 &secondPoint, const QString &typeLine, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); + const Document::Documents &parse, const Valentina::Sources &typeCreation); static const QString TagName; public slots: /** diff --git a/src/tools/drawTools/vtoollineintersect.cpp b/src/tools/drawTools/vtoollineintersect.cpp index d6ec5cc8f..7688e8414 100644 --- a/src/tools/drawTools/vtoollineintersect.cpp +++ b/src/tools/drawTools/vtoollineintersect.cpp @@ -33,13 +33,13 @@ const QString VToolLineIntersect::ToolType = QStringLiteral("lineIntersect"); VToolLineIntersect::VToolLineIntersect(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &p1Line1, const quint32 &p2Line1, const quint32 &p1Line2, - const quint32 &p2Line2, const Tool::Sources &typeCreation, + const quint32 &p2Line2, const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), p1Line1(p1Line1), p2Line1(p2Line1), p1Line2(p1Line2), p2Line2(p2Line2) { ignoreFullUpdate = true; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -73,14 +73,14 @@ void VToolLineIntersect::Create(DialogTool *dialog, VMainGraphicsScene *scene, V quint32 p2Line2Id = dialogTool->getP2Line2(); QString pointName = dialogTool->getPointName(); Create(0, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, pointName, 5, 10, scene, doc, data, - Document::FullParse, Tool::FromGui); + Document::FullParse, Valentina::FromGui); } void VToolLineIntersect::Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id, const quint32 &p1Line2Id, const quint32 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation) + const Valentina::Sources &typeCreation) { const VPointF *p1Line1 = data->GeometricObject(p1Line1Id); const VPointF *p2Line1 = data->GeometricObject(p2Line1Id); @@ -94,7 +94,7 @@ void VToolLineIntersect::Create(const quint32 _id, const quint32 &p1Line1Id, con if (intersect == QLineF::UnboundedIntersection || intersect == QLineF::BoundedIntersection) { quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(new VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); data->AddLine(p1Line1Id, id); @@ -114,7 +114,7 @@ void VToolLineIntersect::Create(const quint32 _id, const quint32 &p1Line1Id, con doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::LineIntersectTool, doc); + VDrawTool::AddRecord(id, Valentina::LineIntersectTool, doc); if (parse == Document::FullParse) { VToolLineIntersect *point = new VToolLineIntersect(doc, data, id, p1Line1Id, p2Line1Id, p1Line2Id, diff --git a/src/tools/drawTools/vtoollineintersect.h b/src/tools/drawTools/vtoollineintersect.h index 00fb946f8..521458048 100644 --- a/src/tools/drawTools/vtoollineintersect.h +++ b/src/tools/drawTools/vtoollineintersect.h @@ -52,7 +52,7 @@ public: */ VToolLineIntersect(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &p1Line1, const quint32 &p2Line1, const quint32 &p1Line2, const quint32 &p2Line2, - const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); + const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ @@ -84,7 +84,7 @@ public: static void Create(const quint32 _id, const quint32 &p1Line1Id, const quint32 &p2Line1Id, const quint32 &p1Line2Id, const quint32 &p2Line2Id, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); + const Document::Documents &parse, const Valentina::Sources &typeCreation); static const QString ToolType; public slots: /** diff --git a/src/tools/drawTools/vtoolnormal.cpp b/src/tools/drawTools/vtoolnormal.cpp index bcc9f0eb0..03edae31f 100644 --- a/src/tools/drawTools/vtoolnormal.cpp +++ b/src/tools/drawTools/vtoolnormal.cpp @@ -34,12 +34,12 @@ const QString VToolNormal::ToolType = QStringLiteral("normal"); VToolNormal::VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const qreal &angle, const quint32 &firstPointId, - const quint32 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) + const quint32 &secondPointId, const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VToolLinePoint(doc, data, id, typeLine, formula, firstPointId, angle, parent), secondPointId(secondPointId) { - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -75,14 +75,14 @@ void VToolNormal::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern QString pointName = dialogTool->getPointName(); qreal angle = dialogTool->getAngle(); Create(0, formula, firstPointId, secondPointId, typeLine, pointName, angle, 5, 10, scene, doc, data, - Document::FullParse, Tool::FromGui); + Document::FullParse, Valentina::FromGui); } void VToolNormal::Create(const quint32 _id, const QString &formula, const quint32 &firstPointId, const quint32 &secondPointId, const QString &typeLine, const QString &pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation) + const Valentina::Sources &typeCreation) { const VPointF *firstPoint = data->GeometricObject(firstPointId); const VPointF *secondPoint = data->GeometricObject(secondPointId); @@ -94,7 +94,7 @@ void VToolNormal::Create(const quint32 _id, const QString &formula, const quint3 QPointF fPoint = VToolNormal::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), toPixel(result), angle); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(new VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); data->AddLine(firstPointId, id); @@ -108,7 +108,7 @@ void VToolNormal::Create(const quint32 _id, const QString &formula, const quint3 doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::NormalTool, doc); + VDrawTool::AddRecord(id, Valentina::NormalTool, doc); if (parse == Document::FullParse) { VToolNormal *point = new VToolNormal(doc, data, id, typeLine, formula, angle, diff --git a/src/tools/drawTools/vtoolnormal.h b/src/tools/drawTools/vtoolnormal.h index dc6241e68..da1d0170b 100644 --- a/src/tools/drawTools/vtoolnormal.h +++ b/src/tools/drawTools/vtoolnormal.h @@ -53,7 +53,7 @@ public: */ VToolNormal(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const qreal &angle, const quint32 &firstPointId, - const quint32 &secondPointId, const Tool::Sources &typeCreation, + const quint32 &secondPointId, const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. @@ -88,7 +88,7 @@ public: const quint32 &secondPointId, const QString &typeLine, const QString &pointName, const qreal angle, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); + const Valentina::Sources &typeCreation); /** * @brief FindPoint return normal point. * @param firstPoint first line point. diff --git a/src/tools/drawTools/vtoolpoint.cpp b/src/tools/drawTools/vtoolpoint.cpp index 4b63db3b8..8ab589871 100644 --- a/src/tools/drawTools/vtoolpoint.cpp +++ b/src/tools/drawTools/vtoolpoint.cpp @@ -113,7 +113,7 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - emit ChoosedTool(id, Scene::Point); + emit ChoosedTool(id, Valentina::Point); } QGraphicsItem::mouseReleaseEvent(event); } diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index 0791d4dfd..d72235f0a 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -35,11 +35,11 @@ const QString VToolPointOfContact::ToolType = QStringLiteral("pointOfContact"); VToolPointOfContact::VToolPointOfContact(VPattern *doc, VContainer *data, const quint32 &id, const QString &radius, const quint32 ¢er, const quint32 &firstPointId, const quint32 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem *parent) + const Valentina::Sources &typeCreation, QGraphicsItem *parent) : VToolPoint(doc, data, id, parent), arcRadius(radius), center(center), firstPointId(firstPointId), secondPointId(secondPointId) { - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -99,14 +99,14 @@ void VToolPointOfContact::Create(DialogTool *dialog, VMainGraphicsScene *scene, quint32 secondPointId = dialogTool->getSecondPoint(); QString pointName = dialogTool->getPointName(); Create(0, radius, center, firstPointId, secondPointId, pointName, 5, 10, scene, doc, data, - Document::FullParse, Tool::FromGui); + Document::FullParse, Valentina::FromGui); } void VToolPointOfContact::Create(const quint32 _id, const QString &radius, const quint32 ¢er, const quint32 &firstPointId, const quint32 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation) + const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VPointF *centerP = data->GeometricObject(center); const VPointF *firstP = data->GeometricObject(firstPointId); @@ -120,7 +120,7 @@ void VToolPointOfContact::Create(const quint32 _id, const QString &radius, const QPointF fPoint = VToolPointOfContact::FindPoint(toPixel(result), centerP->toQPointF(), firstP->toQPointF(), secondP->toQPointF()); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(new VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); data->AddLine(firstPointId, id); @@ -138,7 +138,7 @@ void VToolPointOfContact::Create(const quint32 _id, const QString &radius, const doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::PointOfContact, doc); + VDrawTool::AddRecord(id, Valentina::PointOfContact, doc); if (parse == Document::FullParse) { VToolPointOfContact *point = new VToolPointOfContact(doc, data, id, radius, center, diff --git a/src/tools/drawTools/vtoolpointofcontact.h b/src/tools/drawTools/vtoolpointofcontact.h index 76d0d90b7..0199dbdba 100644 --- a/src/tools/drawTools/vtoolpointofcontact.h +++ b/src/tools/drawTools/vtoolpointofcontact.h @@ -52,7 +52,7 @@ public: VToolPointOfContact(VPattern *doc, VContainer *data, const quint32 &id, const QString &arcRadius, const quint32 ¢er, const quint32 &firstPointId, const quint32 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); + const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ @@ -94,7 +94,7 @@ public: static void Create(const quint32 _id, const QString &arcRadius, const quint32 ¢er, const quint32 &firstPointId, const quint32 &secondPointId, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, - VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation); + VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation); static const QString ToolType; public slots: /** diff --git a/src/tools/drawTools/vtoolpointofintersection.cpp b/src/tools/drawTools/vtoolpointofintersection.cpp index 6744f1d6f..1fe8457a5 100644 --- a/src/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/tools/drawTools/vtoolpointofintersection.cpp @@ -33,11 +33,11 @@ const QString VToolPointOfIntersection::ToolType = QStringLiteral("pointOfInters VToolPointOfIntersection::VToolPointOfIntersection(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &firstPointId, const quint32 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem *parent) + const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), firstPointId(firstPointId), secondPointId(secondPointId) { ignoreFullUpdate = true; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -67,20 +67,20 @@ void VToolPointOfIntersection::Create(DialogTool *dialog, VMainGraphicsScene *sc quint32 firstPointId = dialogTool->getFirstPointId(); quint32 secondPointId = dialogTool->getSecondPointId(); QString pointName = dialogTool->getPointName(); - Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, Tool::FromGui); + Create(0, pointName, firstPointId, secondPointId, 5, 10, scene, doc, data, Document::FullParse, Valentina::FromGui); } void VToolPointOfIntersection::Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation) + const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VPointF *firstPoint = data->GeometricObject(firstPointId); const VPointF *secondPoint = data->GeometricObject(secondPointId); QPointF point(firstPoint->x(), secondPoint->y()); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(new VPointF(point.x(), point.y(), pointName, mx, my)); } @@ -92,7 +92,7 @@ void VToolPointOfIntersection::Create(const quint32 _id, const QString &pointNam doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::PointOfIntersection, doc); + VDrawTool::AddRecord(id, Valentina::PointOfIntersection, doc); if (parse == Document::FullParse) { VToolPointOfIntersection *point = new VToolPointOfIntersection(doc, data, id, firstPointId, diff --git a/src/tools/drawTools/vtoolpointofintersection.h b/src/tools/drawTools/vtoolpointofintersection.h index d6df58072..89fc26709 100644 --- a/src/tools/drawTools/vtoolpointofintersection.h +++ b/src/tools/drawTools/vtoolpointofintersection.h @@ -50,7 +50,7 @@ public: */ VToolPointOfIntersection(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &firstPointId, const quint32 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); + const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ @@ -80,7 +80,7 @@ public: static void Create(const quint32 _id, const QString &pointName, const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); + const Valentina::Sources &typeCreation); static const QString ToolType; public slots: /** diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 4f137473d..1c35b3d40 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -34,11 +34,11 @@ const QString VToolShoulderPoint::ToolType = QStringLiteral("shoulder"); VToolShoulderPoint::VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const quint32 &p1Line, const quint32 &p2Line, - const quint32 &pShoulder, const Tool::Sources &typeCreation, + const quint32 &pShoulder, const Valentina::Sources &typeCreation, QGraphicsItem * parent) :VToolLinePoint(doc, data, id, typeLine, formula, p1Line, 0, parent), p2Line(p2Line), pShoulder(pShoulder) { - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -101,14 +101,14 @@ void VToolShoulderPoint::Create(DialogTool *dialog, VMainGraphicsScene *scene, V QString typeLine = dialogTool->getTypeLine(); QString pointName = dialogTool->getPointName(); Create(0, formula, p1Line, p2Line, pShoulder, typeLine, pointName, 5, 10, scene, doc, data, - Document::FullParse, Tool::FromGui); + Document::FullParse, Valentina::FromGui); } void VToolShoulderPoint::Create(const quint32 _id, const QString &formula, const quint32 &p1Line, const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation) + const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VPointF *firstPoint = data->GeometricObject(p1Line); const VPointF *secondPoint = data->GeometricObject(p2Line); @@ -122,7 +122,7 @@ void VToolShoulderPoint::Create(const quint32 _id, const QString &formula, const QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), shoulderPoint->toQPointF(), toPixel(result)); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(new VPointF(fPoint.x(), fPoint.y(), pointName, mx, my)); data->AddLine(p1Line, id); @@ -138,7 +138,7 @@ void VToolShoulderPoint::Create(const quint32 _id, const QString &formula, const doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::ShoulderPointTool, doc); + VDrawTool::AddRecord(id, Valentina::ShoulderPointTool, doc); if (parse == Document::FullParse) { VToolShoulderPoint *point = new VToolShoulderPoint(doc, data, id, typeLine, formula, diff --git a/src/tools/drawTools/vtoolshoulderpoint.h b/src/tools/drawTools/vtoolshoulderpoint.h index 2de3803be..8885dc8d6 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.h +++ b/src/tools/drawTools/vtoolshoulderpoint.h @@ -53,7 +53,7 @@ public: */ VToolShoulderPoint(VPattern *doc, VContainer *data, const quint32 &id, const QString &typeLine, const QString &formula, const quint32 &p1Line, const quint32 &p2Line, - const quint32 &pShoulder, const Tool::Sources &typeCreation, + const quint32 &pShoulder, const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. @@ -97,7 +97,7 @@ public: static void Create(const quint32 _id, const QString &formula, const quint32 &p1Line, const quint32 &p2Line, const quint32 &pShoulder, const QString &typeLine, const QString &pointName, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); + const Document::Documents &parse, const Valentina::Sources &typeCreation); static const QString ToolType; public slots: /** diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index a475a1f64..4447f1fa7 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -31,7 +31,7 @@ const QString VToolSinglePoint::ToolType = QStringLiteral("single"); -VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, +VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, QGraphicsItem * parent ) :VToolPoint(doc, data, id, parent) { @@ -42,7 +42,7 @@ VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); this->setFlag(QGraphicsItem::ItemIsFocusable, false); setColorLabel(Qt::black); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } diff --git a/src/tools/drawTools/vtoolsinglepoint.h b/src/tools/drawTools/vtoolsinglepoint.h index c869e81f6..90fbfbd67 100644 --- a/src/tools/drawTools/vtoolsinglepoint.h +++ b/src/tools/drawTools/vtoolsinglepoint.h @@ -47,7 +47,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, + VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr ); /** * @brief setDialog set dialog when user want change tool option. diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index 09fbf4381..b3db920ea 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -32,7 +32,7 @@ const QString VToolSpline::ToolType = QStringLiteral("simple"); -VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, +VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent) { const VSpline *spl = data->GeometricObject(id); @@ -61,7 +61,7 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Tool connect(this, &VToolSpline::setEnabledPoint, controlPoint2, &VControlPointSpline::setEnabledPoint); controlPoints.append(controlPoint2); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -100,19 +100,19 @@ void VToolSpline::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern qreal angle2 = dialogTool->getAngle2(); qreal kCurve = dialogTool->getKCurve(); Create(0, p1, p4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, doc, data, Document::FullParse, - Tool::FromGui); + Valentina::FromGui); } void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation) + const Document::Documents &parse, const Valentina::Sources &typeCreation) { VPointF point1 = *data->GeometricObject(p1); VPointF point4 = *data->GeometricObject(p4); VSpline *spline = new VSpline(point1, point4, angle1, angle2, kAsm1, kAsm2, kCurve); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(spline); data->AddLengthSpline(spline->name(), toMM(spline->GetLength())); @@ -126,7 +126,7 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4 doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::SplineTool, doc); + VDrawTool::AddRecord(id, Valentina::SplineTool, doc); if (parse == Document::FullParse) { VToolSpline *spl = new VToolSpline(doc, data, id, typeCreation); @@ -209,7 +209,7 @@ void VToolSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - emit ChoosedTool(id, Scene::Spline); + emit ChoosedTool(id, Valentina::Spline); } QGraphicsItem::mouseReleaseEvent(event); } diff --git a/src/tools/drawTools/vtoolspline.h b/src/tools/drawTools/vtoolspline.h index ead416779..1f42f5060 100644 --- a/src/tools/drawTools/vtoolspline.h +++ b/src/tools/drawTools/vtoolspline.h @@ -47,7 +47,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolSpline (VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, + VToolSpline (VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr ); /** * @brief setDialog set dialog when user want change tool option. @@ -80,7 +80,7 @@ public: static void Create(const quint32 _id, const quint32 &p1, const quint32 &p4, const qreal &kAsm1, const qreal kAsm2, const qreal &angle1, const qreal &angle2, const qreal &kCurve, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); + const Document::Documents &parse, const Valentina::Sources &typeCreation); static const QString ToolType; public slots: /** diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index 3f4df7ef0..b5aaf2378 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -31,7 +31,7 @@ const QString VToolSplinePath::ToolType = QStringLiteral("path"); -VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, +VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VAbstractSpline(doc, data, id, parent) { const VSplinePath *splPath = data->GeometricObject(id); @@ -62,7 +62,7 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co connect(this, &VToolSplinePath::setEnabledPoint, controlPoint, &VControlPointSpline::setEnabledPoint); controlPoints.append(controlPoint); } - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -91,15 +91,15 @@ void VToolSplinePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPat { doc->IncrementReferens((*path)[i].P().id()); } - Create(0, path, scene, doc, data, Document::FullParse, Tool::FromGui); + Create(0, path, scene, doc, data, Document::FullParse, Valentina::FromGui); } void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation) + const Valentina::Sources &typeCreation) { quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(path); data->AddLengthSpline(path->name(), toMM(path->GetLength())); @@ -113,7 +113,7 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::SplinePathTool, doc); + VDrawTool::AddRecord(id, Valentina::SplinePathTool, doc); if (parse == Document::FullParse) { VToolSplinePath *spl = new VToolSplinePath(doc, data, id, typeCreation); @@ -256,7 +256,7 @@ void VToolSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - emit ChoosedTool(id, Scene::SplinePath); + emit ChoosedTool(id, Valentina::SplinePath); } QGraphicsItem::mouseReleaseEvent(event); } diff --git a/src/tools/drawTools/vtoolsplinepath.h b/src/tools/drawTools/vtoolsplinepath.h index ab009fbcc..4e7ca8358 100644 --- a/src/tools/drawTools/vtoolsplinepath.h +++ b/src/tools/drawTools/vtoolsplinepath.h @@ -46,7 +46,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Tool::Sources &typeCreation, + VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. @@ -72,7 +72,7 @@ public: */ static void Create(const quint32 _id, VSplinePath *path, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); + const Valentina::Sources &typeCreation); static const QString ToolType; signals: /** diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index 1e86786ee..9529d0d7c 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -33,12 +33,12 @@ const QString VToolTriangle::ToolType = QStringLiteral("triangle"); VToolTriangle::VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &axisP1Id, const quint32 &axisP2Id, const quint32 &firstPointId, - const quint32 &secondPointId, const Tool::Sources &typeCreation, QGraphicsItem *parent) + const quint32 &secondPointId, const Valentina::Sources &typeCreation, QGraphicsItem *parent) :VToolPoint(doc, data, id, parent), axisP1Id(axisP1Id), axisP2Id(axisP2Id), firstPointId(firstPointId), secondPointId(secondPointId) { ignoreFullUpdate = true; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -73,13 +73,13 @@ void VToolTriangle::Create(DialogTool *dialog, VMainGraphicsScene *scene, quint32 secondPointId = dialogTool->getSecondPointId(); QString pointName = dialogTool->getPointName(); Create(0, pointName, axisP1Id, axisP2Id, firstPointId, secondPointId, 5, 10, scene, doc, data, - Document::FullParse, Tool::FromGui); + Document::FullParse, Valentina::FromGui); } void VToolTriangle::Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id, const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, - VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) + VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation) { const VPointF *axisP1 = data->GeometricObject(axisP1Id); const VPointF *axisP2 = data->GeometricObject(axisP2Id); @@ -89,7 +89,7 @@ void VToolTriangle::Create(const quint32 _id, const QString &pointName, const qu QPointF point = FindPoint(axisP1->toQPointF(), axisP2->toQPointF(), firstPoint->toQPointF(), secondPoint->toQPointF()); quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->AddGObject(new VPointF(point.x(), point.y(), pointName, mx, my)); } @@ -101,7 +101,7 @@ void VToolTriangle::Create(const quint32 _id, const QString &pointName, const qu doc->UpdateToolData(id, data); } } - VDrawTool::AddRecord(id, Tool::Triangle, doc); + VDrawTool::AddRecord(id, Valentina::Triangle, doc); if (parse == Document::FullParse) { VToolTriangle *point = new VToolTriangle(doc, data, id, axisP1Id, axisP2Id, firstPointId, diff --git a/src/tools/drawTools/vtooltriangle.h b/src/tools/drawTools/vtooltriangle.h index ffdb63e30..7495e3b3c 100644 --- a/src/tools/drawTools/vtooltriangle.h +++ b/src/tools/drawTools/vtooltriangle.h @@ -52,7 +52,7 @@ public: */ VToolTriangle(VPattern *doc, VContainer *data, const quint32 &id, const quint32 &axisP1Id, const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId, - const Tool::Sources &typeCreation, QGraphicsItem * parent = nullptr); + const Valentina::Sources &typeCreation, QGraphicsItem * parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ @@ -84,7 +84,7 @@ public: static void Create(const quint32 _id, const QString &pointName, const quint32 &axisP1Id, const quint32 &axisP2Id, const quint32 &firstPointId, const quint32 &secondPointId, const qreal &mx, const qreal &my, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation); + const Document::Documents &parse, const Valentina::Sources &typeCreation); /** * @brief FindPoint find point intersection two foots right triangle. * @param axisP1 first axis point. diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index e2d55ef9f..bf3e69c78 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -33,14 +33,14 @@ const QString VNodeArc::TagName = QStringLiteral("arc"); const QString VNodeArc::ToolType = QStringLiteral("modeling"); -VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Tool::Sources &typeCreation, +VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent) :VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); this->setPen(QPen(baseColor, toPixel(widthHairLine))); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -51,9 +51,9 @@ VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, c } void VNodeArc::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document::Documents &parse, - const Tool::Sources &typeCreation, const quint32 &idTool, QObject *parent) + const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *parent) { - VAbstractTool::AddRecord(id, Tool::NodeArc, doc); + VAbstractTool::AddRecord(id, Valentina::NodeArc, doc); if (parse == Document::FullParse) { VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent); @@ -120,7 +120,7 @@ void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - emit ChoosedTool(id, Scene::Arc); + emit ChoosedTool(id, Valentina::Arc); } QGraphicsItem::mouseReleaseEvent(event); } diff --git a/src/tools/nodeDetails/vnodearc.h b/src/tools/nodeDetails/vnodearc.h index 2564b429b..e548a2e5e 100644 --- a/src/tools/nodeDetails/vnodearc.h +++ b/src/tools/nodeDetails/vnodearc.h @@ -48,7 +48,7 @@ public: * @param typeCreation way we create this tool. * @param parent parent object. */ - VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Tool::Sources &typeCreation, + VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Valentina::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr); /** * @brief Create help create tool. @@ -60,7 +60,7 @@ public: * @param typeCreation way we create this tool. */ static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, const Document::Documents &parse, - const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr); + const Valentina::Sources &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr); static const QString TagName; static const QString ToolType; /** diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index cf21cc2e1..9928d87c9 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -34,7 +34,7 @@ const QString VNodePoint::TagName = QStringLiteral("point"); const QString VNodePoint::ToolType = QStringLiteral("modeling"); VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, - const Tool::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, + const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent) :VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), namePoint(nullptr), lineName(nullptr) @@ -48,7 +48,7 @@ VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPo this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); RefreshPointGeometry(*VAbstractTool::data.GeometricObject(id)); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -59,10 +59,10 @@ VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPo } void VNodePoint::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, - const Document::Documents &parse, const Tool::Sources &typeCreation, const quint32 &idTool, + const Document::Documents &parse, const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *parent) { - VAbstractTool::AddRecord(id, Tool::NodePoint, doc); + VAbstractTool::AddRecord(id, Valentina::NodePoint, doc); if (parse == Document::FullParse) { //TODO Need create garbage collector and remove all nodes, what we don't use. @@ -137,7 +137,7 @@ void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - emit ChoosedTool(id, Scene::Point); + emit ChoosedTool(id, Valentina::Point); } QGraphicsItem::mouseReleaseEvent(event); } diff --git a/src/tools/nodeDetails/vnodepoint.h b/src/tools/nodeDetails/vnodepoint.h index 951d4e0af..af513d3b5 100644 --- a/src/tools/nodeDetails/vnodepoint.h +++ b/src/tools/nodeDetails/vnodepoint.h @@ -49,7 +49,7 @@ public: * @param parent parent object. */ VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, - const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = nullptr, + const Valentina::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr ); /** * @brief Create help create tool. @@ -61,7 +61,7 @@ public: * @param typeCreation way we create this tool. */ static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, - const Document::Documents &parse, const Tool::Sources &typeCreation, const quint32 &idTool = 0, + const Document::Documents &parse, const Valentina::Sources &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr); static const QString TagName; static const QString ToolType; diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index 3aff1236f..2661882c3 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -34,14 +34,14 @@ const QString VNodeSpline::TagName = QStringLiteral("spline"); const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline"); VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, - const Tool::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, + const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, QGraphicsItem * parent) :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); this->setPen(QPen(baseColor, toPixel(widthHairLine))); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -52,10 +52,10 @@ VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 id } VNodeSpline *VNodeSpline::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, - const Document::Documents &parse, const Tool::Sources &typeCreation, + const Document::Documents &parse, const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *parent) { - VAbstractTool::AddRecord(id, Tool::NodeSpline, doc); + VAbstractTool::AddRecord(id, Valentina::NodeSpline, doc); VNodeSpline *spl = nullptr; if (parse == Document::FullParse) { @@ -124,7 +124,7 @@ void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - emit ChoosedTool(id, Scene::Spline); + emit ChoosedTool(id, Valentina::Spline); } QGraphicsItem::mouseReleaseEvent(event); } diff --git a/src/tools/nodeDetails/vnodespline.h b/src/tools/nodeDetails/vnodespline.h index 1384ea97e..b7e680e40 100644 --- a/src/tools/nodeDetails/vnodespline.h +++ b/src/tools/nodeDetails/vnodespline.h @@ -49,7 +49,7 @@ public: * @param parent parent object. */ VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, - const Tool::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = nullptr, + const Valentina::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr); /** * @brief Create help create tool. @@ -62,7 +62,7 @@ public: * @return */ static VNodeSpline *Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, - const Document::Documents &parse, const Tool::Sources &typeCreation, + const Document::Documents &parse, const Valentina::Sources &typeCreation, const quint32 &idTool = 0, QObject *parent = nullptr); static const QString TagName; static const QString ToolType; diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index 5470e1cd0..5008aa1bb 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -34,14 +34,14 @@ const QString VNodeSplinePath::TagName = QStringLiteral("spline"); const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, - const Tool::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, + const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, QGraphicsItem * parent) :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); this->setPen(QPen(baseColor, toPixel(widthHairLine))); - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -52,10 +52,10 @@ VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, qu } void VNodeSplinePath::Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, - const Document::Documents &parse, const Tool::Sources &typeCreation, const quint32 &idTool, + const Document::Documents &parse, const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *parent) { - VAbstractTool::AddRecord(id, Tool::NodeSplinePath, doc); + VAbstractTool::AddRecord(id, Valentina::NodeSplinePath, doc); if (parse == Document::FullParse) { VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent); @@ -127,7 +127,7 @@ void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - emit ChoosedTool(id, Scene::SplinePath); + emit ChoosedTool(id, Valentina::SplinePath); } QGraphicsItem::mouseReleaseEvent(event); } diff --git a/src/tools/nodeDetails/vnodesplinepath.h b/src/tools/nodeDetails/vnodesplinepath.h index 3d96c306a..8c0829543 100644 --- a/src/tools/nodeDetails/vnodesplinepath.h +++ b/src/tools/nodeDetails/vnodesplinepath.h @@ -49,7 +49,7 @@ public: * @param parent parent object. */ VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, - const Tool::Sources &typeCreation, const quint32 &idTool = 0, + const Valentina::Sources &typeCreation, const quint32 &idTool = 0, QObject *qoParent = nullptr, QGraphicsItem * parent = nullptr); /** * @brief Create help create tool. @@ -61,7 +61,7 @@ public: * @param typeCreation way we create this tool. */ static void Create(VPattern *doc, VContainer *data, quint32 id, quint32 idSpline, - const Document::Documents &parse, const Tool::Sources &typeCreation, const quint32 &idTool = 0, + const Document::Documents &parse, const Valentina::Sources &typeCreation, const quint32 &idTool = 0, QObject *parent = 0); static const QString TagName; static const QString ToolType; diff --git a/src/tools/vabstracttool.cpp b/src/tools/vabstracttool.cpp index e6453f773..81337c83d 100644 --- a/src/tools/vabstracttool.cpp +++ b/src/tools/vabstracttool.cpp @@ -304,7 +304,7 @@ const QStringList VAbstractTool::Styles() return styles; } -void VAbstractTool::AddRecord(const quint32 id, const Tool::Tools &toolType, VPattern *doc) +void VAbstractTool::AddRecord(const quint32 id, const Valentina::Tools &toolType, VPattern *doc) { quint32 cursor = doc->getCursor(); QVector *history = doc->getHistory(); diff --git a/src/tools/vabstracttool.h b/src/tools/vabstracttool.h index 48b613971..430d2d290 100644 --- a/src/tools/vabstracttool.h +++ b/src/tools/vabstracttool.h @@ -153,7 +153,7 @@ public: * @param toolType tool type * @param doc dom document container */ - static void AddRecord(const quint32 id, const Tool::Tools &toolType, VPattern *doc); + static void AddRecord(const quint32 id, const Valentina::Tools &toolType, VPattern *doc); public slots: /** * @brief FullUpdateFromFile update tool data form file. @@ -169,7 +169,7 @@ signals: * @param id object id in container. * @param type type of scene object. */ - void ChoosedTool(quint32 id, Scene::Scenes type); + void ChoosedTool(quint32 id, Valentina::Scenes type); /** * @brief FullUpdateTree emit if need reparse pattern file. */ diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index 5ad9740b4..60504c451 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -47,7 +47,7 @@ const QString VToolDetail::NodePoint = QStringLiteral("NodePoint"); const QString VToolDetail::NodeSpline = QStringLiteral("NodeSpline"); const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath"); -VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Tool::Sources &typeCreation, +VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Valentina::Sources &typeCreation, VMainGraphicsScene *scene, QGraphicsItem *parent) :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene) { @@ -56,16 +56,16 @@ VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, con { switch (detail[i].getTypeTool()) { - case (Tool::NodePoint): + case (Valentina::NodePoint): InitTool(scene, detail[i]); break; - case (Tool::NodeArc): + case (Valentina::NodeArc): InitTool(scene, detail[i]); break; - case (Tool::NodeSpline): + case (Valentina::NodeSpline): InitTool(scene, detail[i]); break; - case (Tool::NodeSplinePath): + case (Valentina::NodeSplinePath): InitTool(scene, detail[i]); break; default: @@ -80,7 +80,7 @@ VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, con this->setPos(detail.getMx(), detail.getMy()); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); - if (typeCreation == Tool::FromGui || typeCreation == Tool::FromTool) + if (typeCreation == Valentina::FromGui || typeCreation == Valentina::FromTool) { AddToFile(); } @@ -112,28 +112,28 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern quint32 id = 0; switch (detail[i].getTypeTool()) { - case (Tool::NodePoint): + case (Valentina::NodePoint): { id = CreateNode(data, detail[i].getId()); - VNodePoint::Create(doc, data, id, detail[i].getId(), Document::FullParse, Tool::FromGui); + VNodePoint::Create(doc, data, id, detail[i].getId(), Document::FullParse, Valentina::FromGui); } break; - case (Tool::NodeArc): + case (Valentina::NodeArc): { id = CreateNode(data, detail[i].getId()); - VNodeArc::Create(doc, data, id, detail[i].getId(), Document::FullParse, Tool::FromGui); + VNodeArc::Create(doc, data, id, detail[i].getId(), Document::FullParse, Valentina::FromGui); } break; - case (Tool::NodeSpline): + case (Valentina::NodeSpline): { id = CreateNode(data, detail[i].getId()); - VNodeSpline::Create(doc, data, id, detail[i].getId(), Document::FullParse, Tool::FromGui); + VNodeSpline::Create(doc, data, id, detail[i].getId(), Document::FullParse, Valentina::FromGui); } break; - case (Tool::NodeSplinePath): + case (Valentina::NodeSplinePath): { id = CreateNode(data, detail[i].getId()); - VNodeSplinePath::Create(doc, data, id, detail[i].getId(), Document::FullParse, Tool::FromGui); + VNodeSplinePath::Create(doc, data, id, detail[i].getId(), Document::FullParse, Valentina::FromGui); } break; default: @@ -144,14 +144,14 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern det.append(node); } det.setName(detail.getName()); - Create(0, det, scene, doc, data, Document::FullParse, Tool::FromGui); + Create(0, det, scene, doc, data, Document::FullParse, Valentina::FromGui); } void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VPattern *doc, - VContainer *data, const Document::Documents &parse, const Tool::Sources &typeCreation) + VContainer *data, const Document::Documents &parse, const Valentina::Sources &typeCreation) { quint32 id = _id; - if (typeCreation == Tool::FromGui || typeCreation == Tool::FromTool) + if (typeCreation == Valentina::FromGui || typeCreation == Valentina::FromTool) { id = data->AddDetail(newDetail); } @@ -163,7 +163,7 @@ void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGrap doc->UpdateToolData(id, data); } } - VAbstractTool::AddRecord(id, Tool::Detail, doc); + VAbstractTool::AddRecord(id, Valentina::DetailTool, doc); if (parse == Document::FullParse) { VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene); @@ -320,7 +320,7 @@ void VToolDetail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - emit ChoosedTool(id, Scene::Detail); + emit ChoosedTool(id, Valentina::Detail); } QGraphicsItem::mouseReleaseEvent(event); } @@ -382,16 +382,16 @@ void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node) } switch (node.getTypeTool()) { - case (Tool::NodeArc): + case (Valentina::NodeArc): doc->SetAttribute(nod, AttrType, NodeArc); break; - case (Tool::NodePoint): + case (Valentina::NodePoint): doc->SetAttribute(nod, AttrType, NodePoint); break; - case (Tool::NodeSpline): + case (Valentina::NodeSpline): doc->SetAttribute(nod, AttrType, NodeSpline); break; - case (Tool::NodeSplinePath): + case (Valentina::NodeSplinePath): doc->SetAttribute(nod, AttrType, NodeSplinePath); break; default: diff --git a/src/tools/vtooldetail.h b/src/tools/vtooldetail.h index 21f84bb48..2a6b44b14 100644 --- a/src/tools/vtooldetail.h +++ b/src/tools/vtooldetail.h @@ -49,7 +49,7 @@ public: * @param scene pointer to scene. * @param parent parent object */ - VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Tool::Sources &typeCreation, + VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, const Valentina::Sources &typeCreation, VMainGraphicsScene *scene, QGraphicsItem * parent = nullptr); ~VToolDetail(); /** @@ -67,7 +67,7 @@ public: { //We can't use exist object. Need create new. T *node = new T(*data->GeometricObject(id)); - node->setMode(Draw::Modeling); + node->setMode(Valentina::Modeling); return data->AddGObject(node); } @@ -91,7 +91,7 @@ public: */ static void Create(const quint32 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); + const Valentina::Sources &typeCreation); static const QString TagName; static const QString TagNode; static const QString AttrSupplement; diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index 31c68715c..2c0c44e0b 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -43,10 +43,10 @@ const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling"); VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, const VDetail &d2, const quint32 &indexD1, const quint32 &indexD2, - const Tool::Sources &typeCreation, QObject *parent) + const Valentina::Sources &typeCreation, QObject *parent) :VAbstractTool(doc, data, id, parent), d1(d1), d2(d2), indexD1(indexD1), indexD2(indexD2) { - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { AddToFile(); } @@ -63,7 +63,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer quint32 id = 0, idObject = 0; switch (det.at(i).getTypeTool()) { - case (Tool::NodePoint): + case (Valentina::NodePoint): { if ( qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && (pRotate == 0)) { @@ -72,18 +72,18 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer else { VPointF *point = new VPointF(*data->GeometricObject(det.at(i).getId())); - point->setMode(Draw::Modeling); + point->setMode(Valentina::Modeling); BiasRotatePoint(point, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); idObject = data->AddGObject(point); VPointF *point1 = new VPointF(*point); - point1->setMode(Draw::Modeling); + point1->setMode(Valentina::Modeling); id = data->AddGObject(point1); - VNodePoint::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); + VNodePoint::Create(doc, data, id, idObject, Document::FullParse, Valentina::FromGui, idTool, tool); } } break; - case (Tool::NodeArc): + case (Valentina::NodeArc): { if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) { @@ -102,24 +102,24 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer QLineF l1(center->toQPointF(), p1.toQPointF()); QLineF l2(center->toQPointF(), p2.toQPointF()); - center->setMode(Draw::Modeling); + center->setMode(Valentina::Modeling); quint32 idCenter = data->AddGObject(center); Q_UNUSED(idCenter); VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle())); - arc1->setMode(Draw::Modeling); + arc1->setMode(Valentina::Modeling); idObject = data->AddGObject(arc1); VArc *arc2 = new VArc(*arc1); - arc2->setMode(Draw::Modeling); + arc2->setMode(Valentina::Modeling); id = data->AddGObject(arc2); - VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); + VNodeArc::Create(doc, data, id, idObject, Document::FullParse, Valentina::FromGui, idTool, tool); } } break; - case (Tool::NodeSpline): + case (Valentina::NodeSpline): { if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) { @@ -144,17 +144,17 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer quint32 idP4 = data->AddGObject(p4); VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, - Draw::Modeling); + Valentina::Modeling); idObject = data->AddGObject(spl); VSpline *spl1 = new VSpline(*spl); - spl1->setMode(Draw::Modeling); + spl1->setMode(Valentina::Modeling); id = data->AddGObject(spl1); - VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); + VNodeSpline::Create(doc, data, id, idObject, Document::FullParse, Valentina::FromGui, idTool, tool); } } break; - case (Tool::NodeSplinePath): + case (Valentina::NodeSplinePath): { if (qFuzzyCompare(dx+1, 1) && qFuzzyCompare(dy+1, 1) && pRotate == 0) { @@ -163,7 +163,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer else { VSplinePath *path = new VSplinePath(); - path->setMode(Draw::Modeling); + path->setMode(Valentina::Modeling); const VSplinePath *splinePath = data->GeometricObject(det.at(i).getId()); qint32 k = splinePath->getMaxCountPoints(); for (qint32 i = 1; i <= splinePath->Count(); ++i) @@ -209,9 +209,9 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer idObject = data->AddGObject(path); VSplinePath *path1 = new VSplinePath(*path); - path1->setMode(Draw::Modeling); + path1->setMode(Valentina::Modeling); id = data->AddGObject(path1); - VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Tool::FromGui, idTool, tool); + VNodeSplinePath::Create(doc, data, id, idObject, Document::FullParse, Valentina::FromGui, idTool, tool); } } break; @@ -228,12 +228,12 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, { switch (det.at(i).getTypeTool()) { - case (Tool::NodePoint): + case (Valentina::NodePoint): { if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { VPointF *point = new VPointF(*data->GeometricObject(det.at(i).getId())); - point->setMode(Draw::Modeling); + point->setMode(Valentina::Modeling); BiasRotatePoint(point, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); ++idCount; data->UpdateGObject(idDetail+idCount, point); @@ -242,7 +242,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, } } break; - case (Tool::NodeArc): + case (Valentina::NodeArc): { if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { @@ -258,11 +258,11 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, QLineF l1(center->toQPointF(), p1.toQPointF()); QLineF l2(center->toQPointF(), p2.toQPointF()); ++idCount; - center->setMode(Draw::Modeling); + center->setMode(Valentina::Modeling); data->UpdateGObject(idDetail+idCount, center); VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle())); - arc1->setMode(Draw::Modeling); + arc1->setMode(Valentina::Modeling); ++idCount; data->UpdateGObject(idDetail+idCount, arc1); @@ -270,7 +270,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, } } break; - case (Tool::NodeSpline): + case (Valentina::NodeSpline): { if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { @@ -293,7 +293,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, data->UpdateGObject(idDetail+idCount, p4); VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, - Draw::Modeling); + Valentina::Modeling); ++idCount; data->UpdateGObject(idDetail+idCount, spl); @@ -302,12 +302,12 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, } } break; - case (Tool::NodeSplinePath): + case (Valentina::NodeSplinePath): { if (qFuzzyCompare(dx+1, 1) == false || qFuzzyCompare(dy+1, 1) == false || pRotate != 0) { VSplinePath *path = new VSplinePath(); - path->setMode(Draw::Modeling); + path->setMode(Valentina::Modeling); const VSplinePath *splinePath = data->GeometricObject(det.at(i).getId()); Q_CHECK_PTR(splinePath); qint32 k = splinePath->getMaxCountPoints(); @@ -390,17 +390,17 @@ void VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsScene *scene, VP ptrdiff_t indexD1 = dialogTool->getIndexD1(); ptrdiff_t indexD2 = dialogTool->getIndexD2(); Create(0, d1, d2, dialogTool->getD1(), dialogTool->getD2(), indexD1, indexD2, scene, doc, data, Document::FullParse, - Tool::FromGui); + Valentina::FromGui); } void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, - const Document::Documents &parse, const Tool::Sources &typeCreation) + const Document::Documents &parse, const Valentina::Sources &typeCreation) { VToolUnionDetails *unionDetails = 0; quint32 id = _id; - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { id = data->getNextId(); } @@ -411,7 +411,7 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta doc->UpdateToolData(id, data); } } - VAbstractTool::AddRecord(id, Tool::UnionDetails, doc); + VAbstractTool::AddRecord(id, Valentina::UnionDetails, doc); if (parse == Document::FullParse) { //Scene doesn't show this tool, so doc will destroy this object. @@ -454,7 +454,7 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta point2.toQPointF())); qint32 pointsD2 = 0; //Keeps count points second detail, what we already add. - if (typeCreation == Tool::FromGui) + if (typeCreation == Valentina::FromGui) { qint32 j = 0, i = 0; VDetail newDetail; @@ -484,7 +484,7 @@ void VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDeta } while(i < d1.RemoveEdge(indexD1).CountNode()); newDetail.setName("Detail"); - VToolDetail::Create(0, newDetail, scene, doc, data, parse, Tool::FromTool); + VToolDetail::Create(0, newDetail, scene, doc, data, parse, Valentina::FromTool); QHash* tools = doc->getTools(); Q_CHECK_PTR(tools); @@ -581,24 +581,24 @@ QVector VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomE quint32 id = doc->GetParametrUInt(element, VToolDetail::AttrIdObject, "0"); qreal mx = toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); qreal my = toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); - Tool::Tools tool; + Valentina::Tools tool; NodeDetail::NodeDetails nodeType = NodeDetail::Contour; QString t = doc->GetParametrString(element, "type", "NodePoint"); if (t == "NodePoint") { - tool = Tool::NodePoint; + tool = Valentina::NodePoint; } else if (t == "NodeArc") { - tool = Tool::NodeArc; + tool = Valentina::NodeArc; } else if (t == "NodeSpline") { - tool = Tool::NodeSpline; + tool = Valentina::NodeSpline; } else if (t == "NodeSplinePath") { - tool = Tool::NodeSplinePath; + tool = Valentina::NodeSplinePath; } d.append(VNodeDetail(id, tool, nodeType, mx, my)); } @@ -669,16 +669,16 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node } switch (node.getTypeTool()) { - case (Tool::NodeArc): + case (Valentina::NodeArc): doc->SetAttribute(nod, AttrType, QStringLiteral("NodeArc")); break; - case (Tool::NodePoint): + case (Valentina::NodePoint): doc->SetAttribute(nod, AttrType, QStringLiteral("NodePoint")); break; - case (Tool::NodeSpline): + case (Valentina::NodeSpline): doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSpline")); break; - case (Tool::NodeSplinePath): + case (Valentina::NodeSplinePath): doc->SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); break; default: diff --git a/src/tools/vtooluniondetails.h b/src/tools/vtooluniondetails.h index 85fdaa978..43e3dd014 100644 --- a/src/tools/vtooluniondetails.h +++ b/src/tools/vtooluniondetails.h @@ -52,7 +52,7 @@ public: * @param parent parent object. */ VToolUnionDetails(VPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, const VDetail &d2, - const quint32 &indexD1, const quint32 &indexD2, const Tool::Sources &typeCreation, + const quint32 &indexD1, const quint32 &indexD2, const Valentina::Sources &typeCreation, QObject *parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. @@ -83,7 +83,7 @@ public: static void Create(const quint32 _id, const VDetail &d1, const VDetail &d2, const quint32 &d1id, const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2, VMainGraphicsScene *scene, VPattern *doc, VContainer *data, const Document::Documents &parse, - const Tool::Sources &typeCreation); + const Valentina::Sources &typeCreation); static void PointsOnEdge(const VDetail &d, const qint32 &index, VPointF &p1, VPointF &p2, VContainer *data); static void FindJ(const qint32 &pointsD2, const VDetail &d2, const qint32 &indexD2, qint32 &j); /** diff --git a/src/widgets/vmaingraphicsscene.cpp b/src/widgets/vmaingraphicsscene.cpp index 7b1b9320d..047f86e16 100644 --- a/src/widgets/vmaingraphicsscene.cpp +++ b/src/widgets/vmaingraphicsscene.cpp @@ -62,7 +62,7 @@ void VMainGraphicsScene::setTransform(const QTransform &transform) _transform = transform; } -void VMainGraphicsScene::ChoosedItem(quint32 id, const Scene::Scenes &type) +void VMainGraphicsScene::ChoosedItem(quint32 id, const Valentina::Scenes &type) { emit ChoosedObject(id, type); } diff --git a/src/widgets/vmaingraphicsscene.h b/src/widgets/vmaingraphicsscene.h index 3b3f6afa4..87620d695 100644 --- a/src/widgets/vmaingraphicsscene.h +++ b/src/widgets/vmaingraphicsscene.h @@ -85,7 +85,7 @@ public slots: * @param id object id. * @param type object scene type. */ - void ChoosedItem(quint32 id, const Scene::Scenes &type); + void ChoosedItem(quint32 id, const Valentina::Scenes &type); /** * @brief SetFactor set current scale factor of scene. * @param factor scene scale factor. scene scale factor. @@ -118,7 +118,7 @@ signals: * @param id object id. * @param type object scene type. */ - void ChoosedObject(quint32 id, Scene::Scenes type); + void ChoosedObject(quint32 id, Valentina::Scenes type); /** * @brief NewFactor send new scale factor. * @param factor scene scale factor. diff --git a/src/widgets/vsimplesplinepath.cpp b/src/widgets/vsimplesplinepath.cpp index 906c41808..18393dd0f 100644 --- a/src/widgets/vsimplesplinepath.cpp +++ b/src/widgets/vsimplesplinepath.cpp @@ -37,7 +37,7 @@ void VSimpleSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { - emit ChoosedTool(id, Scene::SplinePath); + emit ChoosedTool(id, Valentina::SplinePath); } QGraphicsItem::mouseReleaseEvent(event); } diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index f3a8b64e2..5131e3aa2 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -62,7 +62,7 @@ const QString VPattern::IncrementKsize = QStringLiteral("ksize"); const QString VPattern::IncrementKgrowth = QStringLiteral("kgrowth"); const QString VPattern::IncrementDescription = QStringLiteral("description"); -VPattern::VPattern(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent) +VPattern::VPattern(VContainer *data, QComboBox *comboBoxDraws, Valentina::Draws *mode, QObject *parent) : QObject(parent), VDomDocument(data), nameActivDraw(QString()), tools(QHash()), history(QVector()), cursor(0), comboBoxDraws(comboBoxDraws), mode(mode), patternModified(false) { @@ -250,7 +250,7 @@ void VPattern::setCursor(const quint32 &value) void VPattern::setCurrentData() { - if (*mode == Draw::Calculation) + if (*mode == Valentina::Calculation) { const QString nameDraw = comboBoxDraws->itemText(comboBoxDraws->currentIndex()); if (nameActivDraw != nameDraw) @@ -458,10 +458,10 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen { case 0: // TagCalculation data->ClearCalculationGObjects(); - ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Calculation); + ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Valentina::Calculation); break; case 1: // TagModeling - ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Draw::Modeling); + ParseDrawMode(sceneDraw, sceneDetail, domElement, parse, Valentina::Modeling); break; case 2: // TagDetails ParseDetails(sceneDetail, domElement, parse); @@ -477,12 +477,12 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen } void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, const QDomNode &node, - const Document::Documents &parse, const Draw::Draws &mode) + const Document::Documents &parse, const Valentina::Draws &mode) { Q_CHECK_PTR(sceneDraw); Q_CHECK_PTR(sceneDetail); VMainGraphicsScene *scene = nullptr; - if (mode == Draw::Calculation) + if (mode == Valentina::Calculation) { scene = sceneDraw; } @@ -555,23 +555,23 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle const NodeDetail::NodeDetails nodeType = NodeDetail::Contour; const QString t = GetParametrString(element, AttrType, "NodePoint"); - Tool::Tools tool; + Valentina::Tools tool; QStringList types; types << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline << VToolDetail::NodeSplinePath; switch (types.indexOf(t)) { case 0: // VToolDetail::NodePoint - tool = Tool::NodePoint; + tool = Valentina::NodePoint; break; case 1: // VToolDetail::NodeArc - tool = Tool::NodeArc; + tool = Valentina::NodeArc; break; case 2: // VToolDetail::NodeSpline - tool = Tool::NodeSpline; + tool = Valentina::NodeSpline; break; case 3: // VToolDetail::NodeSplinePath - tool = Tool::NodeSplinePath; + tool = Valentina::NodeSplinePath; break; default: qWarning()<<"Wrong node type."<UpdateGObject(id, new VPointF(x, y, name, mx, my)); - VDrawTool::AddRecord(id, Tool::SinglePointTool, this); + VDrawTool::AddRecord(id, Valentina::SinglePointTool, this); if (parse != Document::FullParse) { UpdateToolData(id, data); } if (parse == Document::FullParse) { - spoint = new VToolSinglePoint(this, data, id, Tool::FromFile); + spoint = new VToolSinglePoint(this, data, id, Valentina::FromFile); scene->addItem(spoint); connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); @@ -681,7 +681,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); VToolEndLine::Create(id, name, typeLine, formula, angle, basePointId, - mx, my, scene, this, data, parse, Tool::FromFile); + mx, my, scene, this, data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -704,7 +704,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); VToolAlongLine::Create(id, name, typeLine, formula, firstPointId, secondPointId, mx, my, scene, this, - data, parse, Tool::FromFile); + data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -728,7 +728,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 pShoulder = GetParametrUInt(domElement, VAbstractTool::AttrPShoulder, "0"); VToolShoulderPoint::Create(id, formula, p1Line, p2Line, pShoulder, typeLine, name, mx, my, scene, this, - data, parse, Tool::FromFile); + data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -752,7 +752,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const qreal angle = GetParametrDouble(domElement, VAbstractTool::AttrAngle, "0.0"); VToolNormal::Create(id, formula, firstPointId, secondPointId, typeLine, name, angle, mx, my, scene, - this, data, parse, Tool::FromFile); + this, data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -776,7 +776,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 thirdPointId = GetParametrUInt(domElement, VAbstractTool::AttrThirdPoint, "0"); VToolBisector::Create(id, formula, firstPointId, secondPointId, thirdPointId, - typeLine, name, mx, my, scene, this, data, parse, Tool::FromFile); + typeLine, name, mx, my, scene, this, data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -798,7 +798,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 p2Line2Id = GetParametrUInt(domElement, VAbstractTool::AttrP2Line2, "0"); VToolLineIntersect::Create(id, p1Line1Id, p2Line1Id, p1Line2Id, p2Line2Id, name, - mx, my, scene, this, data, parse, Tool::FromFile); + mx, my, scene, this, data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -820,7 +820,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); VToolPointOfContact::Create(id, radius, center, firstPointId, secondPointId, name, mx, my, scene, this, - data, parse, Tool::FromFile); + data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -839,8 +839,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), mx, my, idObject, - Draw::Modeling)); - VNodePoint::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); + Valentina::Modeling)); + VNodePoint::Create(this, data, id, idObject, parse, Valentina::FromFile, idTool); } catch (const VExceptionBadId &e) { @@ -863,7 +863,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 p2LineId = GetParametrUInt(domElement, VAbstractTool::AttrP2Line, "0"); VToolHeight::Create(id, name, typeLine, basePointId, p1LineId, p2LineId, - mx, my, scene, this, data, parse, Tool::FromFile); + mx, my, scene, this, data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -885,7 +885,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); VToolTriangle::Create(id, name, axisP1Id, axisP2Id, firstPointId, secondPointId, mx, my, scene, this, - data, parse, Tool::FromFile); + data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -905,7 +905,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); VToolPointOfIntersection::Create(id, name, firstPointId, secondPointId, mx, my, scene, this, data, - parse, Tool::FromFile); + parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -924,7 +924,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0"); - VToolCutSpline::Create(id, name, formula, splineId, mx, my, scene, this, data, parse, Tool::FromFile); + VToolCutSpline::Create(id, name, formula, splineId, mx, my, scene, this, data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -944,7 +944,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0"); VToolCutSplinePath::Create(id, name, formula, splinePathId, mx, my, - scene, this, data, parse, Tool::FromFile); + scene, this, data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -963,7 +963,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); const quint32 arcId = GetParametrUInt(domElement, VToolCutArc::AttrArc, "0"); - VToolCutArc::Create(id, name, formula, arcId, mx, my, scene, this, data, parse, Tool::FromFile); + VToolCutArc::Create(id, name, formula, arcId, mx, my, scene, this, data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -991,7 +991,7 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); - VToolLine::Create(id, firstPoint, secondPoint, typeLine, scene, this, data, parse, Tool::FromFile); + VToolLine::Create(id, firstPoint, secondPoint, typeLine, scene, this, data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -1025,7 +1025,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & const qreal kCurve = GetParametrDouble(domElement, VAbstractTool::AttrKCurve, "1.0"); VToolSpline::Create(id, point1, point4, kAsm1, kAsm2, angle1, angle2, kCurve, scene, this, data, parse, - Tool::FromFile); + Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -1069,7 +1069,7 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & } } - VToolSplinePath::Create(id, path, scene, this, data, parse, Tool::FromFile); + VToolSplinePath::Create(id, path, scene, this, data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -1086,9 +1086,9 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VSpline *spl = new VSpline(*data->GeometricObject(idObject)); spl->setIdObject(idObject); - spl->setMode(Draw::Modeling); + spl->setMode(Valentina::Modeling); data->UpdateGObject(id, spl); - VNodeSpline::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); + VNodeSpline::Create(this, data, id, idObject, parse, Valentina::FromFile, idTool); } catch (const VExceptionBadId &e) { @@ -1105,9 +1105,9 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement & const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VSplinePath *path = new VSplinePath(*data->GeometricObject(idObject)); path->setIdObject(idObject); - path->setMode(Draw::Modeling); + path->setMode(Valentina::Modeling); data->UpdateGObject(id, path); - VNodeSplinePath::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); + VNodeSplinePath::Create(this, data, id, idObject, parse, Valentina::FromFile, idTool); } catch (const VExceptionBadId &e) { @@ -1143,7 +1143,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom const QString f1 = GetParametrString(domElement, VAbstractTool::AttrAngle1, "180"); const QString f2 = GetParametrString(domElement, VAbstractTool::AttrAngle2, "270"); - VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Tool::FromFile); + VToolArc::Create(id, center, radius, f1, f2, scene, this, data, parse, Valentina::FromFile); } catch (const VExceptionBadId &e) { @@ -1160,9 +1160,9 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); VArc *arc = new VArc(*data->GeometricObject(idObject)); arc->setIdObject(idObject); - arc->setMode(Draw::Modeling); + arc->setMode(Valentina::Modeling); data->UpdateGObject(id, arc); - VNodeArc::Create(this, data, id, idObject, parse, Tool::FromFile, idTool); + VNodeArc::Create(this, data, id, idObject, parse, Valentina::FromFile, idTool); } catch (const VExceptionBadId &e) { @@ -1199,7 +1199,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d const QVector vector = VToolUnionDetails::GetDetailFromFile(this, domElement); VToolUnionDetails::Create(id, vector[0], vector[1], 0, 0, indexD1, indexD2, scene, this, data, parse, - Tool::FromFile); + Valentina::FromFile); } catch (const VExceptionBadId &e) { diff --git a/src/xml/vpattern.h b/src/xml/vpattern.h index 67298f618..d748f693a 100644 --- a/src/xml/vpattern.h +++ b/src/xml/vpattern.h @@ -52,7 +52,7 @@ class VPattern : public QObject, public VDomDocument { Q_OBJECT public: - VPattern(VContainer *data, QComboBox *comboBoxDraws, Draw::Draws *mode, QObject *parent = nullptr); + VPattern(VContainer *data, QComboBox *comboBoxDraws, Valentina::Draws *mode, QObject *parent = nullptr); /** * @brief CreateEmptyFile create minimal empty file. */ @@ -256,7 +256,7 @@ private: /** * @brief mode current draw mode. */ - Draw::Draws *mode; + Valentina::Draws *mode; /** * @brief fileModified true if exist change in file. */ @@ -291,7 +291,7 @@ private: * @param mode draw mode. */ void ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail, - const QDomNode& node, const Document::Documents &parse, const Draw::Draws &mode); + const QDomNode& node, const Document::Documents &parse, const Valentina::Draws &mode); /** * @brief ParseDetailElement parse detail tag. * @param sceneDetail detail scene. diff --git a/src/xml/vtoolrecord.cpp b/src/xml/vtoolrecord.cpp index 110a9c9c2..ed6f0e756 100644 --- a/src/xml/vtoolrecord.cpp +++ b/src/xml/vtoolrecord.cpp @@ -29,7 +29,7 @@ #include "vtoolrecord.h" VToolRecord::VToolRecord() - :id(0), typeTool(Tool::ArrowTool), nameDraw(QString()){} + :id(0), typeTool(Valentina::ArrowTool), nameDraw(QString()){} -VToolRecord::VToolRecord(const quint32 &id, const Tool::Tools &typeTool, const QString &nameDraw) +VToolRecord::VToolRecord(const quint32 &id, const Valentina::Tools &typeTool, const QString &nameDraw) :id(id), typeTool(typeTool), nameDraw(nameDraw){} diff --git a/src/xml/vtoolrecord.h b/src/xml/vtoolrecord.h index 3530d1c5e..edbe2aae6 100644 --- a/src/xml/vtoolrecord.h +++ b/src/xml/vtoolrecord.h @@ -49,7 +49,7 @@ public: * @param typeTool tool type. * @param nameDraw pattern peace name. */ - VToolRecord(const quint32 &id, const Tool::Tools &typeTool, const QString &nameDraw); + VToolRecord(const quint32 &id, const Valentina::Tools &typeTool, const QString &nameDraw); /** * @brief getId return tool id. * @return id. @@ -64,12 +64,12 @@ public: * @brief getTypeTool return tool type. * @return tool type. */ - Tool::Tools getTypeTool() const; + Valentina::Tools getTypeTool() const; /** * @brief setTypeTool set tool type. * @param value tool type. */ - void setTypeTool(const Tool::Tools &value); + void setTypeTool(const Valentina::Tools &value); /** * @brief getNameDraw return pattern peace name. * @return pattern peace name. @@ -88,7 +88,7 @@ private: /** * @brief typeTool tool type. */ - Tool::Tools typeTool; + Valentina::Tools typeTool; /** * @brief nameDraw pattern peace name. */ @@ -105,12 +105,12 @@ inline void VToolRecord::setId(const quint32 &value) id = value; } -inline Tool::Tools VToolRecord::getTypeTool() const +inline Valentina::Tools VToolRecord::getTypeTool() const { return typeTool; } -inline void VToolRecord::setTypeTool(const Tool::Tools &value) +inline void VToolRecord::setTypeTool(const Valentina::Tools &value) { typeTool = value; } From b2d26e5ae887148e27c4999c46c91f8320189fc3 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 11 Mar 2014 17:04:04 +0200 Subject: [PATCH 41/60] toPixel and fromPixel with units support - mm, cm, inch. --HG-- branch : feature --- src/container/vcontainer.cpp | 4 +- src/dialogs/tools/dialogdetail.cpp | 8 +-- src/dialogs/tools/dialogsinglepoint.cpp | 16 ++--- src/main.cpp | 3 +- src/mainwindow.cpp | 4 +- src/options.h | 60 ++++++++++++++----- src/tablewindow.cpp | 2 +- src/tools/drawTools/vtoolalongline.cpp | 8 +-- src/tools/drawTools/vtoolbisector.cpp | 8 +-- src/tools/drawTools/vtoolcutarc.cpp | 8 +-- src/tools/drawTools/vtoolcutspline.cpp | 16 ++--- src/tools/drawTools/vtoolcutsplinepath.cpp | 16 ++--- src/tools/drawTools/vtoolendline.cpp | 8 +-- src/tools/drawTools/vtoolheight.cpp | 8 +-- src/tools/drawTools/vtoollineintersect.cpp | 8 +-- src/tools/drawTools/vtoolnormal.cpp | 8 +-- src/tools/drawTools/vtoolpoint.cpp | 4 +- src/tools/drawTools/vtoolpointofcontact.cpp | 8 +-- .../drawTools/vtoolpointofintersection.cpp | 8 +-- src/tools/drawTools/vtoolshoulderpoint.cpp | 8 +-- src/tools/drawTools/vtoolsinglepoint.cpp | 24 ++++---- src/tools/drawTools/vtoolspline.cpp | 4 +- src/tools/drawTools/vtoolsplinepath.cpp | 4 +- src/tools/drawTools/vtooltriangle.cpp | 8 +-- src/tools/nodeDetails/vnodepoint.cpp | 12 ++-- src/tools/vtooldetail.cpp | 12 ++-- src/tools/vtooluniondetails.cpp | 4 +- 27 files changed, 156 insertions(+), 125 deletions(-) diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index 499460a9a..2f2f4a0d9 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -239,7 +239,7 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value) void VContainer::AddLengthArc(const quint32 &id) { const VArc * arc = GeometricObject(id); - lengthArcs[arc->name()] = toMM(arc->GetLength()); + lengthArcs[arc->name()] = fromPixel(arc->GetLength()); } void VContainer::AddLineAngle(const QString &name, const qreal &value) @@ -352,7 +352,7 @@ void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPoint QString nameLine = GetNameLine(firstPointId, secondPointId); const VPointF *first = GeometricObject(firstPointId); const VPointF *second = GeometricObject(secondPointId); - AddLengthLine(nameLine, toMM(QLineF(first->toQPointF(), second->toQPointF()).length())); + AddLengthLine(nameLine, fromPixel(QLineF(first->toQPointF(), second->toQPointF()).length())); nameLine = GetNameLineAngle(firstPointId, secondPointId); AddLineAngle(nameLine, QLineF(first->toQPointF(), second->toQPointF()).angle()); } diff --git a/src/dialogs/tools/dialogdetail.cpp b/src/dialogs/tools/dialogdetail.cpp index df0a1e044..7813037fc 100644 --- a/src/dialogs/tools/dialogdetail.cpp +++ b/src/dialogs/tools/dialogdetail.cpp @@ -150,8 +150,8 @@ void DialogDetail::NewItem(quint32 id, const Valentina::Tools &typeTool, const N this, &DialogDetail::BiasXChanged); disconnect(ui.spinBoxBiasY, static_cast(&QSpinBox::valueChanged), this, &DialogDetail::BiasYChanged); - ui.spinBoxBiasX->setValue(static_cast(toMM(node.getMx()))); - ui.spinBoxBiasY->setValue(static_cast(toMM(node.getMy()))); + ui.spinBoxBiasX->setValue(static_cast(fromPixel(node.getMx()))); + ui.spinBoxBiasY->setValue(static_cast(fromPixel(node.getMy()))); connect(ui.spinBoxBiasX, static_cast(&QSpinBox::valueChanged), this, &DialogDetail::BiasXChanged); connect(ui.spinBoxBiasY, static_cast(&QSpinBox::valueChanged), @@ -218,8 +218,8 @@ void DialogDetail::ObjectChanged(int row) } QListWidgetItem *item = ui.listWidget->item( row ); VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); - ui.spinBoxBiasX->setValue(static_cast(toMM(node.getMx()))); - ui.spinBoxBiasY->setValue(static_cast(toMM(node.getMy()))); + ui.spinBoxBiasX->setValue(static_cast(fromPixel(node.getMx()))); + ui.spinBoxBiasY->setValue(static_cast(fromPixel(node.getMy()))); } void DialogDetail::DeleteItem() diff --git a/src/dialogs/tools/dialogsinglepoint.cpp b/src/dialogs/tools/dialogsinglepoint.cpp index 570758d28..4cc21750d 100644 --- a/src/dialogs/tools/dialogsinglepoint.cpp +++ b/src/dialogs/tools/dialogsinglepoint.cpp @@ -36,8 +36,8 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) point(QPointF()) { ui->setupUi(this); - ui->doubleSpinBoxX->setRange(0, toMM(SceneSize)); - ui->doubleSpinBoxY->setRange(0, toMM(SceneSize)); + ui->doubleSpinBoxX->setRange(0, fromPixel(SceneSize)); + ui->doubleSpinBoxY->setRange(0, fromPixel(SceneSize)); labelEditNamePoint = ui->labelEditName; InitOkCansel(ui); @@ -51,14 +51,14 @@ void DialogSinglePoint::mousePress(const QPointF &scenePos) { if (isInitialized == false) { - ui->doubleSpinBoxX->setValue(toMM(scenePos.x())); - ui->doubleSpinBoxY->setValue(toMM(scenePos.y())); + ui->doubleSpinBoxX->setValue(fromPixel(scenePos.x())); + ui->doubleSpinBoxY->setValue(fromPixel(scenePos.y())); this->show(); } else { - ui->doubleSpinBoxX->setValue(toMM(scenePos.x())); - ui->doubleSpinBoxY->setValue(toMM(scenePos.y())); + ui->doubleSpinBoxX->setValue(fromPixel(scenePos.x())); + ui->doubleSpinBoxY->setValue(fromPixel(scenePos.y())); } } @@ -75,8 +75,8 @@ void DialogSinglePoint::setData(const QString &name, const QPointF &point) this->point = point; isInitialized = true; ui->lineEditName->setText(name); - ui->doubleSpinBoxX->setValue(toMM(point.x())); - ui->doubleSpinBoxY->setValue(toMM(point.y())); + ui->doubleSpinBoxX->setValue(fromPixel(point.x())); + ui->doubleSpinBoxY->setValue(fromPixel(point.y())); } DialogSinglePoint::~DialogSinglePoint() diff --git a/src/main.cpp b/src/main.cpp index bf6e7159e..aaedb8c55 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,7 +33,8 @@ #include "tablewindow.h" #include "options.h" -Valentina::Units patternUnit = Valentina::Cm; +//Default pattern unit. +Valentina::Units patternUnit = Valentina::Mm; #ifdef Q_OS_WIN const QString translationsPath = QString("/translations"); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 098a82c18..591c56d5e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -621,8 +621,8 @@ void MainWindow::currentDrawChanged( int index ) void MainWindow::mouseMove(const QPointF &scenePos) { QString string = QString("%1, %2") - .arg(static_cast(toMM(scenePos.x()))) - .arg(static_cast(toMM(scenePos.y()))); + .arg(static_cast(fromPixel(scenePos.x()))) + .arg(static_cast(fromPixel(scenePos.y()))); mouseCoordinate->setText(string); } diff --git a/src/options.h b/src/options.h index 6580940f4..d07c656eb 100644 --- a/src/options.h +++ b/src/options.h @@ -34,21 +34,6 @@ #define SceneSize 50000 -#define PrintDPI 96.0 - -inline double toPixel(double mm) -{ - return (mm / 25.4) * PrintDPI; -} - -inline double toMM(double pix) -{ - return (pix / PrintDPI) * 25.4; -} - -#define widthMainLine 1.2 //mm -#define widthHairLine widthMainLine/3 - extern const QString translationsPath; namespace Valentina @@ -118,4 +103,49 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Units ) extern Valentina::Units patternUnit; +#define PrintDPI 96.0 + +inline double toPixel(double unit) +{ + double result = 0; + switch (patternUnit) + { + case Valentina::Mm: + result = (unit / 25.4) * PrintDPI; + break; + case Valentina::Cm: + result = ((unit * 10.0) / 25.4) * PrintDPI; + break; + case Valentina::In: + result = unit * PrintDPI; + break; + default: + break; + } + return result; +} + +inline double fromPixel(double pix) +{ + double result = 0; + switch (patternUnit) + { + case Valentina::Mm: + result = (pix / PrintDPI) * 25.4; + break; + case Valentina::Cm: + result = ((pix / PrintDPI) * 25.4) / 10.0; + break; + case Valentina::In: + result = pix / PrintDPI; + break; + default: + break; + } + return result; +} + +#define widthMainLine 1.2 //mm +#define widthHairLine widthMainLine/3 + #endif // OPTIONS_H diff --git a/src/tablewindow.cpp b/src/tablewindow.cpp index de0598f80..06e23ce0e 100644 --- a/src/tablewindow.cpp +++ b/src/tablewindow.cpp @@ -474,7 +474,7 @@ void TableWindow::PdfFile(const QString &name) const qreal x=0, y=0, w=0, h=0; r.getRect(&x, &y, &w, &h);// Re-shrink the scene to it's bounding contents printer.setResolution(PrintDPI); - printer.setPaperSize ( QSizeF(toMM(w), toMM(h)), QPrinter::Millimeter ); + printer.setPaperSize ( QSizeF(fromPixel(w), fromPixel(h)), QPrinter::Millimeter ); QPainter painter; if (painter.begin( &printer ) == false) { // failed to open file diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index 961e2bf1b..325a28ca4 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -87,8 +87,8 @@ void VToolAlongLine::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); @@ -104,8 +104,8 @@ void VToolAlongLine::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index 373f140ec..9e6147e18 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -185,8 +185,8 @@ void VToolBisector::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); @@ -203,8 +203,8 @@ void VToolBisector::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index 2c19e1be2..9e830059f 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -208,8 +208,8 @@ void VToolCutArc::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrArc, arcId); @@ -224,8 +224,8 @@ void VToolCutArc::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrArc, arcId); } diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index 6d6c5e97b..fbebbf04a 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -110,11 +110,11 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); spl1id = data->AddGObject(spline1); - data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength())); + data->AddLengthSpline(spline1->name(), fromPixel(spline1->GetLength())); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); spl2id = data->AddGObject(spline2); - data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength())); + data->AddLengthSpline(spline2->name(), fromPixel(spline2->GetLength())); } else { @@ -126,11 +126,11 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); data->UpdateGObject(spl1id, spline1); - data->AddLengthSpline(spline1->name(), toMM(spline1->GetLength())); + data->AddLengthSpline(spline1->name(), fromPixel(spline1->GetLength())); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); data->UpdateGObject(spl2id, spline2); - data->AddLengthSpline(spline2->name(), toMM(spline2->GetLength())); + data->AddLengthSpline(spline2->name(), fromPixel(spline2->GetLength())); if (parse != Document::FullParse) { @@ -204,8 +204,8 @@ void VToolCutSpline::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrSpline, splineId); @@ -220,8 +220,8 @@ void VToolCutSpline::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrSpline, splineId); } diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index c29c921cf..f99b09179 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -159,10 +159,10 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con splPath2->setMaxCountPoints(splPath->CountPoint()); splPath1id = data->AddGObject(splPath1); - data->AddLengthSpline(splPath1->name(), toMM(splPath1->GetLength())); + data->AddLengthSpline(splPath1->name(), fromPixel(splPath1->GetLength())); splPath2id = data->AddGObject(splPath2); - data->AddLengthSpline(splPath2->name(), toMM(splPath2->GetLength())); + data->AddLengthSpline(splPath2->name(), fromPixel(splPath2->GetLength())); } else { @@ -200,10 +200,10 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con splPath2->setMaxCountPoints(splPath->CountPoint()); data->UpdateGObject(splPath1id, splPath1); - data->AddLengthSpline(splPath1->name(), toMM(splPath1->GetLength())); + data->AddLengthSpline(splPath1->name(), fromPixel(splPath1->GetLength())); data->UpdateGObject(splPath2id, splPath2); - data->AddLengthSpline(splPath2->name(), toMM(splPath2->GetLength())); + data->AddLengthSpline(splPath2->name(), fromPixel(splPath2->GetLength())); if (parse != Document::FullParse) { @@ -278,8 +278,8 @@ void VToolCutSplinePath::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrSplinePath, splinePathId); @@ -294,8 +294,8 @@ void VToolCutSplinePath::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrSplinePath, splinePathId); } diff --git a/src/tools/drawTools/vtoolendline.cpp b/src/tools/drawTools/vtoolendline.cpp index 3448387ae..81213c3cf 100644 --- a/src/tools/drawTools/vtoolendline.cpp +++ b/src/tools/drawTools/vtoolendline.cpp @@ -151,8 +151,8 @@ void VToolEndLine::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); @@ -169,8 +169,8 @@ void VToolEndLine::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrAngle, angle); diff --git a/src/tools/drawTools/vtoolheight.cpp b/src/tools/drawTools/vtoolheight.cpp index c468180a6..475d127aa 100644 --- a/src/tools/drawTools/vtoolheight.cpp +++ b/src/tools/drawTools/vtoolheight.cpp @@ -157,8 +157,8 @@ void VToolHeight::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrBasePoint, basePointId); @@ -176,8 +176,8 @@ void VToolHeight::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrBasePoint, basePointId); doc->SetAttribute(domElement, AttrP1Line, p1LineId); diff --git a/src/tools/drawTools/vtoollineintersect.cpp b/src/tools/drawTools/vtoollineintersect.cpp index 7688e8414..255ea5048 100644 --- a/src/tools/drawTools/vtoollineintersect.cpp +++ b/src/tools/drawTools/vtoollineintersect.cpp @@ -168,8 +168,8 @@ void VToolLineIntersect::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrP1Line1, p1Line1); doc->SetAttribute(domElement, AttrP2Line1, p2Line1); @@ -186,8 +186,8 @@ void VToolLineIntersect::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrP1Line1, p1Line1); doc->SetAttribute(domElement, AttrP2Line1, p2Line1); doc->SetAttribute(domElement, AttrP1Line2, p1Line2); diff --git a/src/tools/drawTools/vtoolnormal.cpp b/src/tools/drawTools/vtoolnormal.cpp index 03edae31f..1af5c1fa4 100644 --- a/src/tools/drawTools/vtoolnormal.cpp +++ b/src/tools/drawTools/vtoolnormal.cpp @@ -171,8 +171,8 @@ void VToolNormal::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); @@ -190,8 +190,8 @@ void VToolNormal::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrAngle, angle); diff --git a/src/tools/drawTools/vtoolpoint.cpp b/src/tools/drawTools/vtoolpoint.cpp index 8ab589871..36fc194db 100644 --- a/src/tools/drawTools/vtoolpoint.cpp +++ b/src/tools/drawTools/vtoolpoint.cpp @@ -62,8 +62,8 @@ void VToolPoint::UpdateNamePosition(qreal mx, qreal my) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrMx, toMM(mx)); - doc->SetAttribute(domElement, AttrMy, toMM(my)); + doc->SetAttribute(domElement, AttrMx, fromPixel(mx)); + doc->SetAttribute(domElement, AttrMy, fromPixel(my)); emit toolhaveChange(); } } diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index d72235f0a..132be01d3 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -191,8 +191,8 @@ void VToolPointOfContact::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrRadius, arcRadius); doc->SetAttribute(domElement, AttrCenter, center); @@ -209,8 +209,8 @@ void VToolPointOfContact::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrRadius, arcRadius); doc->SetAttribute(domElement, AttrCenter, center); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); diff --git a/src/tools/drawTools/vtoolpointofintersection.cpp b/src/tools/drawTools/vtoolpointofintersection.cpp index 1fe8457a5..8c94e118d 100644 --- a/src/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/tools/drawTools/vtoolpointofintersection.cpp @@ -141,8 +141,8 @@ void VToolPointOfIntersection::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); @@ -157,8 +157,8 @@ void VToolPointOfIntersection::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); } diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 1c35b3d40..140c62550 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -193,8 +193,8 @@ void VToolShoulderPoint::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); @@ -212,8 +212,8 @@ void VToolShoulderPoint::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrName, toMM(point->mx())); - doc->SetAttribute(domElement, AttrName, toMM(point->my())); + doc->SetAttribute(domElement, AttrName, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrName, fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrP1Line, basePointId); diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index 4447f1fa7..1b86768f5 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -69,10 +69,10 @@ void VToolSinglePoint::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrX, toMM(point->x())); - doc->SetAttribute(domElement, AttrY, toMM(point->y())); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrX, fromPixel(point->x())); + doc->SetAttribute(domElement, AttrY, fromPixel(point->y())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); AddToCalculation(domElement); } @@ -84,10 +84,10 @@ void VToolSinglePoint::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrX, QString().setNum(toMM(point->x()))); - doc->SetAttribute(domElement, AttrY, QString().setNum(toMM(point->y()))); - doc->SetAttribute(domElement, AttrMx, QString().setNum(toMM(point->mx()))); - doc->SetAttribute(domElement, AttrMy, QString().setNum(toMM(point->my()))); + doc->SetAttribute(domElement, AttrX, QString().setNum(fromPixel(point->x()))); + doc->SetAttribute(domElement, AttrY, QString().setNum(fromPixel(point->y()))); + doc->SetAttribute(domElement, AttrMx, QString().setNum(fromPixel(point->mx()))); + doc->SetAttribute(domElement, AttrMy, QString().setNum(fromPixel(point->my()))); } } @@ -113,8 +113,8 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrX, QString().setNum(toMM(newPos.x()))); - doc->SetAttribute(domElement, AttrY, QString().setNum(toMM(newPos.y()))); + doc->SetAttribute(domElement, AttrX, QString().setNum(fromPixel(newPos.x()))); + doc->SetAttribute(domElement, AttrY, QString().setNum(fromPixel(newPos.y()))); QList list = this->scene()->views(); VAbstractTool::NewSceneRect(this->scene(), list[0]); @@ -143,8 +143,8 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement) QPointF p = dialogTool->getPoint(); QString name = dialogTool->getName(); doc->SetAttribute(domElement, AttrName, name); - doc->SetAttribute(domElement, AttrX, QString().setNum(toMM(p.x()))); - doc->SetAttribute(domElement, AttrY, QString().setNum(toMM(p.y()))); + doc->SetAttribute(domElement, AttrX, QString().setNum(fromPixel(p.x()))); + doc->SetAttribute(domElement, AttrY, QString().setNum(fromPixel(p.y()))); } void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color) diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index b3db920ea..1f3c9599f 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -115,12 +115,12 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4 if (typeCreation == Valentina::FromGui) { id = data->AddGObject(spline); - data->AddLengthSpline(spline->name(), toMM(spline->GetLength())); + data->AddLengthSpline(spline->name(), fromPixel(spline->GetLength())); } else { data->UpdateGObject(id, spline); - data->AddLengthSpline(spline->name(), toMM(spline->GetLength())); + data->AddLengthSpline(spline->name(), fromPixel(spline->GetLength())); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index b5aaf2378..28fc4a1ee 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -102,12 +102,12 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics if (typeCreation == Valentina::FromGui) { id = data->AddGObject(path); - data->AddLengthSpline(path->name(), toMM(path->GetLength())); + data->AddLengthSpline(path->name(), fromPixel(path->GetLength())); } else { data->UpdateGObject(id, path); - data->AddLengthSpline(path->name(), toMM(path->GetLength())); + data->AddLengthSpline(path->name(), fromPixel(path->GetLength())); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index 9529d0d7c..c86753455 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -197,8 +197,8 @@ void VToolTriangle::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrAxisP1, axisP1Id); doc->SetAttribute(domElement, AttrAxisP2, axisP2Id); @@ -215,8 +215,8 @@ void VToolTriangle::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); doc->SetAttribute(domElement, AttrAxisP1, axisP1Id); doc->SetAttribute(domElement, AttrAxisP2, axisP2Id); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index 9928d87c9..92c7e2139 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -107,8 +107,8 @@ void VNodePoint::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrIdObject, idNode); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); if (idTool != 0) { doc->SetAttribute(domElement, AttrIdTool, idTool); @@ -124,8 +124,8 @@ void VNodePoint::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrIdObject, idNode); - doc->SetAttribute(domElement, AttrMx, toMM(point->mx())); - doc->SetAttribute(domElement, AttrMy, toMM(point->my())); + doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); if (idTool != 0) { doc->SetAttribute(domElement, AttrIdTool, idTool); @@ -171,8 +171,8 @@ void VNodePoint::UpdateNamePosition(qreal mx, qreal my) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrMx, QString().setNum(toMM(mx))); - doc->SetAttribute(domElement, AttrMy, QString().setNum(toMM(my))); + doc->SetAttribute(domElement, AttrMx, QString().setNum(fromPixel(mx))); + doc->SetAttribute(domElement, AttrMy, QString().setNum(fromPixel(my))); emit toolhaveChange(); } } diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index 60504c451..4415a0ac1 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -230,8 +230,8 @@ void VToolDetail::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrName, detail.getName()); - doc->SetAttribute(domElement, AttrMx, toMM(detail.getMx())); - doc->SetAttribute(domElement, AttrMy, toMM(detail.getMy())); + doc->SetAttribute(domElement, AttrMx, fromPixel(detail.getMx())); + doc->SetAttribute(domElement, AttrMy, fromPixel(detail.getMy())); doc->SetAttribute(domElement, AttrSupplement, detail.getSeamAllowance()); doc->SetAttribute(domElement, AttrClosed, detail.getClosed()); doc->SetAttribute(domElement, AttrWidth, detail.getWidth()); @@ -277,8 +277,8 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrMx, QString().setNum(toMM(newPos.x()))); - doc->SetAttribute(domElement, AttrMy, QString().setNum(toMM(newPos.y()))); + doc->SetAttribute(domElement, AttrMx, QString().setNum(fromPixel(newPos.x()))); + doc->SetAttribute(domElement, AttrMy, QString().setNum(fromPixel(newPos.y()))); QList list = this->scene()->views(); VAbstractTool::NewSceneRect(this->scene(), list[0]); @@ -370,8 +370,8 @@ void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node) QDomElement nod = doc->createElement(TagNode); doc->SetAttribute(nod, AttrIdObject, node.getId()); - doc->SetAttribute(nod, AttrMx, toMM(node.getMx())); - doc->SetAttribute(nod, AttrMy, toMM(node.getMy())); + doc->SetAttribute(nod, AttrMx, fromPixel(node.getMx())); + doc->SetAttribute(nod, AttrMy, fromPixel(node.getMy())); if (node.getTypeNode() == NodeDetail::Contour) { doc->SetAttribute(nod, AttrNodeType, NodeTypeContour); diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index 2c0c44e0b..2d3d8b952 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -657,8 +657,8 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node QDomElement nod = doc->createElement(TagNode); doc->SetAttribute(nod, AttrIdObject, node.getId()); - doc->SetAttribute(nod, AttrMx, toMM(node.getMx())); - doc->SetAttribute(nod, AttrMy, toMM(node.getMy())); + doc->SetAttribute(nod, AttrMx, fromPixel(node.getMx())); + doc->SetAttribute(nod, AttrMy, fromPixel(node.getMy())); if (node.getTypeNode() == NodeDetail::Contour) { doc->SetAttribute(nod, AttrNodeType, NodeTypeContour); From ed568678bea97ee3a0d1f1654a62bf4335955105 Mon Sep 17 00:00:00 2001 From: dismine Date: Tue, 11 Mar 2014 22:19:13 +0200 Subject: [PATCH 42/60] Parsing standard measurements table. --HG-- branch : feature --- .../schema/standard_measurements.xsd | 12 ++ share/tables/standard/GOST_man_ru.vst | 8 +- src/container/vcontainer.cpp | 104 +++--------- src/container/vcontainer.h | 90 ++++++----- src/container/vstandardtablerow.cpp | 8 +- src/container/vstandardtablerow.h | 21 ++- src/dialogs/app/dialogincrements.cpp | 2 +- src/dialogs/tools/dialogpointofcontact.cpp | 4 +- src/dialogs/tools/dialogtool.cpp | 29 +++- src/dialogs/tools/dialogtool.h | 8 +- src/main.cpp | 2 +- src/mainwindow.cpp | 2 +- src/xml/vdomdocument.h | 2 +- src/xml/vpattern.cpp | 2 +- src/xml/vpattern.h | 1 + src/xml/vstandardmeasurements.cpp | 151 ++++++++++++++++++ src/xml/vstandardmeasurements.h | 11 +- 17 files changed, 303 insertions(+), 154 deletions(-) diff --git a/share/resources/schema/standard_measurements.xsd b/share/resources/schema/standard_measurements.xsd index 7159630a7..98f4759ad 100644 --- a/share/resources/schema/standard_measurements.xsd +++ b/share/resources/schema/standard_measurements.xsd @@ -5,6 +5,18 @@ + + + + + + + + + + + + diff --git a/share/tables/standard/GOST_man_ru.vst b/share/tables/standard/GOST_man_ru.vst index b0289246d..4d61516ab 100644 --- a/share/tables/standard/GOST_man_ru.vst +++ b/share/tables/standard/GOST_man_ru.vst @@ -1,6 +1,8 @@ - Типовые фигуры мужчин 1-й полнотной группы, обхват груди 100 см + Типовые фигуры мужчин 1-й полнотной группы, обхват груди 100 см mm + + @@ -16,8 +18,8 @@ - - + + diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index 2f2f4a0d9..3dc327aa2 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -34,14 +34,11 @@ quint32 VContainer::_id = 0; VContainer::VContainer() - :base(QHash()), gObjects(QHash()), + :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash()), standardTable(QHash()), incrementTable(QHash()), lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()), lengthArcs(QHash()), details(QHash()) { - SetSize(500); - SetGrowth(1760); - CreateManTableIGroup (); } VContainer &VContainer::operator =(const VContainer &data) @@ -51,7 +48,7 @@ VContainer &VContainer::operator =(const VContainer &data) } VContainer::VContainer(const VContainer &data) - :base(QHash()), gObjects(QHash()), + :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash()), standardTable(QHash()), incrementTable(QHash()), lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()), lengthArcs(QHash()), details(QHash()) @@ -67,7 +64,10 @@ VContainer::~VContainer() void VContainer::setData(const VContainer &data) { - base = *data.DataBase(); + _size = data.size(); + sizeName = data.SizeName(); + _height = data.height(); + heightName = data.HeightName(); qDeleteAll(gObjects); gObjects.clear(); @@ -248,21 +248,21 @@ void VContainer::AddLineAngle(const QString &name, const qreal &value) lineAngles[name] = value; } -qreal VContainer::GetValueStandardTableCell(const QString& name) const +qreal VContainer::GetValueStandardTableRow(const QString& name) const { - VStandardTableRow cell = GetStandardTableCell(name); - qreal k_size = ( static_cast (size()/10.0) - 50.0 ) / 2.0; - qreal k_growth = ( static_cast (growth()/10.0) - 176.0 ) / 6.0; - qreal value = cell.GetBase() + k_size*cell.GetKsize() + k_growth*cell.GetKgrowth(); + const VStandardTableRow row = GetStandardTableCell(name); + const qreal k_size = ( size() - 50.0 ) / 2.0; + const qreal k_growth = ( height() - 176.0 ) / 6.0; + const qreal value = row.GetBase() + k_size * row.GetKsize() + k_growth * row.GetKgrowth(); return value; } qreal VContainer::GetValueIncrementTableRow(const QString& name) const { - VIncrementTableRow cell = GetIncrementTableRow(name); - qreal k_size = ( static_cast (size()/10.0) - 50.0 ) / 2.0; - qreal k_growth = ( static_cast (growth()/10.0) - 176.0 ) / 6.0; - qreal value = cell.getBase() + k_size*cell.getKsize() + k_growth*cell.getKgrowth(); + const VIncrementTableRow row = GetIncrementTableRow(name); + const qreal k_size = ( size() - 50.0 ) / 2.0; + const qreal k_growth = ( height() - 176.0 ) / 6.0; + const qreal value = row.getBase() + k_size * row.getKsize() + k_growth * row.getKgrowth(); return value; } @@ -307,16 +307,20 @@ void VContainer::ClearCalculationGObjects() qreal VContainer::FindVar(const QString &name, bool *ok)const { - if (base.contains(name)) + if (sizeName == name) { *ok = true; - return base.value(name); + return _size; + } + if (heightName == name) + { + *ok = true; + return _height; } - if (standardTable.contains(name)) { *ok = true; - return GetValueStandardTableCell(name); + return GetValueStandardTableRow(name); } if (incrementTable.contains(name)) { @@ -400,65 +404,3 @@ void VContainer::AddLengthLine(const QString &name, const qreal &value) Q_ASSERT(name.isEmpty() == false); lengthLines[name] = value; } - -void VContainer::CreateManTableIGroup () -{ - AddStandardTableCell("Pkor", VStandardTableRow(84, 0, 3)); - AddStandardTableCell("Vtos", VStandardTableRow(1450, 2, 51)); - AddStandardTableCell("Vtosh", VStandardTableRow(1506, 2, 54)); - AddStandardTableCell("Vpt", VStandardTableRow(1438, 3, 52)); - AddStandardTableCell("Vst", VStandardTableRow(1257, -1, 49)); - AddStandardTableCell("Vlt", VStandardTableRow(1102, 0, 43)); - AddStandardTableCell("Vk", VStandardTableRow(503, 0, 22)); - AddStandardTableCell("Vsht", VStandardTableRow(1522, 2, 54)); - AddStandardTableCell("Vzy", VStandardTableRow(1328, 0, 49)); - AddStandardTableCell("Vlop", VStandardTableRow(1320, 0, 49)); - AddStandardTableCell("Vps", VStandardTableRow(811, -1, 36)); - AddStandardTableCell("Ssh", VStandardTableRow(202, 4, 1)); - AddStandardTableCell("SgI", VStandardTableRow(517, 18, 2)); - AddStandardTableCell("SgII", VStandardTableRow(522, 19, 1)); - AddStandardTableCell("SgIII", VStandardTableRow(500, 20, 0)); - AddStandardTableCell("SbI", VStandardTableRow(482, 12, 6)); - AddStandardTableCell("Obed", VStandardTableRow(566, 18, 6)); - AddStandardTableCell("Ok", VStandardTableRow(386, 8, 8)); - AddStandardTableCell("Oi", VStandardTableRow(380, 8, 6)); - AddStandardTableCell("Osch", VStandardTableRow(234, 4, 4)); - AddStandardTableCell("Dsb", VStandardTableRow(1120, 0, 44)); - AddStandardTableCell("Dsp", VStandardTableRow(1110, 0, 43)); - AddStandardTableCell("Dn", VStandardTableRow(826, -3, 37)); - AddStandardTableCell("Dps", VStandardTableRow(316, 4, 7)); - AddStandardTableCell("Dpob", VStandardTableRow(783, 14, 15)); - AddStandardTableCell("Ds", VStandardTableRow(260, 1, 6)); - AddStandardTableCell("Op", VStandardTableRow(316, 12, 0)); - AddStandardTableCell("Ozap", VStandardTableRow(180, 4, 0)); - AddStandardTableCell("Pkis", VStandardTableRow(250, 4, 0)); - AddStandardTableCell("SHp", VStandardTableRow(160, 1, 4)); - AddStandardTableCell("Dlych", VStandardTableRow(500, 2, 15)); - AddStandardTableCell("Dzap", VStandardTableRow(768, 2, 24)); - AddStandardTableCell("DIIIp", VStandardTableRow(970, 2, 29)); - AddStandardTableCell("Vprp", VStandardTableRow(214, 3, 3)); - AddStandardTableCell("Vg", VStandardTableRow(262, 8, 3)); - AddStandardTableCell("Dtp", VStandardTableRow(460, 7, 9)); - AddStandardTableCell("Dp", VStandardTableRow(355, 5, 5)); - AddStandardTableCell("Vprz", VStandardTableRow(208, 3, 5)); - AddStandardTableCell("Dts", VStandardTableRow(438, 2, 10)); - AddStandardTableCell("DtsI", VStandardTableRow(469, 2, 10)); - AddStandardTableCell("Dvcht", VStandardTableRow(929, 9, 19)); - AddStandardTableCell("SHg", VStandardTableRow(370, 14, 4)); - AddStandardTableCell("Cg", VStandardTableRow(224, 6, 0)); - AddStandardTableCell("SHs", VStandardTableRow(416, 10, 2)); - AddStandardTableCell("dpzr", VStandardTableRow(121, 6, 0)); - AddStandardTableCell("Ogol", VStandardTableRow(576, 4, 4)); - AddStandardTableCell("Ssh1", VStandardTableRow(205, 5, 0)); - - //TODO Posible duplicate. Need check. - //AddStandardTableCell("St", VStandardTableRow(410, 20, 0)); - AddStandardTableCell("St", VStandardTableRow(390, 20, 0)); - - AddStandardTableCell("Drzap", VStandardTableRow(594, 3, 19)); - AddStandardTableCell("DbII", VStandardTableRow(1020, 0, 44)); - - //TODO Posible duplicate. Need check. - //AddStandardTableCell("Sb", VStandardTableRow(504, 15, 4)); - AddStandardTableCell("Sb", VStandardTableRow(492, 15, 5)); -} diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index 03c2e66cd..08e7c1f07 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -166,11 +166,11 @@ public: */ quint32 AddDetail(VDetail detail); /** - * @brief AddStandardTableCell add new row of standard table + * @brief AddStandardTableRow add new row of standard table * @param name name of row of standard table - * @param cell row of standard table + * @param row row of standard table */ - void AddStandardTableCell(const QString& name, const VStandardTableRow &cell); + void AddStandardTableRow(const QString& name, const VStandardTableRow &row); /** * @brief AddIncrementTableRow add new row of increment table * @param name name of new row of increment table @@ -252,7 +252,7 @@ public: * @param name name of row * @return value in mm */ - qreal GetValueStandardTableCell(const QString& name) const; + qreal GetValueStandardTableRow(const QString& name) const; /** * @brief GetValueIncrementTableRow return value of increment table row by name * @param name name of row @@ -291,24 +291,28 @@ public: void ClearDetails(); /** * @brief SetSize set value of size - * @param size value of size in mm + * @param size value of size */ - void SetSize(qint32 size); + void SetSize(qreal size); + void SetSizeName(const QString &name); /** * @brief SetGrowth set value of growth - * @param growth value of growth in mm + * @param growth value of growth */ - void SetGrowth(qint32 growth); + void SetHeight(qreal height); + void SetHeightName(const QString &name); /** * @brief size return size * @return size in mm */ - qint32 size() const; + qreal size() const; + QString SizeName()const; /** - * @brief growth return growth - * @return growth in mm + * @brief height return height + * @return height in pattern units */ - qint32 growth() const; + qreal height() const; + QString HeightName()const; /** * @brief FindVar return value of variable by name * @param name name of variable @@ -337,11 +341,6 @@ public: * @return pointer on container of gObjects */ const QHash *DataGObjects() const; - /** - * @brief data container with dataBase return container of data - * @return pointer on container of base data - */ - const QHash *DataBase() const; /** * @brief data container with dataStandardTable return container of standard table * @return pointer on container of standard table @@ -382,19 +381,15 @@ public: * @param newId id */ static void UpdateId(quint32 newId); - /** - * @brief CreateManTableIGroup generate man standard table of measurements - */ - void CreateManTableIGroup (); private: /** * @brief _id current id. New object will have value +1. For empty class equal 0. */ static quint32 _id; - /** - * @brief base container of base data (size and growth) - */ - QHash base; + qreal _size; + QString sizeName; + qreal _height; + QString heightName; /** * @brief gObjects graphicals objects of pattern. */ @@ -463,9 +458,9 @@ private: static quint32 AddObject(QHash &obj, val value); }; -inline void VContainer::AddStandardTableCell(const QString &name, const VStandardTableRow &cell) +inline void VContainer::AddStandardTableRow(const QString &name, const VStandardTableRow &row) { - standardTable[name] = cell; + standardTable[name] = row; } inline void VContainer::UpdateStandardTableCell(const QString &name, VStandardTableRow cell) @@ -508,24 +503,44 @@ inline void VContainer::ClearDetails() details.clear(); } -inline void VContainer::SetSize(qint32 size) +inline void VContainer::SetSize(qreal size) { - base["Сг"] = size; + _size = size; } -inline void VContainer::SetGrowth(qint32 growth) +inline void VContainer::SetSizeName(const QString &name) { - base["Р"] = growth; + sizeName = name; } -inline qint32 VContainer::size() const +inline void VContainer::SetHeight(qreal height) { - return base.value("Сг"); + _height = height; } -inline qint32 VContainer::growth() const +inline void VContainer::SetHeightName(const QString &name) { - return base.value("Р"); + heightName = name; +} + +inline qreal VContainer::size() const +{ + return _size; +} + +inline QString VContainer::SizeName() const +{ + return sizeName; +} + +inline qreal VContainer::height() const +{ + return _height; +} + +inline QString VContainer::HeightName() const +{ + return heightName; } inline bool VContainer::IncrementTableContains(const QString &name) @@ -543,11 +558,6 @@ inline const QHash *VContainer::DataGObjects() const return &gObjects; } -inline const QHash *VContainer::DataBase() const -{ - return &base; -} - inline const QHash *VContainer::DataStandardTable() const { return &standardTable; diff --git a/src/container/vstandardtablerow.cpp b/src/container/vstandardtablerow.cpp index 0c2586cc9..a150460df 100644 --- a/src/container/vstandardtablerow.cpp +++ b/src/container/vstandardtablerow.cpp @@ -29,8 +29,8 @@ #include "vstandardtablerow.h" VStandardTableRow::VStandardTableRow() - :base(0), ksize(0), kgrowth(0), description(QString()){} + :base(0), ksize(0), kgrowth(0), gui_text(QString()), number(QString()){} -VStandardTableRow::VStandardTableRow(const qint32 &base, const qreal &ksize, const qreal &kgrowth, - const QString &description) - :base(base), ksize(ksize), kgrowth(kgrowth), description(description){} +VStandardTableRow::VStandardTableRow(const qreal &base, const qreal &ksize, const qreal &kgrowth, + const QString &description, const QString &number) + :base(base), ksize(ksize), kgrowth(kgrowth), gui_text(description), number(number){} diff --git a/src/container/vstandardtablerow.h b/src/container/vstandardtablerow.h index 5dafdbac6..6305e6746 100644 --- a/src/container/vstandardtablerow.h +++ b/src/container/vstandardtablerow.h @@ -48,14 +48,14 @@ public: * @param kgrowth increment in growths * @param description description of increment */ - VStandardTableRow(const qint32 &base, const qreal &ksize, const qreal &kgrowth, - const QString &description = QString()); + VStandardTableRow(const qreal &base, const qreal &ksize, const qreal &kgrowth, + const QString &gui_text = QString(), const QString &number = QString()); ~VStandardTableRow(){} /** * @brief GetBase return value in base size and growth * @return value */ - qint32 GetBase() const; + qreal GetBase() const; /** * @brief GetKsize return increment in sizes * @return increment @@ -71,11 +71,12 @@ public: * @return description */ QString GetDescription() const; + QString GetNumber() const; private: /** * @brief base value in base size and growth */ - qint32 base; + qreal base; /** * @brief ksize increment in sizes */ @@ -87,10 +88,11 @@ private: /** * @brief description description measurement */ - QString description; + QString gui_text; + QString number; }; -inline qint32 VStandardTableRow::GetBase() const +inline qreal VStandardTableRow::GetBase() const { return base; } @@ -107,7 +109,12 @@ inline qreal VStandardTableRow::GetKgrowth() const inline QString VStandardTableRow::GetDescription() const { - return description; + return gui_text; +} + +inline QString VStandardTableRow::GetNumber() const +{ + return number; } #endif // VSTANDARDTABLEROW_H diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index 38cda7ffe..96b27bae5 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -79,7 +79,7 @@ void DialogIncrements::FillStandardTable() item->setFont(QFont("Times", 12, QFont::Bold)); ui->tableWidgetStandard->setItem(currentRow, 0, item); - item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableCell(i.key()))); + item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(i.key()))); item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetStandard->setItem(currentRow, 1, item); diff --git a/src/dialogs/tools/dialogpointofcontact.cpp b/src/dialogs/tools/dialogpointofcontact.cpp index 334878e2b..0ff100e3d 100644 --- a/src/dialogs/tools/dialogpointofcontact.cpp +++ b/src/dialogs/tools/dialogpointofcontact.cpp @@ -67,8 +67,8 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare connect(ui.listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal); connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogPointOfContact::ValChenged); - ShowVariable(data->DataBase()); - connect(ui.radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogPointOfContact::SizeGrowth); + SizeHeight(); + connect(ui.radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogPointOfContact::SizeHeight); connect(ui.radioButtonStandardTable, &QRadioButton::clicked, this, &DialogPointOfContact::StandardTable); connect(ui.radioButtonIncrements, &QRadioButton::clicked, this, &DialogPointOfContact::Increments); connect(ui.radioButtonLengthLine, &QRadioButton::clicked, this, &DialogPointOfContact::LengthLines); diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index 82ad1925f..ba6efc9aa 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -524,9 +524,24 @@ void DialogTool::EvalFormula() Eval(lineEditFormula, flagFormula, timerFormula, labelResultCalculation); } -void DialogTool::SizeGrowth() +void DialogTool::SizeHeight() { - ShowVariable(data->DataBase()); + Q_CHECK_PTR(listWidget); + disconnect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); + listWidget->clear(); + + { + QListWidgetItem *item = new QListWidgetItem(data->HeightName()); + item->setFont(QFont("Times", 12, QFont::Bold)); + listWidget->addItem(item); + } + + QListWidgetItem *item = new QListWidgetItem(data->SizeName()); + item->setFont(QFont("Times", 12, QFont::Bold)); + listWidget->addItem(item); + + connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); + listWidget->setCurrentRow (0); } void DialogTool::StandardTable() @@ -587,12 +602,12 @@ void DialogTool::ValChenged(int row) QListWidgetItem *item = listWidget->item( row ); if (radioButtonSizeGrowth->isChecked()) { - if (item->text()=="Р") + if (item->text()==data->HeightName()) { - QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->growth()).arg(tr("Height")); + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->height()).arg(tr("Height")); labelDescription->setText(desc); } - if (item->text()=="Сг") + if (item->text()==data->SizeName()) { QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->size()).arg(tr("Size")); labelDescription->setText(desc); @@ -602,7 +617,7 @@ void DialogTool::ValChenged(int row) if (radioButtonStandardTable->isChecked()) { VStandardTableRow stable = data->GetStandardTableCell(item->text()); - QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueStandardTableCell(item->text())) + QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueStandardTableRow(item->text())) .arg(stable.GetDescription()); labelDescription->setText(desc); return; @@ -649,7 +664,7 @@ void DialogTool::UpdateList() if (radioButtonSizeGrowth->isChecked()) { - ShowVariable(data->DataBase()); + SizeHeight(); } if (radioButtonStandardTable->isChecked()) { diff --git a/src/dialogs/tools/dialogtool.h b/src/dialogs/tools/dialogtool.h index dad41b0b5..054fcb015 100644 --- a/src/dialogs/tools/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -137,9 +137,9 @@ public slots: */ void EvalFormula(); /** - * @brief SizeGrowth show in list base variables + * @brief SizeHeight show in list base variables */ - void SizeGrowth(); + void SizeHeight(); /** * @brief StandardTable show in list standard table variables */ @@ -428,8 +428,8 @@ protected: connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); - ShowVariable(data->DataBase()); - connect(radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeGrowth); + SizeHeight(); + connect(radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); connect(radioButtonStandardTable, &QRadioButton::clicked, this, &DialogTool::StandardTable); connect(radioButtonIncrements, &QRadioButton::clicked, this, &DialogTool::Increments); connect(radioButtonLengthLine, &QRadioButton::clicked, this, &DialogTool::LengthLines); diff --git a/src/main.cpp b/src/main.cpp index aaedb8c55..f604eac08 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,7 +34,7 @@ #include "options.h" //Default pattern unit. -Valentina::Units patternUnit = Valentina::Mm; +Valentina::Units patternUnit = Valentina::Cm; #ifdef Q_OS_WIN const QString translationsPath = QString("/translations"); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 591c56d5e..543875485 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -975,7 +975,7 @@ void MainWindow::ChangedSize(const QString & text) void MainWindow::ChangedHeight(const QString &text) { qint32 growth = text.toInt(); - pattern->SetGrowth(growth*10); + pattern->SetHeight(growth*10); doc->FullUpdateTree(); } diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index e1a944956..fe667ff64 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -111,7 +111,7 @@ public: * @return true if validation successful. */ static bool ValidatePattern(const QString &schema, const QString &fileName, QString &errorMsg, qint64 &errorLine, - qint64 &errorColumn); + qint64 &errorColumn); protected: /** * @brief data container with data. diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index 5131e3aa2..821feb487 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -1283,7 +1283,7 @@ void VPattern::PrepareForParse(const Document::Documents &parse, VMainGraphicsSc { TestUniqueId(); data->Clear(); - data->CreateManTableIGroup(); + emit UpdateMeasurements(); nameActivDraw.clear(); sceneDraw->clear(); sceneDetail->clear(); diff --git a/src/xml/vpattern.h b/src/xml/vpattern.h index d748f693a..102e53c0a 100644 --- a/src/xml/vpattern.h +++ b/src/xml/vpattern.h @@ -218,6 +218,7 @@ signals: * @param id tool id. */ void ChangedCursor(quint32 id); + void UpdateMeasurements(); public slots: /** * @brief FullUpdateTree lite parse file. diff --git a/src/xml/vstandardmeasurements.cpp b/src/xml/vstandardmeasurements.cpp index 1aaf4cf46..92c88a976 100644 --- a/src/xml/vstandardmeasurements.cpp +++ b/src/xml/vstandardmeasurements.cpp @@ -27,7 +27,158 @@ *************************************************************************/ #include "vstandardmeasurements.h" +#include VStandardMeasurements::VStandardMeasurements(VContainer *data):VDomDocument(data) { } + +Valentina::Units VStandardMeasurements::Unit() +{ + const QString unit = UniqueTagText("unit", "cm"); + QStringList units; + units << "mm" << "cm" << "in"; + Valentina::Units result = Valentina::Cm; + switch (units.indexOf(unit)) + { + case 0:// mm + result = Valentina::Mm; + break; + case 1:// cm + result = Valentina::Cm; + break; + case 2:// in + result = Valentina::In; + break; + default: + result = Valentina::Cm; + break; + } + return result; +} + +QString VStandardMeasurements::Description() +{ + const QString desc = UniqueTagText("description", ""); + if (desc.isEmpty()) + { + qWarning()<<"Empty description in standard table."<elementsByTagName("measurement"); + if (nodeList.isEmpty()) + { + qWarning()<<"Measurement list is empty"<AddStandardTableRow(name, VStandardTableRow(base/10.0, size_increace/10.0, + height_increase/10.0, gui_text, number)); + } + else//Cm or inch. + { + data->AddStandardTableRow(name, VStandardTableRow(base, size_increace, height_increase, + gui_text, number)); + } + } + } + } + } +} + +void VStandardMeasurements::SetSize() +{ + const QDomNodeList nodeList = this->elementsByTagName("size"); + if (nodeList.isEmpty()) + { + data->SetSize(50); + data->SetSizeName("Сг"); + } + else + { + const QDomNode domNode = nodeList.at(0); + if (domNode.isNull() == false && domNode.isElement()) + { + const QDomElement domElement = domNode.toElement(); + if (domElement.isNull() == false) + { + const QString name = GetParametrString(domElement, "name", "Сг"); + const qreal base = GetParametrDouble(domElement, "base", "50.0"); + if (Unit() == Valentina::Mm)//Convert to Cm. + { + data->SetSize(base/10.0); + data->SetSizeName(name); + } + else//Cm or inch. + { + data->SetSize(base); + data->SetSizeName(name); + } + } + } + } +} + +void VStandardMeasurements::SetHeight() +{ + const QDomNodeList nodeList = this->elementsByTagName("height"); + if (nodeList.isEmpty()) + { + data->SetHeight(176); + data->SetHeightName("P"); + } + else + { + const QDomNode domNode = nodeList.at(0); + if (domNode.isNull() == false && domNode.isElement()) + { + const QDomElement domElement = domNode.toElement(); + if (domElement.isNull() == false) + { + const QString name = GetParametrString(domElement, "name", "Р"); + const qreal base = GetParametrDouble(domElement, "base", "176.0"); + if (Unit() == Valentina::Mm)//Convert to Cm. + { + data->SetHeight(base/10.0); + data->SetHeightName(name); + } + else//Cm or inch. + { + data->SetHeight(base); + data->SetHeightName(name); + } + } + } + } +} + +void VStandardMeasurements::Update() +{ + Measurements(); +} diff --git a/src/xml/vstandardmeasurements.h b/src/xml/vstandardmeasurements.h index 003af3625..7df93d3c0 100644 --- a/src/xml/vstandardmeasurements.h +++ b/src/xml/vstandardmeasurements.h @@ -30,11 +30,20 @@ #define VSTANDARDMEASUREMENTS_H #include "vdomdocument.h" +#include "../options.h" -class VStandardMeasurements:public VDomDocument +class VStandardMeasurements:public QObject, public VDomDocument { + Q_OBJECT public: VStandardMeasurements(VContainer *data); + Valentina::Units Unit(); + QString Description(); + void Measurements(); + void SetSize(); + void SetHeight(); +public slots: + void Update(); }; #endif // VSTANDARDMEASUREMENTS_H From 7d01bca72d5a51731b0e05dae2cdd85c274f77de Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 14 Mar 2014 16:12:53 +0200 Subject: [PATCH 43/60] Parsing individual measurements table. --HG-- branch : feature --- share/tables/individual/indivindual_ru.vit | 160 +++++++-------- src/container/container.pri | 4 +- src/container/vcontainer.cpp | 20 +- src/container/vcontainer.h | 42 ++-- ...vstandardtablerow.cpp => vmeasurement.cpp} | 30 ++- .../{vstandardtablerow.h => vmeasurement.h} | 30 +-- src/dialogs/app/dialogincrements.cpp | 8 +- src/dialogs/tools/dialogtool.cpp | 2 +- src/main.cpp | 4 +- src/options.h | 12 ++ src/xml/vdomdocument.cpp | 32 ++- src/xml/vdomdocument.h | 2 + src/xml/vindividualmeasurements.cpp | 184 ++++++++++++++++++ src/xml/vindividualmeasurements.h | 8 + src/xml/vstandardmeasurements.cpp | 26 +-- src/xml/vstandardmeasurements.h | 1 - 16 files changed, 404 insertions(+), 161 deletions(-) rename src/container/{vstandardtablerow.cpp => vmeasurement.cpp} (58%) rename src/container/{vstandardtablerow.h => vmeasurement.h} (77%) diff --git a/share/tables/individual/indivindual_ru.vit b/share/tables/individual/indivindual_ru.vit index 9f7ee6edf..796a317ab 100644 --- a/share/tables/individual/indivindual_ru.vit +++ b/share/tables/individual/indivindual_ru.vit @@ -9,98 +9,98 @@ mm - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - + + + - - - - - - - + + + + + + + - - + + - - - - - - - - - + + + + + + + + + diff --git a/src/container/container.pri b/src/container/container.pri index 5fe8d435f..bbc26547b 100644 --- a/src/container/container.pri +++ b/src/container/container.pri @@ -2,10 +2,10 @@ SOURCES += \ src/container/vincrementtablerow.cpp \ src/container/vcontainer.cpp \ src/container/calculator.cpp \ - src/container/vstandardtablerow.cpp + src/container/vmeasurement.cpp HEADERS += \ src/container/vincrementtablerow.h \ src/container/vcontainer.h \ src/container/calculator.h \ - src/container/vstandardtablerow.h + src/container/vmeasurement.h diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index 3dc327aa2..e6219cc78 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -35,7 +35,7 @@ quint32 VContainer::_id = 0; VContainer::VContainer() :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash()), - standardTable(QHash()), incrementTable(QHash()), + standardTable(QHash()), incrementTable(QHash()), lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()), lengthArcs(QHash()), details(QHash()) { @@ -49,7 +49,7 @@ VContainer &VContainer::operator =(const VContainer &data) VContainer::VContainer(const VContainer &data) :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash()), - standardTable(QHash()), incrementTable(QHash()), + standardTable(QHash()), incrementTable(QHash()), lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()), lengthArcs(QHash()), details(QHash()) { @@ -143,7 +143,7 @@ val VContainer::GetVariable(const QHash &obj, key id) const } } -const VStandardTableRow VContainer::GetStandardTableCell(const QString &name) const +const VMeasurement VContainer::GetMeasurement(const QString &name) const { Q_ASSERT(name.isEmpty()==false); return GetVariable(standardTable, name); @@ -250,11 +250,15 @@ void VContainer::AddLineAngle(const QString &name, const qreal &value) qreal VContainer::GetValueStandardTableRow(const QString& name) const { - const VStandardTableRow row = GetStandardTableCell(name); - const qreal k_size = ( size() - 50.0 ) / 2.0; - const qreal k_growth = ( height() - 176.0 ) / 6.0; - const qreal value = row.GetBase() + k_size * row.GetKsize() + k_growth * row.GetKgrowth(); - return value; + const VMeasurement m = GetMeasurement(name); + if (patternType == Pattern::Individual) + { + return m.GetValue(); + } + else + { + return m.GetValue(size(), height()); + } } qreal VContainer::GetValueIncrementTableRow(const QString& name) const diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index 08e7c1f07..0550c0a45 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -29,7 +29,7 @@ #ifndef VCONTAINER_H #define VCONTAINER_H -#include "vstandardtablerow.h" +#include "vmeasurement.h" #include "vincrementtablerow.h" #include "../geometry/varc.h" #include "../geometry/vsplinepath.h" @@ -107,11 +107,11 @@ public: */ const VGObject *GetGObject(quint32 id) const; /** - * @brief GetStandardTableCell return standard table row by name - * @param name name of standard table row - * @return row of standard table + * @brief GetMeasurement return measurement by name + * @param name short measurement name + * @return measurement */ - const VStandardTableRow GetStandardTableCell(const QString& name) const; + const VMeasurement GetMeasurement(const QString& name) const; /** * @brief GetIncrementTableRow return increment table row by name * @param name name of increment table row @@ -147,7 +147,7 @@ public: * @param id id of detail * @return detail */ - const VDetail GetDetail(quint32 id) const; + const VDetail GetDetail(quint32 id) const; /** * @brief getId return current id * @return current id @@ -166,11 +166,11 @@ public: */ quint32 AddDetail(VDetail detail); /** - * @brief AddStandardTableRow add new row of standard table - * @param name name of row of standard table - * @param row row of standard table + * @brief AddMeasurement add new measurement + * @param name short measurement name + * @param row measurement */ - void AddStandardTableRow(const QString& name, const VStandardTableRow &row); + void AddMeasurement(const QString& name, const VMeasurement &m); /** * @brief AddIncrementTableRow add new row of increment table * @param name name of new row of increment table @@ -236,11 +236,11 @@ public: */ void UpdateDetail(quint32 id, const VDetail &detail); /** - * @brief UpdateStandardTableCell update standard table row by name - * @param name name of row - * @param cell row of standard table + * @brief UpdateMeasurement update measurement by name + * @param name short measurement name + * @param m measurement */ - void UpdateStandardTableCell(const QString& name, VStandardTableRow cell); + void UpdateMeasurement(const QString& name, VMeasurement m); /** * @brief UpdateIncrementTableRow update increment table row by name * @param name name of row @@ -345,7 +345,7 @@ public: * @brief data container with dataStandardTable return container of standard table * @return pointer on container of standard table */ - const QHash *DataStandardTable() const; + const QHash *DataStandardTable() const; /** * @brief data container with dataIncrementTable return container of increment table * @return pointer on container of increment table @@ -397,7 +397,7 @@ private: /** * @brief standardTable container of standard table rows */ - QHash standardTable; + QHash standardTable; /** * @brief incrementTable */ @@ -458,14 +458,14 @@ private: static quint32 AddObject(QHash &obj, val value); }; -inline void VContainer::AddStandardTableRow(const QString &name, const VStandardTableRow &row) +inline void VContainer::AddMeasurement(const QString &name, const VMeasurement &m) { - standardTable[name] = row; + standardTable[name] = m; } -inline void VContainer::UpdateStandardTableCell(const QString &name, VStandardTableRow cell) +inline void VContainer::UpdateMeasurement(const QString &name, VMeasurement m) { - standardTable[name] = cell; + standardTable[name] = m; } inline void VContainer::UpdateIncrementTableRow(const QString &name, VIncrementTableRow row) @@ -558,7 +558,7 @@ inline const QHash *VContainer::DataGObjects() const return &gObjects; } -inline const QHash *VContainer::DataStandardTable() const +inline const QHash *VContainer::DataStandardTable() const { return &standardTable; } diff --git a/src/container/vstandardtablerow.cpp b/src/container/vmeasurement.cpp similarity index 58% rename from src/container/vstandardtablerow.cpp rename to src/container/vmeasurement.cpp index a150460df..c08f28318 100644 --- a/src/container/vstandardtablerow.cpp +++ b/src/container/vmeasurement.cpp @@ -26,11 +26,29 @@ ** *************************************************************************/ -#include "vstandardtablerow.h" +#include "vmeasurement.h" -VStandardTableRow::VStandardTableRow() - :base(0), ksize(0), kgrowth(0), gui_text(QString()), number(QString()){} +VMeasurement::VMeasurement() + :base(0), ksize(50.0), kheight(176.0), gui_text(QString()), number(QString()){} -VStandardTableRow::VStandardTableRow(const qreal &base, const qreal &ksize, const qreal &kgrowth, - const QString &description, const QString &number) - :base(base), ksize(ksize), kgrowth(kgrowth), gui_text(description), number(number){} +VMeasurement::VMeasurement(const qreal &base, const qreal &ksize, const qreal &kgrowth, + const QString &gui_text, const QString &number) + :base(base), ksize(ksize), kheight(kgrowth), gui_text(gui_text), number(number){} + +VMeasurement::VMeasurement(const qreal &base, const QString &gui_text, const QString &number) + :base(base), ksize(50.0), kheight(176.0), gui_text(gui_text), number(number) +{ + +} + +qreal VMeasurement::GetValue() const +{ + return base; +} + +qreal VMeasurement::GetValue(const qreal &size, const qreal &height) const +{ + const qreal k_size = ( size - 50.0 ) / 2.0; + const qreal k_growth = ( height - 176.0 ) / 6.0; + return base + k_size * ksize + k_growth * kheight; +} diff --git a/src/container/vstandardtablerow.h b/src/container/vmeasurement.h similarity index 77% rename from src/container/vstandardtablerow.h rename to src/container/vmeasurement.h index 6305e6746..7942df8d7 100644 --- a/src/container/vstandardtablerow.h +++ b/src/container/vmeasurement.h @@ -32,15 +32,15 @@ #include /** - * @brief The VStandardTableRow class keep data row of standard table + * @brief The VMeasurement class keep data row of standard table */ -class VStandardTableRow +class VMeasurement { public: /** * @brief VStandardTableRow create empty row */ - VStandardTableRow(); + VMeasurement(); /** * @brief VStandardTableRow create row * @param base value in base size and growth @@ -48,9 +48,11 @@ public: * @param kgrowth increment in growths * @param description description of increment */ - VStandardTableRow(const qreal &base, const qreal &ksize, const qreal &kgrowth, + VMeasurement(const qreal &base, const qreal &ksize, const qreal &kheight, const QString &gui_text = QString(), const QString &number = QString()); - ~VStandardTableRow(){} + VMeasurement(const qreal &base, const QString &gui_text = QString(), + const QString &number = QString()); + ~VMeasurement(){} /** * @brief GetBase return value in base size and growth * @return value @@ -65,13 +67,15 @@ public: * @brief GetKgrowth return increment in growths * @return increment */ - qreal GetKgrowth() const; + qreal GetKheight() const; /** * @brief GetDescription return description * @return description */ QString GetDescription() const; QString GetNumber() const; + qreal GetValue() const; + qreal GetValue(const qreal &size, const qreal &height) const; private: /** * @brief base value in base size and growth @@ -84,7 +88,7 @@ private: /** * @brief kgrowth increment in growths */ - qreal kgrowth; + qreal kheight; /** * @brief description description measurement */ @@ -92,27 +96,27 @@ private: QString number; }; -inline qreal VStandardTableRow::GetBase() const +inline qreal VMeasurement::GetBase() const { return base; } -inline qreal VStandardTableRow::GetKsize() const +inline qreal VMeasurement::GetKsize() const { return ksize; } -inline qreal VStandardTableRow::GetKgrowth() const +inline qreal VMeasurement::GetKheight() const { - return kgrowth; + return kheight; } -inline QString VStandardTableRow::GetDescription() const +inline QString VMeasurement::GetDescription() const { return gui_text; } -inline QString VStandardTableRow::GetNumber() const +inline QString VMeasurement::GetNumber() const { return number; } diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index 96b27bae5..2fa67fc92 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -64,14 +64,14 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par void DialogIncrements::FillStandardTable() { - const QHash *standardTable = data->DataStandardTable(); + const QHash *standardTable = data->DataStandardTable(); qint32 currentRow = -1; - QHashIterator i(*standardTable); + QHashIterator i(*standardTable); ui->tableWidgetStandard->setRowCount ( standardTable->size() ); while (i.hasNext()) { i.next(); - VStandardTableRow cell = i.value(); + VMeasurement cell = i.value(); currentRow++; QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); @@ -91,7 +91,7 @@ void DialogIncrements::FillStandardTable() item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetStandard->setItem(currentRow, 3, item); - item = new QTableWidgetItem(QString().setNum(cell.GetKgrowth())); + item = new QTableWidgetItem(QString().setNum(cell.GetKheight())); item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetStandard->setItem(currentRow, 4, item); diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index ba6efc9aa..378508674 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -616,7 +616,7 @@ void DialogTool::ValChenged(int row) } if (radioButtonStandardTable->isChecked()) { - VStandardTableRow stable = data->GetStandardTableCell(item->text()); + VMeasurement stable = data->GetMeasurement(item->text()); QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueStandardTableRow(item->text())) .arg(stable.GetDescription()); labelDescription->setText(desc); diff --git a/src/main.cpp b/src/main.cpp index f604eac08..250149737 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -33,8 +33,8 @@ #include "tablewindow.h" #include "options.h" -//Default pattern unit. -Valentina::Units patternUnit = Valentina::Cm; +Valentina::Units patternUnit = Valentina::Cm;// Default pattern unit. +Pattern::Measurements patternType = Pattern::Individual;// Default pattern type. #ifdef Q_OS_WIN const QString translationsPath = QString("/translations"); diff --git a/src/options.h b/src/options.h index d07c656eb..b7466d681 100644 --- a/src/options.h +++ b/src/options.h @@ -103,6 +103,18 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Units ) extern Valentina::Units patternUnit; +namespace Pattern +{ + /** + * @brief The Scene enum + */ + enum Measurement { Standard, Individual }; + Q_DECLARE_FLAGS(Measurements, Measurement) +} +Q_DECLARE_OPERATORS_FOR_FLAGS( Pattern::Measurements ) + +extern Pattern::Measurements patternType; + #define PrintDPI 96.0 inline double toPixel(double unit) diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index e22d956e5..bc248a6bc 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -168,7 +168,14 @@ QString VDomDocument::GetParametrString(const QDomElement &domElement, const QSt const QString parameter = domElement.attribute(name, defValue); if (parameter.isEmpty()) { - throw VExceptionEmptyParameter(tr("Got empty parameter"), name, domElement); + if (defValue.isEmpty()) + { + throw VExceptionEmptyParameter(tr("Got empty parameter"), name, domElement); + } + else + { + return defValue; + } } return parameter; } @@ -258,3 +265,26 @@ bool VDomDocument::ValidatePattern(const QString &schema, const QString &fileNam return true; } } + +Valentina::Units VDomDocument::Units(const QString &unit) +{ + QStringList units; + units << "mm" << "cm" << "in"; + Valentina::Units result = Valentina::Cm; + switch (units.indexOf(unit)) + { + case 0:// mm + result = Valentina::Mm; + break; + case 1:// cm + result = Valentina::Cm; + break; + case 2:// in + result = Valentina::In; + break; + default: + result = Valentina::Cm; + break; + } + return result; +} diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index fe667ff64..ede7c9963 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -33,6 +33,7 @@ #include #include +#include "../options.h" #ifdef Q_CC_GNU #pragma GCC diagnostic push @@ -117,6 +118,7 @@ protected: * @brief data container with data. */ VContainer *data; + Valentina::Units Units(const QString &unit); private: Q_DISABLE_COPY(VDomDocument) /** diff --git a/src/xml/vindividualmeasurements.cpp b/src/xml/vindividualmeasurements.cpp index 94bd3d812..e474fd179 100644 --- a/src/xml/vindividualmeasurements.cpp +++ b/src/xml/vindividualmeasurements.cpp @@ -31,3 +31,187 @@ VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data) { } + +Valentina::Units VIndividualMeasurements::Unit() +{ + const QString unit = UniqueTagText("unit", "cm"); + return VDomDocument::Units(unit); +} + +void VIndividualMeasurements::Measurements() +{ + //head and neck + Measurement("head_girth"); + Measurement("mid_neck_girth"); + Measurement("neck_base_girth"); + Measurement("head_and_neck_length"); + //torso + Measurement("center_front_waist_length"); + Measurement("center_back_waist_length"); + Measurement("shoulder_length"); + Measurement("side_waist_length"); + Measurement("trunk_length"); + Measurement("shoulder_girth"); + Measurement("upper_chest_girth"); + Measurement("bust__girth"); + Measurement("under_bust_girth"); + Measurement("waist_girth"); + Measurement("high_hip_girth"); + Measurement("hip_girth"); + Measurement("upper_front_chest_width"); + Measurement("front_chest_width"); + Measurement("across_front_shoulder_width"); + Measurement("across_back_shoulder_width"); + Measurement("upper_back_width"); + Measurement("back_width"); + Measurement("bustpoint_to_bustpoint"); + Measurement("halter_bustpoint_to_bustpoint"); + Measurement("neck_to_bustpoint"); + Measurement("crotch_length"); + Measurement("rise_height"); + Measurement("shoulder_drop"); + Measurement("shoulder_slope_degrees"); + Measurement("front_shoulder_slope_length"); + Measurement("back_shoulder_slope_length"); + Measurement("front_shoulder_to_waist_length"); + Measurement("back_shoulder_to_waist_length"); + Measurement("front_neck_arc"); + Measurement("back_neck_arc"); + Measurement("front_upper-bust_arc"); + Measurement("back_upper-bust_arc"); + Measurement("front_waist_arc"); + Measurement("back_waist_arc"); + Measurement("front_upper-hip_arc"); + Measurement("back_upper-hip_arc"); + Measurement("front_hip_arc"); + Measurement("back_hip_arc"); + Measurement("chest_slope"); + Measurement("back_slope"); + Measurement("front_waist_slope"); + Measurement("back_waist_slope"); + Measurement("front-neck_to_upper-chest_height"); + Measurement("front-neck_to_bust_height"); + //arm + Measurement("armscye_girth"); + Measurement("elbow_girth"); + Measurement("upper-arm_girth"); + Measurement("wrist_girth"); + Measurement("scye_depth"); + Measurement("shoulder_and_arm_length"); + Measurement("underarm_length"); + Measurement("cervicale_to_wrist_length"); + Measurement("shoulder_to_elbow_length"); + Measurement("arm_length"); + //hand + Measurement("hand_width"); + Measurement("hand_length"); + Measurement("hand_girth"); + //leg + Measurement("thigh_girth"); + Measurement("mid_thigh_girth"); + Measurement("knee_girth"); + Measurement("calf_girth"); + Measurement("ankle_girth"); + Measurement("knee_height"); + Measurement("ankle_height"); + //foot + Measurement("foot_width"); + Measurement("foot_length"); + //heights + Measurement("height"); + Measurement("cervicale_height"); + Measurement("cervicale_to_knee_height"); + Measurement("waist_height"); + Measurement("high_hip_height"); + Measurement("hip_height"); + Measurement("waist_to_hip_height"); + Measurement("waist_to_knee_height"); + Measurement("crotch_height"); +} + +void VIndividualMeasurements::Measurement(const QString &tag) +{ + const QDomNodeList nodeList = this->elementsByTagName(tag); + if (nodeList.isEmpty()) + { + qWarning()<<"Measurement" << tag <<"doesn't exist"<AddMeasurement(name, VMeasurement(value/10.0, gui_text, description)); + if (m_number.isEmpty()) + { + qWarning()<<"Can't find language-independent measurement name for "<< tag; + return; + } + else + { + data->AddMeasurement(m_number, VMeasurement(value/10.0, gui_text, description)); + } + } + else//Cm or inch. + { + data->AddMeasurement(name, VMeasurement(value, gui_text, description)); + if (m_number.isEmpty()) + { + qWarning()<<"Can't find language-independent measurement name for "<< tag; + return; + } + else + { + data->AddMeasurement(m_number, VMeasurement(value, gui_text, description)); + } + } + } + } + } +} + +QString VIndividualMeasurements::Language() +{ + return UniqueTagText("lang", "en"); +} + +QString VIndividualMeasurements::FamilyName() +{ + return UniqueTagText("family-name", ""); +} + +QString VIndividualMeasurements::GivenName() +{ + return UniqueTagText("given-name", ""); +} + +QString VIndividualMeasurements::BirthDate() +{ + return UniqueTagText("birth-date", ""); +} + +QString VIndividualMeasurements::Sex() +{ + return UniqueTagText("sex", ""); +} diff --git a/src/xml/vindividualmeasurements.h b/src/xml/vindividualmeasurements.h index f2cf6fda6..55931039d 100644 --- a/src/xml/vindividualmeasurements.h +++ b/src/xml/vindividualmeasurements.h @@ -35,6 +35,14 @@ class VIndividualMeasurements:public VDomDocument { public: VIndividualMeasurements(VContainer *data); + Valentina::Units Unit(); + void Measurements(); + void Measurement(const QString &tag); + QString Language(); + QString FamilyName(); + QString GivenName(); + QString BirthDate(); + QString Sex(); }; #endif // VINDIVIDUALMEASUREMENTS_H diff --git a/src/xml/vstandardmeasurements.cpp b/src/xml/vstandardmeasurements.cpp index 92c88a976..cf146f807 100644 --- a/src/xml/vstandardmeasurements.cpp +++ b/src/xml/vstandardmeasurements.cpp @@ -36,25 +36,7 @@ VStandardMeasurements::VStandardMeasurements(VContainer *data):VDomDocument(data Valentina::Units VStandardMeasurements::Unit() { const QString unit = UniqueTagText("unit", "cm"); - QStringList units; - units << "mm" << "cm" << "in"; - Valentina::Units result = Valentina::Cm; - switch (units.indexOf(unit)) - { - case 0:// mm - result = Valentina::Mm; - break; - case 1:// cm - result = Valentina::Cm; - break; - case 2:// in - result = Valentina::In; - break; - default: - result = Valentina::Cm; - break; - } - return result; + return VDomDocument::Units(unit); } QString VStandardMeasurements::Description() @@ -98,12 +80,12 @@ void VStandardMeasurements::Measurements() if (Unit() == Valentina::Mm)//Convert to Cm. { - data->AddStandardTableRow(name, VStandardTableRow(base/10.0, size_increace/10.0, - height_increase/10.0, gui_text, number)); + data->AddMeasurement(name, VMeasurement(base/10.0, size_increace/10.0, height_increase/10.0, + gui_text, number)); } else//Cm or inch. { - data->AddStandardTableRow(name, VStandardTableRow(base, size_increace, height_increase, + data->AddMeasurement(name, VMeasurement(base, size_increace, height_increase, gui_text, number)); } } diff --git a/src/xml/vstandardmeasurements.h b/src/xml/vstandardmeasurements.h index 7df93d3c0..327c32caa 100644 --- a/src/xml/vstandardmeasurements.h +++ b/src/xml/vstandardmeasurements.h @@ -30,7 +30,6 @@ #define VSTANDARDMEASUREMENTS_H #include "vdomdocument.h" -#include "../options.h" class VStandardMeasurements:public QObject, public VDomDocument { From 4d210ddd48400957f3afd531abab39bfb84b2e09 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 14 Mar 2014 17:59:28 +0200 Subject: [PATCH 44/60] Each exception can show error message from previous. --HG-- branch : feature --- src/exception/vexception.cpp | 28 +++++++++++++- src/exception/vexception.h | 29 +++++++++++++- src/exception/vexceptionemptyparameter.cpp | 3 +- src/exception/vexceptionobjecterror.cpp | 26 ++----------- src/exception/vexceptionobjecterror.h | 19 ---------- src/exception/vexceptionwrongid.cpp | 3 +- src/xml/vdomdocument.cpp | 44 ++++++++++++++++++---- src/xml/vdomdocument.h | 3 ++ src/xml/vpattern.cpp | 20 ++++++++-- 9 files changed, 115 insertions(+), 60 deletions(-) diff --git a/src/exception/vexception.cpp b/src/exception/vexception.cpp index 35216898b..a9121884e 100644 --- a/src/exception/vexception.cpp +++ b/src/exception/vexception.cpp @@ -31,11 +31,16 @@ #include #include -VException::VException(const QString &what):QException(), what(what) +VException::VException(const QString &what):QException(), what(what), moreInfo(QString()) { Q_ASSERT_X(what.isEmpty() == false, Q_FUNC_INFO, "Error message is empty"); } +VException::VException(const VException &e):what(e.What()), moreInfo(e.MoreInformation()) +{ + +} + QString VException::ErrorMessage() const { QString error = QString("Exception: %1").arg(what); @@ -61,3 +66,24 @@ void VException::CriticalMessageBox(const QString &situation, QWidget * parent) layout->addItem(horizontalSpacer, layout->rowCount(), 0, 1, layout->columnCount()); msgBox.exec(); } + +void VException::AddMoreInformation(const QString &info) +{ + if (info.isEmpty()) + { + return; + } + moreInfo = QString("%1\n%2").arg(moreInfo, info); +} + +QString VException::MoreInfo(const QString &detInfo) const +{ + if (moreInfo.isEmpty() == false) + { + return QString("%1\n%2").arg(moreInfo, detInfo); + } + else + { + return detInfo; + } +} diff --git a/src/exception/vexception.h b/src/exception/vexception.h index ea0145ce7..4a42522d9 100644 --- a/src/exception/vexception.h +++ b/src/exception/vexception.h @@ -49,7 +49,7 @@ public: * @brief VException copy constructor * @param e exception */ - VException(const VException &e):what(e.What()){} + VException(const VException &e); virtual ~VException() noexcept (true){} /** * @brief raise method raise for exception @@ -69,7 +69,7 @@ public: * @brief DetailedInformation return detailed information about error * @return detailed information */ - virtual QString DetailedInformation() const { return QString(); } + virtual QString DetailedInformation() const; /** * @brief What return string with error * @return string with error @@ -80,11 +80,26 @@ public: * @param situation main text message box. */ virtual void CriticalMessageBox(const QString &situation, QWidget *parent = nullptr) const; + /** + * @brief AddMoreInformation add more information for error + * @param info information + */ + void AddMoreInformation(const QString &info); + /** + * @brief MoreInformation return more information for error + * @return information + */ + QString MoreInformation() const; protected: /** * @brief what string with error */ QString what; + /** + * @brief moreInfo more information about error + */ + QString moreInfo; + QString MoreInfo(const QString &detInfo) const; }; inline void VException::raise() const @@ -97,9 +112,19 @@ inline VException *VException::clone() const return new VException(*this); } +inline QString VException::DetailedInformation() const +{ + return moreInfo; +} + inline QString VException::What() const { return what; } +inline QString VException::MoreInformation() const +{ + return moreInfo; +} + #endif // VEXCEPTION_H diff --git a/src/exception/vexceptionemptyparameter.cpp b/src/exception/vexceptionemptyparameter.cpp index 1d12deac5..ed767abc9 100644 --- a/src/exception/vexceptionemptyparameter.cpp +++ b/src/exception/vexceptionemptyparameter.cpp @@ -56,6 +56,5 @@ QString VExceptionEmptyParameter::ErrorMessage() const QString VExceptionEmptyParameter::DetailedInformation() const { - QString detail = QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText); - return detail; + return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText)); } diff --git a/src/exception/vexceptionobjecterror.cpp b/src/exception/vexceptionobjecterror.cpp index ab69f8a3b..4273a745b 100644 --- a/src/exception/vexceptionobjecterror.cpp +++ b/src/exception/vexceptionobjecterror.cpp @@ -30,7 +30,7 @@ #include VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElement &domElement) - :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1), moreInfo(QString()) + :VException(what), tagText(QString()), tagName(QString()), lineNumber(-1) { Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); QTextStream stream(&tagText); @@ -40,8 +40,7 @@ VExceptionObjectError::VExceptionObjectError(const QString &what, const QDomElem } VExceptionObjectError::VExceptionObjectError(const VExceptionObjectError &e) - :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()), - moreInfo(e.MoreInformation()) + :VException(e), tagText(e.TagText()), tagName(e.TagName()), lineNumber(e.LineNumber()) { } @@ -54,24 +53,5 @@ QString VExceptionObjectError::ErrorMessage() const QString VExceptionObjectError::DetailedInformation() const { - QString detail; - if (moreInfo.isEmpty() == false) - { - QString i = QString("tag: %1 in line %2\n%3").arg(tagName).arg(lineNumber).arg(tagText); - detail = QString("%1\n%2").arg(moreInfo, i); - } - else - { - detail = QString("tag: %1 in line %2\n%3").arg(tagName).arg(lineNumber).arg(tagText); - } - return detail; -} - -void VExceptionObjectError::AddMoreInformation(const QString &info) -{ - if (info.isEmpty()) - { - qWarning()<<"Error additional information is empty."<moreInfo.append(info); + return MoreInfo(QString("tag: %1 in line %2\n%3").arg(tagName).arg(lineNumber).arg(tagText)); } diff --git a/src/exception/vexceptionobjecterror.h b/src/exception/vexceptionobjecterror.h index ab2baa4f5..864a78e13 100644 --- a/src/exception/vexceptionobjecterror.h +++ b/src/exception/vexceptionobjecterror.h @@ -76,16 +76,6 @@ public: * @return line number */ qint32 LineNumber() const; - /** - * @brief AddMoreInformation add more information for error - * @param info information - */ - void AddMoreInformation(const QString &info); - /** - * @brief MoreInformation return more information for error - * @return information - */ - QString MoreInformation() const; protected: /** * @brief tagText tag text @@ -99,10 +89,6 @@ protected: * @brief lineNumber line number */ qint32 lineNumber; - /** - * @brief moreInfo more information about error - */ - QString moreInfo; }; inline QString VExceptionObjectError::TagText() const @@ -120,9 +106,4 @@ inline qint32 VExceptionObjectError::LineNumber() const return lineNumber; } -inline QString VExceptionObjectError::MoreInformation() const -{ - return moreInfo; -} - #endif // VEXCEPTIONOBJECTERROR_H diff --git a/src/exception/vexceptionwrongid.cpp b/src/exception/vexceptionwrongid.cpp index ac78b1d99..76471d0c7 100644 --- a/src/exception/vexceptionwrongid.cpp +++ b/src/exception/vexceptionwrongid.cpp @@ -53,6 +53,5 @@ QString VExceptionWrongId::ErrorMessage() const QString VExceptionWrongId::DetailedInformation() const { - QString detail = QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText); - return detail; + return MoreInfo(QString("tag: %1 in line %2\nFull tag:\n%3").arg(tagName).arg(lineNumber).arg(tagText)); } diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index bc248a6bc..ea9f94dee 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -150,13 +150,28 @@ quint32 VDomDocument::GetParametrUInt(const QDomElement &domElement, const QStri { Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + bool ok = false; - const QString parametr = GetParametrString(domElement, name, defValue); - const quint32 id = parametr.toUInt(&ok); - if (ok == false) + QString parametr; + quint32 id = 0; + + QString message = tr("Can't convert toUInt parameter"); + try { - throw VExceptionConversionError(tr("Can't convert toUInt parameter"), name); + parametr = GetParametrString(domElement, name, defValue); + id = parametr.toUInt(&ok); + if (ok == false) + { + throw VExceptionConversionError(message, name); + } } + catch (const VExceptionEmptyParameter &e) + { + VExceptionConversionError excep(message, name); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; + } + return id; } @@ -184,12 +199,25 @@ qreal VDomDocument::GetParametrDouble(const QDomElement &domElement, const QStri { Q_ASSERT_X(name.isEmpty() == false, Q_FUNC_INFO, "name of parametr is empty"); Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); + bool ok = false; - QString parametr = GetParametrString(domElement, name, defValue); - const qreal param = parametr.replace(",", ".").toDouble(&ok); - if (ok == false) + qreal param = 0; + + QString message = tr("Can't convert toDouble parameter"); + try { - throw VExceptionConversionError(tr("Can't convert toDouble parameter"), name); + QString parametr = GetParametrString(domElement, name, defValue); + param = parametr.replace(",", ".").toDouble(&ok); + if (ok == false) + { + throw VExceptionConversionError(message, name); + } + } + catch (const VExceptionEmptyParameter &e) + { + VExceptionConversionError excep(message, name); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; } return param; } diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index ede7c9963..3de21dc03 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -88,8 +88,11 @@ public: const QString &defValue) const; /** * @brief GetParametrString return string value of attribute. + * + * if attribute empty return default value. If default value empty too throw exception. * @param domElement tag in xml tree. * @param name attribute name. + * @throw VExceptionEmptyParameter when attribute is empty * @return attribute value. */ QString GetParametrString(const QDomElement& domElement, const QString &name, diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index 821feb487..b3f763291 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -34,6 +34,7 @@ #include "../tools/nodeDetails/nodedetails.h" #include "../exception/vexceptionobjecterror.h" #include "../exception/vexceptionwrongid.h" +#include "../exception/vexceptionconversionerror.h" #include @@ -1244,10 +1245,23 @@ void VPattern::ParseIncrementsElement(const QDomNode &node) quint32 VPattern::GetParametrId(const QDomElement &domElement) const { Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null"); - const quint32 id = GetParametrUInt(domElement, VAbstractTool::AttrId, "0"); - if (id <= 0) + + quint32 id = 0; + + QString message = tr("Got wrong parameter id. Need only id > 0."); + try { - throw VExceptionWrongId(tr("Got wrong parameter id. Need only id > 0."), domElement); + id = GetParametrUInt(domElement, VAbstractTool::AttrId, "0"); + if (id <= 0) + { + throw VExceptionWrongId(message, domElement); + } + } + catch (const VExceptionConversionError &e) + { + VExceptionWrongId excep(message, domElement); + excep.AddMoreInformation(e.ErrorMessage()); + throw excep; } return id; } From de85cad8392542a7370895b1e5ece37c7faebe02 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 14 Mar 2014 19:54:20 +0200 Subject: [PATCH 45/60] Creation list with all tables with standard measurements. --HG-- branch : feature --- .../app/dialogstandardmeasurements.cpp | 53 ++++-- src/dialogs/app/dialogstandardmeasurements.h | 4 +- src/mainwindow.cpp | 170 ++++++++---------- src/xml/vdomdocument.cpp | 38 ++-- src/xml/vdomdocument.h | 4 +- 5 files changed, 150 insertions(+), 119 deletions(-) diff --git a/src/dialogs/app/dialogstandardmeasurements.cpp b/src/dialogs/app/dialogstandardmeasurements.cpp index 9d84b4d1c..4d9daee79 100644 --- a/src/dialogs/app/dialogstandardmeasurements.cpp +++ b/src/dialogs/app/dialogstandardmeasurements.cpp @@ -29,9 +29,10 @@ #include "dialogstandardmeasurements.h" #include "ui_dialogstandardmeasurements.h" #include +#include "../../xml/vstandardmeasurements.h" -DialogStandardMeasurements::DialogStandardMeasurements(QWidget *parent) : - QDialog(parent), ui(new Ui::DialogStandardMeasurements), _name(QString()), _tablePath(QString()) +DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, QWidget *parent) : + QDialog(parent), ui(new Ui::DialogStandardMeasurements), data(data), _name(QString()), _tablePath(QString()) { ui->setupUi(this); @@ -70,7 +71,8 @@ QString DialogStandardMeasurements::tablePath() const void DialogStandardMeasurements::DialogAccepted() { _name = ui->lineEditName->text(); - _tablePath = "path"; + const qint32 index = ui->comboBoxTables->currentIndex(); + _tablePath = ui->comboBoxTables->itemData(index).toString(); accept(); } @@ -107,20 +109,19 @@ void DialogStandardMeasurements::CheckState() void DialogStandardMeasurements::LoadStandardTables() { #ifdef Q_OS_WIN - const QString pathToTables = QString("/standard_tables"); + const QString pathToTables = QString("/tables/standard"); #else #ifdef QT_DEBUG - const QString pathToTables = QString("/standard_tables"); + const QString pathToTables = QString("/tables/standard"); #else - const QString pathToTables = QString("/usr/share/valentina/standard_tables"); + const QString pathToTables = QString("/usr/share/valentina/tables/standard"); #endif #endif + QStringList filters; + filters << "*.vst"; QDir tablesDir(pathToTables); - { - QStringList filters; - filters << "*.cpp"; - tablesDir.setNameFilters(filters); - } + tablesDir.setNameFilters(filters); + const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files); if (allFiles.isEmpty() == true) { @@ -131,6 +132,36 @@ void DialogStandardMeasurements::LoadStandardTables() for (int i = 0; i < allFiles.size(); ++i) { + QFile file(allFiles.at(i)); + if (file.open(QIODevice::ReadOnly)) + { + try + { + VDomDocument::ValidatePattern("://schema/standard_measurements.xsd", allFiles.at(i)); + } + catch(VException &e) + { + qWarning()<<"Validation file error."<comboBoxTables->addItem(m.Description(), QVariant(allFiles.at(i))); + } + catch(VException &e) + { + qWarning()<<"Parsing pattern file error."< +#include "../../container/vcontainer.h" namespace Ui { @@ -40,13 +41,14 @@ class DialogStandardMeasurements : public QDialog { Q_OBJECT public: - explicit DialogStandardMeasurements(QWidget *parent = nullptr); + explicit DialogStandardMeasurements(VContainer *data, QWidget *parent = nullptr); ~DialogStandardMeasurements(); QString name() const; QString tablePath() const; private: Q_DISABLE_COPY(DialogStandardMeasurements) Ui::DialogStandardMeasurements *ui; + VContainer *data; QString _name; QString _tablePath; void DialogAccepted(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 543875485..7aaf7cb80 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -120,7 +120,7 @@ void MainWindow::ActionNewDraw() measurements.exec(); if (measurements.type() == Measurements::Standard) { - DialogStandardMeasurements stMeasurements(this); + DialogStandardMeasurements stMeasurements(pattern, this); if (stMeasurements.exec() == QDialog::Accepted) { nameDraw = stMeasurements.name(); @@ -1381,107 +1381,91 @@ MainWindow::~MainWindow() void MainWindow::LoadPattern(const QString &fileName) { QFile file(fileName); - QString errorMsg; - qint64 errorLine = 0; - qint64 errorColumn = 0; if (file.open(QIODevice::ReadOnly)) { - if (VDomDocument::ValidatePattern("://schema/pattern.xsd", fileName, errorMsg, errorLine, errorColumn)) + try { - qint32 errorLine = 0; - qint32 errorColumn = 0; - if (doc->setContent(&file, &errorMsg, &errorLine, &errorColumn)) - { - disconnect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), - this, &MainWindow::currentDrawChanged); - try - { - #ifndef QT_NO_CURSOR - QApplication::setOverrideCursor(Qt::WaitCursor); - #endif - doc->Parse(Document::FullParse, sceneDraw, sceneDetails); - #ifndef QT_NO_CURSOR - QApplication::restoreOverrideCursor(); - #endif - ui->actionPattern_properties->setEnabled(true); - } - catch (const VExceptionObjectError &e) - { - e.CriticalMessageBox(tr("Error parsing file."), this); - file.close(); - Clear(); - return; - } - catch (const VExceptionConversionError &e) - { - e.CriticalMessageBox(tr("Error can't convert value."), this); - file.close(); - Clear(); - return; - } - catch (const VExceptionEmptyParameter &e) - { - e.CriticalMessageBox(tr("Error empty parameter."), this); - file.close(); - Clear(); - return; - } - catch (const VExceptionWrongId &e) - { - e.CriticalMessageBox(tr("Error wrong id."), this); - file.close(); - Clear(); - return; - } - connect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), - this, &MainWindow::currentDrawChanged); - QString nameDraw = doc->GetNameActivDraw(); - qint32 index = comboBoxDraws->findText(nameDraw); - if ( index != -1 ) - { // -1 for not found - comboBoxDraws->setCurrentIndex(index); - } - if (comboBoxDraws->count() > 0) - { - SetEnableTool(true); - } - else - { - SetEnableTool(false); - } - SetEnableWidgets(true); - } - else - { - QMessageBox msgBox(this); - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Parsing pattern file error.")); - msgBox.setInformativeText(errorMsg); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - QString error = QString(tr("Error in line %1 column %2")).arg(errorLine).arg(errorColumn); - msgBox.setDetailedText(error); - msgBox.exec(); - file.close(); - Clear(); - return; - } + VDomDocument::ValidatePattern("://schema/pattern.xsd", fileName); } - else + catch(VException &e) { - QMessageBox msgBox(this); - msgBox.setWindowTitle(tr("Error!")); - msgBox.setText(tr("Validation file error.")); - msgBox.setInformativeText(errorMsg); - msgBox.setStandardButtons(QMessageBox::Ok); - msgBox.setDefaultButton(QMessageBox::Ok); - QString error = QString(tr("Error in line %1 column %2")).arg(errorLine).arg(errorColumn); - msgBox.setDetailedText(error); - msgBox.exec(); + e.CriticalMessageBox(tr("Validation file error."), this); file.close(); Clear(); return; } + + try + { + doc->setContent(&file); + } + catch(VException &e) + { + e.CriticalMessageBox(tr("Parsing pattern file error."), this); + file.close(); + Clear(); + return; + } + + disconnect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), + this, &MainWindow::currentDrawChanged); + try + { + #ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(Qt::WaitCursor); + #endif + doc->Parse(Document::FullParse, sceneDraw, sceneDetails); + #ifndef QT_NO_CURSOR + QApplication::restoreOverrideCursor(); + #endif + ui->actionPattern_properties->setEnabled(true); + } + catch (const VExceptionObjectError &e) + { + e.CriticalMessageBox(tr("Error parsing file."), this); + file.close(); + Clear(); + return; + } + catch (const VExceptionConversionError &e) + { + e.CriticalMessageBox(tr("Error can't convert value."), this); + file.close(); + Clear(); + return; + } + catch (const VExceptionEmptyParameter &e) + { + e.CriticalMessageBox(tr("Error empty parameter."), this); + file.close(); + Clear(); + return; + } + catch (const VExceptionWrongId &e) + { + e.CriticalMessageBox(tr("Error wrong id."), this); + file.close(); + Clear(); + return; + } + connect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), + this, &MainWindow::currentDrawChanged); + QString nameDraw = doc->GetNameActivDraw(); + qint32 index = comboBoxDraws->findText(nameDraw); + if ( index != -1 ) + { // -1 for not found + comboBoxDraws->setCurrentIndex(index); + } + if (comboBoxDraws->count() > 0) + { + SetEnableTool(true); + } + else + { + SetEnableTool(false); + } + SetEnableWidgets(true); + file.close(); } else diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index ea9f94dee..bff6d5c19 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -244,22 +244,27 @@ QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVa return defVal; } -bool VDomDocument::ValidatePattern(const QString &schema, const QString &fileName, QString &errorMsg, qint64 &errorLine, - qint64 &errorColumn) +void VDomDocument::ValidatePattern(const QString &schema, const QString &fileName) { - errorLine = -1; - errorColumn = -1; + QString errorMsg; + qint64 errorLine = -1; + qint64 errorColumn = -1; + QFile pattern(fileName); if (pattern.open(QIODevice::ReadOnly) == false) { errorMsg = QString(tr("Can't open file %1:\n%2.").arg(fileName).arg(pattern.errorString())); - return false; + VException e(errorMsg); + e.AddMoreInformation(tr("Error in line %1 column %2").arg(errorLine).arg(errorColumn)); + throw e; } QFile fileSchema(schema); if (fileSchema.open(QIODevice::ReadOnly) == false) { errorMsg = QString(tr("Can't open schema file %1:\n%2.").arg(schema).arg(fileSchema.errorString())); - return false; + VException e(errorMsg); + e.AddMoreInformation(tr("Error in line %1 column %2").arg(errorLine).arg(errorColumn)); + throw e; } MessageHandler messageHandler; @@ -283,14 +288,23 @@ bool VDomDocument::ValidatePattern(const QString &schema, const QString &fileNam if (errorOccurred) { - errorMsg = messageHandler.statusMessage(); - errorLine = messageHandler.line(); - errorColumn = messageHandler.column(); - return false; + VException e(messageHandler.statusMessage()); + e.AddMoreInformation(tr("Error in line %1 column %2").arg(messageHandler.line()).arg(messageHandler.column())); + throw e; } - else + +} + +void VDomDocument::setContent(QIODevice *dev) +{ + QString errorMsg; + int errorLine = 0; + int errorColumn = 0; + if (QDomDocument::setContent(dev, &errorMsg, &errorLine, &errorColumn) == false) { - return true; + VException e(errorMsg); + e.AddMoreInformation(tr("Error in line %1 column %2").arg(errorLine).arg(errorColumn)); + throw e; } } diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index 3de21dc03..e4d645dee 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -114,8 +114,8 @@ public: * @param errorColumn number error column. * @return true if validation successful. */ - static bool ValidatePattern(const QString &schema, const QString &fileName, QString &errorMsg, qint64 &errorLine, - qint64 &errorColumn); + static void ValidatePattern(const QString &schema, const QString &fileName); + void setContent(QIODevice * dev); protected: /** * @brief data container with data. From 2cddab80d4ad9a6e484bdb49faeb3caed8b936de Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 14 Mar 2014 20:47:50 +0200 Subject: [PATCH 46/60] Delete parametr name and use last parameter in string list instead. --HG-- branch : feature --- src/tablewindow.cpp | 11 +++++------ src/tablewindow.h | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/tablewindow.cpp b/src/tablewindow.cpp index 06e23ce0e..af06035b1 100644 --- a/src/tablewindow.cpp +++ b/src/tablewindow.cpp @@ -499,7 +499,7 @@ void TableWindow::EpsFile(const QString &name) const QStringList params; params << "-eps" << tmp.fileName() << name; - PdfToPs(name, params); + PdfToPs(params); } } @@ -513,12 +513,11 @@ void TableWindow::PsFile(const QString &name) const QStringList params; params << tmp.fileName() << name; - PdfToPs(name, params); + PdfToPs(params); } } -//TODO delete parametr name and use last parameter in string list instead. -void TableWindow::PdfToPs(const QString &name, const QStringList ¶ms) const +void TableWindow::PdfToPs(const QStringList ¶ms) const { #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(Qt::WaitCursor); @@ -534,10 +533,10 @@ void TableWindow::PdfToPs(const QString &name, const QStringList ¶ms) const QApplication::restoreOverrideCursor(); #endif - QFile f(name); + QFile f(params.last()); if (f.exists() == false) { - QString msg = QString(tr("Creating file '%1' failed! %2")).arg(name).arg(proc.errorString()); + QString msg = QString(tr("Creating file '%1' failed! %2")).arg(params.last()).arg(proc.errorString()); QMessageBox msgBox(QMessageBox::Critical, tr("Critical error!"), msg, QMessageBox::Ok | QMessageBox::Default); msgBox.exec(); } diff --git a/src/tablewindow.h b/src/tablewindow.h index 026bda81d..2db91a8ff 100644 --- a/src/tablewindow.h +++ b/src/tablewindow.h @@ -225,11 +225,10 @@ private: void PsFile(const QString &name)const; /** * @brief PdfToPs use external tool "pdftops" for converting pdf too eps or ps format. - * @param name name output file. * @param params string with parameter for tool. Parameters have format: "-eps input_file out_file". Use -eps when * need create eps file. */ - void PdfToPs(const QString &name, const QStringList ¶ms)const; + void PdfToPs(const QStringList ¶ms)const; }; #endif // TABLEWINDOW_H From a950a9f59bbc68d328595247794ed9832cf360dd Mon Sep 17 00:00:00 2001 From: dismine Date: Sat, 15 Mar 2014 22:51:12 +0200 Subject: [PATCH 47/60] Choose individual measurements. --HG-- branch : feature --- .../app/dialogindividualmeasurements.cpp | 151 +++++++++++++++++- .../app/dialogindividualmeasurements.h | 7 +- .../app/dialogindividualmeasurements.ui | 3 + src/mainwindow.cpp | 2 +- 4 files changed, 158 insertions(+), 5 deletions(-) diff --git a/src/dialogs/app/dialogindividualmeasurements.cpp b/src/dialogs/app/dialogindividualmeasurements.cpp index 586d588b3..68720b6eb 100644 --- a/src/dialogs/app/dialogindividualmeasurements.cpp +++ b/src/dialogs/app/dialogindividualmeasurements.cpp @@ -29,9 +29,13 @@ #include "dialogindividualmeasurements.h" #include "ui_dialogindividualmeasurements.h" #include +#include "../../xml/vindividualmeasurements.h" +#include +#include +#include -DialogIndividualMeasurements::DialogIndividualMeasurements(QWidget *parent) : - QDialog(parent), ui(new Ui::DialogIndividualMeasurements), _name(QString()), _tablePath(QString()) +DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, QWidget *parent) : + QDialog(parent), ui(new Ui::DialogIndividualMeasurements), _name(QString()), _tablePath(QString()), data(data) { ui->setupUi(this); @@ -46,10 +50,14 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(QWidget *parent) : connect(bCansel, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogRejected); } + LoadIndividualTables(); + CheckState(); connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogIndividualMeasurements::CheckState); connect(ui->buttonGroupPath, static_cast(&QButtonGroup::buttonClicked), this, &DialogIndividualMeasurements::CheckState); + connect(ui->toolButtonOpenExist, &QToolButton::clicked, this, &DialogIndividualMeasurements::OpenTable); + connect(ui->toolButtonOpenNew, &QToolButton::clicked, this, &DialogIndividualMeasurements::NewTable); } DialogIndividualMeasurements::~DialogIndividualMeasurements() @@ -67,6 +75,20 @@ void DialogIndividualMeasurements::DialogAccepted() else { _tablePath = ui->lineEditPathNewM->text(); + QFile table(_tablePath); + if (table.exists()) + { + table.remove(); + } + + const qint32 index = ui->comboBoxLang->currentIndex(); + QString path = ui->comboBoxLang->itemData(index).toString(); + QFile iMeasur(path); + if ( iMeasur.copy(_tablePath) == false ) + { + QMessageBox::warning(this, tr("Could not create measurements file"), tr("Please try again or change file")); + return; + } } accept(); } @@ -94,18 +116,141 @@ void DialogIndividualMeasurements::CheckState() ui->lineEditPathNewM->setEnabled(false); ui->toolButtonOpenNew->setEnabled(false); + ui->comboBoxLang->setEditable(false); + + if (ui->lineEditPathExistM->text().isEmpty() == false) + { + flagPath = true; + } } else { ui->lineEditPathNewM->setEnabled(true); ui->toolButtonOpenNew->setEnabled(true); + ui->comboBoxLang->setEditable(true); ui->toolButtonOpenExist->setEnabled(false); ui->lineEditPathExistM->setEnabled(false); + if (ui->lineEditPathNewM->text().isEmpty() == false) + { + flagPath = true; + } + } + + bool flagLang = false; + { + const QComboBox *box = ui->comboBoxLang; + Q_CHECK_PTR(box); + if (box->count() > 0 && box->currentIndex() != -1) + { + flagLang = true; + } } QPushButton *bOk = ui->buttonBox->button(QDialogButtonBox::Ok); Q_CHECK_PTR(bOk); - bOk->setEnabled(flagName && flagPath); + bOk->setEnabled(flagName && flagPath && flagLang); +} + +void DialogIndividualMeasurements::LoadIndividualTables() +{ +#ifdef Q_OS_WIN + const QString pathToTables = QString("/tables/individual"); +#else + #ifdef QT_DEBUG + const QString pathToTables = QString("/tables/individual"); + #else + const QString pathToTables = QString("/usr/share/valentina/tables/individual"); + #endif +#endif + QStringList filters; + filters << "*.vit"; + QDir tablesDir(pathToTables); + tablesDir.setNameFilters(filters); + + const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files); + if (allFiles.isEmpty() == true) + { + ui->comboBoxLang->clear(); + CheckState(); + return; + } + + for (int i = 0; i < allFiles.size(); ++i) + { + QFile file(allFiles.at(i)); + if (file.open(QIODevice::ReadOnly)) + { + try + { + VDomDocument::ValidatePattern("://schema/standard_measurements.xsd", allFiles.at(i)); + } + catch(VException &e) + { + qWarning()<<"Validation file error."<comboBoxLang->addItem(lang, QVariant(allFiles.at(i))); + } + catch(VException &e) + { + qWarning()<<"Parsing pattern file error."<comboBoxLang->findData(checkedLocale); + if (index != -1) + { + ui->comboBoxLang->setCurrentIndex(index); + } +} + +void DialogIndividualMeasurements::OpenTable() +{ + const QString filter(tr("Individual measurements (*.vit)")); + const QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter); + ui->lineEditPathExistM->setText(fileName); + CheckState(); +} + +void DialogIndividualMeasurements::NewTable() +{ + QString name = QFileDialog::getSaveFileName(this, tr("Where save measurements?"), QDir::homePath(), + tr("Individual measurements (*.vit)")); + + if (name.isEmpty()) + { + return; + } + + // what if the users did not specify a suffix...? + QFileInfo f( name ); + if (f.suffix().isEmpty() && f.suffix() != "vit") + { + name += ".vit"; + } + ui->lineEditPathNewM->setText(name); + CheckState(); } diff --git a/src/dialogs/app/dialogindividualmeasurements.h b/src/dialogs/app/dialogindividualmeasurements.h index 1c97d264e..296f5ccc7 100644 --- a/src/dialogs/app/dialogindividualmeasurements.h +++ b/src/dialogs/app/dialogindividualmeasurements.h @@ -30,6 +30,7 @@ #define DIALOGINDIVIDUALMEASUREMENTS_H #include +#include "../../container/vcontainer.h" namespace Ui { @@ -41,7 +42,7 @@ class DialogIndividualMeasurements : public QDialog Q_OBJECT public: - explicit DialogIndividualMeasurements(QWidget *parent = nullptr); + explicit DialogIndividualMeasurements(VContainer *data, QWidget *parent = nullptr); ~DialogIndividualMeasurements(); QString name() const; QString tablePath() const; @@ -50,9 +51,13 @@ private: Ui::DialogIndividualMeasurements *ui; QString _name; QString _tablePath; + VContainer *data; void DialogAccepted(); void DialogRejected(); void CheckState(); + void LoadIndividualTables(); + void OpenTable(); + void NewTable(); }; inline QString DialogIndividualMeasurements::name() const diff --git a/src/dialogs/app/dialogindividualmeasurements.ui b/src/dialogs/app/dialogindividualmeasurements.ui index f82c642cc..e711d4540 100644 --- a/src/dialogs/app/dialogindividualmeasurements.ui +++ b/src/dialogs/app/dialogindividualmeasurements.ui @@ -81,6 +81,9 @@ + + + diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7aaf7cb80..3ad0cae19 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -132,7 +132,7 @@ void MainWindow::ActionNewDraw() } else { - DialogIndividualMeasurements indMeasurements(this); + DialogIndividualMeasurements indMeasurements(pattern, this); if (indMeasurements.exec() == QDialog::Accepted) { nameDraw = indMeasurements.name(); From 61c4d8df0cb6a8850b4da6b819cda19e7df1040c Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 16 Mar 2014 08:32:52 +0200 Subject: [PATCH 48/60] Get measurements units. --HG-- branch : feature --- .../app/dialogindividualmeasurements.cpp | 49 +++++++++++++++++-- .../app/dialogindividualmeasurements.h | 2 +- .../app/dialogstandardmeasurements.cpp | 48 ++++++++++++++++-- src/dialogs/app/dialogstandardmeasurements.h | 2 +- src/mainwindow.cpp | 29 ++++++----- src/xml/vdomdocument.h | 28 +++++++++++ src/xml/vpattern.cpp | 48 +++++++++++------- src/xml/vpattern.h | 4 +- 8 files changed, 169 insertions(+), 41 deletions(-) diff --git a/src/dialogs/app/dialogindividualmeasurements.cpp b/src/dialogs/app/dialogindividualmeasurements.cpp index 68720b6eb..8da793595 100644 --- a/src/dialogs/app/dialogindividualmeasurements.cpp +++ b/src/dialogs/app/dialogindividualmeasurements.cpp @@ -34,8 +34,10 @@ #include #include -DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, QWidget *parent) : - QDialog(parent), ui(new Ui::DialogIndividualMeasurements), _name(QString()), _tablePath(QString()), data(data) +DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, const QString &patternPieceName, + QWidget *parent) : + QDialog(parent), ui(new Ui::DialogIndividualMeasurements), _name(patternPieceName), _tablePath(QString()), + data(data) { ui->setupUi(this); @@ -50,6 +52,8 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, QWi connect(bCansel, &QPushButton::clicked, this, &DialogIndividualMeasurements::DialogRejected); } + ui->lineEditName->setText(_name); + LoadIndividualTables(); CheckState(); @@ -90,13 +94,50 @@ void DialogIndividualMeasurements::DialogAccepted() return; } } + QFile file(_tablePath); + if (file.open(QIODevice::ReadOnly)) + { + try + { + VDomDocument::ValidatePattern("://schema/standard_measurements.xsd", _tablePath); + } + catch(VException &e) + { + e.CriticalMessageBox(tr("Validation file error."), this); + qWarning()<<"Validation file error."< #include "../../xml/vstandardmeasurements.h" -DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, QWidget *parent) : - QDialog(parent), ui(new Ui::DialogStandardMeasurements), data(data), _name(QString()), _tablePath(QString()) +DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const QString &patternPieceName, + QWidget *parent) : + QDialog(parent), ui(new Ui::DialogStandardMeasurements), data(data), _name(patternPieceName), _tablePath(QString()) { ui->setupUi(this); @@ -47,6 +48,8 @@ DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, QWidget connect(bCansel, &QPushButton::clicked, this, &DialogStandardMeasurements::DialogRejected); } + ui->lineEditName->setText(_name); + LoadStandardTables(); CheckState(); @@ -73,13 +76,50 @@ void DialogStandardMeasurements::DialogAccepted() _name = ui->lineEditName->text(); const qint32 index = ui->comboBoxTables->currentIndex(); _tablePath = ui->comboBoxTables->itemData(index).toString(); + QFile file(_tablePath); + if (file.open(QIODevice::ReadOnly)) + { + try + { + VDomDocument::ValidatePattern("://schema/standard_measurements.xsd", _tablePath); + } + catch(VException &e) + { + e.CriticalMessageBox(tr("Validation file error."), this); + qWarning()<<"Validation file error."<CreateEmptyFile(); connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified); InitAutoSave(); @@ -113,17 +112,20 @@ MainWindow::MainWindow(QWidget *parent) void MainWindow::ActionNewDraw() { - QString nameDraw; + QString patternPieceName = QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1); if (comboBoxDraws->count() == 0) { + QString path; DialogMeasurements measurements(this); measurements.exec(); if (measurements.type() == Measurements::Standard) { - DialogStandardMeasurements stMeasurements(pattern, this); + patternType == Pattern::Standard; + DialogStandardMeasurements stMeasurements(pattern, patternPieceName, this); if (stMeasurements.exec() == QDialog::Accepted) { - nameDraw = stMeasurements.name(); + patternPieceName = stMeasurements.name(); + path = stMeasurements.tablePath(); } else { @@ -132,33 +134,36 @@ void MainWindow::ActionNewDraw() } else { - DialogIndividualMeasurements indMeasurements(pattern, this); + patternType == Pattern::Individual; + DialogIndividualMeasurements indMeasurements(pattern, patternPieceName, this); if (indMeasurements.exec() == QDialog::Accepted) { - nameDraw = indMeasurements.name(); + patternPieceName = indMeasurements.name(); + path = indMeasurements.tablePath(); } else { return; } } + doc->CreateEmptyFile(path); } else { - nameDraw = PatternPieceName(QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1)); - if (nameDraw.isEmpty()) + patternPieceName = PatternPieceName(patternPieceName); + if (patternPieceName.isEmpty()) { return; } } - if (doc->appendDraw(nameDraw) == false) + if (doc->appendDraw(patternPieceName) == false) { - qWarning()<(&QComboBox::currentIndexChanged), this, &MainWindow::currentDrawChanged); - comboBoxDraws->addItem(nameDraw); + comboBoxDraws->addItem(patternPieceName); pattern->ClearGObjects(); //Create single point @@ -175,7 +180,7 @@ void MainWindow::ActionNewDraw() SetEnableTool(true); SetEnableWidgets(true); - const qint32 index = comboBoxDraws->findText(nameDraw); + const qint32 index = comboBoxDraws->findText(patternPieceName); if ( index != -1 ) { // -1 for not found comboBoxDraws->setCurrentIndex(index); diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index e4d645dee..bfe95376c 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -144,6 +144,34 @@ inline void VDomDocument::SetAttribute(QDomElement &domElement, const Q domElement.setAttribute(name, value); } +template <> +inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, + const Pattern::Measurements &value) +{ + if (value == Pattern::Standard) + { + domElement.setAttribute(name, "standard"); + } + else + { + domElement.setAttribute(name, "individual"); + } +} + +template <> +inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, + const Valentina::Units &value) +{ + if (value == Valentina::Cm || value == Valentina::Mm) + { + domElement.setAttribute(name, "cm"); + } + else + { + domElement.setAttribute(name, "in"); + } +} + #ifdef Q_CC_GNU #pragma GCC diagnostic pop #endif diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index b3f763291..5305c8ce0 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -38,24 +38,25 @@ #include -const QString VPattern::TagPattern = QStringLiteral("pattern"); -const QString VPattern::TagCalculation = QStringLiteral("calculation"); -const QString VPattern::TagModeling = QStringLiteral("modeling"); -const QString VPattern::TagDetails = QStringLiteral("details"); -const QString VPattern::TagAuthor = QStringLiteral("author"); -const QString VPattern::TagDescription = QStringLiteral("description"); -const QString VPattern::TagNotes = QStringLiteral("notes"); -const QString VPattern::TagIncrements = QStringLiteral("increments"); -const QString VPattern::TagIncrement = QStringLiteral("increment"); -const QString VPattern::TagDraw = QStringLiteral("draw"); -const QString VPattern::TagPoint = QStringLiteral("point"); -const QString VPattern::TagLine = QStringLiteral("line"); -const QString VPattern::TagSpline = QStringLiteral("spline"); -const QString VPattern::TagArc = QStringLiteral("arc"); -const QString VPattern::TagTools = QStringLiteral("tools"); +const QString VPattern::TagPattern = QStringLiteral("pattern"); +const QString VPattern::TagCalculation = QStringLiteral("calculation"); +const QString VPattern::TagModeling = QStringLiteral("modeling"); +const QString VPattern::TagDetails = QStringLiteral("details"); +const QString VPattern::TagAuthor = QStringLiteral("author"); +const QString VPattern::TagDescription = QStringLiteral("description"); +const QString VPattern::TagNotes = QStringLiteral("notes"); +const QString VPattern::TagMeasurements = QStringLiteral("measurements"); +const QString VPattern::TagIncrements = QStringLiteral("increments"); +const QString VPattern::TagIncrement = QStringLiteral("increment"); +const QString VPattern::TagDraw = QStringLiteral("draw"); +const QString VPattern::TagPoint = QStringLiteral("point"); +const QString VPattern::TagLine = QStringLiteral("line"); +const QString VPattern::TagSpline = QStringLiteral("spline"); +const QString VPattern::TagArc = QStringLiteral("arc"); +const QString VPattern::TagTools = QStringLiteral("tools"); -const QString VPattern::AttrName = QStringLiteral("name"); -const QString VPattern::AttrType = QStringLiteral("type"); +const QString VPattern::AttrName = QStringLiteral("name"); +const QString VPattern::AttrType = QStringLiteral("type"); const QString VPattern::IncrementName = QStringLiteral("name"); const QString VPattern::IncrementBase = QStringLiteral("base"); @@ -69,14 +70,25 @@ VPattern::VPattern(VContainer *data, QComboBox *comboBoxDraws, Valentina::Draws { } -void VPattern::CreateEmptyFile() +void VPattern::CreateEmptyFile(const QString &tablePath) { + if (tablePath.isEmpty()) + { + throw VException("Path to measurement table empty."); + } QDomElement patternElement = this->createElement(TagPattern); patternElement.appendChild(createComment("Valentina pattern format.")); patternElement.appendChild(createElement(TagAuthor)); patternElement.appendChild(createElement(TagDescription)); patternElement.appendChild(createElement(TagNotes)); + + QDomElement measurements = createElement(TagMeasurements); + SetAttribute(measurements, "unit", patternUnit); + SetAttribute(measurements, "type", patternType); + SetAttribute(measurements, "path", tablePath); + patternElement.appendChild(measurements); + patternElement.appendChild(createElement(TagIncrements)); this->appendChild(patternElement); diff --git a/src/xml/vpattern.h b/src/xml/vpattern.h index 102e53c0a..d51f6cd16 100644 --- a/src/xml/vpattern.h +++ b/src/xml/vpattern.h @@ -55,8 +55,9 @@ public: VPattern(VContainer *data, QComboBox *comboBoxDraws, Valentina::Draws *mode, QObject *parent = nullptr); /** * @brief CreateEmptyFile create minimal empty file. + * @param tablePath */ - void CreateEmptyFile(); + void CreateEmptyFile(const QString &tablePath); /** * @brief ChangeActivDraw set new pattern peace name. * @param name new name. @@ -171,6 +172,7 @@ public: static const QString TagAuthor; static const QString TagDescription; static const QString TagNotes; + static const QString TagMeasurements; static const QString TagIncrements; static const QString TagIncrement; static const QString TagDraw; From 5b36420466e1e4f541b57ec387ac76f987fb171d Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 16 Mar 2014 15:17:39 +0200 Subject: [PATCH 49/60] Hide size and height option in individual mode. --HG-- branch : feature --- src/container/vcontainer.cpp | 14 ++++++------- src/container/vcontainer.h | 24 +++++++++++----------- src/dialogs/app/dialogincrements.cpp | 2 +- src/dialogs/tools/dialogpointofcontact.cpp | 14 ++++++++++--- src/dialogs/tools/dialogtool.cpp | 6 +++--- src/dialogs/tools/dialogtool.h | 18 +++++++++++----- 6 files changed, 47 insertions(+), 31 deletions(-) diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index e6219cc78..b56a56528 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -35,7 +35,7 @@ quint32 VContainer::_id = 0; VContainer::VContainer() :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash()), - standardTable(QHash()), incrementTable(QHash()), + measurements(QHash()), incrementTable(QHash()), lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()), lengthArcs(QHash()), details(QHash()) { @@ -49,7 +49,7 @@ VContainer &VContainer::operator =(const VContainer &data) VContainer::VContainer(const VContainer &data) :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash()), - standardTable(QHash()), incrementTable(QHash()), + measurements(QHash()), incrementTable(QHash()), lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()), lengthArcs(QHash()), details(QHash()) { @@ -103,7 +103,7 @@ void VContainer::setData(const VContainer &data) qWarning()<<"Don't know how copy this type."; } } - standardTable = *data.DataStandardTable(); + measurements = *data.DataMeasurements(); incrementTable = *data.DataIncrementTable(); lengthLines = *data.DataLengthLines(); lineAngles = *data.DataLineAngles(); @@ -146,7 +146,7 @@ val VContainer::GetVariable(const QHash &obj, key id) const const VMeasurement VContainer::GetMeasurement(const QString &name) const { Q_ASSERT(name.isEmpty()==false); - return GetVariable(standardTable, name); + return GetVariable(measurements, name); } const VIncrementTableRow VContainer::GetIncrementTableRow(const QString& name) const @@ -250,7 +250,7 @@ void VContainer::AddLineAngle(const QString &name, const qreal &value) qreal VContainer::GetValueStandardTableRow(const QString& name) const { - const VMeasurement m = GetMeasurement(name); + const VMeasurement m = GetMeasurement(name); if (patternType == Pattern::Individual) { return m.GetValue(); @@ -273,7 +273,7 @@ qreal VContainer::GetValueIncrementTableRow(const QString& name) const void VContainer::Clear() { _id = 0; - standardTable.clear(); + measurements.clear(); incrementTable.clear(); lengthLines.clear(); lengthArcs.clear(); @@ -321,7 +321,7 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const *ok = true; return _height; } - if (standardTable.contains(name)) + if (measurements.contains(name)) { *ok = true; return GetValueStandardTableRow(name); diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index 0550c0a45..3609408c1 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -248,9 +248,9 @@ public: */ void UpdateIncrementTableRow(const QString& name, VIncrementTableRow row); /** - * @brief GetValueStandardTableCell return value of standard table row by name - * @param name name of row - * @return value in mm + * @brief GetValueStandardTableRow return value of measurement by name + * @param name name of measurement + * @return value in measurement units */ qreal GetValueStandardTableRow(const QString& name) const; /** @@ -342,10 +342,10 @@ public: */ const QHash *DataGObjects() const; /** - * @brief data container with dataStandardTable return container of standard table - * @return pointer on container of standard table + * @brief DataMeasurements container with measurements. + * @return pointer to measurements. */ - const QHash *DataStandardTable() const; + const QHash *DataMeasurements() const; /** * @brief data container with dataIncrementTable return container of increment table * @return pointer on container of increment table @@ -395,9 +395,9 @@ private: */ QHash gObjects; /** - * @brief standardTable container of standard table rows + * @brief measurements container of measurements. */ - QHash standardTable; + QHash measurements; /** * @brief incrementTable */ @@ -460,12 +460,12 @@ private: inline void VContainer::AddMeasurement(const QString &name, const VMeasurement &m) { - standardTable[name] = m; + measurements[name] = m; } inline void VContainer::UpdateMeasurement(const QString &name, VMeasurement m) { - standardTable[name] = m; + measurements[name] = m; } inline void VContainer::UpdateIncrementTableRow(const QString &name, VIncrementTableRow row) @@ -558,9 +558,9 @@ inline const QHash *VContainer::DataGObjects() const return &gObjects; } -inline const QHash *VContainer::DataStandardTable() const +inline const QHash *VContainer::DataMeasurements() const { - return &standardTable; + return &measurements; } inline const QHash *VContainer::DataIncrementTable() const diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index 2fa67fc92..af95d1807 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -64,7 +64,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par void DialogIncrements::FillStandardTable() { - const QHash *standardTable = data->DataStandardTable(); + const QHash *standardTable = data->DataMeasurements(); qint32 currentRow = -1; QHashIterator i(*standardTable); ui->tableWidgetStandard->setRowCount ( standardTable->size() ); diff --git a/src/dialogs/tools/dialogpointofcontact.cpp b/src/dialogs/tools/dialogpointofcontact.cpp index 0ff100e3d..44d1b2512 100644 --- a/src/dialogs/tools/dialogpointofcontact.cpp +++ b/src/dialogs/tools/dialogpointofcontact.cpp @@ -67,9 +67,17 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare connect(ui.listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal); connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogPointOfContact::ValChenged); - SizeHeight(); - connect(ui.radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogPointOfContact::SizeHeight); - connect(ui.radioButtonStandardTable, &QRadioButton::clicked, this, &DialogPointOfContact::StandardTable); + if (patternType == Pattern::Standard) + { + SizeHeight(); + connect(ui.radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); + } + else + { + radioButtonSizeGrowth->setVisible(false); + Measurements(); + } + connect(ui.radioButtonStandardTable, &QRadioButton::clicked, this, &DialogPointOfContact::Measurements); connect(ui.radioButtonIncrements, &QRadioButton::clicked, this, &DialogPointOfContact::Increments); connect(ui.radioButtonLengthLine, &QRadioButton::clicked, this, &DialogPointOfContact::LengthLines); connect(ui.radioButtonLengthArc, &QRadioButton::clicked, this, &DialogPointOfContact::LengthArcs); diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index 378508674..6c0ee1405 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -544,9 +544,9 @@ void DialogTool::SizeHeight() listWidget->setCurrentRow (0); } -void DialogTool::StandardTable() +void DialogTool::Measurements() { - ShowVariable(data->DataStandardTable()); + ShowVariable(data->DataMeasurements()); } void DialogTool::LengthLines() @@ -668,7 +668,7 @@ void DialogTool::UpdateList() } if (radioButtonStandardTable->isChecked()) { - ShowVariable(data->DataStandardTable()); + ShowVariable(data->DataMeasurements()); } if (radioButtonIncrements->isChecked()) { diff --git a/src/dialogs/tools/dialogtool.h b/src/dialogs/tools/dialogtool.h index 054fcb015..cc8d03a7e 100644 --- a/src/dialogs/tools/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -141,9 +141,9 @@ public slots: */ void SizeHeight(); /** - * @brief StandardTable show in list standard table variables + * @brief Measurements show in list measurements */ - void StandardTable(); + void Measurements(); /** * @brief LengthLines show in list lengths of lines variables */ @@ -428,9 +428,17 @@ protected: connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); - SizeHeight(); - connect(radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); - connect(radioButtonStandardTable, &QRadioButton::clicked, this, &DialogTool::StandardTable); + if (patternType == Pattern::Standard) + { + SizeHeight(); + connect(radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); + } + else + { + radioButtonSizeGrowth->setVisible(false); + Measurements(); + } + connect(radioButtonStandardTable, &QRadioButton::clicked, this, &DialogTool::Measurements); connect(radioButtonIncrements, &QRadioButton::clicked, this, &DialogTool::Increments); connect(radioButtonLengthLine, &QRadioButton::clicked, this, &DialogTool::LengthLines); connect(radioButtonLengthArc, &QRadioButton::clicked, this, &DialogTool::LengthArcs); From 9584192ec76ee362d22544d41764fcbe501eb5a0 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 16 Mar 2014 16:17:07 +0200 Subject: [PATCH 50/60] Make install section for measurements. Copy to bin directory measurements. --HG-- branch : feature --- Valentina.pro | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/Valentina.pro b/Valentina.pro index 9f3855da4..c6ba0d871 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -131,6 +131,10 @@ INSTALL_TRANSLATIONS += share/translations/valentina_ru.qm \ share/translations/valentina_he_IL.qm \ share/translations/valentina_fr.qm +INSTALL_STANDARD_MEASHUREMENTS += share/tables/standard/GOST_man_ru.vst + +INSTALL_INDIVIDUAL_MEASHUREMENTS += share/tables/individual/indivindual_ru.vit + unix { #VARIABLES isEmpty(PREFIX) { @@ -147,10 +151,16 @@ pixmaps.path = $$DATADIR/pixmaps/ pixmaps.files += dist/$${TARGET}.png translations.path = $$DATADIR/$${TARGET}/translations/ translations.files = $$INSTALL_TRANSLATIONS +standard.path = $$DATADIR/$${TARGET}/tables/standard/ +standard.files = $$INSTALL_STANDARD_MEASHUREMENTS +individual.path = $$DATADIR/$${TARGET}/tables/individual/ +individual.files = $$INSTALL_INDIVIDUAL_MEASHUREMENTS INSTALLS += target \ desktop \ pixmaps \ - translations + translations \ + standard \ + individual } !isEmpty(TRANSLATIONS): { @@ -187,3 +197,19 @@ for(DIR, INSTALL_TRANSLATIONS) { } copyToDestdir($$tr_path, $$shell_path($$OUT_PWD/$$DESTDIR/translations)) + +for(DIR, INSTALL_STANDARD_MEASHUREMENTS) { + #add these absolute paths to a variable which + #ends up as 'mkcommands = path1 path2 path3 ...' + st_path += $$PWD/$$DIR +} + +copyToDestdir($$st_path, $$shell_path($$OUT_PWD/$$DESTDIR/tables/standard)) + +for(DIR, INSTALL_INDIVIDUAL_MEASHUREMENTS) { + #add these absolute paths to a variable which + #ends up as 'mkcommands = path1 path2 path3 ...' + ind_path += $$PWD/$$DIR +} + +copyToDestdir($$ind_path, $$shell_path($$OUT_PWD/$$DESTDIR/tables/individual)) From f641894abdc2f0f61ac5b31722cd88b391557007 Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 17 Mar 2014 20:13:39 +0200 Subject: [PATCH 51/60] Refactoring dialog increment. --HG-- branch : feature --- src/dialogs/app/dialogincrements.cpp | 12 +-- src/dialogs/app/dialogincrements.h | 4 +- src/dialogs/app/dialogincrements.ui | 114 ++++++++++++++++++++++++--- 3 files changed, 112 insertions(+), 18 deletions(-) diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index af95d1807..11659bf90 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -45,7 +45,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate); - FillStandardTable(); + FillMeasurements(); FillIncrementTable(); FillLengthLines(); FillLengthSplines(); @@ -62,12 +62,12 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par ui->tabWidget->setCurrentIndex(0); } -void DialogIncrements::FillStandardTable() +void DialogIncrements::FillMeasurements() { - const QHash *standardTable = data->DataMeasurements(); + const QHash *table = data->DataMeasurements(); qint32 currentRow = -1; - QHashIterator i(*standardTable); - ui->tableWidgetStandard->setRowCount ( standardTable->size() ); + QHashIterator i(*table); + ui->tableWidgetStandard->setRowCount ( table->size() ); while (i.hasNext()) { i.next(); @@ -276,7 +276,7 @@ void DialogIncrements::FullUpdateFromFile() &DialogIncrements::cellChanged); ui->tableWidgetStandard->clearContents(); - FillStandardTable(); + FillMeasurements(); ui->tableWidgetIncrement->clearContents(); FillIncrementTable(); diff --git a/src/dialogs/app/dialogincrements.h b/src/dialogs/app/dialogincrements.h index 7ea4841a4..e78120b3c 100644 --- a/src/dialogs/app/dialogincrements.h +++ b/src/dialogs/app/dialogincrements.h @@ -105,9 +105,9 @@ private: */ qint32 column; /** - * @brief FillStandardTable fill data for standard table + * @brief FillMeasurements load measurements data */ - void FillStandardTable(); + void FillMeasurements(); /** * @brief FillIncrementTable fill data for increment table */ diff --git a/src/dialogs/app/dialogincrements.ui b/src/dialogs/app/dialogincrements.ui index a6ad81fab..4ae845d75 100644 --- a/src/dialogs/app/dialogincrements.ui +++ b/src/dialogs/app/dialogincrements.ui @@ -7,7 +7,7 @@ 0 0 897 - 422 + 566 @@ -20,7 +20,7 @@ Increments - + :/icon/64x64/icon64x64.png:/icon/64x64/icon64x64.png @@ -39,14 +39,109 @@ QTabWidget::North - 1 + 0 - Sizes table + Measurements - - + + + + + + + Load another measurements table + + + + + + + ... + + + + + + + + + + + + + + Family name + + + + + + + + + + + + + + + 84 + 0 + + + + Given name + + + + + + + + + + + + + + + 84 + 0 + + + + Birth date + + + + + + + + + + + + + + + 84 + 0 + + + + Sex + + + + + + + + + true @@ -112,7 +207,7 @@ - In growths + In heights @@ -192,7 +287,7 @@ - In growths + In heights @@ -353,7 +448,6 @@ - tabWidget tableWidgetStandard tableWidgetIncrement toolButtonAdd @@ -363,7 +457,7 @@ tableWidgetArcs - + From fa06c04cd23c167d08f197298f986e56bc2b04af Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 19 Mar 2014 20:27:11 +0200 Subject: [PATCH 52/60] Refactoring. Delete global variables. --HG-- branch : feature --- src/container/container.pri | 8 +- src/container/vcontainer.cpp | 39 +++-- src/container/vcontainer.h | 38 ++--- ...{vincrementtablerow.cpp => vincrement.cpp} | 22 ++- .../{vincrementtablerow.h => vincrement.h} | 45 ++--- src/container/vmeasurement.cpp | 4 +- src/dialogs/app/dialogincrements.cpp | 159 +++++++++++------- src/dialogs/app/dialogincrements.h | 5 +- src/dialogs/app/dialogincrements.ui | 24 +-- .../app/dialogindividualmeasurements.cpp | 14 +- .../app/dialogstandardmeasurements.cpp | 14 +- src/dialogs/app/pages.cpp | 3 +- src/dialogs/tools/dialogdetail.cpp | 12 +- src/dialogs/tools/dialogpointofcontact.cpp | 2 +- src/dialogs/tools/dialogsinglepoint.cpp | 18 +- src/dialogs/tools/dialogtool.cpp | 8 +- src/dialogs/tools/dialogtool.h | 3 +- src/geometry/vequidistant.cpp | 7 +- src/main.cpp | 20 +-- src/mainwindow.cpp | 10 +- src/options.h | 48 +----- src/stable.h | 1 - src/tablewindow.cpp | 52 +++--- src/tools/drawTools/vabstractspline.cpp | 6 +- src/tools/drawTools/vdrawtool.h | 2 +- src/tools/drawTools/vtoolalongline.cpp | 10 +- src/tools/drawTools/vtoolarc.cpp | 12 +- src/tools/drawTools/vtoolbisector.cpp | 10 +- src/tools/drawTools/vtoolcutarc.cpp | 14 +- src/tools/drawTools/vtoolcutspline.cpp | 18 +- src/tools/drawTools/vtoolcutsplinepath.cpp | 18 +- src/tools/drawTools/vtoolendline.cpp | 10 +- src/tools/drawTools/vtoolheight.cpp | 8 +- src/tools/drawTools/vtoolline.cpp | 10 +- src/tools/drawTools/vtoollineintersect.cpp | 8 +- src/tools/drawTools/vtoollinepoint.cpp | 6 +- src/tools/drawTools/vtoolnormal.cpp | 10 +- src/tools/drawTools/vtoolpoint.cpp | 22 +-- src/tools/drawTools/vtoolpointofcontact.cpp | 10 +- .../drawTools/vtoolpointofintersection.cpp | 8 +- src/tools/drawTools/vtoolshoulderpoint.cpp | 10 +- src/tools/drawTools/vtoolsinglepoint.cpp | 26 +-- src/tools/drawTools/vtoolspline.cpp | 8 +- src/tools/drawTools/vtoolsplinepath.cpp | 8 +- src/tools/drawTools/vtooltriangle.cpp | 8 +- src/tools/nodeDetails/vnodearc.cpp | 7 +- src/tools/nodeDetails/vnodepoint.cpp | 23 +-- src/tools/nodeDetails/vnodespline.cpp | 7 +- src/tools/nodeDetails/vnodesplinepath.cpp | 7 +- src/tools/vtooldetail.cpp | 12 +- src/tools/vtooluniondetails.cpp | 8 +- src/widgets/vapplication.cpp | 90 +++++++++- src/widgets/vapplication.h | 43 ++++- src/widgets/vcontrolpointspline.cpp | 15 +- src/widgets/vitem.cpp | 8 +- src/widgets/vsimplearc.cpp | 13 +- src/widgets/vsimplespline.cpp | 16 +- src/widgets/vsimplesplinepath.cpp | 5 +- src/xml/vpattern.cpp | 78 ++++----- 59 files changed, 626 insertions(+), 504 deletions(-) rename src/container/{vincrementtablerow.cpp => vincrement.cpp} (68%) rename src/container/{vincrementtablerow.h => vincrement.h} (76%) diff --git a/src/container/container.pri b/src/container/container.pri index bbc26547b..fcd3ba862 100644 --- a/src/container/container.pri +++ b/src/container/container.pri @@ -1,11 +1,11 @@ SOURCES += \ - src/container/vincrementtablerow.cpp \ src/container/vcontainer.cpp \ src/container/calculator.cpp \ - src/container/vmeasurement.cpp + src/container/vmeasurement.cpp \ + src/container/vincrement.cpp HEADERS += \ - src/container/vincrementtablerow.h \ src/container/vcontainer.h \ src/container/calculator.h \ - src/container/vmeasurement.h + src/container/vmeasurement.h \ + src/container/vincrement.h diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index b56a56528..9f3209a21 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -30,12 +30,13 @@ #include #include +#include "../widgets/vapplication.h" quint32 VContainer::_id = 0; VContainer::VContainer() :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash()), - measurements(QHash()), incrementTable(QHash()), + measurements(QHash()), increments(QHash()), lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()), lengthArcs(QHash()), details(QHash()) { @@ -49,7 +50,7 @@ VContainer &VContainer::operator =(const VContainer &data) VContainer::VContainer(const VContainer &data) :_size(50), sizeName("Сг"), _height(176), heightName("P"), gObjects(QHash()), - measurements(QHash()), incrementTable(QHash()), + measurements(QHash()), increments(QHash()), lengthLines(QHash()), lineAngles(QHash()), lengthSplines(QHash()), lengthArcs(QHash()), details(QHash()) { @@ -104,7 +105,7 @@ void VContainer::setData(const VContainer &data) } } measurements = *data.DataMeasurements(); - incrementTable = *data.DataIncrementTable(); + increments = *data.DataIncrements(); lengthLines = *data.DataLengthLines(); lineAngles = *data.DataLineAngles(); lengthSplines = *data.DataLengthSplines(); @@ -149,10 +150,10 @@ const VMeasurement VContainer::GetMeasurement(const QString &name) const return GetVariable(measurements, name); } -const VIncrementTableRow VContainer::GetIncrementTableRow(const QString& name) const +const VIncrement VContainer::GetIncrement(const QString& name) const { Q_ASSERT(name.isEmpty()==false); - return GetVariable(incrementTable, name); + return GetVariable(increments, name); } qreal VContainer::GetLine(const QString &name) const @@ -196,9 +197,9 @@ quint32 VContainer::AddDetail(VDetail detail) return id; } -void VContainer::AddIncrementTableRow(const QString &name, VIncrementTableRow row) +void VContainer::AddIncrement(const QString &name, VIncrement incr) { - incrementTable[name] = row; + increments[name] = incr; } quint32 VContainer::getNextId() @@ -239,7 +240,7 @@ void VContainer::AddLengthSpline(const QString &name, const qreal &value) void VContainer::AddLengthArc(const quint32 &id) { const VArc * arc = GeometricObject(id); - lengthArcs[arc->name()] = fromPixel(arc->GetLength()); + lengthArcs[arc->name()] = qApp->fromPixel(arc->GetLength()); } void VContainer::AddLineAngle(const QString &name, const qreal &value) @@ -251,7 +252,7 @@ void VContainer::AddLineAngle(const QString &name, const qreal &value) qreal VContainer::GetValueStandardTableRow(const QString& name) const { const VMeasurement m = GetMeasurement(name); - if (patternType == Pattern::Individual) + if (qApp->patternType() == Pattern::Individual) { return m.GetValue(); } @@ -263,18 +264,22 @@ qreal VContainer::GetValueStandardTableRow(const QString& name) const qreal VContainer::GetValueIncrementTableRow(const QString& name) const { - const VIncrementTableRow row = GetIncrementTableRow(name); - const qreal k_size = ( size() - 50.0 ) / 2.0; - const qreal k_growth = ( height() - 176.0 ) / 6.0; - const qreal value = row.getBase() + k_size * row.getKsize() + k_growth * row.getKgrowth(); - return value; + const VIncrement icr = GetIncrement(name); + if (qApp->patternType() == Pattern::Individual) + { + return icr.GetValue(); + } + else + { + return icr.GetValue(size(), height()); + } } void VContainer::Clear() { _id = 0; measurements.clear(); - incrementTable.clear(); + increments.clear(); lengthLines.clear(); lengthArcs.clear(); lineAngles.clear(); @@ -326,7 +331,7 @@ qreal VContainer::FindVar(const QString &name, bool *ok)const *ok = true; return GetValueStandardTableRow(name); } - if (incrementTable.contains(name)) + if (increments.contains(name)) { *ok = true; return GetValueIncrementTableRow(name); @@ -360,7 +365,7 @@ void VContainer::AddLine(const quint32 &firstPointId, const quint32 &secondPoint QString nameLine = GetNameLine(firstPointId, secondPointId); const VPointF *first = GeometricObject(firstPointId); const VPointF *second = GeometricObject(secondPointId); - AddLengthLine(nameLine, fromPixel(QLineF(first->toQPointF(), second->toQPointF()).length())); + AddLengthLine(nameLine, qApp->fromPixel(QLineF(first->toQPointF(), second->toQPointF()).length())); nameLine = GetNameLineAngle(firstPointId, secondPointId); AddLineAngle(nameLine, QLineF(first->toQPointF(), second->toQPointF()).angle()); } diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index 3609408c1..88a4a1329 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -30,7 +30,7 @@ #define VCONTAINER_H #include "vmeasurement.h" -#include "vincrementtablerow.h" +#include "vincrement.h" #include "../geometry/varc.h" #include "../geometry/vsplinepath.h" #include "../geometry/vdetail.h" @@ -113,11 +113,11 @@ public: */ const VMeasurement GetMeasurement(const QString& name) const; /** - * @brief GetIncrementTableRow return increment table row by name + * @brief GetIncrement return increment table row by name * @param name name of increment table row - * @return row of increment table + * @return increment */ - const VIncrementTableRow GetIncrementTableRow(const QString& name) const; + const VIncrement GetIncrement(const QString& name) const; /** * @brief GetLine return length of line by name * @param name name of line @@ -172,11 +172,11 @@ public: */ void AddMeasurement(const QString& name, const VMeasurement &m); /** - * @brief AddIncrementTableRow add new row of increment table + * @brief AddIncrement add new row of increment table * @param name name of new row of increment table * @param row new row of increment table */ - void AddIncrementTableRow(const QString& name, VIncrementTableRow row); + void AddIncrement(const QString& name, VIncrement incr); /** * @brief AddLengthLine add length of line to container * @param name name of line @@ -242,11 +242,11 @@ public: */ void UpdateMeasurement(const QString& name, VMeasurement m); /** - * @brief UpdateIncrementTableRow update increment table row by name + * @brief UpdateIncrement update increment table row by name * @param name name of row * @param row row */ - void UpdateIncrementTableRow(const QString& name, VIncrementTableRow row); + void UpdateIncrement(const QString& name, VIncrement incr); /** * @brief GetValueStandardTableRow return value of measurement by name * @param name name of measurement @@ -347,10 +347,10 @@ public: */ const QHash *DataMeasurements() const; /** - * @brief data container with dataIncrementTable return container of increment table + * @brief data container with dataIncrements return container of increment table * @return pointer on container of increment table */ - const QHash *DataIncrementTable() const; + const QHash *DataIncrements() const; /** * @brief data container with dataLengthLines return container of lines lengths * @return pointer on container of lines lengths @@ -399,9 +399,9 @@ private: */ QHash measurements; /** - * @brief incrementTable + * @brief increments */ - QHash incrementTable; + QHash increments; /** * @brief lengthLines container of lines lengths */ @@ -468,14 +468,14 @@ inline void VContainer::UpdateMeasurement(const QString &name, VMeasurement m) measurements[name] = m; } -inline void VContainer::UpdateIncrementTableRow(const QString &name, VIncrementTableRow row) +inline void VContainer::UpdateIncrement(const QString &name, VIncrement incr) { - incrementTable[name] = row; + increments[name] = incr; } inline void VContainer::ClearIncrementTable() { - incrementTable.clear(); + increments.clear(); } inline void VContainer::ClearLengthLines() @@ -545,12 +545,12 @@ inline QString VContainer::HeightName() const inline bool VContainer::IncrementTableContains(const QString &name) { - return incrementTable.contains(name); + return increments.contains(name); } inline void VContainer::RemoveIncrementTableRow(const QString &name) { - incrementTable.remove(name); + increments.remove(name); } inline const QHash *VContainer::DataGObjects() const @@ -563,9 +563,9 @@ inline const QHash *VContainer::DataMeasurements() const return &measurements; } -inline const QHash *VContainer::DataIncrementTable() const +inline const QHash *VContainer::DataIncrements() const { - return &incrementTable; + return &increments; } inline const QHash *VContainer::DataLengthLines() const diff --git a/src/container/vincrementtablerow.cpp b/src/container/vincrement.cpp similarity index 68% rename from src/container/vincrementtablerow.cpp rename to src/container/vincrement.cpp index 2e41c2755..bcabed46c 100644 --- a/src/container/vincrementtablerow.cpp +++ b/src/container/vincrement.cpp @@ -26,10 +26,22 @@ ** *************************************************************************/ -#include "vincrementtablerow.h" +#include "vincrement.h" -VIncrementTableRow::VIncrementTableRow() - :id(0), base(0), ksize(0), kgrowth(0), description(QString()){} +VIncrement::VIncrement() + :id(0), base(0), ksize(50.0), kheight(176.0), description(QString()){} -VIncrementTableRow::VIncrementTableRow(quint32 id, qreal base, qreal ksize, qreal kgrowth, QString description) - :id(id), base(base), ksize(ksize), kgrowth(kgrowth), description(description){} +VIncrement::VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description) + :id(id), base(base), ksize(ksize), kheight(kheight), description(description){} + +qreal VIncrement::GetValue() const +{ + return base; +} + +qreal VIncrement::GetValue(const qreal &size, const qreal &height) const +{ + const qreal k_size = ( size - 50.0 ) / 2.0; + const qreal k_height = ( height - 176.0 ) / 6.0; + return base + k_size * ksize + k_height * kheight; +} diff --git a/src/container/vincrementtablerow.h b/src/container/vincrement.h similarity index 76% rename from src/container/vincrementtablerow.h rename to src/container/vincrement.h index b077d7940..943dc6683 100644 --- a/src/container/vincrementtablerow.h +++ b/src/container/vincrement.h @@ -32,15 +32,15 @@ #include /** - * @brief The VIncrementTableRow class keep data row of increment table + * @brief The VIncrement class keep data row of increment table */ -class VIncrementTableRow +class VIncrement { public: /** * @brief VIncrementTableRow create enpty row */ - VIncrementTableRow(); + VIncrement(); /** * @brief VIncrementTableRow create row * @param id id @@ -49,8 +49,7 @@ public: * @param kgrowth increment in growths * @param description description of increment */ - VIncrementTableRow(quint32 id, qreal base, qreal ksize, qreal kgrowth, - QString description = QString()); + VIncrement(quint32 id, qreal base, qreal ksize, qreal kheight, QString description = QString()); /** * @brief getId return id of row * @return id @@ -82,15 +81,15 @@ public: */ void setKsize(const qreal &value); /** - * @brief getKgrowth return increment in growths + * @brief getKheight return increment in growths * @return increment */ - qreal getKgrowth() const; + qreal getKheight() const; /** - * @brief setKgrowth set increment in growths + * @brief setKheight set increment in growths * @param value value of increment */ - void setKgrowth(const qreal &value); + void setKheight(const qreal &value); /** * @brief getDescription return description * @return description @@ -101,6 +100,8 @@ public: * @param value description */ void setDescription(const QString &value); + qreal GetValue() const; + qreal GetValue(const qreal &size, const qreal &height) const; private: /** * @brief id identificator @@ -117,59 +118,59 @@ private: /** * @brief kgrowth increment in growths */ - qreal kgrowth; + qreal kheight; /** * @brief description description of increment */ QString description; }; -inline quint32 VIncrementTableRow::getId() const +inline quint32 VIncrement::getId() const { return id; } -inline void VIncrementTableRow::setId(const quint32 &value) +inline void VIncrement::setId(const quint32 &value) { id = value; } -inline qreal VIncrementTableRow::getBase() const +inline qreal VIncrement::getBase() const { return base; } -inline void VIncrementTableRow::setBase(const qreal &value) +inline void VIncrement::setBase(const qreal &value) { base = value; } -inline qreal VIncrementTableRow::getKsize() const +inline qreal VIncrement::getKsize() const { return ksize; } -inline void VIncrementTableRow::setKsize(const qreal &value) +inline void VIncrement::setKsize(const qreal &value) { ksize = value; } -inline qreal VIncrementTableRow::getKgrowth() const +inline qreal VIncrement::getKheight() const { - return kgrowth; + return kheight; } -inline void VIncrementTableRow::setKgrowth(const qreal &value) +inline void VIncrement::setKheight(const qreal &value) { - kgrowth = value; + kheight = value; } -inline QString VIncrementTableRow::getDescription() const +inline QString VIncrement::getDescription() const { return description; } -inline void VIncrementTableRow::setDescription(const QString &value) +inline void VIncrement::setDescription(const QString &value) { description = value; } diff --git a/src/container/vmeasurement.cpp b/src/container/vmeasurement.cpp index c08f28318..5f9b9b56f 100644 --- a/src/container/vmeasurement.cpp +++ b/src/container/vmeasurement.cpp @@ -49,6 +49,6 @@ qreal VMeasurement::GetValue() const qreal VMeasurement::GetValue(const qreal &size, const qreal &height) const { const qreal k_size = ( size - 50.0 ) / 2.0; - const qreal k_growth = ( height - 176.0 ) / 6.0; - return base + k_size * ksize + k_growth * kheight; + const qreal k_height = ( height - 176.0 ) / 6.0; + return base + k_size * ksize + k_height * kheight; } diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index 11659bf90..963d7e8c4 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -45,13 +45,40 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate); ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate); + if (qApp->patternType() == Pattern::Standard) + { + ui->labelBirthDate->setVisible(false); + ui->lineEditBirthDate->setVisible(false); + ui->labelFamilyName->setVisible(false); + ui->lineEditFamilyName->setVisible(false); + ui->labelGivenName->setVisible(false); + ui->lineEditGivenName->setVisible(false); + ui->labelSex->setVisible(false); + ui->lineEditSex->setVisible(false); + } + else + { + ui->tableWidgetMeasurements->setColumnHidden( 1, true ); + ui->tableWidgetMeasurements->setColumnHidden( 3, true ); + ui->tableWidgetMeasurements->setColumnHidden( 4, true ); + + ui->tableWidgetIncrement->setColumnHidden( 1, true ); + ui->tableWidgetIncrement->setColumnHidden( 3, true ); + ui->tableWidgetIncrement->setColumnHidden( 4, true ); + + ui->tableWidgetMeasurements->setItemDelegateForColumn(0, textDelegate); + ui->tableWidgetMeasurements->setItemDelegateForColumn(2, doubleDelegate); + + connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementsChanged); + } + FillMeasurements(); - FillIncrementTable(); + FillIncrements(); FillLengthLines(); FillLengthSplines(); FillLengthArcs(); - connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::cellChanged); + connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged); connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd); connect(ui->toolButtonRemove, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonRemove); @@ -67,54 +94,61 @@ void DialogIncrements::FillMeasurements() const QHash *table = data->DataMeasurements(); qint32 currentRow = -1; QHashIterator i(*table); - ui->tableWidgetStandard->setRowCount ( table->size() ); + ui->tableWidgetMeasurements->setRowCount ( table->size() ); while (i.hasNext()) { i.next(); - VMeasurement cell = i.value(); + VMeasurement m = i.value(); currentRow++; QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); item->setTextAlignment(Qt::AlignHCenter); item->setFont(QFont("Times", 12, QFont::Bold)); - ui->tableWidgetStandard->setItem(currentRow, 0, item); + item->setToolTip(m.GetDescription()); + ui->tableWidgetMeasurements->setItem(currentRow, 0, item); - item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(i.key()))); - item->setTextAlignment(Qt::AlignHCenter); - ui->tableWidgetStandard->setItem(currentRow, 1, item); + if (qApp->patternType() == Pattern::Standard) + { + QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(i.key()))); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetMeasurements->setItem(currentRow, 1, item); + } - item = new QTableWidgetItem(QString().setNum(cell.GetBase())); + item = new QTableWidgetItem(QString().setNum(m.GetBase())); item->setTextAlignment(Qt::AlignHCenter); - ui->tableWidgetStandard->setItem(currentRow, 2, item); + ui->tableWidgetMeasurements->setItem(currentRow, 2, item); - item = new QTableWidgetItem(QString().setNum(cell.GetKsize())); - item->setTextAlignment(Qt::AlignHCenter); - ui->tableWidgetStandard->setItem(currentRow, 3, item); + if (qApp->patternType() == Pattern::Standard) + { + QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(m.GetKsize())); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetMeasurements->setItem(currentRow, 3, item); - item = new QTableWidgetItem(QString().setNum(cell.GetKheight())); - item->setTextAlignment(Qt::AlignHCenter); - ui->tableWidgetStandard->setItem(currentRow, 4, item); + item = new QTableWidgetItem(QString().setNum(m.GetKheight())); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetMeasurements->setItem(currentRow, 4, item); + } - item = new QTableWidgetItem(cell.GetDescription()); + item = new QTableWidgetItem(m.GetNumber()); item->setTextAlignment(Qt::AlignHCenter); - ui->tableWidgetStandard->setItem(currentRow, 5, item); + ui->tableWidgetMeasurements->setItem(currentRow, 5, item); } - ui->tableWidgetStandard->resizeColumnsToContents(); - ui->tableWidgetStandard->resizeRowsToContents(); - ui->tableWidgetStandard->verticalHeader()->setDefaultSectionSize(20); + ui->tableWidgetMeasurements->resizeColumnsToContents(); + ui->tableWidgetMeasurements->resizeRowsToContents(); + ui->tableWidgetMeasurements->verticalHeader()->setDefaultSectionSize(20); } -void DialogIncrements::FillIncrementTable() +void DialogIncrements::FillIncrements() { - const QHash *incrementTable = data->DataIncrementTable(); - QHashIterator i(*incrementTable); + const QHash *increments = data->DataIncrements(); + QHashIterator i(*increments); QMap map; //Sorting QHash by id while (i.hasNext()) { i.next(); - VIncrementTableRow cell = i.value(); - map.insert(cell.getId(), i.key()); + VIncrement incr = i.value(); + map.insert(incr.getId(), i.key()); } qint32 currentRow = -1; @@ -122,37 +156,43 @@ void DialogIncrements::FillIncrementTable() while (iMap.hasNext()) { iMap.next(); - VIncrementTableRow cell = incrementTable->value(iMap.value()); + VIncrement incr = increments->value(iMap.value()); currentRow++; - ui->tableWidgetIncrement->setRowCount ( incrementTable->size() ); + ui->tableWidgetIncrement->setRowCount ( increments->size() ); QTableWidgetItem *item = new QTableWidgetItem(iMap.value()); item->setTextAlignment(Qt::AlignHCenter); item->setFont(QFont("Times", 12, QFont::Bold)); - item->setData(Qt::UserRole, cell.getId()); + item->setData(Qt::UserRole, incr.getId()); ui->tableWidgetIncrement->setItem(currentRow, 0, item); - item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value()))); - item->setTextAlignment(Qt::AlignHCenter); - // set the item non-editable (view only), and non-selectable - Qt::ItemFlags flags = item->flags(); - flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag - item->setFlags(flags); - ui->tableWidgetIncrement->setItem(currentRow, 1, item); + if (qApp->patternType() == Pattern::Standard) + { + item = new QTableWidgetItem(QString().setNum(data->GetValueIncrementTableRow(iMap.value()))); + item->setTextAlignment(Qt::AlignHCenter); + // set the item non-editable (view only), and non-selectable + Qt::ItemFlags flags = item->flags(); + flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag + item->setFlags(flags); + ui->tableWidgetIncrement->setItem(currentRow, 1, item); + } - item = new QTableWidgetItem(QString().setNum(cell.getBase())); + item = new QTableWidgetItem(QString().setNum(incr.getBase())); item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetIncrement->setItem(currentRow, 2, item); - item = new QTableWidgetItem(QString().setNum(cell.getKsize())); - item->setTextAlignment(Qt::AlignHCenter); - ui->tableWidgetIncrement->setItem(currentRow, 3, item); + if (qApp->patternType() == Pattern::Standard) + { + item = new QTableWidgetItem(QString().setNum(incr.getKsize())); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetIncrement->setItem(currentRow, 3, item); - item = new QTableWidgetItem(QString().setNum(cell.getKgrowth())); - item->setTextAlignment(Qt::AlignHCenter); - ui->tableWidgetIncrement->setItem(currentRow, 4, item); + item = new QTableWidgetItem(QString().setNum(incr.getKheight())); + item->setTextAlignment(Qt::AlignHCenter); + ui->tableWidgetIncrement->setItem(currentRow, 4, item); + } - item = new QTableWidgetItem(cell.getDescription()); + item = new QTableWidgetItem(incr.getDescription()); item->setTextAlignment(Qt::AlignLeft); ui->tableWidgetIncrement->setItem(currentRow, 5, item); } @@ -273,13 +313,13 @@ void DialogIncrements::FillLengthArcs() void DialogIncrements::FullUpdateFromFile() { disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, - &DialogIncrements::cellChanged); + &DialogIncrements::IncrementChanged); - ui->tableWidgetStandard->clearContents(); + ui->tableWidgetMeasurements->clearContents(); FillMeasurements(); ui->tableWidgetIncrement->clearContents(); - FillIncrementTable(); + FillIncrements(); ui->tableWidgetLines->clearContents(); FillLengthLines(); @@ -291,14 +331,14 @@ void DialogIncrements::FullUpdateFromFile() FillLengthArcs(); connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, - &DialogIncrements::cellChanged); + &DialogIncrements::IncrementChanged); } void DialogIncrements::clickedToolButtonAdd() { ui->tableWidgetIncrement->setFocus(Qt::OtherFocusReason); disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, - &DialogIncrements::cellChanged); + &DialogIncrements::IncrementChanged); qint32 currentRow = ui->tableWidgetIncrement->rowCount(); ui->tableWidgetIncrement->insertRow( currentRow ); @@ -315,8 +355,8 @@ void DialogIncrements::clickedToolButtonAdd() qreal ksize = 0; qreal kgrowth = 0; QString description = QString(tr("Description")); - VIncrementTableRow incrementRow = VIncrementTableRow(id, base, ksize, kgrowth, description); - data->AddIncrementTableRow(name, incrementRow); + VIncrement incr = VIncrement(id, base, ksize, kgrowth, description); + data->AddIncrement(name, incr); AddIncrementToFile(id, name, base, ksize, kgrowth, description); @@ -353,14 +393,14 @@ void DialogIncrements::clickedToolButtonAdd() ui->toolButtonRemove->setEnabled(true); connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, - &DialogIncrements::cellChanged); + &DialogIncrements::IncrementChanged); emit haveLiteChange(); } void DialogIncrements::clickedToolButtonRemove() { disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, - &DialogIncrements::cellChanged); + &DialogIncrements::IncrementChanged); QTableWidgetItem *item = ui->tableWidgetIncrement->currentItem(); qint32 row = item->row(); QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0); @@ -378,7 +418,7 @@ void DialogIncrements::clickedToolButtonRemove() ui->toolButtonRemove->setEnabled(false); } connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, - &DialogIncrements::cellChanged); + &DialogIncrements::IncrementChanged); emit haveLiteChange(); } @@ -415,7 +455,7 @@ void DialogIncrements::AddIncrementToFile(quint32 id, QString name, qreal base, list.at(0).appendChild(element); } -void DialogIncrements::cellChanged ( qint32 row, qint32 column ) +void DialogIncrements::IncrementChanged ( qint32 row, qint32 column ) { QTableWidgetItem *item = nullptr; QTableWidgetItem *itemName = nullptr; @@ -493,9 +533,9 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) if (domElement.isElement()) { domElement.setAttribute("description", item->text()); - VIncrementTableRow incr = data->GetIncrementTableRow(itemName->text()); + VIncrement incr = data->GetIncrement(itemName->text()); incr.setDescription(item->text()); - data->UpdateIncrementTableRow(itemName->text(), incr); + data->UpdateIncrement(itemName->text(), incr); ui->tableWidgetIncrement->resizeColumnsToContents(); ui->tableWidgetIncrement->resizeRowsToContents(); ui->tableWidgetIncrement->setCurrentCell( row, 0 ); @@ -507,6 +547,11 @@ void DialogIncrements::cellChanged ( qint32 row, qint32 column ) } } +void DialogIncrements::MeasurementsChanged(qint32 row, qint32 column) +{ + +} + void DialogIncrements::closeEvent(QCloseEvent *event) { emit DialogClosed(QDialog::Accepted); diff --git a/src/dialogs/app/dialogincrements.h b/src/dialogs/app/dialogincrements.h index e78120b3c..bb8256880 100644 --- a/src/dialogs/app/dialogincrements.h +++ b/src/dialogs/app/dialogincrements.h @@ -66,7 +66,8 @@ public slots: * @param row number of row * @param column number of column */ - void cellChanged ( qint32 row, qint32 column ); + void IncrementChanged ( qint32 row, qint32 column ); + void MeasurementsChanged ( qint32 row, qint32 column ); /** * @brief FullUpdateFromFile update information in tables form file */ @@ -111,7 +112,7 @@ private: /** * @brief FillIncrementTable fill data for increment table */ - void FillIncrementTable(); + void FillIncrements(); /** * @brief FillLengthLines fill data for table of lines lengths */ diff --git a/src/dialogs/app/dialogincrements.ui b/src/dialogs/app/dialogincrements.ui index 4ae845d75..96d7eb33a 100644 --- a/src/dialogs/app/dialogincrements.ui +++ b/src/dialogs/app/dialogincrements.ui @@ -61,7 +61,9 @@ ... - + + + @@ -70,21 +72,21 @@ - + Family name - + - + 84 @@ -97,14 +99,14 @@ - + - + 84 @@ -117,14 +119,14 @@ - + - + 84 @@ -137,12 +139,12 @@ - + - + true @@ -448,7 +450,7 @@ - tableWidgetStandard + tableWidgetMeasurements tableWidgetIncrement toolButtonAdd toolButtonRemove diff --git a/src/dialogs/app/dialogindividualmeasurements.cpp b/src/dialogs/app/dialogindividualmeasurements.cpp index 8da793595..96e2e0e06 100644 --- a/src/dialogs/app/dialogindividualmeasurements.cpp +++ b/src/dialogs/app/dialogindividualmeasurements.cpp @@ -33,6 +33,7 @@ #include #include #include +#include "../../widgets/vapplication.h" DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, const QString &patternPieceName, QWidget *parent) : @@ -112,7 +113,7 @@ void DialogIndividualMeasurements::DialogAccepted() try { m.setContent(&file); - patternUnit = m.Unit(); + qApp->setPatternUnit( m.Unit()); } catch(VException &e) { @@ -196,18 +197,9 @@ void DialogIndividualMeasurements::CheckState() void DialogIndividualMeasurements::LoadIndividualTables() { -#ifdef Q_OS_WIN - const QString pathToTables = QString("/tables/individual"); -#else - #ifdef QT_DEBUG - const QString pathToTables = QString("/tables/individual"); - #else - const QString pathToTables = QString("/usr/share/valentina/tables/individual"); - #endif -#endif QStringList filters; filters << "*.vit"; - QDir tablesDir(pathToTables); + QDir tablesDir(qApp->pathToTables()); tablesDir.setNameFilters(filters); const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files); diff --git a/src/dialogs/app/dialogstandardmeasurements.cpp b/src/dialogs/app/dialogstandardmeasurements.cpp index cd9297659..d5e9d0ee9 100644 --- a/src/dialogs/app/dialogstandardmeasurements.cpp +++ b/src/dialogs/app/dialogstandardmeasurements.cpp @@ -30,6 +30,7 @@ #include "ui_dialogstandardmeasurements.h" #include #include "../../xml/vstandardmeasurements.h" +#include "../../widgets/vapplication.h" DialogStandardMeasurements::DialogStandardMeasurements(VContainer *data, const QString &patternPieceName, QWidget *parent) : @@ -94,7 +95,7 @@ void DialogStandardMeasurements::DialogAccepted() try { m.setContent(&file); - patternUnit = m.Unit(); + qApp->setPatternUnit(m.Unit()); } catch(VException &e) { @@ -148,18 +149,9 @@ void DialogStandardMeasurements::CheckState() void DialogStandardMeasurements::LoadStandardTables() { -#ifdef Q_OS_WIN - const QString pathToTables = QString("/tables/standard"); -#else - #ifdef QT_DEBUG - const QString pathToTables = QString("/tables/standard"); - #else - const QString pathToTables = QString("/usr/share/valentina/tables/standard"); - #endif -#endif QStringList filters; filters << "*.vst"; - QDir tablesDir(pathToTables); + QDir tablesDir(qApp->pathToTables()); tablesDir.setNameFilters(filters); const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files); diff --git a/src/dialogs/app/pages.cpp b/src/dialogs/app/pages.cpp index 8dcf9c239..eb729b1d7 100644 --- a/src/dialogs/app/pages.cpp +++ b/src/dialogs/app/pages.cpp @@ -28,6 +28,7 @@ #include "pages.h" #include "../../options.h" +#include "../../widgets/vapplication.h" ConfigurationPage::ConfigurationPage(QWidget *parent): QWidget(parent), autoSaveCheck(0), autoTime(0), langCombo(0), osOptionCheck(0), langChanged(false) @@ -115,7 +116,7 @@ QGroupBox *ConfigurationPage::LangGroup() QString checkedLocale = settings.value("configuration/locale", defaultLocale).toString(); QString m_langPath = QApplication::applicationDirPath(); - m_langPath.append(translationsPath); + m_langPath.append(qApp->translationsPath()); QDir dir(m_langPath); QStringList fileNames = dir.entryList(QStringList("valentina_*.qm")); diff --git a/src/dialogs/tools/dialogdetail.cpp b/src/dialogs/tools/dialogdetail.cpp index 7813037fc..d192889cf 100644 --- a/src/dialogs/tools/dialogdetail.cpp +++ b/src/dialogs/tools/dialogdetail.cpp @@ -150,8 +150,8 @@ void DialogDetail::NewItem(quint32 id, const Valentina::Tools &typeTool, const N this, &DialogDetail::BiasXChanged); disconnect(ui.spinBoxBiasY, static_cast(&QSpinBox::valueChanged), this, &DialogDetail::BiasYChanged); - ui.spinBoxBiasX->setValue(static_cast(fromPixel(node.getMx()))); - ui.spinBoxBiasY->setValue(static_cast(fromPixel(node.getMy()))); + ui.spinBoxBiasX->setValue(static_cast(qApp->fromPixel(node.getMx()))); + ui.spinBoxBiasY->setValue(static_cast(qApp->fromPixel(node.getMy()))); connect(ui.spinBoxBiasX, static_cast(&QSpinBox::valueChanged), this, &DialogDetail::BiasXChanged); connect(ui.spinBoxBiasY, static_cast(&QSpinBox::valueChanged), @@ -184,7 +184,7 @@ void DialogDetail::BiasXChanged(qreal d) QListWidgetItem *item = ui.listWidget->item( row ); Q_CHECK_PTR(item); VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); - node.setMx(toPixel(d)); + node.setMx(qApp->toPixel(d)); item->setData(Qt::UserRole, QVariant::fromValue(node)); } @@ -194,7 +194,7 @@ void DialogDetail::BiasYChanged(qreal d) QListWidgetItem *item = ui.listWidget->item( row ); Q_CHECK_PTR(item); VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); - node.setMy(toPixel(d)); + node.setMy(qApp->toPixel(d)); item->setData(Qt::UserRole, QVariant::fromValue(node)); } @@ -218,8 +218,8 @@ void DialogDetail::ObjectChanged(int row) } QListWidgetItem *item = ui.listWidget->item( row ); VNodeDetail node = qvariant_cast(item->data(Qt::UserRole)); - ui.spinBoxBiasX->setValue(static_cast(fromPixel(node.getMx()))); - ui.spinBoxBiasY->setValue(static_cast(fromPixel(node.getMy()))); + ui.spinBoxBiasX->setValue(static_cast(qApp->fromPixel(node.getMx()))); + ui.spinBoxBiasY->setValue(static_cast(qApp->fromPixel(node.getMy()))); } void DialogDetail::DeleteItem() diff --git a/src/dialogs/tools/dialogpointofcontact.cpp b/src/dialogs/tools/dialogpointofcontact.cpp index 44d1b2512..8d9881e7f 100644 --- a/src/dialogs/tools/dialogpointofcontact.cpp +++ b/src/dialogs/tools/dialogpointofcontact.cpp @@ -67,7 +67,7 @@ DialogPointOfContact::DialogPointOfContact(const VContainer *data, QWidget *pare connect(ui.listWidget, &QListWidget::itemDoubleClicked, this, &DialogPointOfContact::PutVal); connect(ui.listWidget, &QListWidget::currentRowChanged, this, &DialogPointOfContact::ValChenged); - if (patternType == Pattern::Standard) + if (qApp->patternType() == Pattern::Standard) { SizeHeight(); connect(ui.radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); diff --git a/src/dialogs/tools/dialogsinglepoint.cpp b/src/dialogs/tools/dialogsinglepoint.cpp index 4cc21750d..f4f07b064 100644 --- a/src/dialogs/tools/dialogsinglepoint.cpp +++ b/src/dialogs/tools/dialogsinglepoint.cpp @@ -36,8 +36,8 @@ DialogSinglePoint::DialogSinglePoint(const VContainer *data, QWidget *parent) point(QPointF()) { ui->setupUi(this); - ui->doubleSpinBoxX->setRange(0, fromPixel(SceneSize)); - ui->doubleSpinBoxY->setRange(0, fromPixel(SceneSize)); + ui->doubleSpinBoxX->setRange(0, qApp->fromPixel(SceneSize)); + ui->doubleSpinBoxY->setRange(0, qApp->fromPixel(SceneSize)); labelEditNamePoint = ui->labelEditName; InitOkCansel(ui); @@ -51,20 +51,20 @@ void DialogSinglePoint::mousePress(const QPointF &scenePos) { if (isInitialized == false) { - ui->doubleSpinBoxX->setValue(fromPixel(scenePos.x())); - ui->doubleSpinBoxY->setValue(fromPixel(scenePos.y())); + ui->doubleSpinBoxX->setValue(qApp->fromPixel(scenePos.x())); + ui->doubleSpinBoxY->setValue(qApp->fromPixel(scenePos.y())); this->show(); } else { - ui->doubleSpinBoxX->setValue(fromPixel(scenePos.x())); - ui->doubleSpinBoxY->setValue(fromPixel(scenePos.y())); + ui->doubleSpinBoxX->setValue(qApp->fromPixel(scenePos.x())); + ui->doubleSpinBoxY->setValue(qApp->fromPixel(scenePos.y())); } } void DialogSinglePoint::DialogAccepted() { - point = QPointF(toPixel(ui->doubleSpinBoxX->value()), toPixel(ui->doubleSpinBoxY->value())); + point = QPointF(qApp->toPixel(ui->doubleSpinBoxX->value()), qApp->toPixel(ui->doubleSpinBoxY->value())); name = ui->lineEditName->text(); emit DialogClosed(QDialog::Accepted); } @@ -75,8 +75,8 @@ void DialogSinglePoint::setData(const QString &name, const QPointF &point) this->point = point; isInitialized = true; ui->lineEditName->setText(name); - ui->doubleSpinBoxX->setValue(fromPixel(point.x())); - ui->doubleSpinBoxY->setValue(fromPixel(point.y())); + ui->doubleSpinBoxX->setValue(qApp->fromPixel(point.x())); + ui->doubleSpinBoxY->setValue(qApp->fromPixel(point.y())); } DialogSinglePoint::~DialogSinglePoint() diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index 6c0ee1405..6e9378c1d 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -566,7 +566,7 @@ void DialogTool::LengthCurves() void DialogTool::Increments() { - ShowVariable(data->DataIncrementTable()); + ShowVariable(data->DataIncrements()); } void DialogTool::PutHere() @@ -624,9 +624,9 @@ void DialogTool::ValChenged(int row) } if (radioButtonIncrements->isChecked()) { - VIncrementTableRow itable = data->GetIncrementTableRow(item->text()); + VIncrement incr = data->GetIncrement(item->text()); QString desc = QString("%1(%2) - %3").arg(item->text()).arg(data->GetValueIncrementTableRow(item->text())) - .arg(itable.getDescription()); + .arg(incr.getDescription()); labelDescription->setText(desc); return; } @@ -672,7 +672,7 @@ void DialogTool::UpdateList() } if (radioButtonIncrements->isChecked()) { - ShowVariable(data->DataIncrementTable()); + ShowVariable(data->DataIncrements()); } if (radioButtonLengthLine->isChecked()) { diff --git a/src/dialogs/tools/dialogtool.h b/src/dialogs/tools/dialogtool.h index cc8d03a7e..eb5111c04 100644 --- a/src/dialogs/tools/dialogtool.h +++ b/src/dialogs/tools/dialogtool.h @@ -37,6 +37,7 @@ #include #include #include "../../container/vcontainer.h" +#include "../../widgets/vapplication.h" namespace ComboMode { @@ -428,7 +429,7 @@ protected: connect(listWidget, &QListWidget::currentRowChanged, this, &DialogTool::ValChenged); - if (patternType == Pattern::Standard) + if (qApp->patternType() == Pattern::Standard) { SizeHeight(); connect(radioButtonSizeGrowth, &QRadioButton::clicked, this, &DialogTool::SizeHeight); diff --git a/src/geometry/vequidistant.cpp b/src/geometry/vequidistant.cpp index af4106be5..c75f8fff6 100644 --- a/src/geometry/vequidistant.cpp +++ b/src/geometry/vequidistant.cpp @@ -27,6 +27,7 @@ *************************************************************************/ #include "vequidistant.h" +#include "../widgets/vapplication.h" QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer *data) const { @@ -145,11 +146,11 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer QPainterPath ekv; if (detail.getClosed() == true) { - ekv = Equidistant(pointsEkv, Detail::CloseEquidistant, toPixel(detail.getWidth())); + ekv = Equidistant(pointsEkv, Detail::CloseEquidistant, qApp->toPixel(detail.getWidth())); } else { - ekv = Equidistant(pointsEkv, Detail::OpenEquidistant, toPixel(detail.getWidth())); + ekv = Equidistant(pointsEkv, Detail::OpenEquidistant, qApp->toPixel(detail.getWidth())); } path.addPath(ekv); path.setFillRule(Qt::WindingFill); @@ -385,7 +386,7 @@ QVector VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2 case (QLineF::UnboundedIntersection): { QLineF line( line1.p2(), CrosPoint ); - if (line.length() > width + toPixel(8)) + if (line.length() > width + qApp->toPixel(8)) { QLineF lineL = QLineF(bigLine1.p2(), CrosPoint); lineL.setLength(width); diff --git a/src/main.cpp b/src/main.cpp index 250149737..9618e82c2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -31,20 +31,6 @@ #include #include #include "tablewindow.h" -#include "options.h" - -Valentina::Units patternUnit = Valentina::Cm;// Default pattern unit. -Pattern::Measurements patternType = Pattern::Individual;// Default pattern type. - -#ifdef Q_OS_WIN - const QString translationsPath = QString("/translations"); -#else - #ifdef QT_DEBUG - const QString translationsPath = QString("/translations"); - #else - const QString translationsPath = QString("/usr/share/valentina/translations"); - #endif -#endif void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) { @@ -98,12 +84,12 @@ int main(int argc, char *argv[]) QTranslator appTranslator; #ifdef Q_OS_WIN - appTranslator.load("valentina_" + checkedLocale, "."+translationsPath); + appTranslator.load("valentina_" + checkedLocale, "."+qApp->translationsPath()); #else #ifdef QT_DEBUG - appTranslator.load("valentina_" + checkedLocale, "."+translationsPath); + appTranslator.load("valentina_" + checkedLocale, "."+qApp->translationsPath()); #else - appTranslator.load("valentina_" + checkedLocale, translationsPath); + appTranslator.load("valentina_" + checkedLocale, qApp->translationsPath()); #endif #endif app.installTranslator(&appTranslator); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e6c7f3efa..873cb7bef 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -120,7 +120,7 @@ void MainWindow::ActionNewDraw() measurements.exec(); if (measurements.type() == Measurements::Standard) { - patternType == Pattern::Standard; + qApp->setPatternType(Pattern::Standard); DialogStandardMeasurements stMeasurements(pattern, patternPieceName, this); if (stMeasurements.exec() == QDialog::Accepted) { @@ -134,7 +134,7 @@ void MainWindow::ActionNewDraw() } else { - patternType == Pattern::Individual; + qApp->setPatternType(Pattern::Individual); DialogIndividualMeasurements indMeasurements(pattern, patternPieceName, this); if (indMeasurements.exec() == QDialog::Accepted) { @@ -167,7 +167,7 @@ void MainWindow::ActionNewDraw() pattern->ClearGObjects(); //Create single point - const quint32 id = pattern->AddGObject(new VPointF(toPixel((10+comboBoxDraws->count()*5)), toPixel(10), "А", 5, + const quint32 id = pattern->AddGObject(new VPointF(qApp->toPixel((10+comboBoxDraws->count()*5)), qApp->toPixel(10), "А", 5, 10)); VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Valentina::FromGui); sceneDraw->addItem(spoint); @@ -626,8 +626,8 @@ void MainWindow::currentDrawChanged( int index ) void MainWindow::mouseMove(const QPointF &scenePos) { QString string = QString("%1, %2") - .arg(static_cast(fromPixel(scenePos.x()))) - .arg(static_cast(fromPixel(scenePos.y()))); + .arg(static_cast(qApp->fromPixel(scenePos.x()))) + .arg(static_cast(qApp->fromPixel(scenePos.y()))); mouseCoordinate->setText(string); } diff --git a/src/options.h b/src/options.h index b7466d681..b58858479 100644 --- a/src/options.h +++ b/src/options.h @@ -101,8 +101,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Sources ) Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Draws ) Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Units ) -extern Valentina::Units patternUnit; - namespace Pattern { /** @@ -111,51 +109,7 @@ namespace Pattern enum Measurement { Standard, Individual }; Q_DECLARE_FLAGS(Measurements, Measurement) } -Q_DECLARE_OPERATORS_FOR_FLAGS( Pattern::Measurements ) - -extern Pattern::Measurements patternType; - -#define PrintDPI 96.0 - -inline double toPixel(double unit) -{ - double result = 0; - switch (patternUnit) - { - case Valentina::Mm: - result = (unit / 25.4) * PrintDPI; - break; - case Valentina::Cm: - result = ((unit * 10.0) / 25.4) * PrintDPI; - break; - case Valentina::In: - result = unit * PrintDPI; - break; - default: - break; - } - return result; -} - -inline double fromPixel(double pix) -{ - double result = 0; - switch (patternUnit) - { - case Valentina::Mm: - result = (pix / PrintDPI) * 25.4; - break; - case Valentina::Cm: - result = ((pix / PrintDPI) * 25.4) / 10.0; - break; - case Valentina::In: - result = pix / PrintDPI; - break; - default: - break; - } - return result; -} +Q_DECLARE_OPERATORS_FOR_FLAGS( Pattern::Measurements ) #define widthMainLine 1.2 //mm #define widthHairLine widthMainLine/3 diff --git a/src/stable.h b/src/stable.h index 09cd50c93..d220aab6a 100644 --- a/src/stable.h +++ b/src/stable.h @@ -47,7 +47,6 @@ were in use. */ #include #include #include -#include "options.h" #endif #endif // STABLE_H diff --git a/src/tablewindow.cpp b/src/tablewindow.cpp index af06035b1..783e75627 100644 --- a/src/tablewindow.cpp +++ b/src/tablewindow.cpp @@ -31,7 +31,7 @@ #include "widgets/vtablegraphicsview.h" #include #include -#include "options.h" +#include "widgets/vapplication.h" TableWindow::TableWindow(QWidget *parent) :QMainWindow(parent), numberDetal(nullptr), colission(nullptr), ui(new Ui::TableWindow), @@ -45,8 +45,8 @@ TableWindow::TableWindow(QWidget *parent) ui->statusBar->addWidget(numberDetal); ui->statusBar->addWidget(colission); outItems = collidingItems = false; - //sceneRect = QRectF(0, 0, toPixel(203), toPixel(287)); - sceneRect = QRectF(0, 0, toPixel(823), toPixel(1171)); + //sceneRect = QRectF(0, 0, qApp->toPixel(203), qApp->toPixel(287)); + sceneRect = QRectF(0, 0, qApp->toPixel(823), qApp->toPixel(1171)); tableScene = new QGraphicsScene(sceneRect); QBrush brush; brush.setStyle( Qt::SolidPattern ); @@ -81,7 +81,7 @@ void TableWindow::AddPaper() shadowPaper->setBrush(QBrush(Qt::black)); tableScene->addItem(shadowPaper); paper = new QGraphicsRectItem(QRectF(x1, y1, x2, y2)); - paper->setPen(QPen(Qt::black, toPixel(widthMainLine))); + paper->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); paper->setBrush(QBrush(Qt::white)); tableScene->addItem(paper); qDebug()<rect().size().toSize(); @@ -168,7 +168,7 @@ void TableWindow::StopTable() delete listOutItems; listDetails.clear(); //sceneRect = QRectF(0, 0, 230*resol/25.9, 327*resol/25.9); - sceneRect = QRectF(0, 0, toPixel(823), toPixel(1171)); + sceneRect = QRectF(0, 0, qApp->toPixel(823), qApp->toPixel(1171)); emit closed(); } @@ -216,6 +216,7 @@ void TableWindow::saveScene() tableScene->setBackgroundBrush( *brush ); tableScene->clearSelection(); // Selections would also render to the file, so need delete them shadowPaper->setVisible(false); + paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen)); QFileInfo fi( name ); QStringList suffix; suffix << "svg" << "png" << "pdf" << "eps" << "ps"; @@ -226,30 +227,23 @@ void TableWindow::saveScene() SvgFile(name); paper->setVisible(true); break; - case 1: //png - paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen)); + case 1: //png PngFile(name); - paper->setPen(QPen(Qt::black, toPixel(widthMainLine))); break; case 2: //pdf - paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen)); - PdfFile(name); - paper->setPen(QPen(Qt::black, toPixel(widthMainLine))); + PdfFile(name); break; case 3: //eps - paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen)); EpsFile(name); - paper->setPen(QPen(Qt::black, toPixel(widthMainLine))); break; case 4: //ps - paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen)); PsFile(name); - paper->setPen(QPen(Qt::black, toPixel(widthMainLine))); break; default: qWarning() << "Bad file suffix"<setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); brush->setColor( QColor( Qt::gray ) ); brush->setStyle( Qt::SolidPattern ); tableScene->setBackgroundBrush( *brush ); @@ -323,7 +317,7 @@ void TableWindow::itemColliding(QList list, int number) { VItem * bitem = qgraphicsitem_cast ( listCollidingItems.at(i) ); Q_CHECK_PTR(bitem); - bitem->setPen(QPen(Qt::black, toPixel(widthMainLine))); + bitem->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); listCollidingItems.removeAt(i); } } @@ -332,7 +326,7 @@ void TableWindow::itemColliding(QList list, int number) { VItem * bitem = qgraphicsitem_cast ( listCollidingItems.at(0) ); Q_CHECK_PTR(bitem); - bitem->setPen(QPen(Qt::black, toPixel(widthMainLine))); + bitem->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); listCollidingItems.clear(); collidingItems = true; } @@ -378,13 +372,13 @@ void TableWindow::GetNextDetail() void TableWindow::AddLength() { QRectF rect = tableScene->sceneRect(); - rect.setHeight(rect.height()+toPixel(279)); + rect.setHeight(rect.height()+qApp->toPixel(279)); tableScene->setSceneRect(rect); rect = shadowPaper->rect(); - rect.setHeight(rect.height()+toPixel(279)); + rect.setHeight(rect.height()+qApp->toPixel(279)); shadowPaper->setRect(rect); rect = paper->rect(); - rect.setHeight(rect.height()+toPixel(279)); + rect.setHeight(rect.height()+qApp->toPixel(279)); paper->setRect(rect); ui->actionRemove->setEnabled(true); emit LengthChanged(); @@ -395,13 +389,13 @@ void TableWindow::RemoveLength() if (sceneRect.height() <= tableScene->sceneRect().height() - 100) { QRectF rect = tableScene->sceneRect(); - rect.setHeight(rect.height()-toPixel(279)); + rect.setHeight(rect.height()-qApp->toPixel(279)); tableScene->setSceneRect(rect); rect = shadowPaper->rect(); - rect.setHeight(rect.height()-toPixel(279)); + rect.setHeight(rect.height()-qApp->toPixel(279)); shadowPaper->setRect(rect); rect = paper->rect(); - rect.setHeight(rect.height()-toPixel(279)); + rect.setHeight(rect.height()-qApp->toPixel(279)); paper->setRect(rect); if (fabs(sceneRect.height() - tableScene->sceneRect().height()) < 0.01) { @@ -437,12 +431,12 @@ void TableWindow::SvgFile(const QString &name) const generator.setViewBox(paper->rect()); generator.setTitle("Valentina pattern"); generator.setDescription(description); - generator.setResolution(PrintDPI); + generator.setResolution(static_cast(qApp->PrintDPI)); QPainter painter; painter.begin(&generator); painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setRenderHint(QPainter::Antialiasing, true); - painter.setPen(QPen(Qt::black, toPixel(widthHairLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter.setPen(QPen(Qt::black, qApp->toPixel(widthHairLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setBrush ( QBrush ( Qt::NoBrush ) ); tableScene->render(&painter); painter.end(); @@ -459,7 +453,7 @@ void TableWindow::PngFile(const QString &name) const QPainter painter(&image); painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setRenderHint(QPainter::Antialiasing, true); - painter.setPen(QPen(Qt::black, toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter.setPen(QPen(Qt::black, qApp->toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setBrush ( QBrush ( Qt::NoBrush ) ); tableScene->render(&painter); image.save(name); @@ -473,8 +467,8 @@ void TableWindow::PdfFile(const QString &name) const QRectF r = paper->rect(); qreal x=0, y=0, w=0, h=0; r.getRect(&x, &y, &w, &h);// Re-shrink the scene to it's bounding contents - printer.setResolution(PrintDPI); - printer.setPaperSize ( QSizeF(fromPixel(w), fromPixel(h)), QPrinter::Millimeter ); + printer.setResolution(static_cast(qApp->PrintDPI)); + printer.setPaperSize ( QSizeF(qApp->fromPixel(w), qApp->fromPixel(h)), QPrinter::Millimeter ); QPainter painter; if (painter.begin( &printer ) == false) { // failed to open file @@ -483,7 +477,7 @@ void TableWindow::PdfFile(const QString &name) const } painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setRenderHint(QPainter::Antialiasing, true); - painter.setPen(QPen(Qt::black, toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter.setPen(QPen(Qt::black, qApp->toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setBrush ( QBrush ( Qt::NoBrush ) ); tableScene->render(&painter); painter.end(); diff --git a/src/tools/drawTools/vabstractspline.cpp b/src/tools/drawTools/vabstractspline.cpp index c2fa77ae9..f3d8d4b32 100644 --- a/src/tools/drawTools/vabstractspline.cpp +++ b/src/tools/drawTools/vabstractspline.cpp @@ -54,7 +54,7 @@ void VAbstractSpline::ChangedActivDraw(const QString &newName) selectable = false; currentColor = Qt::gray; } - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); this->setAcceptHoverEvents (selectable); emit setEnabledPoint(selectable); @@ -75,13 +75,13 @@ void VAbstractSpline::SetFactor(qreal factor) void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor)); } void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); } QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) diff --git a/src/tools/drawTools/vdrawtool.h b/src/tools/drawTools/vdrawtool.h index f4c65ec44..801771591 100644 --- a/src/tools/drawTools/vdrawtool.h +++ b/src/tools/drawTools/vdrawtool.h @@ -196,7 +196,7 @@ protected: { currentColor = color; } - item->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + item->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); } } private: diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index 325a28ca4..789a51a1c 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -87,8 +87,8 @@ void VToolAlongLine::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); @@ -104,8 +104,8 @@ void VToolAlongLine::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); @@ -172,7 +172,7 @@ void VToolAlongLine::Create(const quint32 _id, const QString &pointName, const Q qreal result = cal.eval(formula, &errorMsg); if (errorMsg.isEmpty()) { - line.setLength(toPixel(result)); + line.setLength(qApp->toPixel(result)); quint32 id = _id; if (typeCreation == Valentina::FromGui) { diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index 4ba88dcff..b47f5d495 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -42,7 +42,7 @@ VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Valentina: path.addPath(arc->GetPath()); path.setFillRule( Qt::WindingFill ); this->setPath(path); - this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor)); + this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setAcceptHoverEvents(true); @@ -93,7 +93,7 @@ void VToolArc::Create(const quint32 _id, const quint32 ¢er, const QString &r qreal result = cal.eval(radius, &errorMsg); if (errorMsg.isEmpty()) { - calcRadius = toPixel(result); + calcRadius = qApp->toPixel(result); } errorMsg.clear(); @@ -155,7 +155,7 @@ void VToolArc::ChangedActivDraw(const QString &newName) selectable = false; currentColor = Qt::gray; } - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); this->setAcceptHoverEvents (selectable); VDrawTool::ChangedActivDraw(newName); @@ -218,14 +218,14 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor)); } //cppcheck-suppress unusedFunction void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); } void VToolArc::RemoveReferens() @@ -278,7 +278,7 @@ void VToolArc::SaveDialog(QDomElement &domElement) void VToolArc::RefreshGeometry() { - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); const VArc *arc = VAbstractTool::data.GeometricObject(id); QPainterPath path; path.addPath(arc->GetPath()); diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index 9e6147e18..3656b4d2c 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -115,7 +115,7 @@ void VToolBisector::Create(const quint32 _id, const QString &formula, const quin if (errorMsg.isEmpty()) { QPointF fPoint = VToolBisector::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), - thirdPoint->toQPointF(), toPixel(result)); + thirdPoint->toQPointF(), qApp->toPixel(result)); quint32 id = _id; if (typeCreation == Valentina::FromGui) { @@ -185,8 +185,8 @@ void VToolBisector::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); @@ -203,8 +203,8 @@ void VToolBisector::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index 9e830059f..1b8c7ca6f 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -98,7 +98,7 @@ void VToolCutArc::Create(const quint32 _id, const QString &pointName, const QStr { VArc arc1; VArc arc2; - QPointF point = arc->CutArc(toPixel(result), arc1, arc2); + QPointF point = arc->CutArc(qApp->toPixel(result), arc1, arc2); quint32 id = _id; quint32 arc1id = 0; @@ -185,8 +185,8 @@ void VToolCutArc::ChangedActivDraw(const QString &newName) secondArc->setFlag(QGraphicsItem::ItemIsSelectable, false); secondArc->setAcceptHoverEvents(false); } - firstArc->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); - secondArc->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + firstArc->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + secondArc->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); VToolPoint::ChangedActivDraw(newName); } @@ -208,8 +208,8 @@ void VToolCutArc::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrArc, arcId); @@ -224,8 +224,8 @@ void VToolCutArc::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrArc, arcId); } diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index fbebbf04a..89ee51eb6 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -98,7 +98,7 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, if (errorMsg.isEmpty()) { QPointF spl1p2, spl1p3, spl2p2, spl2p3; - QPointF point = spl->CutSpline(toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3); + QPointF point = spl->CutSpline(qApp->toPixel(result), spl1p2, spl1p3, spl2p2, spl2p3); quint32 id = _id; quint32 spl1id = 0; @@ -110,11 +110,11 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); spl1id = data->AddGObject(spline1); - data->AddLengthSpline(spline1->name(), fromPixel(spline1->GetLength())); + data->AddLengthSpline(spline1->name(), qApp->fromPixel(spline1->GetLength())); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); spl2id = data->AddGObject(spline2); - data->AddLengthSpline(spline2->name(), fromPixel(spline2->GetLength())); + data->AddLengthSpline(spline2->name(), qApp->fromPixel(spline2->GetLength())); } else { @@ -126,11 +126,11 @@ void VToolCutSpline::Create(const quint32 _id, const QString &pointName, VSpline *spline1 = new VSpline(spl->GetP1(), spl1p2, spl1p3, *p, spl->GetKcurve()); data->UpdateGObject(spl1id, spline1); - data->AddLengthSpline(spline1->name(), fromPixel(spline1->GetLength())); + data->AddLengthSpline(spline1->name(), qApp->fromPixel(spline1->GetLength())); VSpline *spline2 = new VSpline(*p, spl2p2, spl2p3, spl->GetP4(), spl->GetKcurve()); data->UpdateGObject(spl2id, spline2); - data->AddLengthSpline(spline2->name(), fromPixel(spline2->GetLength())); + data->AddLengthSpline(spline2->name(), qApp->fromPixel(spline2->GetLength())); if (parse != Document::FullParse) { @@ -204,8 +204,8 @@ void VToolCutSpline::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrSpline, splineId); @@ -220,8 +220,8 @@ void VToolCutSpline::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrSpline, splineId); } diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index f99b09179..eabb9ba70 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -102,7 +102,7 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con QPointF spl1p2, spl1p3, spl2p2, spl2p3; qint32 p1 = 0, p2 = 0; - const QPointF point = splPath->CutSplinePath(toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3); + const QPointF point = splPath->CutSplinePath(qApp->toPixel(result), p1, p2, spl1p2, spl1p3, spl2p2, spl2p3); VPointF *p = new VPointF(point.x(), point.y(), pointName, mx, my); if (typeCreation == Valentina::FromGui) { @@ -159,10 +159,10 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con splPath2->setMaxCountPoints(splPath->CountPoint()); splPath1id = data->AddGObject(splPath1); - data->AddLengthSpline(splPath1->name(), fromPixel(splPath1->GetLength())); + data->AddLengthSpline(splPath1->name(), qApp->fromPixel(splPath1->GetLength())); splPath2id = data->AddGObject(splPath2); - data->AddLengthSpline(splPath2->name(), fromPixel(splPath2->GetLength())); + data->AddLengthSpline(splPath2->name(), qApp->fromPixel(splPath2->GetLength())); } else { @@ -200,10 +200,10 @@ void VToolCutSplinePath::Create(const quint32 _id, const QString &pointName, con splPath2->setMaxCountPoints(splPath->CountPoint()); data->UpdateGObject(splPath1id, splPath1); - data->AddLengthSpline(splPath1->name(), fromPixel(splPath1->GetLength())); + data->AddLengthSpline(splPath1->name(), qApp->fromPixel(splPath1->GetLength())); data->UpdateGObject(splPath2id, splPath2); - data->AddLengthSpline(splPath2->name(), fromPixel(splPath2->GetLength())); + data->AddLengthSpline(splPath2->name(), qApp->fromPixel(splPath2->GetLength())); if (parse != Document::FullParse) { @@ -278,8 +278,8 @@ void VToolCutSplinePath::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrSplinePath, splinePathId); @@ -294,8 +294,8 @@ void VToolCutSplinePath::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrSplinePath, splinePathId); } diff --git a/src/tools/drawTools/vtoolendline.cpp b/src/tools/drawTools/vtoolendline.cpp index 81213c3cf..04a7201f4 100644 --- a/src/tools/drawTools/vtoolendline.cpp +++ b/src/tools/drawTools/vtoolendline.cpp @@ -89,7 +89,7 @@ void VToolEndLine::Create(const quint32 _id, const QString &pointName, const QSt qreal result = cal.eval(formula, &errorMsg); if (errorMsg.isEmpty()) { - line.setLength(toPixel(result)); + line.setLength(qApp->toPixel(result)); line.setAngle(angle); quint32 id = _id; if (typeCreation == Valentina::FromGui) @@ -151,8 +151,8 @@ void VToolEndLine::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); @@ -169,8 +169,8 @@ void VToolEndLine::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrAngle, angle); diff --git a/src/tools/drawTools/vtoolheight.cpp b/src/tools/drawTools/vtoolheight.cpp index 475d127aa..b662422fb 100644 --- a/src/tools/drawTools/vtoolheight.cpp +++ b/src/tools/drawTools/vtoolheight.cpp @@ -157,8 +157,8 @@ void VToolHeight::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrBasePoint, basePointId); @@ -176,8 +176,8 @@ void VToolHeight::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrBasePoint, basePointId); doc->SetAttribute(domElement, AttrP1Line, p1LineId); diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index b1a768007..78cdea854 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -45,7 +45,7 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setAcceptHoverEvents(true); - this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor, LineStyle())); + this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor, LineStyle())); if (typeCreation == Valentina::FromGui) { @@ -142,7 +142,7 @@ void VToolLine::ChangedActivDraw(const QString &newName) selectable = false; currentColor = Qt::gray; } - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle())); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle())); this->setAcceptHoverEvents (selectable); VDrawTool::ChangedActivDraw(newName); } @@ -177,13 +177,13 @@ void VToolLine::RefreshDataInFile() void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor, LineStyle())); + this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor, LineStyle())); } void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle())); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle())); } void VToolLine::RemoveReferens() @@ -245,5 +245,5 @@ void VToolLine::RefreshGeometry() const VPointF *first = VAbstractTool::data.GeometricObject(firstPoint); const VPointF *second = VAbstractTool::data.GeometricObject(secondPoint); this->setLine(QLineF(first->toQPointF(), second->toQPointF())); - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle())); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle())); } diff --git a/src/tools/drawTools/vtoollineintersect.cpp b/src/tools/drawTools/vtoollineintersect.cpp index 255ea5048..b607fcdf2 100644 --- a/src/tools/drawTools/vtoollineintersect.cpp +++ b/src/tools/drawTools/vtoollineintersect.cpp @@ -168,8 +168,8 @@ void VToolLineIntersect::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrP1Line1, p1Line1); doc->SetAttribute(domElement, AttrP2Line1, p2Line1); @@ -186,8 +186,8 @@ void VToolLineIntersect::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrP1Line1, p1Line1); doc->SetAttribute(domElement, AttrP2Line1, p2Line1); doc->SetAttribute(domElement, AttrP1Line2, p1Line2); diff --git a/src/tools/drawTools/vtoollinepoint.cpp b/src/tools/drawTools/vtoollinepoint.cpp index d9ced2f1a..e19aec719 100644 --- a/src/tools/drawTools/vtoollinepoint.cpp +++ b/src/tools/drawTools/vtoollinepoint.cpp @@ -39,7 +39,7 @@ VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &i QPointF point1 = data->GeometricObject(basePointId)->toQPointF(); QPointF point2 = data->GeometricObject(id)->toQPointF(); mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this); - mainLine->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor, LineStyle())); + mainLine->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor, LineStyle())); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); } @@ -53,13 +53,13 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName) { currentColor = Qt::gray; } - mainLine->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle())); + mainLine->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle())); VToolPoint::ChangedActivDraw(newName); } void VToolLinePoint::RefreshGeometry() { - mainLine->setPen(QPen(currentColor, toPixel(widthHairLine)/factor, LineStyle())); + mainLine->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle())); VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject(id)); QPointF point = VDrawTool::data.GeometricObject(id)->toQPointF(); QPointF basePoint = VDrawTool::data.GeometricObject(basePointId)->toQPointF(); diff --git a/src/tools/drawTools/vtoolnormal.cpp b/src/tools/drawTools/vtoolnormal.cpp index 1af5c1fa4..60c5e82d6 100644 --- a/src/tools/drawTools/vtoolnormal.cpp +++ b/src/tools/drawTools/vtoolnormal.cpp @@ -92,7 +92,7 @@ void VToolNormal::Create(const quint32 _id, const QString &formula, const quint3 if (errorMsg.isEmpty()) { QPointF fPoint = VToolNormal::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), - toPixel(result), angle); + qApp->toPixel(result), angle); quint32 id = _id; if (typeCreation == Valentina::FromGui) { @@ -171,8 +171,8 @@ void VToolNormal::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); @@ -190,8 +190,8 @@ void VToolNormal::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrAngle, angle); diff --git a/src/tools/drawTools/vtoolpoint.cpp b/src/tools/drawTools/vtoolpoint.cpp index 36fc194db..a2fe84741 100644 --- a/src/tools/drawTools/vtoolpoint.cpp +++ b/src/tools/drawTools/vtoolpoint.cpp @@ -31,7 +31,7 @@ const QString VToolPoint::TagName = QStringLiteral("point"); VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent):VDrawTool(doc, data, id), - QGraphicsEllipseItem(parent), radius(toPixel(2)), namePoint(0), lineName(0) + QGraphicsEllipseItem(parent), radius(qApp->toPixel(2)), namePoint(0), lineName(0) { namePoint = new VGraphicsSimpleTextItem(this); connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu); @@ -62,8 +62,8 @@ void VToolPoint::UpdateNamePosition(qreal mx, qreal my) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrMx, fromPixel(mx)); - doc->SetAttribute(domElement, AttrMy, fromPixel(my)); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(mx)); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(my)); emit toolhaveChange(); } } @@ -81,7 +81,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName) selectable = false; currentColor = Qt::gray; } - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); this->setAcceptHoverEvents (selectable); namePoint->setFlag(QGraphicsItem::ItemIsMovable, selectable); @@ -89,7 +89,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName) namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, selectable); namePoint->setBrush(QBrush(currentColor)); namePoint->setAcceptHoverEvents(selectable); - lineName->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + lineName->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); VDrawTool::ChangedActivDraw(newName); } @@ -121,18 +121,18 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthMainLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor)); } void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); } void VToolPoint::RefreshPointGeometry(const VPointF &point) { - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); QRectF rec = QRectF(0, 0, radius*2/factor, radius*2/factor); rec.translate(-rec.center().x(), -rec.center().y()); this->setRect(rec); @@ -158,13 +158,13 @@ void VToolPoint::RefreshLine() lineName->setLine(QLineF(p1, pRec - scenePos())); if (currentColor == Qt::gray) { - lineName->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + lineName->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); } else { - lineName->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor)); + lineName->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor)); } - if (QLineF(p1, pRec - scenePos()).length() <= toPixel(4)) + if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4)) { lineName->setVisible(false); } diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index 132be01d3..4f65ed382 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -117,7 +117,7 @@ void VToolPointOfContact::Create(const quint32 _id, const QString &radius, const qreal result = cal.eval(radius, &errorMsg); if (errorMsg.isEmpty()) { - QPointF fPoint = VToolPointOfContact::FindPoint(toPixel(result), centerP->toQPointF(), + QPointF fPoint = VToolPointOfContact::FindPoint(qApp->toPixel(result), centerP->toQPointF(), firstP->toQPointF(), secondP->toQPointF()); quint32 id = _id; if (typeCreation == Valentina::FromGui) @@ -191,8 +191,8 @@ void VToolPointOfContact::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrRadius, arcRadius); doc->SetAttribute(domElement, AttrCenter, center); @@ -209,8 +209,8 @@ void VToolPointOfContact::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrRadius, arcRadius); doc->SetAttribute(domElement, AttrCenter, center); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); diff --git a/src/tools/drawTools/vtoolpointofintersection.cpp b/src/tools/drawTools/vtoolpointofintersection.cpp index 8c94e118d..724999ede 100644 --- a/src/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/tools/drawTools/vtoolpointofintersection.cpp @@ -141,8 +141,8 @@ void VToolPointOfIntersection::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); @@ -157,8 +157,8 @@ void VToolPointOfIntersection::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); doc->SetAttribute(domElement, AttrSecondPoint, secondPointId); } diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 140c62550..e96df9315 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -120,7 +120,7 @@ void VToolShoulderPoint::Create(const quint32 _id, const QString &formula, const if (errorMsg.isEmpty()) { QPointF fPoint = VToolShoulderPoint::FindPoint(firstPoint->toQPointF(), secondPoint->toQPointF(), - shoulderPoint->toQPointF(), toPixel(result)); + shoulderPoint->toQPointF(), qApp->toPixel(result)); quint32 id = _id; if (typeCreation == Valentina::FromGui) { @@ -193,8 +193,8 @@ void VToolShoulderPoint::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); @@ -212,8 +212,8 @@ void VToolShoulderPoint::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrName, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrName, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrName, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrName, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrTypeLine, typeLine); doc->SetAttribute(domElement, AttrLength, formula); doc->SetAttribute(domElement, AttrP1Line, basePointId); diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index 1b86768f5..757aded00 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -69,10 +69,10 @@ void VToolSinglePoint::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrX, fromPixel(point->x())); - doc->SetAttribute(domElement, AttrY, fromPixel(point->y())); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrX, qApp->fromPixel(point->x())); + doc->SetAttribute(domElement, AttrY, qApp->fromPixel(point->y())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); AddToCalculation(domElement); } @@ -84,10 +84,10 @@ void VToolSinglePoint::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrX, QString().setNum(fromPixel(point->x()))); - doc->SetAttribute(domElement, AttrY, QString().setNum(fromPixel(point->y()))); - doc->SetAttribute(domElement, AttrMx, QString().setNum(fromPixel(point->mx()))); - doc->SetAttribute(domElement, AttrMy, QString().setNum(fromPixel(point->my()))); + doc->SetAttribute(domElement, AttrX, QString().setNum(qApp->fromPixel(point->x()))); + doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(point->y()))); + doc->SetAttribute(domElement, AttrMx, QString().setNum(qApp->fromPixel(point->mx()))); + doc->SetAttribute(domElement, AttrMy, QString().setNum(qApp->fromPixel(point->my()))); } } @@ -113,8 +113,8 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrX, QString().setNum(fromPixel(newPos.x()))); - doc->SetAttribute(domElement, AttrY, QString().setNum(fromPixel(newPos.y()))); + doc->SetAttribute(domElement, AttrX, QString().setNum(qApp->fromPixel(newPos.x()))); + doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(newPos.y()))); QList list = this->scene()->views(); VAbstractTool::NewSceneRect(this->scene(), list[0]); @@ -143,14 +143,14 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement) QPointF p = dialogTool->getPoint(); QString name = dialogTool->getName(); doc->SetAttribute(domElement, AttrName, name); - doc->SetAttribute(domElement, AttrX, QString().setNum(fromPixel(p.x()))); - doc->SetAttribute(domElement, AttrY, QString().setNum(fromPixel(p.y()))); + doc->SetAttribute(domElement, AttrX, QString().setNum(qApp->fromPixel(p.x()))); + doc->SetAttribute(domElement, AttrY, QString().setNum(qApp->fromPixel(p.y()))); } void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color) { namePoint->setBrush(color); - lineName->setPen(QPen(color, toPixel(widthHairLine)/factor)); + lineName->setPen(QPen(color, qApp->toPixel(widthHairLine)/factor)); } void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index 1f3c9599f..49c192724 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -40,7 +40,7 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Vale path.addPath(spl->GetPath()); path.setFillRule( Qt::WindingFill ); this->setPath(path); - this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor)); + this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setAcceptHoverEvents(true); @@ -115,12 +115,12 @@ void VToolSpline::Create(const quint32 _id, const quint32 &p1, const quint32 &p4 if (typeCreation == Valentina::FromGui) { id = data->AddGObject(spline); - data->AddLengthSpline(spline->name(), fromPixel(spline->GetLength())); + data->AddLengthSpline(spline->name(), qApp->fromPixel(spline->GetLength())); } else { data->UpdateGObject(id, spline); - data->AddLengthSpline(spline->name(), fromPixel(spline->GetLength())); + data->AddLengthSpline(spline->name(), qApp->fromPixel(spline->GetLength())); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); @@ -256,7 +256,7 @@ void VToolSpline::SaveDialog(QDomElement &domElement) void VToolSpline::RefreshGeometry() { - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); const VSpline *spl = VAbstractTool::data.GeometricObject(id); QPainterPath path; path.addPath(spl->GetPath()); diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index 28fc4a1ee..ac7a43dd7 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -39,7 +39,7 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co path.addPath(splPath->GetPath()); path.setFillRule( Qt::WindingFill ); this->setPath(path); - this->setPen(QPen(Qt::black, toPixel(widthHairLine)/factor)); + this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setAcceptHoverEvents(true); @@ -102,12 +102,12 @@ void VToolSplinePath::Create(const quint32 _id, VSplinePath *path, VMainGraphics if (typeCreation == Valentina::FromGui) { id = data->AddGObject(path); - data->AddLengthSpline(path->name(), fromPixel(path->GetLength())); + data->AddLengthSpline(path->name(), qApp->fromPixel(path->GetLength())); } else { data->UpdateGObject(id, path); - data->AddLengthSpline(path->name(), fromPixel(path->GetLength())); + data->AddLengthSpline(path->name(), qApp->fromPixel(path->GetLength())); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); @@ -284,7 +284,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement) void VToolSplinePath::RefreshGeometry() { - this->setPen(QPen(currentColor, toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); const VSplinePath *splPath = VAbstractTool::data.GeometricObject(id); QPainterPath path; path.addPath(splPath->GetPath()); diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index c86753455..2467d527f 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -197,8 +197,8 @@ void VToolTriangle::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrAxisP1, axisP1Id); doc->SetAttribute(domElement, AttrAxisP2, axisP2Id); @@ -215,8 +215,8 @@ void VToolTriangle::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrName, point->name()); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); doc->SetAttribute(domElement, AttrAxisP1, axisP1Id); doc->SetAttribute(domElement, AttrAxisP2, axisP2Id); doc->SetAttribute(domElement, AttrFirstPoint, firstPointId); diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index bf3e69c78..f8e84eb4b 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -29,6 +29,7 @@ #include "vnodearc.h" #include +#include "../../widgets/vapplication.h" const QString VNodeArc::TagName = QStringLiteral("arc"); const QString VNodeArc::ToolType = QStringLiteral("modeling"); @@ -38,7 +39,7 @@ VNodeArc::VNodeArc(VPattern *doc, VContainer *data, quint32 id, quint32 idArc, c :VAbstractNode(doc, data, id, idArc, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); - this->setPen(QPen(baseColor, toPixel(widthHairLine))); + this->setPen(QPen(baseColor, qApp->toPixel(widthHairLine))); if (typeCreation == Valentina::FromGui) { @@ -128,13 +129,13 @@ void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthMainLine))); + this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine))); } void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthHairLine))); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine))); } void VNodeArc::RefreshGeometry() diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index 92c7e2139..bdb6e7949 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -29,6 +29,7 @@ #include "vnodepoint.h" #include +#include "../../widgets/vapplication.h" const QString VNodePoint::TagName = QStringLiteral("point"); const QString VNodePoint::ToolType = QStringLiteral("modeling"); @@ -36,14 +37,14 @@ const QString VNodePoint::ToolType = QStringLiteral("modeling"); VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPoint, const Valentina::Sources &typeCreation, const quint32 &idTool, QObject *qoParent, QGraphicsItem *parent) - :VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(toPixel(1.5)), + :VAbstractNode(doc, data, id, idPoint, idTool, qoParent), QGraphicsEllipseItem(parent), radius(qApp->toPixel(1.5)), namePoint(nullptr), lineName(nullptr) { namePoint = new VGraphicsSimpleTextItem(this); lineName = new QGraphicsLineItem(this); connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VNodePoint::NameChangePosition); - this->setPen(QPen(Qt::black, toPixel(widthHairLine))); + this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); this->setBrush(QBrush(Qt::NoBrush)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); @@ -107,8 +108,8 @@ void VNodePoint::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrIdObject, idNode); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); if (idTool != 0) { doc->SetAttribute(domElement, AttrIdTool, idTool); @@ -124,8 +125,8 @@ void VNodePoint::RefreshDataInFile() if (domElement.isElement()) { doc->SetAttribute(domElement, AttrIdObject, idNode); - doc->SetAttribute(domElement, AttrMx, fromPixel(point->mx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(point->my())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(point->my())); if (idTool != 0) { doc->SetAttribute(domElement, AttrIdTool, idTool); @@ -145,13 +146,13 @@ void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthMainLine))); + this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine))); } void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthHairLine))); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine))); } @@ -171,8 +172,8 @@ void VNodePoint::UpdateNamePosition(qreal mx, qreal my) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrMx, QString().setNum(fromPixel(mx))); - doc->SetAttribute(domElement, AttrMy, QString().setNum(fromPixel(my))); + doc->SetAttribute(domElement, AttrMx, QString().setNum(qApp->fromPixel(mx))); + doc->SetAttribute(domElement, AttrMy, QString().setNum(qApp->fromPixel(my))); emit toolhaveChange(); } } @@ -200,7 +201,7 @@ void VNodePoint::RefreshLine() LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center()- scenePos()), p1, p2); QPointF pRec = LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center())); lineName->setLine(QLineF(p1, pRec - scenePos())); - if (QLineF(p1, pRec - scenePos()).length() <= toPixel(4)) + if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4)) { lineName->setVisible(false); } diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index 2661882c3..e20ee9078 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -29,6 +29,7 @@ #include "vnodespline.h" #include +#include "../../widgets/vapplication.h" const QString VNodeSpline::TagName = QStringLiteral("spline"); const QString VNodeSpline::ToolType = QStringLiteral("modelingSpline"); @@ -39,7 +40,7 @@ VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 id :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); - this->setPen(QPen(baseColor, toPixel(widthHairLine))); + this->setPen(QPen(baseColor, qApp->toPixel(widthHairLine))); if (typeCreation == Valentina::FromGui) { @@ -132,13 +133,13 @@ void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthMainLine))); + this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine))); } void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthHairLine))); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine))); } void VNodeSpline::RefreshGeometry() diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index 5008aa1bb..d3b6a436c 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -29,6 +29,7 @@ #include "vnodesplinepath.h" #include +#include "../../widgets/vapplication.h" const QString VNodeSplinePath::TagName = QStringLiteral("spline"); const QString VNodeSplinePath::ToolType = QStringLiteral("modelingPath"); @@ -39,7 +40,7 @@ VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, qu :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); - this->setPen(QPen(baseColor, toPixel(widthHairLine))); + this->setPen(QPen(baseColor, qApp->toPixel(widthHairLine))); if (typeCreation == Valentina::FromGui) { @@ -135,13 +136,13 @@ void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthMainLine))); + this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine))); } void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthHairLine))); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine))); } void VNodeSplinePath::RefreshGeometry() diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index 4415a0ac1..42c6caddb 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -230,8 +230,8 @@ void VToolDetail::AddToFile() doc->SetAttribute(domElement, AttrId, id); doc->SetAttribute(domElement, AttrName, detail.getName()); - doc->SetAttribute(domElement, AttrMx, fromPixel(detail.getMx())); - doc->SetAttribute(domElement, AttrMy, fromPixel(detail.getMy())); + doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(detail.getMx())); + doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(detail.getMy())); doc->SetAttribute(domElement, AttrSupplement, detail.getSeamAllowance()); doc->SetAttribute(domElement, AttrClosed, detail.getClosed()); doc->SetAttribute(domElement, AttrWidth, detail.getWidth()); @@ -277,8 +277,8 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - doc->SetAttribute(domElement, AttrMx, QString().setNum(fromPixel(newPos.x()))); - doc->SetAttribute(domElement, AttrMy, QString().setNum(fromPixel(newPos.y()))); + doc->SetAttribute(domElement, AttrMx, QString().setNum(qApp->fromPixel(newPos.x()))); + doc->SetAttribute(domElement, AttrMy, QString().setNum(qApp->fromPixel(newPos.y()))); QList list = this->scene()->views(); VAbstractTool::NewSceneRect(this->scene(), list[0]); @@ -370,8 +370,8 @@ void VToolDetail::AddNode(QDomElement &domElement, const VNodeDetail &node) QDomElement nod = doc->createElement(TagNode); doc->SetAttribute(nod, AttrIdObject, node.getId()); - doc->SetAttribute(nod, AttrMx, fromPixel(node.getMx())); - doc->SetAttribute(nod, AttrMy, fromPixel(node.getMy())); + doc->SetAttribute(nod, AttrMx, qApp->fromPixel(node.getMx())); + doc->SetAttribute(nod, AttrMy, qApp->fromPixel(node.getMy())); if (node.getTypeNode() == NodeDetail::Contour) { doc->SetAttribute(nod, AttrNodeType, NodeTypeContour); diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index 2d3d8b952..73efd7f9a 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -579,8 +579,8 @@ QVector VToolUnionDetails::GetDetailFromFile(VPattern *doc, const QDomE if (element.tagName() == VToolUnionDetails::TagNode) { quint32 id = doc->GetParametrUInt(element, VToolDetail::AttrIdObject, "0"); - qreal mx = toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); - qreal my = toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); + qreal mx = qApp->toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); + qreal my = qApp->toPixel(doc->GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); Valentina::Tools tool; NodeDetail::NodeDetails nodeType = NodeDetail::Contour; QString t = doc->GetParametrString(element, "type", "NodePoint"); @@ -657,8 +657,8 @@ void VToolUnionDetails::AddNode(QDomElement &domElement, const VNodeDetail &node QDomElement nod = doc->createElement(TagNode); doc->SetAttribute(nod, AttrIdObject, node.getId()); - doc->SetAttribute(nod, AttrMx, fromPixel(node.getMx())); - doc->SetAttribute(nod, AttrMy, fromPixel(node.getMy())); + doc->SetAttribute(nod, AttrMx, qApp->fromPixel(node.getMx())); + doc->SetAttribute(nod, AttrMy, qApp->fromPixel(node.getMy())); if (node.getTypeNode() == NodeDetail::Contour) { doc->SetAttribute(nod, AttrNodeType, NodeTypeContour); diff --git a/src/widgets/vapplication.cpp b/src/widgets/vapplication.cpp index 6686f8faf..5b0f4d494 100644 --- a/src/widgets/vapplication.cpp +++ b/src/widgets/vapplication.cpp @@ -36,12 +36,20 @@ #include #include +const qreal VApplication::PrintDPI = 96.0; + // reimplemented from QApplication so we can throw exceptions in slots +VApplication::VApplication(int &argc, char **argv) + : QApplication(argc, argv), _patternUnit(Valentina::Cm), _patternType(Pattern::Individual) +{ + +} + bool VApplication::notify(QObject *receiver, QEvent *event) { try { - return QApplication::notify(receiver, event); + return QApplication::notify(receiver, event); } catch (const VExceptionObjectError &e) { @@ -79,3 +87,83 @@ bool VApplication::notify(QObject *receiver, QEvent *event) } return false; } + +double VApplication::toPixel(double unit) const +{ + double result = 0; + switch (_patternUnit) + { + case Valentina::Mm: + result = (unit / 25.4) * PrintDPI; + break; + case Valentina::Cm: + result = ((unit * 10.0) / 25.4) * PrintDPI; + break; + case Valentina::In: + result = unit * PrintDPI; + break; + default: + break; + } + return result; +} + +double VApplication::fromPixel(double pix) const +{ + double result = 0; + switch (_patternUnit) + { + case Valentina::Mm: + result = (pix / PrintDPI) * 25.4; + break; + case Valentina::Cm: + result = ((pix / PrintDPI) * 25.4) / 10.0; + break; + case Valentina::In: + result = pix / PrintDPI; + break; + default: + break; + } + return result; +} +QString VApplication::pathToTables() const +{ + if (_patternType == Pattern::Individual) + { + #ifdef Q_OS_WIN + return QStringLiteral("/tables/individual"); + #else + #ifdef QT_DEBUG + return QStringLiteral("/tables/individual"); + #else + return QStringLiteral("/usr/share/valentina/tables/individual"); + #endif + #endif + } + else + { + #ifdef Q_OS_WIN + return QStringLiteral("/tables/standard"); + #else + #ifdef QT_DEBUG + return QStringLiteral("/tables/standard"); + #else + return QStringLiteral("/usr/share/valentina/tables/standard"); + #endif + #endif + } +} + +QString VApplication::translationsPath() const +{ + #ifdef Q_OS_WIN + return QStringLiteral("/translations"); + #else + #ifdef QT_DEBUG + return QStringLiteral("/translations"); + #else + return QStringLiteral("/usr/share/valentina/translations"); + #endif + #endif +} diff --git a/src/widgets/vapplication.h b/src/widgets/vapplication.h index 2320d3fe1..6d3b63eae 100644 --- a/src/widgets/vapplication.h +++ b/src/widgets/vapplication.h @@ -30,6 +30,14 @@ #define VAPPLICATION_H #include +#include "../options.h" + +class VApplication; + +#if defined(qApp) +#undef qApp +#endif +#define qApp (static_cast(QCoreApplication::instance())) /** * @brief The VApplication class reimplamentation QApplication class. @@ -43,7 +51,7 @@ public: * @param argc number arguments. * @param argv command line. */ - VApplication(int &argc, char ** argv): QApplication(argc, argv){} + VApplication(int &argc, char ** argv); virtual ~VApplication() {} /** * @brief notify Reimplemented from QApplication::notify(). @@ -52,6 +60,39 @@ public: * @return value that is returned from the receiver's event handler. */ virtual bool notify(QObject * receiver, QEvent * event); + Valentina::Units patternUnit() const; + void setPatternUnit(const Valentina::Units &patternUnit); + Pattern::Measurements patternType() const; + void setPatternType(const Pattern::Measurements &patternType); + double toPixel(double unit) const; + double fromPixel(double pix) const; + static const qreal PrintDPI; + QString translationsPath() const; + QString pathToTables() const; +private: + Valentina::Units _patternUnit; + Pattern::Measurements _patternType; }; +inline Valentina::Units VApplication::patternUnit() const +{ + return _patternUnit; +} + +inline void VApplication::setPatternUnit(const Valentina::Units &patternUnit) +{ + _patternUnit = patternUnit; +} + +inline Pattern::Measurements VApplication::patternType() const +{ + return _patternType; +} + +inline void VApplication::setPatternType(const Pattern::Measurements &patternType) +{ + _patternType = patternType; +} + + #endif // VAPPLICATION_H diff --git a/src/widgets/vcontrolpointspline.cpp b/src/widgets/vcontrolpointspline.cpp index ea4fc8459..2db37ee54 100644 --- a/src/widgets/vcontrolpointspline.cpp +++ b/src/widgets/vcontrolpointspline.cpp @@ -30,18 +30,19 @@ #include "../tools/vabstracttool.h" #include +#include "../widgets/vapplication.h" VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint::Position position, const QPointF &controlPoint, const QPointF &splinePoint, QGraphicsItem *parent) - :QGraphicsEllipseItem(parent), radius(toPixel(1.5)), controlLine(nullptr), indexSpline(indexSpline), + :QGraphicsEllipseItem(parent), radius(qApp->toPixel(1.5)), controlLine(nullptr), indexSpline(indexSpline), position(position) { //create circle QRectF rec = QRectF(0, 0, radius*2, radius*2); rec.translate(-rec.center().x(), -rec.center().y()); this->setRect(rec); - this->setPen(QPen(Qt::black, toPixel(widthHairLine))); + this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); this->setBrush(QBrush(Qt::NoBrush)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsMovable, true); @@ -52,20 +53,20 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint: QPointF p1, p2; VAbstractTool::LineIntersectCircle(QPointF(), radius, QLineF( QPointF(), splinePoint-controlPoint), p1, p2); controlLine = new QGraphicsLineItem(QLineF(splinePoint-controlPoint, p1), this); - controlLine->setPen(QPen(Qt::red, toPixel(widthHairLine))); + controlLine->setPen(QPen(Qt::red, qApp->toPixel(widthHairLine))); controlLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); } void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(Qt::black, toPixel(widthMainLine))); + this->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); } void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(Qt::black, toPixel(widthHairLine))); + this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); } QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) @@ -94,14 +95,14 @@ void VControlPointSpline::setEnabledPoint(bool enable) { if (enable == true) { - this->setPen(QPen(Qt::black, toPixel(widthHairLine))); + this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setAcceptHoverEvents(true); } else { - this->setPen(QPen(Qt::gray, toPixel(widthHairLine))); + this->setPen(QPen(Qt::gray, qApp->toPixel(widthHairLine))); this->setFlag(QGraphicsItem::ItemIsSelectable, false); this->setFlag(QGraphicsItem::ItemIsMovable, false); this->setAcceptHoverEvents(false); diff --git a/src/widgets/vitem.cpp b/src/widgets/vitem.cpp index 35332e4e0..5ef3d68da 100644 --- a/src/widgets/vitem.cpp +++ b/src/widgets/vitem.cpp @@ -27,10 +27,10 @@ *************************************************************************/ #include "vitem.h" -#include "../options.h" #include #include +#include "../widgets/vapplication.h" VItem::VItem (const QPainterPath & path, int numInList, QGraphicsItem * parent ) :QGraphicsPathItem ( path, parent ), numInOutList(numInList), paper(nullptr) @@ -63,19 +63,19 @@ void VItem::checkItemChange() QRectF myrect = sceneBoundingRect(); if ( rect.contains( myrect )==true ) { - setPen(QPen(Qt::black, toPixel(widthMainLine))); + setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); emit itemOut( numInOutList, false ); } else { - setPen(QPen(Qt::red, toPixel(widthMainLine))); + setPen(QPen(Qt::red, qApp->toPixel(widthMainLine))); emit itemOut( numInOutList, true ); } QList list = QGraphicsItem::collidingItems (); if ( list.size() - 2 > 0 ) { list.append( this ); - setPen(QPen(Qt::red, toPixel(widthMainLine))); + setPen(QPen(Qt::red, qApp->toPixel(widthMainLine))); emit itemColliding( list, 1 );//Detail intersect with other details. } else diff --git a/src/widgets/vsimplearc.cpp b/src/widgets/vsimplearc.cpp index 572bef916..68cb158e9 100644 --- a/src/widgets/vsimplearc.cpp +++ b/src/widgets/vsimplearc.cpp @@ -27,17 +27,18 @@ *************************************************************************/ #include "vsimplearc.h" +#include "../widgets/vapplication.h" VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) { if (factor == nullptr) { - setPen(QPen(Qt::black, toPixel(widthHairLine))); + setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); } else { - setPen(QPen(Qt::black, toPixel(widthHairLine)/ *factor)); + setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/ *factor)); } setFlag(QGraphicsItem::ItemIsSelectable, true); setAcceptHoverEvents(true); @@ -57,11 +58,11 @@ void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_UNUSED(event); if (factor == nullptr) { - this->setPen(QPen(*currentColor, toPixel(widthMainLine))); + this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine))); } else { - this->setPen(QPen(*currentColor, toPixel(widthMainLine)/ *factor)); + this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine)/ *factor)); } } @@ -70,10 +71,10 @@ void VSimpleArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_UNUSED(event); if (factor == nullptr) { - this->setPen(QPen(*currentColor, toPixel(widthHairLine))); + this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine))); } else { - this->setPen(QPen(*currentColor, toPixel(widthHairLine)/ *factor)); + this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine)/ *factor)); } } diff --git a/src/widgets/vsimplespline.cpp b/src/widgets/vsimplespline.cpp index c70488228..d3786517d 100644 --- a/src/widgets/vsimplespline.cpp +++ b/src/widgets/vsimplespline.cpp @@ -27,18 +27,18 @@ *************************************************************************/ #include "vsimplespline.h" -#include "../options.h" +#include "../widgets/vapplication.h" VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, QObject *parent) :QObject(parent), QGraphicsPathItem(), id (id), factor(factor), currentColor(currentColor) { if (factor == nullptr) { - setPen(QPen(Qt::black, toPixel(widthHairLine))); + setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); } else { - setPen(QPen(Qt::black, toPixel(widthHairLine)/ *factor)); + setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/ *factor)); } setFlag(QGraphicsItem::ItemIsSelectable, true); setAcceptHoverEvents(true); @@ -48,7 +48,7 @@ void VSimpleSpline::ChangedActivDraw(const bool &flag) { setFlag(QGraphicsItem::ItemIsSelectable, flag); setAcceptHoverEvents(flag); - setPen(QPen(*currentColor, toPixel(widthHairLine)/ *factor)); + setPen(QPen(*currentColor, qApp->toPixel(widthHairLine)/ *factor)); } void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) @@ -65,11 +65,11 @@ void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_UNUSED(event); if (factor == nullptr) { - this->setPen(QPen(*currentColor, toPixel(widthMainLine))); + this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine))); } else { - this->setPen(QPen(*currentColor, toPixel(widthMainLine)/ *factor)); + this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine)/ *factor)); } } @@ -78,10 +78,10 @@ void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_UNUSED(event); if (factor == nullptr) { - this->setPen(QPen(*currentColor, toPixel(widthHairLine))); + this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine))); } else { - this->setPen(QPen(*currentColor, toPixel(widthHairLine)/ *factor)); + this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine)/ *factor)); } } diff --git a/src/widgets/vsimplesplinepath.cpp b/src/widgets/vsimplesplinepath.cpp index 18393dd0f..ccd0021d5 100644 --- a/src/widgets/vsimplesplinepath.cpp +++ b/src/widgets/vsimplesplinepath.cpp @@ -27,6 +27,7 @@ *************************************************************************/ #include "vsimplesplinepath.h" +#include "../widgets/vapplication.h" VSimpleSplinePath::VSimpleSplinePath(VPattern *doc, VContainer *data, quint32 id, qreal *factor) :VAbstractTool(doc, data, id), factor(factor) @@ -45,11 +46,11 @@ void VSimpleSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthMainLine)/ *factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/ *factor)); } void VSimpleSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, toPixel(widthHairLine)/ *factor)); + this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/ *factor)); } diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index 5305c8ce0..61ab9a593 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -84,8 +84,8 @@ void VPattern::CreateEmptyFile(const QString &tablePath) patternElement.appendChild(createElement(TagNotes)); QDomElement measurements = createElement(TagMeasurements); - SetAttribute(measurements, "unit", patternUnit); - SetAttribute(measurements, "type", patternType); + SetAttribute(measurements, "unit", qApp->patternUnit()); + SetAttribute(measurements, "type", qApp->patternType()); SetAttribute(measurements, "path", tablePath); patternElement.appendChild(measurements); @@ -547,8 +547,8 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle VDetail detail; const quint32 id = GetParametrId(domElement); detail.setName(GetParametrString(domElement, VAbstractTool::AttrName, "")); - detail.setMx(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0"))); - detail.setMy(toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "0.0"))); + detail.setMx(qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "0.0"))); + detail.setMy(qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "0.0"))); detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1")); detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0")); detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1")); @@ -563,8 +563,8 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle if (element.tagName() == VToolDetail::TagNode) { const quint32 id = GetParametrUInt(element, VToolDetail::AttrIdObject, "0"); - const qreal mx = toPixel(GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); - const qreal my = toPixel(GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(element, VAbstractTool::AttrMx, "0.0")); + const qreal my = qApp->toPixel(GetParametrDouble(element, VAbstractTool::AttrMy, "0.0")); const NodeDetail::NodeDetails nodeType = NodeDetail::Contour; const QString t = GetParametrString(element, AttrType, "NodePoint"); @@ -650,10 +650,10 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, "A"); - const qreal x = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrX, "10.0")); - const qreal y = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0")); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal x = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrX, "10.0")); + const qreal y = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); data->UpdateGObject(id, new VPointF(x, y, name, mx, my)); VDrawTool::AddRecord(id, Valentina::SinglePointTool, this); @@ -685,8 +685,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); @@ -708,8 +708,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); @@ -731,8 +731,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); @@ -755,8 +755,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); @@ -779,8 +779,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "100.0"); @@ -803,8 +803,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const quint32 p1Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line1, "0"); const quint32 p2Line1Id = GetParametrUInt(domElement, VAbstractTool::AttrP2Line1, "0"); const quint32 p1Line2Id = GetParametrUInt(domElement, VAbstractTool::AttrP1Line2, "0"); @@ -825,8 +825,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString radius = GetParametrString(domElement, VAbstractTool::AttrRadius, "0"); const quint32 center = GetParametrUInt(domElement, VAbstractTool::AttrCenter, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); @@ -849,8 +849,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d const quint32 idObject = GetParametrUInt(domElement, VAbstractNode::AttrIdObject, "0"); const quint32 idTool = GetParametrUInt(domElement, VAbstractNode::AttrIdTool, "0"); const VPointF *point = data->GeometricObject(idObject ); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); data->UpdateGObject(id, new VPointF(point->x(), point->y(), point->name(), mx, my, idObject, Valentina::Modeling)); VNodePoint::Create(this, data, id, idObject, parse, Valentina::FromFile, idTool); @@ -867,8 +867,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString typeLine = GetParametrString(domElement, VAbstractTool::AttrTypeLine, VAbstractTool::TypeLineLine); const quint32 basePointId = GetParametrUInt(domElement, VAbstractTool::AttrBasePoint, "0"); @@ -890,8 +890,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const quint32 axisP1Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP1, "0"); const quint32 axisP2Id = GetParametrUInt(domElement, VAbstractTool::AttrAxisP2, "0"); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); @@ -912,8 +912,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const quint32 firstPointId = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, "0"); const quint32 secondPointId = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, "0"); @@ -932,8 +932,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); const quint32 splineId = GetParametrUInt(domElement, VToolCutSpline::AttrSpline, "0"); @@ -951,8 +951,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); const quint32 splinePathId = GetParametrUInt(domElement, VToolCutSplinePath::AttrSplinePath, "0"); @@ -971,8 +971,8 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, const QDomElement &d { const quint32 id = GetParametrId(domElement); const QString name = GetParametrString(domElement, VAbstractTool::AttrName, ""); - const qreal mx = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); - const qreal my = toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); + const qreal mx = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMx, "10.0")); + const qreal my = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrMy, "15.0")); const QString formula = GetParametrString(domElement, VAbstractTool::AttrLength, "0"); const quint32 arcId = GetParametrUInt(domElement, VToolCutArc::AttrArc, "0"); @@ -1246,7 +1246,7 @@ void VPattern::ParseIncrementsElement(const QDomNode &node) const qreal kgrowth = GetParametrDouble(domElement, IncrementKgrowth, "0"); const QString desc = GetParametrString(domElement, IncrementDescription, "Description"); data->UpdateId(id); - data->AddIncrementTableRow(name, VIncrementTableRow(id, base, ksize, kgrowth, desc)); + data->AddIncrement(name, VIncrement(id, base, ksize, kgrowth, desc)); } } } From 69309730ffa46f2cd609181331c7c06808dae003 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 21 Mar 2014 12:08:29 +0200 Subject: [PATCH 53/60] After this commit begin testing. --HG-- branch : feature --- src/container/vmeasurement.cpp | 23 +- src/container/vmeasurement.h | 37 ++- src/dialogs/app/dialogincrements.cpp | 305 ++++++++++-------- src/dialogs/app/dialogincrements.h | 8 +- .../app/dialogindividualmeasurements.cpp | 2 +- src/mainwindow.cpp | 5 +- src/tools/drawTools/vtoolalongline.cpp | 2 +- src/tools/drawTools/vtoolarc.cpp | 2 +- src/tools/drawTools/vtoolbisector.cpp | 2 +- src/tools/drawTools/vtoolcutarc.cpp | 2 +- src/tools/drawTools/vtoolcutspline.cpp | 2 +- src/tools/drawTools/vtoolcutsplinepath.cpp | 2 +- src/tools/drawTools/vtoolendline.cpp | 2 +- src/tools/drawTools/vtoolheight.cpp | 2 +- src/tools/drawTools/vtoolline.cpp | 2 +- src/tools/drawTools/vtoollineintersect.cpp | 2 +- src/tools/drawTools/vtoolnormal.cpp | 2 +- src/tools/drawTools/vtoolpointofcontact.cpp | 2 +- .../drawTools/vtoolpointofintersection.cpp | 2 +- src/tools/drawTools/vtoolshoulderpoint.cpp | 2 +- src/tools/drawTools/vtoolsinglepoint.cpp | 2 +- src/tools/drawTools/vtoolspline.cpp | 2 +- src/tools/drawTools/vtoolsplinepath.cpp | 2 +- src/tools/drawTools/vtooltriangle.cpp | 2 +- src/tools/nodeDetails/vnodearc.cpp | 2 +- src/tools/nodeDetails/vnodepoint.cpp | 2 +- src/tools/nodeDetails/vnodespline.cpp | 2 +- src/tools/nodeDetails/vnodesplinepath.cpp | 2 +- src/tools/vabstracttool.cpp | 1 - src/tools/vabstracttool.h | 1 - src/tools/vtooldetail.cpp | 2 +- src/tools/vtooluniondetails.cpp | 2 +- src/xml/vdomdocument.cpp | 12 +- src/xml/vdomdocument.h | 24 +- src/xml/vindividualmeasurements.cpp | 48 ++- src/xml/vindividualmeasurements.h | 11 + src/xml/vpattern.cpp | 84 ++++- src/xml/vpattern.h | 4 + src/xml/vstandardmeasurements.cpp | 53 +-- src/xml/vstandardmeasurements.h | 10 + 40 files changed, 443 insertions(+), 233 deletions(-) diff --git a/src/container/vmeasurement.cpp b/src/container/vmeasurement.cpp index 5f9b9b56f..3aa743ce6 100644 --- a/src/container/vmeasurement.cpp +++ b/src/container/vmeasurement.cpp @@ -29,14 +29,23 @@ #include "vmeasurement.h" VMeasurement::VMeasurement() - :base(0), ksize(50.0), kheight(176.0), gui_text(QString()), number(QString()){} + :base(0), ksize(50.0), kheight(176.0), gui_text(QString()), number(QString()), virtualM(false), + _tagName(QString()) +{ + +} VMeasurement::VMeasurement(const qreal &base, const qreal &ksize, const qreal &kgrowth, - const QString &gui_text, const QString &number) - :base(base), ksize(ksize), kheight(kgrowth), gui_text(gui_text), number(number){} + const QString &gui_text, const QString &number, const QString &tagName) + :base(base), ksize(ksize), kheight(kgrowth), gui_text(gui_text), number(number), virtualM(false), + _tagName(tagName) +{ -VMeasurement::VMeasurement(const qreal &base, const QString &gui_text, const QString &number) - :base(base), ksize(50.0), kheight(176.0), gui_text(gui_text), number(number) +} + +VMeasurement::VMeasurement(const qreal &base, const QString &gui_text, const QString &number, const QString &tagName) + :base(base), ksize(50.0), kheight(176.0), gui_text(gui_text), number(number), virtualM(false), + _tagName(tagName) { } @@ -52,3 +61,7 @@ qreal VMeasurement::GetValue(const qreal &size, const qreal &height) const const qreal k_height = ( height - 176.0 ) / 6.0; return base + k_size * ksize + k_height * kheight; } + + + + diff --git a/src/container/vmeasurement.h b/src/container/vmeasurement.h index 7942df8d7..4dab3e8f4 100644 --- a/src/container/vmeasurement.h +++ b/src/container/vmeasurement.h @@ -49,15 +49,17 @@ public: * @param description description of increment */ VMeasurement(const qreal &base, const qreal &ksize, const qreal &kheight, - const QString &gui_text = QString(), const QString &number = QString()); + const QString &gui_text = QString(), const QString &number = QString(), + const QString &TagName = QString()); VMeasurement(const qreal &base, const QString &gui_text = QString(), - const QString &number = QString()); + const QString &number = QString(), const QString &TagName = QString()); ~VMeasurement(){} /** * @brief GetBase return value in base size and growth * @return value */ qreal GetBase() const; + void setBase(const qreal &value); /** * @brief GetKsize return increment in sizes * @return increment @@ -76,6 +78,10 @@ public: QString GetNumber() const; qreal GetValue() const; qreal GetValue(const qreal &size, const qreal &height) const; + QString TagName() const; + void setTagName(const QString &TagName); + bool Virtual() const; + void setVirtual(bool value); private: /** * @brief base value in base size and growth @@ -94,6 +100,8 @@ private: */ QString gui_text; QString number; + bool virtualM; + QString _tagName; }; inline qreal VMeasurement::GetBase() const @@ -101,6 +109,11 @@ inline qreal VMeasurement::GetBase() const return base; } +inline void VMeasurement::setBase(const qreal &value) +{ + base = value; +} + inline qreal VMeasurement::GetKsize() const { return ksize; @@ -121,4 +134,24 @@ inline QString VMeasurement::GetNumber() const return number; } +inline QString VMeasurement::TagName() const +{ + return _tagName; +} + +inline void VMeasurement::setTagName(const QString &tagName) +{ + _tagName = tagName; +} + +inline bool VMeasurement::Virtual() const +{ + return virtualM; +} + +inline void VMeasurement::setVirtual(bool value) +{ + virtualM = value; +} + #endif // VSTANDARDTABLEROW_H diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index 963d7e8c4..549cc687f 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -33,17 +33,18 @@ #include "../../exception/vexception.h" #include +#include DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent) - :DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0) + :DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0), m(nullptr) { ui->setupUi(this); TextDelegate *textDelegate = new TextDelegate(ui->tableWidgetIncrement); - ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate); + ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);// name DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement); - ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate); - ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate); - ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate); + ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);// base value + ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate);// in sizes + ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate);// in heights if (qApp->patternType() == Pattern::Standard) { @@ -58,16 +59,15 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par } else { - ui->tableWidgetMeasurements->setColumnHidden( 1, true ); - ui->tableWidgetMeasurements->setColumnHidden( 3, true ); - ui->tableWidgetMeasurements->setColumnHidden( 4, true ); + ui->tableWidgetMeasurements->setColumnHidden( 1, true );// calculated value + ui->tableWidgetMeasurements->setColumnHidden( 3, true );// in sizes + ui->tableWidgetMeasurements->setColumnHidden( 4, true );// in heights - ui->tableWidgetIncrement->setColumnHidden( 1, true ); - ui->tableWidgetIncrement->setColumnHidden( 3, true ); - ui->tableWidgetIncrement->setColumnHidden( 4, true ); + ui->tableWidgetIncrement->setColumnHidden( 1, true );// calculated value + ui->tableWidgetIncrement->setColumnHidden( 3, true );// in sizes + ui->tableWidgetIncrement->setColumnHidden( 4, true );// in heights - ui->tableWidgetMeasurements->setItemDelegateForColumn(0, textDelegate); - ui->tableWidgetMeasurements->setItemDelegateForColumn(2, doubleDelegate); + ui->tableWidgetMeasurements->setItemDelegateForColumn(2, doubleDelegate);// base value connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementsChanged); } @@ -87,21 +87,66 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par connect(this->doc, &VPattern::FullUpdateFromFile, this, &DialogIncrements::FullUpdateFromFile); ui->tabWidget->setCurrentIndex(0); + + if (qApp->patternType() == Pattern::Individual) + { + QString filePath = doc->MPath(); + QFile file(filePath); + if (file.open(QIODevice::ReadOnly)) + { + try + { + VDomDocument::ValidatePattern("://schema/individual_measurements.xsd", filePath); + } + catch(VException &e) + { + qWarning()<<"Validation file error."<setContent(&file); + } + catch(VException &e) + { + qWarning()<<"Parsing measurements file error."< *table = data->DataMeasurements(); - qint32 currentRow = -1; QHashIterator i(*table); - ui->tableWidgetMeasurements->setRowCount ( table->size() ); + QMap map; + //Sorting QHash by id while (i.hasNext()) { i.next(); - VMeasurement m = i.value(); + map.insert(i.key(), i.value()); + } + qint32 currentRow = -1; + QMapIterator iMap(map); + ui->tableWidgetMeasurements->setRowCount ( table->size() ); + while (iMap.hasNext()) + { + iMap.next(); + VMeasurement m = iMap.value(); currentRow++; - QTableWidgetItem *item = new QTableWidgetItem(QString(i.key())); + QTableWidgetItem *item = new QTableWidgetItem(QString(iMap.key())); item->setTextAlignment(Qt::AlignHCenter); item->setFont(QFont("Times", 12, QFont::Bold)); item->setToolTip(m.GetDescription()); @@ -109,7 +154,7 @@ void DialogIncrements::FillMeasurements() if (qApp->patternType() == Pattern::Standard) { - QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(i.key()))); + QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(iMap.key()))); item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetMeasurements->setItem(currentRow, 1, item); } @@ -133,9 +178,9 @@ void DialogIncrements::FillMeasurements() item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetMeasurements->setItem(currentRow, 5, item); } + ui->tableWidgetMeasurements->verticalHeader()->setDefaultSectionSize(20); ui->tableWidgetMeasurements->resizeColumnsToContents(); ui->tableWidgetMeasurements->resizeRowsToContents(); - ui->tableWidgetMeasurements->verticalHeader()->setDefaultSectionSize(20); } void DialogIncrements::FillIncrements() @@ -305,21 +350,20 @@ void DialogIncrements::FillLengthArcs() item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetArcs->setItem(currentRow, 1, item); } + ui->tableWidgetArcs->verticalHeader()->setDefaultSectionSize(20); ui->tableWidgetArcs->resizeColumnsToContents(); ui->tableWidgetArcs->resizeRowsToContents(); - ui->tableWidgetArcs->verticalHeader()->setDefaultSectionSize(20); } void DialogIncrements::FullUpdateFromFile() { - disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, - &DialogIncrements::IncrementChanged); - ui->tableWidgetMeasurements->clearContents(); FillMeasurements(); + disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged); ui->tableWidgetIncrement->clearContents(); FillIncrements(); + connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged); ui->tableWidgetLines->clearContents(); FillLengthLines(); @@ -329,9 +373,6 @@ void DialogIncrements::FullUpdateFromFile() ui->tableWidgetArcs->clearContents(); FillLengthArcs(); - - connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, - &DialogIncrements::IncrementChanged); } void DialogIncrements::clickedToolButtonAdd() @@ -350,15 +391,12 @@ void DialogIncrements::clickedToolButtonAdd() num++; } while (data->IncrementTableContains(name)); - quint32 id = data->getNextId(); - qreal base = 0; - qreal ksize = 0; - qreal kgrowth = 0; - QString description = QString(tr("Description")); - VIncrement incr = VIncrement(id, base, ksize, kgrowth, description); + const quint32 id = data->getNextId(); + const QString description(tr("Description")); + VIncrement incr = VIncrement(id, 0, 0, 0, description); data->AddIncrement(name, incr); - AddIncrementToFile(id, name, base, ksize, kgrowth, description); + AddIncrementToFile(id, name, 0, 0, 0, description); QTableWidgetItem *item = new QTableWidgetItem(name); item->setTextAlignment(Qt::AlignHCenter); @@ -367,7 +405,7 @@ void DialogIncrements::clickedToolButtonAdd() ui->tableWidgetIncrement->setItem(currentRow, 0, item); ui->tableWidgetIncrement->setCurrentCell(currentRow, 0, QItemSelectionModel::ClearAndSelect); - item = new QTableWidgetItem("0"); + item = new QTableWidgetItem("0");// calculated value item->setTextAlignment(Qt::AlignHCenter); // set the item non-editable (view only), and non-selectable Qt::ItemFlags flags = item->flags(); @@ -375,19 +413,19 @@ void DialogIncrements::clickedToolButtonAdd() item->setFlags(flags); ui->tableWidgetIncrement->setItem(currentRow, 1, item); - item = new QTableWidgetItem("0"); + item = new QTableWidgetItem("0");// base value item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetIncrement->setItem(currentRow, 2, item); - item = new QTableWidgetItem("0"); + item = new QTableWidgetItem("0");// in sizes item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetIncrement->setItem(currentRow, 3, item); - item = new QTableWidgetItem("0"); + item = new QTableWidgetItem("0"); // in heights item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetIncrement->setItem(currentRow, 4, item); - item = new QTableWidgetItem(tr("Description")); + item = new QTableWidgetItem(description); item->setTextAlignment(Qt::AlignHCenter); ui->tableWidgetIncrement->setItem(currentRow, 5, item); @@ -409,7 +447,7 @@ void DialogIncrements::clickedToolButtonRemove() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement()) { - QDomNodeList list = doc->elementsByTagName("increments"); + QDomNodeList list = doc->elementsByTagName(VPattern::TagIncrements); list.at(0).removeChild(domElement); } ui->tableWidgetIncrement->removeRow(row); @@ -422,134 +460,115 @@ void DialogIncrements::clickedToolButtonRemove() emit haveLiteChange(); } -void DialogIncrements::AddIncrementToFile(quint32 id, QString name, qreal base, qreal ksize, qreal kgrowth, - QString description) +void DialogIncrements::AddIncrementToFile(const quint32 &id, const QString &name, const qreal &base, const qreal &ksize, + const qreal &kheight, const QString &description) { - QDomNodeList list = doc->elementsByTagName("increments"); - QDomElement element = doc->createElement("increment"); + QDomElement element = doc->createElement(VPattern::TagIncrement); - QDomAttr drawAttr = doc->createAttribute("id"); - drawAttr.setValue(QString().setNum(id)); - element.setAttributeNode(drawAttr); - - drawAttr = doc->createAttribute("name"); - drawAttr.setValue(name); - element.setAttributeNode(drawAttr); - - drawAttr = doc->createAttribute("base"); - drawAttr.setValue(QString().setNum(base)); - element.setAttributeNode(drawAttr); - - drawAttr = doc->createAttribute("ksize"); - drawAttr.setValue(QString().setNum(ksize)); - element.setAttributeNode(drawAttr); - - drawAttr = doc->createAttribute("kgrowth"); - drawAttr.setValue(QString().setNum(kgrowth)); - element.setAttributeNode(drawAttr); - - drawAttr = doc->createAttribute("description"); - drawAttr.setValue(description); - element.setAttributeNode(drawAttr); + doc->SetAttribute(element, VDomDocument::AttrId, id); + doc->SetAttribute(element, VPattern::IncrementName, name); + doc->SetAttribute(element, VPattern::IncrementBase, base); + doc->SetAttribute(element, VPattern::IncrementKsize, ksize); + doc->SetAttribute(element, VPattern::IncrementKgrowth, kheight); + doc->SetAttribute(element, VPattern::IncrementDescription, description); + QDomNodeList list = doc->elementsByTagName(VPattern::TagIncrements); list.at(0).appendChild(element); } void DialogIncrements::IncrementChanged ( qint32 row, qint32 column ) { - QTableWidgetItem *item = nullptr; - QTableWidgetItem *itemName = nullptr; - quint32 id; - QDomElement domElement; + + const QTableWidgetItem *itemName = ui->tableWidgetIncrement->item(row, 0); + const QTableWidgetItem *item = ui->tableWidgetIncrement->item(row, column); + const quint32 id = qvariant_cast(itemName->data(Qt::UserRole)); + QDomElement domElement = doc->elementById(QString().setNum(id)); + if (domElement.isElement() == false) + { + qWarning()<<"Cant't find increment with id = "<row = row; switch (column) { - case 0: // name - item = ui->tableWidgetIncrement->item(row, 0); - id = qvariant_cast(item->data(Qt::UserRole)); - domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute("name", item->text()); - data->ClearIncrementTable(); - this->column = 2; - emit FullUpdateTree(); - emit haveLiteChange(); - } + case 0: // VPattern::IncrementName + doc->SetAttribute(domElement, VPattern::IncrementName, item->text()); + data->ClearIncrementTable(); + this->column = 2; + emit FullUpdateTree(); break; - case 2: // base - itemName = ui->tableWidgetIncrement->item(row, 0); - item = ui->tableWidgetIncrement->item(row, column); - id = qvariant_cast(itemName->data(Qt::UserRole)); - domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - bool ok = false; - qreal value = item->text().replace(",", ".").toDouble(&ok); - if (ok) - { - domElement.setAttribute("base", value); - this->column = 3; - emit FullUpdateTree(); - emit haveLiteChange(); - } - else - { - throw VException(tr("Can't convert toDouble value.")); - } - } + case 2: // VPattern::IncrementBase + doc->SetAttribute(domElement, VPattern::IncrementBase, item->text()); + this->column = 3; + emit FullUpdateTree(); break; - case 3: // ksize - itemName = ui->tableWidgetIncrement->item(row, 0); - item = ui->tableWidgetIncrement->item(row, column); - id = qvariant_cast(itemName->data(Qt::UserRole)); - domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute("ksize", item->text().replace(",", ".").toDouble()); - this->column = 4; - emit FullUpdateTree(); - emit haveLiteChange(); - } + case 3: // VPattern::IncrementKsize + doc->SetAttribute(domElement, VPattern::IncrementKsize, item->text()); + this->column = 4; + emit FullUpdateTree(); break; - case 4: // kgrowth - itemName = ui->tableWidgetIncrement->item(row, 0); - item = ui->tableWidgetIncrement->item(row, column); - id = qvariant_cast(itemName->data(Qt::UserRole)); - domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute("kgrowth", item->text().replace(",", ".").toDouble()); - this->column = 5; - emit FullUpdateTree(); - emit haveLiteChange(); - } + case 4: // VPattern::IncrementKgrowth + doc->SetAttribute(domElement, VPattern::IncrementKgrowth, item->text()); + this->column = 5; + emit FullUpdateTree(); break; - case 5: // description - itemName = ui->tableWidgetIncrement->item(row, 0); - item = ui->tableWidgetIncrement->item(row, column); - id = qvariant_cast(itemName->data(Qt::UserRole)); - domElement = doc->elementById(QString().setNum(id)); - if (domElement.isElement()) - { - domElement.setAttribute("description", item->text()); - VIncrement incr = data->GetIncrement(itemName->text()); - incr.setDescription(item->text()); - data->UpdateIncrement(itemName->text(), incr); - ui->tableWidgetIncrement->resizeColumnsToContents(); - ui->tableWidgetIncrement->resizeRowsToContents(); - ui->tableWidgetIncrement->setCurrentCell( row, 0 ); - emit haveLiteChange(); - } + case 5: // VPattern::IncrementDescription + { + doc->SetAttribute(domElement, VPattern::IncrementDescription, item->text()); + VIncrement incr = data->GetIncrement(itemName->text()); + incr.setDescription(item->text()); + data->UpdateIncrement(itemName->text(), incr); + ui->tableWidgetIncrement->resizeColumnsToContents(); + ui->tableWidgetIncrement->resizeRowsToContents(); + this->column = 0; + ui->tableWidgetIncrement->setCurrentCell( row, this->column ); break; + } default: break; } + emit haveLiteChange(); } void DialogIncrements::MeasurementsChanged(qint32 row, qint32 column) { + const QTableWidgetItem *itemName = ui->tableWidgetMeasurements->item(row, 0); + QTableWidgetItem *item = ui->tableWidgetMeasurements->item(row, 2); + VMeasurement measur = data->GetMeasurement(itemName->text()); + const QString tag = measur.TagName(); + VIndividualMeasurements m(data); + QDomNodeList list = m.elementsByTagName(tag); + QDomElement domElement = list.at(0).toElement(); + if (domElement.isElement() == false) + { + qWarning()<<"Cant't find measurement "<text()); + bool ok = false; + const qreal base = item->text().replace(",", ".").toDouble(&ok); + if (ok == false) + { + measur.setBase(0); + item->setText("0"); + qWarning()<<"Can't convert toDouble measurement value"<UpdateMeasurement(itemName->text(), measur); + break; + } + default: + break; + } + emit haveLiteChange(); } void DialogIncrements::closeEvent(QCloseEvent *event) diff --git a/src/dialogs/app/dialogincrements.h b/src/dialogs/app/dialogincrements.h index bb8256880..eb920b00c 100644 --- a/src/dialogs/app/dialogincrements.h +++ b/src/dialogs/app/dialogincrements.h @@ -31,6 +31,7 @@ #include "../tools/dialogtool.h" #include "../../xml/vpattern.h" +#include "../../xml/vindividualmeasurements.h" namespace Ui { @@ -105,6 +106,7 @@ private: * @brief column save number of column current selected cell */ qint32 column; + VIndividualMeasurements *m; /** * @brief FillMeasurements load measurements data */ @@ -131,11 +133,11 @@ private: * @param name name * @param base base value * @param ksize increment in sizes - * @param kgrowth increment in growths + * @param kheight increment in heights * @param description description of increment */ - void AddIncrementToFile(quint32 id, QString name, qreal base, qreal ksize, qreal kgrowth, - QString description); + void AddIncrementToFile(const quint32 &id, const QString &name, const qreal &base, + const qreal &ksize, const qreal &kheight, const QString &description); }; #endif // DIALOGINCREMENTS_H diff --git a/src/dialogs/app/dialogindividualmeasurements.cpp b/src/dialogs/app/dialogindividualmeasurements.cpp index 96e2e0e06..e5cf13870 100644 --- a/src/dialogs/app/dialogindividualmeasurements.cpp +++ b/src/dialogs/app/dialogindividualmeasurements.cpp @@ -217,7 +217,7 @@ void DialogIndividualMeasurements::LoadIndividualTables() { try { - VDomDocument::ValidatePattern("://schema/standard_measurements.xsd", allFiles.at(i)); + VDomDocument::ValidatePattern("://schema/individual_measurements.xsd", allFiles.at(i)); } catch(VException &e) { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 873cb7bef..5a5afc784 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -49,8 +49,9 @@ MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), tool(Valentina::ArrowTool), currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr), mouseCoordinate(nullptr), helpLabel(nullptr), view(nullptr), isInitialized(false), dialogTable(0), dialogTool(nullptr), dialogHistory(nullptr), - comboBoxDraws(nullptr), curFile(QString()), mode(Valentina::Calculation), currentDrawIndex(0), currentToolBoxIndex(0), - drawMode(true), recentFileActs{0, 0, 0, 0, 0}, separatorAct(nullptr), autoSaveTimer(nullptr) + comboBoxDraws(nullptr), curFile(QString()), mode(Valentina::Calculation), currentDrawIndex(0), + currentToolBoxIndex(0), drawMode(true), recentFileActs{0, 0, 0, 0, 0}, separatorAct(nullptr), + autoSaveTimer(nullptr) { CreateActions(); CreateMenus(); diff --git a/src/tools/drawTools/vtoolalongline.cpp b/src/tools/drawTools/vtoolalongline.cpp index 789a51a1c..ac8e65204 100644 --- a/src/tools/drawTools/vtoolalongline.cpp +++ b/src/tools/drawTools/vtoolalongline.cpp @@ -84,7 +84,7 @@ void VToolAlongLine::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index b47f5d495..032ca5d9b 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -182,7 +182,7 @@ void VToolArc::AddToFile() const VArc *arc = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrCenter, arc->GetCenter().id()); doc->SetAttribute(domElement, AttrRadius, arc->GetFormulaRadius()); diff --git a/src/tools/drawTools/vtoolbisector.cpp b/src/tools/drawTools/vtoolbisector.cpp index 3656b4d2c..34bf702b6 100644 --- a/src/tools/drawTools/vtoolbisector.cpp +++ b/src/tools/drawTools/vtoolbisector.cpp @@ -182,7 +182,7 @@ void VToolBisector::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index 1b8c7ca6f..ef3ccad11 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -205,7 +205,7 @@ void VToolCutArc::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolcutspline.cpp b/src/tools/drawTools/vtoolcutspline.cpp index 89ee51eb6..9c0e88a96 100644 --- a/src/tools/drawTools/vtoolcutspline.cpp +++ b/src/tools/drawTools/vtoolcutspline.cpp @@ -201,7 +201,7 @@ void VToolCutSpline::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolcutsplinepath.cpp b/src/tools/drawTools/vtoolcutsplinepath.cpp index eabb9ba70..da87b2d83 100644 --- a/src/tools/drawTools/vtoolcutsplinepath.cpp +++ b/src/tools/drawTools/vtoolcutsplinepath.cpp @@ -275,7 +275,7 @@ void VToolCutSplinePath::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolendline.cpp b/src/tools/drawTools/vtoolendline.cpp index 04a7201f4..98603c373 100644 --- a/src/tools/drawTools/vtoolendline.cpp +++ b/src/tools/drawTools/vtoolendline.cpp @@ -148,7 +148,7 @@ void VToolEndLine::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolheight.cpp b/src/tools/drawTools/vtoolheight.cpp index b662422fb..5a0640718 100644 --- a/src/tools/drawTools/vtoolheight.cpp +++ b/src/tools/drawTools/vtoolheight.cpp @@ -154,7 +154,7 @@ void VToolHeight::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index 78cdea854..143022e42 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -155,7 +155,7 @@ void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolLine::AddToFile() { QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrFirstPoint, firstPoint); doc->SetAttribute(domElement, AttrSecondPoint, secondPoint); doc->SetAttribute(domElement, AttrTypeLine, typeLine); diff --git a/src/tools/drawTools/vtoollineintersect.cpp b/src/tools/drawTools/vtoollineintersect.cpp index b607fcdf2..9598a3873 100644 --- a/src/tools/drawTools/vtoollineintersect.cpp +++ b/src/tools/drawTools/vtoollineintersect.cpp @@ -165,7 +165,7 @@ void VToolLineIntersect::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolnormal.cpp b/src/tools/drawTools/vtoolnormal.cpp index 60c5e82d6..83b00e6af 100644 --- a/src/tools/drawTools/vtoolnormal.cpp +++ b/src/tools/drawTools/vtoolnormal.cpp @@ -168,7 +168,7 @@ void VToolNormal::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolpointofcontact.cpp b/src/tools/drawTools/vtoolpointofcontact.cpp index 4f65ed382..b1221b45e 100644 --- a/src/tools/drawTools/vtoolpointofcontact.cpp +++ b/src/tools/drawTools/vtoolpointofcontact.cpp @@ -188,7 +188,7 @@ void VToolPointOfContact::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolpointofintersection.cpp b/src/tools/drawTools/vtoolpointofintersection.cpp index 724999ede..c66fc0c04 100644 --- a/src/tools/drawTools/vtoolpointofintersection.cpp +++ b/src/tools/drawTools/vtoolpointofintersection.cpp @@ -138,7 +138,7 @@ void VToolPointOfIntersection::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index e96df9315..255fd6bfe 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -190,7 +190,7 @@ void VToolShoulderPoint::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index 757aded00..b723bff54 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -66,7 +66,7 @@ void VToolSinglePoint::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrX, qApp->fromPixel(point->x())); diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index 49c192724..6c545c5ee 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -176,7 +176,7 @@ void VToolSpline::AddToFile() const VSpline *spl = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrPoint1, spl->GetP1().id()); doc->SetAttribute(domElement, AttrPoint4, spl->GetP4().id()); diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index ac7a43dd7..50586b9b6 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -214,7 +214,7 @@ void VToolSplinePath::AddToFile() VSplinePath splPath = *VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrKCurve, splPath.getKCurve()); diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index 2467d527f..5fb1a7a0f 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -194,7 +194,7 @@ void VToolTriangle::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrName, point->name()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/nodeDetails/vnodearc.cpp b/src/tools/nodeDetails/vnodearc.cpp index f8e84eb4b..c115458f6 100644 --- a/src/tools/nodeDetails/vnodearc.cpp +++ b/src/tools/nodeDetails/vnodearc.cpp @@ -93,7 +93,7 @@ void VNodeArc::AddToFile() { QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrIdObject, idNode); if (idTool != 0) diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index bdb6e7949..25126cf02 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -105,7 +105,7 @@ void VNodePoint::AddToFile() const VPointF *point = VAbstractTool::data.GeometricObject(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrIdObject, idNode); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(point->mx())); diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index e20ee9078..3ffd0ad8f 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -97,7 +97,7 @@ void VNodeSpline::AddToFile() { QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrIdObject, idNode); if (idTool != 0) diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index d3b6a436c..5c3c208b8 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -100,7 +100,7 @@ void VNodeSplinePath::AddToFile() { QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrIdObject, idNode); if (idTool != 0) diff --git a/src/tools/vabstracttool.cpp b/src/tools/vabstracttool.cpp index 81337c83d..b61174d58 100644 --- a/src/tools/vabstracttool.cpp +++ b/src/tools/vabstracttool.cpp @@ -28,7 +28,6 @@ #include "vabstracttool.h" -const QString VAbstractTool::AttrId = QStringLiteral("id"); const QString VAbstractTool::AttrType = QStringLiteral("type"); const QString VAbstractTool::AttrMx = QStringLiteral("mx"); const QString VAbstractTool::AttrMy = QStringLiteral("my"); diff --git a/src/tools/vabstracttool.h b/src/tools/vabstracttool.h index 430d2d290..74cb53a17 100644 --- a/src/tools/vabstracttool.h +++ b/src/tools/vabstracttool.h @@ -102,7 +102,6 @@ public: * @param c c value */ static void LineCoefficients(const QLineF &line, qreal *a, qreal *b, qreal *c); - static const QString AttrId; static const QString AttrType; static const QString AttrMx; static const QString AttrMy; diff --git a/src/tools/vtooldetail.cpp b/src/tools/vtooldetail.cpp index 42c6caddb..641cf5ab7 100644 --- a/src/tools/vtooldetail.cpp +++ b/src/tools/vtooldetail.cpp @@ -228,7 +228,7 @@ void VToolDetail::AddToFile() VDetail detail = VAbstractTool::data.GetDetail(id); QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrName, detail.getName()); doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(detail.getMx())); doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(detail.getMy())); diff --git a/src/tools/vtooluniondetails.cpp b/src/tools/vtooluniondetails.cpp index 73efd7f9a..aebabf4a4 100644 --- a/src/tools/vtooluniondetails.cpp +++ b/src/tools/vtooluniondetails.cpp @@ -615,7 +615,7 @@ void VToolUnionDetails::AddToFile() { QDomElement domElement = doc->createElement(TagName); - doc->SetAttribute(domElement, AttrId, id); + doc->SetAttribute(domElement, VDomDocument::AttrId, id); doc->SetAttribute(domElement, AttrType, ToolType); doc->SetAttribute(domElement, AttrIndexD1, indexD1); doc->SetAttribute(domElement, AttrIndexD2, indexD2); diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index bff6d5c19..a6464c53d 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -77,6 +77,12 @@ inline qint64 MessageHandler::column() const return m_sourceLocation.column(); } +const QString VDomDocument::AttrId = QStringLiteral("id"); +const QString VDomDocument::AttrUnit = QStringLiteral("unit"); +const QString VDomDocument::UnitMM = QStringLiteral("mm"); +const QString VDomDocument::UnitCM = QStringLiteral("cm"); +const QString VDomDocument::UnitIN = QStringLiteral("in"); + VDomDocument::VDomDocument(VContainer *data) : QDomDocument(), data(data), map(QHash()) { @@ -122,9 +128,9 @@ void VDomDocument::removeAllChilds(QDomElement &element) bool VDomDocument::find(const QDomElement &node, const QString& id) { - if (node.hasAttribute("id")) + if (node.hasAttribute(AttrId)) { - const QString value = node.attribute("id"); + const QString value = node.attribute(AttrId); this->map[value] = node; if (value == id) { @@ -311,7 +317,7 @@ void VDomDocument::setContent(QIODevice *dev) Valentina::Units VDomDocument::Units(const QString &unit) { QStringList units; - units << "mm" << "cm" << "in"; + units << UnitMM << UnitCM << UnitIN; Valentina::Units result = Valentina::Cm; switch (units.indexOf(unit)) { diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index bfe95376c..6692d0760 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -47,6 +47,11 @@ class VDomDocument : public QDomDocument { Q_DECLARE_TR_FUNCTIONS(VDomDocument) public: + static const QString AttrId; + static const QString AttrUnit; + static const QString UnitMM; + static const QString UnitCM; + static const QString UnitIN; /** * @brief VDomDocument constructor. * @param data container with variables. @@ -162,13 +167,20 @@ template <> inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, const Valentina::Units &value) { - if (value == Valentina::Cm || value == Valentina::Mm) + switch(value) { - domElement.setAttribute(name, "cm"); - } - else - { - domElement.setAttribute(name, "in"); + case Valentina::Mm: + domElement.setAttribute(name, "mm"); + break; + case Valentina::Cm: + domElement.setAttribute(name, "cm"); + break; + case Valentina::In: + domElement.setAttribute(name, "in"); + break; + default: + domElement.setAttribute(name, "cm"); + break; } } diff --git a/src/xml/vindividualmeasurements.cpp b/src/xml/vindividualmeasurements.cpp index e474fd179..375e56198 100644 --- a/src/xml/vindividualmeasurements.cpp +++ b/src/xml/vindividualmeasurements.cpp @@ -28,13 +28,25 @@ #include "vindividualmeasurements.h" +const QString VIndividualMeasurements::AttrIgnore = QStringLiteral("ignore"); +const QString VIndividualMeasurements::AttrName = QStringLiteral("name"); +const QString VIndividualMeasurements::AttrM_number = QStringLiteral("m_number"); +const QString VIndividualMeasurements::AttrGui_text = QStringLiteral("gui_text"); +const QString VIndividualMeasurements::AttrValue = QStringLiteral("value"); +const QString VIndividualMeasurements::AttrDescription = QStringLiteral("description"); +const QString VIndividualMeasurements::AttrLang = QStringLiteral("lang"); +const QString VIndividualMeasurements::AttrFamily_name = QStringLiteral("family-name"); +const QString VIndividualMeasurements::AttrGiven_name = QStringLiteral("given-name"); +const QString VIndividualMeasurements::AttrBirth_date = QStringLiteral("birth-date"); +const QString VIndividualMeasurements::AttrSex = QStringLiteral("sex"); + VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data) { } Valentina::Units VIndividualMeasurements::Unit() { - const QString unit = UniqueTagText("unit", "cm"); + const QString unit = UniqueTagText(AttrUnit, UnitCM); return VDomDocument::Units(unit); } @@ -145,24 +157,24 @@ void VIndividualMeasurements::Measurement(const QString &tag) const QDomElement domElement = domNode.toElement(); if (domElement.isNull() == false) { - const bool ignore = QVariant(GetParametrString(domElement, "ignore", "false")).toBool(); + const bool ignore = QVariant(GetParametrString(domElement, AttrIgnore, "false")).toBool(); if (ignore) { return; } - const QString name = GetParametrString(domElement, "name", ""); + const QString name = GetParametrString(domElement, AttrName, ""); if (name.isEmpty()) { return; } - const QString m_number = GetParametrString(domElement, "m_number", ""); - const QString gui_text = GetParametrString(domElement, "gui_text", ""); - const qreal value = GetParametrDouble(domElement, "value", "0.0"); - const QString description = GetParametrString(domElement, "description", ""); + const QString m_number = GetParametrString(domElement, AttrM_number, ""); + const QString gui_text = GetParametrString(domElement, AttrGui_text, ""); + const qreal value = GetParametrDouble(domElement, AttrValue, "0.0"); + const QString description = GetParametrString(domElement, AttrDescription, ""); if (Unit() == Valentina::Mm)//Convert to Cm. { - data->AddMeasurement(name, VMeasurement(value/10.0, gui_text, description)); + data->AddMeasurement(name, VMeasurement(value/10.0, gui_text, description, tag)); if (m_number.isEmpty()) { qWarning()<<"Can't find language-independent measurement name for "<< tag; @@ -170,12 +182,14 @@ void VIndividualMeasurements::Measurement(const QString &tag) } else { - data->AddMeasurement(m_number, VMeasurement(value/10.0, gui_text, description)); + VMeasurement m(value/10.0, gui_text, description, tag); + m.setVirtual(true); + data->AddMeasurement(m_number, m); } } else//Cm or inch. { - data->AddMeasurement(name, VMeasurement(value, gui_text, description)); + data->AddMeasurement(name, VMeasurement(value, gui_text, description, tag)); if (m_number.isEmpty()) { qWarning()<<"Can't find language-independent measurement name for "<< tag; @@ -183,7 +197,9 @@ void VIndividualMeasurements::Measurement(const QString &tag) } else { - data->AddMeasurement(m_number, VMeasurement(value, gui_text, description)); + VMeasurement m(value, gui_text, description, tag); + m.setVirtual(true); + data->AddMeasurement(m_number, m); } } } @@ -193,25 +209,25 @@ void VIndividualMeasurements::Measurement(const QString &tag) QString VIndividualMeasurements::Language() { - return UniqueTagText("lang", "en"); + return UniqueTagText(AttrLang, "en"); } QString VIndividualMeasurements::FamilyName() { - return UniqueTagText("family-name", ""); + return UniqueTagText(AttrFamily_name, ""); } QString VIndividualMeasurements::GivenName() { - return UniqueTagText("given-name", ""); + return UniqueTagText(AttrGiven_name, ""); } QString VIndividualMeasurements::BirthDate() { - return UniqueTagText("birth-date", ""); + return UniqueTagText(AttrBirth_date, ""); } QString VIndividualMeasurements::Sex() { - return UniqueTagText("sex", ""); + return UniqueTagText(AttrSex, ""); } diff --git a/src/xml/vindividualmeasurements.h b/src/xml/vindividualmeasurements.h index 55931039d..d2742c289 100644 --- a/src/xml/vindividualmeasurements.h +++ b/src/xml/vindividualmeasurements.h @@ -43,6 +43,17 @@ public: QString GivenName(); QString BirthDate(); QString Sex(); + static const QString AttrIgnore; + static const QString AttrName; + static const QString AttrM_number; + static const QString AttrGui_text; + static const QString AttrValue; + static const QString AttrDescription; + static const QString AttrLang; + static const QString AttrFamily_name; + static const QString AttrGiven_name; + static const QString AttrBirth_date; + static const QString AttrSex; }; #endif // VINDIVIDUALMEASUREMENTS_H diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index 61ab9a593..b236a987b 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -57,6 +57,7 @@ const QString VPattern::TagTools = QStringLiteral("tools"); const QString VPattern::AttrName = QStringLiteral("name"); const QString VPattern::AttrType = QStringLiteral("type"); +const QString VPattern::AttrPath = QStringLiteral("path"); const QString VPattern::IncrementName = QStringLiteral("name"); const QString VPattern::IncrementBase = QStringLiteral("base"); @@ -84,9 +85,9 @@ void VPattern::CreateEmptyFile(const QString &tablePath) patternElement.appendChild(createElement(TagNotes)); QDomElement measurements = createElement(TagMeasurements); - SetAttribute(measurements, "unit", qApp->patternUnit()); - SetAttribute(measurements, "type", qApp->patternType()); - SetAttribute(measurements, "path", tablePath); + SetAttribute(measurements, AttrUnit, qApp->patternUnit()); + SetAttribute(measurements, AttrType, qApp->patternType()); + SetAttribute(measurements, AttrPath, tablePath); patternElement.appendChild(measurements); patternElement.appendChild(createElement(TagIncrements)); @@ -412,6 +413,79 @@ bool VPattern::GetActivNodeElement(const QString &name, QDomElement &element) return false; } +QString VPattern::MPath() const +{ + QDomNodeList list = elementsByTagName(VPattern::TagMeasurements); + QDomElement element = list.at(0).toElement(); + if (element.isElement()) + { + return GetParametrString(element, AttrPath); + } + else + { + return QString(); + } +} + +Valentina::Units VPattern::MUnit() const +{ + QDomNodeList list = elementsByTagName(VPattern::TagMeasurements); + QDomElement element = list.at(0).toElement(); + if (element.isElement()) + { + QStringList units; + units << "mm" << "cm" << "in"; + QString unit = GetParametrString(element, AttrUnit); + switch(units.indexOf(unit)) + { + case 0:// mm + return Valentina::Mm; + break; + case 1:// cm + return Valentina::Cm; + break; + case 2:// in + return Valentina::In; + break; + default: + return Valentina::Cm; + break; + } + } + else + { + return Valentina::Cm; + } +} + +Pattern::Measurements VPattern::MType() const +{ + QDomNodeList list = elementsByTagName(VPattern::TagMeasurements); + QDomElement element = list.at(0).toElement(); + if (element.isElement()) + { + QString type = GetParametrString(element, AttrType); + QStringList types; + types << "standard" << "individual"; + switch(types.indexOf(type)) + { + case 0:// standard + return Pattern::Standard; + break; + case 1:// individual + return Pattern::Individual; + break; + default: + return Pattern::Individual; + break; + } + } + else + { + return Pattern::Individual; + } +} + void VPattern::FullUpdateTree() { VMainGraphicsScene *scene = new VMainGraphicsScene(); @@ -1263,7 +1337,7 @@ quint32 VPattern::GetParametrId(const QDomElement &domElement) const QString message = tr("Got wrong parameter id. Need only id > 0."); try { - id = GetParametrUInt(domElement, VAbstractTool::AttrId, "0"); + id = GetParametrUInt(domElement, VDomDocument::AttrId, "0"); if (id <= 0) { throw VExceptionWrongId(message, domElement); @@ -1280,7 +1354,7 @@ quint32 VPattern::GetParametrId(const QDomElement &domElement) const void VPattern::CollectId(const QDomElement &node, QVector &vector) const { - if (node.hasAttribute(VAbstractTool::AttrId)) + if (node.hasAttribute(VDomDocument::AttrId)) { const quint32 id = GetParametrId(node); if (vector.contains(id)) diff --git a/src/xml/vpattern.h b/src/xml/vpattern.h index d51f6cd16..f1e559543 100644 --- a/src/xml/vpattern.h +++ b/src/xml/vpattern.h @@ -165,6 +165,9 @@ public: * @return true if found. */ bool GetActivNodeElement(const QString& name, QDomElement& element); + QString MPath() const; + Valentina::Units MUnit() const; + Pattern::Measurements MType() const; static const QString TagPattern; static const QString TagCalculation; static const QString TagModeling; @@ -183,6 +186,7 @@ public: static const QString TagTools; static const QString AttrName; static const QString AttrType; + static const QString AttrPath; static const QString IncrementName; static const QString IncrementBase; static const QString IncrementKsize; diff --git a/src/xml/vstandardmeasurements.cpp b/src/xml/vstandardmeasurements.cpp index cf146f807..204687dfb 100644 --- a/src/xml/vstandardmeasurements.cpp +++ b/src/xml/vstandardmeasurements.cpp @@ -29,19 +29,30 @@ #include "vstandardmeasurements.h" #include +const QString VStandardMeasurements::TagMeasurement = QStringLiteral("measurement"); +const QString VStandardMeasurements::TagDescription = QStringLiteral("description"); +const QString VStandardMeasurements::TagSize = QStringLiteral("size"); +const QString VStandardMeasurements::TagHeight = QStringLiteral("height"); +const QString VStandardMeasurements::AttrName = QStringLiteral("name"); +const QString VStandardMeasurements::AttrGui_text = QStringLiteral("gui_text"); +const QString VStandardMeasurements::AttrBase = QStringLiteral("base"); +const QString VStandardMeasurements::AttrSize_increace = QStringLiteral("size_increace"); +const QString VStandardMeasurements::AttrHeight_increase = QStringLiteral("height_increase"); +const QString VStandardMeasurements::AttrNumber = QStringLiteral("number"); + VStandardMeasurements::VStandardMeasurements(VContainer *data):VDomDocument(data) { } Valentina::Units VStandardMeasurements::Unit() { - const QString unit = UniqueTagText("unit", "cm"); + const QString unit = UniqueTagText(AttrUnit, UnitCM); return VDomDocument::Units(unit); } QString VStandardMeasurements::Description() { - const QString desc = UniqueTagText("description", ""); + const QString desc = UniqueTagText(TagDescription, ""); if (desc.isEmpty()) { qWarning()<<"Empty description in standard table."<elementsByTagName("measurement"); + const QDomNodeList nodeList = this->elementsByTagName(TagMeasurement); if (nodeList.isEmpty()) { qWarning()<<"Measurement list is empty"<AddMeasurement(name, VMeasurement(base/10.0, size_increace/10.0, height_increase/10.0, gui_text, number)); } - else//Cm or inch. + else// Cm or inch. { data->AddMeasurement(name, VMeasurement(base, size_increace, height_increase, gui_text, number)); @@ -96,7 +107,7 @@ void VStandardMeasurements::Measurements() void VStandardMeasurements::SetSize() { - const QDomNodeList nodeList = this->elementsByTagName("size"); + const QDomNodeList nodeList = this->elementsByTagName(TagSize); if (nodeList.isEmpty()) { data->SetSize(50); @@ -110,14 +121,14 @@ void VStandardMeasurements::SetSize() const QDomElement domElement = domNode.toElement(); if (domElement.isNull() == false) { - const QString name = GetParametrString(domElement, "name", "Сг"); - const qreal base = GetParametrDouble(domElement, "base", "50.0"); - if (Unit() == Valentina::Mm)//Convert to Cm. + const QString name = GetParametrString(domElement, AttrName, "Сг"); + const qreal base = GetParametrDouble(domElement, AttrBase, "50.0"); + if (Unit() == Valentina::Mm)// Convert to Cm. { data->SetSize(base/10.0); data->SetSizeName(name); } - else//Cm or inch. + else// Cm or inch. { data->SetSize(base); data->SetSizeName(name); @@ -129,7 +140,7 @@ void VStandardMeasurements::SetSize() void VStandardMeasurements::SetHeight() { - const QDomNodeList nodeList = this->elementsByTagName("height"); + const QDomNodeList nodeList = this->elementsByTagName(TagHeight); if (nodeList.isEmpty()) { data->SetHeight(176); @@ -143,14 +154,14 @@ void VStandardMeasurements::SetHeight() const QDomElement domElement = domNode.toElement(); if (domElement.isNull() == false) { - const QString name = GetParametrString(domElement, "name", "Р"); - const qreal base = GetParametrDouble(domElement, "base", "176.0"); - if (Unit() == Valentina::Mm)//Convert to Cm. + const QString name = GetParametrString(domElement, AttrName, "Р"); + const qreal base = GetParametrDouble(domElement, AttrBase, "176.0"); + if (Unit() == Valentina::Mm)// Convert to Cm. { data->SetHeight(base/10.0); data->SetHeightName(name); } - else//Cm or inch. + else// Cm or inch. { data->SetHeight(base); data->SetHeightName(name); diff --git a/src/xml/vstandardmeasurements.h b/src/xml/vstandardmeasurements.h index 327c32caa..822df44b0 100644 --- a/src/xml/vstandardmeasurements.h +++ b/src/xml/vstandardmeasurements.h @@ -41,6 +41,16 @@ public: void Measurements(); void SetSize(); void SetHeight(); + static const QString TagMeasurement; + static const QString TagDescription; + static const QString TagSize; + static const QString TagHeight; + static const QString AttrName; + static const QString AttrGui_text; + static const QString AttrBase; + static const QString AttrSize_increace; + static const QString AttrHeight_increase; + static const QString AttrNumber; public slots: void Update(); }; From 17bd0253a23e3adff8d93ab04d55905368dd9584 Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 23 Mar 2014 16:36:34 +0200 Subject: [PATCH 54/60] Saving pattern with standard table. --HG-- branch : feature --- .../app/dialogstandardmeasurements.cpp | 8 +++-- src/dialogs/app/dialogstandardmeasurements.ui | 30 +++++++++++++++---- src/dialogs/app/pages.cpp | 3 +- src/main.cpp | 4 +-- src/widgets/vapplication.cpp | 12 ++++---- src/xml/vpattern.cpp | 4 ++- 6 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/dialogs/app/dialogstandardmeasurements.cpp b/src/dialogs/app/dialogstandardmeasurements.cpp index d5e9d0ee9..36a061279 100644 --- a/src/dialogs/app/dialogstandardmeasurements.cpp +++ b/src/dialogs/app/dialogstandardmeasurements.cpp @@ -153,6 +153,7 @@ void DialogStandardMeasurements::LoadStandardTables() filters << "*.vst"; QDir tablesDir(qApp->pathToTables()); tablesDir.setNameFilters(filters); + tablesDir.setCurrent(qApp->pathToTables()); const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files); if (allFiles.isEmpty() == true) @@ -164,12 +165,13 @@ void DialogStandardMeasurements::LoadStandardTables() for (int i = 0; i < allFiles.size(); ++i) { + QFileInfo fi(allFiles.at(i)); QFile file(allFiles.at(i)); if (file.open(QIODevice::ReadOnly)) { try { - VDomDocument::ValidatePattern("://schema/standard_measurements.xsd", allFiles.at(i)); + VDomDocument::ValidatePattern("://schema/standard_measurements.xsd", fi.absoluteFilePath()); } catch(VException &e) { @@ -181,7 +183,7 @@ void DialogStandardMeasurements::LoadStandardTables() try { m.setContent(&file); - ui->comboBoxTables->addItem(m.Description(), QVariant(allFiles.at(i))); + ui->comboBoxTables->addItem(m.Description(), QVariant(fi.absoluteFilePath())); } catch(VException &e) { @@ -193,7 +195,7 @@ void DialogStandardMeasurements::LoadStandardTables() } else { - qWarning()< 0 0 - 439 - 247 + 452 + 115 @@ -19,11 +19,17 @@ - + 0 0 + + + 206 + 0 + + Pattern piece name @@ -33,7 +39,14 @@ - + + + + 0 + 0 + + + @@ -53,7 +66,14 @@ - + + + + 0 + 0 + + + diff --git a/src/dialogs/app/pages.cpp b/src/dialogs/app/pages.cpp index eb729b1d7..68b27a7c9 100644 --- a/src/dialogs/app/pages.cpp +++ b/src/dialogs/app/pages.cpp @@ -115,8 +115,7 @@ QGroupBox *ConfigurationPage::LangGroup() defaultLocale.truncate(defaultLocale.lastIndexOf('_')); // e.g. "de" QString checkedLocale = settings.value("configuration/locale", defaultLocale).toString(); - QString m_langPath = QApplication::applicationDirPath(); - m_langPath.append(qApp->translationsPath()); + QString m_langPath = qApp->translationsPath(); QDir dir(m_langPath); QStringList fileNames = dir.entryList(QStringList("valentina_*.qm")); diff --git a/src/main.cpp b/src/main.cpp index 9618e82c2..8b1711f86 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -84,10 +84,10 @@ int main(int argc, char *argv[]) QTranslator appTranslator; #ifdef Q_OS_WIN - appTranslator.load("valentina_" + checkedLocale, "."+qApp->translationsPath()); + appTranslator.load("valentina_" + checkedLocale, qApp->translationsPath()); #else #ifdef QT_DEBUG - appTranslator.load("valentina_" + checkedLocale, "."+qApp->translationsPath()); + appTranslator.load("valentina_" + checkedLocale, qApp->translationsPath()); #else appTranslator.load("valentina_" + checkedLocale, qApp->translationsPath()); #endif diff --git a/src/widgets/vapplication.cpp b/src/widgets/vapplication.cpp index 5b0f4d494..dd2ac8575 100644 --- a/src/widgets/vapplication.cpp +++ b/src/widgets/vapplication.cpp @@ -132,10 +132,10 @@ QString VApplication::pathToTables() const if (_patternType == Pattern::Individual) { #ifdef Q_OS_WIN - return QStringLiteral("/tables/individual"); + return QApplication::applicationDirPath() + QStringLiteral("/tables/individual"); #else #ifdef QT_DEBUG - return QStringLiteral("/tables/individual"); + return QApplication::applicationDirPath() + QStringLiteral("/tables/individual"); #else return QStringLiteral("/usr/share/valentina/tables/individual"); #endif @@ -144,10 +144,10 @@ QString VApplication::pathToTables() const else { #ifdef Q_OS_WIN - return QStringLiteral("/tables/standard"); + return QApplication::applicationDirPath() + QStringLiteral("/tables/standard"); #else #ifdef QT_DEBUG - return QStringLiteral("/tables/standard"); + return QApplication::applicationDirPath() + QStringLiteral("/tables/standard"); #else return QStringLiteral("/usr/share/valentina/tables/standard"); #endif @@ -158,10 +158,10 @@ QString VApplication::pathToTables() const QString VApplication::translationsPath() const { #ifdef Q_OS_WIN - return QStringLiteral("/translations"); + return QApplication::applicationDirPath() + QStringLiteral("/translations"); #else #ifdef QT_DEBUG - return QStringLiteral("/translations"); + return QApplication::applicationDirPath() + QStringLiteral("/translations"); #else return QStringLiteral("/usr/share/valentina/translations"); #endif diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index b236a987b..24ed010bb 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -201,7 +201,7 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene if (domElement.isNull() == false) { QStringList tags; - tags << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes; + tags << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes << TagMeasurements; switch (tags.indexOf(domElement.tagName())) { case 0: // TagDraw @@ -232,6 +232,8 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene break; case 4: // TagNotes break; + case 5: // TagMeasurements + break; default: qWarning()<<"Wrong tag name"< Date: Sun, 23 Mar 2014 19:04:45 +0200 Subject: [PATCH 55/60] Saving pattern with individual table. --HG-- branch : feature --- .../schema/individual_measurements.xsd | 93 ++++++++++++++++--- share/tables/individual/indivindual_ru.vit | 8 +- .../app/dialogindividualmeasurements.cpp | 42 +++++++-- .../app/dialogindividualmeasurements.ui | 86 +++++++++++++---- src/dialogs/app/dialogmeasurements.ui | 10 +- 5 files changed, 193 insertions(+), 46 deletions(-) diff --git a/share/resources/schema/individual_measurements.xsd b/share/resources/schema/individual_measurements.xsd index 98295c417..130b5b1cc 100644 --- a/share/resources/schema/individual_measurements.xsd +++ b/share/resources/schema/individual_measurements.xsd @@ -10,7 +10,7 @@ - + @@ -24,6 +24,7 @@ + @@ -33,6 +34,7 @@ + @@ -42,6 +44,7 @@ + @@ -51,6 +54,7 @@ + @@ -66,6 +70,7 @@ + @@ -75,6 +80,7 @@ + @@ -84,6 +90,7 @@ + @@ -93,15 +100,17 @@ + - + + @@ -111,6 +120,7 @@ + @@ -120,6 +130,7 @@ + @@ -129,6 +140,7 @@ + @@ -138,6 +150,7 @@ + @@ -147,6 +160,7 @@ + @@ -156,6 +170,7 @@ + @@ -165,6 +180,7 @@ + @@ -174,6 +190,7 @@ + @@ -183,6 +200,7 @@ + @@ -192,6 +210,7 @@ + @@ -201,6 +220,7 @@ + @@ -210,6 +230,7 @@ + @@ -219,6 +240,7 @@ + @@ -228,6 +250,7 @@ + @@ -237,6 +260,7 @@ + @@ -246,6 +270,7 @@ + @@ -255,6 +280,7 @@ + @@ -264,6 +290,7 @@ + @@ -273,6 +300,7 @@ + @@ -282,6 +310,7 @@ + @@ -291,6 +320,7 @@ + @@ -300,6 +330,7 @@ + @@ -309,6 +340,7 @@ + @@ -318,6 +350,7 @@ + @@ -327,6 +360,7 @@ + @@ -336,6 +370,7 @@ + @@ -345,6 +380,7 @@ + @@ -354,6 +390,7 @@ + @@ -363,6 +400,7 @@ + @@ -372,6 +410,7 @@ + @@ -381,6 +420,7 @@ + @@ -390,6 +430,7 @@ + @@ -399,6 +440,7 @@ + @@ -408,6 +450,7 @@ + @@ -417,6 +460,7 @@ + @@ -426,6 +470,7 @@ + @@ -435,6 +480,7 @@ + @@ -444,6 +490,7 @@ + @@ -453,6 +500,7 @@ + @@ -462,6 +510,7 @@ + @@ -477,6 +526,7 @@ + @@ -486,6 +536,7 @@ + @@ -495,6 +546,7 @@ + @@ -504,6 +556,7 @@ + @@ -513,6 +566,7 @@ + @@ -522,6 +576,7 @@ + @@ -531,6 +586,7 @@ + @@ -540,6 +596,7 @@ + @@ -549,6 +606,7 @@ + @@ -558,6 +616,7 @@ + @@ -573,6 +632,7 @@ + @@ -582,6 +642,7 @@ + @@ -591,6 +652,7 @@ + @@ -606,6 +668,7 @@ + @@ -615,6 +678,7 @@ + @@ -624,6 +688,7 @@ + @@ -633,6 +698,7 @@ + @@ -642,6 +708,7 @@ + @@ -651,6 +718,7 @@ + @@ -660,6 +728,7 @@ + @@ -675,6 +744,7 @@ + @@ -684,15 +754,7 @@ - - - - - - - - - + @@ -708,6 +770,7 @@ + @@ -717,6 +780,7 @@ + @@ -726,6 +790,7 @@ + @@ -735,6 +800,7 @@ + @@ -744,6 +810,7 @@ + @@ -753,6 +820,7 @@ + @@ -762,6 +830,7 @@ + @@ -771,6 +840,7 @@ + @@ -780,6 +850,7 @@ + diff --git a/share/tables/individual/indivindual_ru.vit b/share/tables/individual/indivindual_ru.vit index 796a317ab..29bbdc85b 100644 --- a/share/tables/individual/indivindual_ru.vit +++ b/share/tables/individual/indivindual_ru.vit @@ -1,10 +1,10 @@ ru - - - - + + + + mm diff --git a/src/dialogs/app/dialogindividualmeasurements.cpp b/src/dialogs/app/dialogindividualmeasurements.cpp index e5cf13870..4749fe567 100644 --- a/src/dialogs/app/dialogindividualmeasurements.cpp +++ b/src/dialogs/app/dialogindividualmeasurements.cpp @@ -100,7 +100,7 @@ void DialogIndividualMeasurements::DialogAccepted() { try { - VDomDocument::ValidatePattern("://schema/standard_measurements.xsd", _tablePath); + VDomDocument::ValidatePattern("://schema/individual_measurements.xsd", _tablePath); } catch(VException &e) { @@ -158,7 +158,7 @@ void DialogIndividualMeasurements::CheckState() ui->lineEditPathNewM->setEnabled(false); ui->toolButtonOpenNew->setEnabled(false); - ui->comboBoxLang->setEditable(false); + ui->comboBoxLang->setEnabled(false); if (ui->lineEditPathExistM->text().isEmpty() == false) { @@ -169,7 +169,7 @@ void DialogIndividualMeasurements::CheckState() { ui->lineEditPathNewM->setEnabled(true); ui->toolButtonOpenNew->setEnabled(true); - ui->comboBoxLang->setEditable(true); + ui->comboBoxLang->setEnabled(true); ui->toolButtonOpenExist->setEnabled(false); ui->lineEditPathExistM->setEnabled(false); @@ -201,6 +201,7 @@ void DialogIndividualMeasurements::LoadIndividualTables() filters << "*.vit"; QDir tablesDir(qApp->pathToTables()); tablesDir.setNameFilters(filters); + tablesDir.setCurrent(qApp->pathToTables()); const QStringList allFiles = tablesDir.entryList(QDir::NoDotAndDotDot | QDir::Files); if (allFiles.isEmpty() == true) @@ -212,12 +213,13 @@ void DialogIndividualMeasurements::LoadIndividualTables() for (int i = 0; i < allFiles.size(); ++i) { + QFileInfo fi(allFiles.at(i)); QFile file(allFiles.at(i)); if (file.open(QIODevice::ReadOnly)) { try { - VDomDocument::ValidatePattern("://schema/individual_measurements.xsd", allFiles.at(i)); + VDomDocument::ValidatePattern("://schema/individual_measurements.xsd", fi.absoluteFilePath()); } catch(VException &e) { @@ -230,7 +232,7 @@ void DialogIndividualMeasurements::LoadIndividualTables() { m.setContent(&file); const QString lang = QLocale(m.Language()).nativeLanguageName(); - ui->comboBoxLang->addItem(lang, QVariant(allFiles.at(i))); + ui->comboBoxLang->addItem(lang, QVariant(fi.absoluteFilePath())); } catch(VException &e) { @@ -242,7 +244,7 @@ void DialogIndividualMeasurements::LoadIndividualTables() } else { - qWarning()<comboBoxLang->findData(checkedLocale); if (index != -1) @@ -263,14 +266,36 @@ void DialogIndividualMeasurements::LoadIndividualTables() void DialogIndividualMeasurements::OpenTable() { const QString filter(tr("Individual measurements (*.vit)")); - const QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter); + QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter); + QFile file(fileName); + if (file.open(QIODevice::ReadOnly)) + { + try + { + VDomDocument::ValidatePattern("://schema/individual_measurements.xsd", fileName); + } + catch(VException &e) + { + e.CriticalMessageBox(tr("Validation file error."), this); + fileName.clear(); + } + file.close(); + } + else + { + QMessageBox::warning(this, tr("Valentina"), tr("Cannot read file %1:\n%2.").arg(fileName) + .arg(file.errorString())); + fileName.clear(); + } ui->lineEditPathExistM->setText(fileName); + ui->lineEditPathExistM->setToolTip(fileName); CheckState(); } void DialogIndividualMeasurements::NewTable() { - QString name = QFileDialog::getSaveFileName(this, tr("Where save measurements?"), QDir::homePath(), + QString dir = QDir::homePath()+"/measurements.vit"; + QString name = QFileDialog::getSaveFileName(this, tr("Where save measurements?"), dir, tr("Individual measurements (*.vit)")); if (name.isEmpty()) @@ -285,5 +310,6 @@ void DialogIndividualMeasurements::NewTable() name += ".vit"; } ui->lineEditPathNewM->setText(name); + ui->lineEditPathNewM->setToolTip(name); CheckState(); } diff --git a/src/dialogs/app/dialogindividualmeasurements.ui b/src/dialogs/app/dialogindividualmeasurements.ui index e711d4540..595c4acc1 100644 --- a/src/dialogs/app/dialogindividualmeasurements.ui +++ b/src/dialogs/app/dialogindividualmeasurements.ui @@ -6,14 +6,14 @@ 0 0 - 398 - 210 + 358 + 247 Dialog - + @@ -46,7 +46,18 @@ - + + + Path: + + + + + + + true + + @@ -65,7 +76,7 @@ - + @@ -80,24 +91,59 @@ - + - + + + + + Language: + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + - - - - - - ... - - - - - - - + + + + + Path: + + + + + + + + + + ... + + + + + + + + + diff --git a/src/dialogs/app/dialogmeasurements.ui b/src/dialogs/app/dialogmeasurements.ui index bf5a53bab..93ebb16e5 100644 --- a/src/dialogs/app/dialogmeasurements.ui +++ b/src/dialogs/app/dialogmeasurements.ui @@ -55,7 +55,7 @@ Graduation - + :/icon/Graduation.png:/icon/Graduation.png @@ -101,7 +101,7 @@ Individual - + :/icon/individual.png:/icon/individual.png @@ -128,8 +128,12 @@ + + toolButtonIndividual + toolButtonStandard + - + From 54cca86be5dc96a985b94c21a6de4898e617710f Mon Sep 17 00:00:00 2001 From: dismine Date: Mon, 24 Mar 2014 17:02:57 +0200 Subject: [PATCH 56/60] Opening empty pattern. --HG-- branch : feature --- Valentina.pro | 4 +- share/resources/schema/pattern.xsd | 13 +- src/dialogs/app/dialogincrements.cpp | 34 +-- .../app/dialogindividualmeasurements.cpp | 92 ++---- .../app/dialogstandardmeasurements.cpp | 71 +---- src/exception/vexception.cpp | 4 +- src/exception/vexception.h | 1 + src/mainwindow.cpp | 289 +++++++++++------- src/mainwindow.h | 1 + src/options.h | 2 +- src/widgets/vapplication.cpp | 4 +- src/xml/vdomdocument.cpp | 82 +++-- src/xml/vdomdocument.h | 35 +-- src/xml/vindividualmeasurements.cpp | 2 +- src/xml/vpattern.cpp | 43 ++- src/xml/vpattern.h | 3 +- src/xml/vstandardmeasurements.cpp | 2 +- 17 files changed, 342 insertions(+), 340 deletions(-) diff --git a/Valentina.pro b/Valentina.pro index c6ba0d871..9c5f07496 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -89,13 +89,13 @@ CONFIG(debug, debug|release){ } } else { *-g++{#Don't use additional GCC keys on Windows system. - QMAKE_CXXFLAGS += -Og -Wall -Wextra -pedantic + QMAKE_CXXFLAGS += -O0 -Wall -Wextra -pedantic } } }else{ # Release *-g++{ - QMAKE_CXXFLAGS += -O1 + QMAKE_CXXFLAGS += -O2 } DEFINES += QT_NO_DEBUG_OUTPUT diff --git a/share/resources/schema/pattern.xsd b/share/resources/schema/pattern.xsd index 78a444e41..cfc6524a5 100644 --- a/share/resources/schema/pattern.xsd +++ b/share/resources/schema/pattern.xsd @@ -4,9 +4,16 @@ - - - + + + + + + + + + + diff --git a/src/dialogs/app/dialogincrements.cpp b/src/dialogs/app/dialogincrements.cpp index 549cc687f..0f44d0e06 100644 --- a/src/dialogs/app/dialogincrements.cpp +++ b/src/dialogs/app/dialogincrements.cpp @@ -91,37 +91,17 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par if (qApp->patternType() == Pattern::Individual) { QString filePath = doc->MPath(); - QFile file(filePath); - if (file.open(QIODevice::ReadOnly)) + try { - try - { - VDomDocument::ValidatePattern("://schema/individual_measurements.xsd", filePath); - } - catch(VException &e) - { - qWarning()<<"Validation file error."<setContent(&file); - } - catch(VException &e) - { - qWarning()<<"Parsing measurements file error."<setContent(filePath); } - else + catch(VException &e) { - qWarning()<setPatternUnit( m.Unit()); - } - catch(VException &e) - { - e.CriticalMessageBox(tr("Parsing pattern file error."), this); - qWarning()<<"Parsing pattern file error."<setPatternUnit( m.Unit()); } - else + catch(VException &e) { - QString message = tr("Cannot read file %1:\n%2.").arg(_tablePath).arg(file.errorString()); - QMessageBox::warning(this, tr("Cannot read file"), message); - qWarning()<comboBoxLang->addItem(lang, QVariant(fi.absoluteFilePath())); - } - catch(VException &e) - { - qWarning()<<"Parsing pattern file error."<comboBoxLang->addItem(lang, QVariant(fi.absoluteFilePath())); } - else + catch(VException &e) { - qWarning()<lineEditPathExistM->setText(fileName); diff --git a/src/dialogs/app/dialogstandardmeasurements.cpp b/src/dialogs/app/dialogstandardmeasurements.cpp index 36a061279..e6af0ffea 100644 --- a/src/dialogs/app/dialogstandardmeasurements.cpp +++ b/src/dialogs/app/dialogstandardmeasurements.cpp @@ -77,40 +77,18 @@ void DialogStandardMeasurements::DialogAccepted() _name = ui->lineEditName->text(); const qint32 index = ui->comboBoxTables->currentIndex(); _tablePath = ui->comboBoxTables->itemData(index).toString(); - QFile file(_tablePath); - if (file.open(QIODevice::ReadOnly)) - { - try - { - VDomDocument::ValidatePattern("://schema/standard_measurements.xsd", _tablePath); - } - catch(VException &e) - { - e.CriticalMessageBox(tr("Validation file error."), this); - qWarning()<<"Validation file error."<setPatternUnit(m.Unit()); - } - catch(VException &e) - { - e.CriticalMessageBox(tr("Parsing pattern file error."), this); - qWarning()<<"Parsing pattern file error."<setPatternUnit(m.Unit()); } - else + catch(VException &e) { - QString message = tr("Cannot read file %1:\n%2.").arg(_tablePath).arg(file.errorString()); - QMessageBox::warning(this, tr("Cannot read file"), message); - qWarning()<comboBoxTables->addItem(m.Description(), QVariant(fi.absoluteFilePath())); - } - catch(VException &e) - { - qWarning()<<"Parsing pattern file error."<comboBoxTables->addItem(m.Description(), QVariant(fi.absoluteFilePath())); } - else + catch(VException &e) { - qWarning()< #include @@ -55,7 +56,6 @@ MainWindow::MainWindow(QWidget *parent) { CreateActions(); CreateMenus(); - ToolBarOption(); ToolBarDraws(); sceneDraw = new VMainGraphicsScene(); @@ -542,39 +542,36 @@ void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::ToolBarOption() { - QLabel * labelGrowth = new QLabel; - labelGrowth->setText(tr("Height: ")); - ui->toolBarOption->addWidget(labelGrowth); + if (qApp->patternType() == Pattern::Standard) + { + ui->toolBarOption->addWidget(new QLabel(tr("Height: "))); - QStringList list; - list <<"92"<<"98"<<"104"<<"110"<<"116"<<"122"<<"128"<<"134"<<"140"<<"146"<<"152"<<"158"<<"164"<<"170"<<"176" - <<"182"<<"188"; - QComboBox *comboBoxGrow = new QComboBox; - comboBoxGrow->clear(); - comboBoxGrow->addItems(list); - comboBoxGrow->setCurrentIndex(14); - ui->toolBarOption->addWidget(comboBoxGrow); - connect(comboBoxGrow, static_cast(&QComboBox::currentIndexChanged), - this, &MainWindow::ChangedHeight); + QStringList list; + list <<"92"<<"98"<<"104"<<"110"<<"116"<<"122"<<"128"<<"134"<<"140"<<"146"<<"152"<<"158"<<"164"<<"170"<<"176" + <<"182"<<"188"; + QComboBox *comboBoxHeight = new QComboBox; + comboBoxHeight->addItems(list); + comboBoxHeight->setCurrentIndex(14);//176 + ui->toolBarOption->addWidget(comboBoxHeight); + connect(comboBoxHeight, static_cast(&QComboBox::currentIndexChanged), + this, &MainWindow::ChangedHeight); - QLabel * labelSize = new QLabel; - labelSize->setText(tr(" Size: ")); - ui->toolBarOption->addWidget(labelSize); + ui->toolBarOption->addWidget(new QLabel(tr(" Size: "))); - list.clear(); - list <<"22"<<"24"<<"26"<<"28"<<"30"<<"32"<<"34"<<"36"<<"38"<<"40"<<"42"<<"44"<<"46"<<"48"<<"50"<<"52"<<"54"<<"56"; - QComboBox *comboBoxSize = new QComboBox; - comboBoxSize->clear(); - comboBoxSize->addItems(list); - comboBoxSize->setCurrentIndex(14); - ui->toolBarOption->addWidget(comboBoxSize); - connect(comboBoxSize, static_cast(&QComboBox::currentIndexChanged), - this, &MainWindow::ChangedSize); + list.clear(); + list <<"22"<<"24"<<"26"<<"28"<<"30"<<"32"<<"34"<<"36"<<"38"<<"40"<<"42"<<"44"<<"46"<<"48"<<"50"<<"52"<<"54" + <<"56"; + QComboBox *comboBoxSize = new QComboBox; + comboBoxSize->addItems(list); + comboBoxSize->setCurrentIndex(14);//50 + ui->toolBarOption->addWidget(comboBoxSize); + connect(comboBoxSize, static_cast(&QComboBox::currentIndexChanged), + this, &MainWindow::ChangedSize); - ui->toolBarOption->addSeparator(); + ui->toolBarOption->addSeparator(); + } - mouseCoordinate = new QLabel; - mouseCoordinate ->setText("0, 0"); + mouseCoordinate = new QLabel("0, 0"); ui->toolBarOption->addWidget(mouseCoordinate); } @@ -626,10 +623,12 @@ void MainWindow::currentDrawChanged( int index ) void MainWindow::mouseMove(const QPointF &scenePos) { - QString string = QString("%1, %2") - .arg(static_cast(qApp->fromPixel(scenePos.x()))) - .arg(static_cast(qApp->fromPixel(scenePos.y()))); - mouseCoordinate->setText(string); + QString string = QString("%1, %2").arg(static_cast(qApp->fromPixel(scenePos.x()))) + .arg(static_cast(qApp->fromPixel(scenePos.y()))); + if (mouseCoordinate != nullptr) + { + mouseCoordinate->setText(string); + } } void MainWindow::CancelTool() @@ -953,6 +952,9 @@ void MainWindow::Clear() ui->actionSave->setEnabled(false); ui->actionPattern_properties->setEnabled(false); SetEnableTool(false); + qApp->setPatternUnit(Valentina::Cm); + qApp->setPatternType(Pattern::Individual); + ui->toolBarOption->clear(); #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); #endif @@ -1386,100 +1388,165 @@ MainWindow::~MainWindow() void MainWindow::LoadPattern(const QString &fileName) { - QFile file(fileName); - if (file.open(QIODevice::ReadOnly)) + try { - try + VDomDocument::ValidateXML("://schema/pattern.xsd", fileName); + doc->setContent(fileName); + + qApp->setPatternUnit(doc->MUnit()); + qApp->setPatternType(doc->MType()); + QString path = doc->MPath(); + + path = CheckPathToMeasurements(path, qApp->patternType()); + if(path.isEmpty()) { - VDomDocument::ValidatePattern("://schema/pattern.xsd", fileName); - } - catch(VException &e) - { - e.CriticalMessageBox(tr("Validation file error."), this); - file.close(); Clear(); return; } - try + QString text = tr("Measurements use different units than pattern. This pattern required measurements in %1") + .arg(doc->UnitsToStr(qApp->patternUnit())); + if (qApp->patternType() == Pattern::Standard) { - doc->setContent(&file); - } - catch(VException &e) - { - e.CriticalMessageBox(tr("Parsing pattern file error."), this); - file.close(); - Clear(); - return; - } - - disconnect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), - this, &MainWindow::currentDrawChanged); - try - { - #ifndef QT_NO_CURSOR - QApplication::setOverrideCursor(Qt::WaitCursor); - #endif - doc->Parse(Document::FullParse, sceneDraw, sceneDetails); - #ifndef QT_NO_CURSOR - QApplication::restoreOverrideCursor(); - #endif - ui->actionPattern_properties->setEnabled(true); - } - catch (const VExceptionObjectError &e) - { - e.CriticalMessageBox(tr("Error parsing file."), this); - file.close(); - Clear(); - return; - } - catch (const VExceptionConversionError &e) - { - e.CriticalMessageBox(tr("Error can't convert value."), this); - file.close(); - Clear(); - return; - } - catch (const VExceptionEmptyParameter &e) - { - e.CriticalMessageBox(tr("Error empty parameter."), this); - file.close(); - Clear(); - return; - } - catch (const VExceptionWrongId &e) - { - e.CriticalMessageBox(tr("Error wrong id."), this); - file.close(); - Clear(); - return; - } - connect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), - this, &MainWindow::currentDrawChanged); - QString nameDraw = doc->GetNameActivDraw(); - qint32 index = comboBoxDraws->findText(nameDraw); - if ( index != -1 ) - { // -1 for not found - comboBoxDraws->setCurrentIndex(index); - } - if (comboBoxDraws->count() > 0) - { - SetEnableTool(true); + VStandardMeasurements m(pattern); + m.setContent(path); + Valentina::Units mUnit = m.Unit(); + if (qApp->patternUnit() != mUnit) + { + QMessageBox::critical(this, tr("Wrong units."), text); + Clear(); + return; + } + m.SetSize(); + m.SetHeight(); + ToolBarOption(); } else { - SetEnableTool(false); + VIndividualMeasurements m(pattern); + m.setContent(path); + Valentina::Units mUnit = m.Unit(); + if (qApp->patternUnit() != mUnit) + { + QMessageBox::critical(this, tr("Wrong units."), text); + Clear(); + return; + } } - SetEnableWidgets(true); + } + catch(VException &e) + { + e.CriticalMessageBox(tr("File error."), this); + Clear(); + return; + } - file.close(); + disconnect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), + this, &MainWindow::currentDrawChanged); + try + { + #ifndef QT_NO_CURSOR + QApplication::setOverrideCursor(Qt::WaitCursor); + #endif + + doc->Parse(Document::FullParse, sceneDraw, sceneDetails); + + #ifndef QT_NO_CURSOR + QApplication::restoreOverrideCursor(); + #endif + ui->actionPattern_properties->setEnabled(true); + } + catch (const VExceptionObjectError &e) + { + e.CriticalMessageBox(tr("Error parsing file."), this); + Clear(); + return; + } + catch (const VExceptionConversionError &e) + { + e.CriticalMessageBox(tr("Error can't convert value."), this); + Clear(); + return; + } + catch (const VExceptionEmptyParameter &e) + { + e.CriticalMessageBox(tr("Error empty parameter."), this); + Clear(); + return; + } + catch (const VExceptionWrongId &e) + { + e.CriticalMessageBox(tr("Error wrong id."), this); + Clear(); + return; + } + connect(comboBoxDraws, static_cast(&QComboBox::currentIndexChanged), + this, &MainWindow::currentDrawChanged); + QString nameDraw = doc->GetNameActivDraw(); + qint32 index = comboBoxDraws->findText(nameDraw); + if ( index != -1 ) + { // -1 for not found + comboBoxDraws->setCurrentIndex(index); + } + if (comboBoxDraws->count() > 0) + { + SetEnableTool(true); } else { - QMessageBox::warning(this, tr("Valentina"), tr("Cannot read file %1:\n%2.") - .arg(fileName) - .arg(file.errorString())); + SetEnableTool(false); } + SetEnableWidgets(true); + setCurrentFile(fileName); helpLabel->setText(tr("File loaded")); } + +QString MainWindow::CheckPathToMeasurements(const QString &path, const Pattern::Measurements &patternType) +{ + QFile table(path); + if (table.exists() == false) + { + QString text = tr("The measurements file

%1

%3").arg(path) + .arg(tr("could not be found. Do you want to update the file location")); + QMessageBox::StandardButton res = QMessageBox::question(this, "Loading measurements file", text, + QMessageBox::Yes | QMessageBox::No, + QMessageBox::Yes); + if(res == QMessageBox::No) + { + return QString(); + } + else + { + QString filter; + if (patternType == Pattern::Standard) + { + filter = tr("Standard measurements (*.vst)"); + } + else + { + filter = tr("Individual measurements (*.vit)"); + } + QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter); + + if(mPath.isEmpty()) + { + return mPath; + } + else + { + if (patternType == Pattern::Standard) + { + VDomDocument::ValidateXML("://schema/standard_measurements.xsd", mPath); + } + else + { + VDomDocument::ValidateXML("://schema/individual_measurements.xsd", mPath); + } + doc->SetPath(mPath); + return mPath; + } + } + } + return path; +} diff --git a/src/mainwindow.h b/src/mainwindow.h index c5bcc046e..cc517b6a0 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -562,6 +562,7 @@ private: void CreateActions(); void InitAutoSave(); QString PatternPieceName(const QString &text); + QString CheckPathToMeasurements(const QString &path, const Pattern::Measurements &patternType); }; #endif // MAINWINDOW_H diff --git a/src/options.h b/src/options.h index b58858479..00da1e17e 100644 --- a/src/options.h +++ b/src/options.h @@ -92,7 +92,7 @@ namespace Valentina /** * @brief The Unit enum */ - enum Unit { Mm, Cm, In }; + enum Unit { Mm, Cm, Inch }; Q_DECLARE_FLAGS(Units, Unit) } Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Scenes ) diff --git a/src/widgets/vapplication.cpp b/src/widgets/vapplication.cpp index dd2ac8575..c33c7b579 100644 --- a/src/widgets/vapplication.cpp +++ b/src/widgets/vapplication.cpp @@ -99,7 +99,7 @@ double VApplication::toPixel(double unit) const case Valentina::Cm: result = ((unit * 10.0) / 25.4) * PrintDPI; break; - case Valentina::In: + case Valentina::Inch: result = unit * PrintDPI; break; default: @@ -119,7 +119,7 @@ double VApplication::fromPixel(double pix) const case Valentina::Cm: result = ((pix / PrintDPI) * 25.4) / 10.0; break; - case Valentina::In: + case Valentina::Inch: result = pix / PrintDPI; break; default: diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index a6464c53d..f6494543a 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -81,7 +81,7 @@ const QString VDomDocument::AttrId = QStringLiteral("id"); const QString VDomDocument::AttrUnit = QStringLiteral("unit"); const QString VDomDocument::UnitMM = QStringLiteral("mm"); const QString VDomDocument::UnitCM = QStringLiteral("cm"); -const QString VDomDocument::UnitIN = QStringLiteral("in"); +const QString VDomDocument::UnitINCH = QStringLiteral("inch"); VDomDocument::VDomDocument(VContainer *data) : QDomDocument(), data(data), map(QHash()) @@ -250,27 +250,21 @@ QString VDomDocument::UniqueTagText(const QString &tagName, const QString &defVa return defVal; } -void VDomDocument::ValidatePattern(const QString &schema, const QString &fileName) +void VDomDocument::ValidateXML(const QString &schema, const QString &fileName) { - QString errorMsg; - qint64 errorLine = -1; - qint64 errorColumn = -1; - QFile pattern(fileName); if (pattern.open(QIODevice::ReadOnly) == false) { - errorMsg = QString(tr("Can't open file %1:\n%2.").arg(fileName).arg(pattern.errorString())); - VException e(errorMsg); - e.AddMoreInformation(tr("Error in line %1 column %2").arg(errorLine).arg(errorColumn)); - throw e; + const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName).arg(pattern.errorString())); + throw VException(errorMsg); } + QFile fileSchema(schema); if (fileSchema.open(QIODevice::ReadOnly) == false) { - errorMsg = QString(tr("Can't open schema file %1:\n%2.").arg(schema).arg(fileSchema.errorString())); - VException e(errorMsg); - e.AddMoreInformation(tr("Error in line %1 column %2").arg(errorLine).arg(errorColumn)); - throw e; + pattern.close(); + const QString errorMsg(tr("Can't open schema file %1:\n%2.").arg(schema).arg(fileSchema.errorString())); + throw VException(errorMsg); } MessageHandler messageHandler; @@ -294,30 +288,41 @@ void VDomDocument::ValidatePattern(const QString &schema, const QString &fileNam if (errorOccurred) { + pattern.close(); + fileSchema.close(); VException e(messageHandler.statusMessage()); - e.AddMoreInformation(tr("Error in line %1 column %2").arg(messageHandler.line()).arg(messageHandler.column())); + e.AddMoreInformation(tr("Validation error in line %1 column %2").arg(messageHandler.line()).arg(messageHandler.column())); throw e; } - + pattern.close(); + fileSchema.close(); } -void VDomDocument::setContent(QIODevice *dev) +void VDomDocument::setContent(const QString &fileName) { - QString errorMsg; - int errorLine = 0; - int errorColumn = 0; - if (QDomDocument::setContent(dev, &errorMsg, &errorLine, &errorColumn) == false) + QFile file(fileName); + if (file.open(QIODevice::ReadOnly) == false) { - VException e(errorMsg); - e.AddMoreInformation(tr("Error in line %1 column %2").arg(errorLine).arg(errorColumn)); - throw e; + const QString errorMsg(tr("Can't open file %1:\n%2.").arg(fileName).arg(file.errorString())); + throw VException(errorMsg); + } + + QString errorMsg; + int errorLine = -1; + int errorColumn = -1; + if (QDomDocument::setContent(&file, &errorMsg, &errorLine, &errorColumn) == false) + { + file.close(); + VException e(errorMsg); + e.AddMoreInformation(tr("Parcing error in line %1 column %2").arg(errorLine).arg(errorColumn)); + throw e; } } -Valentina::Units VDomDocument::Units(const QString &unit) +Valentina::Units VDomDocument::StrToUnits(const QString &unit) { QStringList units; - units << UnitMM << UnitCM << UnitIN; + units << UnitMM << UnitCM << UnitINCH; Valentina::Units result = Valentina::Cm; switch (units.indexOf(unit)) { @@ -327,8 +332,8 @@ Valentina::Units VDomDocument::Units(const QString &unit) case 1:// cm result = Valentina::Cm; break; - case 2:// in - result = Valentina::In; + case 2:// inch + result = Valentina::Inch; break; default: result = Valentina::Cm; @@ -336,3 +341,24 @@ Valentina::Units VDomDocument::Units(const QString &unit) } return result; } + +QString VDomDocument::UnitsToStr(const Valentina::Units &unit) +{ + QString result; + switch(unit) + { + case Valentina::Mm: + result = "mm"; + break; + case Valentina::Cm: + result = "cm"; + break; + case Valentina::Inch: + result = "inch"; + break; + default: + result = "cm"; + break; + } + return result; +} diff --git a/src/xml/vdomdocument.h b/src/xml/vdomdocument.h index 6692d0760..8c6df8ab7 100644 --- a/src/xml/vdomdocument.h +++ b/src/xml/vdomdocument.h @@ -51,7 +51,7 @@ public: static const QString AttrUnit; static const QString UnitMM; static const QString UnitCM; - static const QString UnitIN; + static const QString UnitINCH; /** * @brief VDomDocument constructor. * @param data container with variables. @@ -111,22 +111,24 @@ public: qreal GetParametrDouble(const QDomElement& domElement, const QString &name, const QString &defValue) const; QString UniqueTagText(const QString &tagName, const QString &defVal = QString()) const; /** - * @brief ValidatePattern validate pattern file by xsd schema. + * @brief ValidateXML validate xml file by xsd schema. * @param schema path to schema file. - * @param fileName name of pattern file. + * @param fileName name of xml file. * @param errorMsg error message. * @param errorLine number error line. * @param errorColumn number error column. * @return true if validation successful. */ - static void ValidatePattern(const QString &schema, const QString &fileName); - void setContent(QIODevice * dev); + static void ValidateXML(const QString &schema, const QString &fileName); + void setContent(const QString &fileName); + static Valentina::Units StrToUnits(const QString &unit); + static QString UnitsToStr(const Valentina::Units &unit); protected: /** * @brief data container with data. */ VContainer *data; - Valentina::Units Units(const QString &unit); + private: Q_DISABLE_COPY(VDomDocument) /** @@ -163,27 +165,6 @@ inline void VDomDocument::SetAttribute(QDomElement &domEl } } -template <> -inline void VDomDocument::SetAttribute(QDomElement &domElement, const QString &name, - const Valentina::Units &value) -{ - switch(value) - { - case Valentina::Mm: - domElement.setAttribute(name, "mm"); - break; - case Valentina::Cm: - domElement.setAttribute(name, "cm"); - break; - case Valentina::In: - domElement.setAttribute(name, "in"); - break; - default: - domElement.setAttribute(name, "cm"); - break; - } -} - #ifdef Q_CC_GNU #pragma GCC diagnostic pop #endif diff --git a/src/xml/vindividualmeasurements.cpp b/src/xml/vindividualmeasurements.cpp index 375e56198..28f870602 100644 --- a/src/xml/vindividualmeasurements.cpp +++ b/src/xml/vindividualmeasurements.cpp @@ -47,7 +47,7 @@ VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument( Valentina::Units VIndividualMeasurements::Unit() { const QString unit = UniqueTagText(AttrUnit, UnitCM); - return VDomDocument::Units(unit); + return VDomDocument::StrToUnits(unit); } void VIndividualMeasurements::Measurements() diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index 24ed010bb..048357a64 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -35,6 +35,8 @@ #include "../exception/vexceptionobjecterror.h" #include "../exception/vexceptionwrongid.h" #include "../exception/vexceptionconversionerror.h" +#include "vstandardmeasurements.h" +#include "vindividualmeasurements.h" #include @@ -85,7 +87,7 @@ void VPattern::CreateEmptyFile(const QString &tablePath) patternElement.appendChild(createElement(TagNotes)); QDomElement measurements = createElement(TagMeasurements); - SetAttribute(measurements, AttrUnit, qApp->patternUnit()); + SetAttribute(measurements, AttrUnit, UnitsToStr(qApp->patternUnit())); SetAttribute(measurements, AttrType, qApp->patternType()); SetAttribute(measurements, AttrPath, tablePath); patternElement.appendChild(measurements); @@ -417,7 +419,7 @@ bool VPattern::GetActivNodeElement(const QString &name, QDomElement &element) QString VPattern::MPath() const { - QDomNodeList list = elementsByTagName(VPattern::TagMeasurements); + QDomNodeList list = elementsByTagName(TagMeasurements); QDomElement element = list.at(0).toElement(); if (element.isElement()) { @@ -429,6 +431,20 @@ QString VPattern::MPath() const } } +void VPattern::SetPath(const QString &path) +{ + QDomNodeList list = elementsByTagName(TagMeasurements); + QDomElement element = list.at(0).toElement(); + if (element.isElement()) + { + SetAttribute(element, AttrPath, path); + } + else + { + qWarning()<<"Can't save path to measurements"<Clear(); - emit UpdateMeasurements(); + UpdateMeasurements(); nameActivDraw.clear(); sceneDraw->clear(); sceneDetail->clear(); @@ -1400,3 +1416,20 @@ void VPattern::PrepareForParse(const Document::Documents &parse, VMainGraphicsSc data->ClearDetails(); history.clear(); } + +void VPattern::UpdateMeasurements() +{ + const QString path = MPath(); + if (MType() == Pattern::Standard) + { + VStandardMeasurements m(data); + m.setContent(path); + m.Measurements(); + } + else + { + VIndividualMeasurements m(data); + m.setContent(path); + m.Measurements(); + } +} diff --git a/src/xml/vpattern.h b/src/xml/vpattern.h index f1e559543..f9b7a8cca 100644 --- a/src/xml/vpattern.h +++ b/src/xml/vpattern.h @@ -166,6 +166,7 @@ public: */ bool GetActivNodeElement(const QString& name, QDomElement& element); QString MPath() const; + void SetPath(const QString &path); Valentina::Units MUnit() const; Pattern::Measurements MType() const; static const QString TagPattern; @@ -224,7 +225,6 @@ signals: * @param id tool id. */ void ChangedCursor(quint32 id); - void UpdateMeasurements(); public slots: /** * @brief FullUpdateTree lite parse file. @@ -382,6 +382,7 @@ private: void CollectId(const QDomElement &node, QVector &vector)const; void PrepareForParse(const Document::Documents &parse, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail); + void UpdateMeasurements(); }; inline QString VPattern::GetNameActivDraw() const diff --git a/src/xml/vstandardmeasurements.cpp b/src/xml/vstandardmeasurements.cpp index 204687dfb..49826919a 100644 --- a/src/xml/vstandardmeasurements.cpp +++ b/src/xml/vstandardmeasurements.cpp @@ -47,7 +47,7 @@ VStandardMeasurements::VStandardMeasurements(VContainer *data):VDomDocument(data Valentina::Units VStandardMeasurements::Unit() { const QString unit = UniqueTagText(AttrUnit, UnitCM); - return VDomDocument::Units(unit); + return VDomDocument::StrToUnits(unit); } QString VStandardMeasurements::Description() From 7c18e85305109ce43f570ef1c43878838bf11c3a Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 26 Mar 2014 06:39:07 +0200 Subject: [PATCH 57/60] Dialog Increment still not tested. --HG-- branch : feature --- .../schema/individual_measurements.xsd | 350 +++++++------- share/resources/schema/pattern.xsd | 24 +- .../schema/standard_measurements.xsd | 16 +- share/tables/individual/indivindual_ru.vit | 102 +++-- share/tables/standard/GOST_man_ru.vst | 1 + src/dialogs/app/dialoghistory.cpp | 2 +- src/dialogs/app/dialogincrements.cpp | 2 + src/dialogs/app/dialogincrements.ui | 426 ++++++++++++------ .../app/dialogindividualmeasurements.cpp | 25 +- .../app/dialogindividualmeasurements.h | 1 + .../app/dialogindividualmeasurements.ui | 122 ++--- src/dialogs/tools/dialogdetail.cpp | 2 +- src/dialogs/tools/dialogtool.cpp | 2 +- src/mainwindow.cpp | 60 +-- src/mainwindow.h | 1 + src/options.h | 5 +- src/tablewindow.cpp | 14 +- src/tools/drawTools/vabstractspline.cpp | 6 +- src/tools/drawTools/vdrawtool.h | 2 +- src/tools/drawTools/vtoolarc.cpp | 10 +- src/tools/drawTools/vtoolcutarc.cpp | 4 +- src/tools/drawTools/vtoolline.cpp | 10 +- src/tools/drawTools/vtoollinepoint.cpp | 6 +- src/tools/drawTools/vtoolpoint.cpp | 40 +- src/tools/drawTools/vtoolsinglepoint.cpp | 2 +- src/tools/drawTools/vtoolspline.cpp | 4 +- src/tools/drawTools/vtoolsplinepath.cpp | 4 +- src/tools/drawTools/vtooltriangle.cpp | 2 +- src/tools/nodeDetails/vnodearc.cpp | 6 +- src/tools/nodeDetails/vnodepoint.cpp | 6 +- src/tools/nodeDetails/vnodespline.cpp | 6 +- src/tools/nodeDetails/vnodesplinepath.cpp | 6 +- src/widgets/textdelegate.cpp | 5 +- src/widgets/vapplication.cpp | 49 +- src/widgets/vapplication.h | 39 +- src/widgets/vcontrolpointspline.cpp | 12 +- src/widgets/vitem.cpp | 6 +- src/widgets/vsimplearc.cpp | 12 +- src/widgets/vsimplespline.cpp | 14 +- src/widgets/vsimplesplinepath.cpp | 4 +- src/xml/vindividualmeasurements.cpp | 64 ++- src/xml/vindividualmeasurements.h | 15 +- src/xml/vpattern.cpp | 6 + 43 files changed, 910 insertions(+), 585 deletions(-) diff --git a/share/resources/schema/individual_measurements.xsd b/share/resources/schema/individual_measurements.xsd index 130b5b1cc..39928eaa9 100644 --- a/share/resources/schema/individual_measurements.xsd +++ b/share/resources/schema/individual_measurements.xsd @@ -9,22 +9,23 @@ - - + + +
- + - - + + @@ -33,8 +34,8 @@ - - + + @@ -43,8 +44,8 @@ - - + + @@ -53,8 +54,8 @@ - - + + @@ -69,8 +70,8 @@ - - + + @@ -79,8 +80,8 @@ - - + + @@ -89,8 +90,8 @@ - - + + @@ -99,8 +100,8 @@ - - + + @@ -109,8 +110,8 @@ - - + + @@ -119,8 +120,8 @@ - - + + @@ -129,8 +130,8 @@ - - + + @@ -139,8 +140,8 @@ - - + + @@ -149,8 +150,8 @@ - - + + @@ -159,8 +160,8 @@ - - + + @@ -169,8 +170,8 @@ - - + + @@ -179,8 +180,8 @@ - - + + @@ -189,8 +190,8 @@ - - + + @@ -199,8 +200,8 @@ - - + + @@ -209,8 +210,8 @@ - - + + @@ -219,8 +220,8 @@ - - + + @@ -229,8 +230,8 @@ - - + + @@ -239,8 +240,8 @@ - - + + @@ -249,8 +250,8 @@ - - + + @@ -259,8 +260,8 @@ - - + + @@ -269,8 +270,8 @@ - - + + @@ -279,8 +280,8 @@ - - + + @@ -289,8 +290,8 @@ - - + + @@ -299,8 +300,8 @@ - - + + @@ -309,8 +310,8 @@ - - + + @@ -319,8 +320,8 @@ - - + + @@ -329,8 +330,8 @@ - - + + @@ -339,8 +340,8 @@ - - + + @@ -349,8 +350,8 @@ - - + + @@ -359,8 +360,8 @@ - - + + @@ -369,8 +370,8 @@ - - + + @@ -379,8 +380,8 @@ - - + + @@ -389,8 +390,8 @@ - - + + @@ -399,8 +400,8 @@ - - + + @@ -409,8 +410,8 @@ - - + + @@ -419,8 +420,8 @@ - - + + @@ -429,8 +430,8 @@ - - + + @@ -439,8 +440,8 @@ - - + + @@ -449,8 +450,8 @@ - - + + @@ -459,8 +460,8 @@ - - + + @@ -469,8 +470,8 @@ - - + + @@ -479,8 +480,8 @@ - - + + @@ -489,8 +490,8 @@ - - + + @@ -499,8 +500,8 @@ - - + + @@ -509,8 +510,8 @@ - - + + @@ -525,8 +526,8 @@ - - + + @@ -535,8 +536,8 @@ - - + + @@ -545,8 +546,8 @@ - - + + @@ -555,8 +556,8 @@ - - + + @@ -565,8 +566,8 @@ - - + + @@ -575,8 +576,8 @@ - - + + @@ -585,8 +586,8 @@ - - + + @@ -595,8 +596,8 @@ - - + + @@ -605,8 +606,8 @@ - - + + @@ -615,8 +616,8 @@ - - + + @@ -631,8 +632,8 @@ - - + + @@ -641,8 +642,8 @@ - - + + @@ -651,8 +652,8 @@ - - + + @@ -667,8 +668,8 @@ - - + + @@ -677,8 +678,8 @@ - - + + @@ -687,8 +688,8 @@ - - + + @@ -697,8 +698,8 @@ - - + + @@ -707,8 +708,8 @@ - - + + @@ -717,8 +718,8 @@ - - + + @@ -727,8 +728,8 @@ - - + + @@ -743,8 +744,8 @@ - - + + @@ -753,8 +754,8 @@ - - + + @@ -769,8 +770,8 @@ - - + + @@ -779,8 +780,8 @@ - - + + @@ -789,8 +790,8 @@ - - + + @@ -799,8 +800,8 @@ - - + + @@ -809,8 +810,8 @@ - - + + @@ -819,8 +820,8 @@ - - + + @@ -829,8 +830,8 @@ - - + + @@ -839,8 +840,8 @@ - - + + @@ -849,8 +850,8 @@ - - + + @@ -866,4 +867,27 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/share/resources/schema/pattern.xsd b/share/resources/schema/pattern.xsd index cfc6524a5..532c2a12e 100644 --- a/share/resources/schema/pattern.xsd +++ b/share/resources/schema/pattern.xsd @@ -9,9 +9,9 @@ - + - + @@ -23,7 +23,7 @@ - + @@ -211,4 +211,22 @@ + + + + + + + + + + + + + + + + + + diff --git a/share/resources/schema/standard_measurements.xsd b/share/resources/schema/standard_measurements.xsd index 98f4759ad..ebff0c5bf 100644 --- a/share/resources/schema/standard_measurements.xsd +++ b/share/resources/schema/standard_measurements.xsd @@ -4,7 +4,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -36,4 +36,16 @@ + + + + + + + + + + + + diff --git a/share/tables/individual/indivindual_ru.vit b/share/tables/individual/indivindual_ru.vit index 29bbdc85b..b7329e774 100644 --- a/share/tables/individual/indivindual_ru.vit +++ b/share/tables/individual/indivindual_ru.vit @@ -1,105 +1,107 @@ + ru - - + 1900-01-01 + male + username@example.com mm - + - + - + - - + + - + - - + + - + - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + - + - - + + - - - + + + - + - + - - + + - + - - - - + + + + diff --git a/share/tables/standard/GOST_man_ru.vst b/share/tables/standard/GOST_man_ru.vst index 4d61516ab..ca4a1c00a 100644 --- a/share/tables/standard/GOST_man_ru.vst +++ b/share/tables/standard/GOST_man_ru.vst @@ -1,3 +1,4 @@ + Типовые фигуры мужчин 1-й полнотной группы, обхват груди 100 см mm diff --git a/src/dialogs/app/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp index 366f277ed..fbf9e1576 100644 --- a/src/dialogs/app/dialoghistory.cpp +++ b/src/dialogs/app/dialoghistory.cpp @@ -395,7 +395,7 @@ QString DialogHistory::Record(const VToolRecord &tool) case Valentina::NodeSplinePath: break; default: - qWarning()<tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementsChanged); } + ui->toolBoxMeasurements->setCurrentIndex(1); + FillMeasurements(); FillIncrements(); FillLengthLines(); diff --git a/src/dialogs/app/dialogincrements.ui b/src/dialogs/app/dialogincrements.ui index 96d7eb33a..ae387ab7a 100644 --- a/src/dialogs/app/dialogincrements.ui +++ b/src/dialogs/app/dialogincrements.ui @@ -6,8 +6,8 @@ 0 0 - 897 - 566 + 979 + 574 @@ -42,21 +42,42 @@ 0 + + + 0 + 0 + + Measurements - + - + + 6 + + + + + 0 + 0 + + Load another measurements table - + + + + 0 + 0 + + ... @@ -70,153 +91,264 @@ - - - - - Family name - - - - - - - - - - - - - - - 84 - 0 - - - - Given name - - - - - - - - - - - - - - - 84 - 0 - - - - Birth date - - - - - - - - - - - - - - - 84 - 0 - - - - Sex - - - - - - - - - - - - true + + + + 0 + 1 + - - QAbstractItemView::NoEditTriggers + + + 0 + 0 + - - true + + 1 - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - - true - - - false - - - 95 - - - 25 - - - false - - - true - - - false - - - 45 - - - 8 - - - - Name + + + + 0 + 0 + 939 + 411 + - - - - The calculated value + + Personal information + + + + + + 6 + + + QLayout::SetDefaultConstraint + + + + + + 0 + 0 + + + + Family name + + + + + + + + + + + + + + + 0 + 0 + + + + + 84 + 0 + + + + Given name + + + + + + + + + + + + + + + 0 + 0 + + + + + 84 + 0 + + + + Birth date + + + + + + + + + + + + + + + 0 + 0 + + + + + 84 + 0 + + + + Sex + + + + + + + + + + + + + + + 0 + 0 + + + + + 84 + 0 + + + + Mail + + + + + + + + + + + + + + layoutWidget + label_5 + + + + + 0 + 0 + 939 + 411 + - - - - Base value - - - - - In sizes - - - - - In heights - - - - - Description - - + + Measurements + + + + + + true + + + QAbstractItemView::NoEditTriggers + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + true + + + false + + + 95 + + + 25 + + + false + + + true + + + false + + + 45 + + + 8 + + + + Name + + + + + The calculated value + + + + + Base value + + + + + In sizes + + + + + In heights + + + + + Description + + + + + + diff --git a/src/dialogs/app/dialogindividualmeasurements.cpp b/src/dialogs/app/dialogindividualmeasurements.cpp index 073669c23..19096b078 100644 --- a/src/dialogs/app/dialogindividualmeasurements.cpp +++ b/src/dialogs/app/dialogindividualmeasurements.cpp @@ -56,6 +56,7 @@ DialogIndividualMeasurements::DialogIndividualMeasurements(VContainer *data, con ui->lineEditName->setText(_name); LoadIndividualTables(); + InitUnits(); CheckState(); connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogIndividualMeasurements::CheckState); @@ -92,7 +93,7 @@ void DialogIndividualMeasurements::DialogAccepted() if ( iMeasur.copy(_tablePath) == false ) { QMessageBox::warning(this, tr("Could not create measurements file"), tr("Please try again or change file")); - return; + DialogRejected(); } } try @@ -100,13 +101,25 @@ void DialogIndividualMeasurements::DialogAccepted() VDomDocument::ValidateXML("://schema/individual_measurements.xsd", _tablePath); VIndividualMeasurements m(data); m.setContent(_tablePath); + const qint32 index = ui->comboBoxUnits->currentIndex(); + Valentina::Units unit = VDomDocument::StrToUnits(ui->comboBoxUnits->itemData(index).toString()); + m.setUnit(unit); qApp->setPatternUnit( m.Unit()); + QFile iMeasur(_tablePath); + if (iMeasur.open(QIODevice::WriteOnly| QIODevice::Truncate)) + { + const int Indent = 4; + QTextStream out(&iMeasur); + out.setCodec("UTF-8"); + m.save(out, Indent); + iMeasur.close(); + } } catch(VException &e) { e.CriticalMessageBox(tr("File error."), this); qWarning()<<"File error."<lineEditPathNewM->setEnabled(false); ui->toolButtonOpenNew->setEnabled(false); ui->comboBoxLang->setEnabled(false); + ui->comboBoxUnits->setEnabled(false); if (ui->lineEditPathExistM->text().isEmpty() == false) { @@ -146,6 +160,7 @@ void DialogIndividualMeasurements::CheckState() ui->lineEditPathNewM->setEnabled(true); ui->toolButtonOpenNew->setEnabled(true); ui->comboBoxLang->setEnabled(true); + ui->comboBoxUnits->setEnabled(true); ui->toolButtonOpenExist->setEnabled(false); ui->lineEditPathExistM->setEnabled(false); @@ -259,3 +274,9 @@ void DialogIndividualMeasurements::NewTable() ui->lineEditPathNewM->setToolTip(name); CheckState(); } + +void DialogIndividualMeasurements::InitUnits() +{ + ui->comboBoxUnits->addItem(tr("centimeter"), QVariant(VDomDocument::UnitsToStr(Valentina::Cm))); + ui->comboBoxUnits->addItem(tr("inch"), QVariant(VDomDocument::UnitsToStr(Valentina::Inch))); +} diff --git a/src/dialogs/app/dialogindividualmeasurements.h b/src/dialogs/app/dialogindividualmeasurements.h index f0e609ea6..51362d31e 100644 --- a/src/dialogs/app/dialogindividualmeasurements.h +++ b/src/dialogs/app/dialogindividualmeasurements.h @@ -58,6 +58,7 @@ private: void LoadIndividualTables(); void OpenTable(); void NewTable(); + void InitUnits(); }; inline QString DialogIndividualMeasurements::name() const diff --git a/src/dialogs/app/dialogindividualmeasurements.ui b/src/dialogs/app/dialogindividualmeasurements.ui index 595c4acc1..522a6a3de 100644 --- a/src/dialogs/app/dialogindividualmeasurements.ui +++ b/src/dialogs/app/dialogindividualmeasurements.ui @@ -6,14 +6,14 @@ 0 0 - 358 - 247 + 397 + 280 Dialog - + @@ -76,7 +76,7 @@ - + @@ -91,59 +91,73 @@ - + - - - - - Language: - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - + + + Language: + + - - - - - Path: - - - - - - - - - - ... - - - - - - - - - + + + + 0 + 0 + + + + + 0 + 0 + + + + + + + + + + + + Units: + + + + + + + + + + + + + + Path: + + + + + + + true + + + + + + + ... + + + + + + + diff --git a/src/dialogs/tools/dialogdetail.cpp b/src/dialogs/tools/dialogdetail.cpp index d192889cf..3b159c351 100644 --- a/src/dialogs/tools/dialogdetail.cpp +++ b/src/dialogs/tools/dialogdetail.cpp @@ -136,7 +136,7 @@ void DialogDetail::NewItem(quint32 id, const Valentina::Tools &typeTool, const N break; } default: - qWarning()<statusBar->addWidget(helpLabel); - connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine); - connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine); - connect(ui->toolButtonAlongLine, &QToolButton::clicked, this, &MainWindow::ToolAlongLine); - connect(ui->toolButtonShoulderPoint, &QToolButton::clicked, this, &MainWindow::ToolShoulderPoint); - connect(ui->toolButtonNormal, &QToolButton::clicked, this, &MainWindow::ToolNormal); - connect(ui->toolButtonBisector, &QToolButton::clicked, this, &MainWindow::ToolBisector); - connect(ui->toolButtonLineIntersect, &QToolButton::clicked, this, &MainWindow::ToolLineIntersect); - connect(ui->toolButtonSpline, &QToolButton::clicked, this, &MainWindow::ToolSpline); - connect(ui->toolButtonArc, &QToolButton::clicked, this, &MainWindow::ToolArc); - connect(ui->toolButtonSplinePath, &QToolButton::clicked, this, &MainWindow::ToolSplinePath); - connect(ui->toolButtonPointOfContact, &QToolButton::clicked, this, &MainWindow::ToolPointOfContact); - connect(ui->toolButtonNewDetail, &QToolButton::clicked, this, &MainWindow::ToolDetail); - connect(ui->toolButtonHeight, &QToolButton::clicked, this, &MainWindow::ToolHeight); - connect(ui->toolButtonTriangle, &QToolButton::clicked, this, &MainWindow::ToolTriangle); - connect(ui->toolButtonPointOfIntersection, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersection); - connect(ui->toolButtonSplineCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSpline); - connect(ui->toolButtonSplinePathCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSplinePath); - connect(ui->toolButtonUnionDetails, &QToolButton::clicked, this, &MainWindow::ToolUnionDetails); - connect(ui->toolButtonArcCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutArc); - pattern = new VContainer(); doc = new VPattern(pattern, comboBoxDraws, &mode); @@ -159,7 +140,7 @@ void MainWindow::ActionNewDraw() } if (doc->appendDraw(patternPieceName) == false) { - qWarning()<(&QComboBox::currentIndexChanged), @@ -577,9 +558,8 @@ void MainWindow::ToolBarOption() void MainWindow::ToolBarDraws() { - QLabel * labelNameDraw = new QLabel; - labelNameDraw ->setText(tr("Pattern Piece: ")); - ui->toolBarDraws->addWidget(labelNameDraw); + QLabel *labelPtternPieceName = new QLabel(tr("Pattern Piece: ")); + ui->toolBarDraws->addWidget(labelPtternPieceName); comboBoxDraws = new QComboBox; ui->toolBarDraws->addWidget(comboBoxDraws); @@ -602,6 +582,29 @@ void MainWindow::ToolBarDraws() ui->actionLayout->setEnabled(false); } +void MainWindow::InitToolButtons() +{ + connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine); + connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine); + connect(ui->toolButtonAlongLine, &QToolButton::clicked, this, &MainWindow::ToolAlongLine); + connect(ui->toolButtonShoulderPoint, &QToolButton::clicked, this, &MainWindow::ToolShoulderPoint); + connect(ui->toolButtonNormal, &QToolButton::clicked, this, &MainWindow::ToolNormal); + connect(ui->toolButtonBisector, &QToolButton::clicked, this, &MainWindow::ToolBisector); + connect(ui->toolButtonLineIntersect, &QToolButton::clicked, this, &MainWindow::ToolLineIntersect); + connect(ui->toolButtonSpline, &QToolButton::clicked, this, &MainWindow::ToolSpline); + connect(ui->toolButtonArc, &QToolButton::clicked, this, &MainWindow::ToolArc); + connect(ui->toolButtonSplinePath, &QToolButton::clicked, this, &MainWindow::ToolSplinePath); + connect(ui->toolButtonPointOfContact, &QToolButton::clicked, this, &MainWindow::ToolPointOfContact); + connect(ui->toolButtonNewDetail, &QToolButton::clicked, this, &MainWindow::ToolDetail); + connect(ui->toolButtonHeight, &QToolButton::clicked, this, &MainWindow::ToolHeight); + connect(ui->toolButtonTriangle, &QToolButton::clicked, this, &MainWindow::ToolTriangle); + connect(ui->toolButtonPointOfIntersection, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersection); + connect(ui->toolButtonSplineCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSpline); + connect(ui->toolButtonSplinePathCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutSplinePath); + connect(ui->toolButtonUnionDetails, &QToolButton::clicked, this, &MainWindow::ToolUnionDetails); + connect(ui->toolButtonArcCutPoint, &QToolButton::clicked, this, &MainWindow::ToolCutArc); +} + void MainWindow::currentDrawChanged( int index ) { if (index != -1) @@ -1119,7 +1122,7 @@ bool MainWindow::SavePattern(const QString &fileName) } if (fileName.isEmpty()) { - qWarning()<save(out, Indent); tempFile.close(); } @@ -1146,7 +1150,7 @@ bool MainWindow::SavePattern(const QString &fileName) { if ( tempFile.copy(patternFile.fileName()) == false ) { - qWarning()< #include +#include #define SceneSize 50000 @@ -100,6 +101,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Tools ) Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Sources ) Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Draws ) Q_DECLARE_OPERATORS_FOR_FLAGS( Valentina::Units ) +Q_DECLARE_METATYPE(Valentina::Unit) namespace Pattern { @@ -111,7 +113,4 @@ namespace Pattern } Q_DECLARE_OPERATORS_FOR_FLAGS( Pattern::Measurements ) -#define widthMainLine 1.2 //mm -#define widthHairLine widthMainLine/3 - #endif // OPTIONS_H diff --git a/src/tablewindow.cpp b/src/tablewindow.cpp index 783e75627..1986bd3af 100644 --- a/src/tablewindow.cpp +++ b/src/tablewindow.cpp @@ -81,7 +81,7 @@ void TableWindow::AddPaper() shadowPaper->setBrush(QBrush(Qt::black)); tableScene->addItem(shadowPaper); paper = new QGraphicsRectItem(QRectF(x1, y1, x2, y2)); - paper->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); + paper->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); paper->setBrush(QBrush(Qt::white)); tableScene->addItem(paper); qDebug()<rect().size().toSize(); @@ -243,7 +243,7 @@ void TableWindow::saveScene() qWarning() << "Bad file suffix"<setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); + paper->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); brush->setColor( QColor( Qt::gray ) ); brush->setStyle( Qt::SolidPattern ); tableScene->setBackgroundBrush( *brush ); @@ -317,7 +317,7 @@ void TableWindow::itemColliding(QList list, int number) { VItem * bitem = qgraphicsitem_cast ( listCollidingItems.at(i) ); Q_CHECK_PTR(bitem); - bitem->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); + bitem->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); listCollidingItems.removeAt(i); } } @@ -326,7 +326,7 @@ void TableWindow::itemColliding(QList list, int number) { VItem * bitem = qgraphicsitem_cast ( listCollidingItems.at(0) ); Q_CHECK_PTR(bitem); - bitem->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); + bitem->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); listCollidingItems.clear(); collidingItems = true; } @@ -436,7 +436,7 @@ void TableWindow::SvgFile(const QString &name) const painter.begin(&generator); painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setRenderHint(QPainter::Antialiasing, true); - painter.setPen(QPen(Qt::black, qApp->toPixel(widthHairLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter.setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine()), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setBrush ( QBrush ( Qt::NoBrush ) ); tableScene->render(&painter); painter.end(); @@ -453,7 +453,7 @@ void TableWindow::PngFile(const QString &name) const QPainter painter(&image); painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setRenderHint(QPainter::Antialiasing, true); - painter.setPen(QPen(Qt::black, qApp->toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter.setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setBrush ( QBrush ( Qt::NoBrush ) ); tableScene->render(&painter); image.save(name); @@ -477,7 +477,7 @@ void TableWindow::PdfFile(const QString &name) const } painter.setFont( QFont( "Arial", 8, QFont::Normal ) ); painter.setRenderHint(QPainter::Antialiasing, true); - painter.setPen(QPen(Qt::black, qApp->toPixel(widthMainLine), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); + painter.setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()), Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); painter.setBrush ( QBrush ( Qt::NoBrush ) ); tableScene->render(&painter); painter.end(); diff --git a/src/tools/drawTools/vabstractspline.cpp b/src/tools/drawTools/vabstractspline.cpp index f3d8d4b32..9d77cdf54 100644 --- a/src/tools/drawTools/vabstractspline.cpp +++ b/src/tools/drawTools/vabstractspline.cpp @@ -54,7 +54,7 @@ void VAbstractSpline::ChangedActivDraw(const QString &newName) selectable = false; currentColor = Qt::gray; } - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); this->setAcceptHoverEvents (selectable); emit setEnabledPoint(selectable); @@ -75,13 +75,13 @@ void VAbstractSpline::SetFactor(qreal factor) void VAbstractSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor)); } void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); } QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) diff --git a/src/tools/drawTools/vdrawtool.h b/src/tools/drawTools/vdrawtool.h index 801771591..d6e86c05d 100644 --- a/src/tools/drawTools/vdrawtool.h +++ b/src/tools/drawTools/vdrawtool.h @@ -196,7 +196,7 @@ protected: { currentColor = color; } - item->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + item->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); } } private: diff --git a/src/tools/drawTools/vtoolarc.cpp b/src/tools/drawTools/vtoolarc.cpp index 032ca5d9b..e45eb80e7 100644 --- a/src/tools/drawTools/vtoolarc.cpp +++ b/src/tools/drawTools/vtoolarc.cpp @@ -42,7 +42,7 @@ VToolArc::VToolArc(VPattern *doc, VContainer *data, quint32 id, const Valentina: path.addPath(arc->GetPath()); path.setFillRule( Qt::WindingFill ); this->setPath(path); - this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setAcceptHoverEvents(true); @@ -155,7 +155,7 @@ void VToolArc::ChangedActivDraw(const QString &newName) selectable = false; currentColor = Qt::gray; } - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); this->setAcceptHoverEvents (selectable); VDrawTool::ChangedActivDraw(newName); @@ -218,14 +218,14 @@ void VToolArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor)); } //cppcheck-suppress unusedFunction void VToolArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); } void VToolArc::RemoveReferens() @@ -278,7 +278,7 @@ void VToolArc::SaveDialog(QDomElement &domElement) void VToolArc::RefreshGeometry() { - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); const VArc *arc = VAbstractTool::data.GeometricObject(id); QPainterPath path; path.addPath(arc->GetPath()); diff --git a/src/tools/drawTools/vtoolcutarc.cpp b/src/tools/drawTools/vtoolcutarc.cpp index ef3ccad11..c363d4723 100644 --- a/src/tools/drawTools/vtoolcutarc.cpp +++ b/src/tools/drawTools/vtoolcutarc.cpp @@ -185,8 +185,8 @@ void VToolCutArc::ChangedActivDraw(const QString &newName) secondArc->setFlag(QGraphicsItem::ItemIsSelectable, false); secondArc->setAcceptHoverEvents(false); } - firstArc->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); - secondArc->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + firstArc->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); + secondArc->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); VToolPoint::ChangedActivDraw(newName); } diff --git a/src/tools/drawTools/vtoolline.cpp b/src/tools/drawTools/vtoolline.cpp index 143022e42..e62d9f09f 100644 --- a/src/tools/drawTools/vtoolline.cpp +++ b/src/tools/drawTools/vtoolline.cpp @@ -45,7 +45,7 @@ VToolLine::VToolLine(VPattern *doc, VContainer *data, quint32 id, quint32 firstP this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setAcceptHoverEvents(true); - this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor, LineStyle())); + this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle())); if (typeCreation == Valentina::FromGui) { @@ -142,7 +142,7 @@ void VToolLine::ChangedActivDraw(const QString &newName) selectable = false; currentColor = Qt::gray; } - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle())); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle())); this->setAcceptHoverEvents (selectable); VDrawTool::ChangedActivDraw(newName); } @@ -177,13 +177,13 @@ void VToolLine::RefreshDataInFile() void VToolLine::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor, LineStyle())); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor, LineStyle())); } void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle())); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle())); } void VToolLine::RemoveReferens() @@ -245,5 +245,5 @@ void VToolLine::RefreshGeometry() const VPointF *first = VAbstractTool::data.GeometricObject(firstPoint); const VPointF *second = VAbstractTool::data.GeometricObject(secondPoint); this->setLine(QLineF(first->toQPointF(), second->toQPointF())); - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle())); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle())); } diff --git a/src/tools/drawTools/vtoollinepoint.cpp b/src/tools/drawTools/vtoollinepoint.cpp index e19aec719..7c7bde930 100644 --- a/src/tools/drawTools/vtoollinepoint.cpp +++ b/src/tools/drawTools/vtoollinepoint.cpp @@ -39,7 +39,7 @@ VToolLinePoint::VToolLinePoint(VPattern *doc, VContainer *data, const quint32 &i QPointF point1 = data->GeometricObject(basePointId)->toQPointF(); QPointF point2 = data->GeometricObject(id)->toQPointF(); mainLine = new QGraphicsLineItem(QLineF(point1 - point2, QPointF()), this); - mainLine->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor, LineStyle())); + mainLine->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle())); mainLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); } @@ -53,13 +53,13 @@ void VToolLinePoint::ChangedActivDraw(const QString &newName) { currentColor = Qt::gray; } - mainLine->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle())); + mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle())); VToolPoint::ChangedActivDraw(newName); } void VToolLinePoint::RefreshGeometry() { - mainLine->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor, LineStyle())); + mainLine->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor, LineStyle())); VToolPoint::RefreshPointGeometry(*VDrawTool::data.GeometricObject(id)); QPointF point = VDrawTool::data.GeometricObject(id)->toQPointF(); QPointF basePoint = VDrawTool::data.GeometricObject(basePointId)->toQPointF(); diff --git a/src/tools/drawTools/vtoolpoint.cpp b/src/tools/drawTools/vtoolpoint.cpp index a2fe84741..f4ae47e14 100644 --- a/src/tools/drawTools/vtoolpoint.cpp +++ b/src/tools/drawTools/vtoolpoint.cpp @@ -30,9 +30,27 @@ const QString VToolPoint::TagName = QStringLiteral("point"); +#define DefRadius 2.0//mm + VToolPoint::VToolPoint(VPattern *doc, VContainer *data, quint32 id, QGraphicsItem *parent):VDrawTool(doc, data, id), - QGraphicsEllipseItem(parent), radius(qApp->toPixel(2)), namePoint(0), lineName(0) + QGraphicsEllipseItem(parent), radius(DefRadius), namePoint(0), lineName(0) { + switch(qApp->patternUnit()) + { + case Valentina::Mm: + radius = qApp->toPixel(DefRadius); + break; + case Valentina::Cm: + radius = qApp->toPixel(DefRadius/10.0); + break; + case Valentina::Inch: + radius = qApp->toPixel(DefRadius/25.4); + break; + default: + radius = qApp->toPixel(DefRadius); + break; + } + namePoint = new VGraphicsSimpleTextItem(this); connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolPoint::ShowContextMenu); namePoint->setBrush(Qt::black); @@ -81,7 +99,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName) selectable = false; currentColor = Qt::gray; } - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, selectable); this->setAcceptHoverEvents (selectable); namePoint->setFlag(QGraphicsItem::ItemIsMovable, selectable); @@ -89,7 +107,7 @@ void VToolPoint::ChangedActivDraw(const QString &newName) namePoint->setFlag(QGraphicsItem::ItemSendsGeometryChanges, selectable); namePoint->setBrush(QBrush(currentColor)); namePoint->setAcceptHoverEvents(selectable); - lineName->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + lineName->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); VDrawTool::ChangedActivDraw(newName); } @@ -121,31 +139,29 @@ void VToolPoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VToolPoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/factor)); } void VToolPoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); } void VToolPoint::RefreshPointGeometry(const VPointF &point) { - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); QRectF rec = QRectF(0, 0, radius*2/factor, radius*2/factor); rec.translate(-rec.center().x(), -rec.center().y()); this->setRect(rec); this->setPos(point.toQPointF()); - disconnect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, - &VToolPoint::NameChangePosition); + disconnect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition); QFont font = namePoint->font(); font.setPointSize(static_cast(namePoint->FontSize()/factor)); namePoint->setFont(font); namePoint->setText(point.name()); namePoint->setPos(QPointF(point.mx(), point.my())); - connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, - &VToolPoint::NameChangePosition); + connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolPoint::NameChangePosition); RefreshLine(); } @@ -158,11 +174,11 @@ void VToolPoint::RefreshLine() lineName->setLine(QLineF(p1, pRec - scenePos())); if (currentColor == Qt::gray) { - lineName->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + lineName->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); } else { - lineName->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor)); + lineName->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor)); } if (QLineF(p1, pRec - scenePos()).length() <= qApp->toPixel(4)) { diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index b723bff54..561c0646d 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -150,7 +150,7 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement) void VToolSinglePoint::setColorLabel(const Qt::GlobalColor &color) { namePoint->setBrush(color); - lineName->setPen(QPen(color, qApp->toPixel(widthHairLine)/factor)); + lineName->setPen(QPen(color, qApp->toPixel(qApp->widthHairLine())/factor)); } void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) diff --git a/src/tools/drawTools/vtoolspline.cpp b/src/tools/drawTools/vtoolspline.cpp index 6c545c5ee..ce1a7f6e1 100644 --- a/src/tools/drawTools/vtoolspline.cpp +++ b/src/tools/drawTools/vtoolspline.cpp @@ -40,7 +40,7 @@ VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const Vale path.addPath(spl->GetPath()); path.setFillRule( Qt::WindingFill ); this->setPath(path); - this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setAcceptHoverEvents(true); @@ -256,7 +256,7 @@ void VToolSpline::SaveDialog(QDomElement &domElement) void VToolSpline::RefreshGeometry() { - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); const VSpline *spl = VAbstractTool::data.GeometricObject(id); QPainterPath path; path.addPath(spl->GetPath()); diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index 50586b9b6..fd0f47c00 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -39,7 +39,7 @@ VToolSplinePath::VToolSplinePath(VPattern *doc, VContainer *data, quint32 id, co path.addPath(splPath->GetPath()); path.setFillRule( Qt::WindingFill ); this->setPath(path); - this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/factor)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsFocusable, true); this->setAcceptHoverEvents(true); @@ -284,7 +284,7 @@ void VToolSplinePath::SaveDialog(QDomElement &domElement) void VToolSplinePath::RefreshGeometry() { - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); const VSplinePath *splPath = VAbstractTool::data.GeometricObject(id); QPainterPath path; path.addPath(splPath->GetPath()); diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index 5fb1a7a0f..b757ea2cc 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -152,7 +152,7 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c if (c*c < a*a + b*b) { //Still don't know why this code handled. Need to think about that. - qWarning()<setPen(QPen(baseColor, qApp->toPixel(widthHairLine))); + this->setPen(QPen(baseColor, qApp->toPixel(qApp->widthHairLine()))); if (typeCreation == Valentina::FromGui) { @@ -129,13 +129,13 @@ void VNodeArc::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine))); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine()))); } void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine))); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine()))); } void VNodeArc::RefreshGeometry() diff --git a/src/tools/nodeDetails/vnodepoint.cpp b/src/tools/nodeDetails/vnodepoint.cpp index 25126cf02..0b2a0204c 100644 --- a/src/tools/nodeDetails/vnodepoint.cpp +++ b/src/tools/nodeDetails/vnodepoint.cpp @@ -44,7 +44,7 @@ VNodePoint::VNodePoint(VPattern *doc, VContainer *data, quint32 id, quint32 idPo lineName = new QGraphicsLineItem(this); connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VNodePoint::NameChangePosition); - this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); + this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine()))); this->setBrush(QBrush(Qt::NoBrush)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setAcceptHoverEvents(true); @@ -146,13 +146,13 @@ void VNodePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodePoint::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine))); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine()))); } void VNodePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine))); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine()))); } diff --git a/src/tools/nodeDetails/vnodespline.cpp b/src/tools/nodeDetails/vnodespline.cpp index 3ffd0ad8f..a9ad3124e 100644 --- a/src/tools/nodeDetails/vnodespline.cpp +++ b/src/tools/nodeDetails/vnodespline.cpp @@ -40,7 +40,7 @@ VNodeSpline::VNodeSpline(VPattern *doc, VContainer *data, quint32 id, quint32 id :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); - this->setPen(QPen(baseColor, qApp->toPixel(widthHairLine))); + this->setPen(QPen(baseColor, qApp->toPixel(qApp->widthHairLine()))); if (typeCreation == Valentina::FromGui) { @@ -133,13 +133,13 @@ void VNodeSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine))); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine()))); } void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine))); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine()))); } void VNodeSpline::RefreshGeometry() diff --git a/src/tools/nodeDetails/vnodesplinepath.cpp b/src/tools/nodeDetails/vnodesplinepath.cpp index 5c3c208b8..c8a01a065 100644 --- a/src/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/tools/nodeDetails/vnodesplinepath.cpp @@ -40,7 +40,7 @@ VNodeSplinePath::VNodeSplinePath(VPattern *doc, VContainer *data, quint32 id, qu :VAbstractNode(doc, data, id, idSpline, idTool, qoParent), QGraphicsPathItem(parent) { RefreshGeometry(); - this->setPen(QPen(baseColor, qApp->toPixel(widthHairLine))); + this->setPen(QPen(baseColor, qApp->toPixel(qApp->widthHairLine()))); if (typeCreation == Valentina::FromGui) { @@ -136,13 +136,13 @@ void VNodeSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VNodeSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine))); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine()))); } void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine))); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine()))); } void VNodeSplinePath::RefreshGeometry() diff --git a/src/widgets/textdelegate.cpp b/src/widgets/textdelegate.cpp index 45c57d6c6..d45b228cf 100644 --- a/src/widgets/textdelegate.cpp +++ b/src/widgets/textdelegate.cpp @@ -41,9 +41,8 @@ QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem Q_UNUSED(option); Q_UNUSED(index); QLineEdit *editor = new QLineEdit(parent); - QRegExp re("^(([^+ -/()\\^*%:;\"\'=.,><0-9]){1,1}[^+ -/()\\^*%:;\"\'=><]([0-9]){0,}){0,}$"); - QRegExpValidator *v = new QRegExpValidator(re); - editor->setValidator( v ); + //Same regex pattern in xsd file + editor->setValidator( new QRegExpValidator(QRegExp("([\\p{L}]|[^0-9])[_\\p{L}0-9]*")) ); connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor); return editor; } diff --git a/src/widgets/vapplication.cpp b/src/widgets/vapplication.cpp index c33c7b579..45ecac5d6 100644 --- a/src/widgets/vapplication.cpp +++ b/src/widgets/vapplication.cpp @@ -38,13 +38,16 @@ const qreal VApplication::PrintDPI = 96.0; -// reimplemented from QApplication so we can throw exceptions in slots -VApplication::VApplication(int &argc, char **argv) - : QApplication(argc, argv), _patternUnit(Valentina::Cm), _patternType(Pattern::Individual) -{ +#define DefWidth 1.2//mm +VApplication::VApplication(int &argc, char **argv) + : QApplication(argc, argv), _patternUnit(Valentina::Cm), _patternType(Pattern::Individual), + _widthMainLine(DefWidth), _widthHairLine(DefWidth/3.0) +{ + InitLineWidth(); } +// reimplemented from QApplication so we can throw exceptions in slots bool VApplication::notify(QObject *receiver, QEvent *event) { try @@ -157,13 +160,41 @@ QString VApplication::pathToTables() const QString VApplication::translationsPath() const { - #ifdef Q_OS_WIN - return QApplication::applicationDirPath() + QStringLiteral("/translations"); - #else - #ifdef QT_DEBUG - return QApplication::applicationDirPath() + QStringLiteral("/translations"); +#ifdef Q_OS_WIN + return QApplication::applicationDirPath() + QStringLiteral("/translations"); +#else +#ifdef QT_DEBUG + return QApplication::applicationDirPath() + QStringLiteral("/translations"); #else return QStringLiteral("/usr/share/valentina/translations"); #endif #endif } + + +void VApplication::InitLineWidth() +{ + switch(_patternUnit) + { + case Valentina::Mm: + _widthMainLine = DefWidth; + break; + case Valentina::Cm: + _widthMainLine = DefWidth/10.0; + break; + case Valentina::Inch: + _widthMainLine = DefWidth/25.4; + break; + default: + _widthMainLine = DefWidth; + break; + } + _widthHairLine = _widthMainLine/3.0; +} + + +void VApplication::setPatternUnit(const Valentina::Units &patternUnit) +{ + _patternUnit = patternUnit; + InitLineWidth(); +} diff --git a/src/widgets/vapplication.h b/src/widgets/vapplication.h index 6d3b63eae..c6a3ff14f 100644 --- a/src/widgets/vapplication.h +++ b/src/widgets/vapplication.h @@ -59,19 +59,24 @@ public: * @param event event. * @return value that is returned from the receiver's event handler. */ - virtual bool notify(QObject * receiver, QEvent * event); - Valentina::Units patternUnit() const; - void setPatternUnit(const Valentina::Units &patternUnit); + virtual bool notify(QObject * receiver, QEvent * event); + Valentina::Units patternUnit() const; + void setPatternUnit(const Valentina::Units &patternUnit); Pattern::Measurements patternType() const; - void setPatternType(const Pattern::Measurements &patternType); - double toPixel(double unit) const; - double fromPixel(double pix) const; - static const qreal PrintDPI; - QString translationsPath() const; - QString pathToTables() const; + void setPatternType(const Pattern::Measurements &patternType); + double toPixel(double unit) const; + double fromPixel(double pix) const; + static const qreal PrintDPI; + QString translationsPath() const; + QString pathToTables() const; + qreal widthMainLine() const; + qreal widthHairLine() const; private: - Valentina::Units _patternUnit; + Valentina::Units _patternUnit; Pattern::Measurements _patternType; + qreal _widthMainLine; + qreal _widthHairLine; + void InitLineWidth(); }; inline Valentina::Units VApplication::patternUnit() const @@ -79,11 +84,6 @@ inline Valentina::Units VApplication::patternUnit() const return _patternUnit; } -inline void VApplication::setPatternUnit(const Valentina::Units &patternUnit) -{ - _patternUnit = patternUnit; -} - inline Pattern::Measurements VApplication::patternType() const { return _patternType; @@ -94,5 +94,14 @@ inline void VApplication::setPatternType(const Pattern::Measurements &patternTyp _patternType = patternType; } +inline qreal VApplication::widthMainLine() const +{ + return _widthMainLine; +} + +inline qreal VApplication::widthHairLine() const +{ + return _widthHairLine; +} #endif // VAPPLICATION_H diff --git a/src/widgets/vcontrolpointspline.cpp b/src/widgets/vcontrolpointspline.cpp index 2db37ee54..9f850ff44 100644 --- a/src/widgets/vcontrolpointspline.cpp +++ b/src/widgets/vcontrolpointspline.cpp @@ -42,7 +42,7 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint: QRectF rec = QRectF(0, 0, radius*2, radius*2); rec.translate(-rec.center().x(), -rec.center().y()); this->setRect(rec); - this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); + this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine()))); this->setBrush(QBrush(Qt::NoBrush)); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsMovable, true); @@ -53,20 +53,20 @@ VControlPointSpline::VControlPointSpline(const qint32 &indexSpline, SplinePoint: QPointF p1, p2; VAbstractTool::LineIntersectCircle(QPointF(), radius, QLineF( QPointF(), splinePoint-controlPoint), p1, p2); controlLine = new QGraphicsLineItem(QLineF(splinePoint-controlPoint, p1), this); - controlLine->setPen(QPen(Qt::red, qApp->toPixel(widthHairLine))); + controlLine->setPen(QPen(Qt::red, qApp->toPixel(qApp->widthHairLine()))); controlLine->setFlag(QGraphicsItem::ItemStacksBehindParent, true); } void VControlPointSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); + this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); } void VControlPointSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); + this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine()))); } QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) @@ -95,14 +95,14 @@ void VControlPointSpline::setEnabledPoint(bool enable) { if (enable == true) { - this->setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); + this->setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine()))); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setAcceptHoverEvents(true); } else { - this->setPen(QPen(Qt::gray, qApp->toPixel(widthHairLine))); + this->setPen(QPen(Qt::gray, qApp->toPixel(qApp->widthHairLine()))); this->setFlag(QGraphicsItem::ItemIsSelectable, false); this->setFlag(QGraphicsItem::ItemIsMovable, false); this->setAcceptHoverEvents(false); diff --git a/src/widgets/vitem.cpp b/src/widgets/vitem.cpp index 5ef3d68da..698a1e1f2 100644 --- a/src/widgets/vitem.cpp +++ b/src/widgets/vitem.cpp @@ -63,19 +63,19 @@ void VItem::checkItemChange() QRectF myrect = sceneBoundingRect(); if ( rect.contains( myrect )==true ) { - setPen(QPen(Qt::black, qApp->toPixel(widthMainLine))); + setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); emit itemOut( numInOutList, false ); } else { - setPen(QPen(Qt::red, qApp->toPixel(widthMainLine))); + setPen(QPen(Qt::red, qApp->toPixel(qApp->widthMainLine()))); emit itemOut( numInOutList, true ); } QList list = QGraphicsItem::collidingItems (); if ( list.size() - 2 > 0 ) { list.append( this ); - setPen(QPen(Qt::red, qApp->toPixel(widthMainLine))); + setPen(QPen(Qt::red, qApp->toPixel(qApp->widthMainLine()))); emit itemColliding( list, 1 );//Detail intersect with other details. } else diff --git a/src/widgets/vsimplearc.cpp b/src/widgets/vsimplearc.cpp index 68cb158e9..a734fea9a 100644 --- a/src/widgets/vsimplearc.cpp +++ b/src/widgets/vsimplearc.cpp @@ -34,11 +34,11 @@ VSimpleArc::VSimpleArc(quint32 id, Qt::GlobalColor *currentColor, qreal *factor, { if (factor == nullptr) { - setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); + setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine()))); } else { - setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/ *factor)); + setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/ *factor)); } setFlag(QGraphicsItem::ItemIsSelectable, true); setAcceptHoverEvents(true); @@ -58,11 +58,11 @@ void VSimpleArc::hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_UNUSED(event); if (factor == nullptr) { - this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine))); + this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthMainLine()))); } else { - this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine)/ *factor)); + this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthMainLine())/ *factor)); } } @@ -71,10 +71,10 @@ void VSimpleArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_UNUSED(event); if (factor == nullptr) { - this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine))); + this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine()))); } else { - this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine)/ *factor)); + this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine())/ *factor)); } } diff --git a/src/widgets/vsimplespline.cpp b/src/widgets/vsimplespline.cpp index d3786517d..fb0d54e10 100644 --- a/src/widgets/vsimplespline.cpp +++ b/src/widgets/vsimplespline.cpp @@ -34,11 +34,11 @@ VSimpleSpline::VSimpleSpline(quint32 id, Qt::GlobalColor *currentColor, qreal *f { if (factor == nullptr) { - setPen(QPen(Qt::black, qApp->toPixel(widthHairLine))); + setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine()))); } else { - setPen(QPen(Qt::black, qApp->toPixel(widthHairLine)/ *factor)); + setPen(QPen(Qt::black, qApp->toPixel(qApp->widthHairLine())/ *factor)); } setFlag(QGraphicsItem::ItemIsSelectable, true); setAcceptHoverEvents(true); @@ -48,7 +48,7 @@ void VSimpleSpline::ChangedActivDraw(const bool &flag) { setFlag(QGraphicsItem::ItemIsSelectable, flag); setAcceptHoverEvents(flag); - setPen(QPen(*currentColor, qApp->toPixel(widthHairLine)/ *factor)); + setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine())/ *factor)); } void VSimpleSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) @@ -65,11 +65,11 @@ void VSimpleSpline::hoverMoveEvent(QGraphicsSceneHoverEvent *event) Q_UNUSED(event); if (factor == nullptr) { - this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine))); + this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthMainLine()))); } else { - this->setPen(QPen(*currentColor, qApp->toPixel(widthMainLine)/ *factor)); + this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthMainLine())/ *factor)); } } @@ -78,10 +78,10 @@ void VSimpleSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_UNUSED(event); if (factor == nullptr) { - this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine))); + this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine()))); } else { - this->setPen(QPen(*currentColor, qApp->toPixel(widthHairLine)/ *factor)); + this->setPen(QPen(*currentColor, qApp->toPixel(qApp->widthHairLine())/ *factor)); } } diff --git a/src/widgets/vsimplesplinepath.cpp b/src/widgets/vsimplesplinepath.cpp index ccd0021d5..c247823a9 100644 --- a/src/widgets/vsimplesplinepath.cpp +++ b/src/widgets/vsimplesplinepath.cpp @@ -46,11 +46,11 @@ void VSimpleSplinePath::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) void VSimpleSplinePath::hoverMoveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthMainLine)/ *factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthMainLine())/ *factor)); } void VSimpleSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - this->setPen(QPen(currentColor, qApp->toPixel(widthHairLine)/ *factor)); + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/ *factor)); } diff --git a/src/xml/vindividualmeasurements.cpp b/src/xml/vindividualmeasurements.cpp index 28f870602..867099140 100644 --- a/src/xml/vindividualmeasurements.cpp +++ b/src/xml/vindividualmeasurements.cpp @@ -28,28 +28,58 @@ #include "vindividualmeasurements.h" -const QString VIndividualMeasurements::AttrIgnore = QStringLiteral("ignore"); -const QString VIndividualMeasurements::AttrName = QStringLiteral("name"); -const QString VIndividualMeasurements::AttrM_number = QStringLiteral("m_number"); -const QString VIndividualMeasurements::AttrGui_text = QStringLiteral("gui_text"); -const QString VIndividualMeasurements::AttrValue = QStringLiteral("value"); +const QString VIndividualMeasurements::AttrIgnore = QStringLiteral("ignore"); +const QString VIndividualMeasurements::AttrName = QStringLiteral("name"); +const QString VIndividualMeasurements::AttrM_number = QStringLiteral("m_number"); +const QString VIndividualMeasurements::AttrGui_text = QStringLiteral("gui_text"); +const QString VIndividualMeasurements::AttrValue = QStringLiteral("value"); const QString VIndividualMeasurements::AttrDescription = QStringLiteral("description"); -const QString VIndividualMeasurements::AttrLang = QStringLiteral("lang"); -const QString VIndividualMeasurements::AttrFamily_name = QStringLiteral("family-name"); -const QString VIndividualMeasurements::AttrGiven_name = QStringLiteral("given-name"); -const QString VIndividualMeasurements::AttrBirth_date = QStringLiteral("birth-date"); -const QString VIndividualMeasurements::AttrSex = QStringLiteral("sex"); + +const QString VIndividualMeasurements::TagLang = QStringLiteral("lang"); +const QString VIndividualMeasurements::TagFamily_name = QStringLiteral("family-name"); +const QString VIndividualMeasurements::TagGiven_name = QStringLiteral("given-name"); +const QString VIndividualMeasurements::TagBirth_date = QStringLiteral("birth-date"); +const QString VIndividualMeasurements::TagSex = QStringLiteral("sex"); +const QString VIndividualMeasurements::TagUnit = QStringLiteral("unit"); VIndividualMeasurements::VIndividualMeasurements(VContainer *data):VDomDocument(data) { } -Valentina::Units VIndividualMeasurements::Unit() +Valentina::Units VIndividualMeasurements::Unit() const { - const QString unit = UniqueTagText(AttrUnit, UnitCM); + const QString unit = UniqueTagText(TagUnit, UnitCM); return VDomDocument::StrToUnits(unit); } +void VIndividualMeasurements::setUnit(const Valentina::Units &unit) +{ + const QDomNodeList nodeList = this->elementsByTagName(AttrUnit); + if (nodeList.isEmpty()) + { + qWarning()<<"Can't save measurements units"< Date: Thu, 27 Mar 2014 13:41:00 +0200 Subject: [PATCH 58/60] Noisy Debug Hook for Qt. --HG-- branch : feature --- src/main.cpp | 105 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 84 insertions(+), 21 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 8b1711f86..de0214e9c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,31 +30,87 @@ #include "widgets/vapplication.h" #include #include +#include +#include #include "tablewindow.h" -void myMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg) +void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { - QByteArray localMsg = msg.toLocal8Bit(); - switch (type) + // Why on earth didn't Qt want to make failed signal/slot connections qWarning? + if ((type == QtDebugMsg) && msg.contains("::connect")) { - case QtDebugMsg: - fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, - context.function); - break; - case QtWarningMsg: - fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, - context.function); - break; - case QtCriticalMsg: - fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, - context.function); - break; - case QtFatalMsg: - fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, - context.function); + type = QtWarningMsg; + } + + // this is another one that doesn't make sense as just a debug message. pretty serious + // sign of a problem + // http://www.developer.nokia.com/Community/Wiki/QPainter::begin:Paint_device_returned_engine_%3D%3D_0_(Known_Issue) + if ((type == QtDebugMsg) && msg.contains("QPainter::begin") && msg.contains("Paint device returned engine")) + { + type = QtWarningMsg; + } + + // This qWarning about "Cowardly refusing to send clipboard message to hung application..." + // is something that can easily happen if you are debugging and the application is paused. + // As it is so common, not worth popping up a dialog. + if ((type == QtWarningMsg) && QString(msg).contains("QClipboard::event") + && QString(msg).contains("Cowardly refusing")) + { + type = QtDebugMsg; + } + + // only the GUI thread should display message boxes. If you are + // writing a multithreaded application and the error happens on + // a non-GUI thread, you'll have to queue the message to the GUI + QCoreApplication *instance = QCoreApplication::instance(); + const bool isGuiThread = instance && (QThread::currentThread() == instance->thread()); + + if (isGuiThread) + { + QByteArray localMsg = msg.toLocal8Bit(); + QMessageBox messageBox; + switch (type) { + case QtDebugMsg: + fprintf(stderr, "Debug: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, + context.function); + return; + case QtWarningMsg: + messageBox.setIcon(QMessageBox::Warning); + messageBox.setInformativeText(msg); + messageBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + fprintf(stderr, "Warning: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, + context.function); + break; + case QtCriticalMsg: + messageBox.setIcon(QMessageBox::Critical); + messageBox.setInformativeText(msg); + messageBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); + fprintf(stderr, "Critical: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, + context.function); + break; + case QtFatalMsg: + messageBox.setIcon(QMessageBox::Critical); + messageBox.setInformativeText(msg); + messageBox.setStandardButtons(QMessageBox::Cancel); + fprintf(stderr, "Fatal: %s (%s:%u, %s)\n", localMsg.constData(), context.file, context.line, + context.function); + break; + default: + break; + } + + const int ret = messageBox.exec(); + if (ret == QMessageBox::Cancel) + { abort(); - default: - break; + } + } + else + { + if (type != QtDebugMsg) + { + abort(); // be NOISY unless overridden! + } } } @@ -65,8 +121,15 @@ int main(int argc, char *argv[]) Q_INIT_RESOURCE(schema); Q_INIT_RESOURCE(theme); - qInstallMessageHandler(myMessageOutput); VApplication app(argc, argv); +#ifdef QT_DEBUG + // Because our "noisy" message handler uses the GUI subsystem for message + // boxes, we can't install it until after the QApplication is constructed. But it + // is good to be the very next thing to run, to start catching warnings ASAP. + { + qInstallMessageHandler(noisyFailureMsgHandler); + } +#endif app.setApplicationDisplayName("Valentina"); app.setApplicationName("Valentina"); app.setOrganizationName("ValentinaTeam"); From a74351495c9d21949c3fd2f6b2397746116443d3 Mon Sep 17 00:00:00 2001 From: dismine Date: Fri, 28 Mar 2014 15:11:46 +0200 Subject: [PATCH 59/60] Issues #19, #7, #78 --HG-- branch : feature --- .../schema/individual_measurements.xsd | 2 +- share/resources/schema/pattern.xsd | 2 +- .../schema/standard_measurements.xsd | 2 +- src/container/vcontainer.cpp | 11 +- src/container/vcontainer.h | 6 + src/dialogs/app/dialoghistory.cpp | 10 +- src/dialogs/app/dialogincrements.cpp | 288 ++++++++++++++---- src/dialogs/app/dialogincrements.h | 8 +- src/dialogs/app/dialogincrements.ui | 96 +++--- .../app/dialogindividualmeasurements.cpp | 13 +- .../app/dialogindividualmeasurements.h | 12 +- .../app/dialogstandardmeasurements.cpp | 4 +- src/dialogs/app/dialogstandardmeasurements.h | 7 +- src/dialogs/tools/dialogdetail.cpp | 4 +- src/dialogs/tools/dialogtool.cpp | 2 +- src/geometry/varc.cpp | 2 +- src/geometry/vdetail.cpp | 8 +- src/geometry/vequidistant.cpp | 6 +- src/geometry/vspline.cpp | 4 +- src/geometry/vsplinepoint.cpp | 2 +- src/mainwindow.cpp | 68 +---- src/tablewindow.cpp | 2 +- src/tools/drawTools/vtoolshoulderpoint.cpp | 2 +- src/tools/drawTools/vtoolsinglepoint.cpp | 1 + src/tools/drawTools/vtoolsplinepath.cpp | 2 +- src/tools/drawTools/vtooltriangle.cpp | 2 +- src/tools/nodeDetails/vabstractnode.cpp | 6 +- src/tools/vabstracttool.cpp | 6 +- src/tools/vtooldetail.cpp | 6 +- src/tools/vtooluniondetails.cpp | 6 +- src/widgets/textdelegate.cpp | 5 +- src/widgets/textdelegate.h | 3 +- src/xml/vdomdocument.cpp | 78 +++++ src/xml/vdomdocument.h | 6 +- src/xml/vindividualmeasurements.cpp | 108 ++++--- src/xml/vindividualmeasurements.h | 36 ++- src/xml/vpattern.cpp | 36 ++- src/xml/vpattern.h | 1 + src/xml/vstandardmeasurements.cpp | 9 +- src/xml/vstandardmeasurements.h | 5 +- 40 files changed, 593 insertions(+), 284 deletions(-) diff --git a/share/resources/schema/individual_measurements.xsd b/share/resources/schema/individual_measurements.xsd index 39928eaa9..55cd7f9a3 100644 --- a/share/resources/schema/individual_measurements.xsd +++ b/share/resources/schema/individual_measurements.xsd @@ -874,7 +874,7 @@ - + diff --git a/share/resources/schema/pattern.xsd b/share/resources/schema/pattern.xsd index 532c2a12e..1f1b0c00c 100644 --- a/share/resources/schema/pattern.xsd +++ b/share/resources/schema/pattern.xsd @@ -213,7 +213,7 @@ - + diff --git a/share/resources/schema/standard_measurements.xsd b/share/resources/schema/standard_measurements.xsd index ebff0c5bf..4ac6eb0d5 100644 --- a/share/resources/schema/standard_measurements.xsd +++ b/share/resources/schema/standard_measurements.xsd @@ -38,7 +38,7 @@ - + diff --git a/src/container/vcontainer.cpp b/src/container/vcontainer.cpp index 9f3209a21..b108b3b81 100644 --- a/src/container/vcontainer.cpp +++ b/src/container/vcontainer.cpp @@ -81,27 +81,20 @@ void VContainer::setData(const VContainer &data) switch (i.value()->getType()) { case (GObject::Arc): - { CopyGObject(data, i.key()); break; - } case (GObject::Point): - { CopyGObject(data, i.key()); break; - } case (GObject::Spline): - { CopyGObject(data, i.key()); break; - } case (GObject::SplinePath): - { CopyGObject(data, i.key()); break; - } default: - qWarning()<<"Don't know how copy this type."; + qDebug()<<"Don't know how copy this type."; + break; } } measurements = *data.DataMeasurements(); diff --git a/src/container/vcontainer.h b/src/container/vcontainer.h index 88a4a1329..6ccf5c1e1 100644 --- a/src/container/vcontainer.h +++ b/src/container/vcontainer.h @@ -272,6 +272,7 @@ public: * @brief ClearIncrementTable clear increment table */ void ClearIncrementTable(); + void ClearMeasurements(); /** * @brief ClearLengthLines clear length lines */ @@ -478,6 +479,11 @@ inline void VContainer::ClearIncrementTable() increments.clear(); } +inline void VContainer::ClearMeasurements() +{ + measurements.clear(); +} + inline void VContainer::ClearLengthLines() { lengthLines.clear(); diff --git a/src/dialogs/app/dialoghistory.cpp b/src/dialogs/app/dialoghistory.cpp index fbf9e1576..5c21887d8 100644 --- a/src/dialogs/app/dialoghistory.cpp +++ b/src/dialogs/app/dialoghistory.cpp @@ -170,7 +170,7 @@ QString DialogHistory::Record(const VToolRecord &tool) const QDomElement domElement = doc->elementById(QString().setNum(tool.getId())); if (domElement.isElement() == false) { - qWarning()<<"Can't find element by id"< #include @@ -39,26 +40,48 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par :DialogTool(data, parent), ui(new Ui::DialogIncrements), data(data), doc(doc), row(0), column(0), m(nullptr) { ui->setupUi(this); - TextDelegate *textDelegate = new TextDelegate(ui->tableWidgetIncrement); + + if (qApp->patternType() == Pattern::Individual) + { + const QString filePath = doc->MPath(); + try + { + VDomDocument::ValidateXML("://schema/individual_measurements.xsd", filePath); + m = new VIndividualMeasurements(data); + m->setContent(filePath); + } + catch(VException &e) + { + e.CriticalMessageBox(tr("File error."), this); + emit DialogClosed(QDialog::Rejected); + return; + } + } + + //Same regex in each shema files. Don't forget synchronize. + TextDelegate *textDelegate = new TextDelegate("^([^0-9-*/^+=\\s\\(\\)%:;!]){1,1}([^-*/^+=\\s\\(\\)%:;!]){0,}$", + ui->tableWidgetIncrement); ui->tableWidgetIncrement->setItemDelegateForColumn(0, textDelegate);// name DoubleSpinBoxDelegate *doubleDelegate = new DoubleSpinBoxDelegate(ui->tableWidgetIncrement); ui->tableWidgetIncrement->setItemDelegateForColumn(2, doubleDelegate);// base value ui->tableWidgetIncrement->setItemDelegateForColumn(3, doubleDelegate);// in sizes ui->tableWidgetIncrement->setItemDelegateForColumn(4, doubleDelegate);// in heights + FillMeasurements(); + FillIncrements(); + FillLengthLines(); + FillLengthSplines(); + FillLengthArcs(); + if (qApp->patternType() == Pattern::Standard) { - ui->labelBirthDate->setVisible(false); - ui->lineEditBirthDate->setVisible(false); - ui->labelFamilyName->setVisible(false); - ui->lineEditFamilyName->setVisible(false); - ui->labelGivenName->setVisible(false); - ui->lineEditGivenName->setVisible(false); - ui->labelSex->setVisible(false); - ui->lineEditSex->setVisible(false); + ui->pagePersonalInformation->setVisible(false); } else { + QRegExpValidator *reg = new QRegExpValidator(QRegExp("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*")); + ui->lineEditMail->setValidator(reg); + ui->tableWidgetMeasurements->setColumnHidden( 1, true );// calculated value ui->tableWidgetMeasurements->setColumnHidden( 3, true );// in sizes ui->tableWidgetMeasurements->setColumnHidden( 4, true );// in heights @@ -69,17 +92,32 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par ui->tableWidgetMeasurements->setItemDelegateForColumn(2, doubleDelegate);// base value - connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementsChanged); + connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged); + + ui->lineEditGivenName->setText(m->GivenName()); + ui->lineEditFamilyName->setText(m->FamilyName()); + + ui->comboBoxSex->addItem(tr("male"),QVariant(m->GenderToStr(VIndividualMeasurements::Male))); + ui->comboBoxSex->addItem(tr("female"),QVariant(m->GenderToStr(VIndividualMeasurements::Female))); + qint32 index = ui->comboBoxSex->findData(m->GenderToStr(m->Sex())); + if (index != -1) + { + ui->comboBoxSex->setCurrentIndex(index); + } + + ui->dateEditBirthDate->setDate(m->BirthDate()); + ui->lineEditMail->setText(m->Mail()); + + connect(ui->lineEditGivenName, &QLineEdit::editingFinished, this, &DialogIncrements::SaveGivenName); + connect(ui->lineEditFamilyName, &QLineEdit::editingFinished, this, &DialogIncrements::SaveFamilyName); + connect(ui->lineEditMail, &QLineEdit::editingFinished, this, &DialogIncrements::SaveEmail); + connect(ui->comboBoxSex, static_cast(&QComboBox::currentIndexChanged), this, + &DialogIncrements::SaveSex); + connect(ui->dateEditBirthDate, &QDateEdit::dateChanged, this, &DialogIncrements::SaveBirthDate); } ui->toolBoxMeasurements->setCurrentIndex(1); - FillMeasurements(); - FillIncrements(); - FillLengthLines(); - FillLengthSplines(); - FillLengthArcs(); - connect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged); connect(ui->toolButtonAdd, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonAdd); connect(ui->toolButtonRemove, &QPushButton::clicked, this, &DialogIncrements::clickedToolButtonRemove); @@ -90,22 +128,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par ui->tabWidget->setCurrentIndex(0); - if (qApp->patternType() == Pattern::Individual) - { - QString filePath = doc->MPath(); - try - { - VDomDocument::ValidateXML("://schema/individual_measurements.xsd", filePath); - m = new VIndividualMeasurements(data); - m->setContent(filePath); - } - catch(VException &e) - { - qWarning()<<"File error."<toolButtonOpenMeasurements, &QToolButton::clicked, this, &DialogIncrements::OpenTable); } void DialogIncrements::FillMeasurements() @@ -132,12 +155,20 @@ void DialogIncrements::FillMeasurements() item->setTextAlignment(Qt::AlignHCenter); item->setFont(QFont("Times", 12, QFont::Bold)); item->setToolTip(m.GetDescription()); + // set the item non-editable (view only), and non-selectable + Qt::ItemFlags flags = item->flags(); + flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag + item->setFlags(flags); ui->tableWidgetMeasurements->setItem(currentRow, 0, item); if (qApp->patternType() == Pattern::Standard) { QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(data->GetValueStandardTableRow(iMap.key()))); item->setTextAlignment(Qt::AlignHCenter); + // set the item non-editable (view only), and non-selectable + Qt::ItemFlags flags = item->flags(); + flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag + item->setFlags(flags); ui->tableWidgetMeasurements->setItem(currentRow, 1, item); } @@ -149,15 +180,27 @@ void DialogIncrements::FillMeasurements() { QTableWidgetItem *item = new QTableWidgetItem(QString().setNum(m.GetKsize())); item->setTextAlignment(Qt::AlignHCenter); + // set the item non-editable (view only), and non-selectable + Qt::ItemFlags flags = item->flags(); + flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag + item->setFlags(flags); ui->tableWidgetMeasurements->setItem(currentRow, 3, item); item = new QTableWidgetItem(QString().setNum(m.GetKheight())); item->setTextAlignment(Qt::AlignHCenter); + // set the item non-editable (view only), and non-selectable + flags = item->flags(); + flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag + item->setFlags(flags); ui->tableWidgetMeasurements->setItem(currentRow, 4, item); } item = new QTableWidgetItem(m.GetNumber()); item->setTextAlignment(Qt::AlignHCenter); + // set the item non-editable (view only), and non-selectable + flags = item->flags(); + flags &= ~(Qt::ItemIsSelectable | Qt::ItemIsEditable); // reset/clear the flag + item->setFlags(flags); ui->tableWidgetMeasurements->setItem(currentRow, 5, item); } ui->tableWidgetMeasurements->verticalHeader()->setDefaultSectionSize(20); @@ -339,8 +382,10 @@ void DialogIncrements::FillLengthArcs() void DialogIncrements::FullUpdateFromFile() { + disconnect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged); ui->tableWidgetMeasurements->clearContents(); FillMeasurements(); + connect(ui->tableWidgetMeasurements, &QTableWidget::cellChanged, this, &DialogIncrements::MeasurementChanged); disconnect(ui->tableWidgetIncrement, &QTableWidget::cellChanged, this, &DialogIncrements::IncrementChanged); ui->tableWidgetIncrement->clearContents(); @@ -357,6 +402,139 @@ void DialogIncrements::FullUpdateFromFile() FillLengthArcs(); } +void DialogIncrements::SaveGivenName() +{ + m->setGivenName(ui->lineEditGivenName->text()); + if (m->SaveDocument(doc->MPath()) == false) + { + qDebug()<<"Can't save GivenName"; + } +} + +void DialogIncrements::SaveFamilyName() +{ + + m->setFamilyName(ui->lineEditFamilyName->text()); + if (m->SaveDocument(doc->MPath()) == false) + { + qDebug()<<"Can't save FamilyName"; + } +} + +void DialogIncrements::SaveEmail() +{ + m->setMail(ui->lineEditMail->text()); + if (m->SaveDocument(doc->MPath()) == false) + { + qDebug()<<"Can't save Email"; + } +} + +void DialogIncrements::SaveSex(int index) +{ + m->setSex(m->StrToGender(ui->comboBoxSex->itemData(index).toString())); + if (m->SaveDocument(doc->MPath()) == false) + { + qDebug()<<"Can't save Sex"; + } +} + +void DialogIncrements::SaveBirthDate(const QDate & date) +{ + m->setBirthDate(date); + if (m->SaveDocument(doc->MPath()) == false) + { + qDebug()<<"Can't save BirthDate"; + } +} + +void DialogIncrements::OpenTable() +{ + QString text = tr("Measurements use different units than pattern. This pattern required measurements in %1") + .arg(doc->UnitsToStr(qApp->patternUnit())); + if (qApp->patternType() == Pattern::Individual) + { + const QString filter(tr("Individual measurements (*.vit)")); + const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter); + if (filePath.isEmpty()) + { + return; + } + + VIndividualMeasurements *m1 = nullptr; + try + { + VDomDocument::ValidateXML("://schema/individual_measurements.xsd", filePath); + + m1 = new VIndividualMeasurements(data); + m1->setContent(filePath); + } + catch(VException &e) + { + e.CriticalMessageBox(tr("File error."), this); + delete m1; + emit DialogClosed(QDialog::Rejected); + return; + } + Valentina::Units mUnit = m1->Unit(); + if (qApp->patternUnit() != mUnit) + { + QMessageBox::critical(this, tr("Wrong units."), text); + delete m1; + return; + } + delete m; + m = m1; + data->ClearMeasurements(); + m->Measurements(); + emit FullUpdateTree(); + + doc->SetPath(filePath); + emit haveLiteChange(); + } + else + { + const QString filter(tr("Standard measurements (*.vst)")); + const QString filePath = QFileDialog::getOpenFileName(this, tr("Open file"), QDir::homePath(), filter); + if (filePath.isEmpty()) + { + return; + } + + VStandardMeasurements *m1 = nullptr; + try + { + VDomDocument::ValidateXML("://schema/standard_measurements.xsd", filePath); + + m1 = new VStandardMeasurements(data); + m1->setContent(filePath); + Valentina::Units mUnit = m1->Unit(); + if (qApp->patternUnit() != mUnit) + { + QMessageBox::critical(this, tr("Wrong units."), text); + delete m1; + return; + } + m1->SetSize(); + m1->SetHeight(); + data->ClearMeasurements(); + m1->Measurements(); + delete m1; + emit FullUpdateTree(); + + doc->SetPath(filePath); + emit haveLiteChange(); + } + catch(VException &e) + { + e.CriticalMessageBox(tr("File error."), this); + delete m1; + emit DialogClosed(QDialog::Rejected); + return; + } + } +} + void DialogIncrements::clickedToolButtonAdd() { ui->tableWidgetIncrement->setFocus(Qt::OtherFocusReason); @@ -467,7 +645,7 @@ void DialogIncrements::IncrementChanged ( qint32 row, qint32 column ) QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement() == false) { - qWarning()<<"Cant't find increment with id = "<text()); + const QTableWidgetItem *itemName = ui->tableWidgetMeasurements->item(row, 0); + QTableWidgetItem *item = ui->tableWidgetMeasurements->item(row, 2); + + VMeasurement measur = data->GetMeasurement(itemName->text()); + const QString tag = measur.TagName(); + QDomNodeList list = m->elementsByTagName(tag); + QDomElement domElement = list.at(0).toElement(); + if (domElement.isElement() == false) + { + qDebug()<<"Cant't find measurement "<SetAttribute(domElement, VIndividualMeasurements::AttrValue, item->text()); + if (m->SaveDocument(doc->MPath()) == false) + { + qDebug()<<"Can't save measurement"; + } bool ok = false; const qreal base = item->text().replace(",", ".").toDouble(&ok); if (ok == false) { measur.setBase(0); item->setText("0"); - qWarning()<<"Can't convert toDouble measurement value"<UpdateMeasurement(itemName->text(), measur); + data->ClearMeasurements(); + m->Measurements(); + emit FullUpdateTree(); break; } default: break; } - emit haveLiteChange(); } void DialogIncrements::closeEvent(QCloseEvent *event) @@ -562,4 +745,5 @@ void DialogIncrements::closeEvent(QCloseEvent *event) DialogIncrements::~DialogIncrements() { delete ui; + delete m; } diff --git a/src/dialogs/app/dialogincrements.h b/src/dialogs/app/dialogincrements.h index eb920b00c..c988f5b1e 100644 --- a/src/dialogs/app/dialogincrements.h +++ b/src/dialogs/app/dialogincrements.h @@ -68,11 +68,17 @@ public slots: * @param column number of column */ void IncrementChanged ( qint32 row, qint32 column ); - void MeasurementsChanged ( qint32 row, qint32 column ); + void MeasurementChanged ( qint32 row, qint32 column ); /** * @brief FullUpdateFromFile update information in tables form file */ void FullUpdateFromFile(); + void SaveGivenName(); + void SaveFamilyName(); + void SaveEmail(); + void SaveSex(int index); + void SaveBirthDate(const QDate & date); + void OpenTable(); signals: /** * @brief FullUpdateTree signal update data for dom document diff --git a/src/dialogs/app/dialogincrements.ui b/src/dialogs/app/dialogincrements.ui index ae387ab7a..f3a0d3c19 100644 --- a/src/dialogs/app/dialogincrements.ui +++ b/src/dialogs/app/dialogincrements.ui @@ -39,7 +39,7 @@ QTabWidget::North - 0 + 1 @@ -71,7 +71,7 @@
- + 0 @@ -107,7 +107,10 @@ 1 - + + + true + 0 @@ -119,34 +122,8 @@ Personal information - - - - - 6 - - - QLayout::SetDefaultConstraint - - - - - - 0 - 0 - - - - Family name - - - - - - - - - + + @@ -172,7 +149,33 @@ - + + + + 6 + + + QLayout::SetDefaultConstraint + + + + + + 0 + 0 + + + + Family name + + + + + + + + + @@ -194,11 +197,15 @@ - + + + yyyy-MM-dd + + - + @@ -220,11 +227,18 @@ - + + + + 0 + 0 + + + - + @@ -251,14 +265,8 @@ - - - - - layoutWidget - label_5 - + 0 @@ -277,7 +285,7 @@ true - QAbstractItemView::NoEditTriggers + QAbstractItemView::AnyKeyPressed|QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed true diff --git a/src/dialogs/app/dialogindividualmeasurements.cpp b/src/dialogs/app/dialogindividualmeasurements.cpp index 19096b078..ef332c049 100644 --- a/src/dialogs/app/dialogindividualmeasurements.cpp +++ b/src/dialogs/app/dialogindividualmeasurements.cpp @@ -108,17 +108,17 @@ void DialogIndividualMeasurements::DialogAccepted() QFile iMeasur(_tablePath); if (iMeasur.open(QIODevice::WriteOnly| QIODevice::Truncate)) { - const int Indent = 4; + const int indent = 4; QTextStream out(&iMeasur); out.setCodec("UTF-8"); - m.save(out, Indent); + m.save(out, indent); iMeasur.close(); } } catch(VException &e) { e.CriticalMessageBox(tr("File error."), this); - qWarning()<<"File error."<setEnabled(true); @@ -136,7 +136,7 @@ void DialogDetail::NewItem(quint32 id, const Valentina::Tools &typeTool, const N break; } default: - qWarning()<<"Got wrong tools. Ignore."; + qDebug()<<"Got wrong tools. Ignore."; break; } diff --git a/src/dialogs/tools/dialogtool.cpp b/src/dialogs/tools/dialogtool.cpp index 37387ce34..320dea50a 100644 --- a/src/dialogs/tools/dialogtool.cpp +++ b/src/dialogs/tools/dialogtool.cpp @@ -258,7 +258,7 @@ void DialogTool::ChangeCurrentText(QComboBox *box, const QString &value) } else { - qWarning()<<"Can't find object by name"< list = listNodePoint(); if (list.size() < 3) { - qWarning()<<"Not enough points."; + qDebug()<<"Not enough points."; return false; } ptrdiff_t i = indexOfNode(list, p1); @@ -151,7 +151,7 @@ ptrdiff_t VDetail::Edge(const quint32 &p1, const quint32 &p2) const { if (OnEdge(p1, p2) == false) { - qWarning()<<"Points don't on edge."; + qDebug()<<"Points don't on edge."; return -1; } @@ -176,7 +176,7 @@ void VDetail::NodeOnEdge(const quint32 &index, VNodeDetail &p1, VNodeDetail &p2) QVector list = listNodePoint(); if (index > static_cast(list.size())) { - qWarning()<<"Wrong edge index index ="< VEquidistant::CorrectEquidistantPoints(const QVector & QVector correctPoints; if (points.size()<4)//Better don't check if only three points. We can destroy equidistant. { - qWarning()<<"Only three points."; + qDebug()<<"Only three points."; return points; } //Clear equivalent points @@ -371,7 +371,7 @@ QVector VEquidistant::EkvPoint(const QLineF &line1, const QLineF &line2 QVector points; if (line1.p2() != line2.p2()) { - qWarning()<<"Last point of two lines must be equal."; + qDebug()<<"Last point of two lines must be equal."; } QPointF CrosPoint; QLineF bigLine1 = ParallelLine(line1, width ); diff --git a/src/geometry/vspline.cpp b/src/geometry/vspline.cpp index 5b731da0e..a3457a45b 100644 --- a/src/geometry/vspline.cpp +++ b/src/geometry/vspline.cpp @@ -134,7 +134,7 @@ qreal VSpline::LengthT(qreal t) const { if (t < 0 || t > 1) { - qWarning()<<"Wrong value t."; + qDebug()<<"Wrong value t."; return 0; } QLineF seg1_2 ( GetP1 ().toQPointF(), GetP2 () ); @@ -564,7 +564,7 @@ QPainterPath VSpline::GetPath() const } else { - qWarning()<<"points.count() < 2"<appendDraw(patternPieceName) == false) { - qWarning()<<"Error creating pattern with the name "<(&QComboBox::currentIndexChanged), @@ -742,7 +750,7 @@ void MainWindow::CancelTool() currentScene->clearSelection(); break; default: - qWarning()<<"Got wrong tool type. Ignored."; + qDebug()<<"Got wrong tool type. Ignored."; break; } } @@ -1111,62 +1119,10 @@ void MainWindow::MinimumScrollBar() bool MainWindow::SavePattern(const QString &fileName) { - try - { - doc->TestUniqueId(); - } - catch (const VExceptionWrongId &e) - { - e.CriticalMessageBox(tr("Error no unique id."), this); - return false; - } - if (fileName.isEmpty()) - { - qWarning()<<"Got empty file name."; - return false; - } - //Writing in temporary file QFileInfo tempInfo(fileName); - QString temp = tempInfo.absolutePath() + "/" + tempInfo.baseName() + ".tmp"; - QFile tempFile(temp); - if (tempFile.open(QIODevice::WriteOnly| QIODevice::Truncate)) - { - const int Indent = 4; - QTextStream out(&tempFile); - out.setCodec("UTF-8"); - doc->save(out, Indent); - tempFile.close(); - } - //Replace temp file our - bool result = false; - QFile patternFile(fileName); - // We need here temporary file because we need restore pattern after error of copying temp file. - QTemporaryFile tempOfPattern; - if (tempOfPattern.open()) - { - patternFile.copy(tempOfPattern.fileName()); - } - if ( patternFile.exists() == false || patternFile.remove() ) - { - if ( tempFile.copy(patternFile.fileName()) == false ) - { - qWarning()<<"Could not copy temp file to pattern file"<SaveDocument(fileName); if (result) { - tempFile.remove(); if (tempInfo.suffix() != "autosave") { setCurrentFile(fileName); @@ -1183,7 +1139,7 @@ void MainWindow::AutoSavePattern() QString autofile = curFile +".autosave"; if (SavePattern(autofile) == false) { - qWarning()<<"Can not save pattern"<setPen(QPen(Qt::black, qApp->toPixel(qApp->widthMainLine()))); diff --git a/src/tools/drawTools/vtoolshoulderpoint.cpp b/src/tools/drawTools/vtoolshoulderpoint.cpp index 255fd6bfe..4aa522f9c 100644 --- a/src/tools/drawTools/vtoolshoulderpoint.cpp +++ b/src/tools/drawTools/vtoolshoulderpoint.cpp @@ -70,7 +70,7 @@ QPointF VToolShoulderPoint::FindPoint(const QPointF &p1Line, const QPointF &p2Li qreal dist = line.length(); if (dist>toolLength) { - qWarning()<<"Correction of length in shoulder point tool. Parameter length too small."; + qDebug()<<"Correction of length in shoulder point tool. Parameter length too small."; toolLength = dist; } if (qFuzzyCompare(dist, toolLength)) diff --git a/src/tools/drawTools/vtoolsinglepoint.cpp b/src/tools/drawTools/vtoolsinglepoint.cpp index 561c0646d..f88570791 100644 --- a/src/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/tools/drawTools/vtoolsinglepoint.cpp @@ -37,6 +37,7 @@ VToolSinglePoint::VToolSinglePoint (VPattern *doc, VContainer *data, quint32 id, { baseColor = Qt::red; currentColor = baseColor; + this->setPen(QPen(currentColor, qApp->toPixel(qApp->widthHairLine())/factor)); ignoreFullUpdate = true; this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); diff --git a/src/tools/drawTools/vtoolsplinepath.cpp b/src/tools/drawTools/vtoolsplinepath.cpp index fd0f47c00..523c5e087 100644 --- a/src/tools/drawTools/vtoolsplinepath.cpp +++ b/src/tools/drawTools/vtoolsplinepath.cpp @@ -231,7 +231,7 @@ void VToolSplinePath::RefreshDataInFile() QDomElement domElement = doc->elementById(QString().setNum(id)); if (domElement.isElement() == false) { - qWarning()<<"Can't find element with id="<(id); diff --git a/src/tools/drawTools/vtooltriangle.cpp b/src/tools/drawTools/vtooltriangle.cpp index b757ea2cc..4bfbb486e 100644 --- a/src/tools/drawTools/vtooltriangle.cpp +++ b/src/tools/drawTools/vtooltriangle.cpp @@ -152,7 +152,7 @@ QPointF VToolTriangle::FindPoint(const QPointF &axisP1, const QPointF &axisP2, c if (c*c < a*a + b*b) { //Still don't know why this code handled. Need to think about that. - qWarning()<<"Can't find point."<IncrementReferens(detail[i].getId()); @@ -137,7 +137,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern } break; default: - qWarning()<<"May be wrong tool type!!! Ignoring."<SetAttribute(nod, AttrType, NodeSplinePath); break; default: - qWarning()<<"May be wrong tool type!!! Ignoring."<SetAttribute(nod, AttrType, QStringLiteral("NodeSplinePath")); break; default: - qWarning()<<"May be wrong tool type!!! Ignoring."< -TextDelegate::TextDelegate(QObject *parent): QItemDelegate(parent), lastText(QString("Name_")) +TextDelegate::TextDelegate(const QString ®ex, QObject *parent): QItemDelegate(parent), lastText(QString("Name_")), + regex(regex) { //Little hack. Help save lineedit text in const method. connect(this, &TextDelegate::SaveText, this, &TextDelegate::InitText); @@ -42,7 +43,7 @@ QWidget *TextDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem Q_UNUSED(index); QLineEdit *editor = new QLineEdit(parent); //Same regex pattern in xsd file - editor->setValidator( new QRegExpValidator(QRegExp("([\\p{L}]|[^0-9])[_\\p{L}0-9]*")) ); + editor->setValidator( new QRegExpValidator(QRegExp(regex)) ); connect(editor, &QLineEdit::editingFinished, this, &TextDelegate::commitAndCloseEditor); return editor; } diff --git a/src/widgets/textdelegate.h b/src/widgets/textdelegate.h index 442ca1a3d..c904e2223 100644 --- a/src/widgets/textdelegate.h +++ b/src/widgets/textdelegate.h @@ -43,7 +43,7 @@ public: * @brief TextDelegate constructor. * @param parent parent widget. */ - explicit TextDelegate(QObject *parent = nullptr); + TextDelegate(const QString ®ex, QObject *parent = nullptr); /** * @brief createEditorReturns the widget used to edit the item specified by index for editing. The parent widget and * style option are used to control how the editor widget appears. @@ -96,6 +96,7 @@ private: * @brief lastValue last saved value. */ QString lastText; + QString regex; }; #endif // TEXTDELEGATE_H diff --git a/src/xml/vdomdocument.cpp b/src/xml/vdomdocument.cpp index f6494543a..402e4f2cb 100644 --- a/src/xml/vdomdocument.cpp +++ b/src/xml/vdomdocument.cpp @@ -362,3 +362,81 @@ QString VDomDocument::UnitsToStr(const Valentina::Units &unit) } return result; } + +bool VDomDocument::SaveDocument(const QString &fileName) +{ + if (fileName.isEmpty()) + { + qDebug()<<"Got empty file name."; + return false; + } + //Writing in temporary file + QFileInfo tempInfo(fileName); + QString temp = tempInfo.absolutePath() + "/" + tempInfo.baseName() + ".tmp"; + QFile tempFile(temp); + if (tempFile.open(QIODevice::WriteOnly| QIODevice::Truncate)) + { + const int indent = 4; + QTextStream out(&tempFile); + out.setCodec("UTF-8"); + save(out, indent); + tempFile.close(); + } + //Replace temp file our + bool result = false; + QFile patternFile(fileName); + // We need here temporary file because we need restore document after error of copying temp file. + QTemporaryFile tempOfPattern; + if (tempOfPattern.open()) + { + patternFile.copy(tempOfPattern.fileName()); + } + if ( patternFile.exists() == false || patternFile.remove() ) + { + if ( tempFile.copy(patternFile.fileName()) == false ) + { + qDebug()<<"Could not copy temp file to document file"<elementsByTagName(tag); + if (nodeList.isEmpty()) + { + qDebug()<<"Can't save tag "<elementsByTagName(AttrUnit); - if (nodeList.isEmpty()) - { - qWarning()<<"Can't save measurements units"<elementsByTagName(tag); if (nodeList.isEmpty()) { - qWarning()<<"Measurement" << tag <<"doesn't exist"<AddMeasurement(name, VMeasurement(value/10.0, gui_text, description, tag)); if (m_number.isEmpty()) { - qWarning()<<"Can't find language-independent measurement name for "<< tag; + qDebug()<<"Can't find language-independent measurement name for "<< tag; return; } else @@ -222,7 +203,7 @@ void VIndividualMeasurements::Measurement(const QString &tag) data->AddMeasurement(name, VMeasurement(value, gui_text, description, tag)); if (m_number.isEmpty()) { - qWarning()<<"Can't find language-independent measurement name for "<< tag; + qDebug()<<"Can't find language-independent measurement name for "<< tag; return; } else @@ -237,27 +218,86 @@ void VIndividualMeasurements::Measurement(const QString &tag) } } -QString VIndividualMeasurements::Language() +QString VIndividualMeasurements::Language() const { return UniqueTagText(TagLang, "en"); } -QString VIndividualMeasurements::FamilyName() +QString VIndividualMeasurements::FamilyName() const { return UniqueTagText(TagFamily_name, ""); } -QString VIndividualMeasurements::GivenName() +void VIndividualMeasurements::setFamilyName(const QString &text) +{ + setTagText(TagFamily_name, text); +} + +QString VIndividualMeasurements::GivenName() const { return UniqueTagText(TagGiven_name, ""); } -QString VIndividualMeasurements::BirthDate() +void VIndividualMeasurements::setGivenName(const QString &text) { - return UniqueTagText(TagBirth_date, ""); + setTagText(TagGiven_name, text); } -QString VIndividualMeasurements::Sex() +QDate VIndividualMeasurements::BirthDate() const { - return UniqueTagText(TagSex, ""); + const QString date = UniqueTagText(TagBirth_date, "1900-01-01"); + return QDate::fromString(date, "yyyy-MM-dd"); +} + +void VIndividualMeasurements::setBirthDate(const QDate &date) +{ + setTagText(TagBirth_date, date.toString("yyyy-MM-dd")); +} + +VIndividualMeasurements::Genders VIndividualMeasurements::Sex() const +{ + return StrToGender(UniqueTagText(TagSex, "")); +} + +void VIndividualMeasurements::setSex(const VIndividualMeasurements::Genders &sex) +{ + setTagText(TagSex, GenderToStr(sex)); +} + +QString VIndividualMeasurements::Mail() const +{ + return UniqueTagText(TagEmail, ""); +} + +void VIndividualMeasurements::setMail(const QString &text) +{ + setTagText(TagEmail, text); +} + +QString VIndividualMeasurements::GenderToStr(const VIndividualMeasurements::Genders &sex) +{ + switch (sex) + { + case Male: + return SexMale; + case Female: + return SexFemale; + default: + return SexMale; + } +} + +VIndividualMeasurements::Genders VIndividualMeasurements::StrToGender(const QString &sex) +{ + QStringList genders; + genders << SexMale << SexFemale; + switch (genders.indexOf(sex)) + { + case 0: // SexMale + return Male; + case 1: // SexFemale + return Female; + default: + return Male; + } } diff --git a/src/xml/vindividualmeasurements.h b/src/xml/vindividualmeasurements.h index de5b37150..7af71045e 100644 --- a/src/xml/vindividualmeasurements.h +++ b/src/xml/vindividualmeasurements.h @@ -30,20 +30,29 @@ #define VINDIVIDUALMEASUREMENTS_H #include "vdomdocument.h" +#include class VIndividualMeasurements:public VDomDocument { public: + enum Sex { Male, Female }; + Q_DECLARE_FLAGS(Genders, Sex) + VIndividualMeasurements(VContainer *data); Valentina::Units Unit() const; - void setUnit(const Valentina::Units &unit); - void Measurements(); - void Measurement(const QString &tag); - QString Language(); - QString FamilyName(); - QString GivenName(); - QString BirthDate(); - QString Sex(); + void setUnit(const Valentina::Units &unit); + void Measurements(); + QString Language() const; + QString FamilyName() const; + void setFamilyName(const QString &text); + QString GivenName() const; + void setGivenName(const QString &text); + QDate BirthDate() const; + void setBirthDate(const QDate &date); + VIndividualMeasurements::Genders Sex() const; + void setSex(const VIndividualMeasurements::Genders &sex); + QString Mail() const; + void setMail(const QString &text); static const QString AttrIgnore; static const QString AttrName; static const QString AttrM_number; @@ -57,6 +66,17 @@ public: static const QString TagBirth_date; static const QString TagSex; static const QString TagUnit; + static const QString TagEmail; + + static const QString SexMale; + static const QString SexFemale; + + static QString GenderToStr(const VIndividualMeasurements::Genders &sex); + static VIndividualMeasurements::Genders StrToGender(const QString &sex); +private: + void Measurement(const QString &tag); }; +Q_DECLARE_OPERATORS_FOR_FLAGS( VIndividualMeasurements::Genders ) + #endif // VINDIVIDUALMEASUREMENTS_H diff --git a/src/xml/vpattern.cpp b/src/xml/vpattern.cpp index e9f72eb28..16e5b320d 100644 --- a/src/xml/vpattern.cpp +++ b/src/xml/vpattern.cpp @@ -184,7 +184,7 @@ bool VPattern::SetNameDraw(const QString &name) } else { - qWarning()<<"Can't find activ draw"<elementsByTagName(TagMeasurement); if (nodeList.isEmpty()) { - qWarning()<<"Measurement list is empty"< Date: Fri, 4 Apr 2014 10:06:33 +0200 Subject: [PATCH 60/60] Little bugs fixes. --HG-- branch : develop --- .hgignore | 8 ++++++++ src/dialogs/tools/dialogalongline.cpp | 2 +- src/mainwindow.cpp | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.hgignore b/.hgignore index 828b54ff8..bdc63555d 100644 --- a/.hgignore +++ b/.hgignore @@ -19,6 +19,11 @@ syntax: glob # Ignore this directory. html/ latex/ +bin/ +moc/ +obj/ +uic/ +rcc/ # Ignore file used QtCreator for user profile. *.pro.user @@ -28,3 +33,6 @@ latex/ # Ignore Mercurial .orig files *.orig + +# Ignore Makefile +Makefile diff --git a/src/dialogs/tools/dialogalongline.cpp b/src/dialogs/tools/dialogalongline.cpp index d9c7b7532..32453506a 100644 --- a/src/dialogs/tools/dialogalongline.cpp +++ b/src/dialogs/tools/dialogalongline.cpp @@ -42,8 +42,8 @@ DialogAlongLine::DialogAlongLine(const VContainer *data, QWidget *parent) flagFormula = false; flagName = false; - CheckState(); InitOkCansel(ui); + CheckState(); FillComboBoxTypeLine(ui->comboBoxLineType); ui->comboBoxLineType->setCurrentIndex(0); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 82bf6651b..075b238b4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -987,14 +987,14 @@ void MainWindow::PatternWasModified() void MainWindow::ChangedSize(const QString & text) { qint32 size = text.toInt(); - pattern->SetSize(size*10); + pattern->SetSize(size); doc->FullUpdateTree(); } void MainWindow::ChangedHeight(const QString &text) { qint32 growth = text.toInt(); - pattern->SetHeight(growth*10); + pattern->SetHeight(growth); doc->FullUpdateTree(); }