Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/qgis/Quantum-GIS
Browse files Browse the repository at this point in the history
  • Loading branch information
volaya committed Jan 7, 2013
2 parents e59de66 + 7e29d7c commit 964e842
Show file tree
Hide file tree
Showing 40 changed files with 5,105 additions and 4,673 deletions.
74 changes: 37 additions & 37 deletions doc/TRANSLATORS

Large diffs are not rendered by default.

2,806 changes: 1,172 additions & 1,634 deletions i18n/qgis_de.ts

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions python/core/qgsapplication.sip
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
//! @note added in 1.4
static const QStringList svgPaths();

//! Returns the system environment variables passed to application.
//! @note added in 1.9
static const QMap<QString, QString> systemEnvVars();

//! Returns the path to the application prefix directory.
static const QString prefixPath();

Expand Down
3 changes: 3 additions & 0 deletions python/core/qgsmaplayerregistry.sip
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class QgsMapLayerRegistry : QObject
//! Retrieve a pointer to a loaded layer by id
QgsMapLayer *mapLayer( QString theLayerId );

//! Retrieve all layers using their name
QList<QgsMapLayer *> mapLayersByName( QString layerName );

//! Retrieve the mapLayers collection (mainly intended for use by projection)
QMap<QString, QgsMapLayer*> & mapLayers();

Expand Down
7 changes: 5 additions & 2 deletions python/core/qgsvectorlayerimport.sip
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class QgsVectorLayerImport
%TypeHeaderCode
#include <qgsvectorlayerimport.h>
#include <qgsfield.h>
class QProgressDialog;
%End

public:
Expand Down Expand Up @@ -37,7 +38,8 @@ class QgsVectorLayerImport
bool onlySelected = false,
QString *errorMessage /Out/ = 0,
bool skipAttributeCreation = false,
QMap<QString, QVariant> *options = 0
QMap<QString, QVariant> *options = 0,
QProgressDialog *progress = 0
);

/** create a empty layer and add fields to it */
Expand All @@ -47,7 +49,8 @@ class QgsVectorLayerImport
QGis::WkbType geometryType,
const QgsCoordinateReferenceSystem* crs,
bool overwrite = false,
const QMap<QString, QVariant> *options = 0
const QMap<QString, QVariant> *options = 0,
QProgressDialog *progress = 0
);

