New: InputMask for String field and managed Validator
authorDmintriy L. Kruglikov <master@shadow.breg.pl.ua>
Wed, 2 Jul 2008 09:50:19 +0000 (12:50 +0300)
committerDmintriy L. Kruglikov <master@shadow.breg.pl.ua>
Wed, 2 Jul 2008 09:50:19 +0000 (12:50 +0300)
src/designer/deditfield.ui
src/designer/deditfield.ui.h
src/lib/acfg.h
src/plugins/wdbfield.cpp
src/plugins/wfield.cpp
src/plugins/wfield.h

index 9ec82d0..2d4084b 100644 (file)
@@ -8,8 +8,8 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>488</width>
-            <height>490</height>
+            <width>585</width>
+            <height>478</height>
         </rect>
     </property>
     <property name="caption">
@@ -42,7 +42,7 @@
                     <property name="name">
                         <cstring>unnamed</cstring>
                     </property>
-                    <widget class="QLabel" row="0" column="0" rowspan="1" colspan="2">
+                    <widget class="QLabel" row="0" column="0">
                         <property name="name">
                             <cstring>textLabel1</cstring>
                         </property>
@@ -68,7 +68,7 @@
                             <string>Name</string>
                         </property>
                     </widget>
-                    <widget class="QLabel" row="2" column="0" rowspan="1" colspan="2">
+                    <widget class="QLabel" row="2" column="0">
                         <property name="name">
                             <cstring>textLabel4</cstring>
                         </property>
                             <string>Type</string>
                         </property>
                     </widget>
-                    <widget class="QLabel" row="1" column="0" rowspan="1" colspan="2">
+                    <widget class="QLabel" row="1" column="0">
                         <property name="name">
                             <cstring>textLabel1_2_2</cstring>
                         </property>
                             <string>Comment</string>
                         </property>
                     </widget>
-                    <widget class="QLineEdit" row="1" column="2" rowspan="1" colspan="3">
+                    <widget class="QLineEdit" row="1" column="1" rowspan="1" colspan="3">
                         <property name="name">
                             <cstring>eComment</cstring>
                         </property>
                             </font>
                         </property>
                     </widget>
-                    <widget class="QComboBox" row="2" column="2" rowspan="1" colspan="3">
+                    <widget class="QComboBox" row="2" column="1" rowspan="1" colspan="3">
                         <property name="name">
                             <cstring>eType</cstring>
                         </property>
                             <bool>false</bool>
                         </property>
                     </widget>
-                    <widget class="QLineEdit" row="0" column="4">
+                    <widget class="QLineEdit" row="0" column="3">
                         <property name="name">
                             <cstring>eCname</cstring>
                         </property>
                             </font>
                         </property>
                     </widget>
-                    <widget class="QLabel" row="0" column="3">
+                    <widget class="QLabel" row="0" column="2">
                         <property name="name">
                             <cstring>textLabel1_2</cstring>
                         </property>
                             <string>Cname</string>
                         </property>
                     </widget>
-                    <widget class="QLineEdit" row="0" column="2">
+                    <widget class="QLineEdit" row="0" column="1">
                         <property name="name">
                             <cstring>eName</cstring>
                         </property>
                             </font>
                         </property>
                     </widget>
-                    <widget class="QLabel" row="3" column="0" rowspan="1" colspan="2">
+                    <widget class="QLabel" row="3" column="0">
                         <property name="name">
                             <cstring>tWidth</cstring>
                         </property>
                             <string>Width</string>
                         </property>
                     </widget>
