[QGIS Commit] r12825 - in trunk/qgis/src: app ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Jan 23 11:23:17 EST 2010


Author: jef
Date: 2010-01-23 11:23:15 -0500 (Sat, 23 Jan 2010)
New Revision: 12825

Modified:
   trunk/qgis/src/app/qgslabeldialog.cpp
   trunk/qgis/src/ui/qgslabeldialogbase.ui
Log:
pack label dialog

Modified: trunk/qgis/src/app/qgslabeldialog.cpp
===================================================================
--- trunk/qgis/src/app/qgslabeldialog.cpp	2010-01-23 12:32:40 UTC (rev 12824)
+++ trunk/qgis/src/app/qgslabeldialog.cpp	2010-01-23 16:23:15 UTC (rev 12825)
@@ -48,7 +48,7 @@
 
   connect( btnDefaultFont, SIGNAL( clicked() ),
            this, SLOT( changeFont() ) );
-  connect( pbnDefaultBufferColor_2, SIGNAL( clicked() ),
+  connect( pbnDefaultBufferColor, SIGNAL( clicked() ),
            this, SLOT( changeBufferColor() ) );
   connect( pbnDefaultFontColor, SIGNAL( clicked() ),
            this, SLOT( changeFontColor() ) );
@@ -165,19 +165,12 @@
     mFont.setPointSizeF( myLabelAttributes->size() );
 
     int myTypeInt = myLabelAttributes->sizeType();
-    if ( myTypeInt == QgsLabelAttributes::PointUnits )
-    {
-      radioFontSizeUnitsPoints->setChecked( true );
-    }
-    else //assume map units is checked
-    {
-      radioFontSizeUnitsMap->setChecked( true );
-    }
+    cboFontSizeUnits->setCurrentIndex( myTypeInt == QgsLabelAttributes::PointUnits ? 0 : 1 );
   }
   else //defaults for when no size has been set
   {
     mFont.setPointSizeF( myLabelAttributes->size() );
-    radioFontSizeUnitsPoints->setChecked( true );
+    cboFontSizeUnits->setCurrentIndex( 0 );
   }
 
   spinFontSize->setValue( myLabelAttributes->size() );
@@ -220,19 +213,13 @@
   if ( myLabelAttributes->offsetIsSet() )
   {
     int myTypeInt = myLabelAttributes->offsetType();
-    if ( myTypeInt == QgsLabelAttributes::PointUnits )
-    {
-      radioOffsetUnitsPoints->setChecked( true );
-    }
-    else
-    {
-      radioOffsetUnitsMap->setChecked( true );
-    }
+    cboOffsetUnits->setCurrentIndex( myTypeInt == QgsLabelAttributes::PointUnits ? 0 : 1 );
     spinXOffset->setValue( myLabelAttributes->xOffset() );
     spinYOffset->setValue( myLabelAttributes->yOffset() );
   }
   else //defaults for when no offset is defined
   {
+    cboOffsetUnits->setCurrentIndex( 0 );
     spinXOffset->setValue( 0 );
     spinYOffset->setValue( 0 );
   }
@@ -267,18 +254,12 @@
   if ( myLabelAttributes->bufferSizeIsSet() )
   {
     int myTypeInt = myLabelAttributes->bufferSizeType();
-    if ( myTypeInt == QgsLabelAttributes::PointUnits )
-    {
-      radioBufferUnitsPoints->setChecked( true );
-    }
-    else
-    {
-      radioBufferUnitsMap->setChecked( true );
-    }
+    cboBufferSizeUnits->setCurrentIndex( myTypeInt == QgsLabelAttributes::PointUnits ? 0 : 1 );
     spinBufferSize->setValue( myLabelAttributes->bufferSize() );
   }
   else //defaults for when no offset is defined
   {
+    cboBufferSizeUnits->setCurrentIndex( 0 );
     spinBufferSize->setValue( 1 );
   }
   //set the state of the multiline enabled checkbox