/** checks whether there were any errors */
Expand Down
4 changes: 2 additions & 2 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ SET(QGIS_APP_SRCS
qgsmeasuretool.cpp
qgsmergeattributesdialog.cpp
qgsoptions.cpp
qgspastetransformations.cpp
#qgspastetransformations.cpp
qgspointrotationitem.cpp
qgspluginitem.cpp
qgspluginmanager.cpp
Expand Down Expand Up @@ -244,7 +244,7 @@ SET (QGIS_APP_MOC_HDRS
qgsmeasuretool.h
qgsmergeattributesdialog.h
qgsoptions.h
qgspastetransformations.h
#qgspastetransformations.h
qgspluginmanager.h
qgsprojectlayergroupdialog.h
qgsprojectproperties.h
Expand Down
54 changes: 54 additions & 0 deletions src/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,60 @@ int main( int argc, char *argv[] )

QSettings mySettings;

// custom environment variables
QMap<QString, QString> systemEnvVars = QgsApplication::systemEnvVars();
bool useCustomVars = mySettings.value( "qgis/customEnvVarsUse", QVariant( false ) ).toBool();
if ( useCustomVars )
{
QStringList customVarsList = mySettings.value( "qgis/customEnvVars", "" ).toStringList();
if ( !customVarsList.isEmpty() )
{
foreach ( const QString &varStr, customVarsList )
{
int pos = varStr.indexOf( QLatin1Char( '|' ) );
if ( pos == -1 )
continue;
QString envVarApply = varStr.left( pos );
QString varStrNameValue = varStr.mid( pos + 1 );
pos = varStrNameValue.indexOf( QLatin1Char( '=' ) );
if ( pos == -1 )
continue;
QString envVarName = varStrNameValue.left( pos );
QString envVarValue = varStrNameValue.mid( pos + 1 );

if ( systemEnvVars.contains( envVarName ) )
{
if ( envVarApply == "prepend" )
{
envVarValue += systemEnvVars.value( envVarName );
}
else if ( envVarApply == "append" )
{
envVarValue = systemEnvVars.value( envVarName ) + envVarValue;
}
}

if ( systemEnvVars.contains( envVarName ) && envVarApply == "unset" )
{
#ifdef Q_WS_WIN
putenv( envVarName.toUtf8().constData() );
#else
unsetenv( envVarName.toUtf8().constData() );
#endif
}
else
{
#ifdef Q_WS_WIN
if ( envVarApply != "undefined" || !getenv( envVarName.toUtf8().constData() ) )
putenv( QString( "%1=%2" ).arg( envVarName ).arg( envVarValue ).toUtf8().constData() );
#else
setenv( envVarName.toUtf8().constData(), envVarValue.toUtf8().constData(), envVarApply == "undefined" ? 0 : 1 );
#endif
}
}
}
}

// Set the application style. If it's not set QT will use the platform style except on Windows
// as it looks really ugly so we use QPlastiqueStyle.
QString style = mySettings.value( "/qgis/style" ).toString();
Expand Down
12 changes: 8 additions & 4 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
#include "qgsmultibandcolorrenderer.h"
#include "qgsnewvectorlayerdialog.h"
#include "qgsoptions.h"
#include "qgspastetransformations.h"
// #include "qgspastetransformations.h"
#include "qgspluginitem.h"
#include "qgspluginlayer.h"
#include "qgspluginlayerregistry.h"
Expand Down Expand Up @@ -3330,11 +3330,12 @@ bool QgisApp::addProject( QString projectFile )

if ( ! QgsProject::instance()->read( projectFile ) )
{
QApplication::restoreOverrideCursor();

QMessageBox::critical( this,
tr( "Unable to open project" ),
QgsProject::instance()->error() );

QApplication::restoreOverrideCursor();

mMapCanvas->freeze( false );
mMapCanvas->refresh();
Expand Down Expand Up @@ -4964,11 +4965,13 @@ void QgisApp::editPaste( QgsMapLayer *destinationLayer )

QHash<int, int> remap;
const QgsFieldMap &fields = clipboard()->fields();
QgsAttributeList pkAttrList = pasteVectorLayer->pendingPkAttributesList();
for ( QgsFieldMap::const_iterator it = fields.begin(); it != fields.end(); it++ )
{
int dst = pasteVectorLayer->fieldNameIndex( it->name() );
if ( dst < 0 )
if ( dst < 0 || pkAttrList.contains( dst ) )
{
// skip primary key attributes
continue;
}
remap.insert( it.key(), dst );
Expand Down Expand Up @@ -5064,6 +5067,7 @@ void QgisApp::pasteStyle( QgsMapLayer * destinationLayer )
}
}

#if 0
void QgisApp::pasteTransformations()
{
QgsPasteTransformations *pt = new QgsPasteTransformations();
Expand All @@ -5072,7 +5076,7 @@ void QgisApp::pasteTransformations()

pt->exec();
}

#endif

void QgisApp::refreshMapCanvas()
{
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
//! Read Well Known Binary stream from PostGIS
//void readWKB(const char *, QStringList tables);
//! shows the paste-transformations dialog
void pasteTransformations();
// void pasteTransformations();
//! check to see if file is dirty and if so, prompt the user th save it
bool saveDirty();
/** Helper function to union several geometries together (used in function mergeSelectedFeatures)
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgsbrowserdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "qgsrasterlayer.h"
#include "qgsvectorlayer.h"
#include "qgisapp.h"
#include "qgsproject.h"

// browser layer properties dialog
#include "qgsapplication.h"
Expand Down Expand Up @@ -285,6 +286,10 @@ void QgsBrowserDockWidget::showEvent( QShowEvent * e )
if ( item && item->type() == QgsDataItem::Favourites )
mBrowserView->expand( index );
}

connect( QgsProject::instance(), SIGNAL( readProject( const QDomDocument & ) ), mModel, SLOT( reload() ) );
connect( QgsProject::instance(), SIGNAL( writeProject( QDomDocument & ) ), mModel, SLOT( reload() ) );
connect( QgisApp::instance(), SIGNAL( newProject() ), mModel, SLOT( reload() ) );
}

QDockWidget::showEvent( e );
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsfieldsproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ QgsAttributeEditorElement* QgsFieldsProperties::createAttributeEditorWidget( QTr

if ( item->data( 0, Qt::UserRole ) == "field" )
{
int idx = *mLayer->dataProvider()->fieldNameMap().find( item->text( 0 ) );
int idx = *( mLayer->dataProvider()->fieldNameMap() ).find( item->text( 0 ) );
widgetDef = new QgsAttributeEditorField( item->text( 0 ), idx, parent );
}
else
Expand Down
16 changes: 11 additions & 5 deletions src/app/qgsmergeattributesdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ void QgsMergeAttributesDialog::createTableWidgetContents()

//create combo boxes and insert attribute names
const QgsFieldMap& fieldMap = mVectorLayer->pendingFields();
QgsAttributeList pkAttrList = mVectorLayer->pendingPkAttributesList();

int col = 0;
for ( QgsFieldMap::const_iterator fieldIt = fieldMap.constBegin();
Expand All @@ -96,7 +97,12 @@ void QgsMergeAttributesDialog::createTableWidgetContents()

mTableWidget->setColumnCount( col + 1 );

mTableWidget->setCellWidget( 0, col, createMergeComboBox( fieldIt->type() ) );
QComboBox *cb = createMergeComboBox( fieldIt->type() );
if ( pkAttrList.contains( fieldIt.key() ) )
{
cb->setCurrentIndex( cb->findText( tr( "Skip attribute" ) ) );
}
mTableWidget->setCellWidget( 0, col, cb );

QTableWidgetItem *item = new QTableWidgetItem( fieldIt.value().name() );
item->setData( Qt::UserRole, fieldIt.key() );
Expand Down Expand Up @@ -135,14 +141,14 @@ void QgsMergeAttributesDialog::createTableWidgetContents()
}
}

QComboBox* QgsMergeAttributesDialog::createMergeComboBox( QVariant::Type columnType ) const
QComboBox *QgsMergeAttributesDialog::createMergeComboBox( QVariant::Type columnType ) const
{
QComboBox* newComboBox = new QComboBox();
QComboBox *newComboBox = new QComboBox();
//add items for feature
QgsFeatureList::const_iterator f_it = mFeatureList.constBegin();
for ( ; f_it != mFeatureList.constEnd(); ++f_it )
{
newComboBox->addItem( tr( "feature %1" ).arg( f_it->id() ) );
newComboBox->addItem( tr( "Feature %1" ).arg( f_it->id() ) );
}

if ( columnType == QVariant::Double || columnType == QVariant::Int )
Expand Down Expand Up @@ -183,7 +189,7 @@ int QgsMergeAttributesDialog::findComboColumn( QComboBox* c ) const
void QgsMergeAttributesDialog::comboValueChanged( const QString &text )
{
Q_UNUSED( text );
QComboBox* senderComboBox = qobject_cast<QComboBox *>( sender() );
QComboBox *senderComboBox = qobject_cast<QComboBox *>( sender() );
if ( !senderComboBox )
{
return;
Expand Down
Loading

0 comments on commit 964e842

Please sign in to comment.