-                    <widget class="QLabel" row="4" column="0" rowspan="1" colspan="2">
-                        <property name="name">
-                            <cstring>Num_Label</cstring>
-                        </property>
-                        <property name="text">
-                            <string>Numerator</string>
-                        </property>
-                    </widget>
-                    <widget class="QLabel" row="6" column="0">
-                        <property name="name">
-                            <cstring>exLabel</cstring>
-                        </property>
-                        <property name="text">
-                            <string>&lt;u&gt;&lt;i&gt;Example&lt;/i&gt;:&lt;/u&gt;</string>
-                        </property>
-                    </widget>
-                    <widget class="QLayoutWidget" row="6" column="1" rowspan="1" colspan="4">
-                        <property name="name">
-                            <cstring>layout27</cstring>
-                        </property>
-                        <hbox>
-                            <property name="name">
-                                <cstring>unnamed</cstring>
-                            </property>
-                            <spacer>
-                                <property name="name">
-                                    <cstring>spacer20</cstring>
-                                </property>
-                                <property name="orientation">
-                                    <enum>Horizontal</enum>
-                                </property>
-                                <property name="sizeType">
-                                    <enum>Expanding</enum>
-                                </property>
-                                <property name="sizeHint">
-                                    <size>
-                                        <width>144</width>
-                                        <height>16</height>
-                                    </size>
-                                </property>
-                            </spacer>
-                            <widget class="QLabel">
-                                <property name="name">
-                                    <cstring>eXample</cstring>
-                                </property>
-                                <property name="text">
-                                    <string>___</string>
-                                </property>
-                            </widget>
-                            <spacer>
-                                <property name="name">
-                                    <cstring>spacer19</cstring>
-                                </property>
-                                <property name="orientation">
-                                    <enum>Horizontal</enum>
-                                </property>
-                                <property name="sizeType">
-                                    <enum>Expanding</enum>
-                                </property>
-                                <property name="sizeHint">
-                                    <size>
-                                        <width>135</width>
-                                        <height>16</height>
-                                    </size>
-                                </property>
-                            </spacer>
-                        </hbox>
-                    </widget>
-                    <widget class="QLayoutWidget" row="4" column="2" rowspan="1" colspan="3">
-                        <property name="name">
-                            <cstring>layout19</cstring>
-                        </property>
-                        <property name="sizePolicy">
-                            <sizepolicy>
-                                <hsizetype>7</hsizetype>
-                                <vsizetype>0</vsizetype>
-                                <horstretch>0</horstretch>
-                                <verstretch>0</verstretch>
-                            </sizepolicy>
-                        </property>
-                        <hbox>
-                            <property name="name">
-                                <cstring>unnamed</cstring>
-                            </property>
-                            <widget class="QLabel">
-                                <property name="name">
-                                    <cstring>MinLabel</cstring>
-                                </property>
-                                <property name="text">
-                                    <string>Min:</string>
-                                </property>
-                            </widget>
-                            <widget class="QLineEdit">
-                                <property name="name">
-                                    <cstring>eMin</cstring>
-                                </property>
-                                <property name="sizePolicy">
-                                    <sizepolicy>
-                                        <hsizetype>7</hsizetype>
-                                        <vsizetype>0</vsizetype>
-                                        <horstretch>2</horstretch>
-                                        <verstretch>0</verstretch>
-                                    </sizepolicy>
-                                </property>
-                            </widget>
-                            <widget class="QLabel">
-                                <property name="name">
-                                    <cstring>MaxLabel</cstring>
-                                </property>
-                                <property name="text">
-                                    <string>Max:</string>
-                                </property>
-                            </widget>
-                            <widget class="QLineEdit">
-                                <property name="name">
-                                    <cstring>eMax</cstring>
-                                </property>
-                                <property name="sizePolicy">
-                                    <sizepolicy>
-                                        <hsizetype>7</hsizetype>
-                                        <vsizetype>0</vsizetype>
-                                        <horstretch>2</horstretch>
-                                        <verstretch>0</verstretch>
-                                    </sizepolicy>
-                                </property>
-                            </widget>
-                            <widget class="QLabel">
-                                <property name="name">
-                                    <cstring>PrLabel</cstring>
-                                </property>
-                                <property name="text">
-                                    <string>Prefix:</string>
-                                </property>
-                            </widget>
-                            <widget class="QLineEdit">
-                                <property name="name">
-                                    <cstring>ePrefix</cstring>
-                                </property>
-                                <property name="sizePolicy">
-                                    <sizepolicy>
-                                        <hsizetype>7</hsizetype>
-                                        <vsizetype>0</vsizetype>
-                                        <horstretch>1</horstretch>
-                                        <verstretch>0</verstretch>
-                                    </sizepolicy>
-                                </property>
-                            </widget>
-                            <widget class="QLabel">
-                                <property name="name">
-                                    <cstring>SfLabel</cstring>
-                                </property>
-                                <property name="text">
-                                    <string>Suffix:</string>
-                                </property>
-                            </widget>
-                            <widget class="QLineEdit">
-                                <property name="name">
-                                    <cstring>eSuffix</cstring>
-                                </property>
-                                <property name="sizePolicy">
-                                    <sizepolicy>
-                                        <hsizetype>7</hsizetype>
-                                        <vsizetype>0</vsizetype>
-                                        <horstretch>1</horstretch>
-                                        <verstretch>0</verstretch>
-                                    </sizepolicy>
-                                </property>
-                            </widget>
-                        </hbox>
-                    </widget>
-                    <widget class="QGroupBox" row="10" column="0" rowspan="1" colspan="5">
+                    <widget class="QGroupBox" row="8" column="0" rowspan="1" colspan="4">
                         <property name="name">
                             <cstring>PropBox</cstring>
                         </property>
                             </spacer>
                         </hbox>
                     </widget>
-                    <widget class="QLayoutWidget" row="9" column="2" rowspan="1" colspan="3">
+                    <widget class="QLayoutWidget" row="7" column="1" rowspan="1" colspan="3">
                         <property name="name">
                             <cstring>layout19</cstring>
                         </property>
                             </widget>
                         </hbox>
                     </widget>