@@ -343,8 +324,7 @@
 
 int QgsLabelDialog::itemNoForField( QString theFieldName, QStringList theFieldList )
 {
-  int myItemInt = 0;
-  for ( QStringList::Iterator it = theFieldList.begin(); it != theFieldList.end(); ++it )
+  int myItemInt = 0; for ( QStringList::Iterator it = theFieldList.begin(); it != theFieldList.end(); ++it )
   {
     if ( theFieldName == *it ) return myItemInt;
     ++myItemInt;
@@ -367,30 +347,14 @@
   QgsLabelAttributes * myLabelAttributes = mLabel->labelAttributes();
   myLabelAttributes->setText( leDefaultLabel->text() );
   myLabelAttributes->setFamily( mFont.family() );
-  int myTypeInt = 0;
-  if ( radioFontSizeUnitsPoints->isChecked() )
-  {
-    myTypeInt = QgsLabelAttributes::PointUnits;
-  }
-  else //assume map units is checked
-  {
-    myTypeInt = QgsLabelAttributes::MapUnits;
-  }
+  int myTypeInt = cboFontSizeUnits->currentIndex() == 0 ? QgsLabelAttributes::PointUnits : QgsLabelAttributes::MapUnits;
   myLabelAttributes->setSize( mFont.pointSizeF(), myTypeInt );
   myLabelAttributes->setBold( mFont.bold() );
   myLabelAttributes->setItalic( mFont.italic() );
   myLabelAttributes->setUnderline( mFont.underline() );
   myLabelAttributes->setStrikeOut( mFont.strikeOut() );
   myLabelAttributes->setColor( mFontColor );
-  myTypeInt = 0;
-  if ( radioOffsetUnitsPoints->isChecked() )
-  {
-    myTypeInt = QgsLabelAttributes::PointUnits;
-  }
-  else
-  {
-    myTypeInt = QgsLabelAttributes::MapUnits;
-  }
+  myTypeInt = cboOffsetUnits->currentIndex() == 0 ?  QgsLabelAttributes::PointUnits : QgsLabelAttributes::MapUnits;
   myLabelAttributes->setOffset( spinXOffset->value(), spinYOffset->value(), myTypeInt );
   myLabelAttributes->setAutoAngle( spinAngle->value() == -1 );
   myLabelAttributes->setAngle( spinAngle->value() );
@@ -411,15 +375,7 @@
   myLabelAttributes->setMultilineEnabled( chkUseMultiline->isChecked() );
   myLabelAttributes->setBufferEnabled( chkUseBuffer->isChecked() );
   myLabelAttributes->setBufferColor( mBufferColor );
-  myTypeInt = 0;
-  if ( radioBufferUnitsPoints->isChecked() )
-  {
-    myTypeInt = QgsLabelAttributes::PointUnits;
-  }
-  else
-  {
-    myTypeInt = QgsLabelAttributes::MapUnits;
-  }
+  myTypeInt = cboBufferSizeUnits->currentIndex() == 0 ? QgsLabelAttributes::PointUnits : QgsLabelAttributes::MapUnits;
   myLabelAttributes->setBufferSize( spinBufferSize->value(), myTypeInt );
   //TODO - transparency attributes for buffers
 

Modified: trunk/qgis/src/ui/qgslabeldialogbase.ui
===================================================================
--- trunk/qgis/src/ui/qgslabeldialogbase.ui	2010-01-23 12:32:40 UTC (rev 12824)
+++ trunk/qgis/src/ui/qgslabeldialogbase.ui	2010-01-23 16:23:15 UTC (rev 12825)
@@ -43,157 +43,11 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>526</width>
-            <height>740</height>
+            <width>525</width>
+            <height>512</height>
            </rect>
           </property>
           <layout class="QGridLayout" name="gridLayout_2">
-           <item row="0" column="0">
-            <widget class="QGroupBox" name="groupBox_8">
-             <property name="title">
-              <string>Basic label options</string>
-             </property>
-             <layout class="QGridLayout" name="gridLayout_8">
-              <item row="0" column="0">
-               <widget class="QLabel" name="textLabel5">
-                <property name="text">
-                 <string>Field containing label</string>
-                </property>
-                <property name="buddy">
-                 <cstring>cboLabelField</cstring>
-                </property>
-               </widget>
-              </item>
-              <item row="0" column="2">
-               <widget class="QComboBox" name="cboLabelField">
-                <property name="sizePolicy">
-                 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-                  <horstretch>1</horstretch>
-                  <verstretch>0</verstretch>
-                 </sizepolicy>
-                </property>
-               </widget>
-              </item>
-              <item row="1" column="0">
-               <widget class="QLabel" name="textLabel1">
-                <property name="text">
-                 <string>Default label</string>
-                </property>
-                <property name="buddy">
-                 <cstring>leDefaultLabel</cstring>
-                </property>
-               </widget>
-              </item>
-              <item row="1" column="2">
-               <widget class="QLineEdit" name="leDefaultLabel">
-                <property name="sizePolicy">
-                 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-                  <horstretch>2</horstretch>
-                  <verstretch>0</verstretch>
-                 </sizepolicy>
-                </property>
-               </widget>
-              </item>
-              <item row="2" column="0">
-               <widget class="QPushButton" name="btnDefaultFont">
-                <property name="sizePolicy">
-                 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-                  <horstretch>2</horstretch>
-                  <verstretch>0</verstretch>
-                 </sizepolicy>
-                </property>
-                <property name="text">
-                 <string>Font</string>
-                </property>
-               </widget>
-              </item>
-              <item row="2" column="1">
-               <widget class="QLabel" name="textLabel5_2_2_3_2">
-                <property name="text">
-                 <string>Font size</string>
-                </property>
-                <property name="alignment">
-                 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
-                </property>
-                <property name="buddy">
-                 <cstring>spinFontSize</cstring>
-                </property>
-               </widget>
-              </item>
-              <item row="2" column="2">
-               <widget class="QDoubleSpinBox" name="spinFontSize">
-                <property name="sizePolicy">
-                 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-                  <horstretch>0</horstretch>
-                  <verstretch>0</verstretch>
-                 </sizepolicy>
-                </property>
-                <property name="minimumSize">
-                 <size>
-                  <width>50</width>
-                  <height>0</height>
-                 </size>
-                </property>
-                <property name="decimals">
-                 <number>6</number>
-                </property>
-                <property name="maximum">
-                 <double>1000000.000000000000000</double>
-                </property>
-                <property name="value">
-                 <double>0.000000000000000</double>
-                </property>
-               </widget>
-              </item>
-              <item row="3" column="0">
-               <widget class="QPushButton" name="pbnDefaultFontColor">
-                <property name="sizePolicy">
-                 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-                  <horstretch>2</horstretch>
-                  <verstretch>0</verstretch>
-                 </sizepolicy>
-                </property>
-                <property name="text">
-                 <string>Color</string>
-                </property>
-               </widget>
-              </item>
-              <item row="3" column="1">
-               <widget class="QLabel" name="textLabel1_2_2_2_2_2">
-                <property name="text">
-                 <string>Angle (deg)</string>
-                </property>
-                <property name="buddy">
-                 <cstring>spinAngle</cstring>
-                </property>
-               </widget>
-              </item>
-              <item row="3" column="2">
-               <widget class="QSpinBox" name="spinAngle">
-                <property name="suffix">
-                 <string>°</string>
-                </property>
-                <property name="maximum">
-                 <number>360</number>
-                </property>
-                <property name="value">
-                 <number>0</number>
-                </property>
-               </widget>
-              </item>
-              <item row="4" column="0">
-               <widget class="QCheckBox" name="chkUseMultiline">
-                <property name="text">
-                 <string>Multiline labels?</string>
-                </property>
-                <property name="checked">
-                 <bool>true</bool>
-                </property>
-               </widget>
-              </item>
-             </layout>
-            </widget>
-           </item>
            <item row="1" column="0">
             <widget class="QGroupBox" name="groupBox_2">
              <property name="title">
@@ -341,37 +195,28 @@
               <item row="1" column="1">
                <widget class="QDoubleSpinBox" name="spinBufferSize"/>
               </item>
-              <item row="2" column="0">
-               <widget class="QRadioButton" name="radioBufferUnitsPoints">
-                <property name="text">
-                 <string>Size is in points</string>
-                </property>
+              <item row="1" column="2">
+               <widget class="QComboBox" name="cboBufferSizeUnits">
+                <item>
+                 <property name="text">
+                  <string>In points</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>In map units</string>
+                 </property>
+                </item>
                </widget>
               </item>
-              <item row="2" column="1">
-               <widget class="QRadioButton" name="radioBufferUnitsMap">
+              <item row="1" column="3">
+               <widget class="QPushButton" name="pbnDefaultBufferColor">
                 <property name="text">
-                 <string>Size is in map units</string>
+                 <string>Color</string>
                 </property>
                </widget>
               </item>
-              <item row="3" column="0">
-               <widget class="QLabel" name="textLabel5_2_2_3">
-                <property name="enabled">
-                 <bool>false</bool>
-                </property>
-                <property name="text">
-                 <string>Transparency</string>
-                </property>
-                <property name="alignment">
-                 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
-                </property>
-                <property name="buddy">
-                 <cstring>spinBufferTransparency</cstring>
-                </property>
-               </widget>
-              </item>
-              <item row="3" column="1">
+              <item row="1" column="4">
                <widget class="QSpinBox" name="spinBufferTransparency">
                 <property name="enabled">
                  <bool>false</bool>
@@ -391,6 +236,9 @@
                 <property name="suffix">
                  <string>%</string>
                 </property>
+                <property name="prefix">
+                 <string>Transparency </string>
+                </property>
                 <property name="maximum">
                  <number>100</number>
                 </property>
@@ -399,85 +247,215 @@
                 </property>
                </widget>
               </item>
-              <item row="0" column="1">
-               <widget class="QPushButton" name="pbnDefaultBufferColor_2">
-                <property name="text">
-                 <string>Color</string>
-                </property>
-               </widget>
-              </item>
              </layout>
             </widget>
            </item>
            <item row="4" column="0">
-            <widget class="QGroupBox" name="groupBox_3">
+            <widget class="QGroupBox" name="buttonGroup10">
              <property name="title">
-              <string>Font size units</string>
+              <string>Offset</string>
              </property>
-             <layout class="QGridLayout" name="gridLayout_3">
+             <layout class="QGridLayout" name="gridLayout_4">
               <item row="0" column="0">
-               <widget class="QRadioButton" name="radioFontSizeUnitsPoints">
-                <property name="text">
-                 <string>Points</string>
+               <widget class="QDoubleSpinBox" name="spinXOffset">
+                <property name="prefix">
+                 <string>X offset </string>
                 </property>
+                <property name="suffix">
+                 <string/>
+                </property>
+                <property name="minimum">
+                 <double>-99.000000000000000</double>
+                </property>
                </widget>
               </item>
               <item row="0" column="1">
-               <widget class="QRadioButton" name="radioFontSizeUnitsMap">
-                <property name="text">
-                 <string>Map units</string>
+               <widget class="QDoubleSpinBox" name="spinYOffset">
+                <property name="prefix">
+                 <string>Y offset </string>
                 </property>
+                <property name="suffix">
+                 <string/>
+                </property>
+                <property name="minimum">
+                 <double>-99.000000000000000</double>
+                </property>
                </widget>
               </item>
+              <item row="0" column="2">
+               <widget class="QComboBox" name="cboOffsetUnits">
+                <item>
+                 <property name="text">
+                  <string>In points</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>In map units</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
              </layout>
             </widget>
            </item>
-           <item row="5" column="0">
-            <widget class="QGroupBox" name="buttonGroup10">
+           <item row="0" column="0">
+            <widget class="QGroupBox" name="groupBox_8">
              <property name="title">
-              <string>Offset units</string>
+              <string>Basic label options</string>
              </property>
-             <layout class="QGridLayout" name="gridLayout_4">
+             <layout class="QGridLayout" name="gridLayout_8">
               <item row="0" column="0">
-               <widget class="QRadioButton" name="radioOffsetUnitsPoints">
+               <widget class="QLabel" name="textLabel5">
                 <property name="text">
-                 <string>Points</string>
+                 <string>Field containing label</string>
                 </property>
+                <property name="buddy">
+                 <cstring>cboLabelField</cstring>
+                </property>
                </widget>
               </item>
-              <item row="0" column="1">
-               <widget class="QRadioButton" name="radioOffsetUnitsMap">
-                <property name="text">
-                 <string>Map units</string>
+              <item row="0" column="1" colspan="3">
+               <widget class="QComboBox" name="cboLabelField">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+                  <horstretch>1</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
                 </property>
                </widget>
               </item>
               <item row="1" column="0">
-               <widget class="QDoubleSpinBox" name="spinXOffset">
-                <property name="prefix">
-                 <string>X offset </string>
+               <widget class="QLabel" name="textLabel1">
+                <property name="text">
+                 <string>Default label</string>
                 </property>
-                <property name="suffix">
-                 <string> points</string>
+                <property name="buddy">
+                 <cstring>leDefaultLabel</cstring>
                 </property>
-                <property name="minimum">
-                 <double>-99.000000000000000</double>
+               </widget>
+              </item>
+              <item row="1" column="1" colspan="3">
+               <widget class="QLineEdit" name="leDefaultLabel">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+                  <horstretch>2</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
                 </property>
                </widget>
               </item>
-              <item row="1" column="1">
-               <widget class="QDoubleSpinBox" name="spinYOffset">
-                <property name="prefix">
-                 <string>Y offset </string>
+              <item row="3" column="0">
+               <widget class="QLabel" name="textLabel5_2_2_3_2">
+                <property name="text">
+                 <string>Font size</string>
                 </property>
+                <property name="alignment">
+                 <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+                </property>
+                <property name="buddy">
+                 <cstring>spinFontSize</cstring>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="0">
+               <widget class="QLabel" name="textLabel1_2_2_2_2_2">
+                <property name="text">
+                 <string>Angle (deg)</string>
+                </property>
+                <property name="buddy">
+                 <cstring>spinAngle</cstring>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="1">
+               <widget class="QDoubleSpinBox" name="spinFontSize">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="minimumSize">
+                 <size>
+                  <width>50</width>
+                  <height>0</height>
+                 </size>
+                </property>
+                <property name="decimals">
+                 <number>6</number>
+                </property>
+                <property name="maximum">
+                 <double>1000000.000000000000000</double>
+                </property>
+                <property name="value">
+                 <double>0.000000000000000</double>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="1">
+               <widget class="QSpinBox" name="spinAngle">
                 <property name="suffix">
-                 <string> points</string>
+                 <string>°</string>
                 </property>
-                <property name="minimum">
-                 <double>-99.000000000000000</double>
+                <property name="maximum">
+                 <number>360</number>
                 </property>
+                <property name="value">
+                 <number>0</number>
+                </property>
                </widget>
               </item>
+              <item row="3" column="2">
+               <widget class="QComboBox" name="cboFontSizeUnits">
+                <item>
+                 <property name="text">
+                  <string>In points</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>In map units</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="6" column="2">
+               <widget class="QCheckBox" name="chkUseMultiline">
+                <property name="text">
+                 <string>Multiline labels?</string>
+                </property>
+                <property name="checked">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="3">
+               <widget class="QPushButton" name="btnDefaultFont">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                  <horstretch>2</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="text">
+                 <string>Font</string>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="3">
+               <widget class="QPushButton" name="pbnDefaultFontColor">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                  <horstretch>2</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="text">
+                 <string>Color</string>
+                </property>
+               </widget>
+              </item>
              </layout>
             </widget>
            </item>
@@ -505,8 +483,8 @@
            <rect>
             <x>0</x>
             <y>0</y>
-            <width>621</width>
-            <height>684</height>
+            <width>525</width>
+            <height>623</height>
            </rect>
           </property>
           <layout class="QGridLayout" name="gridLayout_7">
@@ -904,16 +882,17 @@
   <tabstop>scrollArea</tabstop>
   <tabstop>cboLabelField</tabstop>
   <tabstop>leDefaultLabel</tabstop>
-  <tabstop>btnDefaultFont</tabstop>
   <tabstop>spinFontSize</tabstop>
-  <tabstop>pbnDefaultFontColor</tabstop>
+  <tabstop>cboFontSizeUnits</tabstop>
+  <tabstop>btnDefaultFont</tabstop>
   <tabstop>spinAngle</tabstop>
   <tabstop>chkUseMultiline</tabstop>
+  <tabstop>pbnDefaultFontColor</tabstop>
+  <tabstop>radioOver</tabstop>
   <tabstop>radioAboveLeft</tabstop>
   <tabstop>radioAbove</tabstop>
   <tabstop>radioAboveRight</tabstop>
   <tabstop>radioLeft</tabstop>
-  <tabstop>radioOver</tabstop>
   <tabstop>radioRight</tabstop>
   <tabstop>radioBelowLeft</tabstop>
   <tabstop>radioBelow</tabstop>
@@ -922,18 +901,13 @@
   <tabstop>leMinimumScale</tabstop>
   <tabstop>leMaximumScale</tabstop>
   <tabstop>chkUseBuffer</tabstop>
-  <tabstop>pbnDefaultBufferColor_2</tabstop>
   <tabstop>spinBufferSize</tabstop>
-  <tabstop>radioBufferUnitsPoints</tabstop>
-  <tabstop>radioBufferUnitsMap</tabstop>
+  <tabstop>cboBufferSizeUnits</tabstop>
+  <tabstop>pbnDefaultBufferColor</tabstop>
   <tabstop>spinBufferTransparency</tabstop>
-  <tabstop>radioFontSizeUnitsPoints</tabstop>
-  <tabstop>radioFontSizeUnitsMap</tabstop>
-  <tabstop>radioOffsetUnitsPoints</tabstop>
-  <tabstop>radioOffsetUnitsMap</tabstop>
   <tabstop>spinXOffset</tabstop>
   <tabstop>spinYOffset</tabstop>
-  <tabstop>scrollArea_2</tabstop>
+  <tabstop>cboOffsetUnits</tabstop>
   <tabstop>cboAlignmentField</tabstop>
   <tabstop>cboAngleField</tabstop>
   <tabstop>cboFontField</tabstop>
@@ -950,6 +924,7 @@
   <tabstop>cboYCoordinateField</tabstop>
   <tabstop>cboXOffsetField</tabstop>
   <tabstop>cboYOffsetField</tabstop>
+  <tabstop>scrollArea_2</tabstop>
  </tabstops>
  <resources/>
  <connections/>



More information about the QGIS-commit mailing list