Skip to content

Commit

Permalink
Merge branch 'master' into expression-builder-highlighter
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Dec 30, 2011
2 parents de48504 + 3c9d1a3 commit 9b93f9b
Show file tree
Hide file tree
Showing 10 changed files with 1,859 additions and 1,596 deletions.
2,913 changes: 1,566 additions & 1,347 deletions i18n/qgis_et.ts

Large diffs are not rendered by default.

29 changes: 26 additions & 3 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -169,9 +169,17 @@ int QgsLegend::addGroup( QString name, bool expand, QTreeWidgetItem* parent )
QgsLegendGroup *group;

if ( parentGroup )
{
group = new QgsLegendGroup( parentGroup, name );
}
else
{
group = new QgsLegendGroup( this, name );
if ( currentItem() )
{
moveItem( group, currentItem() );
}
}

QModelIndex groupIndex = indexFromItem( group );
setExpanded( groupIndex, expand );
Expand Down Expand Up @@ -808,19 +816,34 @@ void QgsLegend::addLayer( QgsMapLayer * layer )
blockSignals( false );

QgsLegendGroup *lg = dynamic_cast<QgsLegendGroup *>( currentItem() );
QSettings settings;
if ( !lg && currentItem() )
{
lg = dynamic_cast<QgsLegendGroup *>( currentItem()->parent() );
}

int index;
if ( lg )
{
index = lg->indexOfChild( currentItem() );
}
else
{
index = indexOfTopLevelItem( currentItem() );
}

if ( index < 0 )
{
index = 0;
}

QSettings settings;
if ( lg && settings.value( "/qgis/addNewLayersToCurrentGroup", false ).toBool() )
{
lg->insertChild( 0, llayer );
lg->insertChild( index, llayer );
}
else
{
insertTopLevelItem( 0, llayer );
insertTopLevelItem( index, llayer );
setCurrentItem( llayer );
}

Expand Down
14 changes: 14 additions & 0 deletions src/app/qgsaddattrdialog.cpp
Expand Up @@ -20,13 +20,16 @@
#include "qgsvectordataprovider.h"
#include "qgslogger.h"

#include <QMessageBox>