-                    <widget class="QGroupBox" row="5" column="0" rowspan="1" colspan="5">
+                    <widget class="QGroupBox" row="4" column="0" rowspan="1" colspan="4">
                         <property name="name">
-                            <cstring>DateMask</cstring>
+                            <cstring>NumeratorGroupBox</cstring>
                         </property>
                         <property name="title">
-                            <string>Use Date with Mask</string>
-                        </property>
-                        <property name="checkable">
-                            <bool>true</bool>
-                        </property>
-                        <property name="checked">
-                            <bool>true</bool>
+                            <string>Numeranor</string>
                         </property>
                         <grid>
                             <property name="name">
                             <property name="spacing">
                                 <number>3</number>
                             </property>
-                            <widget class="QLabel" row="0" column="0">
+                            <widget class="QLabel" row="2" column="0">
                                 <property name="name">
-                                    <cstring>textLabel1_3</cstring>
+                                    <cstring>exLabel</cstring>
                                 </property>
                                 <property name="text">
-                                    <string>Date format</string>
+                                    <string>&lt;u&gt;&lt;i&gt;Example&lt;/i&gt;:&lt;/u&gt;</string>
                                 </property>
                             </widget>
-                            <widget class="AComboBox" row="0" column="1">
-                                <item>
-                                    <property name="text">
-                                        <string>yyyyMMdd</string>
-                                    </property>
-                                </item>
-                                <item>
-                                    <property name="text">
-                                        <string>yyMMdd</string>
-                                    </property>
-                                </item>
-                                <item>
-                                    <property name="text">
-                                        <string>dd MMMM yyyy</string>
-                                    </property>
-                                </item>
+                            <widget class="QLabel" row="0" column="0">
                                 <property name="name">
-                                    <cstring>aDFormatBox</cstring>
+                                    <cstring>Num_Label</cstring>
                                 </property>
-                                <property name="sizePolicy">
-                                    <sizepolicy>
-                                        <hsizetype>1</hsizetype>
-                                        <vsizetype>0</vsizetype>
-                                        <horstretch>2</horstretch>
-                                        <verstretch>0</verstretch>
-                                    </sizepolicy>
+                                <property name="text">
+                                    <string>Numerator</string>
                                 </property>
                             </widget>
-                            <widget class="QLabel" row="0" column="2">
+                            <widget class="QCheckBox" row="1" column="0">
                                 <property name="name">
-                                    <cstring>textLabel2</cstring>
+                                    <cstring>DateFormat</cstring>
                                 </property>
                                 <property name="text">
-                                    <string>or</string>
+                                    <string>and date</string>
                                 </property>
                             </widget>
-                            <spacer row="0" column="5">
-                                <property name="name">
-                                    <cstring>spacer21</cstring>
-                                </property>
-                                <property name="orientation">
-                                    <enum>Horizontal</enum>
-                                </property>
-                                <property name="sizeType">
-                                    <enum>Expanding</enum>
-                                </property>
-                                <property name="sizeHint">
-                                    <size>
-                                        <width>20</width>
-                                        <height>16</height>
-                                    </size>
-                                </property>
-                            </spacer>
-                            <widget class="QLineEdit" row="0" column="4">
+                            <widget class="QLayoutWidget" row="0" column="1">
                                 <property name="name">
-                                    <cstring>eOwnFormat</cstring>
+                                    <cstring>layout19</cstring>
                                 </property>
                                 <property name="sizePolicy">
                                     <sizepolicy>
                                         <hsizetype>7</hsizetype>
                                         <vsizetype>0</vsizetype>
-                                        <horstretch>1</horstretch>
+                                        <horstretch>0</horstretch>
                                         <verstretch>0</verstretch>
                                     </sizepolicy>
                                 </property>
