From 0260e0467bc31a7a2d1d7faf81b31c5da6270f47 Mon Sep 17 00:00:00 2001 From: Dmintriy L. Kruglikov Date: Thu, 3 Jul 2008 13:26:39 +0300 Subject: [PATCH] Attr "Numerator" in Designer. --- src/designer/deditfield.ui | 738 ++++++++++++++++++++---------------------- src/designer/deditfield.ui.h | 110 ++++++- src/lib/acfg.h | 5 + 3 files changed, 456 insertions(+), 397 deletions(-) diff --git a/src/designer/deditfield.ui b/src/designer/deditfield.ui index 2d4084b..cbcc76b 100644 --- a/src/designer/deditfield.ui +++ b/src/designer/deditfield.ui @@ -8,8 +8,8 @@ 0 0 - 585 - 478 + 570 + 507 @@ -155,60 +155,6 @@ false - - - eCname - - - - 7 - 0 - 2 - 0 - - - - - - - - - - textLabel1_2 - - - - 1 - 5 - 0 - 0 - - - - - - - - Cname - - - - - eName - - - - 7 - 0 - 2 - 0 - - - - - - - tWidth @@ -315,7 +261,168 @@ - + + + ValidateGroupBox + + + Validator + + + false + + + + unnamed + + + + textLabel3 + + + <u>Example:</u> RegExp <b><i>[A-C]\d{5}[W-Z]</b></i> for string <i><b>A12345Z</b></i> + + + AutoText + + + + + textLabel1_5 + + + RegExp + + + + + two_state + + + Intermediate == Invalid + + + + + textLabel1_4 + + + Input Mask + + + + + VdRegEx + + + [ABCD], will match an A or a B or a C or a D. + + + + + inputMask + + + [ABCD], will match an A or a B or a C or a D. + + + + + layout7 + + + + unnamed + + + + textLabel2_3 + + + Test: + + + + + Testline + + + + + + + + + textLabel1_2 + + + + 1 + 5 + 0 + 0 + + + + + + + + Cname + + + + + eName + + + + 7 + 0 + 2 + 0 + + + + + + + + + + eCname + + + + 7 + 0 + 2 + 0 + + + + + + + + + + spacer13 + + + Vertical + + + Expanding + + + + 16 + 40 + + + + layout19 @@ -366,12 +473,121 @@ + + + layout8 + + + + unnamed + + + + eWidth + + + + + + + 254 + + + 1 + + + 10 + + + + + tDec + + + + + + + , + + + + + eDec + + + + + + + + + tNotBound + + + + + + + Max + + + + + tSepTriads + + + + + + + As triads + + + + + efVd + + + Vd + + + true + + + + + efNumerator + + + Num + + + + + spacer7 + + + Horizontal + + + Expanding + + + + 64 + 20 + + + + + NumeratorGroupBox - Numeranor + Numerator @@ -396,7 +612,7 @@ Num_Label - Numerator + Construct: @@ -404,111 +620,9 @@ DateFormat - and date + + Date as: - - - layout19 - - - - 7 - 0 - 0 - 0 - - - - - unnamed - - - - MinLabel - - - Min: - - - - - eMin - - - - 7 - 0 - 2 - 0 - - - - - - MaxLabel - - - Max: - - - - - eMax - - - - 7 - 0 - 2 - 0 - - - - - - PrLabel - - - Prefix: - - - - - ePrefix - - - - 7 - 0 - 1 - 0 - - - - - - SfLabel - - - Suffix: - - - - - eSuffix - - - - 7 - 0 - 1 - 0 - - - - - layout27 @@ -563,7 +677,7 @@ - layout9 + layout10 @@ -610,7 +724,7 @@ useOwnFofmat - use own format + Own format @@ -628,193 +742,9 @@ - - - - - layout7 - - - - unnamed - - - - eWidth - - - - - - - 254 - - - 1 - - - 10 - - - - - tDec - - - - - - - , - - - - - eDec - - - - - - - - - tNotBound - - - - - - - Max - - - - - tSepTriads - - - - - - - As triads - - - - - lzcheckBox - - - LZ - - - - - efVd - - - Vd - - - true - - - - - efNumerator - - - Num - - - - - spacer7 - - - Horizontal - - - Expanding - - - - 45 - 20 - - - - - - - - ValidateGroupBox - - - Validator - - - false - - - - unnamed - - - - textLabel3 - - - <u>Example:</u> RegExp <b><i>[A-C]\d{5}[W-Z]</b></i> for string <i><b>A12345Z</b></i> - - - AutoText - - - - - textLabel1_5 - - - RegExp - - - - - two_state - - - Intermediate == Invalid - - - - - textLabel1_4 - - - Input Mask - - - - - VdRegEx - - - [ABCD], will match an A or a B or a C or a D. - - - - - inputMask - - - [ABCD], will match an A or a B or a C or a D. - - - + - layout7 + layout9 @@ -822,38 +752,74 @@ - textLabel2_3 + PrLabel - Test: + Prefix: - Testline + ePrefix + + + + 7 + 0 + 1 + 0 + + + + + + textLabel1_6 + + + + + + + + + lzcheckBox + + + LZ + + + + + textLabel1_3 + + + + UID + + + + + + SfLabel + + + Suffix: + + + + + eSuffix + + + + 7 + 0 + 1 + 0 + - - - spacer13 - - - Vertical - - - Expanding - - - - 16 - 80 - - - @@ -1020,18 +986,6 @@ setExample() - eMin - textChanged(const QString&) - dEditField - setExample() - - - eMax - textChanged(const QString&) - dEditField - setExample() - - lzcheckBox toggled(bool) dEditField @@ -1073,6 +1027,24 @@ dEditField DateFormat_stateChanged(int) + + DateFormat + toggled(bool) + dEditField + setExample() + + + useOwnFofmat + stateChanged(int) + dEditField + useOwnFofmat_stateChanged(int) + + + eWidth + valueChanged(int) + dEditField + eWidth_valueChanged(int) + acfg.h @@ -1103,6 +1075,8 @@ inputMask_textChanged( const QString & ) efNumerator_stateChanged( int ) DateFormat_stateChanged( int ) + useOwnFofmat_stateChanged( int ) + eWidth_valueChanged( int ) destroy() diff --git a/src/designer/deditfield.ui.h b/src/designer/deditfield.ui.h index 9f5ec42..79b8ffb 100644 --- a/src/designer/deditfield.ui.h +++ b/src/designer/deditfield.ui.h @@ -72,7 +72,7 @@ void dEditField::init() artypes.clear(); eType->clear(); otypes.append(" "); - lzcheckBox->setText(tr("Add leading zeros")); + lzcheckBox->setText(tr("Add zeros")); efVd->setText(tr("Validate")); efNumerator->setText(tr("Numerator")); eType->insertItem(tr("Unknown"), 0); @@ -125,13 +125,53 @@ void dEditField::setData( aListViewItem *o ) else efPlus->setChecked( false ); if( md->attr( obj, mda_nz ) == "1" ) efNZ->setChecked( true ); else efNZ->setChecked( false ); - if( md->attr( obj, mda_vd ) == "1" ) efVd->setChecked( true ); - else efVd->setChecked( false ); - if( md->attr( obj, mda_twostate ) == "1" ) two_state->setChecked( true ); - else two_state->setChecked( false ); + if( md->attr( obj, mda_vd ) == "1" ) { + efVd->setChecked( true ); + ValidateGroupBox->show(); + }else { + efVd->setChecked( false ); + ValidateGroupBox->hide(); + } + if( md->attr( obj, mda_numerator) == "1" ) + { + efNumerator->setChecked( true ); + NumeratorGroupBox->show(); + }else { + efNumerator->setChecked( false ); + NumeratorGroupBox->hide(); + } + two_state->setChecked( md->attr( obj, mda_twostate ) == "1" ); + lzcheckBox->setChecked( md->attr( obj, mda_lz ) == "1" ); VdRegEx->setText( md->attr( obj, mda_validator ) ); inputMask->setText( md->attr( obj, mda_inputmask ) ); + if (md->attr( obj, mda_numdate) != "") + { + DateFormat->setChecked( md->attr( obj, mda_numdate) != ""); + int i; + bool found; + found = FALSE; + for (i=0; i < aDFormatBox->count(); ++i) + { + if (aDFormatBox->text(i) == md->attr( obj, mda_numdate)) + { aDFormatBox->setCurrentText(md->attr( obj, mda_numdate)); + aDFormatBox->setEnabled(TRUE); + found = TRUE; + } + } + if (found == FALSE) + { + eOwnFormat->setText(md->attr( obj, mda_numdate)); + aDFormatBox->setEnabled(FALSE); + useOwnFofmat->setChecked(TRUE); + } + + } + + + ePrefix->setText( md->attr( obj, mda_numpref ) ); + eSuffix->setText( md->attr( obj, mda_numsuff ) ); + efSum->setChecked(md->attr( obj, mda_sum ) == "1"); QStringList tlist; @@ -299,9 +339,28 @@ void dEditField::updateMD() else md->setAttr( obj, mda_plus, "0" ); if( efNZ->isChecked() ) md->setAttr( obj, mda_nz, "1" ); else md->setAttr( obj, mda_nz, "0" ); - if( efVd->isChecked() ) md->setAttr( obj, mda_vd, "1" ); - else md->setAttr( obj, mda_vd, "0" ); + if( efVd->isChecked() ) { + md->setAttr( obj, mda_vd, "1" ); + }else{ + md->setAttr( obj, mda_vd, "0" ); + } + if (efNumerator->isChecked() ){ + md->setAttr( obj, mda_numerator, "1" ); + }else{ + md->setAttr( obj, mda_numerator, "0" ); + } if (VdRegEx->text() )md->setAttr( obj, mda_validator, VdRegEx->text().stripWhiteSpace() ); + if (ePrefix->text() ) md->setAttr( obj, mda_numpref, ePrefix->text()); + if (eSuffix->text() ) md->setAttr( obj, mda_numsuff, eSuffix->text()); + if (DateFormat->isChecked() ) + { + if (useOwnFofmat->isChecked() ) + { + md->setAttr( obj, mda_numdate, eOwnFormat->text() ); + }else{ + md->setAttr( obj, mda_numdate, aDFormatBox->currentText() ); + } + } if (inputMask->text() )md->setAttr( obj, mda_inputmask, inputMask->text().stripWhiteSpace() ); if (two_state->isChecked() ) md->setAttr( obj, mda_twostate, "1" ); else md->setAttr( obj, mda_twostate, "0" ); @@ -309,6 +368,12 @@ void dEditField::updateMD() md->setAttr( obj, mda_sum, "1" ); else md->setAttr( obj, mda_sum, "0" ); + + if( lzcheckBox->isChecked() ) + md->setAttr( obj, mda_lz, "1" ); + else + md->setAttr( obj, mda_lz, "0" ); + if(eType->currentItem()==0) { st.sprintf(artypes[comboBox2->currentItem()]); @@ -335,7 +400,6 @@ void dEditField::typeSelect( int idx ) eDec->show(); tWidth->show(); tDec->show(); - lzcheckBox->show(); efSum->show(); tNotBound->hide(); tSepTriads->show(); @@ -358,12 +422,11 @@ void dEditField::typeSelect( int idx ) tDec->hide(); efSum->hide(); tSepTriads->hide(); - lzcheckBox->hide(); tNotBound->show(); efNumerator->show(); - NumeratorGroupBox->show(); + if ( efNumerator->isChecked() ) NumeratorGroupBox->show(); efVd->show(); - ValidateGroupBox->show(); + if ( efVd->isChecked() ) ValidateGroupBox->show(); efSum->setChecked(false); comboBox2->setEnabled(false); comboBox2->hide(); @@ -377,7 +440,6 @@ void dEditField::typeSelect( int idx ) comboBox2->show(); comboBox2->setEnabled(true); eWidth->hide(); - lzcheckBox->hide(); eDec->hide(); tWidth->hide(); tDec->hide(); @@ -395,7 +457,6 @@ void dEditField::typeSelect( int idx ) comboBox2->setEnabled(false); comboBox2->hide(); saldoTextLabel->hide(); - lzcheckBox->hide(); eWidth->hide(); eDec->hide(); tWidth->hide(); @@ -463,10 +524,10 @@ void dEditField::setExample() if (lzcheckBox->isChecked()) { - numerator = eMin->text().rightJustify( eWidth->value(), '0' ); + numerator = QString("789").rightJustify( eWidth->value(), '0' ); } else { - numerator = eMin->text(); + numerator = QString("789"); } eXample->setText(QString("%1%2%3%4").arg(ePrefix->text()).arg(numerator).arg(eSuffix->text()).arg(curdate)); } @@ -523,6 +584,7 @@ void dEditField::efNumerator_stateChanged( int ) if (efNumerator->isChecked() ) { NumeratorGroupBox->show(); + eWidth->setValue(10); } else { NumeratorGroupBox->hide(); } @@ -544,3 +606,21 @@ void dEditField::DateFormat_stateChanged( int ) eOwnFormat->setEnabled(FALSE); } } + + +void dEditField::useOwnFofmat_stateChanged( int ) +{ + if (useOwnFofmat->isChecked() ) + { + aDFormatBox->setEnabled(FALSE); + }else{ + aDFormatBox->setEnabled(TRUE); + } + +} + + +void dEditField::eWidth_valueChanged( int ) +{ + if (efNumerator->isChecked() ) setExample(); +} diff --git a/src/lib/acfg.h b/src/lib/acfg.h index d16f174..8507dc6 100644 --- a/src/lib/acfg.h +++ b/src/lib/acfg.h @@ -214,6 +214,11 @@ Metadata attributes. #define mda_twostate "twostate" #define mda_validator "validator" #define mda_inputmask "inputmask" +#define mda_numerator "numerator" +#define mda_numpref "numpref" +#define mda_numsuff "numsuff" +#define mda_numdate "numdate" +#define mda_lz "lz" /*! -- 1.7.1