QgsAddAttrDialog::QgsAddAttrDialog( QgsVectorLayer *vlayer, QWidget *parent, Qt::WFlags fl )
: QDialog( parent, fl )
{
setupUi( this );

//fill data types into the combo box
const QList< QgsVectorDataProvider::NativeType > &typelist = vlayer->dataProvider()->nativeTypes();
mLayerType = vlayer->storageType();

for ( int i = 0; i < typelist.size(); i++ )
{
Expand Down Expand Up @@ -70,6 +73,17 @@ void QgsAddAttrDialog::on_mTypeBox_currentIndexChanged( int idx )
mPrec->setValue( mPrec->maximum() );
}

void QgsAddAttrDialog::accept()
{
if ( mLayerType == "ESRI Shapefile" && mNameEdit->text().toLower() == "shape" )
{
QMessageBox::warning( this, tr( "Warning" ),
tr( "Invalid field name. This field name is reserved and cannot be used." ) );
return;
}
QDialog::accept();
}

QgsField QgsAddAttrDialog::field() const
{
QgsDebugMsg( QString( "idx:%1 name:%2 type:%3 typeName:%4 length:%5 prec:%6 comment:%7" )
Expand Down
4 changes: 4 additions & 0 deletions src/app/qgsaddattrdialog.h
Expand Up @@ -37,6 +37,10 @@ class QgsAddAttrDialog: public QDialog, private Ui::QgsAddAttrDialogBase

public slots:
void on_mTypeBox_currentIndexChanged( int idx );
void accept();

private:
QString mLayerType;

};

Expand Down
7 changes: 5 additions & 2 deletions src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -455,15 +455,18 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString theProj4String

if ( myRecord.empty() )
{
// match all arameters individually:
// match all parameters individually:
// - order of parameters doesn't matter
// - found definition may have more parameters (like +towgs84 in GDAL)
// - retry without datum, if no match is found (looks like +datum<>WGS84 was dropped in GDAL)

QString sql = "SELECT * FROM tbl_srs WHERE ";
QString delim = "";
QString datum;
foreach( QString param, theProj4String.split( " ", QString::SkipEmptyParts ) )

// split on spaces followed by a plus sign (+) to deal
// also with parameters containing spaces (e.g. +nadgrids)
foreach( QString param, theProj4String.split( QRegExp( "\\s+(?=\\+)" ), QString::SkipEmptyParts ) )
{
QString arg = QString( "' '||parameters||' ' LIKE %1" ).arg( quotedValue( QString( "% %1 %" ).arg( param ) ) );
if ( param.startsWith( "+datum=" ) )
Expand Down
12 changes: 4 additions & 8 deletions src/gui/qgsexpressionbuilderwidget.cpp
Expand Up @@ -42,15 +42,11 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent )

expressionTree->setContextMenuPolicy( Qt::CustomContextMenu );
connect( expressionTree, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( showContextMenu( const QPoint & ) ) );
connect( btnPlusPushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
connect( btnMinusPushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
connect( btnDividePushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
connect( btnMultiplyPushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
connect( btnExpButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
connect( btnConcatButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
connect( btnOpenBracketPushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
connect( btnCloseBracketPushButton, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );

foreach (QPushButton* button, this->mOperatorsGroupBox->findChildren<QPushButton *>())
{
connect( button, SIGNAL( pressed() ), this, SLOT( operatorButtonClicked() ) );
}

// TODO Can we move this stuff to QgsExpression, like the functions?
registerItem( tr( "Operators" ), "+", " + " );
Expand Down
7 changes: 7 additions & 0 deletions src/ui/qgsexpressionbuilder.ui
Expand Up @@ -283,6 +283,13 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="btnEqualPushButton">
<property name="text">
<string>=</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnPlusPushButton">
<property name="sizePolicy">
Expand Down
144 changes: 71 additions & 73 deletions tests/testdata/lines.qml
@@ -1,75 +1,73 @@
<!DOCTYPE qgis PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'>
<qgis version="0.9.2-Ganymede" minimumScale="1" maximumScale="1e+08" hasScaleBasedVisibilityFlag="0" geometry="Line" type="vector" >
<id>lines20080110101725388</id>
<datasource>/Users/timlinux/dev/cpp/qgis_qml/tests/testdata/lines.shp</datasource>
<layername>lines</layername>
<srs>
<spatialrefsys>
<proj4>+proj=longlat +ellps=WGS84 +no_defs</proj4>
<srsid>1449</srsid>
<srid>4031</srid>
<epsg>4031</epsg>
<description>Unknown datum based upon the GEM 10C ellipsoid</description>
<projectionacronym>longlat</projectionacronym>
<ellipsoidacronym>WGS84</ellipsoidacronym>
<geographicflag>true</geographicflag>
</spatialrefsys>
</srs>
<transparencyLevelInt>255</transparencyLevelInt>
<provider>ogr</provider>
<encoding>System</encoding>
<classificationattribute>Name</classificationattribute>
<displayfield>Name</displayfield>
<label>0</label>
<attributeactions/>
<uniquevalue>
<classificationfield>0</classificationfield>
<symbol>
<lowervalue>Arterial</lowervalue>
<uppervalue></uppervalue>
<label></label>
<pointsymbol>hard:circle</pointsymbol>
<pointsize>11</pointsize>
<rotationclassificationfield>-1</rotationclassificationfield>
<scaleclassificationfield>-1</scaleclassificationfield>
<outlinecolor red="154" blue="116" green="139" />
<outlinestyle>DashDotDotLine</outlinestyle>
<outlinewidth>5</outlinewidth>
<fillcolor red="0" blue="0" green="0" />
<fillpattern>NoBrush</fillpattern>
<texturepath></texturepath>
</symbol>
<symbol>
<lowervalue>Highway</lowervalue>
<uppervalue></uppervalue>
<label></label>
<pointsymbol>hard:circle</pointsymbol>
<pointsize>11</pointsize>
<rotationclassificationfield>-1</rotationclassificationfield>
<scaleclassificationfield>-1</scaleclassificationfield>
<outlinecolor red="94" blue="55" green="89" />
<outlinestyle>SolidLine</outlinestyle>
<outlinewidth>7</outlinewidth>
<fillcolor red="0" blue="0" green="0" />
<fillpattern>NoBrush</fillpattern>
<texturepath></texturepath>
</symbol>
</uniquevalue>
<labelattributes>
<label field="" text="Label" />
<family field="" name="Lucida Grande" />
<size field="" units="pt" value="12" />
<bold field="" on="0" />
<italic field="" on="0" />
<underline field="" on="0" />
<color field="" red="0" blue="0" green="0" />
<x field="" />
<y field="" />
<offset x="0" y="0" yfield="-1" xfield="-1" units="pt" />
<angle field="" value="0" />
<alignment field="-1" value="center" />
<buffercolor field="" red="255" blue="255" green="255" />
<buffersize field="" units="pt" value="1" />
<bufferenabled field="" on="" />
</labelattributes>
<qgis version="1.9.90-Alpha" minimumScale="1" maximumScale="1e+08" minLabelScale="1" maxLabelScale="1e+08" hasScaleBasedVisibilityFlag="0" scaleBasedLabelVisibilityFlag="0">
<transparencyLevelInt>255</transparencyLevelInt>
<classificationattribute>Name</classificationattribute>
<uniquevalue>
<classificationfield>Name</classificationfield>
<symbol>
<lowervalue>Arterial</lowervalue>
<uppervalue></uppervalue>
<label></label>
<pointsymbol>hard:circle</pointsymbol>
<pointsize>11</pointsize>
<pointsizeunits>pixels</pointsizeunits>
<rotationclassificationfieldname></rotationclassificationfieldname>
<scaleclassificationfieldname></scaleclassificationfieldname>
<symbolfieldname></symbolfieldname>
<outlinecolor red="154" blue="116" green="139"/>
<outlinestyle>DashDotDotLine</outlinestyle>
<outlinewidth>5</outlinewidth>
<fillcolor red="0" blue="0" green="0"/>
<fillpattern>NoBrush</fillpattern>
<texturepath></texturepath>
</symbol>
<symbol>
<lowervalue>Highway</lowervalue>
<uppervalue></uppervalue>
<label></label>
<pointsymbol>hard:circle</pointsymbol>
<pointsize>11</pointsize>
<pointsizeunits>pixels</pointsizeunits>
<rotationclassificationfieldname></rotationclassificationfieldname>
<scaleclassificationfieldname></scaleclassificationfieldname>
<symbolfieldname></symbolfieldname>
<outlinecolor red="94" blue="55" green="89"/>
<outlinestyle>SolidLine</outlinestyle>
<outlinewidth>7</outlinewidth>
<fillcolor red="0" blue="0" green="0"/>
<fillpattern>NoBrush</fillpattern>
<texturepath></texturepath>
</symbol>
</uniquevalue>
<customproperties/>
<displayfield>Name</displayfield>
<label>0</label>
<labelattributes>
<label fieldname="" text="Label"/>
<family fieldname="" name="Lucida Grande"/>
<size fieldname="" units="pt" value="12"/>
<bold fieldname="" on="0"/>
<italic fieldname="" on="0"/>
<underline fieldname="" on="0"/>
<strikeout fieldname="" on="0"/>
<color fieldname="" red="0" blue="0" green="0"/>
<x fieldname=""/>
<y fieldname=""/>
<offset x="0" y="0" units="pt" yfieldname="" xfieldname=""/>
<angle fieldname="" value="0" auto="0"/>
<alignment fieldname="" value="center"/>
<buffercolor fieldname="" red="255" blue="255" green="255"/>
<buffersize fieldname="" units="pt" value="1"/>
<bufferenabled fieldname="" on=""/>
<multilineenabled fieldname="" on=""/>
<selectedonly on=""/>
</labelattributes>
<edittypes>
<edittype type="0" name="Name"/>
<edittype type="0" name="Value"/>
</edittypes>
<editform></editform>
<editforminit></editforminit>
<annotationform></annotationform>
<attributeactions/>
</qgis>

0 comments on commit 9b93f9b

Please sign in to comment.