+                                <hbox>
+                                    <property name="name">
+                                        <cstring>unnamed</cstring>
+                                    </property>
+                                    <widget class="QLabel">
+                                        <property name="name">
+                                            <cstring>MinLabel</cstring>
+                                        </property>
+                                        <property name="text">
+                                            <string>Min:</string>
+                                        </property>
+                                    </widget>
+                                    <widget class="QLineEdit">
+                                        <property name="name">
+                                            <cstring>eMin</cstring>
+                                        </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>7</hsizetype>
+                                                <vsizetype>0</vsizetype>
+                                                <horstretch>2</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
+                                    </widget>
+                                    <widget class="QLabel">
+                                        <property name="name">
+                                            <cstring>MaxLabel</cstring>
+                                        </property>
+                                        <property name="text">
+                                            <string>Max:</string>
+                                        </property>
+                                    </widget>
+                                    <widget class="QLineEdit">
+                                        <property name="name">
+                                            <cstring>eMax</cstring>
+                                        </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>7</hsizetype>
+                                                <vsizetype>0</vsizetype>
+                                                <horstretch>2</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
+                                    </widget>
+                                    <widget class="QLabel">
+                                        <property name="name">
+                                            <cstring>PrLabel</cstring>
+                                        </property>
+                                        <property name="text">
+                                            <string>Prefix:</string>
+                                        </property>
+                                    </widget>
+                                    <widget class="QLineEdit">
+                                        <property name="name">
+                                            <cstring>ePrefix</cstring>
+                                        </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>7</hsizetype>
+                                                <vsizetype>0</vsizetype>
+                                                <horstretch>1</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
+                                    </widget>
+                                    <widget class="QLabel">
+                                        <property name="name">
+                                            <cstring>SfLabel</cstring>
+                                        </property>
+                                        <property name="text">
+                                            <string>Suffix:</string>
+                                        </property>
+                                    </widget>
+                                    <widget class="QLineEdit">
+                                        <property name="name">
+                                            <cstring>eSuffix</cstring>
+                                        </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>7</hsizetype>
+                                                <vsizetype>0</vsizetype>
+                                                <horstretch>1</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
+                                    </widget>
+                                </hbox>
                             </widget>
-                            <widget class="QCheckBox" row="0" column="3">
+                            <widget class="QLayoutWidget" row="2" column="1">
                                 <property name="name">
-                                    <cstring>useOwnFofmat</cstring>
+                                    <cstring>layout27</cstring>
                                 </property>
-                                <property name="text">
-                                    <string>use own format</string>
+                                <hbox>
+                                    <property name="name">
+                                        <cstring>unnamed</cstring>
+                                    </property>
+                                    <spacer>
+                                        <property name="name">
+                                            <cstring>spacer20</cstring>
+                                        </property>
+                                        <property name="orientation">
+                                            <enum>Horizontal</enum>
+                                        </property>
+                                        <property name="sizeType">
+                                            <enum>Expanding</enum>
+                                        </property>
+                                        <property name="sizeHint">
+                                            <size>
+                                                <width>144</width>
+                                                <height>16</height>
+                                            </size>
+                                        </property>
+                                    </spacer>
+                                    <widget class="QLabel">
+                                        <property name="name">
+                                            <cstring>eXample</cstring>
+                                        </property>
+                                        <property name="text">
+                                            <string>___</string>
+                                        </property>
+                                    </widget>
+                                    <spacer>
+                                        <property name="name">
+                                            <cstring>spacer19</cstring>
+                                        </property>
+                                        <property name="orientation">
+                                            <enum>Horizontal</enum>
+                                        </property>
+                                        <property name="sizeType">
+                                            <enum>Expanding</enum>
+                                        </property>
+                                        <property name="sizeHint">
+                                            <size>
+                                                <width>135</width>
+                                                <height>16</height>
+                                            </size>
+                                        </property>
+                                    </spacer>
+                                </hbox>
+                            </widget>
+                            <widget class="QLayoutWidget" row="1" column="1">
+                                <property name="name">
+                                    <cstring>layout9</cstring>
                                 </property>
+                                <hbox>
+                                    <property name="name">
+                                        <cstring>unnamed</cstring>
+                                    </property>
+                                    <widget class="AComboBox">
+                                        <item>
+                                            <property name="text">
+                                                <string>yyyyMMdd</string>
+                                            </property>
+                                        </item>
+                                        <item>
+                                            <property name="text">
+                                                <string>yyMMdd</string>
+                                            </property>
+                                        </item>
+                                        <item>
+                                            <property name="text">
+                                                <string>dd MMMM yyyy</string>
+                                            </property>
+                                        </item>
+                                        <property name="name">
+                                            <cstring>aDFormatBox</cstring>
+                                        </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>1</hsizetype>
+                                                <vsizetype>0</vsizetype>
+                                                <horstretch>2</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
+                                    </widget>
+                                    <widget class="QLabel">
+                                        <property name="name">
+                                            <cstring>textLabel2</cstring>
+                                        </property>
+                                        <property name="text">
+                                            <string>or</string>
+                                        </property>
+                                    </widget>
+                                    <widget class="QCheckBox">
+                                        <property name="name">
+                                            <cstring>useOwnFofmat</cstring>
+                                        </property>
+                                        <property name="text">
+                                            <string>use own format</string>
+                                        </property>
+                                    </widget>
+                                    <widget class="QLineEdit">
+                                        <property name="name">
+                                            <cstring>eOwnFormat</cstring>
+                                        </property>
+                                        <property name="sizePolicy">
+                                            <sizepolicy>
+                                                <hsizetype>7</hsizetype>
+                                                <vsizetype>0</vsizetype>
+                                                <horstretch>1</horstretch>
+                                                <verstretch>0</verstretch>
+                                            </sizepolicy>
+                                        </property>
+                                    </widget>
+                                </hbox>
                             </widget>
                         </grid>
                     </widget>
