Skip to content

Commit

Permalink
fix lenny build
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14707 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Nov 18, 2010
1 parent 9e9eec9 commit 2f572cf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 22 deletions.
2 changes: 1 addition & 1 deletion scripts/prepare-commit.sh
Expand Up @@ -36,7 +36,7 @@ if [ -d .svn ]; then
REV=$(svn info | sed -ne "s/Revision: //p") REV=$(svn info | sed -ne "s/Revision: //p")
svn diff >r$REV.diff svn diff >r$REV.diff
elif [ -d .git ]; then elif [ -d .git ]; then
REV=$(git svn info | sed -ne "s/Revision //p") REV=$(git svn info | sed -ne "s/Revision: //p")
git diff >r$REV.diff git diff >r$REV.diff
fi fi


Expand Down
52 changes: 31 additions & 21 deletions src/app/qgslabelpropertydialog.cpp
Expand Up @@ -36,20 +36,20 @@ QgsLabelPropertyDialog::~QgsLabelPropertyDialog()


void QgsLabelPropertyDialog::init( const QString& layerId, int featureId ) void QgsLabelPropertyDialog::init( const QString& layerId, int featureId )
{ {
if( !mMapRenderer ) if ( !mMapRenderer )
{ {
return; return;
} }


//get feature attributes //get feature attributes
QgsVectorLayer* vlayer = dynamic_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( layerId ) ); QgsVectorLayer* vlayer = dynamic_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( layerId ) );
if( !vlayer ) if ( !vlayer )
{ {
return; return;
} }


QgsFeature f; QgsFeature f;
if( !vlayer->featureAtId( featureId, f, false, true ) ) if ( !vlayer->featureAtId( featureId, f, false, true ) )
{ {
return; return;
} }
Expand All @@ -58,7 +58,7 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId )


//get layerproperties. Problem: only for pallabeling... //get layerproperties. Problem: only for pallabeling...
QgsPalLabeling* lbl = dynamic_cast<QgsPalLabeling*>( mMapRenderer->labelingEngine() ); QgsPalLabeling* lbl = dynamic_cast<QgsPalLabeling*>( mMapRenderer->labelingEngine() );
if( !lbl ) if ( !lbl )
{ {
return; return;
} }
Expand All @@ -67,12 +67,12 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId )


//get label field and fill line edit //get label field and fill line edit
QString labelFieldName = vlayer->customProperty( "labeling/fieldName" ).toString(); QString labelFieldName = vlayer->customProperty( "labeling/fieldName" ).toString();
if( !labelFieldName.isEmpty() ) if ( !labelFieldName.isEmpty() )
{ {
mCurrentLabelField = vlayer->fieldNameIndex( labelFieldName ); mCurrentLabelField = vlayer->fieldNameIndex( labelFieldName );
mLabelTextLineEdit->setText( attributeValues[mCurrentLabelField].toString() ); mLabelTextLineEdit->setText( attributeValues[mCurrentLabelField].toString() );
const QgsFieldMap& layerFields = vlayer->pendingFields(); const QgsFieldMap& layerFields = vlayer->pendingFields();
switch( layerFields[mCurrentLabelField].type() ) switch ( layerFields[mCurrentLabelField].type() )
{ {
case QVariant::Double: case QVariant::Double:
mLabelTextLineEdit->setValidator( new QDoubleValidator( this ) ); mLabelTextLineEdit->setValidator( new QDoubleValidator( this ) );
Expand All @@ -82,6 +82,8 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId )
case QVariant::LongLong: case QVariant::LongLong:
mLabelTextLineEdit->setValidator( new QIntValidator( this ) ); mLabelTextLineEdit->setValidator( new QIntValidator( this ) );
break; break;
default:
break;
} }
} }


Expand All @@ -94,17 +96,17 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId )
mBufferColorButton->setColor( layerSettings.textColor ); mBufferColorButton->setColor( layerSettings.textColor );
mLabelDistanceSpinBox->setValue( layerSettings.dist ); mLabelDistanceSpinBox->setValue( layerSettings.dist );
mBufferSizeSpinBox->setValue( layerSettings.bufferSize ); mBufferSizeSpinBox->setValue( layerSettings.bufferSize );
mHaliComboBox->setCurrentIndex( mHaliComboBox->findText("Left") ); mHaliComboBox->setCurrentIndex( mHaliComboBox->findText( "Left" ) );
mValiComboBox->setCurrentIndex( mValiComboBox->findText("Bottom") ); mValiComboBox->setCurrentIndex( mValiComboBox->findText( "Bottom" ) );


disableGuiElements(); disableGuiElements();


mDataDefinedProperties = layerSettings.dataDefinedProperties; mDataDefinedProperties = layerSettings.dataDefinedProperties;
QMap< QgsPalLayerSettings::DataDefinedProperties, int >::const_iterator propIt = mDataDefinedProperties.constBegin(); QMap< QgsPalLayerSettings::DataDefinedProperties, int >::const_iterator propIt = mDataDefinedProperties.constBegin();


