From 3b4c4e826125397af1da7b230bc242397e6043cc Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 12 Oct 2015 17:57:11 +0300 Subject: [PATCH] Resolved issue #376. Add buttons in Tape.exe to move measurement to top or bottom of list. --HG-- branch : develop --- src/app/tape/tmainwindow.cpp | 48 ++++++++++++++++++ src/app/tape/tmainwindow.h | 2 + src/app/tape/tmainwindow.ui | 26 ++++++++++ src/libs/vformat/vmeasurements.cpp | 38 ++++++++++++++ src/libs/vformat/vmeasurements.h | 2 + .../16x16/actions/go-bottom.png | Bin 0 -> 804 bytes .../win.icon.theme/16x16/actions/go-top.png | Bin 0 -> 777 bytes .../24x24/actions/go-bottom.png | Bin 0 -> 1209 bytes .../win.icon.theme/24x24/actions/go-top.png | Bin 0 -> 1154 bytes .../32x32/actions/go-bottom.png | Bin 0 -> 1582 bytes .../win.icon.theme/32x32/actions/go-top.png | Bin 0 -> 1561 bytes src/libs/vmisc/share/resources/theme.qrc | 6 +++ 12 files changed, 122 insertions(+) create mode 100755 src/libs/vmisc/share/resources/icons/win.icon.theme/16x16/actions/go-bottom.png create mode 100755 src/libs/vmisc/share/resources/icons/win.icon.theme/16x16/actions/go-top.png create mode 100755 src/libs/vmisc/share/resources/icons/win.icon.theme/24x24/actions/go-bottom.png create mode 100755 src/libs/vmisc/share/resources/icons/win.icon.theme/24x24/actions/go-top.png create mode 100755 src/libs/vmisc/share/resources/icons/win.icon.theme/32x32/actions/go-bottom.png create mode 100755 src/libs/vmisc/share/resources/icons/win.icon.theme/32x32/actions/go-top.png diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index a8a412721..aab081c7b 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -731,6 +731,24 @@ void TMainWindow::Remove() } } +//--------------------------------------------------------------------------------------------------------------------- +void TMainWindow::MoveTop() +{ + const int row = ui->tableWidget->currentRow(); + + if (row == -1) + { + return; + } + + const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName); + m->MoveTop(nameField->data(Qt::UserRole).toString()); + MeasurementsWasSaved(false); + RefreshData(); + search->RefreshList(ui->lineEditFind->text()); + ui->tableWidget->selectRow(0); +} + //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::MoveUp() { @@ -767,6 +785,24 @@ void TMainWindow::MoveDown() ui->tableWidget->selectRow(row+1); } +//--------------------------------------------------------------------------------------------------------------------- +void TMainWindow::MoveBottom() +{ + const int row = ui->tableWidget->currentRow(); + + if (row == -1) + { + return; + } + + const QTableWidgetItem *nameField = ui->tableWidget->item(row, ColumnName); + m->MoveBottom(nameField->data(Qt::UserRole).toString()); + MeasurementsWasSaved(false); + RefreshData(); + search->RefreshList(ui->lineEditFind->text()); + ui->tableWidget->selectRow(ui->tableWidget->rowCount()-1); +} + //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::Fx() { @@ -1712,8 +1748,10 @@ void TMainWindow::InitWindow() #endif connect(ui->toolButtonRemove, &QToolButton::clicked, this, &TMainWindow::Remove); + connect(ui->toolButtonTop, &QToolButton::clicked, this, &TMainWindow::MoveTop); connect(ui->toolButtonUp, &QToolButton::clicked, this, &TMainWindow::MoveUp); connect(ui->toolButtonDown, &QToolButton::clicked, this, &TMainWindow::MoveDown); + connect(ui->toolButtonBottom, &QToolButton::clicked, this, &TMainWindow::MoveBottom); connect(ui->lineEditName, &QLineEdit::editingFinished, this, &TMainWindow::SaveMName); connect(ui->plainTextEditDescription, &QPlainTextEdit::textChanged, this, &TMainWindow::SaveMDescription); @@ -2020,8 +2058,10 @@ void TMainWindow::Controls() if (m->ReadOnly()) { ui->toolButtonRemove->setEnabled(false); + ui->toolButtonTop->setEnabled(false); ui->toolButtonUp->setEnabled(false); ui->toolButtonDown->setEnabled(false); + ui->toolButtonBottom->setEnabled(false); return; } @@ -2038,24 +2078,32 @@ void TMainWindow::Controls() { if (ui->tableWidget->currentRow() == 0) { + ui->toolButtonTop->setEnabled(false); ui->toolButtonUp->setEnabled(false); ui->toolButtonDown->setEnabled(true); + ui->toolButtonBottom->setEnabled(true); } else if (ui->tableWidget->currentRow() == ui->tableWidget->rowCount()-1) { + ui->toolButtonTop->setEnabled(true); ui->toolButtonUp->setEnabled(true); ui->toolButtonDown->setEnabled(false); + ui->toolButtonBottom->setEnabled(false); } else { + ui->toolButtonTop->setEnabled(true); ui->toolButtonUp->setEnabled(true); ui->toolButtonDown->setEnabled(true); + ui->toolButtonBottom->setEnabled(true); } } else { + ui->toolButtonTop->setEnabled(false); ui->toolButtonUp->setEnabled(false); ui->toolButtonDown->setEnabled(false); + ui->toolButtonBottom->setEnabled(false); } } diff --git a/src/app/tape/tmainwindow.h b/src/app/tape/tmainwindow.h index 52566d089..3e717399f 100644 --- a/src/app/tape/tmainwindow.h +++ b/src/app/tape/tmainwindow.h @@ -89,8 +89,10 @@ private slots: void ReadOnly(bool ro); void Remove(); + void MoveTop(); void MoveUp(); void MoveDown(); + void MoveBottom(); void Fx(); void AddCustom(); diff --git a/src/app/tape/tmainwindow.ui b/src/app/tape/tmainwindow.ui index 588e0f5f2..face1924b 100644 --- a/src/app/tape/tmainwindow.ui +++ b/src/app/tape/tmainwindow.ui @@ -326,6 +326,19 @@ + + + + false + + + ... + + + + + + @@ -362,6 +375,19 @@ + + + + false + + + ... + + + + + + diff --git a/src/libs/vformat/vmeasurements.cpp b/src/libs/vformat/vmeasurements.cpp index 9fd5e30f5..d4bf623af 100644 --- a/src/libs/vformat/vmeasurements.cpp +++ b/src/libs/vformat/vmeasurements.cpp @@ -137,6 +137,25 @@ void VMeasurements::Remove(const QString &name) list.at(0).removeChild(FindM(name)); } +//--------------------------------------------------------------------------------------------------------------------- +void VMeasurements::MoveTop(const QString &name) +{ + const QDomElement node = FindM(name); + if (not node.isNull()) + { + const QDomNodeList mList = elementsByTagName(TagMeasurement); + if (mList.size() >= 2) + { + const QDomNode top = mList.at(0); + if (not top.isNull()) + { + const QDomNodeList list = elementsByTagName(TagBodyMeasurements); + list.at(0).insertBefore(node, top); + } + } + } +} + //--------------------------------------------------------------------------------------------------------------------- void VMeasurements::MoveUp(const QString &name) { @@ -167,6 +186,25 @@ void VMeasurements::MoveDown(const QString &name) } } +//--------------------------------------------------------------------------------------------------------------------- +void VMeasurements::MoveBottom(const QString &name) +{ + const QDomElement node = FindM(name); + if (not node.isNull()) + { + const QDomNodeList mList = elementsByTagName(TagMeasurement); + if (mList.size() >= 2) + { + const QDomNode bottom = mList.at(mList.size()-1); + if (not bottom.isNull()) + { + const QDomNodeList list = elementsByTagName(TagBodyMeasurements); + list.at(0).insertAfter(node, bottom); + } + } + } +} + //--------------------------------------------------------------------------------------------------------------------- void VMeasurements::ReadMeasurements() const { diff --git a/src/libs/vformat/vmeasurements.h b/src/libs/vformat/vmeasurements.h index bf64a8129..39efb7e95 100644 --- a/src/libs/vformat/vmeasurements.h +++ b/src/libs/vformat/vmeasurements.h @@ -48,8 +48,10 @@ public: void AddEmpty(const QString &name, const QString &formula = QString()); void AddEmptyAfter(const QString &after, const QString &name, const QString &formula = QString()); void Remove(const QString &name); + void MoveTop(const QString &name); void MoveUp(const QString &name); void MoveDown(const QString &name); + void MoveBottom(const QString &name); void ReadMeasurements() const; diff --git a/src/libs/vmisc/share/resources/icons/win.icon.theme/16x16/actions/go-bottom.png b/src/libs/vmisc/share/resources/icons/win.icon.theme/16x16/actions/go-bottom.png new file mode 100755 index 0000000000000000000000000000000000000000..a273b51f4689acf311887f21cfa3b365038e590e GIT binary patch literal 804 zcmV+<1Ka$GP)(ow0|f@?j>bTz~(q#$OK5N|VwVub9v53bS_5iA7p*rL)TSGQL(iT3)jP;KTun z#KzK0Vw|%8D5Xhk8WH5*oK*pW6T#R7ZDO1(0gP25B8ad$K*S-UFg8Ki2-PPZg@eeq)*y)r( zl*LL+lt`p?5~qB&HoD_-usz+3UmA4FJTtZVxX>0HEOmO9#jo|*)EA=k9P?g(3x`cPvbij`XCpk7&I=l;#f$CjAZ)@$R>1e$4Lw=yGWV(Z#N8>}``HM&Op^ZCo)$*136<5&wM}Iz;Vb4#c^1IjZ z88h2H8-FZ*{%brLIWn|mYT|B{?^1do4WRd)>lq$Azv&Wd@WTVa|K=)y{Na#$w-QdC z^?uEDFz5%$dI4e#IRx#eSg2D?NY%?PN(TTo*alb-Q_5Tb0000qL=-Q*s-s_J$@1YK6{e^v7YK@}8VH3CdIuUP#@qJBgI;Ql{g3TVCDjBM6zI@FLH36|%YL|DQIF~|h8(qK;@ z|EpwSF1_3xi3HPc$3Ft|8yoC8SA|cDOQlB}_unrK(<#q);dw56--nl%@N5a07a(aS z1Y3z$)AJLR^)cU`ch-Ht%t%Dbt(8o6JnscxMgrNVrw4XoGd329bb4 z0T8X*M34ZnAkCU~1TX_idhHrNJO5L3!r00000NkvXX Hu0mjfi(EiJ literal 0 HcmV?d00001 diff --git a/src/libs/vmisc/share/resources/icons/win.icon.theme/24x24/actions/go-bottom.png b/src/libs/vmisc/share/resources/icons/win.icon.theme/24x24/actions/go-bottom.png new file mode 100755 index 0000000000000000000000000000000000000000..a4983946752930bbca20784ef840400dcafefd01 GIT binary patch literal 1209 zcmV;q1V;ObP)5YKgqQ}U@zK^Qb)|xC3WA^_2qNxWh@uDuUAa@JMWrYRE(CF*C<-c6#EOXBXiaO; zmeeF|(l#&KJZ>KMIWy;cE|SJvn_Egei`mS~?{~ic_njG`!P@)$ZW5d99O&(TAsc2w zMN!p_k4U*ziAEh;p=oQ}-_&5CM;7L`3Uu+^E1ghjR|=ERF=X9*?e9pje!9h{zTM z>QGg+F2Ry;O+?$Q0!s%Tg+r>2B}3 zIq-wrY+=c^G&S`(XT`d;h(uSr3&^TmO4V}T-wU%lTb{@n=d=_hI^i3k^iBEN3iPNl z@NECn`)(UJ5C)=(ri^bx8^uTfVid&^B{gbMh0v>p{k_3EJ9>JeC=xj{K5=;YtJ0fI zkLT8zb?Nm!(?zLL>Aio?ou7BNhxZk01@ILwP}Ia!-3nD(B(@RGIy4bnEabd)7UqKE zr$(lp%!K|#;mh(m(`*zh=S%Fmy>I#a)Xb%}=9Y)Utjk%yN@7YBb(Yu^k(9-xz@!8* zN;;Jxt~Ae|JwN+$Pgm~b#7q^&?B)U{;BtPErLRll-cB#-Q`3v19qldqn>*P?I$D>Q z6l79)mZq9!PMx^&QqPX;(B<(2F4}8Y-loI*3rt<8Q265D;OM!+Au6raFrC7L5ab|} z50GkWGIDnD-Puoy$IhQF!Liz=s7)&XVBB$V@JHrO7l(3PnOnMh^LsU2!Ve+sIvD;f z{&w)Ynb$J=Qq}nTxFM#o0I;4<$Gu@Zd8s(m*4pw=YlrDHlH$r=nG45%zWie6t?9A3 zVGGl?A;Y_#fZ>SQ(U?b`>Kh*VWB&E>)V7sqx-B|AxbW8er|+G(bg~MA5&wI65BLz^ z?>f-=_Fb=Zeat;%Q~QG(dbjQ*w>_0Xm9V3S{b7by&)~#>81Ou_Qr32L1lhdIs72H% zYQZ_AR%Y?al>8t$IAd4lM-iA;056M;2BR5)LHdh3@#B| z1U6Q0Wu7w&v-~PT-8j_=Y%Hi!T%6-jwL-gRaN>h!1o1%DI;JY9Wp(#f(L}sTi8&in z6tDj0@DGZ~CeWgcIlBM=03v!+SaefwW^{L9a%BJjc-kv3FW1Y=%Pvk%EJ)SMFG>dh XHrNJO5L3!r00000NkvXXu0mjf01rw- literal 0 HcmV?d00001 diff --git a/src/libs/vmisc/share/resources/icons/win.icon.theme/24x24/actions/go-top.png b/src/libs/vmisc/share/resources/icons/win.icon.theme/24x24/actions/go-top.png new file mode 100755 index 0000000000000000000000000000000000000000..e2e4f2bf0f96d47d20c3219cd47636f1f6621ee1 GIT binary patch literal 1154 zcmV-|1bzF7P)0BMF$nkT%T62Duwdm$3flGZ3Ji+5Qdj&#Yjs5gW3Z- z2|#;*b``WE0tFFLnyr8hKrz4uS}C+^4ewSFw*|x@0KxM0Y4w~pixl)fl`AbA`%Y0< zdC8oa6INOn5C*^sCPru?EJI=AYJaK#6yY8jf8?#BCl7w4_ouR*&vveBt#ij8MqQjZ z`65BǑZA{z?Ql&I_#;mR8H| zg5!AGa+&n8KTqF4_Hd>SP>q0U7^2wLexIwIEZ|T}IypAnzvaEa&Zh(n2EkB-*hUa$ zWZbUsx9Q4Dv61fu*0DtXito>+5+3}|Ybol@?$(P%+?)k~zUR9EB|VmnSTZmaBaExC zWNOis0%;ZjUDJ;FeeU#fy=ot(KL1xYZ4@!pOqdYc5J6l8b3@-z>Q?-w?Pg5?GXt7o zDMn~&=1SGPLq5XJ@~rc|0Qe~?Zjl2VJI0I3tgs2o+pu%wz? z)V~0QTMc!BwZz>3001I-R9JLVZ)S9NVRB^v0C?IfFE7{2%*!rLPAo{(%P&d?05;eL USP)anTmS$707*qoM6N<$f?z-r6#xJL literal 0 HcmV?d00001 diff --git a/src/libs/vmisc/share/resources/icons/win.icon.theme/32x32/actions/go-bottom.png b/src/libs/vmisc/share/resources/icons/win.icon.theme/32x32/actions/go-bottom.png new file mode 100755 index 0000000000000000000000000000000000000000..9302a5e91f34f55768c1574f4d8fa18fa25dcbeb GIT binary patch literal 1582 zcmV+}2GRM6P)Pd)s(zuT?VA?8DueGvEGxXXl(N z>@kW@7O4KA#{Eybu4d_5uJ9 z5zajKnX`{P@Zhr|nz3=1_uJQcZ-Q5^y!9&)IbVFTuxIR^0081Jv|*@J8|7_#Jf2Na zO7Q{WFtokK?HNG5lDU*LYXJh=ZNTG6U5a|`HS9hBR8e)PcYxr#>5oUfqUw7M+dF{w z9#zGu>-t>>)S}1A{?^LD_Z|!eRqJqLLZsS z9{R|`W6vFV{6HuO-Xo<#;iNI(e1;f74DBf$i?S>w^>xBXKl{;dPP}A9yhmABT57G= zv!58@;+_gPbySnaY#12(;KcanQ@2LyT8O}UqYPG&0K@{ulWLPjTBn&NG+PZ;(?$A+ zierV69}5V{2O})6ul%{Z(!7?BwwH))Pm=xyBS!|3g>q#o49#PMrEqAext;tE9e3lC6jkjj6{d94qnUo3x5I7{KsBN;Yw^`E#Qd`61m0UqOGcN?OFg$pWq?v18 zySemy@dP7LRytp{=@^LFP#45eP2)QA}y&?_Z3o;U~^!Cb}nod zM|Gg7$7)2;jdS7ko4=o%T7D)Th^vi1C0)Q<_PD?8+?MSMptFwJ zA*fF`rjvYgaO}v)qhYBfnoBznkzm92;c>2jsg7{*!p+|d<3yzEbV-V;hw@FZp@^sZ%;1$_}-7jv(2jX5_)e10CXlL z8_m&txp}=ln%dDr!=Ek=smV+Ov5?OdX)O%`7w^7OdtqGyP5+wo61q1405_8n zJrT2dBbn5|pPU#!e81+_0VuY{cHM?n3=) zK8hYYc64wkk^-}DX64uab?dta#&U10Eed)q+fUg2jo@>6o?rbC!)FUmfB82j>tB2E zBFr5^z%cP78@c)exH9V2%pCS7dh$4~YB+y-)V?(O9mI%Hn>b&qsEn;_WTc?vD#N8Xi3%p001I-R9JLVZ)S9NVRB^v0C?IfFE7{2%*!rL gPAo{(%P&d?05;eLSP)anTmS$707*qoM6N<$f&>}}OaK4? literal 0 HcmV?d00001 diff --git a/src/libs/vmisc/share/resources/icons/win.icon.theme/32x32/actions/go-top.png b/src/libs/vmisc/share/resources/icons/win.icon.theme/32x32/actions/go-top.png new file mode 100755 index 0000000000000000000000000000000000000000..46cd1a74fefde1119c9f61453c4a3eb661644f7b GIT binary patch literal 1561 zcmV+!2Il#RP)59NFKSG@0E$NO zf-w*aD<29}n+HrQ+uY-y5vDFRR)H_9h43XGMJY>-!Jhy5ZU<+gsl?}#Y3xCis zARK}b0TKyE#ASNfuAwNYUf+n`zJc5g%iCUAw4iR` zxPK0WXw=LMngGxQqarQ&9vV_vOBy z=Wi>hb5In5K_I3}#>o(L*|=5&6&M78hip3ASoBmw&yoJmQ!7(pc&xH3Dqa!x9S**G z^F=Ido4cc9;k^3;HHt#92o)HFzP_v_jiB_G)YDMDMxj`QuSd|asO6q(7B}zAf0&28 z&8-M9`7T%w%wN=uyjQxeYuS?b7q-;44qqGqEQaL*mJ?ma!UBZF5CUK@zyJ}0G{I;F zDMmwVE>4~<^c^^I{JvDY=BI)4L%`lCT+nbsJuZwFGVSwQUg~Vib!k(AEnU<&NiY!t zMdk^*B+tYh03bjTdIv-o|+N}D_Lq_Y!s$dWsgxW`F0vIx2 zA~=-C>2rlWy>AXYiVPSMkU5FiY}e=t>u?f4>0=*=LJk6e_!Spn#gMF$Fq1HBU`Rt7g+P@+933!1h;kjCZg z-F~NJO>R#hH#d$G1Emc$uG48ri~ic~3Kl_RgdeJ3wysTo^~nzxqhtJEdhHrNJO5L3!r00000 LNkvXXu0mjfF67Tq literal 0 HcmV?d00001 diff --git a/src/libs/vmisc/share/resources/theme.qrc b/src/libs/vmisc/share/resources/theme.qrc index 12f35f3b4..ccae8e601 100644 --- a/src/libs/vmisc/share/resources/theme.qrc +++ b/src/libs/vmisc/share/resources/theme.qrc @@ -71,5 +71,11 @@ icons/win.icon.theme/16x16/actions/go-up.png icons/win.icon.theme/24x24/actions/go-up.png icons/win.icon.theme/32x32/actions/go-up.png + icons/win.icon.theme/16x16/actions/go-top.png + icons/win.icon.theme/24x24/actions/go-top.png + icons/win.icon.theme/32x32/actions/go-top.png + icons/win.icon.theme/16x16/actions/go-bottom.png + icons/win.icon.theme/24x24/actions/go-bottom.png + icons/win.icon.theme/32x32/actions/go-bottom.png