-                    <widget class="QLayoutWidget" row="3" column="2" rowspan="1" colspan="3">
+                    <widget class="QLayoutWidget" row="3" column="1" rowspan="1" colspan="3">
                         <property name="name">
-                            <cstring>layout6</cstring>
+                            <cstring>layout7</cstring>
                         </property>
                         <hbox>
                             <property name="name">
                                     <bool>true</bool>
                                 </property>
                             </widget>
+                            <widget class="QCheckBox">
+                                <property name="name">
+                                    <cstring>efNumerator</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>Num</string>
+                                </property>
+                            </widget>
                             <spacer>
                                 <property name="name">
                                     <cstring>spacer7</cstring>
                                 </property>
                                 <property name="sizeHint">
                                     <size>
-                                        <width>15</width>
+                                        <width>45</width>
                                         <height>20</height>
                                     </size>
                                 </property>
                             </spacer>
                         </hbox>
                     </widget>
-                    <spacer row="8" column="3">
-                        <property name="name">
-                            <cstring>spacer13</cstring>
-                        </property>
-                        <property name="orientation">
-                            <enum>Vertical</enum>
-                        </property>
-                        <property name="sizeType">
-                            <enum>Expanding</enum>
-                        </property>
-                        <property name="sizeHint">
-                            <size>
-                                <width>16</width>
-                                <height>40</height>
-                            </size>
-                        </property>
-                    </spacer>
-                    <widget class="QGroupBox" row="7" column="0" rowspan="1" colspan="5">
+                    <widget class="QGroupBox" row="5" column="0" rowspan="1" colspan="4">
                         <property name="name">
                             <cstring>ValidateGroupBox</cstring>
                         </property>
                             <property name="name">
                                 <cstring>unnamed</cstring>
                             </property>
-                            <widget class="QLayoutWidget" row="0" column="0">
+                            <widget class="QLabel" row="2" column="0" rowspan="1" colspan="3">
                                 <property name="name">
-                                    <cstring>layout8</cstring>
+                                    <cstring>textLabel3</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>&lt;u&gt;Example:&lt;/u&gt; RegExp &lt;b&gt;&lt;i&gt;[A-C]\d{5}[W-Z]&lt;/b&gt;&lt;/i&gt; for string &lt;i&gt;&lt;b&gt;A12345Z&lt;/b&gt;&lt;/i&gt;</string>
+                                </property>
+                                <property name="textFormat">
+                                    <enum>AutoText</enum>
+                                </property>
+                            </widget>
+                            <widget class="QLabel" row="0" column="0">
+                                <property name="name">
+                                    <cstring>textLabel1_5</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>RegExp</string>
+                                </property>
+                            </widget>
+                            <widget class="QCheckBox" row="0" column="2">
+                                <property name="name">
+                                    <cstring>two_state</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>Intermediate == Invalid</string>
+                                </property>
+                            </widget>
+                            <widget class="QLabel" row="1" column="0">
+                                <property name="name">
+                                    <cstring>textLabel1_4</cstring>
+                                </property>
+                                <property name="text">
+                                    <string>Input Mask</string>
+                                </property>
+                            </widget>
+                            <widget class="QLineEdit" row="0" column="1">
+                                <property name="name">
+                                    <cstring>VdRegEx</cstring>
+                                </property>
+                                <property name="toolTip" stdset="0">
+                                    <string>[ABCD], will match an A or a B or a C or a D.</string>
+                                </property>
+                            </widget>
+                            <widget class="QLineEdit" row="1" column="1">
+                                <property name="name">
+                                    <cstring>inputMask</cstring>
+                                </property>
+                                <property name="toolTip" stdset="0">
+                                    <string>[ABCD], will match an A or a B or a C or a D.</string>
+                                </property>
+                            </widget>
+                            <widget class="QLayoutWidget" row="1" column="2">
+                                <property name="name">
+                                    <cstring>layout7</cstring>
                                 </property>
                                 <hbox>
                                     <property name="name">
                                     </property>
                                     <widget class="QLabel">
                                         <property name="name">