for(; propIt != mDataDefinedProperties.constEnd(); ++propIt ) for ( ; propIt != mDataDefinedProperties.constEnd(); ++propIt )
{ {
switch( propIt.key() ) switch ( propIt.key() )
{ {
case QgsPalLayerSettings::Size: case QgsPalLayerSettings::Size:
mFontSizeSpinBox->setEnabled( true ); mFontSizeSpinBox->setEnabled( true );
Expand Down Expand Up @@ -148,7 +150,7 @@ void QgsLabelPropertyDialog::init( const QString& layerId, int featureId )
mRotationSpinBox->setValue( attributeValues[propIt.value()].toDouble() ); mRotationSpinBox->setValue( attributeValues[propIt.value()].toDouble() );
break; break;


//font related properties //font related properties
case QgsPalLayerSettings::Bold: case QgsPalLayerSettings::Bold:
mLabelFont.setBold( attributeValues[propIt.value()].toBool() ); mLabelFont.setBold( attributeValues[propIt.value()].toBool() );
break; break;
Expand Down Expand Up @@ -247,8 +249,8 @@ void QgsLabelPropertyDialog::on_mRotationSpinBox_valueChanged( double d )
void QgsLabelPropertyDialog::on_mFontPushButton_clicked() void QgsLabelPropertyDialog::on_mFontPushButton_clicked()
{ {
bool ok; bool ok;
mLabelFont = QFontDialog::getFont( &ok, mLabelFont, 0, tr("Label font") ); mLabelFont = QFontDialog::getFont( &ok, mLabelFont, 0, tr( "Label font" ) );
if( ok ) if ( ok )
{ {
insertChangedValue( QgsPalLayerSettings::Size, mLabelFont.pointSizeF() ); insertChangedValue( QgsPalLayerSettings::Size, mLabelFont.pointSizeF() );
insertChangedValue( QgsPalLayerSettings::Bold, mLabelFont.bold() ); insertChangedValue( QgsPalLayerSettings::Bold, mLabelFont.bold() );
Expand All @@ -259,8 +261,12 @@ void QgsLabelPropertyDialog::on_mFontPushButton_clicked()


void QgsLabelPropertyDialog::on_mFontColorButton_clicked() void QgsLabelPropertyDialog::on_mFontColorButton_clicked()
{ {
QColor c = QColorDialog::getColor ( mFontColorButton->color(), 0, tr("Font color"), QColorDialog::ShowAlphaChannel ); #if QT_VERSION >= 0x040500
if( c.isValid() ) QColor c = QColorDialog::getColor( mFontColorButton->color(), 0, tr( "Font color" ), QColorDialog::ShowAlphaChannel );
#else
QColor c = QColorDialog::getColor( mFontColorButton->color() );
#endif
if ( c.isValid() )
{ {
mFontColorButton->setColor( c ); mFontColorButton->setColor( c );
insertChangedValue( QgsPalLayerSettings::Color, c.name() ); insertChangedValue( QgsPalLayerSettings::Color, c.name() );
Expand All @@ -269,8 +275,12 @@ void QgsLabelPropertyDialog::on_mFontColorButton_clicked()


void QgsLabelPropertyDialog::on_mBufferColorButton_clicked() void QgsLabelPropertyDialog::on_mBufferColorButton_clicked()
{ {
QColor c = QColorDialog::getColor ( mBufferColorButton->color(), 0, tr("Buffer color"), QColorDialog::ShowAlphaChannel ); #if QT_VERSION >= 0x040500
if( c.isValid() ) QColor c = QColorDialog::getColor( mBufferColorButton->color(), 0, tr( "Buffer color" ), QColorDialog::ShowAlphaChannel );
#else
QColor c = QColorDialog::getColor( mBufferColorButton->color() );
#endif
if ( c.isValid() )
{ {
mFontColorButton->setColor( c ); mFontColorButton->setColor( c );
insertChangedValue( QgsPalLayerSettings::BufferColor, c.name() ); insertChangedValue( QgsPalLayerSettings::BufferColor, c.name() );
Expand All @@ -287,18 +297,18 @@ void QgsLabelPropertyDialog::on_mValiComboBox_currentIndexChanged( const QString
insertChangedValue( QgsPalLayerSettings::Vali, text ); insertChangedValue( QgsPalLayerSettings::Vali, text );
} }


void QgsLabelPropertyDialog::on_mLabelTextLineEdit_textChanged ( const QString& text ) void QgsLabelPropertyDialog::on_mLabelTextLineEdit_textChanged( const QString& text )
{ {
if( mCurrentLabelField != -1 ) if ( mCurrentLabelField != -1 )
{ {
mChangedProperties.insert( mCurrentLabelField, text ); mChangedProperties.insert( mCurrentLabelField, text );
} }
} }


void QgsLabelPropertyDialog::insertChangedValue( QgsPalLayerSettings::DataDefinedProperties p, QVariant value ) void QgsLabelPropertyDialog::insertChangedValue( QgsPalLayerSettings::DataDefinedProperties p, QVariant value )
{ {
QMap< QgsPalLayerSettings::DataDefinedProperties, int >::const_iterator ddIt = mDataDefinedProperties.find( p ); QMap< QgsPalLayerSettings::DataDefinedProperties, int >::const_iterator ddIt = mDataDefinedProperties.find( p );
if( ddIt != mDataDefinedProperties.constEnd() ) if ( ddIt != mDataDefinedProperties.constEnd() )
{ {
mChangedProperties.insert( ddIt.value(), value ); mChangedProperties.insert( ddIt.value(), value );
} }
Expand Down

0 comments on commit 2f572cf

Please sign in to comment.