Skip to content

Commit 63ab9a5

Browse files
author
jef
committedJan 23, 2010
pack label dialog
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12825 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 4c9b4a0 commit 63ab9a5

File tree

2 files changed

+214
-283
lines changed

2 files changed

+214
-283
lines changed
 

‎src/app/qgslabeldialog.cpp

Lines changed: 11 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ QgsLabelDialog::QgsLabelDialog( QgsLabel *label, QWidget *parent )
4848

4949
connect( btnDefaultFont, SIGNAL( clicked() ),
5050
this, SLOT( changeFont() ) );
51-
connect( pbnDefaultBufferColor_2, SIGNAL( clicked() ),
51+
connect( pbnDefaultBufferColor, SIGNAL( clicked() ),
5252
this, SLOT( changeBufferColor() ) );
5353
connect( pbnDefaultFontColor, SIGNAL( clicked() ),
5454
this, SLOT( changeFontColor() ) );
@@ -165,19 +165,12 @@ void QgsLabelDialog::init( )
165165
mFont.setPointSizeF( myLabelAttributes->size() );
166166

167167
int myTypeInt = myLabelAttributes->sizeType();
168-
if ( myTypeInt == QgsLabelAttributes::PointUnits )
169-
{
170-
radioFontSizeUnitsPoints->setChecked( true );
171-
}
172-
else //assume map units is checked
173-
{
174-
radioFontSizeUnitsMap->setChecked( true );
175-
}
168+
cboFontSizeUnits->setCurrentIndex( myTypeInt == QgsLabelAttributes::PointUnits ? 0 : 1 );
176169
}
177170
else //defaults for when no size has been set
178171
{
179172
mFont.setPointSizeF( myLabelAttributes->size() );
180-
radioFontSizeUnitsPoints->setChecked( true );
173+
cboFontSizeUnits->setCurrentIndex( 0 );
181174
}
182175

183176
spinFontSize->setValue( myLabelAttributes->size() );
@@ -220,19 +213,13 @@ void QgsLabelDialog::init( )
220213
if ( myLabelAttributes->offsetIsSet() )
221214
{
222215
int myTypeInt = myLabelAttributes->offsetType();
223-
if ( myTypeInt == QgsLabelAttributes::PointUnits )
224-
{
225-
radioOffsetUnitsPoints->setChecked( true );
226-
}
227-
else
228-
{
229-
radioOffsetUnitsMap->setChecked( true );
230-
}
216+
cboOffsetUnits->setCurrentIndex( myTypeInt == QgsLabelAttributes::PointUnits ? 0 : 1 );
231217
spinXOffset->setValue( myLabelAttributes->xOffset() );
232218
spinYOffset->setValue( myLabelAttributes->yOffset() );
233219
}
234220
else //defaults for when no offset is defined
235221
{
222+
cboOffsetUnits->setCurrentIndex( 0 );
236223
spinXOffset->setValue( 0 );
237224
spinYOffset->setValue( 0 );
238225
}
@@ -267,18 +254,12 @@ void QgsLabelDialog::init( )
267254
if ( myLabelAttributes->bufferSizeIsSet() )
268255
{
269256
int myTypeInt = myLabelAttributes->bufferSizeType();
270-
if ( myTypeInt == QgsLabelAttributes::PointUnits )
271-
{
272-
radioBufferUnitsPoints->setChecked( true );
273-
}
274-
else
275-
{
276-
radioBufferUnitsMap->setChecked( true );
277-
}
257+
cboBufferSizeUnits->setCurrentIndex( myTypeInt == QgsLabelAttributes::PointUnits ? 0 : 1 );
278258
spinBufferSize->setValue( myLabelAttributes->bufferSize() );
279259
}
280260
else //defaults for when no offset is defined
281261
{
262+
cboBufferSizeUnits->setCurrentIndex( 0 );
282263
spinBufferSize->setValue( 1 );
283264
}
284265
//set the state of the multiline enabled checkbox
@@ -343,8 +324,7 @@ void QgsLabelDialog::changeBufferColor( void )
343324

344325
int QgsLabelDialog::itemNoForField( QString theFieldName, QStringList theFieldList )
345326
{
346-
int myItemInt = 0;
347-
for ( QStringList::Iterator it = theFieldList.begin(); it != theFieldList.end(); ++it )
327+
int myItemInt = 0; for ( QStringList::Iterator it = theFieldList.begin(); it != theFieldList.end(); ++it )
348328
{
349329
if ( theFieldName == *it ) return myItemInt;
350330
++myItemInt;
@@ -367,30 +347,14 @@ void QgsLabelDialog::apply()
367347
QgsLabelAttributes * myLabelAttributes = mLabel->labelAttributes();
368348
myLabelAttributes->setText( leDefaultLabel->text() );
369349
myLabelAttributes->setFamily( mFont.family() );
370-
int myTypeInt = 0;
371-
if ( radioFontSizeUnitsPoints->isChecked() )
372-
{
373-
myTypeInt = QgsLabelAttributes::PointUnits;
374-
}
375-
else //assume map units is checked
376-
{
377-
myTypeInt = QgsLabelAttributes::MapUnits;
378-
}
350+
int myTypeInt = cboFontSizeUnits->currentIndex() == 0 ? QgsLabelAttributes::PointUnits : QgsLabelAttributes::MapUnits;
379351
myLabelAttributes->setSize( mFont.pointSizeF(), myTypeInt );
380352
myLabelAttributes->setBold( mFont.bold() );
381353
myLabelAttributes->setItalic( mFont.italic() );
382354
myLabelAttributes->setUnderline( mFont.underline() );
383355
myLabelAttributes->setStrikeOut( mFont.strikeOut() );
384356
myLabelAttributes->setColor( mFontColor );
385-
myTypeInt = 0;
386-
if ( radioOffsetUnitsPoints->isChecked() )
387-
{
388-
myTypeInt = QgsLabelAttributes::PointUnits;
389-
}
390-
else
391-
{
392-
myTypeInt = QgsLabelAttributes::MapUnits;
393-
}
357+
myTypeInt = cboOffsetUnits->currentIndex() == 0 ? QgsLabelAttributes::PointUnits : QgsLabelAttributes::MapUnits;
394358
myLabelAttributes->setOffset( spinXOffset->value(), spinYOffset->value(), myTypeInt );
395359
myLabelAttributes->setAutoAngle( spinAngle->value() == -1 );
396360
myLabelAttributes->setAngle( spinAngle->value() );
@@ -411,15 +375,7 @@ void QgsLabelDialog::apply()
411375
myLabelAttributes->setMultilineEnabled( chkUseMultiline->isChecked() );
412376
myLabelAttributes->setBufferEnabled( chkUseBuffer->isChecked() );
413377
myLabelAttributes->setBufferColor( mBufferColor );
414-
myTypeInt = 0;
415-
if ( radioBufferUnitsPoints->isChecked() )
416-
{
417-
myTypeInt = QgsLabelAttributes::PointUnits;
418-
}
419-
else
420-
{
421-
myTypeInt = QgsLabelAttributes::MapUnits;
422-
}
378+
myTypeInt = cboBufferSizeUnits->currentIndex() == 0 ? QgsLabelAttributes::PointUnits : QgsLabelAttributes::MapUnits;
423379
myLabelAttributes->setBufferSize( spinBufferSize->value(), myTypeInt );
424380
//TODO - transparency attributes for buffers
425381

0 commit comments

Comments
 (0)
Please sign in to comment.