-                                            <cstring>textLabel1_5</cstring>
-                                        </property>
-                                        <property name="text">
-                                            <string>RegExp</string>
-                                        </property>
-                                    </widget>
-                                    <widget class="QLineEdit">
-                                        <property name="name">
-                                            <cstring>VdRegEx</cstring>
-                                        </property>
-                                        <property name="toolTip" stdset="0">
-                                            <string>[ABCD], will match an A or a B or a C or a D.</string>
-                                        </property>
-                                    </widget>
-                                    <spacer>
-                                        <property name="name">
-                                            <cstring>spacer7_2</cstring>
-                                        </property>
-                                        <property name="orientation">
-                                            <enum>Horizontal</enum>
-                                        </property>
-                                        <property name="sizeType">
-                                            <enum>Expanding</enum>
-                                        </property>
-                                        <property name="sizeHint">
-                                            <size>
-                                                <width>20</width>
-                                                <height>21</height>
-                                            </size>
-                                        </property>
-                                    </spacer>
-                                    <widget class="QLabel">
-                                        <property name="name">
                                             <cstring>textLabel2_3</cstring>
                                         </property>
                                         <property name="text">
                                     </widget>
                                 </hbox>
                             </widget>
-                            <widget class="QLabel" row="1" column="0">
-                                <property name="name">
-                                    <cstring>textLabel3</cstring>
-                                </property>
-                                <property name="text">
-                                    <string>&lt;u&gt;Example:&lt;/u&gt; RegExp &lt;b&gt;&lt;i&gt;[A-C]\d{5}[W-Z]&lt;/b&gt;&lt;/i&gt; for string &lt;i&gt;&lt;b&gt;A12345Z&lt;/b&gt;&lt;/i&gt;</string>
-                                </property>
-                                <property name="textFormat">
-                                    <enum>AutoText</enum>
-                                </property>
-                            </widget>
                         </grid>
                     </widget>
+                    <spacer row="6" column="2">
+                        <property name="name">
+                            <cstring>spacer13</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Vertical</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Expanding</enum>
+                        </property>
+                        <property name="sizeHint">
+                            <size>
+                                <width>16</width>
+                                <height>80</height>
+                            </size>
+                        </property>
+                    </spacer>
                 </grid>
             </widget>
             <widget class="QWidget">
         <slot>setExample()</slot>
     </connection>
     <connection>
-        <sender>DateMask</sender>
-        <signal>toggled(bool)</signal>
-        <receiver>dEditField</receiver>
-        <slot>setExample()</slot>
-    </connection>
-    <connection>
         <sender>ePrefix</sender>
         <signal>textChanged(const QString&amp;)</signal>
         <receiver>dEditField</receiver>
         <slot>efVd_stateChanged(int)</slot>
     </connection>
     <connection>
-        <sender>VdRegEx</sender>
+        <sender>Testline</sender>
         <signal>textChanged(const QString&amp;)</signal>
         <receiver>dEditField</receiver>
-        <slot>VdRegEx_textChanged(const QString&amp;)</slot>
+        <slot>Testline_textChanged(const QString&amp;)</slot>
     </connection>
     <connection>
-        <sender>Testline</sender>
+        <sender>inputMask</sender>
         <signal>textChanged(const QString&amp;)</signal>
         <receiver>dEditField</receiver>
-        <slot>Testline_textChanged(const QString&amp;)</slot>
+        <slot>inputMask_textChanged(const QString&amp;)</slot>
+    </connection>
+    <connection>
+        <sender>efNumerator</sender>
+        <signal>stateChanged(int)</signal>
+        <receiver>dEditField</receiver>
+        <slot>efNumerator_stateChanged(int)</slot>
+    </connection>
+    <connection>
+        <sender>DateFormat</sender>
+        <signal>stateChanged(int)</signal>
+        <receiver>dEditField</receiver>
+        <slot>DateFormat_stateChanged(int)</slot>
     </connection>
 </connections>
 <includes>
     <slot>aUsersList_clicked( QListViewItem * )</slot>
     <slot>setExample()</slot>
     <slot>efVd_stateChanged( int )</slot>
-    <slot>VdRegEx_textChanged( const QString &amp; )</slot>
     <slot>Testline_textChanged( const QString &amp; )</slot>
+    <slot>inputMask_textChanged( const QString &amp; )</slot>
+    <slot>efNumerator_stateChanged( int )</slot>
+    <slot>DateFormat_stateChanged( int )</slot>
 </slots>
 <functions>
     <function access="private">destroy()</function>
index 75f104a..3b35c0d 100644 (file)
@@ -74,6 +74,7 @@ void dEditField::init()
        otypes.append(" ");
        lzcheckBox->setText(tr("Add leading zeros"));
        efVd->setText(tr("Validate"));
+       efNumerator->setText(tr("Numerator"));
        eType->insertItem(tr("Unknown"), 0);
 
 }
@@ -126,8 +127,10 @@ void dEditField::setData( aListViewItem *o )
        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 );
        VdRegEx->setText( md->attr( obj, mda_validator ) );
+       inputMask->setText( md->attr( obj, mda_inputmask ) );
 
        efSum->setChecked(md->attr( obj, mda_sum ) == "1");
 
@@ -299,6 +302,9 @@ void dEditField::updateMD()
  if( efVd->isChecked() ) md->setAttr( obj, mda_vd, "1" );
  else md->setAttr( obj, mda_vd, "0" );
  if (VdRegEx->text() )md->setAttr( obj, mda_validator, VdRegEx->text().stripWhiteSpace() );
+ 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" );
  if( efSum->isChecked() )
      md->setAttr( obj, mda_sum, "1" );
  else
@@ -337,21 +343,8 @@ void dEditField::typeSelect( int idx )
                comboBox2->hide();
                efVd->show();
                ValidateGroupBox->show();
-               DateMask->hide();
+               NumeratorGroupBox->hide();
                saldoTextLabel->hide();
-               //
-               Num_Label->hide();
-               MinLabel->hide();
-               eMin->hide();
-               MaxLabel->hide();
-               eMax->hide();
-               PrLabel->hide();
-               ePrefix->hide();
-               SfLabel->hide();
-               eSuffix->hide();
-               exLabel->hide();
-               eXample->hide();
-                //
        }
        else
        {
@@ -366,24 +359,13 @@ void dEditField::typeSelect( int idx )
                        tSepTriads->hide();
                        lzcheckBox->hide();
                        tNotBound->show();
-                       DateMask->show();
+                       NumeratorGroupBox->show();
                        efVd->show();
                        ValidateGroupBox->show();
                        efSum->setChecked(false);
                        comboBox2->setEnabled(false);
                        comboBox2->hide();
                        saldoTextLabel->hide();
-                           Num_Label->show();
-                           MinLabel->show();
-                           eMin->show();
-                           MaxLabel->show();
-                           eMax->show();
-                           PrLabel->show();
-                           ePrefix->show();
-                           SfLabel->show();
-                           eSuffix->show();
-                           exLabel->show();
-                           eXample->show();
                }
                else
                {
@@ -402,19 +384,7 @@ void dEditField::typeSelect( int idx )
                            tSepTriads->hide();
                            efVd->hide();
                            ValidateGroupBox->hide();
-                           //
-                           Num_Label->hide();
-                           MinLabel->hide();
-                           eMin->hide();
-                           MaxLabel->hide();
-                           eMax->hide();
-                           PrLabel->hide();
-                           ePrefix->hide();
-                           SfLabel->hide();
-                           eSuffix->hide();
-                           exLabel->hide();
-                           eXample->hide();
-                           //
+                           NumeratorGroupBox->hide();
                            efSum->setChecked(false);
                        }
                        else
@@ -431,21 +401,8 @@ void dEditField::typeSelect( int idx )
                                tNotBound->hide();
                                tSepTriads->hide();
                                efVd->hide();
-                               DateMask->hide();
+                               NumeratorGroupBox->hide();
                                ValidateGroupBox->hide();
-                                //
-                           Num_Label->hide();
-                           MinLabel->hide();
-                           eMin->hide();
-                           MaxLabel->hide();
-                           eMax->hide();
-                           PrLabel->hide();
-                           ePrefix->hide();
-                           SfLabel->hide();
-                           eSuffix->hide();
-                           exLabel->hide();
-                           eXample->hide();
-                           //
                                efSum->setChecked(false);
                                // comboBox2->setEnabled(false);
                        }
@@ -488,16 +445,13 @@ void dEditField::setExample()
 {
      QDate date = QDate::currentDate();
      QString curdate, dateformat, numerator;
-     if (DateMask->isChecked() )
+     
+     if (DateFormat->isChecked() )
      {
         if (useOwnFofmat->isChecked() )
         {
-            aDFormatBox->setEnabled(FALSE);
-            eOwnFormat->setEnabled(TRUE);
             dateformat =eOwnFormat->text();
         }else{
-            aDFormatBox->setEnabled(TRUE);
-            eOwnFormat->setEnabled(FALSE);
             dateformat =aDFormatBox->currentText();
         }
         curdate = date.toString(dateformat);
@@ -514,8 +468,6 @@ void dEditField::setExample()
 }
 
 
-
-
 void dEditField::efVd_stateChanged( int )
 {
     if (efVd->isChecked() )
@@ -527,12 +479,6 @@ void dEditField::efVd_stateChanged( int )
 }
 
 
-void dEditField::VdRegEx_textChanged( const QString & )
-{
-
-}
-
-
 void dEditField::Testline_textChanged( const QString & )
 {
     QRegExp rx( VdRegEx->text() );
@@ -548,7 +494,11 @@ void dEditField::Testline_textChanged( const QString & )
     }
     if(v.validate(s, pos ) == QValidator::Intermediate)
     {
-        pal.setColor(QColorGroup::Highlight, Qt::red);
+       if (two_state->isChecked() ) {
+           pal.setColor(QColorGroup::Highlight, Qt::red);
+       }else{
+           pal.setColor(QColorGroup::Highlight, Qt::yellow);
+       }
         Testline->setPalette(pal);
     }
      if(v.validate(s, pos ) == QValidator::Acceptable)
@@ -557,3 +507,36 @@ void dEditField::Testline_textChanged( const QString & )
         Testline->setPalette(pal);
     }
 }
+
+void dEditField::inputMask_textChanged( const QString & )
+{
+    Testline->setInputMask(inputMask->text());
+}
+
+
+void dEditField::efNumerator_stateChanged( int )
+{
+    if (efNumerator->isChecked() )
+    {
+       NumeratorGroupBox->show();
+    } else {
+       NumeratorGroupBox->hide();
+    }
+}
+
+
+void dEditField::DateFormat_stateChanged( int )
+{
+    if (DateFormat->isChecked() )
+    {
+       aDFormatBox->setEnabled(TRUE);
+       textLabel2->setEnabled(TRUE);
+       useOwnFofmat->setEnabled(TRUE);
+       eOwnFormat->setEnabled(TRUE);
+    } else {
+       aDFormatBox->setEnabled(FALSE);
+       textLabel2->setEnabled(FALSE);
+       useOwnFofmat->setEnabled(FALSE);
+       eOwnFormat->setEnabled(FALSE);
+    }
+}
index 67e51b9..d16f174 100644 (file)
@@ -211,13 +211,14 @@ Metadata attributes.
 #define mda_stdf               "stdf"
 #define mda_rights             "rights"
 #define mda_vd                 "vd"
+#define mda_twostate           "twostate"
 #define mda_validator          "validator"
+#define mda_inputmask          "inputmask"
 
 
 /*!
 Actions types
 */
-
 #define md_action_new          0
 #define md_action_edit         1
 #define md_action_view         2
index 24a7929..9790dab 100644 (file)
@@ -326,7 +326,11 @@ wDBField::initObject(aDatabase *adb )
   }
   if ( md->attr(o,mda_vd) == "1" && md->attr(o,mda_validator) != "")
   {
-         wField::SetValidator( md->attr(o,mda_validator) );
+         wField::SetValidator( md->attr(o,mda_validator), md->attr(o,mda_twostate).toInt() );
+  }
+  if (md->attr(o,mda_inputmask) != "" )
+  {
+         wField::SetMask(md->attr(o,mda_inputmask));
   }
 
 
index 4c4a19d..f05ddc1 100644 (file)
@@ -380,7 +380,11 @@ wField::Validate(const QString &test)
                        emit inputInvalid();
                        break;
                case QValidator::Intermediate:
-                       pal.setColor(QColorGroup::Highlight, Qt::yellow);
+                       if (two_state == 0) {
+                               pal.setColor(QColorGroup::Highlight, Qt::yellow);
+                       }else{
+                               pal.setColor(QColorGroup::Highlight, Qt::red);
+                       }
                        lineEdit->setPalette(pal);
                        setValue( test );
                        break;
@@ -401,14 +405,29 @@ wField::Validate(const QString &test)
  * \param QString Validator - \en RegExp for QRegExpValidator  \_en \ru значение RegExp для установки QRegExpValidator\_ru
  */
 void
-wField::SetValidator(QString Validator)
+wField::SetValidator(QString Validator, int twostate)
 {
+       two_state = twostate;
        QRegExp rx( Validator );
        v = new QRegExpValidator( rx, 0 );
        connect( lineEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( Validate( const QString & ) ) );
 }
 
 /*!
+ * \en Set input Mask to LineEdit.
+ * \_en
+ * \ru Устанавливает маску ввода в LineEdit.
+ * \_ru
+ * \param QString inputMas - \en inputMas for  LineEdit. \_en
+ * \ru inputMas для LineEdit.\_ru
+ */
+void
+wField::SetMask(QString inputMask)
+{
+       if (inputMask != "") lineEdit->setInputMask(inputMask);
+}
+
+/*!
  * \en         Sets value. \_en
  * \ru Устанавливает значение виджета. \_ru
  *     \param newvalue (in) - \en value for set \_en \ru значение для установки \_ru
index c0dffa3..edf58e8 100644 (file)
@@ -104,7 +104,8 @@ public slots:
        void                    selectAll();
        virtual void            SetReadOnly(bool);
        virtual void            SetNonZero(bool);
-       virtual void            SetValidator(QString Validator);
+       virtual void            SetMask(QString);
+       virtual void            SetValidator(QString Validator, int twostate);
 
 private slots:
        void on_selected( Q_ULLONG uid );
@@ -118,6 +119,7 @@ protected:
        wCatButton      *objButton;
        wCheckBox       *checkBox;
        QValidator      *v;
+       int             two_state;
        tEditorType     vEditorType;
        QString         vFieldType;
        QString         vValue;